cloning a parent form fields to new form without saving it

Aps1
Tera Expert

Hello Team,
I want to clone fields from the parent record to new record but without saving the new form user can mark submit to insert it.
and a field called parent should get the value from the parent record.

script:

var grTransitionNew=new GlideRecord("x_novrp_it_transition_cost_master_table");
grTransitionNew.initialize();
 
var copyFieldArray=["project_id","demand_id",'application','pqm','date_when_project_was_assigned','ste','deputy_ste','priority','implementation_vendor'];
for(var fieldName in current)
{
if(copyFieldArray.indexOf(fieldName)>-1)
   grTransitionNew.setValue(fieldName,current.getValue(fieldName));
   grTransitionNew.setValue('parent_st',current.sys_id);
   grTransitionNew.release =(current.release || 1) + 1;
 
}
grTransitionNew.insert();

action.setRedirectURL(grTransitionNew);
0 REPLIES 0