approval flow
						
					
					
				
			
		
	
			
	
	
	
	
	
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
13 hours ago
director - answer = {
// Configure policy inputs here
u_director_approval_mandatory: false
};
var director_approval_required = false;
var gr_conflict = new GlideRecord('conflict');
gr_conflict.addEncodedQuery("change=" + current.sys_id + "^type=blackout^schedule.ref_cmn_schedule_blackout.u_director_approval_req=true");
gr_conflict.query();
if (gr_conflict.next()) {
if (current.assigned_to.manager != current.assigned_to.u_director) {
director_approval_required = true;
} else {
//if user's manager is their director, then this is not required (it would be a duplicate)
director_approval_required = false;
}
}
if (director_approval_required){
if (!current.assigned_to.u_director){
current.work_notes = "Current User doesn't have a Director";
}
answer.u_director_approval_mandatory = true;
}
vp - answer = {
// Configure policy inputs here
u_vp_approval_mandatory: false
};
var vp_approval_required = false;
var gr_conflict = new GlideRecord('conflict');
gr_conflict.addEncodedQuery("change=" + current.sys_id + "^type=blackout^schedule.ref_cmn_schedule_blackout.u_vp_approval_req=true");
gr_conflict.query();
if (gr_conflict.next()) {
// Logic to check if VP approval required
if (!current.assigned_to.u_vp) {
current.work_notes = "VP data missing on approval flow hierarchy - approval flow progressed to next level in hierarchy ";
current.update(); // Updates ONLY when VP is missing
vp_approval_required = false; // Not required if VP is missing
} else if (current.assigned_to.manager != current.assigned_to.u_vp) {
vp_approval_required = true;
} else {
//if user's manager is their VP, then this is not required (it would be a duplicate)
vp_approval_required = false;
}
}
if (vp_approval_required) {
answer.u_vp_approval_mandatory = true;
}
svp -answer = {
u_svp_approval_mandatory: false,
u_svp_no_vp: false,
u_evp_approval_required: false // add this flag
};
var svp_approval_required = false;
var svp_no_vp_required = false;
var evp_approval_required = false;
var gr_conflict = new GlideRecord('conflict');
gr_conflict.addEncodedQuery("change=" + current.sys_id + "^type=blackout^schedule.ref_cmn_schedule_blackout.u_svp_approval_req=true");
gr_conflict.query();
if (gr_conflict.next()) {
if (current.assigned_to.u_management_level < 5 && current.assigned_to.manager && current.assigned_to.manager.u_management_level < 6) {
svp_approval_required = true;
}
if (
(!current.assigned_to.u_vp && current.assigned_to.u_director && current.assigned_to.u_director.manager && current.assigned_to.u_director.manager.u_management_level == 6) ||
(!current.assigned_to.u_vp && (!current.assigned_to.manager || current.assigned_to.manager.u_management_level < 6))
) {
svp_no_vp_required = true;
}
// NEW BLOCK: trigger EVP for VP missing and no SVP either
if (
(!current.assigned_to.u_vp && (!current.assigned_to.u_director || !current.assigned_to.u_director.manager || current.assigned_to.u_director.manager.u_management_level < 6)) &&
(!current.assigned_to.manager || current.assigned_to.manager.u_management_level < 6)
) {
// neither VP nor SVP found in reporting chain
evp_approval_required = true;
}
}
if (svp_approval_required) {
answer.u_svp_approval_mandatory = true;
}
if (svp_no_vp_required) {
answer.u_svp_approval_mandatory = false;
answer.u_svp_no_vp = true;
}
if (evp_approval_required) {
answer.u_evp_approval_required = true;
}
when assigned user has no director, vp, svp it is not triggering to evp
when assigned user has no director, no vp it is not triggering to svp
In vp, svp or evp we need to make the changes to add the conditions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
8 hours ago
Hi @Bhavani1995,
you maybe want to give some context, you just copied a random code and wrote random abbreviations - vp, svp, evp... do you really think somebody can help you with this? :))
What could help better would be to explain what you are trying to achieve, where it fails and what you have tried to resolve it. Based on that some meaningful advice might come but you just pasted very long code without any explanation and I doubt that somebody could help you... perhaps some of the AI guys who will paste it to chatGPT and copy answer back here :)))
Please this is difficult to follow, you should better explain the situation if you expect someone to help you, what do you think about it?
/* If my response wasn’t a total disaster ↙️ ⭐ drop a Kudos or Accept as Solution ✅ ↘️ Cheers! */
