- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-25-2024 10:30 PM
I'm trying to create either a business rule or flow that is triggered when an approval record is created for a change record, and a custom field on the change record has a certain value. I've created the custom field called "Approval State" on the change request form, but when I go to create a business rule or flow on the approval table, and then drill down to "Approval for" I can't find my custom field.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-25-2024 10:52 PM
Hey @Abbottronix
The Approval field on the [sysapproval] table is a reference to the Task [task] table, while your custom field was created on the Change Request [change_request] table.
So just to one more step dot-walk to the Change Request table, where you will find your custom field. Like below.
Cheers,
Tai Vu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-25-2024 10:52 PM
Hey @Abbottronix
The Approval field on the [sysapproval] table is a reference to the Task [task] table, while your custom field was created on the Change Request [change_request] table.
So just to one more step dot-walk to the Change Request table, where you will find your custom field. Like below.
Cheers,
Tai Vu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-26-2024 04:38 PM
Thank you! I couldn't find Change Request in the drop down but it appeared when I typed it in the search box like in your screenshot.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-25-2024 11:01 PM
Hello @Abbottronix
Since the custom field is on change record, it will not be available in Approval table.
Here is how you can achieve the requirement:
Write a Business Rule on sysapproval_approver:
- Create a Business Rule on the sysapproval_approver table.
- Checkbox advanced
- Use the following script to check for the Approval State field on the related Change record.
if (current.source_table == 'change_request') {
var grChange = new GlideRecord('change_request');
if (grChange.get(current.document_id)) {
if (grChange.approval_state == 'desired_value') {
// Perform your logic here
}
}
}
Hope this helps!
"If you found my answer helpful, please like and mark it as an "accepted solution". It helps others find the solution more easily and supports the community!"
Thank You
Juhi Poddar