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
anukarthi_nimmalaanukarthi_nimmala 

Regarding document id

Hi,

 

Iam inserting document in to documents object using custom controller .So once i save the document its saving to document object. After saving i want to dispaly the saved document  id in the visualforce page.So how to catch the saved document id in apex controller and then how to pass that id to the vpages  and howto display it in visualforce page up on saving the document.please give me any ideas.

 

If possible please explain me with an example code of doing it .

 

                                                     Thanks and regards,

                                                                  ANu..

 

Alok_NagarroAlok_Nagarro

Hi anukarthi,

 

Below is the code,that will help you.

 

// *********** you created new document

 

    Document d=new Document();
    d.Body=this.theBlob;
    d.Name=this.fileName;
    d.FolderId='00lS0000000Qjcj';
    insert d;

//*********** after insert it , now u have id of this document,using this id you can fetch this document


    this.myUrl='https://cs1.salesforce.com/servlet/servlet.FileDownload?file='+d.Id;

 

The marked url is the fixed format of accessing document, only id is changed.

so provide id of your document (which is u have after inserting document).

 

I think,this snap of code will help u,if u have more problem,let me know.

 

 

 

Thanks.