workflow

gaikwadshre
Tera Contributor
Say suppose ,there are two run script activities in a WF ,  i need one value of a variable from run script 1 into the run script 2 how i can do that in workflow ???
2 ACCEPTED SOLUTIONS

Ankur Bawiskar
Tera Patron
Tera Patron

@gaikwadshre 

if you want to use any variable globally in workflow then you need to use workflow scratchpad variable

you need to store the value in workflow scratchpad variable and then access it

Using variables in a workflow 

Run Script 1

workflow.scratchpad.approver = userSysId;

Run Script 2 - access the value

var approver = workflow.scratchpad.approver;

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

@gaikwadshre 

Hope you are doing good.

Did my reply answer your question?

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

3 REPLIES 3

Arun_Manoj
Mega Sage

Hi @gaikwadshre ,

 

Use workflow.scratchpad

// Example: setting a value in script 1
workflow.scratchpad.myValue = 'Script 1';

 

Script 2:

var testValue=workflow.scratchpad.myValue 

 

Please mark my answer as helpful/correct if it resolves your query.

Regards,

Arun Manoj

Ankur Bawiskar
Tera Patron
Tera Patron

@gaikwadshre 

if you want to use any variable globally in workflow then you need to use workflow scratchpad variable

you need to store the value in workflow scratchpad variable and then access it

Using variables in a workflow 

Run Script 1

workflow.scratchpad.approver = userSysId;

Run Script 2 - access the value

var approver = workflow.scratchpad.approver;

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@gaikwadshre 

Hope you are doing good.

Did my reply answer your question?

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader