How to start Process Builder after one minute in Salesforce

    Salesforce has a lot of tools to help things done. With Apex, Flows, Process Builders, and more, a developer can accomplish a great set of requirements. However, things get tricky when it comes to testing. While Apex has a very well-defined testing process as such the programmers have to write test classes making sure that the line coverage is at least 75% for each Apex class. These test classes can be run immediately and can give us all the desired details.

    However, we don’t have that liberty in Process Builders. In order to test a Process Builder, we have to manually run it to see if the whole process works as it should. One major hurdle in the testing of Process Builder is that it can only start at least after one hour. By default, Salesforce doesn’t provide any way to start the process immediately. This can make the testing process very slow and inefficient.

    In this guide, we will teach you that how you can start a process builder after one minute. In fact, you will be able to select the time as per your liking. Without further ado, let’s discuss the solution.

    • First create a formula field with Time datatype as output. The formula will be: NOW() – 59*(1/24/60). “NOW()” gives us the current time. The fraction “(1/24/60)” gives the fraction of total minutes in a day (1/1440). You can check out Oracle Scheduling Date and Time for more detail regarding this fraction. “59” is the number of minutes we want to subtract from current time after multiplying with the fraction result. This number 59 in this formula is of the actual importance and will make the result 1 minute. If we want to start the process builder after 10 minutes, we can change the number from 59 to 50. And so on. The whole formula translates to “minutes ago” the current time. In our case, 59 minutes ago.
    • Once the formula field is created, in the “Set Time for Actions to Execute” panel of the Process Builder, select the first option in which we start our process after the time given by one the object fields.
    • In the field input, select the new formula field. In our case, it is TimesAgo__c.
    • Select After in the third input.
    • Select Hours from the second input.
    • Add 1 in the first input. This will mean that we want to start our process builder one hour after 59 minutes ago – that will be one minute from now.

    In this way, you will be able to start your Process Builder after one minute or any time you want. We hope that this guide will help you in testing and debugging. For more, keep following Retrology.

    Talha Saqib
    Talha Saqib
    Founder of Retrology. Been actively following the gaming and media industry for the past 15 years. Also, a full-time software engineer. My day-to-day tasks include writing, editing, strategizing content, managing my team, and handling the complete back-end.
    Notify of
    Inline Feedbacks
    View all comments