GraphRequest Class

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.

Namespace 

PlaceQuote

Example 

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;
    8    
    9           //Quote Line Item Setup
    10    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.

    Note

    1PlaceQuote.GraphRequest graph = new PlaceQuote.GraphRequest('test',listOfRecords);
    2    PlaceQuote.ConfigurationOptionsInput cInput = new PlaceQuote.ConfigurationOptionsInput();
    3    PlaceQuote.CatalogRatesPreferenceEnum catalogRatesPreference = PlaceQuote.CatalogRatesPreferenceEnum.Fetch;
    4....PlaceQuote.ConfigurationInputEnum configurationPreference = PlaceQuote.ConfigurationInputEnum.RunAndAllowErrors;
    5    PlaceQuote.PricingPreferenceEnum pricingPreference = PlaceQuote.PricingPreferenceEnum.System;
    6    //System.debug(graph);
    7      
    8    //Place Quote Call
    9    PlaceQuote.PlaceQuoteResponse resp = PlaceQuote.PlaceQuoteRLMApexProcessor.execute(pricingPreference, catalogRatesPreference, graph, configurationPreference, cInput);
    10    System.debug(resp);
  • GraphRequest Constructors

    Learn more about the available constructors with the GraphRequest class.

  • GraphRequest Properties

GraphRequest Constructors 

Learn more about the available constructors with the GraphRequest class.

The GraphRequest class includes these constructors.

GraphRequest(graphId, records) 

Creates an instance of the GraphRequest class to assign the graph ID and a list of records to be ingested.

Signature 

public GraphRequest(String graphId, List<placequote.RecordWithReferenceRequest> records)

Parameters 

graphId

Type: String

ID of the graph.

records

Type: List<placequote.RecordWithReferenceRequest>

List of records to be ingested.

GraphRequest Properties 

The following are properties for GraphRequest.

  • graphId

    Set the graphId property to assign the ID value of the graph.

graphId 

Set the graphId property to assign the ID value of the graph.

Signature 

public String graphId {get; set;}

Property Value 

Type: String