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

SANDEEP28
Mega Sage

@Rameshwar Bera3  Use "Combination" trigger type. You will get to use "Date", "condition" & "other activity sets" combination.  In "Date", you can write date logic and in "Condition", you can write India user logic.

 

SANDEEP28_0-1689853606563.png

 

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

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

Thanks For the reply.

But How It work for non Indian employee.

 

For EX- I am from India If we use combination filter it work for myself. but user is non Indian then activity is not trigger for them. 

 

My use case is like same activity set should trigger on normal user , but if user is from India then it should trigger one day before.

@Rameshwar Bera3  Select trigger type as "Advanced" and add below code in script section

 

Replace "parentCase.subject_person.country.name" with your instance country field of user table.

Replace "parent.u_expected_start_date" with Expected start date field of your instance.

 

(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 GlideDate();
    expectedStartDate.setValue(parent.u_expected_start_date);

    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(-1); // 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);

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