Show 'Assess' button when CHG req CTASK Short description contains 'Design to the IRP'
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2023 07:36 AM
Hi Team,
I have a requirement, I need to make visible "Assess" ui Action button if the below conditions satisfy
- CHG request in related list CTask's Short description contains "Design to the IRP" Need to show the Assess button.
Can any one help me the condition for Ui Action.
Thanks,
1 REPLY 1

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2023 08:01 AM
Hello @prasad39 ,
Try Below Script in UI Action
var answer;
// Check if there are related CTask records with Short description containing "Design to the IRP"
var relatedCTask = new GlideRecord('change_task');
relatedCTask.addQuery('change_request', current.sys_id); // Assuming 'change_request' is the reference field linking CHG request and CTask
relatedCTask.addQuery('short_description', 'CONTAINS', 'Design to the IRP');
relatedCTask.query();
// Show the "Assess" button if at least one related CTask record meets the condition
if(relatedCTask.next()){
answer = true;
}
else {
answer = false;
}
answer;
Kindly mark correct and helpful if applicable