{"revision":"c10276e953456835cdbb1f3a60d58ae1980be353","document":{"id":840,"path":"api-reference/server-api-reference/LeadToCashCoreAPI.md","title":"LeadtoCashCore - Scoped","bundle":null,"doc_type":null,"release":"australia","body":"\n# LeadtoCashCore- Scoped\n\nThe LeadtoCashCore script include provides methods to orchestrate a lead-to-cash workflow in the Lead to Cash Core life cycle.\n\nThe Lead to Cash Core \\(com.snc.l2c.core\\) plugin must be activated for LeadtoCashCore script includes to be available in an instance. This plugin can be accessed via the Lead to Cash Core \\(com.snc.l2c\\_core\\) application in the ServiceNow Store. This script include belongs to the sn\\_l2c\\_core namespace and requires the admin role.\n\nIn 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 [Lead to Cash Core](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/order-management/lead-to-cash.md) for more information.\n\nTo 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:\n\n1.  [LeadtoCashCore - getPrimitivesEPService\\(String sourceToTargetConfigID, Object context\\)](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/LeadToCashCoreAPI.md) - Contains a utility for retrieving the extension point used to invoke scripts. Must be provided with every method call. See the 'Prequisites' section in this topic for more information.\n2.  [LeadtoCashCore - createInstance\\(String headerSysIDs, String lineSysIDs, Boolean isTarget, Object additionalParams\\)](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/LeadToCashCoreAPI.md) - Fetches the data of a given entity. For example, customer order-related information including line items and their related data.\n\n    Use the **context** parameter to declare one or more header or line IDs in the script, referred to as \"multi-select\". Pass the **context.entityConfigId** parameter to invoke the script without any defined mapping. For such multi-select use cases, the output JSON contains a key items array where each entry represents a single entity.\n\n3.  [LeadtoCashCore - delta\\(Object sourceJSON, Object dirtyJSON, Object additionalParams\\)](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/LeadToCashCoreAPI.md) - Compares two JSON inputs and identifies any changes that occurred between them. For example, when something is added, deleted, or modified in an entity.\n4.  [LeadtoCashCore - effect\\(Object sourceJSON, Object targetJSON, Object additionalParams\\)](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/LeadToCashCoreAPI.md) - Transforms the source JSON object into a target object.\n5.  [LeadtoCashCore - commitInstance\\(Object targetJSON, Object additionalParams\\)](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/LeadToCashCoreAPI.md) - Commits the transformation made in the effect\\(\\) script include to the database.\n\n**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\\(\\)\\).\n\n## Prerequisites\n\nEach 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\\)](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/LeadToCashCoreAPI.md). 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.\n\n## Example Lead to Cash Core workflow script\n\nThough 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.\n\n```\nvar util = new sn_l2c_core.PrimitiveUtil(); \n\n// Set the context.isMultiSelect parameter as true to enable multi-select use cases\n// Set the context.entityConfigId parameter to the config id of the source entity (sold prodcut) to trigger createInstance with only configId \nvar context = {\"isMultiSelect\": false, \"entityConfigId\": “sn_l2c_cust_flows_sold_product”}; \n\n//Flow: Creation of an order from a sold product \nvar service = util.getPrimitivesEPService('sn_l2c_cust_flows_sp_to_order', context);  \n  \n//CREATE INSTANCE to get the data of sold product with sys_id '06670ba3c3adbd501caee74bb0013166' \nvar SPInstance = service.createInstance(null, '06670ba3c3adbd501caee74bb0013166');  \ngs.info(\"SPInstance: \"+JSON.stringify(SPInstance));  \n  \n// DELTA  \n// construct the dirtyJSON as required  \nvar deltaOutput = service.delta(SPInstance, dirtyJSON);/  \ngs.info(\"deltaOutput: \"+JSON.stringify(deltaOutput));  \n  \n// EFFECT  \nvar effectOutput = service.effect(deltaOutput);  \ngs.info(\"effectOutput: \" + JSON.stringify(effectOutput));  \n  \n// COMMIT INSTANCE \nvar commitOutput = service.commitInstance(effectOutput);  \ngs.info(\"commitOutput: \" + JSON.stringify(commitOutput));\n```\n\nIn 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:\n\n1.  The first call gets the existing sold product information using the createInstance\\(\\) method.\n2.  We then compare this source JSON with the dirty JSON using the delta\\(\\) method, which returns a delta JSON.\n3.  The **delta\\(\\)** JSON is then transformed into a JSON of type order using the effect\\(\\) method.\n4.  The order JSON is committed to the database using the commitInstance\\(\\) method.\n\n**Parent Topic:**[Server API reference](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/api-server.md)\n\n## LeadtoCashCore - getPrimitivesEPService\\(String sourceToTargetConfigID, Object context\\)\n\nTriggers the PrimitiveUtil\\(\\) utility method.\n\nTo 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.\n\n<table id=\"table_nzs_qbn_d1c\" class=\"parameters\"><thead><tr><th>\n\nName\n\n</th><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\ncontext\n\n</td><td>\n\nObject\n\n</td><td>\n\nOptional. Additional parameter options for displaying attribute values and for invoking more than one instance at a time.```\n\"context\": {\n  \"entityConfigId\": \"String\",\n  \"isMultiSelect\": \"Boolean\",\n  \"loadDisplayValue\": \"Boolean\"\n}\n```\n\n</td></tr><tr><td>\n\ncontext.entityConfigId\n\n</td><td>\n\nString\n\n</td><td>\n\nOptional. Configuration ID of the entity. If both **entityConfigId** and **sourceToTargetConﬁgID** are provided, priority is given to **entityConfigId**.Table: Lead To Cash Entity \\[sn\\_l2c\\_core\\_entity\\]\n\nData type: String\n\n</td></tr><tr><td>\n\ncontext.isMultiSelect\n\n</td><td>\n\nBoolean\n\n</td><td>\n\nOptional. Flag that indicates whether to pass multiple entities as input to create the instance. Valid values:\n\n-   true: Enables the passing of multiple entities as input. When true, you can pass multiple line items in a comma-separated list.\n-   false: Doesn't enable the passing of multiple entities as input. Only one input may be passed in the API script.\n\nDefault: false\n\n</td></tr><tr><td>\n\ncontext.loadDisplayValue\n\n</td><td>\n\nBoolean\n\n</td><td>\n\nOptional. Flag that indicates whether to load the display value for each attribute.Valid values:\n\n-   true: Enables the loading of an attribute's display value.\n-   false: Doesn't enable the loading of an attribute's display value.\n\nDefault: false\n\n</td></tr><tr><td>\n\nsourceToTargetConfigID\n\n</td><td>\n\nString\n\n</td><td>\n\nMapping configuration ID for the source-to-target mapping. Table: Lead To Cash Entity Mapping \\[sn\\_l2c\\_core\\_entity\\_mapping\\]\n\n</td></tr></tbody>\n</table>|Type|Description|\n|----|-----------|\n|None| |\n\nThe 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.\n\n```\n//Utility to invoke createInstance API  \nvar util = new sn_l2c_core.PrimitiveUtil(); \nvar context = {\"isMultiSelect\": true}; // Set the context.isMultiSelect parameter as true to enable multi-select use cases.\n\n//Invokes the extension point and specifies an implementation based on sourceToTargetConfigID of a L2C flow.  \nvar service = util.getPrimitivesEPService('sn_l2c_cust_flows_sp_to_order’, context)\n```\n\nThe following example invokes PrimitiveUtil\\(\\) and picks an implementation based on the configId, `l2c_order`, in the Lead To Cash Entity \\[sn\\_l2c\\_core\\_entity\\] table.\n\n```\n//Utility to invoke createInstance API   \nvar util = new sn_l2c_core.PrimitiveUtil();  \nvar context = {\"isMultiSelect\": true, “entityConfigId”: “l2c_order”};  \n// Set the context.isMultiSelect parameter as true to enable multi-select use cases. \n// Set the context.entityConfigId parameter if createInstance needs to be invoked with only configId. \n \n//Invokes the extension point and uses default implementation based on entityConfigId of a L2C flow.   \nvar service = util.getPrimitivesEPService('’, context); \n```\n\n## LeadtoCashCore - createInstance\\(String headerSysIDs, String lineSysIDs, Boolean isTarget, Object additionalParams\\)\n\nReturns 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.\n\nUse the output JSON of the createInstance\\(\\) method in subsequent methods of the Lead to Cash Core workflow such as delta\\(\\), effect\\(\\), and commitInstance\\(\\).\n\n### Requirements\n\nThe LeadtoCashCore script include requires you to first call the script utility method PrimitiveUtil\\(\\) with the [LeadtoCashCore - getPrimitivesEPService\\(String sourceToTargetConfigID, Object context\\)](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/LeadToCashCoreAPI.md) 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.\n\n### Considerations\n\n-   To enable createInstance\\(\\) to pass multiple, comma-separated headerIDs or lineIDs at a time, set the getPrimitivesEPService\\(\\) boolean parameter **context.isMultiSelect** to true. Otherwise, you can only pass one ID at a time. The single headerID use case with multiple lineIDs is supported without setting **context.isMultiSelect** to true.\n\n-   To enable createInstance\\(\\) to be invoked with only the configuration ID of the entity, set the getPrimitivesEPService\\(\\) String parameter, **context.entityConfigId**. If both entityConfigId and sourceToTargetConfigID are passed, entityConfigId is prioritized to execute createInstance\\(\\).\n\n    For more information about this functionality, see [LeadtoCashCore - getPrimitivesEPService\\(String sourceToTargetConfigID, Object context\\)](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/LeadToCashCoreAPI.md).\n\n-   `createInstance()` supports selective data retrieval and multiple root entity definitions, allowing developers to explicitly fetch ramps and headerless scenarios using additional parameters such as **fetchRecordSysIds** and **multiSelectMerge**.\n\n<table id=\"table_rn1_yzl_d1c\" class=\"parameters\"><thead><tr><th>\n\nName\n\n</th><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nadditionalParams\n\n</td><td>\n\nObject\n\n</td><td>\n\nOptional. Additional parameters to use.\n\n</td></tr><tr><td>\n\nadditionalParams.skipLines\n\n</td><td>\n\nBoolean\n\n</td><td>\n\nOptional. Flag that indicates whether to fetch line items for the specified entity.Valid values:\n\n-   true: Skip returning line items information for the entity.\n-   false: Return line items information for the entity.\n\nDefault: false\n\n</td></tr><tr><td>\n\nfetchRecordSysIds\n\n</td><td>\n\nArray of Objects\n\n</td><td>\n\nEnables selective fetching of data for both header‑based and header‑less scenarios by explicitly mapping table names to sys\\_ids.Behavior:\n\n-   With header: Allows selective fetching of child entities \\(like ramps\\) linked to the header. If ramp IDs aren't provided, fetches all ramps linked to header.\n-   Without header: Supports fetching of ramps where direct relationships are missing in header-less entities. Ramp IDs must be included; without them, doesn't return ramp data.\n\nStructure:\n\n```\n[{\n \"<table_name1>\": \"<sys_id1>\", \n \"<table_name2>\": \"<sys_id2>\", \n}]\n```\n\n</td></tr><tr><td>\n\nmultiSelectMerge\n\n</td><td>\n\nBoolean\n\n</td><td>\n\nOnly for no-header scenarios. Flag that indicates whether to merge data of same context-type into a single flat structure.Valid values:\n\n-   true: Merges same context-type data in a flat structure.\n-   false: Doesn't merge data.\n\n</td></tr><tr><td>\n\nadditionalParams.allowedContextTypes\n\n</td><td>\n\nArray of Strings\n\n</td><td>\n\nOptional. Controls population and processing to only those types listed in allowedContextTypes, excluding all other unrelated sections.Valid values:\n\n-   For header-based partial sync, `header` must be passed in **allowedContextTypes** to allow this method to build the root structure.\n-   For no-header partial sync, `lineItems` must be passed in **allowedContextTypes** to allow this method to build the structure for processing child data.\n\nStructure:\n\n```\nallowedContextTypes: [\"header\",\"headerRelatedParty\"]  }; \n```\n\n</td></tr><tr><td>\n\nheaderSysIDs\n\n</td><td>\n\nString\n\n</td><td>\n\nHeader 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\\)](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/LeadToCashCoreAPI.md).\n\n**Note:** At least one **headerSysID** or **lineSysIDs** parameter is required.\n\n</td></tr><tr><td>\n\nisTarget\n\n</td><td>\n\nBoolean\n\n</td><td>\n\nOptional. Flag that determines whether to fetch target entity data.Valid values:\n\n-   true: Fetch data of the target entity.\n-   false: Don't fetch data of the target entity.\n\nDefault: false\n\n</td></tr><tr><td>\n\nlineSysIDs\n\n</td><td>\n\nString\n\n</td><td>\n\nLine 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\\)](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/LeadToCashCoreAPI.md).\n\n**Note:** At least one **headerSysID** or **lineSysIDs** parameter is required. If passing multiple **lineSysIDs**, all records must belong to the same **headerSysID**.\n\n</td></tr></tbody>\n</table><table id=\"id_hfh_p13_h1c\" class=\"returns\"><thead><tr><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nJSON Object\n\n</td><td>\n\nA JSON containing details of the entity record.Data type: Array of objects\n\n```\n{\n\"items\": [\n  {\n  \"attributes\": {Object},\n  \"sys_id\": {Object},\n  \"table\": \"String\",\n  \"lineItems\": [\n    {\n     \"attributes\": {Object},\n     \"sys_id\": {Object},\n     \"table\": \"String\",\n     \"characteristics\": [Array],\n     \"lineItems\": [Array]\n     }\n    ],\n  \"characteristics\": [Array],\n  \"_state\": \"String\"\n  }\n ]\n}\n```\n\n</td></tr><tr><td>\n\n\\_state\n\n</td><td>\n\nActivity state of the entity.Possible values:\n\n-   active: The entity is active.\n-   inactive: The entity is inactive.\n\nDefault: active\n\nData type: String\n\n</td></tr><tr><td>\n\ncharacteristics\n\n</td><td>\n\nList of entity characteristics. Characteristics may vary between entities.Data type: Array of objects\n\n```\n\"characteristics\": [  \n        {  \n          \"attributes\": {Object},\n          \"sys_id\": {Object},  \n          \"table\": \"String\"\n        }  \n      ]\n```\n\n</td></tr><tr><td>\n\ncharacteristics.attributes\n\n</td><td>\n\nOne or more objects that contain information about attributes associated with the characteristic record. The &lt;attribute type&gt; 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\n\n```\n\"attributes\": {\n  \"<attribute_type>\": {Object}\n}\n```\n\n</td></tr><tr><td>\n\ncharacteristics.attributes.&lt;attribute\\_type&gt;\n\n</td><td>\n\nInformation about the key name of the item attribute.```\n\"<key_name>\": { \n  \"value\": \"String\" \n}\n```\n\nData type: Object\n\n</td></tr><tr><td>\n\ncharacteristics.attributes.&lt;attribute\\_type&gt;.value\n\n</td><td>\n\nTypically 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\n\n</td></tr><tr><td>\n\ncharacteristics.sys\\_id\n\n</td><td>\n\nObject containing the sys\\_id of the associated characteristic record.Data type: Object\n\n```\n\"sys_id\": { \n  \"value\": \"String\" \n }\n```\n\n</td></tr><tr><td>\n\ncharacteristics.sys\\_id.value\n\n</td><td>\n\nSys\\_id of the associated characteristic record.Data type: String\n\n</td></tr><tr><td>\n\ncharacteristics.table\n\n</td><td>\n\nName of the table that contains the characteristic record of the lead to cash entity.Data type: String\n\n</td></tr><tr><td>\n\nitems\n\n</td><td>\n\nContains an array of selected objects when **context.isMultiSelect** is set to true.Data type: Array of Objects\n\n```\n\"items\": [\n{ \n  \"attributes\": {Object}, \n  \"sys_id\": {Object}, \n  \"table\": \"String\",\n  \"lineItems\": [Array]\n }, \n]\n```\n\n</td></tr><tr><td>\n\nitems.attributes\n\n</td><td>\n\nAttributes of the item record. Attributes may vary between entities.```\n\"attributes\": {\n  \"account\": {Object},\n  \"name\": {Object}\n}\n```\n\nData type: Object\n\n</td></tr><tr><td>\n\nitems.attributes.account\n\n</td><td>\n\nInformation about the account associated with the item attribute.```\n\"account\": { \n  \"value\": \"String\" \n}\n```\n\n</td></tr><tr><td>\n\nitems.attributes.account.value\n\n</td><td>\n\nAttributes of the item. Attributes may vary between entities.```\n\"attributes\": {\n  \"account\": {Object},\n  \"<key_name>\": {Object}\n}\n```\n\nData type: Object\n\n</td></tr><tr><td>\n\nitems.attributes.&lt;key\\_name&gt;\n\n</td><td>\n\nInformation about the key name of the item attribute.```\n\"<key_name>\": { \n  \"value\": \"String\" \n}\n```\n\nData type: Object\n\n</td></tr><tr><td>\n\nitems.attributes.&lt;key\\_name&gt;.value\n\n</td><td>\n\nValue of the key name attribute.Data type: String\n\n</td></tr><tr><td>\n\nitems.sys\\_id\n\n</td><td>\n\nObject containing sys\\_id information about the entity item. Values vary between entities.Data type: Object\n\n```\n\"sys_id\": {\n  \"value\": \"String\"\n}\n```\n\n</td></tr><tr><td>\n\nitems.sys\\_id.value\n\n</td><td>\n\nSys\\_id of an associated item.Data type: String\n\n</td></tr><tr><td>\n\nitems.table\n\n</td><td>\n\nName of the table that contains line item record associated with the lead to cash entity.Data type: String\n\n</td></tr><tr><td>\n\nitems.lineItems\n\n</td><td>\n\nJSON object that contains the line item details of the entity record. Data type: Array of objects\n\n```\n\"lineItems\": [ \n  { \n    \"attributes\": {Object},\n    \"characteristics\": [Array],\n    \"lineItems\": [Array],\n    \"_state\": \"String\",\n    \"sys_id\": {Object},\n    \"table\": \"String\"\n  }\n]\n```\n\n</td></tr><tr><td>\n\nitems.lineItems.\\_state\n\n</td><td>\n\nActivity state of the line item entity.Possible values:\n\n-   active: The entity is active.\n-   inactive: The entity is inactive.\n\nDefault: active\n\nData type: String\n\n</td></tr><tr><td>\n\nitems.lineItems.attributes\n\n</td><td>\n\nAttributes of the line item record. Attributes may vary between entities.```\n\"attributes\": {\n  \"account\": {Object},\n  \"<key_name>\": {Object}\n}\n```\n\nData type: Object\n\n</td></tr><tr><td>\n\nitems.lineItems.attributes.&lt;key\\_name&gt;\n\n</td><td>\n\nInformation about the key name of the line item attribute.```\n\"<key_name>\": { \n  \"value\": \"String\" \n}\n```\n\nData type: Object\n\n</td></tr><tr><td>\n\nitems.lineItems.attributes.&lt;key\\_name&gt;.value\n\n</td><td>\n\nValue of the key name attribute.Data type: String\n\n</td></tr><tr><td>\n\nitems.lineItems.attributes.account\n\n</td><td>\n\nInformation about the account associated with the line item attribute.```\n\"account\": { \n  \"value\": \"String\" \n}\n```\n\n</td></tr><tr><td>\n\nitems.lineItems.attributes.account.value\n\n</td><td>\n\nSys\\_id of the account associated with the line item attribute.Data type: String\n\n</td></tr><tr><td>\n\nitems.lineItems.characteristics\n\n</td><td>\n\nList of characteristics associated with the line item. Characteristics may vary between entities.Data type: Array of objects\n\n```\n\"characteristics\": [  \n        {  \n          \"attributes\": {Object},\n          \"sys_id\": {Object},  \n          \"table\": \"String\"\n        }  \n      ]\n```\n\n</td></tr><tr><td>\n\nitems.lineItems.characteristics.attributes\n\n</td><td>\n\nOne or more objects that contain information about attributes associated with the characteristic record. The &lt;attribute type&gt; 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\n\n```\n\"attributes\": {\n  \"<attribute_type>\": {Object}\n}\n```\n\n</td></tr><tr><td>\n\nitems.lineItems.characteristics.attributes.&lt;attribute\\_type&gt;.value\n\n</td><td>\n\nTypically 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\n\n</td></tr><tr><td>\n\nitems.lineItems.characteristics.sys\\_id\n\n</td><td>\n\nObject containing the sys\\_id of the associated characteristic record.Data type: Object\n\n```\n\"sys_id\": { \n  \"value\": \"String\" \n }\n```\n\n</td></tr><tr><td>\n\nitems.lineItems.characteristics.sys\\_id.value\n\n</td><td>\n\nSys\\_id of the associated characteristic record.Data type: String\n\n</td></tr><tr><td>\n\nitems.lineItems.characteristics.table\n\n</td><td>\n\nName of the table that contains the characteristic record of the lead to cash entity.Data type: String\n\n</td></tr><tr><td>\n\nitems.lineItems.lineItems\n\n</td><td>\n\nChild line items of a parent line item. This object has the same format as the **lineItems** parameter.Data type: Object\n\n```\n\"lineItems\": [\n  { \n    \"attributes\": {Object},\n    \"characteristics\": [Array],\n    \"lineItems\": [Array],\n    \"_state\": {Object},\n    \"sys_id\": {Object},\n    \"table\": \"String\"\n  }\n] \n```\n\n</td></tr><tr><td>\n\nitems.lineItems.sys\\_id\n\n</td><td>\n\nObject containing sys\\_id information about the associated line item record.Data type: Object\n\n```\n\"sys_id\": {\n  \"value\": \"String\"\n}\n```\n\n</td></tr><tr><td>\n\nitems.lineItems.sys\\_id.value\n\n</td><td>\n\nSys\\_id of an associated line item record.Data type: String\n\n</td></tr><tr><td>\n\nitems.lineItems.table\n\n</td><td>\n\nName of the table that contains the line item record associated with the lead to cash entity.Data type: String\n\n</td></tr></tbody>\n</table>The example script below invokes the createInstance\\(\\) method to load the data of a sold product, its entire hierarchy, and its characteristics.\n\n```\n//Utility to invoke createInstance API \nvar util = new sn_l2c_core.PrimitiveUtil();  \n \n//Invoke extension point, picks an implementation based on sourceToTargetConfigID of a L2C flow, the Mapping Config ID  in \"sn_l2c_core_entity_mapping\" table. \nvar service = util.getPrimitivesEPService('sn_l2c_cust_flows_sp_to_order'); \n \n//Invoke createInstance API with required params \nvar SPInstance = service.createInstance(null, '4e03cda2ec873110f87727ef5883a2cf'); \n \n//Print the returned JSON \ngs.info(\"SPInstance: \"+JSON.stringify(SPInstance));  \n \n//The returned JSON can be used for subsequent methods of the flow such as delta(), effect() and commitInstance()\n```\n\nOutput:\n\n```\n{ \n  \"lineItems\": [ \n    { \n      \"table\": \"sn_install_base_sold_product\", \n      \"sys_id\": { \n        \"value\": \"4e03cda2ec873110f87727ef5883a2cf\" \n      }, \n      \"attributes\": { \n        \"name\": { \n          \"value\": \"Quadplay Home Tech Hub Bundle\" \n        }, \n        \"account\": { \n          \"value\": \"9e2fd2ee11b43110f877366201dea674\" \n        } \n      }, \n      \"lineItems\": [ \n        { \n          \"table\": \"sn_install_base_sold_product\", \n          \"sys_id\": { \n            \"value\": \"9e0301e2ec873110f87727ef5883a23a\" \n          }, \n          \"attributes\": { \n            \"name\": { \n              \"value\": \"Internet and OTT Bundle\" \n            }, \n          \"_state\": \"active\",\n          \"account\": { \n              \"value\": \"9e2fd2ee11b43110f877366201dea674\" \n            } \n          }, \n          \"lineItems\": [ \n          ], \n          \"characteristics\": [] \n        } \n      ], \n      \"characteristics\": [ \n        { \n          \"table\": \"sn_prd_pm_product_characteristics\", \n          \"sys_id\": { \n            \"value\": \"8d669b6665ebf110f877d71ec56bf75c\" \n          }, \n          \"attributes\": { \n            \"sys_id\": { \n              \"value\": \"8d669b6665ebf110f87d71ec56bf75c\" \n            },\n          \"_state\": \"active\", \n          \"characteristic_value\": { \n              \"value\": \"\" \n            }, \n          \"characteristic\": { \n              \"value\": \"4f31999fd0a63110f8770dbf976be178\" \n            }, \n          \"characteristic_option\": { \n              \"value\": \"4f31999fd0a63110f8770dbf976be179\" \n            }, \n          \"sold_product\": { \n              \"value\": \"4e03cda2ec873110f87727ef5883a2cf\" \n            } \n          } \n        } \n      ] \n    } \n  ] \n}\n```\n\n### Multi-select\n\nThe 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.\n\n```\n//Utility to invoke createInstance API  \nvar util = new sn_l2c_core.PrimitiveUtil();   \n\n//Set context variable isMultiSelect true to enable multi-select \nvar context = {\"isMultiSelect\": true}; \n//Invoke extension point, picks an implementation based on sourceToTargetConfigID of a L2C flow, the Mapping Config ID  in “sn_l2c_core_entity_mapping” table.  \nvar service = util.getPrimitivesEPService('sn_l2c_cust_flows_sp_to_order’, context);  \n  \n//Multiple sold products selected  \nvar selectedLineitems = '4e03cda2ec873110f87727ef5883a2cf,036a2349284d0210f877b68370fb2e93'; \n\n//Invoke createInstance API with required params  \nvar SPInstance = service.createInstance(null, selectedLineitems);  \n  \n//Print the returned JSON  \ngs.info(\"SPInstance: \"+JSON.stringify(SPInstance));   \n  \n//The returned JSON can be used for subsequent APIs of the flow such as Delta, Effect and Commit Instance \n```\n\nResponse:\n\n```\n{  \n  \"items\": [ \n    { \n      \"lineItems\": [ \n        { \n          \"table\": \"sn_install_base_sold_product\", \n          \"sys_id\": { \n            \"value\": \"4e03cda2ec873110f87727ef5883a2cf\" \n          }, \n          \"attributes\": { \n            \"name\": { \n              \"value\": \"Quadplay Home Tech Hub Bundle\" \n            }, \n            \"account\": { \n              \"value\": \"9e2fd2ee11b43110f877366201dea674\" \n            } \n          }, \n          \"lineItems\": [ \n            { \n              \"table\": \"sn_install_base_sold_product\", \n              \"sys_id\": { \n                \"value\": \"9e0301e2ec873110f87727ef5883a23a\" \n              }, \n              \"attributes\": { \n                \"name\": { \n                  \"value\": \"Internet and OTT Bundle\" \n                }, \n                \"account\": { \n                  \"value\": \"9e2fd2ee11b43110f877366201dea674\" \n                } \n              }, \n              \"lineItems\": [], \n              \"characteristics\": [] \n            } \n          ] \n        } \n      ] \n    }, \n    { \n      \"lineItems\": [ \n        { \n          \"table\": \"sn_install_base_sold_product\", \n          \"sys_id\": { \n            \"value\": \"036a2349284d0210f877b68370fb2e93\" \n          }, \n          \"attributes\": { \n            \"name\": { \n              \"value\": \"Quadplay Home Tech Hub Bundle\" \n            }, \n            \"account\": { \n              \"value\": \"9e2fd2ee11b43110f877366201dea674\" \n            } \n          }, \n          \"lineItems\": [ \n            { \n              \"table\": \"sn_install_base_sold_product\", \n              \"sys_id\": { \n                \"value\": \"4b6a2349284d0210f877b68370fb2e9c\" \n              }, \n              \"attributes\": { \n                \"name\": { \n                  \"value\": \"Internet and OTT Bundle\" \n                }, \n                \"account\": { \n                  \"value\": \"9e2fd2ee11b43110f877366201dea674\" \n                } \n              }, \n              \"lineItems\": [], \n              \"characteristics\": [] \n            } \n          ], \n          \"characteristics\": [],\n          \"_state\": \"active\" \n        } \n      ] \n    } \n  ] \n}\n```\n\n### Invoke createInstance\\(\\) with entityConfigId\n\nThe example script below invokes the createInstance\\(\\) method to load the data of an order, its entire hierarchy, and its characteristics. The example demonstrates in an sp to order flow, we want to fetch the sales agreement data attached to the sold product.\n\n```\n// Utility to invoke createInstance API\nvar util = new sn_l2c_core.PrimitiveUtil();\n\nvar quoteToSA = \"sn_l2c_quote_to_sales_agreement_pricing\";\n\nvar context = {\n  \"entityConfigId\": \"sn_l2c_sales_agreement\"\n};\n\nvar spToOrder = \"sn_l2c_cust_flows_sp_to_order\";\n\nvar service = util.getPrimitivesEPService(spToOrder, context);\n\nvar createInstanceOutput = service.createInstance(\"c8e1e678432242105eba72eb3ab8f261\");\n\ngs.info(\"Sales Agreement JSON \" + JSON.stringify(createInstanceOutput));\n\n// The returned JSON can be used for subsequent methods of the flow such as delta(), effect() and commitInstance()\n```\n\nOutput:\n\n```\n{\n  \"table\": \"sn_sales_agmt_core_sales_agreement\",\n  \"sys_id\": {\n    \"value\": \"c8e1e678432242105eba72eb3ab8f261\"\n  },\n  \"attributes\": {\n    \"account\": {\n      \"value\": \"051f62b0d7300200e5982cf65e610333\"\n    },\n    \"short_description\": {\n      \"value\": \"1 year sales agreement for Spark Technologies\"\n    }\n  },\n  \"lineItems\": [\n    {\n      \"table\": \"sn_sales_agmt_core_sales_agreement_line\",\n      \"sys_id\": {\n        \"value\": \"4104369034641210f877af77d9dd31bb\"\n      },\n      \"attributes\": {\n        \"sales_agreement\": {\n          \"value\": \"c8e1e678432242105eba72eb3ab8f261\"\n        },\n        \"short_description\": {\n          \"value\": \"Home Automation Bundle\"\n        }\n      },\n      \"lineItems\": [\n        {\n          \"table\": \"sn_sales_agmt_core_sales_agreement_line\",\n          \"sys_id\": {\n            \"value\": \"45e6fa4a436a02105eba72eb3ab8f247\"\n          },\n          \"attributes\": {\n            \"sales_agreement\": {\n              \"value\": \"c8e1e678432242105eba72eb3ab8f261\"\n            },\n            \"short_description\": {\n              \"value\": \"Outdoor Camera\"\n            }\n          },\n          \"lineItems\": [],\n          \"characteristics\": [],\n          \"pricingAdjustments\": []\n        },\n        {\n          \"table\": \"sn_sales_agmt_core_sales_agreement_line\",\n          \"sys_id\": {\n            \"value\": \"73e6fa4a436a02105eba72eb3ab8f25a\"\n          },\n          \"attributes\": {\n            \"sales_agreement\": {\n              \"value\": \"c8e1e678432242105eba72eb3ab8f261\"\n            },\n            \"short_description\": {\n              \"value\": \"Indoor Camera\"\n            }\n          },\n          \"lineItems\": [],\n          \"characteristics\": [],\n          \"pricingAdjustments\": []\n        }\n      ],\n      \"characteristics\": [],\n      \"pricingAdjustments\": []\n    }\n  ]\n}\n```\n\n### Partial sync of Related Parties using allowedContextTypes\n\nThe following createInstance\\(\\) script sets **allowedContextTypes** with `header` and `headerRelatedParty` to output only those two populated sections in the sn\\_l2c\\_quote\\_to\\_opportunity table.\n\n```\nvar util1 = new sn_l2c_core.PrimitiveUtil();\nvar service1 = util1.getPrimitivesEPService('sn_l2c_quote_to_opportunity'); // WITH HEADER FLOW\nvar quoteId = '04ba9004f11f3110f8777d7194f166f6';\nvar additionalParams1 = {\n    allowedContextTypes: [\"header\", \"headerRelatedParty\"]\n};\n\nvar quoteInstance = service1.createInstance(quoteId, null, false, additionalParams1);\ngs.info(JSON.stringify(quoteInstance));\n```\n\nOutput. The output contains only those two populated sections defined in the **allowedContextTypes**. All other context-types \\(lines, childLines, characteristics, etc.\\) are empty or omitted, allowing partial sync.\n\n```\n{\n  \"table\": \"sn_quote_mgmt_core_quote\",\n  \"sys_id\": {\n    \"value\": \"04ba9004f11f3110f8777d7194f166f6\"\n  },\n  \"attributes\": {\n    \"renewal_adjustment_value\": { \"value\": \"\" },\n    \"contract_start_date\": { \"value\": \"2024-01-01\" },\n    \"total_net_new_amount\": { \"value\": \"USD;0\" },\n    \"agreement_start_date\": { \"value\": \"\" },\n    \"total_one_time_price\": { \"value\": \"USD;214\" },\n    \"consumer\": { \"value\": \"\" },\n    \"billing_location\": { \"value\": \"\" },\n    \"document_template\": { \"value\": \"\" },\n    \"pricelist\": { \"value\": \"19d29513d0e63110f8770dbf976be122\" },\n    \"assignment_group\": { \"value\": \"a4b31c0cf1db3110f8777d7194f166e9\" },\n    \"partner_contact\": { \"value\": \"\" },\n    \"auto_generated_for_renewal\": { \"value\": \"false\" },\n    \"contract_end_date\": { \"value\": \"2025-12-31\" },\n    \"active\": { \"value\": \"true\" },\n    \"billing_state\": { \"value\": \"\" },\n    \"external_system\": { \"value\": \"\" },\n    \"renewal_adjustment_type\": { \"value\": \"\" },\n    \"source_opportunity\": { \"value\": \"\" },\n    \"total_annual_recurring_price_v2\": { \"value\": \"USD;1596\" },\n    \"internal_signer\": { \"value\": \"\" },\n    \"costbook\": { \"value\": \"a3042cdce405c210f8773750028d6f72\" },\n    \"payment_terms\": { \"value\": \"\" },\n    \"shipping_location\": { \"value\": \"\" },\n    \"seller_organization\": { \"value\": \"\" },\n    \"contact\": { \"value\": \"4d147a386f0331003b3c498f5d3ee437\" },\n    \"external_id\": { \"value\": \"\" },\n    \"transaction_date\": { \"value\": \"2023-12-18 23:37:11\" },\n    \"version\": { \"value\": \"1\" },\n    \"billing_zip\": { \"value\": \"\" },\n    \"previous_quote\": { \"value\": \"\" },\n    \"assigned_to\": { \"value\": \"b9b19484f1db3110f8777d7194f166d1\" },\n    \"total_monthly_recurring_price_v2\": { \"value\": \"USD;133\" },\n    \"agreement_end_date\": { \"value\": \"\" },\n    \"contract_type\": { \"value\": \"\" },\n    \"renewal_adjustment_basis\": { \"value\": \"\" },\n    \"header_api\": { \"value\": \"\" },\n    \"channel\": { \"value\": \"agent_assist\" },\n    \"existing_contract\": { \"value\": \"\" },\n    \"state\": { \"value\": \"draft\" },\n    \"header_id\": { \"value\": \"04ba9004f11f3110f8777d7194f166f6\" },\n    \"account\": { \"value\": \"86837a386f0331003b3c498f5d3ee4ca\" },\n    \"quote_type\": { \"value\": \"add\" },\n    \"billing_street\": { \"value\": \"\" },\n    \"same_as_shipping_address\": { \"value\": \"false\" },\n    \"work_notes\": { \"value\": \"\" },\n    \"comments\": { \"value\": \"\" },\n    \"short_description\": {\n      \"value\": \"B2B - Quadplay Home Tech Hub Bundle\"\n    },\n    \"partner\": { \"value\": \"\" },\n    \"sales_agreement\": { \"value\": \"\" },\n    \"total_renewal_amount\": { \"value\": \"USD;0\" },\n    \"sa_quote\": { \"value\": \"false\" },\n    \"external_signer\": { \"value\": \"\" },\n    \"shipping_city\": { \"value\": \"\" },\n    \"discount_percentage\": { \"value\": \"\" },\n    \"expiration_date\": { \"value\": \"\" },\n    \"billing_city\": { \"value\": \"\" },\n    \"currency\": { \"value\": \"USD\" },\n    \"shipping_country\": { \"value\": \"\" },\n    \"billing_country\": { \"value\": \"\" },\n    \"record_number\": { \"value\": \"QT0000001\" },\n    \"shipping_state\": { \"value\": \"\" },\n    \"initial_quote\": {\n      \"value\": \"04ba9004f11f3110f8777d7194f166f6\"\n    },\n    \"shipping_street\": { \"value\": \"\" },\n    \"shipping_zip\": { \"value\": \"\" },\n    \"total_amount\": { \"value\": \"USD;1897.2689\" },\n    \"term_month\": { \"value\": \"24\" },\n    \"total_upsell_downsell_amount\": { \"value\": \"USD;0\" },\n    \"auto_renew\": { \"value\": \"false\" }\n  },\n  \"ramp\": [],\n  \"lineItems\": [],\n  \"headerRelatedParty\": [\n    {\n      \"table\": \"sn_quote_mgmt_core_quote_related_party\",\n      \"sys_id\": {\n        \"value\": \"a822ac20740f3690f877229405634411\"\n      },\n      \"attributes\": {\n        \"type\": {\n          \"value\": \"e12455b553716210c6caddeeff7b12d3\"\n        },\n        \"seller_organization\": { \"value\": \"\" },\n        \"active\": { \"value\": \"true\" },\n        \"responsibility\": {\n          \"value\": \"c7ccc21b65ed1910f87764df53db7725\"\n        },\n        \"order\": { \"value\": \"20\" }\n      }\n    }\n  ]\n}\n```\n\n### Multi-Select Merge\n\nThe following example fetches ramped Sold Products \\(multiple Sold Products with a single ramp\\) and merges all ramps together and all entities together in a flat structure.\n\n```\n/******** Sold Product to Order - MultiSelectMerge for Ramped SPs ********/ \n\nvar util = new sn_l2c_core.PrimitiveUtil(); \nvar service = util.getPrimitivesEPService('sn_l2c_cust_flows_sp_to_order'); \n\nvar spIDs = 'aedfb2a6e9de4210f8774eb53302a639,28490592cc253210f87793fd12b09a97'; \nvar additionalParams = { \n\"multiSelectMerge\": true, \n\"fetchRecordSysIds\": [{ \n\"sn_install_base_sold_product_ramp\": \"5b8c9d9ac429b210f87756e9cf81cc6b\" \n}] \n}; \nvar SPInstance = service.createInstance(null, spIDs, false, additionalParams); \n\ngs.info(\"SPInstance: \" + JSON.stringify(SPInstance)); \n```\n\nOutput:\n\n```\n{\n  \"ramp\": [{\"sys_id\": {...}}], \n  \"lineItems\": [{\"sys_id\": {...}}, {\"sys_id\": {...}}] \n}\n```\n\n## LeadtoCashCore - delta\\(Object sourceJSON, Object dirtyJSON, Object additionalParams\\)\n\nCompares 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.\n\n**Note:** The LeadtoCashCore script include requires you to first call the scripted extension point PrimitiveUtil\\(\\) with the [LeadtoCashCore - getPrimitivesEPService\\(String sourceToTargetConfigID, Object context\\)](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/LeadToCashCoreAPI.md) 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.\n\nTo enable delta\\(\\) to be invoked with only the configuration ID of the entity, set the getPrimitivesEPService\\(\\) string parameter, **context.entityConfigId**. If both **entityConfigId** and **sourceToTargetConfigID** are passed, **entityConfigId** is prioritized to execute delta\\(\\).\n\n<table id=\"table_hvh_twm_d1c\" class=\"parameters\"><thead><tr><th>\n\nName\n\n</th><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nsourceJSON\n\n</td><td>\n\nObject\n\n</td><td>\n\nJSON object of the source lead to cash entity. **Note:** Use the [LeadtoCashCore - createInstance\\(String headerSysIDs, String lineSysIDs, Boolean isTarget, Object additionalParams\\)](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/LeadToCashCoreAPI.md) method to retrieve the source JSON of an entity.\n\n</td></tr><tr><td>\n\ndirtyJSON\n\n</td><td>\n\nObject\n\n</td><td>\n\nModified source JSON of the lead to cash entity.\n\n</td></tr><tr><td>\n\nadditionalParams\n\n</td><td>\n\nObject\n\n</td><td>\n\nOptional. Additional parameters to use.\n\n</td></tr><tr><td>\n\nadditionalParams.delta\\_ignore\\_attributes\n\n</td><td>\n\nObject\n\n</td><td>\n\nTable attributes to ignore during comparison between the source and dirtyJSON. Enables support of reconfiguration  use cases.```\n{  \n“<table_name>”: [<attribute_name1>, attribute_name2>] \n}\n```\n\n</td></tr><tr><td>\n\nadditionalParams.delta\\_ignore\\_attributes.&lt;table\\_name&gt;\n\n</td><td>\n\nString\n\n</td><td>\n\nThe name of the table and its associated attributes to ignore.For example:\n\n```\n{  \n“sn_install_base_sold_product”: [“state”,”unit_price”]  \n}\n```\n\n</td></tr><tr><td>\n\nadditionalParams.loadDisplayValue\n\n</td><td>\n\nBoolean\n\n</td><td>\n\nOptional. Flag that indicates whether to load the display value for each attribute.Valid values:\n\n-   true: Enables the loading of an attribute's display value.\n-   false: Doesn't enable the loading of an attribute's display value.\n\nDefault: false\n\n</td></tr></tbody>\n</table><table id=\"leadtocore-return-parameters\" class=\"returns\"><thead><tr><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nJSON Object\n\n</td><td>\n\nAn object containing details of the entity record with any changes that occurred between the sourceJSON and dirtyJSON.Data type: Object\n\n```\n{\n\"lineItems\": [Array] \n}\n```\n\n</td></tr><tr><td>\n\nlineItems\n\n</td><td>\n\nJSON 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\n\n```\n\"lineItems\": [ \n {\n  \"_action\": \"String\",\n  \"attributes\": {Object}\n  \"characteristics\": [Array]\n  \"lineItems\": [Array],\n  \"sys_id\": {Object},\n  \"table\": \"String\"\n } \n]\n```\n\n</td></tr><tr><td>\n\nlineItems.\\_action\n\n</td><td id=\"l2c-returns-lineItems._action-entry\">\n\nChange action applied to the line item of the source JSON. Possible values:\n\n-   add: Information was added to the source JSON.\n-   change: Information was updated in the source JSON.\n-   disconnect: Information was disconnected from the source JSON.\n-   nochange: No change occurred on the source JSON.\n\nData type: String\n\n</td></tr><tr><td>\n\nlineItems.attributes\n\n</td><td id=\"l2c-returns-lineItems.attributes-returns\">\n\nAttributes of the line item. For example, the attribute's name and value. May contain varying fields based on the entity.Data type: Object\n\n```\n\"attributes\": { \n  \"<attribute_name>\": {Object}\n}\n```\n\n</td></tr><tr><td>\n\nlineitems.attributes.&lt;attribute\\_name&gt;\n\n</td><td id=\"l2c-returns-lineItems.attributes.attribute_name-returns\">\n\nName of the line item attribute. For example, the name of an account or contact. May contain varying fields of the entity.Data type: Object\n\n```\n\"attributes\": { \n \"<attribute_name>\": { \n   \"value\": \"String\"\n }\n}\n```\n\n</td></tr><tr><td>\n\nlineitems.attributes.&lt;attribute\\_name&gt;.value\n\n</td><td id=\"l2c-returns-lineItems.attributes.attribute_name.value-returns\">\n\nValue of the line item attribute. Data type: String\n\n</td></tr><tr><td>\n\nlineItems.attributes.account\n\n</td><td id=\"l2c-returns-lineItems-attributes.account-returns\">\n\nInformation about the account associated with the item attribute.Data type: Object\n\n```\n\"account\": { \n  \"value\": \"String\" \n}\n```\n\n</td></tr><tr><td>\n\nlineItems.attributes.account.value\n\n</td><td id=\"l2c-returns-lineItems.attributes.account.value-returns\">\n\nSys\\_id of the account associated with the line item attribute.Data type: String\n\n</td></tr><tr><td>\n\nlineItems.characteristics\n\n</td><td>\n\nCharacteristics of the line item. May contain varying fields based on the entity.Data type: Array of Objects\n\n```\n\"characteristics\": [  \n {  \n  \"attributes\": {Object},\n  \"sys_id\": {Object},  \n  \"table\": \"String\"\n  }  \n]\n```\n\n</td></tr><tr><td>\n\nlineItems.characteristics.attributes\n\n</td><td>\n\nAttributes of the header record characteristics. For example, the attribute's name and value. May contain varying fields based on the entity.Data type: Object\n\n```\n\"attributes\": { \n \"<field_name>\": { \n \"value\": \"String\"\n}\n```\n\n</td></tr><tr><td>\n\nlineitems.characteristics.attributes.&lt;field\\_name&gt;\n\n</td><td id=\"l2c-returns-lineItems.attributes.field_name-returns\">\n\nAttribute name of the characteristic record associated with the line item.Data type: Object\n\n```\n\"<field_name>\": { \n  \"value\": \"String\" \n}\n```\n\n</td></tr><tr><td>\n\nlineitems.characteristics.attributes.&lt;field\\_name&gt;.value\n\n</td><td id=\"l2c-returns-lineItems.attributes.name.field_name.value-returns\">\n\nValue of the attribute belonging to the characteristic record of an entity.Data type: String\n\n</td></tr><tr><td>\n\nlineItems.characteristics.sys\\_id\n\n</td><td>\n\nSys\\_id object of the characteristic record.Data type: Object\n\n```\n\"sys_id\": { \n  \"value\": \"String\" \n}\n```\n\n</td></tr><tr><td>\n\nlineItems.characteristics.sys\\_id.value\n\n</td><td id=\"l2c-returns-lineItems.-characteristics.sys_id.value-returns\">\n\nSys\\_id of the associated characteristic record. The updated table may vary between entities. For example, Order \\[sn\\_ind\\_tmt\\_orm\\_order\\].Data type: String\n\n</td></tr><tr><td>\n\nlineItems.characteristics.table\n\n</td><td id=\"l2c-returns-lineItems.characteristics.table-returns\">\n\nName of the table containing the characteristic record.Data type: String\n\n</td></tr><tr><td>\n\nlineItems.lineItems\n\n</td><td id=\"l2c-returns-lineItems.lineitems-returns\">\n\nChild line items of a parent line item. This object has the same format as the **lineItems** parameter.Data type: Array of Objects\n\n```\n\"lineItems\": [  \n {  \n  \"_glide_action\": \"String\",\n  \"attributes\": {Object},\n  \"characteristics\": [Array],\n  \"lineItems\": [Array],\n  \"sys_id\": {Object},\n  \"table\": \"String\"\n } \n]\n```\n\n</td></tr><tr><td>\n\nlineItems.sys\\_id\n\n</td><td id=\"l2c-returns-lineItems.sys_id-returns\">\n\nSys\\_id of the associated item record.Data type: Object\n\n```\n\"sys_id\": {\n  \"value\": \"String\"\n}\n```\n\n</td></tr><tr><td>\n\nlineItems.sys\\_id.value\n\n</td><td id=\"l2c-returns-lineItems.sys_id.value-returns\">\n\nSys\\_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\n\n</td></tr><tr><td>\n\nlineItems.table\n\n</td><td id=\"l2c-returns-lineItems.table-returns\">\n\nName of the table that contains the item record associated with the lead to cash entity. Data type: String\n\n</td></tr></tbody>\n</table>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.\n\n```\n//Utility to invoke Delta API \nvar util = new sn_l2c_core.PrimitiveUtil();  \n \n//Invoke extension point, picks an implementation based on sourceToTargetConfigID of a L2C flow, the Mapping Config ID  in “sn_l2c_core_entity_mapping” table. \nvar service = util.getPrimitivesEPService('sp_order_macd'); \n \n//Invoke delta API with required params \n// sourceJSON can be the output of createInstance or null \n//dirtyJSON is the modified sourceJSON \nvar deltaOutput= service.delta(sourceJSON, dirtyJSON);  \n \n//Print the returned JSON \ngs.info(\" deltaOutput: \"+JSON.stringify(deltaOutput));  \n \n//The returned JSON can be used for subsequent APIs of the flow such as Effect and Commit Instance\n```\n\nThe output JSON shows that several line items were added to the sold base product:\n\n```\n{ \n  \"lineItems\": [ \n    { \n      \"table\": \"sn_install_base_sold_product\", \n      \"sys_id\": { \n        \"value\": \"-1\" \n      }, \n      \"attributes\": { \n        \"name\": { \n          \"value\": \"Quadplay Home Tech Hub Bundle\" \n        }, \n        \"account\": { \n          \"value\": \"9e2fd2ee11b43110f877366201dea674\" \n        } \n      }, \n      \"lineItems\": [ \n        { \n          \"table\": \"sn_install_base_sold_product\", \n          \"sys_id\": { \n            \"value\": \"-1\" \n          }, \n          \"attributes\": { \n            \"name\": { \n              \"value\": \"Internet and OTT Bundle\" \n            }, \n            \"account\": { \n              \"value\": \"9e2fd2ee11b43110f877366201dea674\" \n            } \n          }, \n          \"lineItems\": [ \n            { \n              \"table\": \"sn_install_base_sold_product\", \n              \"sys_id\": { \n                \"value\": \"-1\" \n              }, \n              \"attributes\": { \n                \"name\": { \n                  \"value\": \"Solana Sports streaming channel\" \n                }, \n                \"account\": { \n                  \"value\": \"9e2fd2ee11b43110f877366201dea674\" \n                } \n              }, \n              \"lineItems\": [], \n              \"characteristics\": [], \n              \"_action\": \"add\" \n            } \n          ], \n          \"characteristics\": [], \n          \"_action\": \"add\" \n        } \n      ], \n      \"characteristics\": [ \n        { \n          \"table\": \"sn_prd_pm_product_characteristics\", \n          \"sys_id\": { \n            \"value\": \"-1\" \n          }, \n          \"attributes\": { \n            \"characteristic_value\": { \n              \"value\": \"\" \n            }, \n            \"characteristic\": { \n              \"value\": \"4f31999fd0a63110f8770dbf976be178\" \n            }, \n            \"characteristic_option\": { \n              \"value\": \"4f31999fd0a63110f8770dbf976be179\" \n            }, \n            \"sold_product\": { \n              \"value\": \"4e03cda2ec873110f87727ef5883a2cf\" \n            }, \n            \"action\": { \n              \"value\": \"add\" \n            } \n          }, \n          \"_action\": \"add\" \n        } \n      ], \n      \"_action\": \"add\" \n    } \n  ] \n} \n```\n\n### Multi-select\n\nThe 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.\n\n```\n/Utility to invoke Delta API  \nvar util = new sn_l2c_core.PrimitiveUtil();   \n\n//Set context variable isMultiSelect true to enable multi-select \nvar context = {\"isMultiSelect\": true}; \n \n//Invoke extension point, picks an implementation based on sourceToTargetConfigID of a L2C flow, the Mapping Config ID  in “sn_l2c_core_entity_mapping” table.  \nvar service = util.getPrimitivesEPService(‘sn_l2c_cust_flows_sp_to_order’, context);  \n  \n//Invoke delta API with required params  \n// sourceJSON can be the output of createInstance for multiple lineIDs or headerIDs or null  \n//dirtyJSON is the modified sourceJSON  \nvar deltaOutput= service.delta(sourceJSON, dirtyJSON);   \n  \n//Print the returned JSON  \ngs.info(\" deltaOutput: \"+JSON.stringify(deltaOutput));   \n  \n//The returned JSON can be used for subsequent APIs of the flow such as Effect and Commit Instance\n```\n\nThe output JSON shows that several line items were added to the sold base product:\n\n```\n{ \n  \"items\": [ \n    { \n      \"lineItems\": [ \n        { \n          \"table\": \"sn_install_base_sold_product\", \n          \"sys_id\": { \n            \"value\": \"4e03cda2ec873110f87727ef5883a2cf\" \n          }, \n          \"attributes\": { \n            \"name\": { \n              \"value\": \"Quadplay Home Tech Hub Bundle\" \n            }, \n            \"account\": { \n              \"value\": \"9e2fd2ee11b43110f877366201dea674\" \n            } \n          }, \n          \"lineItems\": [ \n            { \n              \"table\": \"sn_install_base_sold_product\", \n              \"sys_id\": { \n                \"value\": \"9e0301e2ec873110f87727ef5883a23a\" \n              }, \n              \"attributes\": { \n                \"name\": { \n                  \"value\": \"Internet and OTT Bundle\" \n                }, \n                \"account\": { \n                  \"value\": \"9e2fd2ee11b43110f877366201dea674\" \n                } \n              }, \n              \"lineItems\": [], \n              \"characteristics\": [], \n              \"_action\": \"disconnect\" \n            } \n          ], \n          \"characteristics\": [], \n          \"_action\": \"disconnect\" \n        } \n      ] \n    }, \n    { \n      \"lineItems\": [\n        { \n          \"table\": \"sn_install_base_sold_product\", \n          \"sys_id\": { \n            \"value\": \"036a2349284d0210f877b68370fb2e93\" \n          }, \n          \"attributes\": { \n            \"name\": { \n              \"value\": \"Quadplay Home Tech Hub Bundle\" \n            }, \n            \"account\": { \n              \"value\": \"9e2fd2ee11b43110f877366201dea674\" \n            } \n          }, \n          \"lineItems\": [ \n            { \n              \"table\": \"sn_install_base_sold_product\", \n              \"sys_id\": { \n                \"value\": \"4b6a2349284d0210f877b68370fb2e9c\" \n              },\n              \"attributes\": { \n                \"name\": { \n                  \"value\": \"Internet and OTT Bundle\" \n                }, \n                \"account\": { \n                  \"value\": \"9e2fd2ee11b43110f877366201dea674\" \n                } \n              }, \n              \"lineItems\": [], \n              \"characteristics\": [], \n              \"_action\": \"disconnect\" \n            } \n          ], \n          \"characteristics\": [], \n          \"_action\": \"disconnect\" \n        } \n      ] \n    } \n  ] \n}\n```\n\n## LeadtoCashCore - effect\\(Object sourceJSON, Object targetJSON, Object additionalParams\\)\n\nTransforms 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.\n\nYou 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.\n\n**Note:** The LeadtoCashCore script include requires you to first call the scripted extension point PrimitiveUtil\\(\\) with the [LeadtoCashCore - getPrimitivesEPService\\(String sourceToTargetConfigID, Object context\\)](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/LeadToCashCoreAPI.md) 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.\n\n<table id=\"table_sjw_1ym_d1c\" class=\"parameters\"><thead><tr><th>\n\nName\n\n</th><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nsourceJSON\n\n</td><td>\n\nObject\n\n</td><td>\n\nJSON containing details of the source entity.**Note:** Use the [LeadtoCashCore - createInstance\\(String headerSysIDs, String lineSysIDs, Boolean isTarget, Object additionalParams\\)](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/LeadToCashCoreAPI.md) to retrieve the source JSON of an entity.\n\n</td></tr><tr><td>\n\ntargetJSON\n\n</td><td>\n\nObject\n\n</td><td>\n\nJSON containing details of the target entity.\n\n</td></tr><tr><td>\n\nadditionalParams\n\n</td><td>\n\nObject\n\n</td><td>\n\nOptional. Additional parameters to use.\n\n</td></tr><tr><td>\n\nadditionalParams.is\\_future\\_state\n\n</td><td>\n\nBoolean\n\n</td><td>\n\nOptional. Use this to support reconfiguration  use cases. Accepted values:\n\n-   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.\n-   false: Provides dictionary field names.\n\nDefault: false\n\n</td></tr></tbody>\n</table><table id=\"id_hfh_p13_h1c\" class=\"returns\"><thead><tr><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nJSON Object\n\n</td><td>\n\nChange 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\n\n```\n{\n  \"_glide_action\": \"String\",\n  \"_records_count: {Object},\n  \"_source_object\": {Object},\n  \"lineItems\": [Array],\n  \"sys_id\": \"String\", \n  \"table\": \"String\"\n}\n```\n\n</td></tr><tr><td>\n\n\\_glide\\_action\n\n</td><td>\n\nIndicates the change that occurred at the item level between the source and target JSON.Possible values \\(case-sensitive\\):\n\n-   DELETE: Information was removed between the source and target JSON structures.\n-   INSERT: Information was added between the source and target JSON structures.\n-   NO\\_CHANGE: No change occurred between the source and target JSON structures.\n-   UPDATE: Information was modified between the source and JSON structures.\n\nData type: String\n\n</td></tr><tr><td>\n\n\\_records\\_count\n\n</td><td>\n\nDetails of new records inserted for each table.Data type: Object\n\n```\n\"_records_count\": {\n\"tableName\": {Object}\n}\n```\n\n</td></tr><tr><td>\n\n\\_records\\_count.tableName\n\n</td><td>\n\nName of the table in which new records are inserted.Data type: Object\n\n```\n\"tableName\": {\n      \"insert\": Number}\n}\n```\n\n</td></tr><tr><td>\n\n\\_records\\_count.tableName.insert\n\n</td><td>\n\nNumber of new records inserted in the table.Data type: Number\n\n</td></tr><tr><td>\n\n\\_source\\_object\n\n</td><td>\n\nSource JSON object to which changes were applied. The object structure may vary between entities.Data type: Object\n\n```\n\"_source_object\": { \n  \"sys_id\": \"String\",\n  \"table\": \"String\" \n}\n```\n\n</td></tr><tr id=\"l2c-returns-lineItems._source_object.sys_id\"><td>\n\n\\_source\\_object.sys\\_id\n\n</td><td>\n\nSys\\_id of the source entity record that was updated. Data type: String\n\n</td></tr><tr id=\"l2c-returns-lineItems._source_object.table\"><td>\n\n\\_source\\_object.table\n\n</td><td>\n\nTable location of the source entity record that was updated. This value may vary between entities.Data type: String\n\n</td></tr><tr><td>\n\nlineItems.\\_glide\\_action\n\n</td><td id=\"l2c-returns-lineItems._glide_action-entry\">\n\nChange action that occurred on the line item.Possible values:\n\n-   DELETE: Information was removed between the source and target JSON structures.\n-   INSERT: Information was added between the source and target JSON structures.\n-   NO\\_CHANGE: No change occurred between the source and target JSON structures.\n-   UPDATE: Information was modified between the source and JSON structures.\n\nData type: String\n\n</td></tr><tr><td>\n\nlineItems.\\_source\\_object\n\n</td><td id=\"l2c-returns-lineItems._source_object-entry\">\n\nSource entity record details to which the \\_glide\\_action was applied. This object may vary between entities.Data type: Object\n\n```\n\"_source_object\": { \n  \"sys_id\": \"String\",\n  \"table\": \"String\" \n}\n```\n\n</td></tr><tr><td>\n\nlineItems.\\_source\\_object.sys\\_id\n\n</td><td>\n\nSys\\_id of the source entity record that was updated. Data type: String\n\n</td></tr><tr><td>\n\nlineItems.\\_source\\_object.table\n\n</td><td>\n\nTable location of the source entity record that was updated. This value may vary between entities.Data type: String\n\n</td></tr><tr><td>\n\nlineItems.\\_state\n\n</td><td id=\"l2c-returns-lineItems._state-entry\">\n\nState of the entity.Data type: Object\n\n```\n\"_state\": {  \n \"value\": \"String\" \n} \n```\n\n</td></tr><tr><td>\n\nlineItems.\\_state.value\n\n</td><td id=\"l2c-returns-lineItems._state.value-returns\">\n\nThe current state of the entity.Possible values:\n\n-   active: The entity object is in an active state.\n-   inactive: The entity object isn't in an active state.\n\nData type: String\n\n</td></tr><tr><td>\n\nlineItems.attributes\n\n</td><td id=\"l2c-returns-lineItems.attributes-returns\">\n\nAttributes of the line item. For example, the attribute's name and value. May contain varying fields based on the entity.Data type: Object\n\n```\n\"attributes\": { \n  \"<attribute_name>\": {Object}\n}\n```\n\n</td></tr><tr><td>\n\nlineitems.attributes.&lt;attribute\\_name&gt;\n\n</td><td id=\"l2c-returns-lineItems.attributes.attribute_name-returns\">\n\nName of the line item attribute. For example, the name of an account or contact. May contain varying fields of the entity.Data type: Object\n\n```\n\"attributes\": { \n \"<attribute_name>\": { \n   \"value\": \"String\"\n }\n}\n```\n\n</td></tr><tr><td>\n\nlineitems.attributes.&lt;attribute\\_name&gt;.value\n\n</td><td id=\"l2c-returns-lineItems.attributes.attribute_name.value-returns\">\n\nValue of the line item attribute. Data type: String\n\n</td></tr><tr><td>\n\nlineItems.attributes.account\n\n</td><td id=\"l2c-returns-lineItems-attributes.account-returns\">\n\nInformation about the account associated with the item attribute.Data type: Object\n\n```\n\"account\": { \n  \"value\": \"String\" \n}\n```\n\n</td></tr><tr><td>\n\nlineItems.attributes.account.value\n\n</td><td id=\"l2c-returns-lineItems.attributes.account.value-returns\">\n\nSys\\_id of the account associated with the line item attribute.Data type: String\n\n</td></tr><tr><td>\n\nlineItems.attributes.short\\_description\n\n</td><td>\n\nBrief description of the line item attribute.Data type: String\n\n</td></tr><tr><td>\n\nlineItems.characteristics\n\n</td><td id=\"l2c-returns-lineItems.characteristics-returns\">\n\nList of characteristics associated with the line item. Characteristics may vary between entities.Data type: Array of Objects\n\n```\n\"characteristics\": [  \n {\n  \"_glide_action: \"String\",\n  \"attributes\": {Object},\n  \"sys_id\": {Object},  \n  \"table\": \"String\"\n }  \n]\n```\n\n</td></tr><tr><td>\n\nlineItems.characteristics.\\_glide\\_action\n\n</td><td>\n\nChange action that occurred on the line item.Possible values:\n\n-   DELETE: Information was removed between the source and target JSON structures.\n-   INSERT: Information was added between the source and target JSON structures.\n-   NO\\_CHANGE: No change occurred between the source and target JSON structures.\n-   UPDATE: Information was modified between the source and JSON structures.\n\nData type: String\n\n</td></tr><tr><td>\n\nlineItems.characteristics.attributes\n\n</td><td id=\"l2c-returns-lineItems.characteristics.attributes-entry\">\n\nOne or more objects that contain information about attributes associated with the characteristic record.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.\n\nData type: Object\n\n```\n\"attributes\": {\n  \"<attribute_type>\": {Object}\n}\n```\n\n</td></tr><tr><td>\n\nlineItems.characteristics.attributes.&lt;attribute\\_type&gt;\n\n</td><td>\n\nType of attribute. This value can contain different values based on the records or functionality associated with the characteristic.Data type: Object\n\n```\n\"<attribute_type>\": {\n  \"value\": \"String\"\n}\n```\n\n</td></tr><tr><td>\n\nlineItems.characteristics.attributes.&lt;attribute\\_type&gt;.value\n\n</td><td id=\"l2c-returns-lineItems.characteristics.attributes.attribute_type-returns\">\n\nValue of the line item attribute.Data type: String\n\n</td></tr><tr><td>\n\nlineitems.characteristics.attributes.&lt;field\\_name&gt;\n\n</td><td id=\"l2c-returns-lineItems.attributes.field_name-returns\">\n\nAttribute name of the characteristic record associated with the line item.Data type: Object\n\n```\n\"<field_name>\": { \n  \"value\": \"String\" \n}\n```\n\n</td></tr><tr><td>\n\nlineitems.characteristics.attributes.&lt;field\\_name&gt;.value\n\n</td><td id=\"l2c-returns-lineItems.attributes.name.field_name.value-returns\">\n\nValue of the attribute belonging to the characteristic record of an entity.Data type: String\n\n</td></tr><tr><td>\n\nlineItems.characteristics.sys\\_id\n\n</td><td id=\"l2c-returns-lineItems-characteristics.sys_id-returns\">\n\nSys\\_id of the associated characteristic record.Data type: Object\n\n```\n\"sys_id\": { \n  \"value\": \"String\" \n }\n```\n\n</td></tr><tr><td>\n\nlineItems.characteristics.sys\\_id.value\n\n</td><td id=\"l2c-returns-lineItems.-characteristics.sys_id.value-returns\">\n\nSys\\_id of the associated characteristic record. The updated table may vary between entities. For example, Order \\[sn\\_ind\\_tmt\\_orm\\_order\\].Data type: String\n\n</td></tr><tr><td>\n\nlineItems.characteristics.table\n\n</td><td id=\"l2c-returns-lineItems.characteristics.table-returns\">\n\nName of the table containing the characteristic record.Data type: String\n\n</td></tr><tr><td>\n\nlineItems.lineItems\n\n</td><td id=\"l2c-returns-lineItems.lineitems-returns\">\n\nChild line items of a parent line item. This object has the same format as the **lineItems** parameter.Data type: Array of Objects\n\n```\n\"lineItems\": [  \n {  \n  \"_glide_action\": \"String\",\n  \"attributes\": {Object},\n  \"characteristics\": [Array],\n  \"lineItems\": [Array],\n  \"sys_id\": {Object},\n  \"table\": \"String\"\n } \n]\n```\n\n</td></tr><tr><td>\n\nlineItems.sys\\_id\n\n</td><td id=\"l2c-returns-lineItems.sys_id-returns\">\n\nSys\\_id of the associated item record.Data type: Object\n\n```\n\"sys_id\": {\n  \"value\": \"String\"\n}\n```\n\n</td></tr><tr><td>\n\nlineItems.sys\\_id.value\n\n</td><td id=\"l2c-returns-lineItems.sys_id.value-returns\">\n\nSys\\_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\n\n</td></tr><tr><td>\n\nlineItems.table\n\n</td><td id=\"l2c-returns-lineItems.table-returns\">\n\nName of the table that contains the item record associated with the lead to cash entity. Data type: String\n\n</td></tr><tr><td>\n\nsys\\_id\n\n</td><td>\n\nSys\\_id of the entity.Data type: String\n\n</td></tr><tr><td>\n\ntable\n\n</td><td>\n\nName of the table in which the entity is found.Data type: String\n\n</td></tr></tbody>\n</table>The following example shows how to apply transformation logic using the output of the delta\\(\\) method:\n\n**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.\n\n```\n//Utility to invoke effect API \nvar util = new sn_l2c_core.PrimitiveUtil();  \n \n//Invoke extension point, picks an implementation based on sourceToTargetConfigID of a L2C flow, the Mapping Config ID  in “sn_l2c_core_entity_mapping” table. \nvar service = util.getPrimitivesEPService('sp_order_macd'); \n \n//Invoke effect API with required params \nvar effectOutput = service.effect(deltaOutput, null); \n \n//Print the returned JSON \ngs.info(\"effectOutput: \" + JSON.stringify(effectOutput)); \n \n//The returned JSON can be used in the subsequent commitInstance() method.\n```\n\nOutput:\n\n```\n{ \n  \"sys_id\": \"-1\", \n  \"table\": \"sn_ind_tmt_orm_order\", \n  \"_glide_action\": \"INSERT\", \n  \"_source_object\": {}, \n  \"lineItems\": [ \n    { \n      \"sys_id\": \"-1\", \n      \"table\": \"sn_ind_tmt_orm_order_line_item\", \n      \"attributes\": { \n        \"account\": { \n          \"value\": \"9e2fd2ee11b43110f877366201dea674\" \n        }, \n        \"short_description\": { \n          \"value\": \"Quadplay Home Tech Hub Bundle\" \n        } \n      }, \n      \"_glide_action\": \"INSERT\", \n      \"_source_object\": { \n        \"sys_id\": \"-1\", \n        \"table\": \"sn_install_base_sold_product\" \n      }, \n      \"lineItems\": [ \n        { \n          \"sys_id\": \"-1\", \n          \"table\": \"sn_ind_tmt_orm_order_line_item\", \n          \"attributes\": { \n            \"account\": { \n              \"value\": \"9e2fd2ee11b43110f877366201dea674\" \n            }, \n            \"short_description\": { \n              \"value\": \"Internet and OTT Bundle\" \n            } \n          }, \n          \"_glide_action\": \"INSERT\", \n          \"_source_object\": { \n            \"sys_id\": \"-1\", \n            \"table\": \"sn_install_base_sold_product\" \n          }, \n          \"lineItems\": [ \n            { \n              \"sys_id\": \"-1\", \n              \"table\": \"sn_ind_tmt_orm_order_line_item\", \n              \"attributes\": { \n                \"account\": { \n                  \"value\": \"9e2fd2ee11b43110f877366201dea674\" \n                }, \n                \"short_description\": { \n                  \"value\": \"Solana Sports streaming channel\" \n                } \n              }, \n              \"_glide_action\": \"INSERT\", \n              \"_source_object\": { \n                \"sys_id\": \"-1\", \n                \"table\": \"sn_install_base_sold_product\" \n              }, \n              \"lineItems\": [], \n              \"characteristics\": [] \n            } \n          ], \n          \"characteristics\": [] \n        } \n      ], \n      \"characteristics\": [ \n        { \n          \"sys_id\": \"-1\", \n          \"table\": \"sn_ind_tmt_orm_order_characteristic_value\", \n          \"attributes\": { \n            \"characteristic_option\": { \n              \"value\": \"4f31999fd0a63110f8770dbf976be179\" \n            }, \n            \"characteristic\": { \n              \"value\": \"4f31999fd0a63110f8770dbf976be178\" \n            }, \n            \"characteristic_option_value\": { \n              \"value\": \"\" \n            } \n          }, \n          \"_glide_action\": \"INSERT\", \n          \"_source_object\": { \n            \"sys_id\": \"-1\", \n            \"table\": \"sn_prd_pm_product_characteristics\" \n          } \n        } \n      ] \n    }, \n  \"_state\": {\n      \"value\": \"active\"\n}\n   ],\n  \"_records_count\":\n    {\n        \"sn_ind_tmt_orm_order\":\n        {\n            \"insert\": 1\n        },\n        \"sn_ind_tmt_orm_order_line_item\":\n        {\n            \"insert\": 3\n        },\n        \"sn_ind_tmt_orm_order_characteristic_value\":\n        {\n            \"insert\": 1\n        }\n    }\n}\n```\n\n## LeadtoCashCore - commitInstance\\(Object targetJSON, Object additionalParams\\)\n\nCommits 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.\n\n**Note:** The LeadtoCashCore script include requires you to first call the scripted extension point PrimitiveUtil\\(\\) with the [LeadtoCashCore - getPrimitivesEPService\\(String sourceToTargetConfigID, Object context\\)](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/LeadToCashCoreAPI.md) utility method to trigger the do before calling commitInstance\\(\\) in your script. Per each flow, become the service only one and use the same service for all LeadtoCashCore methods.\n\nAs of the March 2026 \\(v1.8\\) store release, the commitInstance\\(\\) method at this time returns a structured **dataObject** that groups all root entities by type \\(for example, `lineItems` and `ramp`\\), allowing developers to reliably access Sold Products and their associated ramps from a one commit response.\n\n<table id=\"table_lmb_zym_d1c\" class=\"parameters\"><thead><tr><th>\n\nName\n\n</th><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\ntargetJSON\n\n</td><td>\n\nObject\n\n</td><td>\n\nJSON object containing the ‘glide\\_action’ of a target entity to commit. You can pass the output of the [effect\\(\\)](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/LeadToCashCoreAPI.md) method here. **Note:** ‘glide\\_action’ identifies the change action that occurred between the source and target JSON of a lead to cash entity.\n\n</td></tr><tr><td>\n\nadditionalParams\n\n</td><td>\n\nObject\n\n</td><td>\n\nOptional. Additional parameters to use.```\n\"additionalParams\": {\n  \"returnDeletedGr\": Boolean,\n  \"useNumberGeneartor\": Boolean\n}\n```\n\n</td></tr><tr><td>\n\nadditionalParams.useNumberGenerator\n\n</td><td>\n\nBoolean\n\n</td><td>\n\nOptional. Flag that indicates if to generate sys\\_numbers in bulk. Applicable values:\n\n-   true: Generate the sys\\_numbers in bulk to be utilized during the record insertion process. Reduces the need for additional queries to fetch numbers and decreases insertion time.\n-   incorrect: Generate the sys\\_number individually at the time of insertion for each record.\n\nDefault: incorrect\n\n</td></tr><tr><td>\n\nadditionalParams.returnDeletedGr\n\n</td><td>\n\nBoolean\n\n</td><td>\n\nOptional. Flag that indicates whether to trigger post processing upon a DELETE operation. Only set **returnDeletedGr** to `true` if your subclass overrides `_postProcess` or `_postHierarchyCommit` and contains logic that should execute after DELETE operations.\n\nValid values:\n\n-   true: The deleted GlideRecord is returned after a DELETE operation and assigned to target, which causes **\\_postProcess** and **\\_postHierarchyCommit** to fire.\n-   false: DELETE operations don't trigger**\\_postProcess** or **\\_postHierarchyCommit**.\n\nDefault: false\n\n</td></tr></tbody>\n</table><table id=\"table_mmb_zym_d1c\" class=\"returns\"><thead><tr><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nJSON Object\n\n</td><td>\n\nDetails about the target entity record.Data type: Object\n\n```\n{\n  \"dataObject\": {Object},\n  \"displayMessage\": \"String\",\n  \"error\": \"String\",\n  \"headerID\": \"String\",\n  \"message\": \"String\",\n  \"rootLineIDs\": [Array],\n  \"status\": \"String\"\n}\n```\n\n**Note:** **headerID** is only present for header entities, **rootLineIDs** are only present for no‑header entities. **dataObject**, **displayMessage**, **error**, **message**, and **status** are always present.\n\n</td></tr><tr><td>\n\ndataObject\n\n</td><td>\n\nJSON object that has detailed data on the commit operations performed at each level. **Note:** As of the March 2026 store release, the **dataObject** field at this time accumulates all root entity types by their typeValue keys \\(for example lineItems, ramp\\), preserving data for all root entities.\n\nData type: Object\n\nStructure when entity has a header:\n\n```\ndataObject: {\n  \"sys_id\": \"String\",\n  \"table\": \"String\",\n  \"attributes\": {Object},\n  \"_glide_action\": \"String\",\n  \"_source_object\": {Object},\n  \"_commitObjectInfo\": {Object},\n  \"lineItems\": [Array],\n  \"ramp\": [Array],\n  \"headerRelatedParty\": [Array],\n  \"characteristics\": [Array]\n}\n```\n\n</td></tr><tr><td>\n\ndataObject.\\_commitObjectInfo\n\n</td><td>\n\nCommit status and sys\\_id if the line item change is an ENGAGE action.Data type: Object\n\n```\n\"_commitObjectInfo\": {\n  \"status\": \"String\",\n  \"sys_id\": \"String\"\n}\n```\n\n</td></tr><tr><td>\n\ndataObject.ramp\n\n</td><td>\n\nRepresents the ramp group\\(s\\) associated with a header or Sold Material.Array of Objects\n\n```\n\"ramp\": { \n  \"sys_id\": \"String\",  \n  \"table\": \"String\", \n  \"attributes\": {Object} \n}\n```\n\n</td></tr><tr><td>\n\ndataObject.ramp.sys\\_id\n\n</td><td>\n\nSys\\_id of the ramp. Providing ramp IDs without the parent mapping is considered invalid input for no-header and multiselect patterns.Data type: String\n\n</td></tr><tr><td>\n\ndataObject.ramp.table\n\n</td><td>\n\nTable name of the ramp entity associated with the committed Sold Material or header. For example, `\"sn_install_base_sold_product_ramp\"`.Data type: String\n\n</td></tr><tr><td>\n\ndataObject.ramp.attribute\n\n</td><td>\n\nAttributes of the ramp.Data type: Object\n\n```\n\"attributes\": { \n  \"end_date\": String,\n  \"parent\": String,\n  \"parent_table\": String,\n  \"ramp_type\": String,\n  \"start_date\": String,\n  \"status\": String,\n  \"term\": String\n}\n```\n\n</td></tr><tr><td>\n\ndataObject.ramp.attribute.parent\n\n</td><td>\n\nSys\\_id of the ramp's parent attribute.Data type: String\n\n</td></tr><tr><td>\n\ndataObject.ramp.attribute.parent\\_table\n\n</td><td>\n\nTable location of the attribute. For example, `table_name`.Data type: String\n\n</td></tr><tr><td>\n\ndataObject.ramp.attribute.ramp\\_type\n\n</td><td>\n\nType of ramp.Possible values:\n\n-   Quarterly\n-   Yearly\n-   Custom\n\nData type: String\n\n</td></tr><tr><td>\n\ndataObject.ramp.attribute.term\n\n</td><td>\n\nTerm.Data type: String\n\n</td></tr><tr><td>\n\ndataObject.ramp.attribute.start\\_date\n\n</td><td>\n\nStart date of the ramp.Data type: String\n\n</td></tr><tr><td>\n\ndataObject.ramp.attribute.end\\_date\n\n</td><td>\n\nEnd date of the ramp.Data type: String\n\n</td></tr><tr><td>\n\ndataObject.\\_commitObjectInfo.status\n\n</td><td>\n\nStatus of the commit operation performed on the particular entity. Possible values:\n\n-   success: The entity commit operation was correct.\n-   if...not: The entity commit operation wasn't correct.\n\nData type: String\n\n</td></tr><tr><td>\n\ndataObject.\\_commitObjectInfo.sys\\_id\n\n</td><td>\n\nSys\\_id of the inserted record. The method returns this parameter only if the **dataObject.\\_glide\\_action** is `ENGAGE`. The updated table possibly change between entities. For example, Order \\[sn\\_ind\\_tmt\\_orm\\_order\\].Data type: String\n\n</td></tr><tr><td>\n\ndataObject.\\_glide\\_action\n\n</td><td>\n\nChange action that occurred on the line item. Possible values:\n\n-   REMOVE: Information was removed between the source and target JSON structures.\n-   ENGAGE: Information was added between the source and target JSON structures.\n-   NO\\_CHANGE: No change occurred between the source and target JSON structures.\n-   UPDATE: Information was modified between the source and target structures.\n\nData type: String\n\n</td></tr><tr><td>\n\ndataObject.\\_source\\_object\n\n</td><td>\n\nSource JSON object to which changes were applied. The object structure possibly change between entities.Data type: Object\n\n```\n\"_source_object\": {\n  \"sys_id\": \"String\", \n  \"table\": \"String” \n}\n```\n\n</td></tr><tr><td>\n\ndataObject.\\_source\\_object.sys\\_id\n\n</td><td>\n\nSys\\_id of the source entity record to which the \\_glide\\_action was applied. The updated table possibly change between entities. For example, Order \\[sn\\_ind\\_tmt\\_orm\\_order\\].Data type: String\n\n</td></tr><tr><td>\n\ndataObject.\\_source\\_object.table\n\n</td><td>\n\nName of the table that has the source entity record to which the \\_glide\\_action was applied. This possibly change between entities.Data type: String\n\n</td></tr><tr><td>\n\ndataObject.lineItems\n\n</td><td>\n\nLine item details of the entity record. For example, order line items or give line items.Data type: Array of Objects\n\n```\n\"lineItems\": [ \n{ \n  \"_action\": \"String\",\n  \"_commitObjectInfo\": {Object},\n  \"_glide_action\": \"String\",\n  \"_source_object\": {Object},\n  \"_state\": \"String\",\n  \"attributes\": {Object},\n  \"characteristics\": [Array],\n  \"lineItems\": [Array],\n  \"sys_id\": {Object},\n  \"table\": \"String\",\n}\n]\n```\n\n</td></tr><tr><td>\n\ndataObject.lineItems.\\_action\n\n</td><td>\n\nChange action applied to the line item of the source JSON. Possible values:\n\n-   add: Information was added to the source JSON.\n-   change: Information was updated in the source JSON.\n-   disconnect: Information was disconnected from the source JSON.\n-   nochange: No change occurred on the source JSON.\n\nData type: String\n\n</td></tr><tr><td>\n\ndataObject.lineItems.\\_commitObjectInfo\n\n</td><td>\n\nReturned if the line item change is an `ENGAGE` action. Has the object’s commit status and sys\\_id.Data type: Object\n\n```\n\"_commitObjectInfo\": { \n  \"status\": \"String\", \n  \"sys_id\": \"String\" \n}\n```\n\n</td></tr><tr><td>\n\ndataObject.lineItems.\\_commitObjectInfo.status\n\n</td><td>\n\nStatus of the commit operation performed on the particular entity. Possible values:\n\n-   success: The entity commit operation was correct.\n-   if...not: The entity commit operation wasn't correct.\n\nData type: String\n\n</td></tr><tr><td>\n\ndataObject.lineItems.\\_commitObjectInfo.sys\\_id\n\n</td><td>\n\nSys\\_id of the inserted record. The updated table possibly change between entities. For example, Order \\[sn\\_ind\\_tmt\\_orm\\_order\\].Data type: String\n\n</td></tr><tr><td>\n\ndataObject.lineItems.\\_glide\\_action\n\n</td><td>\n\nChange action that occurred on the line item.Possible values:\n\n-   DELETE: Information was removed between the source and target JSON structures.\n-   INSERT: Information was added between the source and target JSON structures.\n-   NO\\_CHANGE: No change occurred between the source and target JSON structures.\n-   UPDATE: Information was modified between the source and JSON structures.\n\nData type: String\n\n</td></tr><tr><td>\n\ndataObject.lineItems.\\_source\\_object\n\n</td><td>\n\nSource entity record details to which the \\_glide\\_action was applied. This object may vary between entities.Data type: Object\n\n```\n\"_source_object\": { \n  \"sys_id\": \"String\",\n  \"table\": \"String\" \n}\n```\n\n</td></tr><tr><td>\n\ndataObject.lineItems.\\_source\\_object.sys\\_id\n\n</td><td>\n\nSys\\_id of the source entity record to which the \\_glide\\_action was applied. Data type: String\n\n</td></tr><tr><td>\n\ndataObject.lineItems.\\_source\\_object.table\n\n</td><td>\n\nTable name of the source entity record to which the \\_glide\\_action was applied.Data type: String\n\n</td></tr><tr><td>\n\ndataObject.lineItems.\\_state\n\n</td><td>\n\nCondition of the object.Possible values:\n\n-   active: The entity object is in an active condition.\n-   inactive: The entity object isn't in an active condition.\n\nData type: String\n\n</td></tr><tr><td>\n\ndataObject.lineItems.attributes\n\n</td><td>\n\nAttributes of the line item. For example, the attribute's name and value. May contain varying fields based on the entity.Data type: Object\n\n```\n\"attributes\": { \n  \"<attribute_name>\": {Object}\n}\n```\n\n</td></tr><tr><td>\n\ndataObject.lineItems.attributes.&lt;attribute\\_name&gt;\n\n</td><td>\n\nName of the line item attribute. For example, the name of an account or contact. May contain varying fields of the entity.Data type: Object\n\n```\n\"attributes\": { \n \"<attribute_name>\": { \n   \"value\": \"String\"\n }\n}\n```\n\n</td></tr><tr><td>\n\ndataObject.lineItems.attributes.&lt;attribute\\_name&gt;.value\n\n</td><td>\n\nValue of the line item attribute. Data type: String\n\n</td></tr><tr><td>\n\ndataObject.lineItems.characteristics\n\n</td><td>\n\nList of characteristics associated with the line item. Characteristics may vary between entities.Data type: Array of Objects\n\n```\n\"characteristics\": [  \n {\n  \"_glide_action: \"String\",\n  \"attributes\": {Object},\n  \"sys_id\": {Object},  \n  \"table\": \"String\"\n }  \n]\n```\n\n</td></tr><tr><td>\n\ndataObject.lineItems.characteristics.\\_glide\\_action\n\n</td><td>\n\nChange action that occurred on the line item.Possible values:\n\n-   DELETE: Information was removed between the source and target JSON structures.\n-   INSERT: Information was added between the source and target JSON structures.\n-   NO\\_CHANGE: No change occurred between the source and target JSON structures.\n-   UPDATE: Information was modified between the source and JSON structures.\n\nData type: String\n\n</td></tr><tr><td>\n\ndataObject.lineItems.characteristics.attributes\n\n</td><td>\n\nOne or more objects that contain information about attributes associated with the characteristic record.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.\n\nData type: Object\n\n```\n\"attributes\": {\n  \"<attribute_type>\": {Object}\n}\n```\n\n</td></tr><tr><td>\n\ndataObject.lineItems.characteristics.attributes.&lt;attribute\\_type&gt;\n\n</td><td>\n\nName of the quality attribute. Possibly contain varying fields of the entity.Data type: Object\n\n```\n\"<attributes_type>\": { \n \"<attribute_name>\": {Object}\n}\n```\n\n</td></tr><tr><td>\n\ndataObject.lineItems.characteristics.attributes.&lt;attribute\\_type&gt;.&lt;attribute\\_name&gt;\n\n</td><td>\n\nName of the quality attribute.Data type: Object\n\n```\n\"<attribute_name>\": { \n \"value\": \"String\"\n}\n```\n\n</td></tr><tr><td>\n\ndataObject.lineItems.characteristics.attributes.&lt;attribute\\_type&gt;.&lt;attribute\\_name&gt;.value\n\n</td><td>\n\nValue of the line item attribute.Data type: String\n\n</td></tr><tr><td>\n\ndataObject.lineItems\\[0\\].characteristics.sys\\_id\n\n</td><td>\n\nSys\\_id of the associated characteristic record.Data type: Object\n\n```\n\"sys_id\": { \n  \"value\": \"String\" \n }\n```\n\n</td></tr><tr><td>\n\ndataObject.lineItems\\[0\\].characteristics.sys\\_id.value\n\n</td><td>\n\nSys\\_id of the associated characteristic record. The updated table may vary between entities. For example, Order \\[sn\\_ind\\_tmt\\_orm\\_order\\].Data type: String\n\n</td></tr><tr><td>\n\ndataObject.lineItems\\[0\\].characteristics.table\n\n</td><td>\n\nName of the table containing the characteristic record.Data type: String\n\n</td></tr><tr><td>\n\ndataObject.lineItems\\[0\\].lineItems\n\n</td><td>\n\nChild line items of a parent line item. This object has the same format as the **lineItems** parameter.Data type: Array of Objects\n\n```\n\"lineItems\": [  \n {  \n  \"_glide_action\": \"String\",\n  \"attributes\": {Object},\n  \"characteristics\": [Array],\n  \"lineItems\": [Array],\n  \"sys_id\": {Object},\n  \"table\": \"String\"\n } \n]\n```\n\n</td></tr><tr><td>\n\ndataObject.lineItems\\[0\\].sys\\_id\n\n</td><td>\n\nSys\\_id of the associated item record.Data type: Object\n\n```\n\"sys_id\": {\n  \"value\": \"String\"\n}\n```\n\n</td></tr><tr><td>\n\ndataObject.lineItems\\[0\\].sys\\_id.value\n\n</td><td>\n\nSys\\_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\n\n</td></tr><tr><td>\n\ndataObject.lineItems\\[0\\].table\n\n</td><td>\n\nName of the table that contains the item record associated with the lead to cash entity. Data type: String\n\n</td></tr><tr><td>\n\ndataObject.sys\\_id\n\n</td><td>\n\nSys\\_id of the associated line item record. The updated table possibly change between entities. For example, Order \\[sn\\_ind\\_tmt\\_orm\\_order\\]. Data type: String\n\n</td></tr><tr><td>\n\ndataObject.table\n\n</td><td>\n\nName of the table that has the record of the lead to cash entity.Data type: String\n\n</td></tr><tr><td>\n\ndisplayMessage\n\n</td><td>\n\nMessage that is displayed to the user in the UI. The display message is identical to the **message** string value.Data type: String\n\n</td></tr><tr><td>\n\nerror\n\n</td><td>\n\nError message that describes the if...not of the commitInstance method. If the request is correct, this parameter returns an empty string.Data type: String\n\n</td></tr><tr><td>\n\nheaderID\n\n</td><td>\n\nRequired only for entities with a header. 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 material, order, etc.\n\nData type: String\n\n</td></tr><tr><td>\n\nmessage\n\n</td><td>\n\nMessage describing the success, error, or partially\\_success scenarios. This message is the same as the **displayMessage** string value and can be used by other apply calls to the API.Data type: String\n\n</td></tr><tr><td>\n\nrootLineIDs\n\n</td><td>\n\nRequired only for no-header entities. 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 material, order, etc.\n\nData type: Array of Strings\n\n</td></tr><tr><td>\n\nstatus\n\n</td><td>\n\nStatus message confirming the success of the commit. Possible values:\n\n-   success: The commit was correct.\n-   if...not: The root line or header glide operation unserviceable. Retrigger the LeadtoCashCore API flow.\n-   partial\\_success: There were failures while processing the entire JSON. Refer to processing logs to troubleshooting specific errors.\n\nData type: String\n\n</td></tr></tbody>\n</table>The follow 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.\n\n```\n//Utility to invoke commitInstance API \nvar util = new sn_l2c_core.PrimitiveUtil();  \n \n//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. \nvar service = util.getPrimitivesEPService('sp_order_macd'); \n \n//Invoke commitInstance API with the required params\nvar effectOutput = service.effect(sourceInstance);\n \n//Print the returned JSON \ngs.info(\"commitOutput: \"+JSON.stringify(commitOutput));  \n\n```\n\nOutput:\n\n```\n{\n  \"status\": \"success\",\n  \"error\": \"\",\n  \"message\": \"Commit operation successfully processed.\",\n  \"displayMessage\": \"Commit operation successfully processed.\",\n  \"dataObject\": {\n    \"sys_id\": \"-1\",\n    \"table\": \"sn_ind_tmt_orm_order\",\n    \"_glide_action\": \"INSERT\",\n    \"_source_object\": {},\n    \"lineItems\": [\n      {\n        \"sys_id\": \"-1\",\n        \"table\": \"sn_ind_tmt_orm_order_line_item\",\n        \"attributes\": {\n          \"account\": {\n            \"value\": \"86837a386f0331003b3c498f5d3ee4ca\"\n          },\n          \"sold_product\": {\n            \"value\": \"e4bbf902b7343300ece839a6ee11a937\"\n          },\n          \"short_description\": {\n            \"value\": \"Network Monitoring\"\n          }\n        },\n        \"_glide_action\": \"INSERT\",\n        \"_source_object\": {\n          \"sys_id\": \"e4bbf902b7343300ece839a6ee11a937\",\n          \"table\": \"sn_install_base_sold_product\"\n        },\n        \"lineItems\": [\n          {\n            \"sys_id\": \"-1\",\n            \"table\": \"sn_ind_tmt_orm_order_line_item\",\n            \"attributes\": {\n              \"account\": {\n                \"value\": \"86837a386f0331003b3c498f5d3ee4ca\"\n              },\n              \"sold_product\": {\n                \"value\": \"23dbbd02b7343300ece839a6ee11a98e\"\n              },\n              \"short_description\": {\n                \"value\": \"Remote Monitoring\"\n              }\n            },\n            \"_glide_action\": \"INSERT\",\n            \"_source_object\": {\n              \"sys_id\": \"23dbbd02b7343300ece839a6ee11a98e\",\n              \"table\": \"sn_install_base_sold_product\"\n            },\n            \"lineItems\": [],\n            \"characteristics\": [],\n            \"coveredProducts\": [],\n            \"_commitObjectInfo\": {\n              \"sys_id\": \"d2d5b868488d5610f877a23d5db8922f\",\n              \"status\": \"success\"\n            }\n          }\n        ],\n        \"characteristics\": [],\n        \"coveredProducts\": [],\n        \"_commitObjectInfo\": {\n          \"sys_id\": \"92d5b868488d5610f877a23d5db89229\",\n          \"status\": \"success\"\n        }\n      }\n    ],\n    \"_commitObjectInfo\": {\n      \"sys_id\": \"46d5b0a4488d5610f877a23d5db892ef\",\n      \"status\": \"success\"\n    }\n  },\n  \"headerID\": \"46d5b0a4488d5610f877a23d5db892ef\",\n  \"rootLineIDs\": [\n    \"92d5b868488d5610f877a23d5db89229\"\n  ]\n}\n```\n\nThe following script demonstrates how to retrieve headerless ramps using **fetchRecordSysIds**. In this scenario, you have one Sold Material, it’s headerless, and you want the JSON to include ramp data by passing the ramp sys\\_id through `fetchRecordSysIds`. We want the ouput to back both sold material \\(lineItems\\) and ramp records \\(ramp\\).\n\n**Note:** For no-header entities, ramps are returned ONLY when ramp sys\\_ids are provided through fetchRecordSysIds.\n\n```\n\nvar util = new sn_l2c_core.PrimitiveUtil();\n\n// Extension point for SP → Order flow (example from uptake doc)\nvar service = util.getPrimitivesEPService('sn_l2c_cust_flows_sp_to_order');\n\n// Parent Sold Product sys_id\nvar spID = 'aedfb2';\n\n// Ramp sys_id that should be included in output\nvar rampID = '8565f'; \n\n// NEW: additionalParams.fetchRecordSysIds (selective record fetch)\nvar additionalParams = {\n  \"fetchRecordSysIds\": [{\n    \"sn_install_base_sold_product\": spID,\n    \"sn_install_base_sold_product_ramp\": rampID\n  }]\n};\n\n// createInstance: headerId = null for no-header entities\nvar sourceInstance = service.createInstance(null, spID, false, additionalParams);\ngs.info(\"createInstance output: \" + JSON.stringify(sourceInstance));\n\n/*\n * Expected high-level output shape (no-header):\n * {\n *   \"ramp\": [ { \"sys_id\": \"...\", \"attributes\": {...} } ],\n *   \"lineItems\": [ { \"sys_id\": \"...\", \"attributes\": {...} } ]\n * }\n */ \n\n\n// ---- Typical next steps in Primitives flow (delta/effect/commit) ----\n// In a real flow you usually have a target instance too.\n// For illustration we reuse the same structure as a placeholder.\nvar targetInstance = sourceInstance;\n\n// Compute changes -> effect -> commit\nvar effectOutput = service.effect(sourceInstance);\nvar commitOutput = service.commitInstance(effectOutput);\n\ngs.info(\"commitInstance output: \" + JSON.stringify(commitOutput));\n\n/*\n * In no-header scenarios, commitInstance returns dataObject that groups\n * root entity types (ex: lineItems, ramp) instead of a single root.\n */\n```\n\nThe follow example script demonstrates how to use **multiSelectMerge**\\(through the createInstance\\(\\) method\\) to merge all ramps entities together, related, into a flat structure for no-header scenarios. In this scenario, you have many Sold Products, want to treat them as one combined payload in MACD-style operations, and want all line items merged plus all ramps merged into a flat structure.\n\n**Note:** multiSelectMerge is only for no-header scenarios.\n\n```\n/***************************************************************\n * Goal: createInstance returns a flat structure:\n *   - lineItems: [ ...all selected SPs... ]\n *   - ramp:     [ ...all ramps... ]\n */\n\nvar util = new sn_l2c_core.PrimitiveUtil();\nvar service = util.getPrimitivesEPService('sn_l2c_cust_flows_sp_to_order');  \n\n// Multiple SPs selected\nvar spIDs = 'aedfb2,28490592';  \n\n// Selective ramp sys_id(s) to include (merged output)\nvar rampID = '5b8c9d9';  \n\nvar additionalParams = {\n  \"multiSelectMerge\": true,\n  \"fetchRecordSysIds\": [{\n    \"sn_install_base_sold_product_ramp\": rampID\n  }]\n};  \n\nvar mergedInstance = service.createInstance(null, spIDs, false, additionalParams);\ngs.info(\"Merged createInstance output: \" + JSON.stringify(mergedInstance));\n\n/*\n * Expected high-level output shape for merge:\n * {\n *   \"ramp\":     [ { ... }, { ... } ],\n *   \"lineItems\":[ { ... }, { ... } ]\n * }\n */  \n\n\n// Optional: Commit example (same pattern)\nvar effectOutput = service.effect(mergedInstance);\nvar commitOutput = service.commitInstance(effectOutput);\ngs.info(\"commitInstance output: \" + JSON.stringify(commitOutput));\n```\n\n### Using returnDeletedGr\n\nThe following example deletes a line item and triggers `_postProcess` and `_postHierarchyCommit` on the deleted GlideRecord by setting **returnDeletedGr** to `true`.\n\n```\nvar util = new sn_l2c_core.PrimitiveUtil();\nvar service = util.getPrimitivesEPService('test_l2c_order_order');\n\nvar jsonObj = {\n    \"sys_id\": \"076d6729ffa012104790ffffffffff54\",\n    \"table\": \"sn_ind_tmt_orm_order\",\n    \"_glide_action\": \"NO_CHANGE\",\n    \"lineItems\": [\n        {\n            \"sys_id\": \"3a8d6b29ffa012104790ffffffffff5c\",\n            \"table\": \"sn_ind_tmt_orm_order_line_item\",\n            \"_glide_action\": \"DELETE\"\n        }\n    ]\n};\n\nvar additionalParams = { returnDeletedGr: true };\nvar response = service.commitInstance(jsonObj, additionalParams);\n```\n\n"}}