Saviynt unveils its cutting-edge Intelligence Suite products to revolutionize Identity Security!
Click HERE to see how Saviynt Intelligence is transforming the industry.
Saviynt Copilot Icon

Blank value in email template instead of null

Community_User
Saviynt Employee
Saviynt Employee
Originally posted on January 28 2021 at 05:35 UTC

Hi Team,


We are using Saviynt v5.5.


We want to show blank in email notification template , when the attribute is not filled.


for eg- while sending joiner notification, if location is not defined for the user, we need to send it as blank.


Currently its showing null.


Can anyone please guide how to achieve this.


Thanks,

Sitarasmi

This message was previously posted on Saviynt's legacy forum by a community user and has been moved over to this forum for continued exposure.
15 REPLIES 15

Community_User
Saviynt Employee
Saviynt Employee
Originally posted on January 28 2021 at 12:37 UTC

Hi Sitarasmi,

You can use a simple code as below :

${null!=user.location?user.location:''}

Regards,

Adrien.

This message was previously posted on Saviynt's legacy forum by a community user and has been moved over to this forum for continued exposure.

Community_User
Saviynt Employee
Saviynt Employee
Originally posted on January 28 2021 at 12:44 UTC

Hi Adrien,


I tried with this, but in this case, email itself is not getting triggered when the value is not given,


when removed, email is triggered.


Thanks,

Sitarasmi

This message was previously posted on Saviynt's legacy forum by a community user and has been moved over to this forum for continued exposure.

Community_User
Saviynt Employee
Saviynt Employee
Originally posted on January 28 2021 at 12:54 UTC

Hi Sitarasmi,

Are you trying to send an email after submitting a Create User Request from UI that must go into approval ?

In this case, you might try something like this :

${accessItems.findAll{it.request_access_attrss.size()}.collect{it.request_access_attrss.findAll{it.attributeName.toString().equalsIgnoreCase('location')}.collect{it.attributeValue}}[0][0]} 



If not, can you please let us know when exactly and how you would like to trigger your email ? This way we can give better insights.

Regards,

Adrien.

This message was previously posted on Saviynt's legacy forum by a community user and has been moved over to this forum for continued exposure.

Community_User
Saviynt Employee
Saviynt Employee
Originally posted on January 28 2021 at 13:06 UTC

Hi Adrien,


We have configured end point level email notification for upon Active Directory New Account task completion


Once the user is created & Active Directory account is assigned, then we are triggering email.



Thanks,

Sitarasmi

This message was previously posted on Saviynt's legacy forum by a community user and has been moved over to this forum for continued exposure.

Community_User
Saviynt Employee
Saviynt Employee
Originally posted on February 2 2021 at 10:54 UTC

Hi Adrien,


Please suggest how to handle null value in email templates


Thanks,

Sitarasmi

This message was previously posted on Saviynt's legacy forum by a community user and has been moved over to this forum for continued exposure.

Community_User
Saviynt Employee
Saviynt Employee
Originally posted on February 2 2021 at 11:31 UTC

Hi Sitarasmi,

Can you please send the email template that you want to insert so I can give you proper insights on which attribute you want to handle null values ?

Thanks,

Adrien.

This message was previously posted on Saviynt's legacy forum by a community user and has been moved over to this forum for continued exposure.

Community_User
Saviynt Employee
Saviynt Employee
Originally posted on February 2 2021 at 14:43 UTC

Hi Adrien,


PFB email template which we are using for joiner process.


User ID: ${user.systemUserName}

Employee ID: ${user.employeeid}

Start Date: ${user?.startdate.format("dd/MM/yyyy")}

User Name: ${user.firstname} ${user.lastname}

Email ID: ${user.email}

Line Manager: ${manager.firstname} ${manager.lastname}

Line Manager Email ID:${manager.email}

Contract Type: ${user.employeeType}

Business Unit: ${user.customproperty1}

Division: ${user.customproperty2}

Location:${user.location}
Role: ${user.customproperty4}


Here, Division & Role we are mapping with customproperties.Sometimes these values are blank & in email templates, we are getting null in that place.


Please guide how to resolve this.


Thanks,
Sitarasmi

This message was previously posted on Saviynt's legacy forum by a community user and has been moved over to this forum for continued exposure.

Community_User
Saviynt Employee
Saviynt Employee
Originally posted on February 2 2021 at 15:49 UTC

Hi Sitarasmi,

If you want to display something else than null values, you can user below code for role and Division :

Division: ${null!=user.customproperty2?user.customproperty2:'Empty}

Role: ${null!=user.customproperty4?user.customproperty4:'Empty'}

Best,

Adrien.

This message was previously posted on Saviynt's legacy forum by a community user and has been moved over to this forum for continued exposure.

Community_User
Saviynt Employee
Saviynt Employee
Originally posted on February 2 2021 at 16:24 UTC

Hi Adrien,


We want to display as blank only, instead of null or any other value.


Is there any way to achieve it ?


Thanks,

Sitarasmi



This message was previously posted on Saviynt's legacy forum by a community user and has been moved over to this forum for continued exposure.

Community_User
Saviynt Employee
Saviynt Employee
Originally posted on February 2 2021 at 16:30 UTC

Hi Sitarasmi,

Just remove "Empty" in above code to have resulting code :

Division: ${null!=user.customproperty2?user.customproperty2:''}

Role: ${null!=user.customproperty4?user.customproperty4:''}

Regards,

Adrien

This message was previously posted on Saviynt's legacy forum by a community user and has been moved over to this forum for continued exposure.

Community_User
Saviynt Employee
Saviynt Employee
Originally posted on February 2 2021 at 16:33 UTC

Hi Adrien,


I already tried with this, & email is not getting triggered if I am keeping this format.


Thanks.

Sitarasmi

This message was previously posted on Saviynt's legacy forum by a community user and has been moved over to this forum for continued exposure.

Community_User
Saviynt Employee
Saviynt Employee
Originally posted on February 2 2021 at 17:15 UTC

Hi Sitarasmi.

On my own it does work fine.

Are you able to catch some logs to see the error that would explain why email is not triggered ?

Regards,

Adrien.

This message was previously posted on Saviynt's legacy forum by a community user and has been moved over to this forum for continued exposure.

Community_User
Saviynt Employee
Saviynt Employee
Originally posted on February 8 2021 at 10:43 UTC

Hi Adrien,


We are getting parsing error in logs while using below format in email template. PFB logs.


Division: ${null!=user.customproperty2?user.customproperty2:''}




2021-02-08 10:37:15,962 [quartzScheduler_Worker-6] ERROR services.ArsTaskService - Error while sending email - Failed to parse template script (your template may contain an error or be trying to use expressions not currently supported): startup failed:

SimpleTemplateScript6732.groovy: 1: unexpected token: > @ line 1, column 794.

2?user.customproperty2:''<span>}<br></sp

^

1 error

groovy.lang.GroovyRuntimeException: Failed to parse template script (your template may contain an error or be trying to use expressions not currently supported): startup failed:

SimpleTemplateScript6732.groovy: 1: unexpected token: > @ line 1, column 794.

2?user.customproperty2:''<span>}<br></sp

^

1 error

at com.saviynt.utility.TemplateUtilityService.getSimpleTemplateString(TemplateUtilityService.groovy:48)

at com.saviynt.utility.TemplateUtilityService.getTemplateString(TemplateUtilityService.groovy:29)

at com.saviynt.ecm.services.ArsTaskService$_sendTaskCompletionEmail_closure153_closure306_closure308.doCall(ArsTaskService.groovy:12406)

at com.saviynt.ecm.services.ArsTaskService$_sendTaskCompletionEmail_closure153_closure306.doCall(ArsTaskService.groovy:12218)

at com.saviynt.ecm.services.ArsTaskService$_sendTaskCompletionEmail_closure153.doCall(ArsTaskService.groovy:12143)

at com.saviynt.ecm.services.ArsTaskService.sendTaskCompletionEmail(ArsTaskService.groovy:12140)

at com.saviynt.ecm.services.ArsTaskService$_completeAutoProvTasks_closure138.doCall(ArsTaskService.groovy:8680)

at com.saviynt.ecm.services.ArsTaskService.completeAutoProvTasks(ArsTaskService.groovy:8662)

at WSRetryJob$_processupgradedmultithreadedtasks_closure18.doCall(WSRetryJob.groovy:982)

at WSRetryJob.processupgradedmultithreadedtasks(WSRetryJob.groovy:968)

at WSRetryJob.execute(WSRetryJob.groovy:486)

at org.quartz.core.JobRunShell.run(JobRunShell.java:199)

at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:546)

2021-02-08 10:37:15,962 [quartzScheduler_Worker-6] DEBUG services.ArsTaskService - Error in sendTaskCompletionEmail :

groovy.lang.GroovyRuntimeException: Failed to parse template script (your template may contain an error or be trying to use expressions not currently supported): startup failed:

SimpleTemplateScript6732.groovy: 1: unexpected token: > @ line 1, column 794.

2?user.customproperty2:''<span>}<br></sp

^

1 error

This message was previously posted on Saviynt's legacy forum by a community user and has been moved over to this forum for continued exposure.

Community_User
Saviynt Employee
Saviynt Employee
Originally posted on February 9 2021 at 17:39 UTC

Hi Sitarasmi,

From what I'm able to see, the code is wrongly written as you add <span> tag into, after having closed the single quotes where you want that empty value.


${null!=user.customproperty2?user.customproperty2:''<span>}....

Please try something like below instead, putting the <span> tag out of ${} data which is where you pass parameters, to fix your unexpected token exception (which is not a "feature" related issue, but more about how to properly write inside html code)


${null!=user.customproperty2?user.customproperty2:''}<span>....


Regards,
Adrien.

This message was previously posted on Saviynt's legacy forum by a community user and has been moved over to this forum for continued exposure.

Community_User
Saviynt Employee
Saviynt Employee
Originally posted on February 11 2021 at 11:59 UTC

Hi Adrien,


Thanks a lot for figuring this out. It working now.


Regards,

Sitarasmi

This message was previously posted on Saviynt's legacy forum by a community user and has been moved over to this forum for continued exposure.