Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

JSM Automation - Problem with 'For each: Smart value'

Steven Lees-Smith June 1, 2022

Hi there,

I have an automation rule in place that checks maintenance end dates from Insight and sends an email with some information.

The problem is I want to add the details to one email and then have it sent off, currently what is it doing is sending an email 'per' line so I end up with a heap of emails.

I have a check for the lookupObjects.size being greater to 0, then a for each: smart value {{ObjectList}} to send an email which I get is doing what it should, but I just want them all in the one email.

What do I need to tweak to have all the info listed in the email body then send to the recipients.

thanks.

1 answer

1 accepted

0 votes
Answer accepted
Fabian Lim
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 1, 2022
Steven Lees-Smith June 1, 2022

Nice, heading there right now - will loop back with questions if you don't mind.

Steven Lees-Smith June 1, 2022

@Fabian Lim Hmmm, I sort of have something happening but not quite.

I used this in the content for the send email (remembering I am pulling values from Insight)

{{#lookupObjects}}
{{ObjectList.Product Name}} - {{ObjectList.Quantity}} - {{ObjectList.Maint End Date}}
{{/}}

Now I get an email containing the right amount of lines, but the email is just fill of

- -

AND I an getting that email for the same number of items.  So it is adding something to the body of the email, but also sending the email on repeat.

Fabian Lim
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 2, 2022

Looks like you are using the wrong smart value syntax. You should be using lookup objects instead.

Link: https://support.atlassian.com/cloud-automation/docs/jira-smart-values-insight/#SmartvaluesInsight-Lookupobjects

Steven Lees-Smith June 2, 2022

hmmm I use ObjectList. as the step before has Advanced Branching that has the smart value of {{lookupObjects}} and it is turned into the ObjectList variable.  Other send emails I have where I don't need to loop through the results all work like this.

 

I'll check the link to see if there is something else wrong.  The email is still being sent dozens of times also so I think the automation is wrong in general somewhere.

MaintenanceExpiry.JPG

Steven Lees-Smith June 2, 2022

@Fabian Lim   I have this working now using this;

 

{{#lookupObjects}}
* {{Product Name}} - {{Quantity}} - {{Maint End Date}}
{{/}}

 

BUT, I still get an email with all the combined output for each item.  So my test returns 15 lines in the email, but I get that 15 times?!

Fabian Lim
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 3, 2022

I think the for each object component is causing it to go 15:times. You should remove it.  

Like Steven Lees-Smith likes this
Steven Lees-Smith June 7, 2022

yep makes perfect sense when you see it written out?!

 

Thanks, of course if it is doing that same thing for each returned instance it was going to email that many times - all good now and only sending the one email.

Like Fabian Lim likes this
Fabian Lim
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 7, 2022

Make sure you accept the answer this one is a very good example that others can use.  

Like Steven Lees-Smith likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events