logo

NJP

fd_data not found if your inline script tries to access an action with parentheses in its name

Import · Oct 15, 2021 · article

Pertaining to the Flow Designer:

In a flow or subflow you can use inline scripting to dynamically get or set a value. In this script you can access the outputs of previous steps in the flow using the "fd_data" object like this:

var myString = fd_data._1__ft_testnamesaction_parens.myoutput;

That works great. However, you'll have a problem if the name of an action contains parentheses. Unfortunately, one of the OOTB actions used in the Create Incident OOTB subflow has this characteristic, and if you try to reference that action, your subflow will fail with the error : "fd_data" not defined. Here's what the script editor will generate for you, and it will fail:

gs.info("FRANK: ciornode = " + fd_data._7__calculate_values_(based_on_the_alert).ciornode);

The script editor allows the above (and even prompts you to use it after you type the period after "fd_data". But it will fail, and it's because of the parentheses in the action name. The solution is to change the name of the action to remove the parentheses. After you do that, you need to update your inline script to:

gs.info("FRANK: ciornode = " + fd_data._7__calculate_values_based_on_the_alert.ciornode);

Then it will work.

Please mark this article as helpful if you've found it useful.

View original source

https://www.servicenow.com/community/itom-articles/fd-data-not-found-if-your-inline-script-tries-to-access-an/ta-p/2323148