Contains constructors and properties to set the graph ID and a list of records to be ingested. The list of records is specified in a key-value map format that contains the field values of an order.
Invoke the Place Quote Apex API by using these steps.
Set up a quote and quote line item. To associate the Record object with a reference identifier, create an instance of the RecordWithReferenceRequest class.
1//Quote Setup 2 PlaceQuote.RecordResource quoteRecord = new PlaceQuote.RecordResource(Quote.getSobjectType(),'POST');3 Map<String,Object>quoteFieldValues = new Map<String,Object>();4 quoteFieldValues.put('Name','q-ap12');5 quoteFieldValues.put('OpportunityId','006xx000001aBFcAAM');6 quoteFieldValues.put('Pricebook2Id','01sxx0000005pvRAAQ');7 quoteRecord.fieldValues = quoteFieldValues;89 //Quote Line Item Setup10 PlaceQuote.RecordResource quoteLineItemRecord1 = new PlaceQuote.RecordResource(QuoteLineItem.getSobjectType(),'POST');11 Map<String,Object>quoteLineItemFieldValues = new Map<String,Object>();12 quoteLineItemFieldValues.put('Product2Id','01txx0000006ibwAAA');13 quoteLineItemFieldValues.put('PricebookEntryId','01uxx0000008zPqAAI');14 quoteLineItemFieldValues.put('Quantity','2.0');15 quoteLineItemFieldValues.put('UnitPrice','5.0');16 quoteLineItemFieldValues.put('StartDate','2023-03-15');17 quoteLineItemFieldValues.put('QuoteId','@{refQuote.id}');18 quoteLineItemRecord1.fieldValues = quoteLineItemFieldValues;19 PlaceQuote.RecordWithReferenceRequest quoteItemRecords = new PlaceQuote.RecordWithReferenceRequest('refQuote',quoteRecord);20 PlaceQuote.RecordWithReferenceRequest quoteLineItemRecords1 = new PlaceQuote.RecordWithReferenceRequest('refQuoteItem1',quoteLineItemRecord1);
To create a quote line relationship, create an instance of the RecordResource class.
1PlaceQuote.RecordResource quoteLineRelationship1 = new PlaceQuote.RecordResource(QuoteLineRelationship.getSobjectType(),'POST');2 Map<String,Object>quoteLineRelationshipValues = new Map<String,Object>();3 quoteLineRelationshipValues.put('ProductRelationshipTypeId','0yoxx00000000JNAAY');4 quoteLineRelationshipValues.put('MainQuoteLineId','@{refQuoteItem2.id}');5 quoteLineRelationshipValues.put('AssociatedQuoteLineId','@{refQuoteItem1.id}');6 quoteLineRelationshipValues.put('AssociatedQuoteLinePricing','IncludedInBundlePrice');7 quoteLineRelationship1.fieldValues = quoteLineRelationshipValues;
Create the list of records to be ingested.
1PlaceQuote.RecordWithReferenceRequest quoteLineRelationship = new PlaceQuote.RecordWithReferenceRequest('QuoteLineRelationship',quoteLineRelationship1);2 List<PlaceQuote.RecordWithReferenceRequest>listOfRecords = new List<PlaceQuote.RecordWithReferenceRequest>();3 listOfRecords.add(quoteItemRecords);4 listOfRecords.add(quoteLineItemRecords1);5 listOfRecords.add(quoteLineItemRecords2);6 listOfRecords.add(quoteLineRelationship);
To contain all record objects, create an instance of the GraphRequest class.
The CatalogRatesPreferenceEnum enum is available when the Usage-Based Selling feature is enabled.