{"revision":"c10276e953456835cdbb1f3a60d58ae1980be353","document":{"id":826,"path":"api-reference/server-api-reference/IBQConfigBaseAPIBoth.md","title":"IBQConfigBase API - Scoped","bundle":null,"doc_type":null,"release":"australia","body":"\n# IBQConfigBase API - Scoped\n\nScript include that must be extended for Sales Customer Relationship Management Request Tracker to track the requests. This script include provides overridable methods that define how requests should be executed.\n\nThe Sales and Service API Core \\(com.sn\\_tmt\\_core\\) plugin must be activated for IBQConfigBase script include to be available in an instance. This script include belongs to the `sn_tmt_core` namespace and requires the admin role.\n\nSee also:\n\n-   [Lead to Cash Core](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/order-management/lead-to-cash.md)\n-   [Inbound Request](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/order-management/som_request_tracker.md)\n\n## Extending the IBQConfigBase API\n\nDefine a script include with the overridable methods of the IBQConfigBase API.\n\n1.  Create a script include. The name must start with `IBQConfig`, for example, IBQConfigQuoteToOrderFlowSNC.\n2.  Extend the IBQConfigBase API.\n\n    For example:\n\n    ```\n    IBQConfigQuoteToOrderFlowSNC.prototype = Object.extendsObject(sn_tmt_core.IBQConfigBase, { \n    ...\n    });\n    ```\n\n3.  Override any necessary methods provided by the IBQConfigBase API.\n\n    For example:\n\n    ```\n    getRunMode: function(inboundQueueParams) {\n        return this.quoteUtil.getQuoteSize(inboundQueueParams.source_record_ids, this.threshold);\n    },\n    \n    generateParentRecord: function(inboundQueueParams, additionalParams, context) {\n        var result = \"\";\n        var entityMappingGr = this.getMapingConfigIdFromSysId(inboundQueueParams.requested_flow);\n        var sourceToTargetConfigID = entityMappingGr.getValue(\"mapping_config_id\");\n        var sourceHeaderId = inboundQueueParams.source_record_ids;\n        if (gs.nil(inboundQueueParams.requested_flow))\n            throw \"sourceToTargetConfigID cannot be null\";\n        if (gs.nil(inboundQueueParams.source_record_ids))\n            throw \"source record id cannot be null\";\n        var util = new sn_l2c_core.PrimitiveUtil();\n        if (gs.nil(additionalParams))\n            additionalParams = {};\n        additionalParams[this.SKIP_LINES_KEY] = \"true\";\n    },\n    \n    processInboundQueueRequest: function(inboundQueueGR) {\n        gs.info(\"processRequest inboundQueueGR \" + JSON.stringify(inboundQueueGR));\n        var result = this.quoteUtil.createOrderFromQuoteUsingMetadata(inboundQueueGR.getValue('source_record_ids'), 'sn_l2c_quote_to_order', null, null, inboundQueueGR.getValue('record_id'));\n        return result;\n    }\n    ```\n\n4.  Create a new metadata entry in Inbound Request Configuration \\[sn\\_tmt\\_core\\_inbound\\_queue\\_config\\] table to define how a request should be processed.\n5.  Link the script include created to the **configuration\\_api** field of metadata record to use the custom logic defined while processing the request. The script include is referenced in the **configuration\\_api** field while creating Inbound Request Configuration metadata.\n\n## Use case: IBQConfigQuoteToOrderFlow\n\nYou can use the IBQConfigBase API to create an order from a quote using inbound request configuration metadata. IBQConfigQuoteToOrderFlow is a custom script include that can be created by extending the IBQConfigBase API. The logic for the overridable methods must be added in the IBQConfigQuoteToOrderFlow script include.\n\n**Note:** This script include extends the IBQConfigBase API and is used in the method examples. For information on using the PrimitiveUtil API, refer to [LeadtoCashCore - Scoped](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/LeadToCashCoreAPI.md).\n\n```\nvar IBQConfigQuoteToOrderFlowSNC = Class.create();\nIBQConfigQuoteToOrderFlowSNC.prototype = Object.extendsObject(sn_tmt_core.IBQConfigBase, {\n\n    initialize: function() {\n\t\tthis.quoteUtil = new sn_quote_mgmt.OrderIntegration();\n        this.SKIP_LINES_KEY = \"skipLines\";\n\t\tthis.threshold = 15;\n    },\n\n    getRunMode: function(inboundQueueParams) {\n        return this.quoteUtil.getQuoteSize(inboundQueueParams.source_record_ids, this.threshold);\n    },\n\n\n    generateParentRecord: function(inboundQueueParams, additionalParams, context) {\n        var result = \"\";\n        var entityMappingGr = this.getMapingConfigIdFromSysId(inboundQueueParams.requested_flow);\n        var sourceToTargetConfigID = entityMappingGr.getValue(\"mapping_config_id\");\n        var sourceHeaderId = inboundQueueParams.source_record_ids;\n        if (gs.nil(inboundQueueParams.requested_flow))\n            throw \"sourceToTargetConfigID cannot be null\";\n        if (gs.nil(inboundQueueParams.source_record_ids))\n            throw \"source record id cannot be null\";\n        var util = new sn_l2c_core.PrimitiveUtil();\n        if (gs.nil(additionalParams))\n            additionalParams = {};\n        additionalParams[this.SKIP_LINES_KEY] = \"true\";\n\n        // additional parameters are retrieved using the PrimitiveUtil() utility methods provided by the Lead to Cash Core application\n        var service = util.getPrimitivesEPService(sourceToTargetConfigID, context);\n        var isEmpty = false;\n        if (service) {\n            var createInstanceOutput = service.createInstance(sourceHeaderId, null, false, additionalParams);\n            if (gs.nil(sourceHeaderId))\n                isEmpty = this.__isEmpty(createInstanceOutput.lineItems);\n            else\n                isEmpty = this.__isEmpty(createInstanceOutput);\n            if (!isEmpty) {\n                var effectOutput = service.effect(createInstanceOutput, null, additionalParams);\n                if (!this.__isEmpty(effectOutput)) {\n                    var commitOutput = service.commitInstance(effectOutput, additionalParams);\n                    return commitOutput;\n                }\n            }\n        }\n        return result;\n    },\n\n    processInboundQueueRequest: function(inboundQueueGR) {\n        gs.info(\"processRequest inboundQueueGR \" + JSON.stringify(inboundQueueGR));\n        var result = this.quoteUtil.createOrderFromQuoteUsingMetadata(inboundQueueGR.getValue('source_record_ids'), 'sn_l2c_quote_to_order', null, null, inboundQueueGR.getValue('record_id'));\n        return result;\n    },\n\n    __isEmpty: function(sourceObj) {\n        if (gs.nil(sourceObj))\n            return true;\n        return Object.keys(sourceObj).length === 0;\n    },\n    getMapingConfigIdFromSysId(requestedFlow) {\n        var gr = new GlideRecord(\"sn_l2c_core_entity_mapping\");\n        gr.addQuery(\"sys_id\", requestedFlow);\n        gr.query();\n        if (gr.next()) {\n            gs.info(\"mapping id received to corresponding requestedFlow\");\n            return gr;\n        }\n    },\n\n    type: 'IBQConfigQuoteToOrderFlowSNC'\n});\n```\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## IBQConfigBase – generateParentRecord\\(Object ibqParams\\)\n\nCreates a parent record which gets added to the record\\_id of the Inbound Request \\[sn\\_tmt\\_core\\_inbound\\_queue\\_list\\] record before processing the request.\n\nHaving a parent record created before processing is ideal for asynchronous processing and allows you to add activities to your script include that can be performed while processing. For example, displaying a message on the screen.\n\n<table id=\"id_dpy_1kb_z2c\" 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\nibqParams\n\n</td><td>\n\nObject\n\n</td><td>\n\nJSON object containing the details of Inbound Request record to be created.```\n{\n  \"account\": \"String\",\n  \"consumer\": \"String\",\n  \"contact\": \"String\",\n  \"payload\": {Object},\n  \"record_id\": \"String\",\n  \"requested_flow\": \"String\",\n  \"source_record_ids\": [Array],\n  \"source_table\": \"String\",\n  \"table\": \"String\"\n}\n```\n\n</td></tr><tr id=\"ibqc-account\"><td>\n\naccount\n\n</td><td>\n\nString\n\n</td><td>\n\nOptional. Information about the account associated with the record.Table: Account \\[customer\\_account\\]\n\n</td></tr><tr id=\"ibqc-consumer\"><td>\n\nconsumer\n\n</td><td>\n\nString\n\n</td><td>\n\nOptional. Information about the consumer associated with the record.Table: Consumer \\[csm\\_consumer\\]\n\n</td></tr><tr id=\"ibqc-contact\"><td>\n\ncontact\n\n</td><td>\n\nString\n\n</td><td>\n\nOptional. Information about the contact associated with the record.Table: Contact \\[customer\\_contact\\]\n\n</td></tr><tr id=\"ibqc-payload\"><td>\n\npayload\n\n</td><td>\n\nObject\n\n</td><td>\n\nOptional. JSON object needed to process the request using the PrimitiveUtil\\(\\) API. For usage information, see [LeadToCashCore](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/LeadToCashCoreAPI.md).```\n\"payload\": {\n  \"additionalParams\": {Object},\n  \"context\": {Object},\n  \"inputParams\": {Object}\n  \"source\": [Array of Objects],\n  \"target\": [Array of Objects]\n}\n```\n\n</td></tr><tr id=\"ibqc-payload.additionalParams\"><td>\n\npayload.additionalParams\n\n</td><td>\n\nObject\n\n</td><td>\n\nOptional. Additional parameters to use.```\n\"additionalParams\": {\n  \"action\": \"String\",\n  \"actionReason\": \"String\"\n  \"endDate\": \"Date\",\n  \"skipLines\": \"Boolean\",\n  \"startDate\": \"Date\"\n}\n```\n\n</td></tr><tr id=\"ibqc-payload.additionalParams.action\"><td>\n\npayload.additionalParams.action\n\n</td><td>\n\nString\n\n</td><td>\n\nOptional. Specifies the type of declarative action being executed. For more information, see [Customer Life Cycle Management Workflows](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/customer-service-management/customer-life-cycle-management-workflows.md).Possible values:\n\n-   disconnect\n-   modify\n-   resume\n-   suspend\n\n</td></tr><tr id=\"ibqc-payload.additionalParams.actionReason\"><td>\n\npayload.additionalParams.actionReason\n\n</td><td>\n\nString\n\n</td><td>\n\nOptional. Property used in flows using declarative actions. Reason for the action.\n\n</td></tr><tr id=\"ibqc-payload.additionalParams.endDate\"><td>\n\npayload.additionalParams.endDate\n\n</td><td>\n\nString\n\n</td><td>\n\nOptional. End date required to execute flows using declarative actions.Format: yyyy-MM-dd HH:mm:ss\n\n</td></tr><tr id=\"ibqc-payload.additionalParams.skipLines\"><td>\n\npayload.additionalParams.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 id=\"ibqc-payload.additionalParams.startDate\"><td>\n\npayload.additionalParams.startDate\n\n</td><td>\n\nString\n\n</td><td>\n\nOptional. Start date to execute flows using declarative actions.Format: yyyy-MM-dd HH:mm:ss\n\n</td></tr><tr id=\"ibqc-payload.context\"><td>\n\npayload.context\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  \"isMultiSelect\": \"Boolean\",\n  \"sourceToTargetConfigID\": \"String\"\n}\n```\n\n</td></tr><tr id=\"ibqc-payload.context.isMultiselect\"><td>\n\npayload.context.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 passing multiple line items in a comma-separated list.\n-   false: Only one input item can be passed in the script.\n\nDefault: false\n\n</td></tr><tr id=\"ibqc-payload.context.sTTCID\"><td>\n\npayload.context.sourceToTargetConfigID\n\n</td><td>\n\nString\n\n</td><td>\n\nOptional. Mapping configuration ID for the source-to-target mapping.Table: Lead To Cash Entity Mapping \\[sn\\_l2c\\_core\\_entity\\_mapping\\]\n\n</td></tr><tr id=\"ibqc-payload.inputParams\"><td>\n\npayload.inputParams\n\n</td><td>\n\nObject\n\n</td><td>\n\nOptional. This object is a placeholder for any input parameters required to invoke the usage of a specific flow.```\n\"inputParams\": {}\n```\n\n</td></tr><tr id=\"ibqc-payload.source\"><td>\n\npayload.source\n\n</td><td>\n\nArray\n\n</td><td>\n\nOptional. JSON object containing details of the source entity to retrieve data from.```\n\"source\": [\n  {\n    \"headerId\": \"String\",\n    \"lineIds\": []\n  }\n]\n```\n\n</td></tr><tr id=\"ibqc-payload.headerId\"><td>\n\npayload.source.headerId\n\n</td><td>\n\nString\n\n</td><td>\n\nOptional. Header sys\\_id of source entity to retrieve data from.-   Required if you don't provide the **lineIds** parameter.\n-   Pass  null  if you aren't passing any header sys\\_ids.\n\n</td></tr><tr id=\"ibqc-payload.source.lineIds\"><td>\n\npayload.source.lineIds\n\n</td><td>\n\nArray\n\n</td><td>\n\nOptional. Array containing source line item sys\\_id\\(s\\) of an entity to retrieve entity data from.Required if you don't provide  the header ID, and if the entity structure starts with line items such as sold product.\n\n</td></tr><tr id=\"ibqc-payload.target\"><td>\n\npayload.target\n\n</td><td>\n\nArray\n\n</td><td>\n\nOptional. JSON object containing details of the target entity.```\n\"target\": [\n  {\n    \"headerId\": \"String\",\n    \"lineIds\": []\n  }\n]\n```\n\n</td></tr><tr id=\"ibqc-payload.target.headerId\"><td>\n\npayload.target.headerId\n\n</td><td>\n\nString\n\n</td><td>\n\nOptional. Header sys\\_id of target entity to retrieve data from. Required if you don't provide the **lineIds** parameter. Pass  null  if you aren't passing any header sys\\_ids.\n\n</td></tr><tr id=\"ibqc-payload.target.lineIds\"><td>\n\npayload.target.lineIds\n\n</td><td>\n\nArray\n\n</td><td>\n\nOptional. Array containing target line item sys\\_id\\(s\\) of an entity to retrieve entity data from. Required if you don't provide  header ID  and if the entity structure starts with line items such as sold product.\n\n</td></tr><tr id=\"ibqc-record\"><td>\n\nrecord\\_id\n\n</td><td>\n\nString\n\n</td><td>\n\nOptional. Sys\\_id of the target record if already present.\n\n</td></tr><tr id=\"ibqc-requested_flow\"><td>\n\nrequested\\_flow\n\n</td><td>\n\nString\n\n</td><td>\n\nOptional. Mapping configuration ID for source-to-target mapping. This property is required for flows using [Entity configuration and mapping](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/order-management/entity-configuration-and-mapping.md).Table: Lead To Cash Entity Mapping \\[sn\\_l2c\\_core\\_entity\\_mapping\\]\n\n</td></tr><tr id=\"ibqc-source_records_ids\"><td>\n\nsource\\_record\\_ids\n\n</td><td>\n\nArray\n\n</td><td>\n\nArray containing the sys\\_ids of the source records.\n\n</td></tr><tr id=\"ibqc-source_table\"><td>\n\nsource\\_table\n\n</td><td>\n\nString\n\n</td><td>\n\nName of the table that contains the source record of the flow.\n\n</td></tr><tr id=\"ibqc-table\"><td>\n\ntable\n\n</td><td>\n\nString\n\n</td><td>\n\nName of the table that contains the target record of the flow.\n\n</td></tr></tbody>\n</table><table id=\"table_qw2_3ct_y2c\" 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 object containing header ID of the target record created.```\n{\n \"headerID\": \"String\",\n // additional parameters, if any, per flow see payload.inputParams\n}\n```\n\n</td></tr><tr><td>\n\nheaderID\n\n</td><td>\n\nSys\\_id of the header of the target record created. This value is used to populate record\\_id field while creating the Inbound Request record.\n\n</td></tr></tbody>\n</table>The following example shows how to invoke the generateParentRecord\\(\\) method.\n\n**Note:** IBQConfigQuoteToOrderFlow is a custom script include that can be created by extending the IBQConfigBase API. The logic for the overridable methods must be added in the IBQConfigQuoteToOrderFlow script include.\n\n```\nvar ibqParams = {\n  \"source_record_ids\": \"f83e29574df02210f877142d1adc9531\",\n  \"requested_flow\": \"0feb6d9da36271105c24939ef31e61dc\",\n  \"initiated_by\": \"admin\",\n  \"source_table\": \"sn_quote_mgmt_core_quote\",\n  \"table\": \"sn_ind_tmt_orm_order\",\n  \"payload\": {}\n}; \n\nvar service = new sn_quote_mgmt.IBQConfigQuoteToOrderFlow(); \nvar parentRecord = service.generateParentRecord(ibqParams); \n\ngs.info(\"Parent record = \"+JSON.stringify(parentRecord));\n```\n\nOutput:\n\n```\nParent record = {\"headerID\":\"d11bd507dc6c6a10f877720033b5d0b9\", ...} \n```\n\n## IBQConfigBase – getRunMode\\(Object ibqParams\\)\n\nDetermines whether a flow should run in sync or async mode.\n\n<table id=\"id_dpy_1kb_z2c\" 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\nibqParams\n\n</td><td>\n\nObject\n\n</td><td>\n\nJSON object containing the details of Inbound Request record to be created.```\n{\n  \"account\": \"String\",\n  \"consumer\": \"String\",\n  \"contact\": \"String\",\n  \"payload\": {Object},\n  \"record_id\": \"String\",\n  \"requested_flow\": \"String\",\n  \"source_record_ids\": [Array],\n  \"source_table\": \"String\",\n  \"table\": \"String\"\n}\n```\n\n</td></tr><tr id=\"ibqc-account\"><td>\n\naccount\n\n</td><td>\n\nString\n\n</td><td>\n\nOptional. Information about the account associated with the record.Table: Account \\[customer\\_account\\]\n\n</td></tr><tr id=\"ibqc-consumer\"><td>\n\nconsumer\n\n</td><td>\n\nString\n\n</td><td>\n\nOptional. Information about the consumer associated with the record.Table: Consumer \\[csm\\_consumer\\]\n\n</td></tr><tr id=\"ibqc-contact\"><td>\n\ncontact\n\n</td><td>\n\nString\n\n</td><td>\n\nOptional. Information about the contact associated with the record.Table: Contact \\[customer\\_contact\\]\n\n</td></tr><tr id=\"ibqc-payload\"><td>\n\npayload\n\n</td><td>\n\nObject\n\n</td><td>\n\nOptional. JSON object needed to process the request using the PrimitiveUtil\\(\\) API. For usage information, see [LeadToCashCore](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/LeadToCashCoreAPI.md).```\n\"payload\": {\n  \"additionalParams\": {Object},\n  \"context\": {Object},\n  \"inputParams\": {Object}\n  \"source\": [Array of Objects],\n  \"target\": [Array of Objects]\n}\n```\n\n</td></tr><tr id=\"ibqc-payload.additionalParams\"><td>\n\npayload.additionalParams\n\n</td><td>\n\nObject\n\n</td><td>\n\nOptional. Additional parameters to use.```\n\"additionalParams\": {\n  \"action\": \"String\",\n  \"actionReason\": \"String\"\n  \"endDate\": \"Date\",\n  \"skipLines\": \"Boolean\",\n  \"startDate\": \"Date\"\n}\n```\n\n</td></tr><tr id=\"ibqc-payload.additionalParams.action\"><td>\n\npayload.additionalParams.action\n\n</td><td>\n\nString\n\n</td><td>\n\nOptional. Specifies the type of declarative action being executed. For more information, see [Customer Life Cycle Management Workflows](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/customer-service-management/customer-life-cycle-management-workflows.md).Possible values:\n\n-   disconnect\n-   modify\n-   resume\n-   suspend\n\n</td></tr><tr id=\"ibqc-payload.additionalParams.actionReason\"><td>\n\npayload.additionalParams.actionReason\n\n</td><td>\n\nString\n\n</td><td>\n\nOptional. Property used in flows using declarative actions. Reason for the action.\n\n</td></tr><tr id=\"ibqc-payload.additionalParams.endDate\"><td>\n\npayload.additionalParams.endDate\n\n</td><td>\n\nString\n\n</td><td>\n\nOptional. End date required to execute flows using declarative actions.Format: yyyy-MM-dd HH:mm:ss\n\n</td></tr><tr id=\"ibqc-payload.additionalParams.skipLines\"><td>\n\npayload.additionalParams.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 id=\"ibqc-payload.additionalParams.startDate\"><td>\n\npayload.additionalParams.startDate\n\n</td><td>\n\nString\n\n</td><td>\n\nOptional. Start date to execute flows using declarative actions.Format: yyyy-MM-dd HH:mm:ss\n\n</td></tr><tr id=\"ibqc-payload.context\"><td>\n\npayload.context\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  \"isMultiSelect\": \"Boolean\",\n  \"sourceToTargetConfigID\": \"String\"\n}\n```\n\n</td></tr><tr id=\"ibqc-payload.context.isMultiselect\"><td>\n\npayload.context.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 passing multiple line items in a comma-separated list.\n-   false: Only one input item can be passed in the script.\n\nDefault: false\n\n</td></tr><tr id=\"ibqc-payload.context.sTTCID\"><td>\n\npayload.context.sourceToTargetConfigID\n\n</td><td>\n\nString\n\n</td><td>\n\nOptional. Mapping configuration ID for the source-to-target mapping.Table: Lead To Cash Entity Mapping \\[sn\\_l2c\\_core\\_entity\\_mapping\\]\n\n</td></tr><tr id=\"ibqc-payload.inputParams\"><td>\n\npayload.inputParams\n\n</td><td>\n\nObject\n\n</td><td>\n\nOptional. This object is a placeholder for any input parameters required to invoke the usage of a specific flow.```\n\"inputParams\": {}\n```\n\n</td></tr><tr id=\"ibqc-payload.source\"><td>\n\npayload.source\n\n</td><td>\n\nArray\n\n</td><td>\n\nOptional. JSON object containing details of the source entity to retrieve data from.```\n\"source\": [\n  {\n    \"headerId\": \"String\",\n    \"lineIds\": []\n  }\n]\n```\n\n</td></tr><tr id=\"ibqc-payload.headerId\"><td>\n\npayload.source.headerId\n\n</td><td>\n\nString\n\n</td><td>\n\nOptional. Header sys\\_id of source entity to retrieve data from.-   Required if you don't provide the **lineIds** parameter.\n-   Pass  null  if you aren't passing any header sys\\_ids.\n\n</td></tr><tr id=\"ibqc-payload.source.lineIds\"><td>\n\npayload.source.lineIds\n\n</td><td>\n\nArray\n\n</td><td>\n\nOptional. Array containing source line item sys\\_id\\(s\\) of an entity to retrieve entity data from.Required if you don't provide  the header ID, and if the entity structure starts with line items such as sold product.\n\n</td></tr><tr id=\"ibqc-payload.target\"><td>\n\npayload.target\n\n</td><td>\n\nArray\n\n</td><td>\n\nOptional. JSON object containing details of the target entity.```\n\"target\": [\n  {\n    \"headerId\": \"String\",\n    \"lineIds\": []\n  }\n]\n```\n\n</td></tr><tr id=\"ibqc-payload.target.headerId\"><td>\n\npayload.target.headerId\n\n</td><td>\n\nString\n\n</td><td>\n\nOptional. Header sys\\_id of target entity to retrieve data from. Required if you don't provide the **lineIds** parameter. Pass  null  if you aren't passing any header sys\\_ids.\n\n</td></tr><tr id=\"ibqc-payload.target.lineIds\"><td>\n\npayload.target.lineIds\n\n</td><td>\n\nArray\n\n</td><td>\n\nOptional. Array containing target line item sys\\_id\\(s\\) of an entity to retrieve entity data from. Required if you don't provide  header ID  and if the entity structure starts with line items such as sold product.\n\n</td></tr><tr id=\"ibqc-record\"><td>\n\nrecord\\_id\n\n</td><td>\n\nString\n\n</td><td>\n\nOptional. Sys\\_id of the target record if already present.\n\n</td></tr><tr id=\"ibqc-requested_flow\"><td>\n\nrequested\\_flow\n\n</td><td>\n\nString\n\n</td><td>\n\nOptional. Mapping configuration ID for source-to-target mapping. This property is required for flows using [Entity configuration and mapping](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/order-management/entity-configuration-and-mapping.md).Table: Lead To Cash Entity Mapping \\[sn\\_l2c\\_core\\_entity\\_mapping\\]\n\n</td></tr><tr id=\"ibqc-source_records_ids\"><td>\n\nsource\\_record\\_ids\n\n</td><td>\n\nArray\n\n</td><td>\n\nArray containing the sys\\_ids of the source records.\n\n</td></tr><tr id=\"ibqc-source_table\"><td>\n\nsource\\_table\n\n</td><td>\n\nString\n\n</td><td>\n\nName of the table that contains the source record of the flow.\n\n</td></tr><tr id=\"ibqc-table\"><td>\n\ntable\n\n</td><td>\n\nString\n\n</td><td>\n\nName of the table that contains the target record of the flow.\n\n</td></tr></tbody>\n</table><table id=\"table_qw2_3ct_y2c\" class=\"returns\"><thead><tr><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nString\n\n</td><td>\n\nInformation about the run mode to be used to execute the request.Possible values:\n\n-   async\n-   sync\n\n</td></tr></tbody>\n</table>The following example shows how to invoke the getRunMode\\(\\) method using the source sys\\_id provided by the source\\_record\\_ids property. If the line items count is greater than 10, then **runMode** is `async`.\n\n**Note:** IBQConfigQuoteToOrderFlow is a custom script include that can be created by extending the IBQConfigBase API. The logic for the overridable methods must be added in the IBQConfigQuoteToOrderFlow script include.\n\n```\nvar ibqParams = {\n  \"source_record_ids\": \"04ba9004f11f3110f8777d7194f166f6\",\n  \"requested_flow\": \"0feb6d9da36271105c24939ef31e61dc\",\n  \"initiated_by\": \"admin\",\n  \"source_table\": \"sn_quote_mgmt_core_quote\",\n  \"table\": \"sn_ind_tmt_orm_order\",\n  \"payload\": {}\n};\n\nvar service = new sn_quote_mgmt.IBQConfigQouteToOrderFlow();\n\nvar runMode = service.getRunMode(ibqParams);\n\ngs.info(\"RunMode = \"+JSON.stringify(runMode));\n```\n\nOutput:\n\n```\nRunMode = \"async\"\n```\n\nThe following example shows how to invoke getRunMode\\(\\) method. It uses the source sys\\_id provided in source\\_record\\_ids. Here the line items count is fewer than 10, so the **runMode** is sync.\n\n**Note:** IBQConfigQuoteToOrderFlow is a custom script include that can be created by extending the IBQConfigBase API. The logic for the overridable methods must be added in the IBQConfigQuoteToOrderFlow script include.\n\n```\nvar ibqParams = {\n  \"source_record_ids\": \"0b0f5cc8f11f3110f8777d7194f16610\",\n  \"requested_flow\": \"0feb6d9da36271105c24939ef31e61dc\",\n  \"initiated_by\": \"admin\",\n  \"source_table\": \"sn_quote_mgmt_core_quote\",\n  \"table\": \"sn_ind_tmt_orm_order\",\n  \"payload\": {}\n};\n\nvar service = new sn_quote_mgmt.IBQConfigQouteToOrderFlow();\n\nvar runMode = service.getRunMode(ibqParams);\n\ngs.info(\"RunMode = \"+JSON.stringify(runMode));\n```\n\nOutput:\n\n```\nRunMode = \"sync\"\n```\n\n## IBQConfigBase – processInboundQueueRequest\\(GlideRecord ibqGr\\)\n\nDefines the logic for processing an inbound request record.\n\n<table id=\"table_pw2_3ct_y2c\" 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\nibqGr\n\n</td><td>\n\nGlideRecord\n\n</td><td>\n\n[GlideRecord](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/c_GlideRecordScopedAPI.md) reference to the Inbound Request record that has triggered the flow.Table: Inbound Request \\[sn\\_tmt\\_core\\_inbound\\_queue\\] \n\n</td></tr></tbody>\n</table><table id=\"table_qw2_3ct_y2c\" class=\"returns\"><thead><tr><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nObject\n\n</td><td>\n\nA JSON object containing the processing details of the Inbound Request record.```\n{\n  \"error\": \"String\",\n  \"response\": {Object},\n  \"status\": \"String\",\n  \"target\": \"String\"\n}\n```\n\n</td></tr><tr><td>\n\nerror\n\n</td><td>\n\nValue indicating the error encountered while processing the request.Data type: String\n\n</td></tr><tr><td>\n\nresponse\n\n</td><td>\n\nA JSON object containing the response of processing the Inbound Request record. For flows created by the Lead to Cash Core PrimitiveUtil API, this output can be provided using the [commitInstance\\(\\)](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/LeadToCashCoreAPI.md) method.Data type: Object\n\n</td></tr><tr><td>\n\nstatus\n\n</td><td>\n\nValue indicating the status of the request processing.Possible values:\n\n-   failure – The operation has failed.\n-   partial\\_success – There were few failures while processing the JSON object. Refer to processing logs in the Log \\[syslog\\] table to troubleshoot specific errors. \n-   success – The operation was successful.\n\nData type: String\n\n</td></tr><tr><td>\n\ntarget\n\n</td><td>\n\nOptional. Sys\\_id of the target record to be used for further processing, such as UI acknowledgment. The target can either be created during the flow or can be passed as input to the **ibqParams** of the generateParentRecord\\(\\) method depending on the requirement.Data type: String\n\n</td></tr></tbody>\n</table>The following example shows how to invoke processInboundQueueRequest\\(\\) method.\n\n**Note:** This method is called during the flow using [Flow Designer](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/application-development/flow-designer.md). In the following example, the Lead to Cash Core PrimitiveUtil [commitInstance\\(\\)](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/LeadToCashCoreAPI.md) method is used to provide the output.\n\n```\nvar gr = new GlideRecord('sn_tmt_core_inbound_queue');\ngr.get('c48ea9974df02210f877142d1adc951a');\n\nvar service = new sn_quote_mgmt.IBQConfigQuoteToOrderFlow();\nvar processRequest = service.processInboundQueueRequest(gr);\n\ngs.info(\"processRequest = \"+JSON.stringify(processRequest));\n```\n\nOutput:\n\n```\nprocessRequest = {\n  \"response\": {\n    \"status\": \"success\",\n    \"error\": \"\",\n    \"message\": \"Commit operation successfully processed.\",\n    \"displayMessage\": \"Commit operation successfully processed.\",\n    \"dataObject\": {\n      \"sys_id\": \"a6f4568bdce0aa10f877720033b5d069\",\n      \"table\": \"sn_ind_tmt_orm_order\",\n      \"attributes\": {\n        \"account\": {\n          \"value\": \"9e2fd2ee11b43110f877366201dea674\"\n        },\n        \"quote\": {\n          \"value\": \"c8841a4bdce0aa10f877720033b5d0f8\"\n        }\n      },\n      \"_glide_action\": \"UPDATE\",\n      \"_source_object\": {\n        \"sys_id\": \"c8841a4bdce0aa10f877720033b5d0f8\",\n        \"table\": \"sn_quote_mgmt_core_quote\"\n      },\n      \"lineItems\": [\n        {\n          \"sys_id\": \"-1\",\n          \"table\": \"sn_ind_tmt_orm_order_line_item\",\n          \"attributes\": {\n            \"short_description\": {\n              \"value\": \"Home Automation Bundle\"\n            },\n            \"account\": {\n              \"value\": \"9e2fd2ee11b43110f877366201dea674\"\n            }\n          },\n          \"_glide_action\": \"INSERT\",\n          \"_source_object\": {\n            \"sys_id\": \"afc4528bdce0aa10f877720033b5d0d0\",\n            \"table\": \"sn_quote_mgmt_core_quote_line_item\"\n          },\n          \"characteristics\": [],\n          \"lineItems\": [\n            {\n              \"sys_id\": \"-1\",\n              \"table\": \"sn_ind_tmt_orm_order_line_item\",\n              \"attributes\": {\n                \"short_description\": {\n                  \"value\": \"Door Sensor\"\n                },\n                \"account\": {\n                  \"value\": \"9e2fd2ee11b43110f877366201dea674\"\n                }\n              },\n              \"_glide_action\": \"INSERT\",\n              \"_source_object\": {\n                \"sys_id\": \"77c4528bdce0aa10f877720033b5d0d5\",\n                \"table\": \"sn_quote_mgmt_core_quote_line_item\"\n              },\n              \"characteristics\": [],\n              \"lineItems\": [],\n              \"pricingAdjustments\": [\n                {\n                  \"sys_id\": \"-1\",\n                  \"table\": \"sn_ind_tmt_orm_pricing_adjustment\",\n                  \"attributes\": {\n                    \"name\": {\n                      \"value\": \"door sensor bundle discount\"\n                    }\n                  },\n                  \"_glide_action\": \"INSERT\",\n                  \"_source_object\": {\n                    \"sys_id\": \"f3c4928bdce0aa10f877720033b5d02f\",\n                    \"table\": \"sn_quote_mgmt_core_pricing_adjustment\"\n                  },\n                  \"_commitObjectInfo\": {\n                    \"sys_id\": \"e6955acbdce0aa10f877720033b5d082\",\n                    \"status\": \"success\"\n                  }\n                }\n              ],\n              \"coveredProducts\": [],\n              \"attributeAdjustment\": [],\n              \"_commitObjectInfo\": {\n                \"sys_id\": \"26955acbdce0aa10f877720033b5d07d\",\n                \"status\": \"success\"\n              }\n            }\n          ],\n          \"pricingAdjustments\": [],\n          \"coveredProducts\": [],\n          \"attributeAdjustment\": [],\n          \"_commitObjectInfo\": {\n            \"sys_id\": \"22955acbdce0aa10f877720033b5d078\",\n            \"status\": \"success\"\n          }\n        }\n      ],\n      \"_commitObjectInfo\": {\n        \"status\": \"success\"\n      }\n    },\n    \"headerID\": \"a6f4568bdce0aa10f877720033b5d069\",\n    \"rootLineIDs\": [\n      \"22955acbdce0aa10f877720033b5d078\"\n    ]\n  },\n  \"status\": \"success\",\n  \"error\": \"\",\n  \"target\": \"a6f4568bdce0aa10f877720033b5d069\"\n}\n```\n\n## IBQConfigBase – setExecuteAfterRequest\\(Object ibqParams\\)\n\nSets the `execute_after` value and updates `state` to Pending on the current inbound request record to configure the order in which records are processed in the Inbound Request table.\n\nThe setExecuteAfterRequest\\(\\) method can be overridden to derive the **execute\\_after** value from other parameters. By default, this method queries the Inbound Request \\[sn\\_tmt\\_core\\_inbound\\_queue\\] table to find the latest record with matching **source\\_record\\_ids**, **record\\_id**, and **resource** values. This method then updates the current record's `execute_after` field with the queried record's sys\\_id, marking the current record to be processed after the queried record. As a result, setExecuteAfterRequest\\(\\) establishes the order in which records are processed.\n\n<table id=\"table_hbf_vqr_tfc\" 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\nibqParams\n\n</td><td>\n\nObject\n\n</td><td>\n\nJSON object containing the details of Inbound Request records to set. These parameters include the record sys\\_id to process before the current record, and the workflow name to filter by in the Inbound Request \\[sn\\_tmt\\_core\\_inbound\\_queue\\] table.```\n{\n  \"account\": \"String\",\n  \"consumer\": \"String\",\n  \"contact\": \"String\",\n  \"execute_after\": \"String\",\n  \"payload\": {Object},\n  \"record_id\": \"String\",\n  \"requested_flow\": \"String\",\n  \"resource\": \"String\",\n  \"source_record_ids\": [Array],\n  \"source_table\": \"String\",\n  \"table\": \"String\"\n}\n```\n\n</td></tr><tr><td>\n\naccount\n\n</td><td>\n\nString\n\n</td><td>\n\nOptional. Information about the account associated with the record.Table: Account \\[customer\\_account\\]\n\n</td></tr><tr><td>\n\nconsumer\n\n</td><td>\n\nString\n\n</td><td>\n\nOptional. Information about the consumer associated with the record.Table: Consumer \\[csm\\_consumer\\]\n\n</td></tr><tr><td>\n\ncontact\n\n</td><td>\n\nString\n\n</td><td>\n\nOptional. Information about the contact associated with the record.Table: Contact \\[customer\\_contact\\]\n\n</td></tr><tr><td>\n\nibqParams.execute\\_after\n\n</td><td>\n\nString\n\n</td><td>\n\nOptional. Sys\\_id of inbound request to process before the current request.Table: Inbound Request \\[sn\\_tmt\\_core\\_inbound\\_queue\\]\n\n</td></tr><tr><td>\n\npayload\n\n</td><td>\n\nObject\n\n</td><td>\n\nOptional. JSON object needed to process the request using the PrimitiveUtil\\(\\) API. For usage information, see [LeadToCashCore](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/LeadToCashCoreAPI.md).```\n\"payload\": {\n  \"additionalParams\": {Object},\n  \"context\": {Object},\n  \"inputParams\": {Object}\n  \"source\": [Array of Objects],\n  \"target\": [Array of Objects]\n}\n```\n\n</td></tr><tr><td>\n\npayload.additionalParams\n\n</td><td>\n\nObject\n\n</td><td>\n\nOptional. Additional parameters to use.```\n\"additionalParams\": {\n  \"action\": \"String\",\n  \"actionReason\": \"String\"\n  \"endDate\": \"Date\",\n  \"skipLines\": \"Boolean\",\n  \"startDate\": \"Date\"\n}\n```\n\n</td></tr><tr><td>\n\npayload.additionalParams.action\n\n</td><td>\n\nString\n\n</td><td>\n\nOptional. Specifies the type of declarative action being executed. For more information, see [Customer Life Cycle Management Workflows](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/customer-service-management/customer-life-cycle-management-workflows.md).Possible values:\n\n-   disconnect\n-   modify\n-   resume\n-   suspend\n\n</td></tr><tr><td>\n\npayload.additionalParams.actionReason\n\n</td><td>\n\nString\n\n</td><td>\n\nOptional. Property used in flows using declarative actions. Reason for the action.\n\n</td></tr><tr><td>\n\npayload.additionalParams.endDate\n\n</td><td>\n\nString\n\n</td><td>\n\nOptional. End date required to execute flows using declarative actions.Format: yyyy-MM-dd HH:mm:ss\n\n</td></tr><tr><td>\n\npayload.additionalParams.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\npayload.additionalParams.startDate\n\n</td><td>\n\nString\n\n</td><td>\n\nOptional. Start date to execute flows using declarative actions.Format: yyyy-MM-dd HH:mm:ss\n\n</td></tr><tr><td>\n\npayload.context\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  \"isMultiSelect\": \"Boolean\",\n  \"sourceToTargetConfigID\": \"String\"\n}\n```\n\n</td></tr><tr><td>\n\npayload.context.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 passing multiple line items in a comma-separated list.\n-   false: Only one input item can be passed in the script.\n\nDefault: false\n\n</td></tr><tr><td>\n\npayload.context.sourceToTargetConfigID\n\n</td><td>\n\nString\n\n</td><td>\n\nOptional. Mapping configuration ID for the source-to-target mapping.Table: Lead To Cash Entity Mapping \\[sn\\_l2c\\_core\\_entity\\_mapping\\]\n\n</td></tr><tr><td>\n\npayload.inputParams\n\n</td><td>\n\nObject\n\n</td><td>\n\nOptional. This object is a placeholder for any input parameters required to invoke the usage of a specific flow.```\n\"inputParams\": {}\n```\n\n</td></tr><tr><td>\n\npayload.source\n\n</td><td>\n\nArray\n\n</td><td>\n\nOptional. JSON object containing details of the source entity to retrieve data from.```\n\"source\": [\n  {\n    \"headerId\": \"String\",\n    \"lineIds\": []\n  }\n]\n```\n\n</td></tr><tr><td>\n\npayload.source.headerId\n\n</td><td>\n\nString\n\n</td><td>\n\nOptional. Header sys\\_id of source entity to retrieve data from.-   Required if you don't provide the **lineIds** parameter.\n-   Pass  null  if you aren't passing any header sys\\_ids.\n\n</td></tr><tr><td>\n\npayload.source.lineIds\n\n</td><td>\n\nArray\n\n</td><td>\n\nOptional. Array containing source line item sys\\_id\\(s\\) of an entity to retrieve entity data from.Required if you don't provide  the header ID, and if the entity structure starts with line items such as sold product.\n\n</td></tr><tr><td>\n\npayload.target\n\n</td><td>\n\nArray\n\n</td><td>\n\nOptional. JSON object containing details of the target entity.```\n\"target\": [\n  {\n    \"headerId\": \"String\",\n    \"lineIds\": []\n  }\n]\n```\n\n</td></tr><tr><td>\n\npayload.target.headerId\n\n</td><td>\n\nString\n\n</td><td>\n\nOptional. Header sys\\_id of target entity to retrieve data from. Required if you don't provide the **lineIds** parameter. Pass  null  if you aren't passing any header sys\\_ids.\n\n</td></tr><tr><td>\n\npayload.target.lineIds\n\n</td><td>\n\nArray\n\n</td><td>\n\nOptional. Array containing target line item sys\\_id\\(s\\) of an entity to retrieve entity data from. Required if you don't provide  header ID  and if the entity structure starts with line items such as sold product.\n\n</td></tr><tr><td>\n\nrecord\\_id\n\n</td><td>\n\nString\n\n</td><td>\n\nOptional. Sys\\_id of the target record if already present.\n\n</td></tr><tr><td>\n\nrequested\\_flow\n\n</td><td>\n\nString\n\n</td><td>\n\nOptional. Mapping configuration ID for source-to-target mapping. This property is required for flows using [Entity configuration and mapping](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/order-management/entity-configuration-and-mapping.md).Table: Lead To Cash Entity Mapping \\[sn\\_l2c\\_core\\_entity\\_mapping\\]\n\n</td></tr><tr><td>\n\nibqParams.resource\n\n</td><td>\n\nString\n\n</td><td>\n\nName of the flow that creates the record in the Inbound Request table \\(for example, a quote or order\\). This value is used to find dependent records of the same type to determine the order of record processing.\n\n</td></tr><tr><td>\n\nsource\\_record\\_ids\n\n</td><td>\n\nArray\n\n</td><td>\n\nArray containing the sys\\_ids of the source records.\n\n</td></tr><tr><td>\n\nsource\\_table\n\n</td><td>\n\nString\n\n</td><td>\n\nName of the table that contains the source record of the flow.\n\n</td></tr><tr><td>\n\ntable\n\n</td><td>\n\nString\n\n</td><td>\n\nName of the table that contains the target record of the flow.\n\n</td></tr></tbody>\n</table>|Type|Description|\n|----|-----------|\n|None| |\n\nIn the following example, the script queries the Inbound Request \\[sn\\_tmt\\_core\\_inbound\\_queue\\] table to find the latest record with matching source\\_record\\_ids, record\\_id, and resource values. The script then calls the setExecuteAfterRequest\\(\\) method to update the current record's execute\\_after value with the fetched record's sys\\_id and sets its state to pending. As a result, the current record will execute after the record specified in the execute\\_after field.\n\n```\nvar ibqParams = { \n  \"source_record_ids\": \"e32e29fd28d26a14f8775b8f954723b8\",\n  \"record_id\":\"b9be293128166a14f8775b8f9547239f\", \n  \"requested_flow\": \"0feb6d9da36271105c24939ef31e61dc\", \n  \"initiated_by\": \"admin\", \n  \"source_table\": \"sn_quote_mgmt_core_quote\", \n  \"table\": \"sn_ind_tmt_orm_order\", \n  \"payload\": {\n  \"context\": {}}, \n  \"resource\": \"quote_to_order\" \n }; \n\nnew sn_tmt_core.IBQConfigBase().setExecuteAfterRequest(ibqParams);\n```\n\nThis method does not return any output.\n\n"}}