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

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

are you saying on incident form under incident task related list when you click new button the fields on incident_task should get auto-populated with data from parent incident?

if yes then you can use display BR on incident task and get the field values and set it

Regards
Ankur

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

Yes

Can you please send me script

Thanks& Regards
Sidhu !

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

Hi ankur

This code is not Working

 
Thanks& Regards
Sidhu !