IdentityIQ 8.4
Hi,
I want to set a dynamic subject for the email template “LCM Requester Notification”.
To do this I’ve tried to set a variable into the of the template with a message depending on the status of the approvalSet item (Accepted or rejected).
<Body>
#set( $dynamicSubject= "my subject")
</Body>
When I use this: <Subject>$dynamicSubject</Subject>
The expression is not evaluated at all. I suspect that the code between the <Body></Body> tag is evaluated after what is between the <Subject></Subject> tag.
When I use a variable that is passed as an argument and set during the “Notify Requester” step, it works fine.
I think I need to create a new variable in the workflow, and in the “Notify Requester” step, do something like this :
#if ( $approvalSet )
#if ( $approvalSet.hasApproved() )
#foreach ($item in $approvalSet.approved)
#if ( $item.operation == "Create" )
#* This is an identity creation *#
#set( $dynamicSubject= "subject1" )
#else #* Modify identity *#
#set( $dynamicSubject= "subject2" )
#end
#end
#end
#if ( $approvalSet.hasRejected() )
#foreach ($item in $approvalSet.rejected)
#if ( $item.operation == "Create" ) #* This is an identity creation *#
#set( $dynamicSubject= "subject 3" )
#else #* Modify identity *#
#set( $dynamicSubject= "subject4" )
#end
#end
#end
#if ( $approvalScheme == "none" )
#foreach ($item in $approvalSet.items)
#if ( $item.operation == "Create" )
#* This is an identity creation *#
#set( $dynamicSubject= "Création du profil informatique pour $firstname $lastname ($typeContrat) effectuée" )
#else #* Modify identity *#
#set( $dynamicSubject= "subject 5" )
#end
#end
#end
#end
But i’m not sure if this will work because in th “Notify Requester” step, the argument “approvalSet” is set by calling the following method: prepareApprovalSetForNotification
I don’t know what this method is doing but maybe if I try to use approvalSet in the script to set my “$dynamicSubject” argument, the object approvalSet won’t be correctly initialized…
Does anyone knows if there’s a simplier way to achieve what I want? Or how to be sure of the state of the approvalSet?
Thanks for your help