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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,644,562
Community Members
 
Community Events
196
Community Groups

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

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.
Jun 01, 2022

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

@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.
Jun 02, 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

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

@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.
Jun 03, 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

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.
Jun 07, 2022 • edited

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