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?
getSObjects()
method of the class that's used as the type of yourodr
variable.