- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2024 02:55 AM
I have a scenario where i need push some of field value to staging form. i have tried with below code, still not working
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2024 03:14 AM - edited 05-02-2024 03:16 AM
Hi @harshalpatil15
Few things to take care
1) Spelling of urgency
2) Current is capital in inc.caller_id = Current.caller_id;
3) Use inc.insert(); instead of inc.update();
4) You should not do inc.sys_id = current.sys_id;
So the updated code will be
var inc = new GlideRecord('u_inc_staging');
inc.initialize();
inc.u_inc_number = current.number;
inc.u_description = current.short_description;
inc.u_impact = current.getValue('impact');
inc.u_urgency = current.getValue('urgency');
inc.u_state = current.getValue('state');
inc.u_assignment_group = current.assignment_group;
inc.caller_id = current.caller_id;
inc.insert();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2024 03:06 AM
Hi @harshalpatil15 ,
If you have to insert new record in staging table you can use below script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2024 03:16 AM
Hi @Community Alums,
Thanks for quick reply. Suggested changes are made still no response from code. Do i need to keep the state, urgency and priority field same as it on Incident form (with there choices)?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2024 03:14 AM - edited 05-02-2024 03:16 AM
Hi @harshalpatil15
Few things to take care
1) Spelling of urgency
2) Current is capital in inc.caller_id = Current.caller_id;
3) Use inc.insert(); instead of inc.update();
4) You should not do inc.sys_id = current.sys_id;
So the updated code will be
var inc = new GlideRecord('u_inc_staging');
inc.initialize();
inc.u_inc_number = current.number;
inc.u_description = current.short_description;
inc.u_impact = current.getValue('impact');
inc.u_urgency = current.getValue('urgency');
inc.u_state = current.getValue('state');
inc.u_assignment_group = current.assignment_group;
inc.caller_id = current.caller_id;
inc.insert();