Copy field value from child to parent

arundharmabe
Tera Guru

Hi All,

I need help on the below requirement. At the moment when the incident is resolved there will be an incident task gets created. Here i want to copy the state of the incident task to a string field on incident table. Already i've tried with the Display BR it's working but it's not saving the value, I've tried with before / after BR but no luck. Can someone guide me on how i can achieve the same.

Below is the simple piece of code that i'm using inside the Display BR

var rec = new GlideRecord('incident_task');

rec.addQuery('incident', current.sys_id);

rec.query();

if (rec.next()) {

current.u_category_on_open = rec.state.getDisplayValue();

}

 

Regards,

Arun

1 ACCEPTED SOLUTION

Hi Arun,

I tried same in my PDI and it is working properly.

Check attached screenshots.

Business Rule -

find_real_file.png

find_real_file.png

 

Incident task record - 

find_real_file.png

 

Incident record after resolved.

find_real_file.png

 

See result in log

find_real_file.png

 

Thanks,

Dhananjay.

View solution in original post

19 REPLIES 19

AMIT SHISHODIA2
Giga Guru

Try Using After/Async Updated business rule and condition:State changes to resolved and then query the same.Kindly check field name also
Kindly mark Correct and Helpful if it helps you.

Hi Amit,

I've tried the same, but no luck.

 

Regards,

Arun

Namrata Khabale
Giga Guru

Hey Arun,

Here is the same thread you Looking for, it might help you:

https://community.servicenow.com/community?id=community_question&sys_id=921d4f69db9cdbc01dcaf3231f96...

 

Mark Correct and Helpful if it helps!!!

 

Best Regards,

Namrata.

Hi Namrata,

In that link it says with Display BR. Even my script is working fine as Display but it's not updating the value in the database. We need to use other methods.

 

Regards,

Arun