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
bohemianguy100bohemianguy100 

mapping cloned id

I have a custom clone function that is cloning cases.  It also clones case articles.  There is another custom case articles object that is used for reporting.  The relationship between the standard case articles object and the custom case articles object is the Id field on the standard case articles object to the Article_ID field on the custom case articles field.

 

In the clone method, I am inserting the standard case articles and then inserting the custom case articles. When the cloned case articles are inserted, I have a new ID.  How can I map that to the custom case articles Article_ID field?  I have no way of determining how to map the new cloned case article record ID to the custom case article record?

 

Any help is appreciated.

vitonevitone

If I understand what you are saying - and I am not sure that I am - then I would insert the std case articles first, get the IDs back, and make a map between the _old_ std case article ids and the _new_ std case records.  Clone, but don't insert, the custom case articles and then retrieve the new std case articles by using the old/existing article_id field to pull the new std case record from the map.  Use it to set the updated article_id in the custom article.

 

--vitone