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
prabhu sethupathy 6prabhu sethupathy 6 

Account Id - How to view it?

hi

How can i get the id for the created account(s)? When i create a account and save it displays the name and address but i think there should be a unique id assigned which i want to track it and map to data loader for parent account id. 

When searching all i could get is to refer to the url for account id but it sounds senseless as there should be a way to get the acount id for display in the search result. any way to do it?
Always ThinkinAlways Thinkin
Hi Prabhu,
If you're creating an Account with Apex using an insert call, the ID will be returned after the call and can be retrieved in Apex. It is the same ID that appears in the URL. For example:

Account acct = New Account(Name = 'New Company', Country = 'USA');
insert acct;
System.debug("new account id is: " + acct.Id);

Note that in Apex the ID is the only field that can be retrieved without a SOQL query for the newly inserted record. So if you also needed to get the Parent Account ID of the newly created Account, you would have to query [SELECT ID, ParentID FROM Account WHERE ID = :acct.Id] in the above example.
 
prabhu sethupathy 6prabhu sethupathy 6
Hi thinkin

I'm not creating account using apex code but using the apps itself and I wish to see the account id displayed in the search result of the standard app. Anyway to see this?
prabhu sethupathy 6prabhu sethupathy 6
I have now done it byt creating a custom field as a advanced formula linking to Account Id and modifying the layout to display the custom field....Quite wierd though!
Always ThinkinAlways Thinkin
I agree that it's weird that it's not available for Search Results but you did it exactly the way I would have done it!