Can I set Trigger Delay Time in second?

Posted by Wave Kasipat on 06-Jun-2016 01:56

In Trigger delay time, Can I set Delay Time in second unit?

 

Thanks,

Kasipat

Posted by Shiva Duriseati on 07-Jun-2016 01:06

Hi Kasipet,

Thank you for clarification. In my earlier post cutoffTimeStamp method increase the execution time of the trigger. So it works when you have remote calls which takes long time in custom trigger.(Its not suitable for your current requirement)

Since your response(REST createRecord) is delayed before execution of trigger, we can try making the trigger execution process to wait for some time using sleep method

Example: I have created a custom trigger which fires after creation of record(REST createRecord). I somehow managed to pause execution time for a specific period using Thread.sleep(1000); for one second.

public class CustomTrigger extends RuntimeTrigger {

/**

* Constructor.

*/

public CustomTrigger(TriggerDef triggerDef, DataObject data, Date triggerDate) {

super(triggerDef, data, triggerDate);

}

/**

* Actually run trigger.

*/

@Override

public void trigger(TriggerRunner runner) throws Exception {

Thread.sleep(1000);

                //Trigger logic goes here.

                // runner.addCutoffTimestamp(60000);

//User user=runner.getUser();

}

}

Regards,

Shiva

All Replies

Posted by satyanarayana sunku on 06-Jun-2016 02:05

Hi Kasipat,

NO. In Public Cloud Minimum delay time is 1 day. If you are private cloud Minimum delay to 1 Min by using MinRecursType=5 .

Thanks

Satya

Posted by satyanarayana sunku on 06-Jun-2016 02:23

Hi Kasipat,

We can not set delay time in seconds. the above setting related to recursive timings.

Thanks

Satya

Posted by Shiva Duriseati on 06-Jun-2016 02:46

Hi Kasipet,

If you are using Custom trigger, please add the following line to your code.

runner.addCutoffTimestamp(1000); // time will be in milli seconds. This will delay trigger execution time by one second.

"runner" is an object of type TriggerRunner.

Regards,

Shiva

Posted by Wave Kasipat on 06-Jun-2016 03:23

Hi Satya and Shiva,

 

Thanks for your answer.

My problem is response time from Rest createRecord.

My obj has trigger after create that take too much time for calculate,

And I have to wait it before it response.

 

So, I have tried to delay trigger then I don't have to wait,

But delay 1 min is too long.

 

Shiva,

Is "runner.addCutoffTimestamp(1000);" in Custom trigger work same as Trigger delay time?

That I don't have to wait trigger run.

If it work same, I will set it 1ms.

 

Or is there anyway that can solve my problem?

 

Thanks.

Kasipat

Posted by Shiva Duriseati on 07-Jun-2016 01:06

Hi Kasipet,

Thank you for clarification. In my earlier post cutoffTimeStamp method increase the execution time of the trigger. So it works when you have remote calls which takes long time in custom trigger.(Its not suitable for your current requirement)

Since your response(REST createRecord) is delayed before execution of trigger, we can try making the trigger execution process to wait for some time using sleep method

Example: I have created a custom trigger which fires after creation of record(REST createRecord). I somehow managed to pause execution time for a specific period using Thread.sleep(1000); for one second.

public class CustomTrigger extends RuntimeTrigger {

/**

* Constructor.

*/

public CustomTrigger(TriggerDef triggerDef, DataObject data, Date triggerDate) {

super(triggerDef, data, triggerDate);

}

/**

* Actually run trigger.

*/

@Override

public void trigger(TriggerRunner runner) throws Exception {

Thread.sleep(1000);

                //Trigger logic goes here.

                // runner.addCutoffTimestamp(60000);

//User user=runner.getUser();

}

}

Regards,

Shiva

This thread is closed