Existing catalogue form will be visible to All Users

Srinivasu2
Tera Contributor

Hi Community,

 

Existing catalogue form will be visible to All the Users, But is there any way to modify existing workflow where if the user is Brazil then the request should land to Brazil assignment group.

 

 

Regards,

Srinivasu Sagiraju

 

17 REPLIES 17

Hi @Srinivasu2 ,

 

you can also directly assignee assignment group depends on your locations add if conditions .

var userLocation = gs.getUser().getLocation();

if (userLocation == 'Brazil') {
    current.assignment_group = 'BrazilAssignmentGroupSysID'; // Replace with the actual Sys ID of the Brazil assignment group
}

If the solution works, please consider marking it as helpful.

Thanks,

Anand

Ok @Anand Kumar P ,  finally i have 2 questions

 

1) but in if condition we should use the below format right?

 

Srinivasu2_0-1696077757830.png

 

2. Brazil is a country right not any particular location?

 

 

Thank you in advance

 

Regards,

Srinivasu Sagiraju

 

 

Hi @Srinivasu2 ,
Take one run script activity from workflow and add below script in that run script if you want logged in user country.

 

var user = new GlideRecord("sys_user");
user.addQuery("sys_id", gs.getUserID());
user.setLimit(1);
user.query();

if (user.next()) {
    var country = user.location.country;
    
    if (country == 'Brazil') {
        current.assignment_group = 'sys_id of Brazil assignment group';
    }
}
(or)
If you want requstor country use below script
var ritm = new GlideRecord("sc_req_item");
    ritm.addQuery("sys_id", current.variables.ritm); 
    ritm.setLimit(1);
    ritm.query();

    if (ritm.next()) {
        var requestorLocation = requestor.location.country;

        if (requestorLocation == 'Brazil') {
            current.assignment_group = 'sys_id of Brazil assignment group';
        }
    }

 

 

 

Thanks,

Anand

 

1) But if he is not a Brazil user the flow will continue,

2) If he is brazil user RITM auto assigned to Brazil assignment group

 

Hi @Srinivasu2

 

If the user is not Brazil then you need to design the flow as per your requirement, i.e if yes  it will set the assignment group or else it will continue with the flow.