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
BpositiveBpositive 

Single record fetch

Is there any way in which I can fetch a single record by specifying the primary key?

Thank you.

 

~VK

Navatar_DbSupNavatar_DbSup

Hi,

 

In salesforce id is a unique identifier. You can retrieve a single record on the basis of id.

 

Try the below code snippet as reference:

Contact con=[select name from contact where id= ‘id’];

 

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved. 

 

 

 

BpositiveBpositive

Thank you very much.

 

I am completely new to this enviornment.I got what you were trying to say.

This SFQL should work, but I need to fetch the entire record. It that case I can use "Select * from..."

Can you please guide me as to where I should write this query and where do I compile and run it?

Secondly, I think I will need an search button for this action to be performed. Can you provide links or a little guidance on that too?

 

Thank you once again.Your help is appreciated.

 

~VK

jhansisridhar_2011jhansisridhar_2011

Hi,

 

You can use Legacy System Id to fetch complete record, Legacy system is alo a complete unique id.

 

for ex: select * from "table name" where Legacysystemid = 'IND0123"

 

Hope this solutions helps u , Mark as solution if this post work.

shra1_devshra1_dev

No you cannot query that way.

 

 

You need to specify all the standard and custome fields with comma separated.

 

ex:[select Id,Name,Phone,Email__c from Account];

 

Regards,

Shravan