You need to sign in to do that
Don't have an account?

The logic is when we create Customer Project for an Opportunity with the Status=Active, then Active Customer project check box on the Opportunity detail page is automatically checked.
The logic is when we create Customer Project(Custom obj) for an Opportunity(Standard obj) with the Status=Active(Picklist value), then Active Customer project check box on the Opportunity detail page is automatically checked.
wherein there is lookup between Customer Project and Opportunity..!
wherein there is lookup between Customer Project and Opportunity..!
if(trigger.isinsert){
list<Id> accIdList = new list<id>();
for(Customer_Project__c c : trigger.new){
if(status__c=='Active')
{
accIdList.add(c.Opportunities_CP__c);
}}
list<Opportunity> acc = [SELECT id,Active_Customer_project from Opportunity WHERE id in: accIdList];
for(Opportunity a : acc){
a.Active_Customer_project = true;
}
update acc;
}
}
All Answers
This can be done through process builder and trigger.
these fields belongs to Customer Project object
if(trigger.isinsert){
list<Id> accIdList = new list<id>();
for(Customer_Project__c c : trigger.new){
if(status__c=='Active')
{
accIdList.add(c.Opportunities_CP__c);
}}
list<Opportunity> acc = [SELECT id,Active_Customer_project from Opportunity WHERE id in: accIdList];
for(Opportunity a : acc){
a.Active_Customer_project = true;
}
update acc;
}
}
Hi Admin,
Please use this below code snippet, Hope it will helps you :)
In above code, Please use correct API Name for -:
1. "Customer_Project__c" (Customer Project Object)
2. ActiveCustomerProjectField (Opportunity Field)
Thanks
Rajat Maheshwari
rajatzmaheshwari@gmail.com
@Rajat maheshwari Even this worked, but unfortunately I can give only one best Answer.