0

I am working with SObject records in Salesforce, specifically with QuoteLineItem objects, which are not enabled by default in our Salesforce environment. Instead of querying QuoteLineItem directly, I am retrieving records dynamically using SObject.

List<SObject> quoteLineItemList = (List<SObject>)odr.getSObjects('QuoteLineItems');

The problem I am facing is that I need to update the field SentinelEMSDEV__LineItemEID__c on QuoteLineItem records. Although I am able to retrieve QuoteLineItem records as SObject and check their Id fields, I am struggling to access the SentinelEMSDEV__LineItemEID__c field using dynamic methods.

for (SObject qli : quoteLineItemList) {
    System.debug('qli Object: ' + qli)

Here is the log for qli Object:

qli Object: QuoteLineItem:{QuoteId=0Q0J2000000oMXXKA2, Id=0QLJ2000000fyYOOAY, Quantity=1.00, Product2Id=01t5h00000BwAl0AAF}

The qli object only contains the fields QuoteId, Id, Quantity, and Product2Id. The SentinelEMSDEV__LineItemEID__c field is not visible in this log output. I need to dynamically access this field and update it based on certain conditions.

How to ensure the SentinelEMSDEV__LineItemEID__c field is included in the dynamically retrieved SObject records?

2
  • The "community" tag is meant to be used for a specific feature of Salesforce (community sites/experience sites). Since this question isn't about that, the tag should not be used.
    – Derek F
    Commented Sep 18 at 13:56
  • You should look at the getSObjects() method of the class that's used as the type of your odr variable.
    – Derek F
    Commented Sep 18 at 13:59

1 Answer 1

0

Here is my update on my post,

The problem is with using getSObjects() method , it restricted to retrieve some of main standard fields like Ids..etc. so that I followed the DataBase.Query(String), where String is

'SELECT Id, LineItemEID__c FROM QuoteLineItem WHERE QuoteId = :quoid WITH USER_MODE';

Now able to retrieve required fields from QuoteLineItem...

Thanks..

You must log in to answer this question.

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