A warm welcome to our website’s new look!

We are excited to unveil a fresh and improved website experience!

We have been hard at work to make your visit even more enjoyable and informative. Our new design is optimized for easy navigation, faster load times, and a more intuitive user experience.

Overview of the recent changes:

  • Enhanced Navigation: Find what you need quickly and easily with our streamlined menu structure.
  • Improved Content Organization: Our content is now better organized and easier to understand.
  • Optimized for Mobile: Whether you are on your desktop or smartphone, our website looks great and functions smoothly.
  • Enhanced Search Functionality: Find exactly what you are looking for with our improved search feature.

The site is designed with accessibility in mind, ensuring that users can easily understand VTAP concepts and utilize its tools without needing extensive coding knowledge. Each example is paired with clear instructions and screenshots, making it simple to follow and implement. 

This allows anyone, regardless of their technical background, to confidently navigate the platform and fully leverage its capabilities.

Happy browsing!

 
 
 

VTAP Customer Use Case

 
 
How do we update/delete Inventory line items using VTAP API?

To manage line items in VTAP API for updating records, you must follow a specific format when adding or deleting items. Here's how you can handle adding and deleting line items for a Quote record in VTAP API.

Adding Line Items
  • Fetch existing line items: First, retrieve all existing line items for the Quote record.
  • Construct the payload: Include all existing line items in the payload, appending the new line item details sequentially.
  • Pass totalProductCount: The payload should include the totalProductCount parameter to indicate the number of line items.
 

How do we update/delete Inventory line items using VTAP API?

To manage line items in VTAP API for updating records, you must follow a specific format when adding or deleting items. Here's how you can handle adding and deleting line items for a Quote record in VTAP API.

Adding Line Items
  • Fetch existing line items: First, retrieve all existing line items for the Quote record.
  • Construct the payload: Include all existing line items in the payload, appending the new line item details sequentially.
  • Pass totalProductCount: The payload should include the totalProductCount parameter to indicate the number of line items.
 
 
 

Sample code to add line items:

 
 

// Assume you already have the existing line item details

 

// Assume you already have the existing line item details


  

let existingLineItems = {

    hdnProductId1:’<product_record_id>’,

    productName1: '<product_name>',

    comment1: '',

    qty1: 1,

    listPrice1: 700.00

};


  

let existingLineItems = {

    hdnProductId1:’<product_record_id>’,

    productName1: '<product_name>',

    comment1: '',

    qty1: 1,

    listPrice1: 700.00

};

 

// Add a new line item to the existing Quote record

 

// Add a new line item to the existing Quote record


  

let newLineItem = {

    hdnProductId2: ‘<product_record_id>’,

    productName2: '<product_name>',

    comment2: '',

    qty2: 5,

    listPrice2: 500.00

};


  

let newLineItem = {

    hdnProductId2: ‘<product_record_id>’,

    productName2: '<product_name>',

    comment2: '',

    qty2: 5,

    listPrice2: 500.00

};

 

// Combine existing and new line items

 

// Combine existing and new line items


  

let params = {

    module: 'Quotes',

    id: quoteId, // replace with the actual Quote ID

    ...existingLineItems,

    ...newLineItem,

    totalProductCount: 2 // Update this count as per the total number of line items

};


  

let params = {

    module: 'Quotes',

    id: quoteId, // replace with the actual Quote ID

    ...existingLineItems,

    ...newLineItem,

    totalProductCount: 2 // Update this count as per the total number of line items

};

 

// Send the request using VTAP API

 

// Send the request using VTAP API


  

VTAP.Api.Put('records', params, (error, response) => {

    if (error) {

        console.error("Error adding line item:", error);

    } else {

        console.log("Line item added successfully:", response);

    }

});


  

VTAP.Api.Put('records', params, (error, response) => {

    if (error) {

        console.error("Error adding line item:", error);

    } else {

        console.log("Line item added successfully:", response);

    }

});

 
Deleting Line Items
  • Fetch existing line items: Get all current line items of the record.
  • Remove the line item you wish to delete: Modify the list by excluding the line item you want to delete.
  • Update totalProductCount: Adjust the count to reflect the new number of line items.
 

Deleting Line Items
  • Fetch existing line items: Get all current line items of the record.
  • Remove the line item you wish to delete: Modify the list by excluding the line item you want to delete.
  • Update totalProductCount: Adjust the count to reflect the new number of line items.
 
 
 

Sample code to delete a line item:

 
 

// Fetch existing line items and filter out the items you want to remove

 

// Fetch existing line items and filter out the items you want to remove


  

let lineItems = {

    hdnProductId1:’<product_record_id>’,

    productName1: '<product_name>',

    comment1: '',

    qty1: 1,

    listPrice1: 700.00,

    hdnProductId2: ’<product_record_id>’,

    productName2: '<product_name>',

    comment2: '',

    qty2: 5,

    listPrice2: 500.00

};


  

let lineItems = {

    hdnProductId1:’<product_record_id>’,

    productName1: '<product_name>',

    comment1: '',

    qty1: 1,

    listPrice1: 700.00,

    hdnProductId2: ’<product_record_id>’,

    productName2: '<product_name>',

    comment2: '',

    qty2: 5,

    listPrice2: 500.00

};

 

// Suppose we want to delete the second line item

 

// Suppose we want to delete the second line item


  

delete lineItems.hdnProductId2;

delete lineItems.productName2;

delete lineItems.comment2;

delete lineItems.qty2;

delete lineItems.listPrice2;


  

delete lineItems.hdnProductId2;

delete lineItems.productName2;

delete lineItems.comment2;

delete lineItems.qty2;

delete lineItems.listPrice2;

 

// Updated payload with the remaining line items

 

// Updated payload with the remaining line items


  

let updatedPayload = {

    module: 'Quotes',

    id: quoteId, // replace with the actual Quote ID

    ...lineItems,

    totalProductCount: 1 // Update the count as needed

};


  

let updatedPayload = {

    module: 'Quotes',

    id: quoteId, // replace with the actual Quote ID

    ...lineItems,

    totalProductCount: 1 // Update the count as needed

};

 

// Send the updated request

 

// Send the updated request


  

VTAP.Api.Post('records', updatedPayload, (error, response) => {

    if (error) {

        console.error("Error deleting line item:", error);

    } else {

        console.log("Line item deleted successfully:", response);

    }

});


  

VTAP.Api.Post('records', updatedPayload, (error, response) => {

    if (error) {

        console.error("Error deleting line item:", error);

    } else {

        console.log("Line item deleted successfully:", response);

    }

});

 
 

Sign up to receive the latest updates!