workflow to script include

servicenow14710
Tera Expert

Hello developers, i need to p send workflow scratchpad variables to script include without function call. is this possible that i can use workflow variables in script include. ANy help is appreciated, Thanks!

3 REPLIES 3

sadif_raja
Tera Guru

Hello,

Yes, it's possible to access workflow scratchpad variables in a Script Include, but typically not directly without some interaction. Workflow scratchpad variables are stored in the current workflow context, so if you're working within the same session or context, you can pass the variables indirectly to your Script Include. Here's a general approach:

  1. Use workflow.scratchpad: If you're within the same workflow or calling the Script Include from a Workflow Activity, you can pass the workflow.scratchpad values as parameters to your Script Include.

  2. Access from current context: If you're using a Business Rule or a Script Include triggered by the workflow, you can access the variables from the current object and then pass them to your Script Include.

  3. Global scratchpad object: You can also use a global variable to store scratchpad values, which can then be accessed by the Script Include. Though this method isn't recommended due to potential security and maintenance issues, it's a workaround.

Without making a direct function call, you'll need to make sure there's a way to pass or reference the scratchpad values, usually during the transition from workflow to other parts of the system.

Hope this helps! Let me know if you need more specifics.

Best regards,
Raja 

SanjivMeher
Kilo Patron
Kilo Patron

No. You can't pass the variables to a script include without passing the variables in the functions.

Could you please elaborate, what is your use case?


Please mark this response as correct or helpful if it assisted you with your question.

Hello @sanjivmehr : based on approved/rejected i need to pass workflow scratchpad values to s.i, when rejected these will be empty so in function call empty parameter will be sent so is there any workaround. Thanks!