Inline Script in Flow Designer not working

Sattyaki1
Tera Expert

I am trying to use the Inline Script in Flow Designer. I am trying to create an hr_case record with Create Record action and set the value of its Category field with inline script. Below is the screenshot and the code

find_real_file.png

/*
**Access Flow/Action data using the fd_data object. Script must return a value.
**example: var shortDesc = fd_data.trigger.current.short_description;
**return shortDesc;
*/
gs.log('flow');
var v = fd_data.trigger.inbound_email.direct.toString();
if (v == 'satt@gmail.com') {
    gs.info('flow script');
    var gr = new GlideRecord('hr_category');
    gr.addQuery('name', 'XYZ');
    gr.addQuery('active', true);
    gr.query();
    gs.info('gr val: ' + gr.hasNext());
    if (gr.next()) {
        return gr.sys_id;
    }
}

It is not even executing the first line "gs.log('flow')" as I can not see that in the logs. Please let me know what I am doing wrong.

1 ACCEPTED SOLUTION

It is fixed in NY Patch 7

View solution in original post

15 REPLIES 15

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hi,

Please note that you should replace gs.log with gs.info if the flow is created in a scoped app.

 

- Pradeep Sharma

Hi Pradeep,

I have tried that also but it didn't work either. I don't think the problem is related to that. When I am trying the same thing in my personal instance it is working fine. The logs are also coming. Also the the auto completion is working in my PDI which is not working in our company instance. Below is the screenshot from my PDI

find_real_file.png

What can be the cause of this issue?

 

Thanks.

Hi Are you sure, that your flow was triggered and executed at all? BR Dirk

Hi Dirk,

Yes my flow was triggered and created the hr_case record. Values of all other fields were set properly except the one which I was trying using inline script option.

The surprising thing is that the same script is working properly in my personal instance.

Thanks.