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.

Change sponsor and Change coordinator to be able to attach documents when Change is in 'Change Review / Pending Approval' State.

nageshmetri
Kilo Contributor

Change sponsor and Change coordinator to be able to   attach documents when Change is in 'Change Review / Pending Approval' State.

"Change sponsor" & "change coordinator" both are the fields in change form.

I need to write a ACL to grant acces for this on SYS ATTACHMENT TABLE .

Please help me with this as Im not understanding how i can write a ACL for the change on SYS ATTACHMENT TABLE.

please find the attachment of SYS ATTACHMENT TABLE COLUMNS.

kindly help me with this as i have stuck with this.

Thanks

20 REPLIES 20

nageshmetri
Kilo Contributor

Awesome !!!!Good approach ,Thanks Rashmi I will try it ,But this line   if(changesponsor != '' && gs.hasRole('Change_manager')) //replace with some role who can be change sponsor or coordinator


I am not getting this because we dont need to give role,only if current logged in user is   changesponsor or changecoordinator than we need to give access


How can i get that?


Please let me know



Thanks



gs.getUserID gives current logged in user sys id



answer = getAttachmentRights();



function getAttachmentRights(){


      var changesponsor;


      var changecoordinator;


      if(current.table_name == 'change_request'){


              var grChange = new GlideRecord(current.table_name);


              grChange.get(current.table_sys_id);


              changesponsor = grChange.change_sponsor;


              changecoordinator = grChange.change_coordinator;


             


                  if(gs.getUserID() == changesponsor || gs.getUserID() == changecoordinator)


                      return grChange.canWrite();


              else


                      return false;


      }


}


nageshmetri
Kilo Contributor

Thanks Rashmi !!!!!!!


Iam really happy for this,I will try that & let you know .


Please mark my answer helpful or correct if it helps you and for states you can try yourself.


Thanks Rashmi its working !!!!!!