Trying to use smart values to pull email attribute from Insight

Scot Michael Hirschman June 9, 2021

Good morning,

 

What Smart value would I use to pull the email attribute I have created for each object?

I have tried both {{object.email}}, {{attribute.email}} {{object(attribute.email)}} but to no avail. Does some have the right format for this?

 

Thanks

2 answers

1 accepted

0 votes
Answer accepted
Alex van Vucht (GLiNTECH)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 10, 2021

For this question, I will assume you have a "User" object type with these attributes:

  1. Name: default Text type attribute
  2. Email: Email type attribute
  3. Manager: User type attribute
  4. Atlassian User Account: User type attribute

Let's assume you also have a "Reporter Object" custom field of type Insight Object/s. This should have an IQL scope along the lines of "objectType = User"

Tip: Until Atlassian returns the Assign IQL custom field feature, you can use an automation to assign the Reporter Object automatically:

  1. When Value changes for Reporter:
  2. Edit issue:
    • Reporter Object: User = {{issue.reporter}}

This is required for the Manager automation below. Ensure the "Allow this rule to be triggered by other rules" checkbox is ticked. 

Let's discuss how to access the Email type attribute. There are now two types of rules in Insight for Jira cloud:

  1. Insight object rules: these are the new "When object changes" rules. Use {{object.Email}}
  2. Issue rules: for these, you must use Insight custom fields. So you'd use {{issue.Reporter Object.Email}}

Right now, you cannot access the emailAddress property on User type attributes. So this works:

  • {{issue.reporter.emailAddress}}
  • {{issue.Reporter Object.Email}} because this is accessing the Email attribute on the User object type.

These are blank:

  • {{object.Atlassian User Account.emailAddress}}
  • {{object.Manager.emailAddress}}
  • {{issue.Reporter Object.Manager.emailAddress}}

For issue rules, this can be worked around by:

  1. Create a "Line Manager" customfield of type User (single).
  2. Adding to the Reporter Object rule above:
    1. Re-fetch issue data
    2. Edit issue:
      • Line Manager: {{issue.Reporter Object.Manager}}

Now you can use {{issue.Line Manager.emailAddress}}

This workaround for Insight Object rules is extreme:

  1. When object changes
  2. If objectType = User
  3. Create an issue with:
    • Summary: Insight User Email Address workaround
    • Reporter: {{object.Atlassian User Account}}
  4. "For Most Recently Created Issue" branch:
    • Do what you need to do, eg. save the email address elsewhere or send an email, with {{issue.reporter.emailAddress}}. Attributes in the original updated object are still available
    • Then Permanently delete this issue

In my tests, Automation complained about creating the issue took too long, so the Add Comment to Issue didn't take effect, so this mightn't work after all.

Not being able to access the emailAddress property of User attributes is probably just an oversight on Atlassian's part, as you can access accountId, ie. {{object.Manager.accountId}} works. I've raised a support request to address this but Atlassian works on their schedule, not ours.

Scot Michael Hirschman June 11, 2021

Thanks @Alex van Vucht (GLiNTECH) 

 

I appreciate the detailed response. This definitely helps me and I am now able to use the user email through a smart value!

 

Thanks!

 

Scot

Alex van Vucht (GLiNTECH)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 23, 2021

FYI, Support raised [JSDCLOUD-10088] Object smart value for "User" doesn't return User email address. regarding being unable to access the emailAddress property of User type attributes of objects in Insight Cloud.

Like Scot Michael Hirschman likes this
0 votes
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 9, 2021

Hi @Scot Michael Hirschman 

As a disclaimer, I am not using Insight, so my advice is about checking if the smart values are supported...

There are several open suggestions to add more Insight field support (link to Code Barrel backlog).  Until more are added, you could use an example issue with your fields and call the REST API to see if the smart values are present.  Here is the how-to article for that method:

https://support.atlassian.com/jira-software-cloud/docs/find-the-smart-value-for-a-field/

Best regards,

Bill

Scot Michael Hirschman June 11, 2021

Thanks @Bill Sheboy

 

This definitely let me test a few smart values which is really nice to see what works and what doesn't. 

 

Thanks!

 

Scot

Like Bill Sheboy likes this

Suggest an answer

Log in or Sign up to answer