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
tnstns 

Need to permanently capture unique ID in a custom field

I created a custom field in Opportunity Products and set the formula to capture the unique ID of the Product line item when it is added to an Opportunity. When this Opportunity is cloned the following year (with the Product line items included), I would like this pre-captured ID to come through as is. Currently, when I clone the Opp with Pro, the custom field gets populated with the unique ID of the new product line item.... because all I have in my formula field is 'Id'. What can I add to this in the formula to make it keep the original value. 
harryr3636harryr3636
Not sure what version of SF you have, but if you have workflow, instead of using a formula, you could use a field update workflow to populate the field with the ID. This way it wouldn't change with a clone. 
tnstns

Thanks for the suggestion. We are on Enterprise Ed. I setup a new TEXT type field, set it to read only except for Sys Admin profile, and created a field update workflow, and in the "Test Options" section, selected "Use a formula to set the new value", but am not sure what to put in the field as a formula. I entered just simply 'Id". When I create a new product line item, the text field does auto populate, however, when I clone the Opp with Products, the new product line item's id replaces the value in the field in which I need it to retain the value from the original product. 

 

Any suggestions would be appreciated.

harryr3636harryr3636

Hi,

 

You're right, the new cloned record would re-fire the trigger. Sorry about that. You can set the criteria for the workflow to only trigger if the field you are populating is blank. This way it won't override the old ID when you do the clone. I just tested that and it worked.

 

For the field name, if you're putting in the Opportunity Line ID, you're right in that the formula would just be "ID". 

 

Harry