i want to restrict the user from accessing record producer on ESC portal based on the users company

Kiran Kumar m
Tera Contributor

I have a requirement where we have a record producer caller high severity placed on ESC portal 
i want that record producer to be made available only when the logged in user company is EA Holding 
i tried creating a user criteria setting company value to EA Holding , but still that doesn't work in ESc portal i dont know why .

can anyone help me how to restrict user from accessing that high severity record producer when his company is not EA Holding

KiranKumarm_0-1715173140985.png

 

4 REPLIES 4

johnfeist
Mega Sage
Mega Sage

Hi Kiran,

 

I can suggest a couple of things to investigate:

  • If you are getting the user data via script the documentation says to make sure that you are referencing user_id and not gs.getUser().
  • Have you tested your criteria in the User Criteria Diagnostics?  That will tell you who can or can't access with some explanation of why.

 

If the above doesn't get you to resolution, please include the criteria record so that we can better guide you.

 

Hope that helps.

:{)

Helpful and Correct tags are appreciated and help others to find information faster

Hii 

these are the user critierias which i created and both are not working 
i tried one without script it failed 
i tried one with script it again failed i dont know what's wrong 

KiranKumarm_1-1715177300906.png

 

this is without script 

KiranKumarm_2-1715177356393.png

 



i did check for diagnostics 
this user belongs to EA Holding company

KiranKumarm_0-1715177164793.png

 

Hi Kiran,

The basic setup against company should give you what you need.  I did a similar setup and it worked no problem.  The only things I can think of are:

  • Make sure that the user against whom you are testing has the correct company identified and meets any other criteria (e.g. if you have not external active, make sure the user is internal)
  • Make sure that you have the criteria record under Available For and not Not Available For

 

Hope that helps.

:{)

Helpful and Correct tags are appreciated and help others to find information faster

SAI VENKATESH
Tera Sage
Tera Sage

HI @Kiran Kumar m 

 

You can try the below script use before business rule and let me know 

(function executeRule(current, previous /*, g_scratchpad*/) {
    var userCompany = gs.getUser().getCompany().getName();
    if (userCompany != "EA Holding") {
        // Restrict access to the record producer
        current.active = false; 
    }
})(current, previous);

Thanks and Regards

Sai Venkatesh