LeadtoCashCore - Scoped

  • Release version: Xanadu
  • Updated August 1, 2024
  • 33 minutes to read
  • The LeadtoCashCore script include provides methods to orchestrate a lead-to-cash workflow in the Lead to Cash Core life cycle.

    The Lead to Cash Core (com.snd.l2c.core) plugin must be activated for LeadtoCashCore script includes to be available in an instance. This script include belongs to the sn_l2c_core namespace and requires the admin role.

    In a lead to cash workflow, you map a source entity to a target entity. An entity is defined as a collection of tables. Source-to-target mapping allows you to transform the structure or content of the source entity to fit the structure or content needed in the target entity. The functionality provided by this script include represents the entity mapping feature available in the Lead to Cash feature. See Sales and Order Management workflows for more information.

    To complete a workflow using the LeadtoCash script include, you pass return parameters from one method to the next. Typically, you call these methods in the following order:

    1. LeadtoCashCore - createInstance(String headerSysIDs, String lineSysIDs, Boolean isTarget, Object additionalParams) - Fetches the data of a given entity. For example, customer order-related information including line items and their related data.

      Use the context parameter to declare one or more header or line IDs in the script. For such multi-select use cases, the output JSON contains a key items array where each entry represents a single entity.

    2. LeadtoCashCore - delta(Object sourceJSON, Object dirtyJSON, Object additionalParams) - Compares two JSON inputs and identifies any changes that occurred between them. For example, when something is added, deleted, or modified in an entity.
    3. LeadtoCashCore - effect(Object sourceJSON, Object targetJSON, Object additionalParams) - Transforms the source JSON target into a target object.
    4. LeadtoCashCore - commitInstance(Object targetJSON, Object additionalParams) - Commits the transformation made in the effect() script include to the database.
    Note:
    If necessary, delta() may be skipped in this workflow. However, calling these methods out of order results in an unsuccessful workflow (for example, when calling commitInstance() and then effect()).

    Prerequisites

    Each of these methods are bundled with an extension point, sn_l2c_core.LeadToCashServiceEP. PrimitiveUtil() is a utility which provides methods to get the extension point service and invokes the script includes according to their available parameters. You must first provide PrimitiveUtil() with the getPrimitivesEPService() method, which specifies the table to get source and target information from. For more information, see LeadtoCashCore - getPrimitivesEPService(String sourceToTargetConfigID, Object context). Once PrimitiveUtil() and getPrimitivesEPService() are provided in the script, you can then call any of the createInstance(), delta(), effect(), or commitInstance() script includes as needed for your use case.

    Example Lead to Cash Core workflow script

    Though each of the available Lead to Cash Core script includes are documented individually, you can reference the following example to see how you can use these methods together to produce a Lead to Cash work flow.

    var util = new sn_l2c_core.PrimitiveUtil(); 
     
    var context = {"isMultiSelect": false}; // Set the context.isMultiSelect parameter as true to enable multi-select use cases
    
    //Flow: Creation of Order from a sold product 
    var service = util.getPrimitivesEPService('sn_l2c_cust_flows_sp_to_order', context);  
      
    //CREATE INSTANCE to get the data of sold product with sys_id '06670ba3c3adbd501caee74bb0013166' 
    var SPInstance = service.createInstance(null, '06670ba3c3adbd501caee74bb0013166');  
    gs.info("SPInstance: "+JSON.stringify(SPInstance));  
      
    // DELTA  
    // construct the dirtyJSON as required  
    var deltaOutput = service.delta(SPInstance, dirtyJSON);/  
    gs.info("deltaOutput: "+JSON.stringify(deltaOutput));  
      
    // EFFECT  
    var effectOutput = service.effect(deltaOutput);  
    gs.info("effectOutput: " + JSON.stringify(effectOutput));  
      
    // COMMIT INSTANCE 
    var commitOutput = service.commitInstance(effectOutput);  
    gs.info("commitOutput: " + JSON.stringify(commitOutput));
    In our example, a customer purchased a sold product but now requests a modification on the existing sold product. The required modifications are provided in the form of a dirtyJSON. To apply these modifications, we call the Lead to Cash Core methods in the following order:
    1. The first call gets the existing sold product information using the createInstance() method.
    2. We then compare this source JSON with the dirty JSON using the delta() method, which returns a delta JSON.
    3. The delta() JSON is then transformed into a JSON of type order using the effect() method.
    4. The order JSON is committed to the database using the commitInstance() method.

    LeadtoCashCore - getPrimitivesEPService(String sourceToTargetConfigID, Object context)

    Triggers the PrimitiveUtil() utility method.

    To use any of the available methods in the LeadtoCashCore script include, you must first always call the scripted extension point PrimitiveUtil() in your script with the getPrimitivesEPService() utility method to trigger the implementation.

    Table 1. Parameters
    Name Type Description
    context Object Optional. Additional parameter options for displaying attribute values and for invoking more than one instance at a time.
    "context": {
      "isMultiSelect": "Boolean"
      "loadDisplayValue": "Boolean"
    }
    context.isMultiSelect Boolean Optional. Flag that indicates whether to pass multiple entities as input to create the instance.
    Valid values:
    • true: Enables the passing of multiple entities as input. When true, you can pass multiple line items in a comma-separated list.
    • false: Doesn't enable the passing of multiple entities as input. Only one input may be passed in the API script.

    Default: false

    context.loadDisplayValue Boolean Optional. Flag that indicates whether to load the display value for each attribute.
    Valid values:
    • true: Enables the loading of an attribute's display value.
    • false: Doesn't enable the loading of an attribute's display value.

    Default: false

    sourceToTargetConfigID String Mapping configuration ID for the source-to-target mapping.

    Table: Lead To Cash Entity Mapping [sn_l2c_core_entity_mapping]

    Table 2. Returns
    Type Description
    None

    The following example invokes PrimitiveUtil() and picks an implementation based on sn_l2c_cust_flows_sp_to_order, which is a Mapping Config ID in the Lead To Cash Entity Mapping [sn_l2c_core_entity_mapping] table.

    //Utility to invoke createInstance API  
    var util = new sn_l2c_core.PrimitiveUtil(); 
    var context = {"isMultiSelect": true}; // Set the context.isMultiSelect parameter as true to enable multi-select use cases
    
    //Invokes the extension point and specifies an implementation based on sourceToTargetConfigID of a L2C flow.  
    var service = util.getPrimitivesEPService('sn_l2c_cust_flows_sp_to_order’, context)

    LeadtoCashCore - createInstance(String headerSysIDs, String lineSysIDs, Boolean isTarget, Object additionalParams)

    Returns the data of one or more given entities with a JSON object containing various details such as header, lines, child lines, characteristics, and their attributes.

    Use the output JSON of the createInstance() method in subsequent methods of the Lead to Cash Core workflow such as delta(), effect(), and commitInstance().

    Note:
    The LeadtoCashCore script include requires you to first call the script utility method PrimitiveUtil() with the LeadtoCashCore - getPrimitivesEPService(String sourceToTargetConfigID, Object context) utility method to trigger the implementation before calling createInstance() in your script. Per each flow, get the service only once and use the same service for all LeadtoCashCore methods.

    Set the getPrimitivesEPService() boolean parameter context.isMultiSelect to true to enable createInstance() to pass multiple, comma-separated headerIDs or lineIDs at a time. Otherwise, you can only pass one ID at a time. See LeadtoCashCore - getPrimitivesEPService(String sourceToTargetConfigID, Object context) for more details. The single headerID use case with multiple lineIDs is supported without setting context.isMultiSelect to true.

    Table 3. Parameters
    Name Type Description
    additionalParams Object Optional. Additional parameters to use.
    additionalParams.skipLines Boolean Optional. Flag that indicates whether to fetch line items for the specified entity.
    Valid values:
    • true: Skip returning line items information for the entity.
    • false: Return line items information for the entity.

    Default: false

    headerSysIDs String Header sys_id(s) of an entity to retrieve data from. Required if you don't provide the lineSysIDs parameter. Pass null if you aren't passing any header sys_ids.

    To designate one or more header sys_ids in your script, set context.isMultiSelect = true in the getPrimitivesEPService() utility method. For more details, see the Parameters table in LeadtoCashCore - getPrimitivesEPService(String sourceToTargetConfigID, Object context).

    Note:
    At least one headerSysID or lineSysIDs parameter is required.
    isTarget Boolean Optional. Flag that determines whether to fetch target entity data.
    Valid values:
    • true: Fetch data of the target entity.
    • false: Don't fetch data of the target entity.

    Default: false

    lineSysIDs String Line item sys_id(s) of an entity to retrieve entity data from. Required if you don't provide headerSysIDs and if the entity structure starts with line items such as sold product.

    To designate one or more line item sys_ids in your script, set context.isMultiSelect = true in the getPrimitivesEPService() utility method. For more details, see the Parameters table in LeadtoCashCore - getPrimitivesEPService(String sourceToTargetConfigID, Object context).

    Note:
    At least one headerSysID or lineSysIDs parameter is required. If passing multiple lineSysIDs, all records must belong to the same headerSysID.
    Table 4. Returns
    Type Description
    JSON Object A JSON containing details of the entity record.

    Data type: Array of objects

    {
    "items": [
      {
      "attributes": {Object},
      "sys_id": {Object},
      "table": "String",
      "lineItems": [
        {
         "attributes": {Object},
         "sys_id": {Object},
         "table": "String",
         "characteristics": [Array],
         "lineItems": [Array]
         }
        ],
      "characteristics": [Array],
      "_state": "String"
      }
     ]
    }
    _state Activity state of the entity.

    Possible values:

    • active: The entity is active.
    • inactive: The entity is inactive.

    Default: active

    Data type: String

    characteristics List of entity characteristics. Characteristics may vary between entities.

    Data type: Array of objects

    "characteristics": [  
            {  
              "attributes": {Object},
              "sys_id": {Object},  
              "table": "String"
            }  
          ]
    characteristics.attributes One or more objects that contain information about attributes associated with the characteristic record. The <attribute type> can be different values based on the records/functionality associated with the characteristic. For example, this object could contain references to the attributes record's sys_id, associated characteristic records, characteristic option records, or sold product information.

    Data type: Object

    "attributes": {
      "<attribute_type>": {Object}
    }
    characteristics.attributes.<attribute_type> Information about the key name of the item attribute.
    "<key_name>": { 
      "value": "String" 
    }

    Data type: Object

    characteristics.attributes.<attribute_type>.value Typically the sys_id of the of the associate attribute record, but can be any meaningful text string that describes the associated attribute type.

    Data type: String

    characteristics.sys_id Object containing the sys_id of the associated characteristic record.

    Data type: Object

    "sys_id": { 
      "value": "String" 
     }
    characteristics.sys_id.value Sys_id of the associated characteristic record.

    Data type: String

    characteristics.table Name of the table that contains the characteristic record of the lead to cash entity.

    Data type: String

    items Contains an array of selected objects when context.isMultiSelect is set to true.

    Data type: Array of Objects

    "items": [
    { 
      "attributes": {Object}, 
      "sys_id": {Object}, 
      "table": "String",
      "lineItems": [Array]
     }, 
    ]
    items.attributes Attributes of the item record. Attributes may vary between entities.
    "attributes": {
      "account": {Object},
      "name": {Object}
    }

    Data type: Object

    items.attributes.account Information about the account associated with the item attribute.
    "account": { 
      "value": "String" 
    }
    items.attributes.account.value Attributes of the item. Attributes may vary between entities.
    "attributes": {
      "account": {Object},
      "<key_name>": {Object}
    }

    Data type: Object

    items.attributes.<key_name> Information about the key name of the item attribute.
    "<key_name>": { 
      "value": "String" 
    }

    Data type: Object

    items.attributes.<key_name>.value Value of the key name attribute.

    Data type: String

    items.sys_id Object containing sys_id information about the entity item. Values vary between entities.

    Data type: Object

    "sys_id": {
      "value": "String"
    }
    items.sys_id.value Sys_id of an associated item.

    Data type: String

    items.table Name of the table that contains line item record associated with the lead to cash entity.

    Data type: String

    items.lineItems JSON object that contains the line item details of the entity record.

    Data type: Array of objects

    "lineItems": [ 
      { 
        "attributes": {Object},
        "characteristics": [Array],
        "lineItems": [Array],
        "_state": "String",
        "sys_id": {Object},
        "table": "String"
      }
    ]
    items.lineItems._state Activity state of the line item entity.

    Possible values:

    • active: The entity is active.
    • inactive: The entity is inactive.

    Default: active

    Data type: String

    items.lineItems.attributes Attributes of the line item record. Attributes may vary between entities.
    "attributes": {
      "account": {Object},
      "<key_name>": {Object}
    }

    Data type: Object

    items.lineItems.attributes.<key_name> Information about the key name of the line item attribute.
    "<key_name>": { 
      "value": "String" 
    }

    Data type: Object

    items.lineItems.attributes.<key_name>.value Value of the key name attribute.

    Data type: String

    items.lineItems.attributes.account Information about the account associated with the line item attribute.
    "account": { 
      "value": "String" 
    }
    items.lineItems.attributes.account.value Sys_id of the account associated with the line item attribute.

    Data type: String

    items.lineItems.characteristics List of characteristics associated with the line item. Characteristics may vary between entities.

    Data type: Array of objects

    "characteristics": [  
            {  
              "attributes": {Object},
              "sys_id": {Object},  
              "table": "String"
            }  
          ]
    items.lineItems.characteristics.attributes One or more objects that contain information about attributes associated with the characteristic record. The <attribute type> can be different values based on the records/functionality associated with the characteristic. For example, this object could contain references to the attributes record's sys_id, associated characteristic records, characteristic option records, or sold product information.

    Data type: Object

    "attributes": {
      "<attribute_type>": {Object}
    }
    items.lineItems.characteristics.attributes.<attribute_type>.value Typically the sys_id of the of the associate attribute record, but can be any meaningful text string that describes the associated attribute type.

    Data type: String

    items.lineItems.characteristics.sys_id Object containing the sys_id of the associated characteristic record.

    Data type: Object

    "sys_id": { 
      "value": "String" 
     }
    items.lineItems.characteristics.sys_id.value Sys_id of the associated characteristic record.

    Data type: String

    items.lineItems.characteristics.table Name of the table that contains the characteristic record of the lead to cash entity.

    Data type: String

    items.lineItems.lineItems Child line items of a parent line item. This object has the same format as the lineItems parameter.

    Data type: Object

    "lineItems": [
      { 
        "attributes": {Object},
        "characteristics": [Array],
        "lineItems": [Array],
        "_state": {Object},
        "sys_id": {Object},
        "table": "String"
      }
    ] 
    items.lineItems.sys_id Object containing sys_id information about the associated line item record.

    Data type: Object

    "sys_id": {
      "value": "String"
    }
    items.lineItems.sys_id.value Sys_id of an associated line item record.

    Data type: String

    items.lineItems.table Name of the table that contains the line item record associated with the lead to cash entity.

    Data type: String

    The example script below invokes the createInstance() method to load the data of a sold product, its entire hierarchy, and its characteristics.

    //Utility to invoke createInstance API 
    var util = new sn_l2c_core.PrimitiveUtil();  
     
    //Invoke extension point, picks an implementation based on sourceToTargetConfigID of a L2C flow, the Mapping Config ID  in "sn_l2c_core_entity_mapping" table. 
    var service = util.getPrimitivesEPService('sn_l2c_cust_flows_sp_to_order'); 
     
    //Invoke createInstance API with required params 
    var SPInstance = service.createInstance(null, '4e03cda2ec873110f87727ef5883a2cf'); 
     
    //Print the returned JSON 
    gs.info("SPInstance: "+JSON.stringify(SPInstance));  
     
    //The returned JSON can be used for subsequent methods of the flow such as delta(), effect() and commitInstance()

    Output:

    { 
      "lineItems": [ 
        { 
          "table": "sn_install_base_sold_product", 
          "sys_id": { 
            "value": "4e03cda2ec873110f87727ef5883a2cf" 
          }, 
          "attributes": { 
            "name": { 
              "value": "Quadplay Home Tech Hub Bundle" 
            }, 
            "account": { 
              "value": "9e2fd2ee11b43110f877366201dea674" 
            } 
          }, 
          "lineItems": [ 
            { 
              "table": "sn_install_base_sold_product", 
              "sys_id": { 
                "value": "9e0301e2ec873110f87727ef5883a23a" 
              }, 
              "attributes": { 
                "name": { 
                  "value": "Internet and OTT Bundle" 
                }, 
              "_state": "active",
              "account": { 
                  "value": "9e2fd2ee11b43110f877366201dea674" 
                } 
              }, 
              "lineItems": [ 
              ], 
              "characteristics": [] 
            } 
          ], 
          "characteristics": [ 
            { 
              "table": "sn_prd_pm_product_characteristics", 
              "sys_id": { 
                "value": "8d669b6665ebf110f877d71ec56bf75c" 
              }, 
              "attributes": { 
                "sys_id": { 
                  "value": "8d669b6665ebf110f87d71ec56bf75c" 
                },
              "_state": "active", 
              "characteristic_value": { 
                  "value": "" 
                }, 
              "characteristic": { 
                  "value": "4f31999fd0a63110f8770dbf976be178" 
                }, 
              "characteristic_option": { 
                  "value": "4f31999fd0a63110f8770dbf976be179" 
                }, 
              "sold_product": { 
                  "value": "4e03cda2ec873110f87727ef5883a2cf" 
                } 
              } 
            } 
          ] 
        } 
      ] 
    }

    Multi-select

    The following script demonstrates how to use isMultiSelect to invoke the createInstance() method and load the data of two sold products with their entire hierarchy and characteristics.

    //Utility to invoke createInstance API  
    var util = new sn_l2c_core.PrimitiveUtil();   
    
    //Set context variable isMultiSelect true to enable multi-select 
    var context = {"isMultiSelect": true}; 
    //Invoke extension point, picks an implementation based on sourceToTargetConfigID of a L2C flow, the Mapping Config ID  in “sn_l2c_core_entity_mapping” table.  
    var service = util.getPrimitivesEPService('sn_l2c_cust_flows_sp_to_order’, context);  
      
    //Multiple sold products selected  
    var selectedLineitems = '4e03cda2ec873110f87727ef5883a2cf,036a2349284d0210f877b68370fb2e93'; 
    
    //Invoke createInstance API with required params  
    var SPInstance = service.createInstance(null, selectedLineitems);  
      
    //Print the returned JSON  
    gs.info("SPInstance: "+JSON.stringify(SPInstance));   
      
    //The returned JSON can be used for subsequent APIs of the flow such as Delta, Effect and Commit Instance 

    Response:

    {  
      "items": [ 
        { 
          "lineItems": [ 
            { 
              "table": "sn_install_base_sold_product", 
              "sys_id": { 
                "value": "4e03cda2ec873110f87727ef5883a2cf" 
              }, 
              "attributes": { 
                "name": { 
                  "value": "Quadplay Home Tech Hub Bundle" 
                }, 
                "account": { 
                  "value": "9e2fd2ee11b43110f877366201dea674" 
                } 
              }, 
              "lineItems": [ 
                { 
                  "table": "sn_install_base_sold_product", 
                  "sys_id": { 
                    "value": "9e0301e2ec873110f87727ef5883a23a" 
                  }, 
                  "attributes": { 
                    "name": { 
                      "value": "Internet and OTT Bundle" 
                    }, 
                    "account": { 
                      "value": "9e2fd2ee11b43110f877366201dea674" 
                    } 
                  }, 
                  "lineItems": [], 
                  "characteristics": [] 
                } 
              ] 
            } 
          ] 
        }, 
        { 
          "lineItems": [ 
            { 
              "table": "sn_install_base_sold_product", 
              "sys_id": { 
                "value": "036a2349284d0210f877b68370fb2e93" 
              }, 
              "attributes": { 
                "name": { 
                  "value": "Quadplay Home Tech Hub Bundle" 
                }, 
                "account": { 
                  "value": "9e2fd2ee11b43110f877366201dea674" 
                } 
              }, 
              "lineItems": [ 
                { 
                  "table": "sn_install_base_sold_product", 
                  "sys_id": { 
                    "value": "4b6a2349284d0210f877b68370fb2e9c" 
                  }, 
                  "attributes": { 
                    "name": { 
                      "value": "Internet and OTT Bundle" 
                    }, 
                    "account": { 
                      "value": "9e2fd2ee11b43110f877366201dea674" 
                    } 
                  }, 
                  "lineItems": [], 
                  "characteristics": [] 
                } 
              ], 
              "characteristics": [],
              "_state": "active" 
            } 
          ] 
        } 
      ] 
    }

    LeadtoCashCore - delta(Object sourceJSON, Object dirtyJSON, Object additionalParams)

    Compares the source and modified source JSON objects of a lead to cash entity and returns a JSON object that describes any changes made to the source JSON, such as any additions, deletions, or modifications.

    Note:
    The LeadtoCashCore script include requires you to first call the scripted extension point PrimitiveUtil() with the LeadtoCashCore - getPrimitivesEPService(String sourceToTargetConfigID, Object context) utility method to trigger the implementation before calling delta() in your script. Per each flow, get the service only once and use the same service for all LeadtoCashCore methods.
    Table 5. Parameters
    Name Type Description
    sourceJSON Object JSON object of the source lead to cash entity.
    dirtyJSON Object Modified source JSON of the lead to cash entity.
    additionalParams Object Optional. Additional parameters to use.
    additionalParams.delta_ignore_attributes Object Table attributes to ignore during comparison between the source and dirtyJSON. Enables support of reconfiguration  use cases.
    {  
    “<table_name>”: [<attribute_name1>, attribute_name2>] 
    }
    additionalParams.delta_ignore_attributes.<table_name> String The name of the table and its associated attributes to ignore.

    For example:

    {  
    “sn_install_base_sold_product”: [“state”,”unit_price”]  
    }
    additionalParams.loadDisplayValue Boolean Optional. Flag that indicates whether to load the display value for each attribute.
    Valid values:
    • true: Enables the loading of an attribute's display value.
    • false: Doesn't enable the loading of an attribute's display value.

    Default: false

    Table 6. Returns
    Type Description
    JSON Object An object containing details of the entity record with any changes that occurred between the sourceJSON and dirtyJSON.

    Data type: Object

    {
    "lineItems": [Array] 
    }
    lineItems JSON object that contains the line item details of the entity record. For example, order line items or quote line items.

    Data type: Array of objects

    "lineItems": [ 
     {
      "_action": "String",
      "attributes": {Object}
      "characteristics": [Array]
      "lineItems": [Array],
      "sys_id": {Object},
      "table": "String"
     } 
    ]
    lineItems._action Change action applied to the line item of the source JSON.
    Possible values:
    • add: Information was added to the source JSON.
    • change: Information was updated in the source JSON.
    • disconnect: Information was disconnected from the source JSON.
    • nochange: No change occurred on the source JSON.

    Data type: String

    lineItems.attributes Attributes of the line item. For example, the attribute's name and value. May contain varying fields based on the entity.

    Data type: Object

    "attributes": { 
      "<attribute_name>": {Object}
    }
    lineitems.attributes.<attribute_name> Name of the line item attribute. For example, the name of an account or contact. May contain varying fields of the entity.

    Data type: Object

    "attributes": { 
     "<attribute_name>": { 
     "value": "String"
     }
    }
    lineitems.attributes.<attribute_name>.value Value of the line item attribute.

    Data type: String

    lineItems.attributes.account Information about the account associated with the item attribute.

    Data type: Object

    "account": { 
      "value": "String" 
    }
    lineItems.attributes.account.value Sys_id of the account associated with the line item attribute.

    Data type: String

    lineItems.characteristics Characteristics of the line item. May contain varying fields based on the entity.

    Data type: Array of Objects

    "characteristics": [  
     {  
      "attributes": {Object},
      "sys_id": {Object},  
      "table": "String"
      }  
    ]
    lineItems.characteristics.attributes Attributes of the header record characteristics. For example, the attribute's name and value. May contain varying fields based on the entity.

    Data type: Object

    "attributes": { 
     "<field_name>": { 
     "value": "String"
    }
    lineitems.characteristics.attributes.<field_name> Attribute name of the characteristic record associated with the line item.

    Data type: Object

    "<field_name>": { 
      "value": "String" 
    }
    lineitems.characteristics.attributes.<field_name>.value Value of the attribute belonging to the characteristic record of an entity.

    Data type: String

    lineItems.characteristics.sys_id Sys_id object of the characteristic record.

    Data type: Object

    "sys_id": { 
      "value": "String" 
    }
    lineItems.characteristics.sys_id.value Sys_id value of the associated characteristic record. The updated table may vary between entities. For example, Order [sn_ind_tmt_orm_order].

    Data type: String

    lineItems.characteristics.table Table name of the characteristic record.

    Data type: String

    lineItems.lineItems Child line items of a parent line item. This object has the same format as the lineItems parameter.

    Data type: Array of Objects

    "lineItems": [  
     {  
      "_glide_action": "String",
      "attributes": {Object},
      "characteristics": [Array],
      "lineItems": [Array],
      "sys_id": {Object},
      "table": "String"
     } 
    ]
    lineItems.sys_id Sys_id of the associated item record.

    Data type: Object

    "sys_id": {
      "value": "String"
    }
    lineItems.sys_id.value Sys_id of an associated item record. The updated table may vary between entities, like Order or Specification. For example, Order [sn_ind_tmt_orm_order].

    Data type: String

    lineItems.table Name of the table that contains the item record associated with the lead to cash entity.

    Data type: String

    The following example demonstrates how to call the delta() method by first calling the PrimitiveUtil utility method and getPrimitiesEPService(), and then providing the source and target JSON objects.

    //Utility to invoke Delta API 
    var util = new sn_l2c_core.PrimitiveUtil();  
     
    //Invoke extension point, picks an implementation based on sourceToTargetConfigID of a L2C flow, the Mapping Config ID  in “sn_l2c_core_entity_mapping” table. 
    var service = util.getPrimitivesEPService('sp_order_macd'); 
     
    //Invoke delta API with required params 
    // sourceJSON can be the output of createInstance or null 
    //dirtyJSON is the modified sourceJSON 
    var deltaOutput= service.delta(sourceJSON, dirtyJSON);  
     
    //Print the returned JSON 
    gs.info(" deltaOutput: "+JSON.stringify(deltaOutput));  
     
    //The returned JSON can be used for subsequent APIs of the flow such as Effect and Commit Instance

    The output JSON shows that several line items were added to the sold base product:

    { 
      "lineItems": [ 
        { 
          "table": "sn_install_base_sold_product", 
          "sys_id": { 
            "value": "-1" 
          }, 
          "attributes": { 
            "name": { 
              "value": "Quadplay Home Tech Hub Bundle" 
            }, 
            "account": { 
              "value": "9e2fd2ee11b43110f877366201dea674" 
            } 
          }, 
          "lineItems": [ 
            { 
              "table": "sn_install_base_sold_product", 
              "sys_id": { 
                "value": "-1" 
              }, 
              "attributes": { 
                "name": { 
                  "value": "Internet and OTT Bundle" 
                }, 
                "account": { 
                  "value": "9e2fd2ee11b43110f877366201dea674" 
                } 
              }, 
              "lineItems": [ 
                { 
                  "table": "sn_install_base_sold_product", 
                  "sys_id": { 
                    "value": "-1" 
                  }, 
                  "attributes": { 
                    "name": { 
                      "value": "Solana Sports streaming channel" 
                    }, 
                    "account": { 
                      "value": "9e2fd2ee11b43110f877366201dea674" 
                    } 
                  }, 
                  "lineItems": [], 
                  "characteristics": [], 
                  "_action": "add" 
                } 
              ], 
              "characteristics": [], 
              "_action": "add" 
            } 
          ], 
          "characteristics": [ 
            { 
              "table": "sn_prd_pm_product_characteristics", 
              "sys_id": { 
                "value": "-1" 
              }, 
              "attributes": { 
                "characteristic_value": { 
                  "value": "" 
                }, 
                "characteristic": { 
                  "value": "4f31999fd0a63110f8770dbf976be178" 
                }, 
                "characteristic_option": { 
                  "value": "4f31999fd0a63110f8770dbf976be179" 
                }, 
                "sold_product": { 
                  "value": "4e03cda2ec873110f87727ef5883a2cf" 
                }, 
                "action": { 
                  "value": "add" 
                } 
              }, 
              "_action": "add" 
            } 
          ], 
          "_action": "add" 
        } 
      ] 
    } 

    Multi-select

    The following example shows how to form the multi-select delta() method by first calling PrimitiveUtil and getPrimitivesEPService and then providing the source and target JSON objects for multiple line or header IDs. Per each flow, get the service only once and use the same service for all the LeadtoCashCore methods.

    /Utility to invoke Delta API  
    var util = new sn_l2c_core.PrimitiveUtil();   
    
    //Set context variable isMultiSelect true to enable multi-select 
    var context = {"isMultiSelect": true}; 
     
    //Invoke extension point, picks an implementation based on sourceToTargetConfigID of a L2C flow, the Mapping Config ID  in “sn_l2c_core_entity_mapping” table.  
    var service = util.getPrimitivesEPService(‘sn_l2c_cust_flows_sp_to_order’, context);  
      
    //Invoke delta API with required params  
    // sourceJSON can be the output of createInstance for multiple lineIDs or headerIDs or null  
    //dirtyJSON is the modified sourceJSON  
    var deltaOutput= service.delta(sourceJSON, dirtyJSON);   
      
    //Print the returned JSON  
    gs.info(" deltaOutput: "+JSON.stringify(deltaOutput));   
      
    //The returned JSON can be used for subsequent APIs of the flow such as Effect and Commit Instance

    The output JSON shows that several line items were added to the sold base product:

    { 
      "items": [ 
        { 
          "lineItems": [ 
            { 
              "table": "sn_install_base_sold_product", 
              "sys_id": { 
                "value": "4e03cda2ec873110f87727ef5883a2cf" 
              }, 
              "attributes": { 
                "name": { 
                  "value": "Quadplay Home Tech Hub Bundle" 
                }, 
                "account": { 
                  "value": "9e2fd2ee11b43110f877366201dea674" 
                } 
              }, 
              "lineItems": [ 
                { 
                  "table": "sn_install_base_sold_product", 
                  "sys_id": { 
                    "value": "9e0301e2ec873110f87727ef5883a23a" 
                  }, 
                  "attributes": { 
                    "name": { 
                      "value": "Internet and OTT Bundle" 
                    }, 
                    "account": { 
                      "value": "9e2fd2ee11b43110f877366201dea674" 
                    } 
                  }, 
                  "lineItems": [], 
                  "characteristics": [], 
                  "_action": "disconnect" 
                } 
              ], 
              "characteristics": [], 
              "_action": "disconnect" 
            } 
          ] 
        }, 
        { 
          "lineItems": [
            { 
              "table": "sn_install_base_sold_product", 
              "sys_id": { 
                "value": "036a2349284d0210f877b68370fb2e93" 
              }, 
              "attributes": { 
                "name": { 
                  "value": "Quadplay Home Tech Hub Bundle" 
                }, 
                "account": { 
                  "value": "9e2fd2ee11b43110f877366201dea674" 
                } 
              }, 
              "lineItems": [ 
                { 
                  "table": "sn_install_base_sold_product", 
                  "sys_id": { 
                    "value": "4b6a2349284d0210f877b68370fb2e9c" 
                  },
                  "attributes": { 
                    "name": { 
                      "value": "Internet and OTT Bundle" 
                    }, 
                    "account": { 
                      "value": "9e2fd2ee11b43110f877366201dea674" 
                    } 
                  }, 
                  "lineItems": [], 
                  "characteristics": [], 
                  "_action": "disconnect" 
                } 
              ], 
              "characteristics": [], 
              "_action": "disconnect" 
            } 
          ] 
        } 
      ] 
    }

    LeadtoCashCore - effect(Object sourceJSON, Object targetJSON, Object additionalParams)

    Transforms and applies the source JSON structure of a given entity to the target JSON of another entity. You can then commit the changed entity to the database using the commitInstance() method.

    You can use the output JSON of the delta() method in the effect() request. Then, commit any effect() JSON output to the database using the commitInstance() to complete the lead to cash workflow.

    Note:
    The LeadtoCashCore script include requires you to first call the scripted extension point PrimitiveUtil() with the LeadtoCashCore - getPrimitivesEPService(String sourceToTargetConfigID, Object context) utility method to trigger the implementation before calling effect() in your script. Per each flow, get the service only once and use the same service for all LeadtoCashCore methods.
    Table 7. Parameters
    Name Type Description
    sourceJSON Object JSON containing details of the source entity.
    targetJSON Object JSON containing details of the target entity.
    additionalParams Object Optional. Additional parameters to use.
    additionalParams.is_future_state Boolean Optional. Use this to support reconfiguration  use cases.
    Accepted values:
    • true: Provides context variable keys instead of dictionary field names. This allows you to provide all the attributes from the target entity instead of mapping attributes from source to target.
    • false: Provides dictionary field names.

    Default: false

    Table 8. Returns
    Type Description
    JSON Object Change that occurred and was applied from the source to target entity JSON objects at each of the header of the lead to cash entity.

    Data type: Object

    {
      "_glide_action": "String", 
      "_source_object": {Object}, 
      "lineItems": [Array]
      "sys_id": "String", 
      "table": "String"
    }
    _glide_action Indicates the change that occurred at the item level between the source and target JSON.
    Possible values (case-sensitive):
    • DELETE: Information was removed between the source and target JSON structures.
    • INSERT: Information was added between the source and target JSON structures.
    • NO_CHANGE: No change occurred between the source and target JSON structures.
    • UPDATE: Information was modified between the source and JSON structures.

    Data type: String

    lineItems Line items of an entity. For example, order line items or quote line items.

    Data type: Array of Objects

    "lineItems": [ 
     { 
      "table": "String", 
      "sys_id": {Object}, 
      "attributes": {Object}
     },
      "_action": "String",
      "_state": {Object},
      "lineItems": [Array], 
      "characteristics": [Array]
     } 
    ]
    lineItems._glide_action Change action that occurred on the line item.
    Possible values:
    • DELETE: Information was removed between the source and target JSON structures.
    • INSERT: Information was added between the source and target JSON structures.
    • NO_CHANGE: No change occurred between the source and target JSON structures.
    • UPDATE: Information was modified between the source and JSON structures.

    Data type: String

    lineItems._source_object Source entity record details to which the _glide_action was applied. This object may vary between entities.

    Data type: Object

    "_source_object": { 
      "sys_id": "String",
      "table": "String" 
    }
    lineItems._source_object.sys_id Sys_id of the source entity record that was updated.

    Data type: String

    lineItems._source_object.table Table location of the source entity record that was updated. This value may vary between entities.

    Data type: String

    lineItems._state State of the entity.

    Data type: Object

    "_state": {  
     "value": "String" 
    } 
    lineItems._state.value The current state of the entity.
    Possible values:
    • active: The entity object is in an active state.
    • inactive: The entity object isn't in an active state.

    Data type: String

    lineItems.attributes Attributes of the line item. For example, the attribute's name and value. May contain varying fields based on the entity.

    Data type: Object

    "attributes": { 
      "<attribute_name>": {Object}
    }
    lineitems.attributes.<attribute_name> Name of the line item attribute. For example, the name of an account or contact. May contain varying fields of the entity.

    Data type: Object

    "attributes": { 
     "<attribute_name>": { 
     "value": "String"
     }
    }
    lineitems.attributes.<attribute_name>.value Value of the line item attribute.

    Data type: String

    lineItems.attributes.account Information about the account associated with the item attribute.

    Data type: Object

    "account": { 
      "value": "String" 
    }
    lineItems.attributes.account.value Sys_id of the account associated with the line item attribute.

    Data type: String

    lineItems.attributes.short_description A brief description of the line item attribute.

    Data type: String

    lineItems.characteristics List of characteristics associated with the line item. Characteristics may vary between entities.

    Data type: Array of Objects

    "characteristics": [  
     {
      "_glide_action: "String",
      "attributes": {Object},
      "sys_id": {Object},  
      "table": "String"
     }  
    ]
    lineitems.characteristics._glide_action Action applied to the characteristic record belonging to the line item.

    Possible values:

    • add: Information was added to the characteristic.
    • change: Information was updated on the characteristic.
    • disconnect: Information was disconnected from the characteristic.
    • no-change: No change occurred to the characteristic.

    Data type: String

    lineItems.characteristics.attributes One or more objects that contain information about attributes associated with the characteristic record. The <attribute type> value can contain different values based on the records or functionality associated with the characteristic.

    For example, this object could contain references to the attributes record's sys_id, associated characteristic records, accounts or contacts, characteristic option records, or sold product information.

    Data type: Object

    "attributes": {
      "<attribute_type>": {Object}
    }
    lineItems.characteristics.attributes.<attribute_type>.value Value of the line item attribute.

    Data type: String

    lineitems.characteristics.attributes.<field_name> Attribute name of the characteristic record associated with the line item.

    Data type: Object

    "<field_name>": { 
      "value": "String" 
    }
    lineitems.characteristics.attributes.<field_name>.value Value of the attribute belonging to the characteristic record of an entity.

    Data type: String

    lineItems.characteristics.sys_id Sys_id of the associated characteristic record.

    Data type: Object

    "sys_id": { 
      "value": "String" 
     }
    lineItems.characteristics.sys_id.value Sys_id value of the associated characteristic record. The updated table may vary between entities. For example, Order [sn_ind_tmt_orm_order].

    Data type: String

    lineItems.characteristics.table Table name of the characteristic record.

    Data type: String

    lineItems.lineItems Child line items of a parent line item. This object has the same format as the lineItems parameter.

    Data type: Array of Objects

    "lineItems": [  
     {  
      "_glide_action": "String",
      "attributes": {Object},
      "characteristics": [Array],
      "lineItems": [Array],
      "sys_id": {Object},
      "table": "String"
     } 
    ]
    lineItems.sys_id Sys_id of the associated item record.

    Data type: Object

    "sys_id": {
      "value": "String"
    }
    lineItems.sys_id.value Sys_id of an associated item record. The updated table may vary between entities, like Order or Specification. For example, Order [sn_ind_tmt_orm_order].

    Data type: String

    lineItems.table Name of the table that contains the item record associated with the lead to cash entity.

    Data type: String

    sys_id Sys_id of the entity.

    Data type: String

    table Name of the table in which the entity is found.

    Data type: String

    The following example shows how to apply transformation logic using the output of the delta() method:
    Note:
    The same script is applicable for both single select and multi-select use cases, as just the source JSON format changes and the output remains the same for both. For multi-select use cases, a single header is created with all the line items added to the same header.
    //Utility to invoke effect API 
    var util = new sn_l2c_core.PrimitiveUtil();  
     
    //Invoke extension point, picks an implementation based on sourceToTargetConfigID of a L2C flow, the Mapping Config ID  in “sn_l2c_core_entity_mapping” table. 
    var service = util.getPrimitivesEPService('sp_order_macd'); 
     
    //Invoke effect API with required params 
    var effectOutput = service.effect(deltaOutput, null); 
     
    //Print the returned JSON 
    gs.info("effectOutput: " + JSON.stringify(effectOutput)); 
     
    //The returned JSON can be used in the subsequent commitInstance() method.

    Output:

    { 
      "sys_id": "-1", 
      "table": "sn_ind_tmt_orm_order", 
      "_glide_action": "INSERT", 
      "_source_object": {}, 
      "lineItems": [ 
        { 
          "sys_id": "-1", 
          "table": "sn_ind_tmt_orm_order_line_item", 
          "attributes": { 
            "account": { 
              "value": "9e2fd2ee11b43110f877366201dea674" 
            }, 
            "short_description": { 
              "value": "Quadplay Home Tech Hub Bundle" 
            } 
          }, 
          "_glide_action": "INSERT", 
          "_source_object": { 
            "sys_id": "-1", 
            "table": "sn_install_base_sold_product" 
          }, 
          "lineItems": [ 
            { 
              "sys_id": "-1", 
              "table": "sn_ind_tmt_orm_order_line_item", 
              "attributes": { 
                "account": { 
                  "value": "9e2fd2ee11b43110f877366201dea674" 
                }, 
                "short_description": { 
                  "value": "Internet and OTT Bundle" 
                } 
              }, 
              "_glide_action": "INSERT", 
              "_source_object": { 
                "sys_id": "-1", 
                "table": "sn_install_base_sold_product" 
              }, 
              "lineItems": [ 
                { 
                  "sys_id": "-1", 
                  "table": "sn_ind_tmt_orm_order_line_item", 
                  "attributes": { 
                    "account": { 
                      "value": "9e2fd2ee11b43110f877366201dea674" 
                    }, 
                    "short_description": { 
                      "value": "Solana Sports streaming channel" 
                    } 
                  }, 
                  "_glide_action": "INSERT", 
                  "_source_object": { 
                    "sys_id": "-1", 
                    "table": "sn_install_base_sold_product" 
                  }, 
                  "lineItems": [], 
                  "characteristics": [] 
                } 
              ], 
              "characteristics": [] 
            } 
          ], 
          "characteristics": [ 
            { 
              "sys_id": "-1", 
              "table": "sn_ind_tmt_orm_order_characteristic_value", 
              "attributes": { 
                "characteristic_option": { 
                  "value": "4f31999fd0a63110f8770dbf976be179" 
                }, 
                "characteristic": { 
                  "value": "4f31999fd0a63110f8770dbf976be178" 
                }, 
                "characteristic_option_value": { 
                  "value": "" 
                } 
              }, 
              "_glide_action": "INSERT", 
              "_source_object": { 
                "sys_id": "-1", 
                "table": "sn_prd_pm_product_characteristics" 
              } 
            } 
          ] 
        }, 
      "_state": {
          "value": "active"
    }
       ],
    }

    LeadtoCashCore - commitInstance(Object targetJSON, Object additionalParams)

    Commits the JSON of a given lead to cash entity to the instance, returns a status message with updated information, and updates the Lead to Cash Core Entity table as a result.

    Note:
    The LeadtoCashCore script include requires you to first call the scripted extension point PrimitiveUtil() with the LeadtoCashCore - getPrimitivesEPService(String sourceToTargetConfigID, Object context) utility method to trigger the implementation before calling commitInstance() in your script. Per each flow, get the service only once and use the same service for all LeadtoCashCore methods.
    Table 9. Parameters
    Name Type Description
    targetJSON Object JSON object containing the ‘glide_action’ of a target entity to commit. You can pass the output of the effect() method here.
    Note:
    ‘glide_action’ identifies the change action that occurred between the source and target JSON of a lead to cash entity.
    additionalParams Object Optional. Additional parameters to use.
    Note:
    Additional parameters for commitInstance() are not available until a later release.
    Table 10. Returns
    Type Description
    JSON Object Details about the target entity record.

    Data type: Object

    {
      "dataObject": {Object},
      "displayMessage":"String",
      "error": "String",
      "headerID": "String",
      "message": "String",
      "rootLineIDs": [Array],
      "status": "String"
    }
    dataObject JSON object that contains detailed data on the commit operations performed at each level.

    Data type: Object

    "dataObject": {
      "_commitObjectInfo": {Object},
      "_glide_action": "String",
      "_source_object": {Object},
      "lineItems": [Array],
      "sys_id": "String",
      "table": "String"
    }
    dataObject._commitObjectInfo JSON object that contains each object's commit status and sys_id if the line item change is an INSERT action.

    Data type: Object

    "_commitObjectInfo": {
      "status": "String",
      "sys_id": "String"
    }
    dataObject._commitObjectInfo.status Status of the commit operation performed on the particular entity.
    Possible values:
    • success: The entity commit operation was successful.
    • failure: The entity commit operation wasn't successful.

    Data type: String

    dataObject._commitObjectInfo.sys_id Sys_id of the inserted record. The API returns this parameter only if the dataObject._glide_action is INSERT. The updated table may vary between entities. For example, Order [sn_ind_tmt_orm_order].

    Data type: String

    dataObject._glide_action Change action that occurred on the line item.
    Possible values:
    • DELETE: Information was removed between the source and target JSON structures.
    • INSERT: Information was added between the source and target JSON structures.
    • NO_CHANGE: No change occurred between the source and target JSON structures.
    • UPDATE: Information was modified between the source and target structures.

    Data type: String

    dataObject._source_object Source JSON object to which changes were applied. The object structure may vary between entities.

    Data type: Object

    "_source_object": {
      "sys_id": "String", 
      "table": "String” 
    }
    dataObject._source_object.sys_id Sys_id of the source entity record to which the _glide_action was applied. The updated table may vary between entities. For example, Order [sn_ind_tmt_orm_order].

    Data type: String

    dataObject._source_object.table Name of the table of source entity record to which the _glide_action was applied. This may vary between entities.

    Data type: String

    dataObject.lineItems Line item details of the entity record. For example, order line items or quote line items.

    Data type: Array of Objects

    "lineItems": [ 
    { 
      "_action": "String",
      "_commitObjectInfo": {Object},
      "_glide_action": "String",
      "_source_object": {Object},
      "_state": "String",
      "attributes": {Object},
      "characteristics": [Array],
      "lineItems": [Array],
      "sys_id": {Object},
      "table": "String",
    }
    ]
    dataObject.lineItems._action Change action applied to the line item of the source JSON.
    Possible values:
    • add: Information was added to the source JSON.
    • change: Information was updated in the source JSON.
    • disconnect: Information was disconnected from the source JSON.
    • nochange: No change occurred on the source JSON.

    Data type: String

    dataObject.lineItems._commitObjectInfo Returned if the line item change is an INSERT action. Contains the object’s commit status and sys_id.

    Data type: Object

    "_commitObjectInfo": { 
      "status": "String", 
      "sys_id": "String" 
    }
    dataObject.lineItems._commitObjectInfo.status Status of the commit operation performed on the particular entity.
    Possible values:
    • success: The entity commit operation was successful.
    • failure: The entity commit operation wasn't successful.

    Data type: String

    dataObject.lineItems._commitObjectInfo.sys_id Sys_id of the inserted record. The updated table may vary between entities. For example, Order [sn_ind_tmt_orm_order].

    Data type: String

    dataObject.lineItems._glide_action Change action that occurred on the line item.
    Possible values:
    • DELETE: Information was removed between the source and target JSON structures.
    • INSERT: Information was added between the source and target JSON structures.
    • NO_CHANGE: No change occurred between the source and target JSON structures.
    • UPDATE: Information was modified between the source and JSON structures.

    Data type: String

    dataObject.lineItems._source_object Source entity record details to which the _glide_action was applied. This object may vary between entities.

    Data type: Object

    "_source_object": { 
      "sys_id": "String",
      "table": "String" 
    }
    dataObject.lineItems._source_object.sys_id Sys_id of the source entity record to which the _glide_action was applied.

    Data type: String

    dataObject.lineItems._source_object.table Table location of the source entity record to which the _glide_action was applied.

    Data type: String

    dataObject.lineItems._state State of the object.
    Possible values:
    • active: The entity object is in an active state.
    • inactive: The entity object isn't in an active state.

    Data type: String

    dataObject.lineItems.attributes Attributes of the line item. For example, the attribute's name and value. May contain varying fields based on the entity.

    Data type: Object

    "attributes": { 
      "<attribute_name>": {Object}
    }
    dataObject.lineItems.attributes.<attribute_name> Name of the line item attribute. For example, the name of an account or contact. May contain varying fields of the entity.

    Data type: Object

    "attributes": { 
     "<attribute_name>": { 
     "value": "String"
     }
    }
    dataObject.lineItems.attributes.<attribute_name>.value Value of the line item attribute.

    Data type: String

    dataObject.lineItems.characteristics List of characteristics associated with the line item. Characteristics may vary between entities.

    Data type: Array of Objects

    "characteristics": [  
     {
      "_glide_action: "String",
      "attributes": {Object},
      "sys_id": {Object},  
      "table": "String"
     }  
    ]
    dataObject.lineItems.characteristics._glide_action Change action that occurred on the line item.
    Possible values:
    • DELETE: Information was removed between the source and target JSON structures.
    • INSERT: Information was added between the source and target JSON structures.
    • NO_CHANGE: No change occurred between the source and target JSON structures.
    • UPDATE: Information was modified between the source and JSON structures.

    Data type: String

    dataObject.lineItems.characteristics.attributes One or more objects that contain information about attributes associated with the characteristic record. The <attribute type> value can contain different values based on the records or functionality associated with the characteristic.

    For example, this object could contain references to the attributes record's sys_id, associated characteristic records, accounts or contacts, characteristic option records, or sold product information.

    Data type: Object

    "attributes": {
      "<attribute_type>": {Object}
    }
    dataObject.lineItems.characteristics.<attributes_type> Name of the characteristic attribute. May contain varying fields of the entity.

    Data type: Object

    "attributes": { 
     "<attribute_name>": { 
     "value": "String"
     }
    }
    dataObject.lineItems.characteristics.attributes.<attribute_type>.value Value of the line item attribute.

    Data type: String

    dataObject.lineItems[0].characteristics.sys_id Sys_id of the associated characteristic record.

    Data type: Object

    "sys_id": { 
      "value": "String" 
     }
    dataObject.lineItems[0].characteristics.sys_id.value Sys_id value of the associated characteristic record. The updated table may vary between entities. For example, Order [sn_ind_tmt_orm_order].

    Data type: String

    dataObject.lineItems[0].characteristics.table Table name of the characteristic record.

    Data type: String

    dataObject.lineItems[0].lineItems Child line items of a parent line item. This object has the same format as the lineItems parameter.

    Data type: Array of Objects

    "lineItems": [  
     {  
      "_glide_action": "String",
      "attributes": {Object},
      "characteristics": [Array],
      "lineItems": [Array],
      "sys_id": {Object},
      "table": "String"
     } 
    ]
    dataObject.lineItems[0].sys_id Sys_id of the associated item record.

    Data type: Object

    "sys_id": {
      "value": "String"
    }
    dataObject.lineItems[0].sys_id.value Sys_id of an associated item record. The updated table may vary between entities, like Order or Specification. For example, Order [sn_ind_tmt_orm_order].

    Data type: String

    dataObject.lineItems[0].table Name of the table that contains the item record associated with the lead to cash entity.

    Data type: String

    dataObject.sys_id Sys_id of the associated item record. The updated table may vary between entities. For example, Order [sn_ind_tmt_orm_order].

    Data type: String

    dataObject.table Name of the table that contains the record of the lead to cash entity.

    Data type: String

    displayMessage Message that is displayed to the user in the UI. The display message is identical to the message string value.

    Data type: String

    error Error message that describes the failure of the commitInstance method. If the request is successful, this parameter returns an empty string.

    Data type: String

    headerID Sys_id of the target entity record created or updated by the commitInstance method.

    Stored in: The related table depending on the entity type, like sold product, order, etc.

    Data type: String

    message Message describing the success, error, or partially_success scenarios. This message is same as displayMessage string value and can be used by other application calls to the API.

    Data type: String

    rootLineIDs Comma-separated list of sys_ids of the target entity records inserted, updated, or deleted by the commitInstance method.

    Stored in: The related table depending on the entity type, like sold product, order, etc.

    Data type: Array of Strings

    status Status message confirming the success of the commit.

    Possible values:

    • success: The commit was successful.
    • failure: The root line or header glide operation failed. Retrigger the Lead to Cash Core API flow.
    • partial_success: There were failures while processing the entire JSON. Refer to processing logs to troubleshoot specific errors.

    Data type: String

    The following example shows how to use each LeadtoCashCore method to retrieve, apply, and commit the details of a source-to-target entity. In this example, the commitInstance() method is used to commit the changed JSON to a lead to cash entity on the instance.

    //Utility to invoke commitInstance API 
    var util = new sn_l2c_core.PrimitiveUtil();  
     
    //Invokes the PrimitiveUtil extension point, picks an implementation based on sourceToTargetConfigID of a Lead to Cash (L2C) flow. The Mapping Config ID  in “sn_l2c_core_entity_mapping” table. 
    var service = util.getPrimitivesEPService('sp_order_macd'); 
     
    //Invoke commitInstance API with the required params 
    var commitOutput = service.commitInstance(effectOutput); 
     
    //Print the returned JSON 
    gs.info("commitOutput: "+JSON.stringify(commitOutput));  
    

    Output:

    {
      "status": "success",
      "error": "",
      "message": "Commit operation successfully processed.",
      "displayMessage": "Commit operation successfully processed.",
      "dataObject": {
        "sys_id": "-1",
        "table": "sn_ind_tmt_orm_order",
        "_glide_action": "INSERT",
        "_source_object": {},
        "lineItems": [
          {
            "sys_id": "-1",
            "table": "sn_ind_tmt_orm_order_line_item",
            "attributes": {
              "account": {
                "value": "86837a386f0331003b3c498f5d3ee4ca"
              },
              "sold_product": {
                "value": "e4bbf902b7343300ece839a6ee11a937"
              },
              "short_description": {
                "value": "Network Monitoring"
              }
            },
            "_glide_action": "INSERT",
            "_source_object": {
              "sys_id": "e4bbf902b7343300ece839a6ee11a937",
              "table": "sn_install_base_sold_product"
            },
            "lineItems": [
              {
                "sys_id": "-1",
                "table": "sn_ind_tmt_orm_order_line_item",
                "attributes": {
                  "account": {
                    "value": "86837a386f0331003b3c498f5d3ee4ca"
                  },
                  "sold_product": {
                    "value": "23dbbd02b7343300ece839a6ee11a98e"
                  },
                  "short_description": {
                    "value": "Remote Monitoring"
                  }
                },
                "_glide_action": "INSERT",
                "_source_object": {
                  "sys_id": "23dbbd02b7343300ece839a6ee11a98e",
                  "table": "sn_install_base_sold_product"
                },
                "lineItems": [],
                "characteristics": [],
                "coveredProducts": [],
                "_commitObjectInfo": {
                  "sys_id": "d2d5b868488d5610f877a23d5db8922f",
                  "status": "success"
                }
              }
            ],
            "characteristics": [],
            "coveredProducts": [],
            "_commitObjectInfo": {
              "sys_id": "92d5b868488d5610f877a23d5db89229",
              "status": "success"
            }
          }
        ],
        "_commitObjectInfo": {
          "sys_id": "46d5b0a4488d5610f877a23d5db892ef",
          "status": "success"
        }
      },
      "headerID": "46d5b0a4488d5610f877a23d5db892ef",
      "rootLineIDs": [
        "92d5b868488d5610f877a23d5db89229"
      ]
    }