0

We have a before delete trigger on QuoteLineItem and are trying to access one of Quote's fields using soql query on the quote line item with help of the id, but we are not able to get the field from Quote. I am just confused since the QuoteId is available in the before delete trigger context, can't we access Quote's field in the before trigger context as well. If not, is there any other way to do it besides querying Quote explicitly since we want to make it generic for all objects?

A simple query like:

QuoteLineItem qli=[Select id, Quote.test_field__c from QuoteLineItem where id =''];

This only returns id and QuoteId while Quote has some value in the test_field__c as well.

Thanks in advance! Any help is appreciated!

2
  • Yes, you should be able to. Some code that demonstrates your issue would help us diagnose the problem, though.
    – sfdcfox
    Dec 30, 2020 at 13:18
  • @sfdcfox A simple query on quotelineitem getting the field from quote doesn't seem to return any value in before delete trigger. It should work right? I have edited my question a bit.Thanks!
    – Isha
    Dec 30, 2020 at 13:24

1 Answer 1

0

This is working, don't know why I couldn't think about it before. I am able to retrieve Quote's field in before delete trigger. Though the field was not visible when debugging the QuoteLineItem record. It was available when I tried to retrieve it using dot operator as in for example:

QuoteLineItem qli=[Select id, Quote.test_field__c from QuoteLineItem where id =''];

The debug was QuoteLineItem[Id = '', QuoteId=''], but when you try to retrieve it, It's available as below:

qli.Quote.test_field__c ==> gives you the value.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .