Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Monday, July 7, 2025 
 
slxdeveloper.com Community Forums  
   
The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
 Architect Forums - SalesLogix Scripting & Customization
Forum to discuss writing script in Architect plugins for SalesLogix & general SalesLogix customization topics (for Windows client only). View the code of conduct for posting guidelines.
Forums RSS Feed


 Back to Forum List | Back to SalesLogix Scripting & Customization | New ThreadView:  Search:  
 Author  Thread: Sleep
Sankar
Posts: 84
 
SleepYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 18 May 10 10:55 AM
How do i make saleslogix wait for a while like 5 sec. I am on version 7.2.
i tried wscript.sleep 5000. its not working. it says variable not defined for wscript.

please help.

thanks
Uma Sankar
[Reply][Quote]
Karlin High
Posts: 9
 
Re: SleepYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 18 May 10 2:32 PM
This is clumsy, but should work: write a loop that keeps calling Application.DoEvents until the desired amount of time has passed. You can use the Now and DateAdd functions to find the current time, add 5 seconds to it, and then loop until that value is less than the value returned by the Now function.

Unless someone else knows a better way...
[Reply][Quote]
Raul A. Chavez
Posts: 1300
Top 10 forum poster: 1300 posts
 
Re: SleepYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 19 May 10 12:08 AM
The main question here is why do you need to sleep for 5 seconds.
Are you waiting for some external process? Or are you looking for the Program to become responsive while doing a lot of work?

Either way, a Loop is not such a good idea as it will use a lot of CPU and would lock the app for those 5 seconds.

If you really need to wait for some events, I would suggest that you put your code inside a form, and then use a Timer Object:
- Add a timer control on the Form.
- Split your code between what needs to happen before, and what needs to happen after the wait
- Set the Interval on the Timer control, and Enable it when you are ready to pause (or go into your "sleep" mode)
- Add the rest of the code to Event handler on the Timer control

Again, depending on what you are doing this may be simple or complex, but the wait won't lock the app, nor cause a spike in CPU.
[Reply][Quote]
Sankar
Posts: 84
 
Re: SleepYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 19 May 10 9:27 AM
We are facing a problem where 2 people are trying to update the same field at the same time. Its the userfield5 of the Contact table, which is later on used for mailmerge by the application and send emails to user.

The first user clicks the email button, the userfield5 is updated with his ticketnumber, and mailmerge process continues after that. after a few lines of code, the mailmerge takes the ticket number from the userfield and inserts some ticket data into the mailmerge document and sends it to the customer.

what is now happaneing is, just before the mail merge takes the userfield's value, somebody else clicks the email button and now the userfield has the new ticketid. because of this, the first user's email has a wrong ticket number now.

this is happening when two people work on two different tickets of the same contact at almost the same time.

I was thinking if i can make the second person wait for a while, when the contact is already being worked on.

any suggestions would be appreciated.

thanks
Uma
[Reply][Quote]
Raul A. Chavez
Posts: 1300
Top 10 forum poster: 1300 posts
 
Re: SleepYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 19 May 10 9:34 AM
Indeed I would suggest that the second person waits for a while, but rather than forcing the Wait via the code looping or sleeping, just go ahead and create a Retry/Cancel loop:

Sub DoSomething
....
Do While FieldStillInUse()
If MsgBox("The xxx is still in use, do you want to retry", vbYesNo) = vbNo then
Exit Sub
End If
Loop

'Out of loop, good to continue
'Do Mail Merge, etc, etc
End Sub

Function FieldStillInUse
'Add your test here, if ok to continue return false
FieldStillInUse = result
End Function
[Reply][Quote]
Sankar
Posts: 84
 
Re: SleepYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 19 May 10 10:30 AM
Yes, Raul..that is what i suggested, but the users want that to be automated. they dont want the users to be clicking message boxes...
[Reply][Quote]
Phil Parkin
Posts: 819
Top 10 forum poster: 819 posts
 
Re: SleepYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 20 May 10 4:51 AM
Why not generate the e-mail from the Ticket - assuming the Ticket is associated with the correct contact - and avoid all this malarkey?
[Reply][Quote]
Sankar
Posts: 84
 
Re: SleepYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 20 May 10 8:25 AM
I am not an expert in mailmerge, but my assumption was mailmerge can be done only from a contact level. Atleast the mailmerge template which was created here is that way.
[Reply][Quote]
Phil Parkin
Posts: 819
Top 10 forum poster: 819 posts
 
Re: SleepYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 20 May 10 8:52 AM
Quote:
Originally posted by Sankar

I am not an expert in mailmerge, but my assumption was mailmerge can be done only from a contact level. Atleast the mailmerge template which was created here is that way.


Your assumption is incorrect - you can mail merge from the context of tickets. But ... I'm not sure about picking up the details of the 'current' ticket in the MM - would have to try it out.

You might also check the code behind the 'E-mail' button on the Ticket Detail form for ideas. Sounds like it would do what you needed, with a bit of tweaking.
[Reply][Quote]
 Page 1 of 1 
  You can subscribe to receive a daily forum digest in your user profile. View the site code of conduct for posting guidelines.

   Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
 

 
 slxdeveloper.com is brought to you courtesy of Ryan Farley & Customer FX Corporation.
 This site, and all contents herein, are Copyright © 2025 Customer FX Corporation. The information and opinions expressed here are not endorsed by Sage Software.

code of conduct | Subscribe to the slxdeveloper.com Latest Article RSS feed
   
 
page cache (param): 7/7/2025 8:36:06 PM