+ Start a Discussion

urgent requirement on trigger pls help me


The requirement is like when the status=open or reopen till the record is saved it has to capture the time,for this help me out how to write trigger .Bsaed on the time the SLA Flag has to set.





Suresh RaghuramSuresh Raghuram

can you elaborate it, Bsaed on the time the SLA Flag has to set.
For your Basic Idea
If the Flag has to set when a record is created and the status = open or reopnen
It would look like this.
trigger <trigName> on <Objt Name>(after Insert,after Update){
objName objjVar = objName();
If (objVar.Status == 'Open' || objVar.Status == 'reopen'){
objVar.Flag = true;
update objVar;


Hi Suree thanks for your reply.My actual Requirement is find below.

Capturing time when status is open or reopen till it is closed in case object to set SLA flags.Bases on this
time I need to set flags according to the durations below.

From Case Created and Case Status = Open

Green = Case Age < 10 hours

Yellow = Case Age > or = 10 hours and < or = 15 hours

Red = Case Age > or = 16 hours

Pls help me in fixing this issue.