You need to sign in to do that
Don't have an account?
Mary Ardelyn Nabong
Cloning is not populating my custom fields
Hi guro,
I have a custom object(Billing Plan) with a custom field (opportunitylineitem, text). Everytime I clone the Billing Plan opportunitylineitem is not populated. I build the relationshop One(pooportunity line item) to Many (Billing Plan).
1. build a trigger to create a billing plan as soon as opportunily line item is added.
2. another trigger to update the opportunity line item with Billing ID.
3. when i clone Billing Plan, everything is populated except the opportunity line item ID(text) , not required, not unique.
Below is the code for my Billing plan
------------------------------------------------------------------------
trigger BillingSchedule on Schedule__c (after insert) {
for(Schedule__c BSupd:trigger.new){
system.debug('BSupd: '+ BSupd.Opportunity_Line_Item__c);
Id lineitemid = BSupd.Opportunity_Line_Item__c;
if (lineitemid != null){
Opportunitylineitem oplnitm =[select id from opportunitylineitem
where id=:lineitemid limit 1];
oplnitm.Schedule__c = BSupd.Id;
update oplnitm;
}
}
}
------------------------------------------------------
Thanks in advance.
Mary
I have a custom object(Billing Plan) with a custom field (opportunitylineitem, text). Everytime I clone the Billing Plan opportunitylineitem is not populated. I build the relationshop One(pooportunity line item) to Many (Billing Plan).
1. build a trigger to create a billing plan as soon as opportunily line item is added.
2. another trigger to update the opportunity line item with Billing ID.
3. when i clone Billing Plan, everything is populated except the opportunity line item ID(text) , not required, not unique.
Below is the code for my Billing plan
------------------------------------------------------------------------
trigger BillingSchedule on Schedule__c (after insert) {
for(Schedule__c BSupd:trigger.new){
system.debug('BSupd: '+ BSupd.Opportunity_Line_Item__c);
Id lineitemid = BSupd.Opportunity_Line_Item__c;
if (lineitemid != null){
Opportunitylineitem oplnitm =[select id from opportunitylineitem
where id=:lineitemid limit 1];
oplnitm.Schedule__c = BSupd.Id;
update oplnitm;
}
}
}
------------------------------------------------------
Thanks in advance.
Mary
Lastly, have you considered implementing this with a Process and a Flow in place of a trigger?