Onboarding tasks- comments on task level roll up to parent.

niveditakumari
Mega Sage

Hi, 

 


Onboarding tasks- comments on task level roll up to parent.

As an HR Agent, if an employee or manager submits a comment on an Onboarding task, I can see all of the comments on the HR Case. 

When employee or manager submits comment on Onboarding task then I should see all comments on HR case. 

Can anyone please help me to achieve it. 

 

Regards, 

Nivedita

 

 

1 ACCEPTED SOLUTION

@niveditakumari Deactivate your business rule in HR Core scope and create a copy of the same Business rule in Human Resources Lifecycle Events scope along with the same script. Ideally, this will address your scope error issue as the worknotes would be added into the LE scope only. 

View solution in original post

14 REPLIES 14

@niveditakumari Deactivate your business rule in HR Core scope and create a copy of the same Business rule in Human Resources Lifecycle Events scope along with the same script. Ideally, this will address your scope error issue as the worknotes would be added into the LE scope only. 

Hi @Sandeep Rajput

 

It worked. 

Thank you so much for all your help and make me understand for this concept. 

 

Regards, 

Nivedita

 

 

Glad to know that it worked for you 🙂

Amit Gujarathi
Giga Sage
Giga Sage

Hi @niveditakumari ,
I trust you are doing great.

we will need to create a new field in the Onboarding Task table to store comments. We will also need to create a business rule that triggers when a comment is added to an Onboarding Task and copies the comment to the newly created field.

Here are the steps to implement this functionality:

  1. Create a new field in the Onboarding Task table to store comments. We can name this field "Comments Rollup" (or any other name you prefer) and set the field type to "Text".

  2. Create a business rule that triggers when a comment is added to an Onboarding Task. The business rule should copy the comment to the "Comments Rollup" field of the corresponding HR Case.
    Please fine the code for the same

/* Business Rule: Onboarding Task Comments Rollup */
/* When a comment is added to an Onboarding Task, roll up the comment to the corresponding HR Case */

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

  // Get the HR Case associated with the Onboarding Task
  var hrCase = new GlideRecord('sn_hr_core_case');
  hrCase.get(current.request);

  // Get the existing comments from the HR Case
  var comments = hrCase.comments.getJournalEntry(-1);
  
  // Add the new comment to the existing comments
  comments += "\n" + current.comments.getJournalEntry(-1);
  
  // Update the HR Case with the new comments
  hrCase.comments = comments;
  hrCase.update();

})(current, previous);

Was this answer helpful?


Please consider marking it correct or helpful.


Your feedback helps us improve!


Thank you!


Regards,


Amit Gujrathi



Hi @Amit Gujarathi

 

I have to achieve it with available additional comments field. I don't want to create new field. 

 

Regards, 

Nivedita