update the catalog item variables values on the order guide summary page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-04-2024 06:38 AM
Hello All,
We have a requirement to update the catalog item variables filled in the summary page of the order guide.
The summary page of order guide only displays catalog item name , quantity, Price..etc.
our requirement is to show the variables under those catalog item displayed on the summary page of the order guide.
Please let us know how to achieve this customization.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-04-2024 08:09 AM
Hi there @Kaustubh k
Modify the order guide summary page to include fields or sections for catalog item variables. Use Script to fetch and dynamically display these variables alongside catalog item details such as name, quantity, and price.
<!-- Example HTML structure for order guide summary -->
<div class="order-guide-summary">
<h3>Order Guide Summary</h3>
<ul>
<!-- Example item in the summary -->
<li>
<strong>Catalog Item: </strong> Laptop
<br>
<strong>Quantity: </strong> 2
<br>
<strong>Price: </strong> $1500
<br>
<!-- Display catalog item variables dynamically -->
<div id="variables_laptop">
<strong>Variables:</strong>
<ul id="laptop_variables">
<!-- Variables will be dynamically added here -->
</ul>
</div>
</li>
<!-- Add more items as needed -->
</ul>
</div>
<script>
// Example function to fetch and display variables for a catalog item
function fetchCatalogItemVariables(itemId) {
var gr = new GlideRecord('sc_cat_item'); // Replace with your catalog item table
if (gr.get(itemId)) {
var variables = gr.variables; // Assuming variables are stored in a field named 'variables'
// Example: Display variables in a list
var variablesList = document.getElementById('laptop_variables');
for (var i = 0; i < variables.length(); i++) {
var variable = variables[i];
var listItem = document.createElement('li');
listItem.textContent = variable.getDisplayValue(); // Adjust as per variable structure
variablesList.appendChild(listItem);
}
}
}
// Example usage: Call fetchCatalogItemVariables() for each catalog item on the summary page
fetchCatalogItemVariables('catalog_item_id_here'); // Replace with actual catalog item ID
</script>
If this helps kindly accept the response.
Kind Regards,
Mohamed Azarudeen Z
Developer @ KPMG
Microsoft MVP (AI Services), India