Hi - I'm working on migrating many native JSM automations (which were configured by a predecessor of mine - so I don't always have the context) into JMWE. I have one still relatively high use rule that I haven't yet figured out how to properly configure in JMWE.
The automation appears relatively simple. It's running hourly, and editing an issue field called "Response SLA Time". That field appears to be just a calculation of how long it took to make first response on an issue (but it factors in whatever SLA rules are configured, to discount weekends/off work hours, etc).
The native JSM automation just has this as the value to set:
{{time to first response.completedCycles.elapsedTime.friendly}}
The field "time to first response" is a count down, showing how much time remains on the SLA. So, say the priority/project/organization on the issue warrants an 8 hour SLA, this value starts at 8, and goes down to 0 and then into the negatives if the SLA is exceeded (also that count down pauses whenever outside of the defined business hours as applicable per SLA).
The field "Response SLA Time" is calculating the inverse of that time to first response. So for instance, if "time to first response" is 7:50, that means the case was responded to in 10 minutes, and the old automation would populate "Response SLA Time" with "10m".
This new value is in turn being used in some reports and fed to extracts that populate some dashboards and other visualizations about SLA attainment and such.
How do I translate:
{{time to first response.completedCycles.elapsedTime.friendly}}
into something JMWE can use in the Set Issue Fields post function for the field "Response SLA Time"?
have you tried this?
{{issue.fields["time to first response"].completedCycles.elapsedTime.friendly}}
I hadn't, but tried it now.
It runs, and appears in the JMWE logs as INFO status, no failures noted, but doesn't appear to perform the expected update.
I have an "If Scope" Target issues JQL set in the JMWE Event-based action like this:
project = "The Actual Project in Question" AND "Response SLA time[Short text]" IS EMPTY AND reporter in (myself)
I tested that JQL in a filter separately, and the issue I'm using to test does come up as expected.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Can you just "Test" the script using the "Test Nunjucks template" button while editing your event-based action against an issue that has a value for that "time to first response" SLA field?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Did try that, it responds just with: Your template ran successfully
(no True or False as I've seen when testing other scripts)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sorry, my bad, the syntax is:
{{ issue.fields['Time to first response'].completedCycles | last | field('elapsedTime.friendly') }}
Make sure you replace "Time to first response" with the exact name (case-sensitive) of the SLA field.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
that looks promising! I got "4m" as my test result this time. Have it scheduled to run in about 5 minutes and we'll see if it catches this test case this time. Assuming so - I'll then remove the boundaries I put to keep it to just my test case.
Thank you @David Fischer !
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.