Regarind MRVS value read and set it into a multiline text
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-10-2024 12:20 AM
Hi all, I have a requirement of get the MRVS values and set it into a Multiline text which is present inside a SingleRow Variable set from a catalog item but when it came to RITM and sc_task the vlaue is not visible accurately as expected.
i have attached the picture i have to set memebr of the distribution list to the ITS CE-API API variable which is a multiline text set inside a single row variable set. i have write a OnSubmit() client script.but it is not giving accurate output it is show '/' and the sys-id of the member i have tried
but it is not working can any one suggest how to achieve it through workflow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-10-2024 12:27 AM - edited 05-10-2024 12:31 AM
Hi @1_DipikaD
'/' is shown because you use JSON.stringify method. use JSON.parse.
Thanks
dgarad
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-10-2024 06:09 AM
i have applied JSON.parse but still i got like this member variable is returning sysid of user which is refer to user table but want to get the actual value. member variable is a reference field present inside the MRVS.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-10-2024 06:50 AM
try the below code and modify it as per requirement.
var mrvs = JSON.parse(g_form.getValue("members_of_the_distribution_list"););//array of objects with values
var returnStr= '';//return string
for(var i=0; i < mrvs.length; i++); {
if(mrvs[i].memeber !=""){
var gr = new GlideRecord('sys_user');
if(gr.get(mrvs[i].member)){//I assume u_user_name is a ref. to sys_user
returnStr += "member: " + '\n' + gr.getValue('user_name') + '\n';
returnStr += "Email: " + mrvs[i].email + '\n'
returnStr += "User_id: " + mrvs[i].user_id + '\n' ;
}
}
g_form.setValue("api_variable", returnStr);
Thanks
dgarad
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-10-2024 01:40 PM
I have just modify the code and tried it using workflow runscript but still the value not populate, i have applied gs.info() that is produce proper result but the result is not set in the multiline text field .i have written this code below