0

Get associated Quote ID from opportunity / Groovy custom column

ecamci 1 year ago in API updated 1 year ago 1

Hi everyone,

I'm preparing a custom column that works on any opportunities view. I want to find the quote associated with every opportunity on a set view. I have implemented a solution far from ideal, which includes getting the opportunity's name and using QuoteFilter to find a quote by the same name. As expected, it doesn't work if the quote's name is different than the opportunity's (if someone's changed the quote's name), or if there are multiple quotes by the same name. I would like to do the same thing with IDs, but I don't know of any methods I am aware of that can take an opportunity ID and give the quote associated with the opportunity. Has anybody accomplished something like this? Is this possible at all?

Thanks in advance for reading.

Efe

Solved. OpportunityRow class doesn't have a method for getting a quote but OpportunityOfferRow does. Use getOffer() on OpportunityRow, assign all offers to a List<OpportunityOfferRow>; use a for loop to get every OpportunityOfferRow inside the list, run getQuote() on each and compare it to null, then finally assign the first non-null quote to a different variable and break the loop.