The Zurich release has arrived! Interested in new features and functionalities? Click here for more

ACL based on field values

Anubhav24
Mega Sage
Mega Sage

Hi All,

 

I have fields on my custom table and there is one field for Public Unit and there are drop down values in this field like 'Digital' , 'Cloud' etc. , my ask is to show records to user based on the values selected in this field.

Ex : Show 'Digital' records to Workflow team and show 'Cloud' records to Cloud team.

Can I write ACLs based on the value selected using the current object , is this possible because mostly I have configured ACLs based off of roles only.

Do I need to go write the query business rule and what would be the best option if writing ACL is possible.

 

11 REPLIES 11

Mayur2109
Kilo Sage
Kilo Sage

Hi @Anubhav24 ,

 

If the field you are using to show records is reference field so why don't you try to write advance reference qualifier based on public unit and role of current logged in user as query. You can write script include for advance reference qualifier.

 

Please check and Mark Helpful and Correct if it really helps you.

Regards,
Mayur Shardul

Hi Mayur , the field is a choice list , small query can I use current.<custom field name>.value == 'Digital' and show only those records using ACL will this work ?

 

Hi @Anubhav24 ,

 

For ACL it will show other group's user message as some records are restricted due to security constrains, so it will be better to add reference qualifier.

 

Regards,

Mayur Shardul.

Hi @Anubhav24 ,

 

Try below script and refence qualifier.

 

Reference equal :

 

 

javascript&colon; new testSI().testFunc(current.Public_Unit);

 

 

 

SI :

 

 

var getRecords = Class.create();

getRecords.prototype = {
    initialize: function() {},

    getRec: function(unit) {
	
        var recs = [];
        if (unit == 'unitValue' && gs.hasRole('role you required')) {
            var userRec = new GlideRecord('table');
            userRec.addEncodedQuery('query');
            userRec.query();
            while (userRec.next()) {
                recs.push(userRec.sys_id);
            }
        }
		else if(unit == 'unitValue' && gs.hasRole('role you required')){
			userRec = new GlideRecord('table');
            userRec.addEncodedQuery('query');
            userRec.query();
            while (userRec.next()) {
                recs.push(userRec.sys_id);
            }
		}

        return 'sys_idIN' + recs;

    },
    type: 'getRecords'
};

 

 

 

Regards,

Mayur