LeadtoCashCore - Scoped
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:
- 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 object.
- 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.
- LeadtoCashCore - effect(Object sourceJSON, Object targetJSON, Object additionalParams) - Transforms the source JSON target into a target object.
- LeadtoCashCore - commitInstance(Object targetJSON, Object additionalParams) - Commits the transformation made in the effect() script include to the database.
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));
- The first call gets the existing sold product information using the createInstance() method.
- We then compare this source JSON with the dirty JSON using the delta() method, which returns a delta JSON.
- The delta() JSON is then transformed into a JSON of type order using the effect() method.
- The order JSON is committed to the database using the commitInstance() method.
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.
| 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. Future use. |
| Type | Description |
|---|---|
| JSON Object | JSON object containing details about the target entity record.Data type: Object |
| error | Error message that describes the failure of the commitInstance method. Data type: String |
| headerID | Sys_id of the target entity record created or updated by the commitInstance method. Data type: String |
| rootLineIDs | Sys_ids of the target entity records inserted, updated, or deleted by the commitInstance method. Data type: Array of Strings |
| status | Status message with a value of 'success' or 'failure'. 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.
//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));
//The returned JSON can be used for subsequent operations.
Output:
{
"status": "success",
"error": "",
"headerID": "cc9b3db665e73510f877d71ec56bf7ed",
"rootLineIDs": [
"0c9b3db665e73510f877d71ec56bf7f1"
]
}
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().
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.
| Name | Type | Description |
|---|---|---|
| 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 Note: At least one headerSysID or lineSysIDs parameter is required. |
| 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 Note: At least one headerSysID or lineSysIDs parameter is required. If passing multiple lineSysIDs, all records
must belong to the same headerSysID. |
| isTarget | Boolean | Optional. Flag that determines whether to fetch target entity data. Valid values:
Default: false |
| 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:
Default: false |
| Type | Description |
|---|---|
| JSON Object | A JSON containing details of the entity record. Note: This JSON is used
in the sourceJSON request parameter of
LeadtoCashCore - delta(Object sourceJSON, Object dirtyJSON, Object additionalParams). Data type: Object |
| attributes | Attributes of header record.Data type: Object |
| attributes.<field_name> | Attributes of the header record. For example, the account or contact, etc. May contain varying fields of the entity.Data type: Object |
| attributes.<field_name>.value | Value of the attribute belonging to the header record of an entity. Data type: String |
| characteristics | Characteristics of a line item.Data type: Array of objects |
| characteristics.table | Table name of the characteristic record of a Lead to Cash
entity. Data type: String |
| characteristics.sys_id | Sys_id of a characteristic record.Data type: Object |
| characteristics.sys_id.value | The sys_id value of a characteristic record. Data type: String |
| characteristics.attributes | Attributes of characteristic
record.Data type: Object |
| characteristics.attributes.<field_name> | Attributes of the characteristic record. For example,
the name or characteristic value, etc.
May contain varying characteristics based on the entity.Data type: Object |
| characteristics.attributes.<field_name>.value | Value of the attribute belonging to the characteristic record of an entity. Data type: String |
| items | Contains an array of selected objects when
context.isMultiSelect is set to true in
getPrimitivesEPService(). Data type: Array of objects |
| lineItems | Line items of an entity. For example, order line items, quote line items, etc.Data type: Array |
| lineItems.attributes | Attributes of the line item record.Data type: Object |
| lineItems.attributes.<field_name> | Attributes of the line item record. For example, the
account or contact, etc. May contain varying fields based on the entity.Data type: Object |
| lineItems.attributes.<field_name>.value | Value of the attribute belonging to the line item of an entity. Data type: String |
| lineItems.LineItems | Child line items of a parent line item.Data type: Object |
| lineItems.sys_id | Sys_id of the line item record.Data type: Object |
| lineItems.sys_id.value | The sys_id value of the line item record. Data type: String |
| lineItems.table | Table name of the line item of a Lead to Cash entity. Data type: String |
| sys_id | Sys_id of the header record.Data type: Object |
| sys_id.value | The sys_id value of the header record. Data type: String |
| table | Table name of the header record of a 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"
},
"account": {
"value": "9e2fd2ee11b43110f877366201dea674"
}
},
"lineItems": [
],
"characteristics": []
}
],
"characteristics": [
{
"table": "sn_prd_pm_product_characteristics",
"sys_id": {
"value": "8d669b6665ebf110f877d71ec56bf75c"
},
"attributes": {
"sys_id": {
"value": "8d669b6665ebf110f877d71ec56bf75c"
},
"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": []
}
]
}
]
}
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 desrcribes any changes made to the source JSON, such as any additions, deletions, or modifications.
| Name | Type | Description |
|---|---|---|
| sourceJSON | Object | The source JSON of the lead to cash entity. Note: Use the LeadtoCashCore - createInstance(String headerSysIDs, String lineSysIDs, Boolean isTarget, Object additionalParams) method to retrieve the source JSON of an entity. |
| dirtyJSON | Object | The modified source JSON of the Lead to Cash entity. |
| additionalParams | Object | Optional. Additional parameters to use. No additional parameters are available now but will in the future. |
| Type | Description |
|---|---|
| JSON Object | A JSON containing details of the entity record. Data type: Object |
| _action | The action applied to the source JSON. Possible values:
|
| attributes | Attributes of header record.Data type: Object |
| attributes.<field_name> | Attributes of the header record. For example, the account or contact, etc. May contain varying fields of the entity.Data type: Object |
| attributes.<field_name>.value | Value of the attribute belonging to the header record of an entity. Data type: String |
| characteristics._action | The action applied to the characteristic. Possible values:
|
| characteristics.attributes | Attributes of characteristic record.Data type: Object |
| characteristics.attributes.<field_name> | Attributes of the characteristic record. For example, the name or characteristic value, etc. May contain varying characteristics based on the entity.Data type: Object |
| characteristics.attributes.<field_name>.value | Value of the attribute belonging to the characteristic record of an entity. Data type: String |
| characteristics.sys_id | Sys_id of a characteristic record.Data type: Object |
| characteristics.sys_id.value | The sys_id value of a characteristic record. Data type: String |
| characteristics.table | Table name of the characteristic record of a Lead to Cash entity. Data type: String |
| lineItems | Line items of an entity. For example, order line items, quote line items, etc.Data type: Array |
| lineItems._action | The action applied to the line item in the source JSON. Possible values:
|
| lineItems.attributes | Attributes of the line item record.Data type: Object |
| lineItems.table | Table name of the line item of a Lead to Cash entity. Data type: String |
| lineItems.sys_id | Sys_id of the line item record.Data type: Object |
| lineItems.sys_id.value | The sys_id value of the line item record. Data type: String |
| lineItems.attributes.<field_name> | Attributes of the line item record. For example, the account or contact, etc. May contain varying fields based on the entity.Data type: Object |
| lineItems.attributes.<field_name>.value | Value of the attribute belonging to the line item of an entity. Data type: String |
| lineItems.LineItems | Child line items of a parent line item.Data type: Object |
| lineItems.characteristics | Characteristics of a line item.Data type: Array |
| sys_id | Sys_id of the header record.Data type: Object |
| sys_id.value | The sys_id value of the header record. Data type: String |
| table | Table name of the header record of a 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.
| Name | Type | Description |
|---|---|---|
| sourceJSON | Object | JSON containing details of the source entity. Note: Use the LeadtoCashCore - createInstance(String headerSysIDs, String lineSysIDs, Boolean isTarget, Object additionalParams) to retrieve the source JSON of an entity. |
| targetJSON | Object | JSON containing details of the target entity. |
| additionalParams | Object | Optional. Specifies additional parameters to use. No additional parameters are available now but will in the future. |
| Type | Description |
|---|---|
| JSON Object | Change that occurred and was applied from the source to target entity JSON objects at each of the object, header line, child lines, and characteristic levels of the Lead to Cash entity.
Possible
values:
|
//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"
}
}
]
}
]
}
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.
| Name | Type | Description |
|---|---|---|
| sourceToTargetConfigID | String | Mapping config ID for the source-to-target mapping. Located in the Lead To Cash Entity Mapping [sn_l2c_core_entity_mapping] table. |
| context | Object | Optional. Additional parameter options for displaying attribute values and for invoking more than one instance at a time. |
| context.loadDisplayValue | Boolean | Optional. Flag that indicates whether to load the display value for each attribute. Valid values:
Default: false |
| context.isMultiSelect | Boolean | Optional. Flag that indicates whether to pass multiple entities as input to create the instance. Valid values:
The multiSelect feature is only applicable to the createInstance(), delta(), and effect() methods. Default: false |
| 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)