Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Hi Flow action script execution from custom table

Community Alums
Not applicable

Hi All,

I have a requirement for the script execution in the flow action. We have created a Custom table with a field type as "Script". Now, If any script is written in that field. I need to run that script in the flow action. How can I achieve this? I tried by giving the "input.variable" in the Script flow. But no luck and I tried to call directly the field inside the flow script but also it didn't worked. But when I have written the script in the custom flow action script and defined only 1 input. It worked. Can anyone help me on this? PFA images for ref.

RipunjaiGurava_0-1709033728159.png

RipunjaiGurava_1-1709033922722.png

Thanks,

Ripunjai

1 ACCEPTED SOLUTION

Hi @Community Alums 

 

Let me give you a step by step explanation. Suppose I have a custom table 'u_testing' with a Script type column 'u_inputscript' which has a simple script to return sum of two numbers. Refer below screenshots :

 

AmitVerma_0-1709121702155.png

 

AmitVerma_1-1709121721057.png

 

AmitVerma_2-1709121745178.png

 

AmitVerma_3-1709121766991.png

 

Now if the following script from Scripts-Background, I will get the sum of both the numbers i.e. 6

 

AmitVerma_4-1709121839343.png

 

AmitVerma_5-1709121854184.png

 

We are already passing the GlideRecord reference while calling the evaluateScript method. It expects the GlideRecord reference and the name of the column in which your script resides. Hope it clears your query.

 

Thanks & Regards

Amit Verma


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

View solution in original post

8 REPLIES 8

Community Alums
Not applicable

Hi @Amit Verma ,

But the GlideRecord should be called from the Custom table field. If I directly add the script in the Flow action without any GlideScopedEvaluator the script will execute.

Thanks,

Ripunjai.

Hi @Community Alums 

 

Let me give you a step by step explanation. Suppose I have a custom table 'u_testing' with a Script type column 'u_inputscript' which has a simple script to return sum of two numbers. Refer below screenshots :

 

AmitVerma_0-1709121702155.png

 

AmitVerma_1-1709121721057.png

 

AmitVerma_2-1709121745178.png

 

AmitVerma_3-1709121766991.png

 

Now if the following script from Scripts-Background, I will get the sum of both the numbers i.e. 6

 

AmitVerma_4-1709121839343.png

 

AmitVerma_5-1709121854184.png

 

We are already passing the GlideRecord reference while calling the evaluateScript method. It expects the GlideRecord reference and the name of the column in which your script resides. Hope it clears your query.

 

Thanks & Regards

Amit Verma


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

Community Alums
Not applicable

Hi @Amit Verma ,

Thanks!!! This worked. 🥳

Thanks,

Ripunjai

Community Alums
Not applicable

Hi @Amit Verma ,

Can we fetch the RITM number from the Flow designer script and add in the custom table script? I want to get the variable from the RITM. Is it possible to get it?

I tried by giving putvariable but it did not worked. Any alternative?

RipunjaiGurava_0-1713938582618.png

 

RipunjaiGurava_1-1713938649145.png

Thanks,

Ripunjai