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
ismyhcismyhc 

Adding a non-salesforce ID to a custom object?

Hi All,

 

Ive created a custom object (advertiser__c) that I want to use to hold the name of an Avertiser as well as an Advertiser ID. I realize that by default when you create a custom object that you get a name field and an ID field but that ID field is saleforce specific. My quesiton is what do I need to do to be able to tie Advertiser name and its Advertiser ID together? (Advertiser ID would just be an integer which is determed by another system) .

 

The advertiser__c custom object is represented on a standard opportunity page with a lookup field. I would like the availble options to be presented to the user as the advertiser name, but on the backend when the user selects an advertiser, my process will use its associated advertiser ID.

 

Any insight on the best way to accomplish this would be much appreciated!

Thanks!

Best Answer chosen by Admin (Salesforce Developers) 
Ankit AroraAnkit Arora

As far as Id in lookup is concerned then when you select the record in lookup it bind the actual salesforce Id in backend. Now if you have any relation between the salesforce record Id and your third party record Id then you can fetch it using the database queries.

 

You need to do this using your custom logics as salesforce will only bind the salesforce Id in backend with lookup.

 

 

Thanks

Ankit Arora

Blog | Facebook | Blog Page

All Answers

Ankit AroraAnkit Arora

You don't need to do any thing to tie the name with the Id. As when we create a record in salesforce it automatically generates a 15-Digit(Case sensitive or 18 - Digit case insensitive) Id for that record.

 

We can identify that record on the basis of that record Id. Record id will be unique all over the organization.

 

Lets say I have two fields on Advertiser

 

1) Name

2) Phone

 

When I navigate from UI and fill the values say, Name = "Ankit Arora" , Phone = "xxxxxxxxxx" and save the record then a record is created and a 15 - digit Id is also generated which is automatically relates to this record.

 

Now if you want to get the Id of this record from database, you can do something like this :

 

List<Advertiser__c> advLst = [select id,name,phone__c from Advertiser__c where name like 'Ankit Arora%'] ;

 

It will provide you the list of all records whose name starts with Ankit Arora. Now you can get the record Id from this list.

 

Hope this is clear you from your doubts. And if not then please do let me know.

 

 

Thanks

Ankit Arora

Blog | Facebook | Blog Page

Ankit AroraAnkit Arora

As far as Id in lookup is concerned then when you select the record in lookup it bind the actual salesforce Id in backend. Now if you have any relation between the salesforce record Id and your third party record Id then you can fetch it using the database queries.

 

You need to do this using your custom logics as salesforce will only bind the salesforce Id in backend with lookup.

 

 

Thanks

Ankit Arora

Blog | Facebook | Blog Page

This was selected as the best answer
ismyhcismyhc

Thanks!

This helped me figure out what I need to do!

Ankit AroraAnkit Arora

Great! Then can you please mark it as solution so other may get benefit.

 

 

Thanks

Ankit Arora

Blog | Facebook | Blog Page