Question on sysapproval_approver Table

priya68
Tera Contributor

Hi There,

  I have one requirement on sysapproval_approver Table

 

     I have one Catalog Item 'XYZ' in that , i have 2 fields and These fields should be displayed on approval page

Not on Request page or RITM those should only visible for Approval ,

So how can i achieve this, can anybody please help me to get the proper solution.

 

Thanks,

Priya 

1 ACCEPTED SOLUTION

Hello,

 

The business rule will only populate the fields on approver table. To hide the fields for other items on we need a UI policy. Please do the below:-

 

Create a UI policy on sysapproval_approver table as below:-

 

Use the below condition:-

First click on Approval for-> task fields

Saurav11_0-1666073686758.png

 

Then select requested item[+]

 

Saurav11_1-1666073764813.png

 

Item-> Catalog item fields

 

Saurav11_2-1666073819224.png

 

Then select name is XYZ

 

Saurav11_3-1666073866192.png

 

Then in the UI policy actions below:-

 

Just create the record for both fields

 

Saurav11_4-1666074011524.png

 

Set the field name and set visible to true and save it

 

Saurav11_5-1666074046879.png

 

Please mark my answer as correct based on Impact.

 

View solution in original post

8 REPLIES 8

Saurav11
Kilo Patron
Kilo Patron

Hello,

 

Are these variables if yes then you need to create two fields on the approver table then populate them using business rule and have them visible of form only if the it is ritm and the ritm item name is XYZ.

 

Please mark my answer as correct based on Impact.

priya68
Tera Contributor

Hello,

  I have created 2 fields on Approver table, now could you please help me on Business Rule.

 

Thanks,

 

priya68
Tera Contributor

Hello Saurav,

 I have written the below BR code, but I don't think the code is in proper manner, please help me on this.

 

 

(function executeRule(current, previous /*null when async*/) {
if(sysapproval.cat_item.name == 'XYZ')

{
    var sysApprover = new GlideRecord("sysapproval_approver");
    sysApprover.addQuery("sysapproval", current.getValue("sys_id"));
    sysApprover.query();
    if (sysApprover.next()) {
    current.variables.u_site_details = sysApprover.approver;
    current.variables.u_network_segment = sysApprover.approver;    
    }}
})(current, previous);

 

Thanks,

 

Hello,

 

Please write a after insert BR on sysapproval_approver table:-

 

Saurav11_0-1666006609846.png

 

 

Use the below code:-(Replace the fieldname1 and fieldname2 with your fieldnames)

 

(function executeRule(current, previous /*null when async*/) {
 var sysApprover = new GlideRecord("sc_req_item");
    sysApprover.addQuery("sys_id", current.sysapproval);
    sysApprover.query();
    if (sysApprover.next()) {
    current.fieldname1 = sysApprover.variables.u_site_details;
    current.fieldname2 = sysApprover.variables.u_network_segment;
	current.update();
	}

})(current, previous);

 

Please mark my answer as correct based on Impact.