ACL Script

CV1
Tera Contributor

Hello All,

Creating  a read ACL on cmn_location for snc_external so that on CSM portal the use can see case location for only that account.

This is the script

mylocation(current);

function mylocation(current){
    if(current.company == gs.getUser().getRecord().getValue('account')){
        return true;
    } else {
        return false;
    }
}
 
plz advise what is wrong as its not working.
TIA
7 REPLIES 7

@CV1 ,

 

Try below:

 

 

answer = mylocation(current);

function mylocation(current){
    if(current.custom_account_field.primary_contact == gs.getUserID()){
        return true;
    } else {
        return false;
    }
}

 

 

I am assuming you you want to check if the currently logged in user is the primary contact for that account and you are able to refer the account directly from the cmn_location table, as mentioned above.

 

Please accept solution OR mark helpful.

Thanks,

CV1
Tera Contributor

Don't have primary_contact  and contact is "empty" in our table cmn_location as well as Table: customer_account.

 

@CV1 ,

 

I think this is a data issue, and this needs to be fixed by your data management team.

The script should work as long as the data in the tables is correctly maintained.

 

Please try adding some demo users/data into the required fields and verify if the script works.

 

Please accept solution OR mark helpful.

Thanks,