Line Items API is available in all CLIC modules.
Replace clicAPI with quoteAPI, rebateAgreementAPI, contractAPI or compensationPlanAPI depending on where you will use these examples.
Create and Fetch new line items
JavaScript
await clicAPI.addLineItems(["lineItem_1", "lineItem_2"]);
const items = await clicAPI.getLineItems();
Create two line items with identical Name and modify them separately
JavaScript
// Step 1: Create multiple line items
await clicAPI.addLineItems(["lineItem_1", "lineItem_1"]);
// Step 2: Retrieve the created line items
const items = await clicAPI.getLineItems();
// Step 3: Update each line item with specific configurations
for (const item of items) {
// You can also write it like this if you need array index
// for (const [i, item] of items.entries()) {
// Itereting through created line items
await clicAPI.setLineItemInputValues(
// Filter criteria to identify the specific line item
{
endRow: 1,
operationType: "fetch",
startRow: 0,
textMatchStyle: "exact",
data: {
operator: "and",
_constructor: "AdvancedCriteria",
criteria: [
{
fieldName: "lineId",
operator: "inSet",
value: item.lineId, // Unique identifier for the line item
},
// Alternative way, filtering by typedId
// {
// fieldName: "id",
// operator: "inSet",
// value: item.typedId.split('.')[0],
// },
],
},
},
// In this Map you can put values which you want to update
{
// Simple input
Customer: `CD-000${Math.floor(Math.random() * 10)}`,
// Nested configuration with multiple fields
Configuration1: {
"How Many Input Blocks?": 1,
StringDefaultValue: null,
"PRODUCT #0": "B-0029",
"CUSTOMERGROUP #0": null,
Price: [],
},
// Complex configuration with array of objects
Configuration2: {
Price: [
{
"Scale Qty": "1000",
"Freight Cost": null,
Price: null,
selected: true,
},
],
},
},
);
}