Change request cannot be moved from access to authorize

Rajesh77
Tera Contributor

Hi Experts,

 

Need you help on the below.

 

A change request cannot be moved from Assess to Authorize state when any associated CTASKS are unassigned to any individual. If in case the requester clicks on Request Approval without assigning the CTASK to an individual, it should throw out a message in Dialog box

 

Note : Assess to Authorize happens when the change is clicked on Request approval

13 REPLIES 13

try below:

 

var ctask = new GlideRecord('change_request');
ctask.addQuery('change_request',current.sys_id);
ctask.addEncodedQuery('assigned_toISEMPTY');
ctask.query();
if(ctask.getRowCount()>0)
{
current.setAbortAction(true);
}
else{
current.state=-3
}

Raghav
MVP 2023

@Rajesh77 did this worked for you?


Raghav
MVP 2023

Musab Rasheed
Tera Sage
Tera Sage

Hello,

Try below before business rule on 'change_request' table , condition is State changes to 'Authorize'

var ctask = new GlideRecord('change_task');
ctask.addQuery('change_request',current.sys_id);
ctask.addQuery('assigned_to' , '');
ctask.query();
if(ctask.hasNext())
{
gs.addInfoMessage('Change cannot be moved to Authorize state as there are CTASKS which are not assigned to anyone');
current.setAbortAction(true);
}

 

Please hit like and mark my response as correct if that helps
Regards,
Musab

this is the one i tried 

 

var ctask = new GlideRecord('change_request');
ctask.addQuery('change_request',current.sys_id);
ctask.addQuery('assigned_to' , '');
ctask.query();
if(ctask.getRowCount()>0)
{
gs.addErrorMessage(" Make sure to assign the CTASK's to the respective Assignee before clicking on Request Approval.");
current.setAbortAction(true);
}