You need to sign in to do that
Don't have an account?
CvrK
Hi ,
i have two objects called Clients,my requirement is when the picklist field's value is selected as "100,000-500,000" another check box field named "Low priority" should be checked on a before insert||before update event and finally picklist field's value on a related object named (Projects) should be selected as "Silver" on after insert||after update,help will be appreciated
code:
trigger AllTrigger on client__c (After insert,After Update,before insert,before update)
{
if(trigger.isBefore)
{
if(trigger.isinsert||trigger.isupdate)
{
List<client__c> Clist= trigger.new;
for(client__c C:Clist)
{
(s.quotation__c=='100,00-500,00')
{
C.Low_priority__c='True';
}
(s.quotation__c=='500,000-750,000')
{
C.Medium_priority__c='True';
}
(s.quotation__c=='750,000-900,000')
{
C.High_priority__c='True';
}
}
}
if(trigger.isAfter)
{
if(trigger.isinsert||trigger.isupdate)
list<Project__c> ProjList= new <list>;
list<client__c> Ailist=trigger.new;
for(client__c A:Ailist)
{
if(Projlist.High_priority__c==TRUE)
}
}
}
Need help with the trigger
Hi ,
i have two objects called Clients,my requirement is when the picklist field's value is selected as "100,000-500,000" another check box field named "Low priority" should be checked on a before insert||before update event and finally picklist field's value on a related object named (Projects) should be selected as "Silver" on after insert||after update,help will be appreciated
code:
trigger AllTrigger on client__c (After insert,After Update,before insert,before update)
{
if(trigger.isBefore)
{
if(trigger.isinsert||trigger.isupdate)
{
List<client__c> Clist= trigger.new;
for(client__c C:Clist)
{
(s.quotation__c=='100,00-500,00')
{
C.Low_priority__c='True';
}
(s.quotation__c=='500,000-750,000')
{
C.Medium_priority__c='True';
}
(s.quotation__c=='750,000-900,000')
{
C.High_priority__c='True';
}
}
}
if(trigger.isAfter)
{
if(trigger.isinsert||trigger.isupdate)
list<Project__c> ProjList= new <list>;
list<client__c> Ailist=trigger.new;
for(client__c A:Ailist)
{
if(Projlist.High_priority__c==TRUE)
}
}
}
Because Low Priority field is a checkbox the value has to be boolean. Having said that you need to remove the single quotes on C.Low_priority__c='True' --> C.Low_priority__c = True;. The same applies to C.Medium_priority__c and C.High_priority__c
The second block of you trigger should look something similar to this:
// AFTER BLOCK
if (trigger.isAfter)
{
if (trigger.isinsert || trigger.isupdate)
{
List < Project__c > ProjList = new List < Project__c > ();
for (client__c A: trigger.new)
{
if (ProjList.High_priority__c == TRUE)
{
// Assign the value Silver to whatever field you need to.
}
}
}
}
// END - AFTER BLOCK
I hope this information helps you.