To Set the value from Business rule
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2023 10:00 PM
Hi all,
I have Multi row Variable set, those variables should be displayed in RITM's Description field.
I have done scripting for this in Business rule. While setting the value it is getting only first record, not all the values.
I am going somewhere wrong in loop i guess. Could any one guide me?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2023 11:21 PM
Hi, unfortunately your post does not make your configuration or requirement clear and you code appears to be incomplete? With your current code you appear to be setting the value of 'res' at every loop and so it will always be the value delivered by the last loop/row. But your post indicates the first row, can you confirm that the loop works as expected and you can see\log each row as you iterate through the rows?
Perhaps you could update this thread with clear details of your requirement and of your debugging. so that the forum can understand your intentions, and the issue that you have with your code.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2023 12:23 AM
Hi @Suvedha
Check with below code.
var mrvs = current.variables.madrid_hq_varibales;
var desc='';
var rowCount = mrvs.getRowCount();
gs.log(mrvs.getRowCount());
for (var i = 0; i < rowCount; i++) {
var row = mrvs.getRow(i);
var app = row.description1;
var app1 = row.quantity1;
var app2 = row.refer;
var gr = new GlideRecord('u_madrid_hq_facilities');
gr.get('sys_id',app);
var res = gr.u_texto_breve_de_material;
desc= desc+ res +', '; // here it will add values of all mrvs rows
}
current.description= desc;