create MRVS records with some array data
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-18-2024 09:51 PM
i have data with array as below
[{ "meterialID:"1220000", "DescriptionID": "tandard qa", "Quantity": 1 },{ "meterialID:"1220000", "DescriptionID": "tandard qa", "Quantity": 1 }]
i want add records in catalog MRVS variable set while submitting catalog through script or flow designer.
Please share any ideas....

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-18-2024 09:55 PM
Using a Catalog Client Script
-
Ensure your variable set is set up: Make sure you have an MRVS variable set defined in your catalog item.
-
Use a Catalog Client Script: You can create a Catalog Client Script that processes the input data and populates the MRVS. Here’s a sample script you might use:
function addToMRVS() {
var data = [
{ "meterialID": "1220000", "DescriptionID": "tandard qa", "Quantity": 1 },
{ "meterialID": "1220000", "DescriptionID": "tandard qa", "Quantity": 1 }
];
// Get the MRVS variable name
var mrvsVariableName = 'your_mrvs_variable_name'; // Replace with your actual variable name
// Loop through the array and add records to the MRVS
data.forEach(function(item) {
// Create a new record in the MRVS
var newRecord = {
"meterialID": item.meterialID,
"DescriptionID": item.DescriptionID,
"Quantity": item.Quantity
};
// Push the new record to the MRVS
g_form.addOption(mrvsVariableName, newRecord);
});
}
// Call the function to add records when the form loads
addToMRVS();
Using Flow Designer
-
Create a Flow: In Flow Designer, create a new Flow and use the trigger that suits your needs (e.g., when a catalog item is requested).
-
Add Action: Use the "Create Record" action to create multiple records in the MRVS.
-
Loop through your data: Use a "For Each" action to iterate over the array of data. In each iteration, create a new record in the MRVS variable set.
-
Map your fields: Map the fields from your array to the fields in your MRVS. This is typically done by selecting the appropriate variable names in the action configuration.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-18-2024 10:13 PM
Thanks for quick reply. unfortunately client script didn't work for me.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-18-2024 10:15 PM
g_form.addOption(mrvsVariableName, newRecord);
Might be this is not working....