Internal Server Error in Flow Designer by fd_data is not defined

Dinh Nguyen
Kilo Sage

Hello everyone, 

 I have created a custom action with query group members and return array.string(email of users) as below, it's testing successfully.

DinhNguyen_0-1703460839086.png

Then, i used "Test Get Group Members" in Flow with script as below, and the flow run Internal Server Error

DinhNguyen_1-1703461009550.png

DinhNguyen_2-1703461040672.png

Please someone help me ! Thank you so much

2 ACCEPTED SOLUTIONS

Sainath N
Mega Sage
Mega Sage

@Dinh Nguyen : Please refer the below HI article that describes the steps for this issue. Check if this helps.

 

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0831029

 

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

 


Please mark this as correct answer and helpful if it resolved, or mark this helpful if this help you to reach towards solution.

 

View solution in original post

lcbell44
Giga Expert

You should create a Flow variable to hold your array and set it using the Set Flow Variables Flow Logic. 
the fd_data "object" is not an object and it is used to match a pattern that is replaced before execution with the real object. E.g., fd_data.flow_var.x is replaced with inputs.flow_var_x. You can prove it by using 
gs.log('fd_data.flow_var.x=' + fd_data.flow_var.x , 'my Flow');//this logs inputs.flow_var_x=
FYI you can't use inputs.flow_var_x since it doesn't exist until you use fd_data.flow_var.x, so just use fd_data.flow_var.x
Also, you don't need to name the IIFE or pass the inputs and outputs global objects since they are global and available inside the IIFE. The IIFE can be simply
(function () {
} ) ();

with your code inside. 
Don't try to add undefined variables to the outputs since the pattern matching Logic won't recognize it for replacement.
I also suggest you use String(gr.user.email) since the toString() function returns a Java String and could throw an exception if gr.user.email is null.
Always check the values before using them so your code should be
if(gr.user.email) ar.push(String(gr.user.email) );
Better yet you can put user.email!= (or user.emailISNOTEMPTY) in your query as well as checking the values before using them.

View solution in original post

2 REPLIES 2

Sainath N
Mega Sage
Mega Sage

@Dinh Nguyen : Please refer the below HI article that describes the steps for this issue. Check if this helps.

 

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0831029

 

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

 


Please mark this as correct answer and helpful if it resolved, or mark this helpful if this help you to reach towards solution.

 

lcbell44
Giga Expert

You should create a Flow variable to hold your array and set it using the Set Flow Variables Flow Logic. 
the fd_data "object" is not an object and it is used to match a pattern that is replaced before execution with the real object. E.g., fd_data.flow_var.x is replaced with inputs.flow_var_x. You can prove it by using 
gs.log('fd_data.flow_var.x=' + fd_data.flow_var.x , 'my Flow');//this logs inputs.flow_var_x=
FYI you can't use inputs.flow_var_x since it doesn't exist until you use fd_data.flow_var.x, so just use fd_data.flow_var.x
Also, you don't need to name the IIFE or pass the inputs and outputs global objects since they are global and available inside the IIFE. The IIFE can be simply
(function () {
} ) ();

with your code inside. 
Don't try to add undefined variables to the outputs since the pattern matching Logic won't recognize it for replacement.
I also suggest you use String(gr.user.email) since the toString() function returns a Java String and could throw an exception if gr.user.email is null.
Always check the values before using them so your code should be
if(gr.user.email) ar.push(String(gr.user.email) );
Better yet you can put user.email!= (or user.emailISNOTEMPTY) in your query as well as checking the values before using them.