The CreatorCon Call for Content is officially open! Get started here.

Create Flow designer for custom table

Zuri
Tera Expert

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

4 REPLIES 4

Juhi Poddar
Kilo Patron
Kilo Patron

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:

  1. Create a Scheduled Job that runs daily.
  2. Use a script to query the custom table, checking if the approval has been pending for more than 7 days.
  3. 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

Thank you @Juhi Poddar 

 

That was my initial plan to use schedule job but requirement is to create flow designer

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:

JuhiPoddar_0-1737900934547.png

Trigger:

JuhiPoddar_1-1737901002531.png

Step1:

JuhiPoddar_2-1737901195668.png

Step2:

JuhiPoddar_3-1737901261478.png

Step3:

JuhiPoddar_5-1737901443175.png

  • 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

Viraj Hudlikar
Tera Sage
Tera Sage

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.

VirajHudlikar_0-1737902385414.png

 

If approval is not triggered from flow, then a separate scheduled flow can help you which can be similar to below screenshot.

 

VirajHudlikar_4-1737903820720.png

 

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.