In manage lifecycle event I want to trigger activity Set before one day for "Indian" user.

Rameshwar Bera3
Tera Contributor

I want to trigger activity set before one day for Indian user but for other user it should be as it is.

How we can achieve with trigger type as "Advanced" or is another way 

 

Thanks in Advance..!!

Onboarding Task.png

9 REPLIES 9

Thank you very much.

 

Yes It work But In same life cycle event I have another activity set which is trigger after 45 days of Expected Star. For this one also I need to trigger activity set before one day for Indian user for another user it should trigger normally.

Ex-  For Indian user it should trigger 44 days after and for other user it trigger normal 

 

Thanks in Advance..!!Activity Set.png

 

Hello Thanks for the reply,

 

Yes, This works. but I have a question in Another activity Set which is triggered after 45 days of expected start. For this activity set also needs to trigger  1 day before for Indian users for another user it should as normal.

For ex-  For This 45 Days activity set needs to trigger an activity set after 44 days for Indian users  and other users activity sets trigger after 45 days. How we can include this condition in advanced Trigger Type.

 

Thanks in Advance..!!

 

Activity Set.png

 

SANDEEP28
Mega Sage

@Rameshwar Bera3 Use below code for your new requirement.

Please open new thread for your new question, so that it will help others to search properly  when they get into same issue.

 

 If I could help you with your Query then, please hit the Thumb Icon and mark as Correct !!

 

(function shouldActivitySetTrigger(parentCase /* GlideRecord for parent case */ ,
    hrTriggerUtil /* hr_TriggerUtil script include instance */ ) {

    //for Non India User
    var flag = false;
    var todayDate = new GlideDate();
    var expectedStartDate = new GlideDateTime(parent.u_expected_start_date);
    expectedStartDate.addDaysLocalTime(45);
    var expectedStartDateNonIndia = new GlideDate();
    expectedStartDateNonIndia.setValue(expectedStartDateNonIndia.getDate());

    if (parentCase.subject_person.country.name != 'India' && (todayDate.getValue() == expectedStartDate.getValue()))
        flag = true;


    // for India User
    var expectedStartDateFromParent = new GlideDateTime(parent.u_expected_start_date);
    expectedStartDateFromParent.addDaysLocalTime(44); // subtracting one day from expected start date
    var expectedStartDateIndia = new GlideDate();
    expectedStartDateIndia.setValue(expectedStartDateFromParent.getDate());

    if (parentCase.subject_person.country.name == 'India' && (todayDate.getValue() == expectedStartDateIndia.getValue()))
        flag = true;

    return flag;

})(parentCase, hrTriggerUtil);

 

 

SANDEEP28
Mega Sage

@Rameshwar Bera3   If I could help you with your Query then, please hit the Thumb Icon and mark as Correct !!

SANDEEP28
Mega Sage

@Rameshwar Bera3   If I could help you with your Query then, please hit the Thumb Icon and mark as Correct !!