function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
elgutierelgutier 

Moving records from one related list to another within an object

Hello everyone,

 

I have a new requirement where I would need the following:

 

Once the status from an Opportunity created is modified to Lost or Won, move this opportunity to a new "Opportunity_History__c" related list.

 

Thanks for your inputs/comments.

 

 

Navatar_DbSupNavatar_DbSup

Hi,

You have to create a trigger on opportunity object

Use the below code snippet as reference:

trigger chnagestatus on Opportunity (before update)

{

if(trigger[0].new.status  == 'Won' || trigger[0].new.status  == 'Lost' )

{

trigger[0].new.Opportunity_History__c='id of record by which you want to associated this Opportunity';

}

 

 

}

 

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved. 

elgutierelgutier

Hi Ankit,

 

Thanks for your prompt reply but I guess your response does not cover my requirement.  I basically need the following:

 

1) If an Opportunity.Opportunity_ID equals to Lost, record is removed from Opportunity and moved to Opportunity_Business_History__c where Opportunity_ID information is populated from Opportunity.Opportunity_ID, same as other fields.  Basically I would need to remove the record from one related list and paste it into a newly created custom object (related list) within the same Object (Opportunity).

 

Thanks.