How to Restrict Approvers not to approve the RITM until approver fills mandatory variables in RITM level in service catalog?

vijayraja
Kilo Explorer

Hi community,

I have one catalog item, made some variables not visible to the end user but the same variables enabled mandatory in RITM level using catalog UI policy (make "Applies only on Requested items" check box to true).

I have two Groups of Approvers in my workflow in RITM, One group of users can approve the request without filling the mandatory fields,but when coming to second group of  approvers,  they should fill those mandatory fields before approving.But here the problem is, without filling the mandatory fields also they are able to approve it.

I want  ,when second level of approver group tries to approve (without filling mandatory fields), they can not be able to approve the RITM and should get warning message that "Before approve the Request,please fill mandatory fields in RITM" 

Very much appreciated, if any one coulg help me on achieving this requirement.Its very urgent.

Regards,

Vijay

6 REPLIES 6

vijayraja
Kilo Explorer

Ram,

I tried ,but it is not working.Can you please share the sample code to retrieve the variable information from RITM?

Regards,

Vijay

Hi Vijay,

 

Please find the below code snippet:

Script:

var ritm = new GlideRecord("sysapproval_approver");
ritm.addQuery("sys_id",current.sysapproval);
ritm.query();
if(ritm.next())
{
if(ritm.cat_item == "")//pass the sys_id of the catalog item in quotes
{
if(ritm.variables.variables1 == '' || ritm.variables.variables2 == '')//variables 1 and 2 are name of the variables
{
gs.addErrorMessage("Please fill in the required fields related to the RITM");
current.setAbortAction(true);
}
}
}

condition:

state changes to Approved

 

Regards,

Ram M