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
Taha HaiderTaha Haider 

Can we retain record id from one environment to another environment? Or will it always get updated when we import the same data

Can we retain record id from one environment to another environment? Or will it always get updated when we import the same data
AnudeepAnudeep (Salesforce Developers) 
Hi Taha, 

Unfortunately, it is not possible. Salesforce generates unique IDs for records across all instances (Record Ids are identical in Full Copy sandbox and Production Org)

A Salesforce.com ID is what references each Record in the back end of Salesforce. It is basically what Salesforce uses to track all the records. It is similar to a key field in an RDBMS

There is a simple fix to this problem by leveraging External Ids to load your Sandbox Id into, and still, let Salesforce create a record Id like it does today. Just use the Upsert command in Data Loader instead of Insert, and do matching against the parent object's External Id field (you'll need to create one).

http://blog.jeffdouglas.com/2010/05/07/using-exernal-id-fields-in-salesforce/

This is a very common approach for loading data from and for supporting integrations from external systems (or sandboxes).

Let me know if this helps, if it does, please mark this answer as best so that others facing the same issue will find this information useful. Thank you