business service restriction

MatheusR
Tera Contributor

I would like to restrict the "Pack" business service to a certain group.
For example, when the applicant is from the "STORE" location, the business service cannot appear for him.

 

I'm using the Vancouver version

2 REPLIES 2

Amitoj Wadhera
Kilo Sage

Hi @MatheusR ,

 

1. Script Include: First, create a script include where you'll define a function to check the user's location

var LocationUtils = Class.create();
LocationUtils.prototype = {   
    getLocation: function(userId) {
        var userLocation = ''; 
        return userLocation;
    },
    isStoreLocation: function(location) {
        return location === 'STORE';
    }
};

2. Modify Business Service ACL: Go to "System Security" > "Access Control" > "Search for your Business Service Access Control".

  • Find the "Pack" business service in the list.
  • Edit the record and add a new condition to the script.
var LocationUtils = new LocationUtils();
var location = LocationUtils.getLocation(gs.getUserID());
if (LocationUtils.isStoreLocation(location)) {
    answer = false;
} else {
    answer = true;
}

 

If you find my response helpful, please consider marking it as the 'Accepted Solution' and giving it a 'Helpful' rating. Your feedback not only supports the community but also encourages me to continue providing valuable assistance.

Thanks,

Amitoj Wadhera

I currently do not have permission to configure the ACL. However, I am working on a workaround. In a Client Script, I am capturing the store value with the 'localizacao' variable using the 'g_form.getDisplayValue('store')' method. Later, I will try to hide the 'Pack' service option in the drop-down menu."

however I am encountering errors because I am not able to pull the values ​​from the select box

could you help me