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!
|
|
Another sales process question  
Posted: 21 Jul 09 4:24 AM
|
Hi All,
Ill keep it short and sweet, i want to display a message box once the user has completed the final step in a sales process. It will used as a reminder to close the opportunity. Im having trouble figuring out how to tell when it is the final step that has been performed.
Thanks in advance |
|
|
|
Re: Another sales process question  
Posted: 21 Jul 09 10:47 AM
|
The DoCompleteStep function gives you the SALESPROCESSAUDITID of the step being completed. So, somewhere in your code you could do the following:
METHOD 1: Use the Highest Stage and Highes Step for last stage -- Get the Number of the Last Stage and retrieve and store in variable called: lastStageNo SELECT MAX(STAGEORDER) FROM SALESPROCESSAUDIT WHERE ENTITYID = myOppID -- Get the Number of the Last Step for the Last Stage and store in variable called: lastStepLastStageNo SELECT MAX(STEPORDER) FROM SALESPROCESSAUDIT WHERE ENTITYID = myOppID AND STAGEORDER = lastStageNo
'Then verify if the SalesProcessAuditID you got matches the last step: SELECT SALESPROCESSAUDITID FROM SALESPROCESSAUDIT WHERE ENTITYID = myOppID AND STAGEORDER = lastStageNo AND STEPORDER = lastStepLastStageNo -- If the ID returned here matches the ID that you got passed into the function, then this s the last step.
METHOD 2 - Use the Sequence field ' The other way around it is to get the step with the highest order: SELECT TOP 1 SALESPROCESSAUDITID FROM SALESPROCESS WHERE ENTITYID = myOppID AND PROCESSTYPE = 'STEP' ORDER BY SEQ DESC ' If the ID returned matches the ID passed into the function, then this is the last step.
|
|
|
| |
|
Re: Another sales process question  
Posted: 22 Jul 09 4:59 AM
|
Hi Raul,
Ive gone through your SQL in the Server Management Studio and everyhting seems to work out great. All i have to do is implement it in the script
As always thanks for your great help |
|
|
|