Send mail on a particular Lifecycle state change

Hello Experts:
We want to send an email to managers when LifeCycle State changes from ‘T1’ to ‘A’. (on Rehire)
Note: We have multiple LifeCycle states but we only want to trigger mail when it changes form ‘T1’ to ‘A’.

Is it possible to use the OOTB template of Lifecycle State change for above requirement with some changes ??

Regards,
Arvind

Hi @ArvindSingh30,

You can use the OOTB template of LCS Change.

You just need to use velocity template to create If else condition using newState and OldState attributes.

For your reference,

1 Like

I agree with Animesh. The OOTB email template he links to is the correct template for handling this. To expand on what he said about velocity template scripting, you can check out this post that explains how you can use if/else logic in the email subject to control when the email is sent.

In your case, you would probably use the following velocity script in the subject.

#if($oldState == 'T1' && $newState == 'A')Lifecycle state has changed for your employee#{else}#stop#end

We’re using Workflow for this instead of messing with email templates which provides a more maintainable solution.

1 Like

Hi Collin,

We tried in same way and it is working when #if($newState== “T1” ) but it is not working when #elseif($newState== “A”).

Please find below script for reference.

Hi ,

#if($newState== “T1” )

The user ${identity.displayName} has been disabled. Please disable MS Exchange and related user accounts.

#elseif($newState== “A”)

Lifecycle state has been changed for ${identityName} to $newState.#{else}#end

Thanks,
The ${PRODUCT_NAME} Team

Please refer to the apache velocity if/else condition documentation. You need to make sure you are terminating with an #end.

http://people.apache.org/~henning/velocity/html/ch05s03.html

Hi Colin,

We observe that Life cycle state change email template is only working for termination (T and T1).

Not working for L ,A.

I just put below basic email template and changed different life cycle states …Triggered for T and T1 , Not triggered for other life cycle states

Hi ,

The user ${identity.displayName} Lifecycle state has been changed to $newState.

Thanks,
The ${PRODUCT_NAME} Team

Is this only work for Termination ?

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.