You need to sign in to do that
Don't have an account?
nagalakshmi
how to set rule criteria through trigger
Hi,
I want to share the records through trigger based on workflow rule. I mean if the rule criteria is 'when the record is create' then i use the 'after insert' event.
If the rule criterial in work flow is 'When a record is created, or when a record is edited and did not previously meet the rule criteria'. How can i set the rule criteria in trigger... Any one please help me...
Thanks,
Lakshmi.
Totaly unclear requirement .Be more specific possibly with an example .
Make sure you are not mixing up Time-based workflow trigger and APEX trigger .
Hi,
My requirement is,
I need to automate the work flow rules through triggers. in that work flow rule i am sending a email for user with sharing instructions of a record. I need to set that sharing criteria of a record through trigger. I am doing everything fine... But i got a doubt that is, how to set the rule criteria in trigger if the work flow having ' When a record is created, or when a record is edited and did not previously meet the rule criteria'.
Thanks,
Laskhmi
Hi Laskhmi,
Use 'before insert', 'before update' events and create a checkbox called "previously met?". This checkbox helps you to track, whether the condition is satisfied in the previous condition.
Ex:
Assume, previously_met__c=FALSE;
If(previously_met__c!=TRUE)
{
// your logic
previously_met__c=TRUE;
}
Madhan Raja M
You can use
Hi,
Did you mean in Sharing_flag__c, shall i keep the sharing rule value like read or write somthing once edited.......
Thanks,
Lakshmi
You can use the content of the variable however you want to use it, all depends on requirements.
If you are going to change the sharing rules based on some criteria in a field(like status) you can use the same field instead of additional custom field like Sharing_flag__c.
Note: Sharing_flag__c is just a example I used, you can use the same fields and values that trigger the workflow