IF ELSE Condition based on Analytics Field

Mahak_Acharya
New Contributor III
New Contributor III

Hi,

I would like to trigger an email from a report/analytics. This email is required to have an if else block based on one of the columns in the analytics.

Usecase:

I would want to trigger emails in the language of the user which are being returned via the report, for this I am printing the User's language in the report in an attribute. Using this i want to build an if else block.

Could anyone please provide a syntax of if else to achieve this.

Regards,

Mahak

5 REPLIES 5

rushikeshvartak
All-Star
All-Star

Instead of column of report use ${user.locale}


Regards,
Rushikesh Vartak
If the response is helpful, please click Accept As Solution and kudos it.

Mahak_Acharya
New Contributor III
New Contributor III

What information is available in User.locale field? 

Users language


Regards,
Rushikesh Vartak
If the response is helpful, please click Accept As Solution and kudos it.

Mahak_Acharya
New Contributor III
New Contributor III

Hi Rushikesh,

The value for user's language is being fed into Saviynt through azure for us into a customproperty. Not sure if it will be the same as user.locale attribute.

Regards,

Mahak

Mahak_Acharya
New Contributor III
New Contributor III

Also using any user attribute is in an analytics email template is resulting in the following error:

 

2023-07-06 11:45:50,880 [https-jsse-nio-443-exec-8] DEBUG analytics.AnalyticsESService  - body after removing individual users analytics data - <html><img width="602" alt="" src="https://bnlwestgunileverds01003.blob.core.windows.net/mim-email-templates/header1.png"> <br>IDENTITY AND ACCESS MANAGEMENT<br><br><% if (${user.locale}=='FR') print "Dear" else print "Th?a" %></html>
2023-07-06 11:45:50,902 [https-jsse-nio-443-exec-8] DEBUG analytics.AnalyticsESService  - Error in notifyEmailToOwner::
groovy.lang.MissingMethodException: No signature of method: SimpleTemplateScript5805.$() is applicable for argument types: (SimpleTemplateScript5805$_run_closure1) values: [SimpleTemplateScript5805$_run_closure1@b411d24]
Possible solutions: is(java.lang.Object), run(), run(), any(), any(groovy.lang.Closure), use([Ljava.lang.Object;)
 
 
2023-07-06 11:53:03,663 [https-jsse-nio-443-exec-1] DEBUG analytics.AnalyticsESService  - body after removing individual users analytics data - <html><img width="602" alt="" src="https://bnlwestgunileverds01003.blob.core.windows.net/mim-email-templates/header1.png"> <br>IDENTITY AND ACCESS MANAGEMENT<br><br><% if (user.locale=='FR') print "Dear" else print "Th?a" %></html>
2023-07-06 11:53:03,675 [https-jsse-nio-443-exec-1] DEBUG analytics.AnalyticsESService  - Error in notifyEmailToOwner::
groovy.lang.MissingPropertyException: No such property: user for class: SimpleTemplateScript5813
at SimpleTemplateScript5813.run(SimpleTemplateScript5813.groovy:1)
 
Regards,
Mahak