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
Behzad Bahadori 18Behzad Bahadori 18 

Retriving Notes and attachments from Quote Page

I need to Query the Last notes and attachments that was added in a Quote, into a PDF, I dont now how to query that , any suggestions?
Best Answer chosen by Behzad Bahadori 18
Brian Cherry FWIBrian Cherry FWI
public Attachment[] attachments {
    get {
        if (attachments == null) {
            attachments = [
                    select Id, Name, Description, LastModifiedDate
                    from Attachment
                    where ParentId = YourObjectId
                    order by Description
                    ];
        }
        return attachments;
    }
    private set;
}

 

All Answers

Brian Cherry FWIBrian Cherry FWI
public Attachment[] attachments {
    get {
        if (attachments == null) {
            attachments = [
                    select Id, Name, Description, LastModifiedDate
                    from Attachment
                    where ParentId = YourObjectId
                    order by Description
                    ];
        }
        return attachments;
    }
    private set;
}

 
This was selected as the best answer
Behzad Bahadori 18Behzad Bahadori 18
Thank you Brian, would the ObjectId be The QuoteID in this case?
Brian Cherry FWIBrian Cherry FWI
Yes so you should have query for the variable of your QuoteID which you would replace YourObjectId

 
Behzad Bahadori 18Behzad Bahadori 18
Perfect thank you so much
ManjusrinuManjusrinu

I have a quote record where quote line items are linked to that record 

Now i need to get the attachements from the quote line items (Product) 

List<Quote> QuoteList = [SELECT Id,(SELECT Id FROM QuoteLineItems) FROM Quote where id = '0Q02w0000005Z2t'] ;
        for(QuoteLineItem eachproduct : QuoteList[0].QuoteLineItems){
           lineitemids.add(eachproduct.Id);
        }
        system.debug('vvvvvv' + lineitemids);

In the lineitems i am getting quoteline items ,but i need to get linked products

Can anyone help me ?..