Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to make only one field editable on record, remains should be read-only

Supriya25
Tera Guru

Hi All,

 

Please help me on below issue.   why my Write ACL not working , always two fields still read-only just like previous.???

 

current setup:

in CSM, we create one custom table "Invoice Compliances "  which is extended from Case table .we have totally 45+ fields (some custom fields and some case table fields ).  Full Access on Invoice Compliances table records/fields can be updated only by  "admins" and "invoice_compliances_user "

ACL : Write 

Table: Invoice Compliances.*   

roles:  "admins" , "invoice_compliances_user ", Condition: State|not|cancelled/Closed. 

 

on request For Finance group we create one new Role "finance_invoice_compliance_user" given read access on list of records for reporting purpose and some other purposes.

ACL : Read   

Table : Invoice Compliances.*   

roles: "finance_invoice_compliance_user" , Condition: State|not|cancelled.

 

up to this point everything  fine.

 

 

Issue

now finance_invoice_compliance_user role users want to update 2-fields by them in 'Invoice Compliances table' record, so we created Write ACL, but it is not working , always that two fields showing as Read-only as like other fileds.

ACL : Write 

Table: Invoice Compliances.Trans ID 

roles:  finance_invoice_compliance_user, Condition: State|not|cancelled/Closed. 

Script

 

 

 

 

var gr=new GlideRecord('sys_user_grmember');
gr.addEncodedQuery('group.name.STARTSWITHFinance_Invoice_Compliance^group.active=true');
gr.addQuery('user',gs.getUserID());
gr.query();
if(gr.next())
answer=true;
else
answer=false;

 

 

 

 

 

 

Kindly help me why my Write ACL not working , always two fields still read-only just like previous.

 

 

 

17 REPLIES 17

Sandeep Rajput
Tera Patron
Tera Patron

@Supriya25 Please update your script as follows.

var gr=new GlideRecord('sys_user_grmember');
gr.addEncodedQuery('group.nameSTARTSWITHFinance_Invoice_Compliance^group.active=true');
gr.addQuery('user',gs.getUserID());
gr.query();
if(gr.next())
answer=true;
else
answer=false;

 

I found an issue with your query where you used . withStartsWith 

gr.addEncodedQuery('group.name.STARTSWITHFinance_Invoice_Compliance^group.active=true');

Where as it should be as follows.

gr.addEncodedQuery('group.nameSTARTSWITHFinance_Invoice_Compliance^group.active=true');

Hope this helps.

Good catch on the extra ".", but funny enough, does not make a difference.

Hi,

 

No change, still it is read-only showing 

I added Popup gs.addInfoMessages in ACL  ...., I can see that info message  as a admin when i Open record, but when i impersonated with 

Finance_Invoice_Compliance

this group user , he is not getting info message on record level.