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

We need write a ACL on SYS ATTACHMENT TABLE for this & the same I am not getting.


I don't know how we can call these fields & states(change sponsor &change coordinator)   in sys attachment table as these are fields of Change form.



Thanks


You can glide record for change request in the ACL. something like below.



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; //replace with your fieldname


              changecoordinator = grChange.change_coordinator;


             


                  if(changesponsor != '' && gs.hasRole('Change_manager')) //replace with some role who can be change sponsor or coordinator


                      return grChange.canWrite();


              else


                      return false;


      }


}



Please mark answer correct if it answers your query



Thanks,


Rashmi


you can done it through before business rule on sys_attachment table. or via ACL also. by the way i did not test the code below




answer = addAttachment();



function addAttachment() {


  var inc = new GlideRecord('incident');


  if (inc.get(current.table_sys_id)) {


      if (inc.caller_id !=''){   // you can access the field through this way.


      return false;


      }


  else


  {


  return true;


  }


  }


}


nageshmetri
Kilo Contributor

Harshvardhan,


Sorry I don't know about the business need!!!!


My lead has assigned me & I need to finish it by tomorrow


I am struggling lot for this.



Thanks


nageshmetri
Kilo Contributor

No Rashmi, No roles those are fields in change form.



Thanks