Create Flow designer for custom table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-26-2025 03:19 AM
I want to create new flow designer for custom table. The condition is if approval requested without action for 7 days. The record will be rejected. I am facing the issue on dot walking condition from approval table. The triggers are not working.
What can be walk around? I tried to use business rule I am not getting result either. I need help with script for custom table which is working. Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-26-2025 03:48 AM
Hello @Zuri
- In flow designer you can add the trigger condition : record created or updated on your custom table.
- Another method could be to create a Scheduled job, run this scheduled job daily.
The script will check for records in your custom table where the approval is still pending for over 7 days and automatically reject them.
Here’s a simple approach:
- Create a Scheduled Job that runs daily.
- Use a script to query the custom table, checking if the approval has been pending for more than 7 days.
- If the condition is met, update the record's state to 'rejected'.
Here's a basic script to get you started:
var customTableGR = new GlideRecord('your_custom_table'); // Replace with your custom table name
customTableGR.addQuery('state', '!=', 'rejected'); // Skip records that are already rejected, modify by adding back-end value
customTableGR.query();
// Loop through all records in your custom table
while (customTableGR.next()) {
var approvalRecord = customTableGR.approval_field; // Replace with your approval field
if (approvalRecord) {
// Check if the approval is still pending and it's been more than 7 days, replace 'approved' with your actual state value
if (approvalRecord.state != 'approved' && approvalRecord.sys_created_on <= gs.daysAgo(7)) {
// If it's been more than 7 days, reject the record in your custom table
customTableGR.state = 'rejected'; // Replace with your actual state value
customTableGR.update(); // Update the custom table record
gs.info('Record ' + customTableGR.getDisplayValue('number') + ' has been rejected due to no approval action within 7 days.');
}
}
}
This will automatically reject records where the approval is pending for 7 days.
Hope this helps!
"If you found my answer helpful, please like and mark it as an "accepted solution". It helps future readers to locate the solution easily and supports the community!"
Thank You
Juhi Poddar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-26-2025 04:06 AM
Thank you @Juhi Poddar
That was my initial plan to use schedule job but requirement is to create flow designer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-26-2025 06:31 AM
Hello @Zuri
- To demonstrate the flow, I have considered sysapproval_approver table.
- You can modify this for your custom table.
Follow these steps to meet your requirement:
Flow structure:
Trigger:
Step1:
Step2:
Step3:
- Update the enable timeout duration as per your need.
- This will wait for 7 days and if the approval state is still requested, it will be updated to rejected.
- You can modify the conditions and table as per your requirement and configuration in your instance.
Hope this helps!
"If you found my answer helpful, please like and mark it as an "accepted solution". It helps future readers to locate the solution easily and supports the community!"
Thank You
Juhi Poddar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-26-2025 07:02 AM - edited 01-26-2025 07:04 AM
Hello @Zuri
First of all, what flow trigger is not working? Can you share screenshots if possible so it will be better to guide .
Also, how the approval is triggered for your custom table record is it from flow? If yes, then then when approval is triggered you can set due date and mark as Reject as show in below image.
If approval is not triggered from flow, then a separate scheduled flow can help you which can be similar to below screenshot.
If my response has helped you hit helpful button and if your concern is solved do mark my response as correct.
Thanks & Regards
Viraj Hudlikar.