
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-28-2022 06:58 AM
We have a form in our Service Portal which customers can use to order something.
We use a Script to populate different fields from the record producer.
For example:
current.u_external_reference = producer.external_reference;
current.company = producer.account;
current.requested_by = producer.contact;
current.type = 'normal';
current.assignment_group = '5683776bdbab0300bb3288805b961926';
current.contact_type = 'self-service';
var description =
"Box order for: "+ producer.contact + "\n" +
"Quantity: " + producer.box_specifications.getRowCount();
Now we want to use a Multi Row Variable set which contain 2 fields.
- Color
- Dimensions
I already managed to get the Quantity value in above example.
But how do I get the values for each field in the Multi Row Variable set?
I want to see the box specifications as part of the description field.
Like:
var description =
"Box order for: "+ producer.contact + "\n" +
"Quantity: " + producer.box_specifications.getRowCount()
"Color and Dimensions: " + ??? + "\n" +
"Color and Dimensions: " + ??? + "\n" +
"Color and Dimensions: " + ??? ;
Etc…
It would be nice if for every row the customer ordered something, the specifications will be shown on a new row.
I already did some testing but that did not give any result.
var description1 = '';
var mrvs = producer.variables.box_specifications;
var l = mrvs.getRowCount();
for(var i = 0; i < l; i++) {
var row = mrvs.getRow(i);
var cells = row.getCells();
var m = cells.length;
for(var j = 0; j < m; j++) {
description1+=cells[j].getLabel() + ': ' + cells[j].getCellDisplayValue() + "\n" ;
}
current.comments='test ' + mrvs;
var description =
"Box order for: "+ producer.contact + "\n" +
"Quantity: " + producer.box_specifications.getRowCount() + "\n" +
"Color and Dimensions: " + "\n" + description1;
Hope anyone can help.
Many Thanks
Solved! Go to Solution.
- Labels:
-
Service Catalog
-
Service Portal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-01-2022 12:42 AM
var mrvs = producer.variables.box_specifications;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-01-2022 12:42 AM
var mrvs = producer.variables.box_specifications;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-31-2023 11:45 PM
We are getting the sys ids, how can we get the display names/values. If we use .getDisplayValue() which returns undefined values, could you please help me on this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-24-2023 10:20 AM
I have the same case, were you able to solve it?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-27-2025 09:08 AM
Hello Dinesh,
You probably already solved it, but I will leave it here in case some needs it in the future.
I had to do a glideRecord inside the for, in order to retrieve the display value.
var mrvs = JSON.parse(producer.VARIABLESETNAME);
var newMember;
var description = ''
for(var i=0; i<mrvs.length;i++){
var grS = new GlideRecord("TABLENAME");
if(grS.get(mrvs[i].new_member)){
newMember = grS.getValue("name");
}
description += '\n' + 'Members: ' + newMember + " - "+ mrvs[i].ip_address + " - " + mrvs[i].port;
}
current.description = description;