Copy Worknotes from HR Case to HR Task copying Duplicate Worknotes in HR Case

Tahzeeb
Giga Expert

Hi Team,

 

I am facing below Issue

I have requirement to copy all the worknotes from HR Case to HR Task and vice versa.

 

While this is working using journel entry(-1), but every time a worknote is added to the HR Case all the old worknotes in HR Case are getting copied to HR Case also.

kindly suggest

1 ACCEPTED SOLUTION

Community Alums
Not applicable

Hi Tahzeeb,

 

I have tried a mock up on my PDI and is working as expected. I have attached my design. Can you give it a try and let me know if you have any questions/issues.

View solution in original post

16 REPLIES 16

Tahzeeb
Giga Expert

For After BR

var HRTask = new GlideRecord('HR_task');

HRTask.addQuery('parent', current.sys_id);

HRTask.query();

while(HRTask.next())

{
          HRTask.work_notes = current.work_notes.getJournalEntry(1);
          HRTask.update();
}

Community Alums
Not applicable

1. I hope you have written GlideRecord on "sn_hr_core_task" and not "HR_task" in the above script

2. Open the BR "Validate Changes" on "sn_hr_core_task" table and comment these two lines. It will stop the rollback of work notes of HR case from being copied from HR task back into HR case

 

find_real_file.png

 

The sys_id of this BR OOTB is fa5330019f22120047a2d126c42e70f9

Hi shruthiub,

 

This approach has worked but now no worknotes from HR Task are getting copied to HR Case, while as in my case I need to get the worknotes copied from HR Task to HR Case as well

 

Yes the GlideRecord form is sn_hr_core_task

 

Please suggest

Community Alums
Not applicable

Hi Tahzeeb,

 

Can you confirm the requirement? I can help you out with this.

 

1. On insert of a HR task, you want the entire work notes of HR case to be copied to HR task

2. When HR Case is updated with a new work notes, you want this new work notes to be copied to HR Task

3. When HR Task is updated with a new work notes, you want this new work notes to be copied to HR Case

 

2 and 3 should not lead to a loop.

 

Is that correct? The above requirement is achievable.

Yes, this correct. that is what is the requirement