Updating custom field with Automation and SmartValues

Rob Peterson
Contributor
November 16, 2021

I've created a custom variable for my rule to parse the numerical value from the initiating issue key so that I can then later use in a mathematical operation to assign either tasks or sub-tasks based on the value.

My SmartValue is updating correctly however when I try to populate into the custom field, I get an error: "Operation value must be a string".  I've placed debug into the code as well and it clearly shows that the end result is a string.

2021-11-16_110426.png

Code in Advance Automation section (for first issue create):
{
"fields": {
   "Parent Link": {
      "value": {{#debug}}"EI-{{#=}}{{NumericalKey}}+1{{/}}{{asJsonString}}"{{/}}
  }
}

 

Any recommendations?

2 answers

1 accepted

0 votes
Answer accepted
Rob Peterson
Contributor
November 18, 2021

Move the automation queue to start with the Story instead of the Epic.

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.
November 16, 2021

Hi @Rob Peterson 

Would you please post an image of your complete rule?  That may provide more context to offer ideas.  Thanks!

And also, that advanced edit expression you show seems incorrect.  You are using a math expression to increment a created variable (apparently), and then treating the asJsonString function as if it was a smart value.  Perhaps instead try building the expression in a variable and then using the function.  For example:

  • set a variable (e.g. varNewKey) to EI-{{NumericalKey.asNumber.plus(1)}}
  • and then run the function on that: {{varNewKey.asJsonString}}

Kind regards,
Bill

Rob Peterson
Contributor
November 16, 2021

Thanks @Bill Sheboy . 

Yeah, I threw in the asJsonString to see if it would force the end result as a string.  If removed, it still provides the same error.

Complete rule:
2021-11-16_154702.png

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.
November 16, 2021

Thanks for that info.  Perhaps try logging that created variable after it is set to learn if it contains what you expect.

Two more things:

Re-fetch can help slow down a rule after the create issue trigger, or to reload data after an edit.  How are you using that action in this rule?

What type of project is this: company-managed or team-managed?  I believe setting the Parent Link this way is not supported for team-managed projects yet via the REST API (and so not by rules either).

Rob Peterson
Contributor
November 18, 2021

So, in short, no joy.  I've moved the automation to start upon the creation of the Story instead of the Epic.  At that point, I am able to cascade the required tasks that I need for the project data points including the association of the parent link.  Thanks @Bill Sheboy  for your assistance!

Like Bill Sheboy likes this

Suggest an answer

Log in or Sign up to answer