- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-26-2023 03:11 AM
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-26-2023 03:46 AM
Hello @APV Babu ,
Please give a try to the code below and let me know how it works for you.
(function executeRule(current, previous /*null when async*/ ) {
var plan = current.getValue('plan_s').split(',');
var clientNames = [];
var clientNumbers = [];
for (var i = 0; i < plan.length; i++) {
gs.info(plan[i] + ' Result');
var client = new GlideRecord("u_table");
client.addQuery('sys_id', plan[i]);
client.query();
while (client.next()) {
clientNames.push(client.u_client_name.u_name);
gs.info(client.u_client_name.u_name + ' clientname');
clientNumbers.push(client.u_client_name.u_client_number);
gs.info(client.u_client_name.u_client_number + ' cliennumber');
}
}
current.client_name = clientNames.join(', ');
current.client_number = clientNumbers.join(', ');
})(current, previous);
Let me know your views on this and Mark ✅Correct if this solves your query and also mark 👍Helpful if you find my response worthy based on the impact.
Thanks,
Aniket
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-26-2023 03:22 AM
Hi @APV Babu ,
Please try the below updated code
(function executeRule(current, previous /*null when async*/ ) {
var plan = current.getValue('plan_s').split(',');
for (var i = 0; i < plan.length; i++) {
gs.info(plan[i] + 'Result');
var client = new GlideRecord("u_table");
client.addQuery('sys_id', plan[i]);
client.query();
while (client.next()) {
current.client_name += client.u_client_name.u_name + ' ';
gs.info(client.u_client_name.u_name + 'clientname');
current.client_number += client.u_client_name.u_client_number + ' ';
gs.info(client.u_client_name.u_client_number + 'cliennumber');
}
}
})(current, previous);
Thanks,
Danish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-26-2023 04:19 AM
Thanks for the response the script was not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-26-2023 04:21 AM
Hi @APV Babu ,
Can u log the plan variable n check whether u getting the sys id's or not?
var plan = current.getValue('plan_s').split(',');
gs.info('Plan Values :-'+ plan);
Thanks,
Danish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-26-2023 04:29 AM
Hey I am not getting the any values from plan