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.

Issue with location code in flow designer

Srilakshmi7
Tera Contributor

Hello All,

 

I have written a script to get the user location in the flow designer when I tried it the value is undefined. Please help me with the code

 

(function executeRule(current, previous /*null when async*/) {
 
    var userlocation = fd_data.trigger.request_item.Variables.g_form.getValue('src_site_req_for');
    var locationrouting = new GlideRecord('x_ibmip_tktrouting_location_routing');
    locationrouting.addEncodedQuery('u_active!=false^u_location_route_type=FIELD_SERVICES');
    locationrouting.addQuery('u_location',userlocation);
    gs.log('location = '+userlocation,'lak');
    locationrouting.query();
    while (locationrouting.next()) {
        gs.log('while function','lak');
        current.assignment_group = locationrouting.u_group;
        gs.log('assgnment group = '+current.assignment_group,'lak');    
        update();
    }
   
})(current, previous);

 

 

 

4 REPLIES 4

Danish Bhairag2
Tera Sage

Hi @Srilakshmi7 ,

 

Can u try with a small v

 

  var userlocation = fd_data.trigger.request_item.variables.g_form.getValue('src_site_req_for');

 

Thanks,

Danish

 

Hello Danish,

 

Thank you for your response I have tried it but still it is same the output is undefined.

 

Thank you.

Hi @Srilakshmi7 ,

 

I am sorry i missed this

 

 var userlocation = fd_data.trigger.request_item.variables.src_site_req_for;

 

Thanks,

Danish

 

 

Srilakshmi7
Tera Contributor

Hello Danish,

I have tried it and now it is working but again there is another error in the flow designer. please check the attached screenshot