How to Auto populate the task_incident values from parent incident (Only when i click on new button in task incident then populate parent incident details).

Sidhu9
Tera Contributor

Thanks

Srinu

Thanks& Regards
Sidhu !
1 ACCEPTED SOLUTION

Hi,

approach using display BR + onLoad client script on incident_task

1) Create a Display Business Rule on your Incident Task Table and use the script mentioned below:

(function executeRule(current, previous /*null when async*/) {

	// Add your code here
	g_scratchpad.shortDescription = current.parent.short_description;
	g_scratchpad.description = current.parent.description;

})(current, previous);

 2) Write an On Load Client Script on Incident Task Table with below Code:

function onLoad() {
   //Type appropriate comment here, and begin script below

   g_form.setValue('short_description', g_scratchpad.shortDescription);
   g_form.setValue('description', g_scratchpad.description);

}

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

View solution in original post

6 REPLIES 6

Hi,

what is not working?

what scripts have you written?

what debugging have you performed?

Did you enhance the script as per your requirement?

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Vaishnavi Lathk
Mega Sage
Mega Sage

Hey  srinu

You can use before insert as following code:-

Apply on Incident table

var gr=new GlideRecord('u_incident_task');
gr.initialize();
gr.short_description=current.short_description;
gr.description=current.description;
gr.parent=current.sys_id;
gr.insert();