Copy Sctask Variables to custom table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2023 05:19 AM
Hi All,
I would like to copy sctask variables to custom table ,what would be best practice to do it and any example script will be helpful.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-31-2023 03:47 AM
Hello @Mahesh033
plz refer this example script :-
var catVar = current.variables.select_all_tw_software_needed.toString();
var catVar2 = current.variables.select_all_3rd_party_software_needed.toString();
var finalVal= catVar+','+catVar2; //combine both the list collector values
var res = finalVal.split(',');
var len = res.length;
if(len>0)
{
for( var i=0; i<len;i++)
{
//creates record for each value selected on both the list collector fields
var table= new GlideRecord('u_asr_apps_to_users');
table.initialize();
table.u_nameid_servicenow_applicaion = res[i];
table.insert();
}
}
}
Plz Mark my Solution as Accept and Give me thumbs up, if you find it Helpful.
Regards,
Samaksh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-31-2023 03:54 AM
What's the business requirement here?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader