Values to be push to another form

harshalpatil15
Tera Contributor

I have a scenario where i need push some of field value to staging form. i have tried with below code, still not working

    var inc = new GlideRecord('u_inc_staging');
    inc.initialize();
    inc.sys_id = current.sys_id;
    inc.u_inc_number = current.number;
    inc.u_description = current.short_description;
    inc.u_impact = current.getValue('impact');
    inc.u_urgencyt = current.getValue('urgency');
    inc.u_state = current.getValue('state');
    inc.u_assignment_group = current.assignment_group;
    inc.caller_id = Current.caller_id;
    inc.update();

 

1 ACCEPTED SOLUTION

Ashutosh C J
Tera Guru

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();

 

 

View solution in original post

3 REPLIES 3

Community Alums
Not applicable

Hi @harshalpatil15 ,

If you have to insert new record in staging table you can use below script 

  var inc = new GlideRecord('u_inc_staging');
    inc.initialize();
    inc.sys_id = current.sys_id;
    inc.u_inc_number = current.number;
    inc.u_description = current.short_description;
    inc.u_impact = current.getValue('impact');
    inc.u_urgencyt = current.getValue('urgency');
    inc.u_state = current.getValue('state');
    inc.u_assignment_group = current.assignment_group;
    inc.caller_id = Current.caller_id;
    inc.insert();
 
Please mark my answer correct and helpful if this works for you
 
Thanks and Regards 
Sarthak

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)? 

Ashutosh C J
Tera Guru

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();