We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

Script is returning null in flow designer

Nagendra Babu32
Tera Contributor

Hi all,

 

I created a flow as shown in below image .

 

NagendraBabu32_4-1711091430459.png

 

 

In create catalog task, I tried to set the field assignment group through scripting to get the group value from decision table but it was returning null for below code::

 

var UserCompany = fd_data._1__get_catalog_variables.requested_for.company.sys_id;
var UserCountry = fd_data._1__get_catalog_variables.requested_for.country;
var dt = new sn_dt.DecisionTableAPI();
    var inputs = new Object();
    // define decision inputs
    //if(current.request_item.variables.itss_std_vsvar_requested_for){
    inputs['u_company'] = fd_data.trigger.request_item.requested_for.company.sys_id;
    inputs['u_country'] = fd_data.trigger.request_item.requested_for.country;
    // make decision
    var assignment = dt.getDecision('5a9fe9862f0102106d9a49e72799b66f', inputs);
    return assignment.sys_id;
NagendraBabu32_6-1711091705415.jpeg

 

 

 

 

 

I tried of getting same group name through decision table in fix script . It was returning the group sys_id.

NagendraBabu32_0-1711091258553.png

 

NagendraBabu32_2-1711091329461.png

 

 

Please Can anyone suggest what I was missing in the code?

 

 

7 REPLIES 7

Not applicable

In which step of your Flow do you get the actual decision? Are you working with a "Get Decision" step somewhere?

NagendraBabu32_0-1711099792067.png

 

NagendraBabu32_0-1711100151179.png

 

Not applicable

So why are you not using the generic "Get Decision" step?