Service Manager / Service Center Practitioners Forum
Showing results for 
Search instead for 
Do you mean 

Calling script.execute from formatctrl

SOLVED
Go to Solution
Regular Advisor

Calling script.execute from formatctrl

I am calling script.execute from formatctrl ("rootcause")

 

in the script i am assigning a thread variable to the description with the timestamp and full name of the operator

 

$deschist=str(tod())+" ("+$lo.ufname+"):";description in $script=insert(denull(description in $script), 1, 1, $description.txt);description in $script=insert(description in $script, 1, 1, $deschist))

 

the problem here is, when i click add to create a Problem record, i can see the description field having the correct value, but after problem is created if i click Cancel and back out of screen and come back again the description field is empty

 

I found out that the Problem is actually getting saved before the script is executed from rootcause formatctrl. Is there a way to change the sequence ? Is it how this always works ?

5 REPLIES
Honored Contributor Honored Contributor

Re: Calling script.execute from formatctrl

In the subroutine line where you call script.execute, make sure the Before property is set to true. (If not true, the subroutine will execute after record save)

----------------------------------------------------
Kudos - what, where, how, and why
Want Good Answers? Ask Good Questions...
Regular Advisor

Re: Calling script.execute from formatctrl

So what is the difference in making the Save First option as true against the Save action in the State record as against making the before as tru in subroutine ?

Honored Contributor Honored Contributor

Re: Calling script.execute from formatctrl

Did you adjust the value of the "Before" condition? did it work?

----------------------------------------------------
Kudos - what, where, how, and why
Want Good Answers? Ask Good Questions...
Regular Advisor

Re: Calling script.execute from formatctrl

Yes it worked , when i made the subroutine, Before condition as true

But it also worked when i made the Save First as true, against the action Save in the State record

 

Just curios to understand what the difference is what the adv/dis adv are

Highlighted
Honored Contributor Honored Contributor

Re: Calling script.execute from formatctrl

Well, format control pre-dates the existence of the document engine (and state level processing), so prior to all modules being migrated to the doc engine (in versions 4, 5, and 5.1) the format control option was primary. 

 

It appears that the document engine state "save first" will perform a similar function, but iI don't really know exactly how the state level "save first" interacts with format control. You'd have to run a RAD trace to get the complete flow or map through the RAD stack to be sure. 

 

----------------------------------------------------
Kudos - what, where, how, and why
Want Good Answers? Ask Good Questions...