How can I ensure quality smart values that are complex?
Asked by Hans Polder:

In [this thread](https://community.atlassian.com/t5/Jira-questions/How-to-set-the-status-of-Parent-Issue-based-on-the-statuses-of/qaq-p/2772641?utm_source=atlcomm&utm_medium=email&utm_campaign=mentions_reply&utm_content=topic) [@Bill Sheboy](/t5/user/viewprofilepage/user-id/1685313) stated some suggestions about maybe using Notepad++ to help build more complex smart values like

```
{{#=}}0{{#lookupIssues}}{{#if(equals(status.name,"In-Progress"))}}+1{{/}}{{/}}{{/}}
```

Bill, could you maybe go a bit more in specifics? Which Notepad++ plugin(s) do you use for this? I tried finding something about 'expressions' in my Visual Studio Code but couldn't really find the extension there. Also, I wouldn't know which 'programming language' to select in my VSC to get the right formatting. I tried json and xml but those just return errors.

Any help would be appreciated!


Answers:
author: Bill Sheboy
body: Hi [@Hans Polder](/t5/user/viewprofilepage/user-id/5506451)

Currently, I am only using JSON plugins with Notepad++ to help with rule writing, expression validation.

There have been improvements over time in the validation of rules during edit, such as these recent ones:

* <https://community.atlassian.com/t5/Automation-articles/New-Improvements-for-Jira-and-Confluence-Automation/ba-p/2744140>
* <https://community.atlassian.com/t5/Automation-articles/Smart-Values-Help-Panel-is-here-for-Jira-Automation/ba-p/2691649>

IMO, these new features need additional work / validation testing. I recall other suggestions to add autocomplete to the rule editor for smart value expressions, but given the dynamic nature of rule scope's impact on smart values, I hypothesize that would cause further performance problems in the editor.

Several community members have suggested creating VS Code extensions to create another rule editor, and which would allow better version management of rules (via source control tools). At this time, I do not believe there is a public REST API which would enable such capabilities. Here is the suggestion to add those endpoints: <https://jira.atlassian.com/browse/AUTO-51>

Others such as [@Darryl Lee](/t5/user/viewprofilepage/user-id/1365322) have tried to help with documentation and rule parsing outside of Jira: <https://community.atlassian.com/t5/Automation-articles/Hacking-Parsing-Automation-Rules-with-JSON-for-Fun-and-Profit/ba-p/1984033>

I welcome learning others' thoughts on such improvements to the rule editor, or perhaps external tooling to help automation writers. Thanks!

Kind regards,  
Bill

comments: author: Hans Polder
body: Thanks for all the tips [@Bill Sheboy](/t5/user/viewprofilepage/user-id/1685313) !

I've bookmarked some of the pages you've suggested including the current one - I'll dive into it some more once I get around to it.

I'm wondering what the differences are between your setup (notepad++ with JSON plugin) and my setup (using VSC). For instance, the script you shared in the linked topic shows red/with problems in VSC:

![Screenshot 2024-08-05 083128.png](https://community.atlassian.com/t5/image/serverpage/image-id/339935iD902F061CAEEC732/image-size/large?v=v2&px=999 "Screenshot 2024-08-05 083128.png")


author: Bill Sheboy
body: Sorry I was not more clear, as I am only using the JSON plugin to help check formatting but *not the automation syntax*. It appears you are getting better highlighting results with VS Code than I was with Notepad++.

I have seen others in internet posts describe using other language plugins which support mustache syntax to help, but none are a good fit for the Atlassian Automation language: as far as I can tell it both extends and varies from the mustache specs I have found.

Last year I considered writing an old-school, BNF spec for the language, feeding that to a canned parser to build a plugin, but never got back to it. Maybe I'll get back to that this year :\^)


author: Hans Polder
body: Hey Bill,

Thanks again. I'll at least try putting it in VSC for now, to check for obvious errors (and ignore some of the problems shown already).

And, I'll likely follow your replies to see where you're using these more complex statements to store them for later.

I know what I'll put on my Christmas letter to Santa this year! ;-)


author: Bill Sheboy
body: Have you tried the community feature to *Bookmark* posts under the ... menu next to post heading? Bookmarks will store them in a list accessible from your profile avatar at the top-right of the page.

That may help when tracking useful smart value expressions to provide context and explanation for them.


author: Hans Polder
body: Hey [@Bill Sheboy](/t5/user/viewprofilepage/user-id/1685313) ,

Yes, I've been using that already - bookmarked this page already! :)


Tags: automation

cloud

jira-cloud

smart-value