restrict field on the basis of date using ACL

Pratiksha Lang1
Kilo Sage

Restrict field on the basis of date using ACL

 

I have written write ACL on a field. This field should be editable if the date is today's date. if it is not current date then it should not allow the field to be edited.

I have written a script in ACL but not sure what is wrong here:

 

PratikshaLang1_0-1704296624319.png

 

Script :

 

//var answer = false;
var gdt = new GlideDate();
gdt.addSeconds(19800);

//var gr = new GlideRecord('x_amspi_smdrs_app_ola_score');
current.addQuery('frequency','Daily');
current.addQuery('ola_formula_score','down_time_minutes');
current.addEncodedQuery('score_number.state=1^ORscore_number.state=2');
current.addQuery('score_number.date',gdt);
current.query();
while(current.next())
{
    answer = true;
}

 

1 REPLY 1

Robbie
Kilo Patron
Kilo Patron

Hi @Pratiksha Lang1 ,

 

Another post in the community should help guide you here. Similar to your request they wanted to make a field editable during a certain period. Check the link below.

 

To help others, please mark this correct and/or helpful.

 

Thanks,

Robbie

 

https://www.servicenow.com/community/developer-forum/urgent-help-how-to-make-field-editable-for-spec...