The CreatorCon Call for Content is officially open! Get started here.

script to add the assignment group based on user location in flow designer

Srilakshmi7
Tera Contributor

Hello Everyone,

We have a location routing table where we have records based on the locations mapped to the assignment groups

Based on that I have written scripts in flow designer to add the assignment group based on the users location. But it is not working. Can anyone help me with the script.

 

Script:

(function executeRule(current, previous /*null when async*/) {
 
    var locationrouting = new GlideRecord('x_ibmip_tktrouting_location_routing');
    locationrouting.addEncodedQuery('u_active!=false^u_location_route_type=FIELD_SERVICES');
    locationrouting.addQuery('u_location',fd_data.trigger.request_item.location.sys_id);
      locationrouting.query();
    while (locationrouting.next()) {
        var groupName = locationrouting.u_group.name;
        return groupName;
    }
 
})(current, previous);
5 REPLIES 5

Hello Stefan,

 

We have location field and group field on the x_ibmip_tktrouting_location_routing

and we have records like the group name for each loaction and also we have location route type field

Conditions are 

1. active is true

2. location route type is Field Services

3. Group is active

4. Group name starts with BA-DS