+ Start a Discussion
Gaurav RajGaurav Raj 

How to query a file id and appent it to the salesforce url?

How to query a file id from a custom objects Notes and Attachment and append this id to the salesforce's url?


can someone help me with the code


If you want to query the attachment from the note and attachment of an associated object, then 1st you should know your parent object and then fire a query again the attachment object from where you can get you're file id


//Capture the account Id first;
id accountId = 'yourAccountid';

//Then get all the attachment records associated to the account
list<attachment> attachmentList = [select id, name from attachment where parentId =: accountId];