We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

Mandatory Risk Assessment to advance Change Request

JP-ODU
Tera Guru

My users say they would like the fields on the related list Risk Assessment for their Change requests to just appear on the Change request form, vs clicking open from the Risk Assessment related list (screenshot)

 

change req risk asmt related link.jpg

 

I can't seem to figure out a way to do this? Is it even possible?

1 ACCEPTED SOLUTION

JP-ODU
Tera Guru

When I went back to the team to ask *why* this is necessary, they explained that they want to make the risk assessment mandatory to advance the change request state. So their logic is transfer the mandatory risk assessment fields onto the change_request form and then they'll be mandatory to advance the request.

 

The correct way to address this is a business rule on the change_request table that triggers before state changes and checks that the related assessment instance is complete. Script for that: 

 

(function executeRule(current, previous /*null when async*/) {

var assessmentinstance = new GlideRecord ('asmt_assessment_instance');  
assessmentinstance.addQuery('task_id', current.sys_id); 
assessmentinstance.query();  
if(!assessmentinstance.next())  
	{ 
	current.setAbortAction(true); 
	gs.addInfoMessage('Please complete the risk assessment related link before proceeding.'); 
	current.state = 1; //check state value 

}  

})(current, previous);

View solution in original post

7 REPLIES 7

CFrandsen
Tera Guru

Hi @JP-ODU  
Just to be sure, that I read your question right... 
you want to auto trigger the Change Assement (open on load) ?
Or you want to "embed" the assesment into the change request form ?



 If this pointed you in the right direction, hit Helpful to spread the good vibes.
If it cracked the case for you, mark it Correct so the next person doesn’t have to reinvent the wheel.

Yeah @CFrandsen CFrandsen thats what I am also thinking as both ways are possible but need some clarity on the requirement form the author @JP-ODU JP-ODU


Thanks & Regards,
Sachin Narayanasamy

Embedded. They'd like the assessment fields to be available and editable on the change request form, without having to use the OOTB functionality of Related Links: Risk Assessment

 

I've been trying various dot-walks and I can't seem to get there

CFrandsen
Tera Guru

As I see it, you could continue to use the OOB functionality (like you do now, utilizing the related list).
it’s supported, low-maintenance, and won’t turn into a custom UI project you have to babysit every upgrade.

Alternately, you could go in the direction of a custom built UI formatter (Remember all the logic you need to cater for in terms of it being editable vs read-only, and how it should handle retakes etc...) 
It becomes a tradeoff; "nicer" UX, but you’re building and maintaining a mini assessment app inside the form.

If you are keen on doing something to cater a tiny bit to the users; go with a small UI formatter just showing Status + "Take Assesment" link. That way you give them a bit of a UI "experience" with limited risk. 



 If this pointed you in the right direction, hit Helpful to spread the good vibes.
If it cracked the case for you, mark it Correct so the next person doesn’t have to reinvent the wheel.