Hi,
I am trying to create a Smart Value with all the watchers to send an email but I want to make sure the initiator is not included. So I created a Smart Value where I use the following expression
{{#issue.watchers}} {{#if(initiator.displayName.eq(displayName),' ',{{emailAddress}})}} {{/}} {{/}}
But the Smart Value comes back empty.
How can I check each item on an array and create another array only with the items that didn't matched the if condition?
I believe that the #if syntax only works for numbers and not for strings. And, I do not believe you can nest smart values with multiple curly-brackets.
Instead you can solve your problem using strings and the Join and Remove functions:
How does this work...
Best regards,
Bill
Hi @Bill Sheboy ,
Thanks so much for your help, this information was super helpful. I was able to remove the initiator by:
Adding a ; at the end of the join.
Then proceed to remove the initiator including a ; at the end as well.
But I still have one ; at the end of the string and I haven't been able to remove that ;, I can't leave it because it's causing an error when sending the email.
Smart value watchers:
{{issue.watchers.emailAddress.join(";").concat(";").remove(initiator.emailAddress.concat(";"))}}
Is there a way to do this, I tried to save the length of this smart value in another and the use the left function to return the string minus the last character but it's not working.
Smart value watcherslen:
{{#=}} {{watchers.length()}} - 1{{/}}
Smart value emails:
{{watchers.left(watcherslen)}}
But the emails returns blank. Any ideas on how to remove the last character of a string?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I couldn't get this to work with the join operation, but using the below format worked for me!
{{issue.watchers.emailAddress.remove(initiator.emailaddress)}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.