EndTime : {{#=}}({{issue.customfield_10590.convertToTimeZone('UTC').toMillis}} +(({{issue.customfield_10592}} + 1) * 3600 * 1000)).toDate{{/}}
issue.customfield_10590 : is the start time in datetime format
issue.customfield_10592 : is the hours in string/number format that I want to pass as an end time in a post web request call for a third-party integration.
right now when I am passing Endtime as a custom variable to the main custom body I am getting this error
Your outgoing web request configuration is invalid. Please fix the following errors and try again. Invalid smart value expression in custom body, please see smart values in our documentation for help with syntax.
please help me on this one.
Full Custom Body
{ "data": { "type": "downtime", "attributes": { "scope": "*", "monitor_identifier": { "monitor_tags": ["******"] }, "display_timezone": "Asia/Kolkata", "message": "Message about the downtime", "mute_first_recovery_notification": false, "notify_end_states": [ "alert", "warn" ], "notify_end_types": [ "canceled", "expired" ], "schedule": { "end": "{{EndTime}}", "start": "{{issue.customfield_10590.convertToTimeZone('UTC')}}" } } } }
Hi @Salil Sekhar -- Welcome to the Atlassian Community!
What does your customfield_10592 contain? Is it:
If it is the first one, please try using one of the plus functions to increment the start date: https://support.atlassian.com/cloud-automation/docs/jira-smart-values-date-and-time/#Date-plus-unit---
If it is the second one, please try using one of the with functions to set the time of day: https://support.atlassian.com/cloud-automation/docs/jira-smart-values-date-and-time/#Date-with-attribute---
If it is something else, please clarify what problem you are trying to solve. Thanks!
Kind regards,
Bill
@bill : thanks for the reply, the customfield_10592 is of type "options: and is basically telling the exact hours by which we have to create an end time example: if the startTime (customfield_10590) is on DEC 19 2022 11:00 PM, the endTime should be at 6 hours + 1 hour (by default) DEC 20 2022 6:00 AM.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
i need to add the value present under customfield_10592 as an hour in the datetime and make it an end time.
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.
To use the values of the select option field in a rule, it is accessed with the value attribute: {{issue.customfield_10592.value}}
That is a text value. As you want to use that as a number, add a conversion: {{issue.customfield_10592.value.asNumber}}
However, I am still confused by the example you provided...
Do you want to add the hour value:
{{issue.customfield_10590.convertToTimeZone("UTC").plusHours(issue.customfield_10592.value.asNumber)}}
Or set the time attribute to that hour:
{{issue.customfield_10590.convertToTimeZone("UTC").withHour(issue.customfield_10592.value.asNumber)}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Start time (customfield_10590) : 2022-12-19T09:30:00.000-0800
NAVSRO - Maintenance Window Duration (Hours) (customfield_10592) : "6"
End Time : {{issue.customfield_10590.convertToTimeZone("UTC").plusHours(issue.customfield_10592.value)}} i.e. 2022-12-19T15:30:00.000-0800
This is what I want.
but I have tried this one out what you have pasted.
it gives me an error:
this is how I am trying to run it , "start" is perfectly getting picked but not the "end"
"end": "{{issue.customfield_10590.plusHours(issue.customfield_10592.value)}}+00:00",
"start": "{{ issue.customfield_10590.format("yyyy-MM-dd'T'HH:mm:ss") }}+00:00"
This is the exact format in which I want the dateime in the body :
"2024-08-17T16:00:00+00:00"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I recommend adding the hours to the start date / time, and then using the built-in or the format() function to set the value rather than trying to concatenate the text:
https://support.atlassian.com/cloud-automation/docs/jira-smart-values-date-and-time/#Date-format---
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
already tried this one as well, but that didn't work:
"start": "{{issue.customfield_10590.format("yyyy-MM-dd'T'HH:mm:ssZ")}}"
also I tried jiraDateTime but even that's not supported as it's coming like this :
"start": "2024-04-17T16:00:00+0000" which Is not supported.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Please try writing these to the audit log to see if they match what you expect:
start date / time: {{issue.customfield_10590}}
value to add: {{issue.customfield_10592.value}}
incremented date / time: {{issue.customfield_10590.plusHours(issue.customfield_10592.value)}}
After you confirm the math is working, then you can focus on the formatting.
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.
Thanks...Now adjust that last one to convert the text to a number:
{{issue.customfield_10590.plusHours(issue.customfield_10592.value.asNumber)}}
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.
This was quick! 🤩
Final working piece :
"end": "{{issue.customfield_10590.plusHours(issue.customfield_10592.value.asNumber).plusHours(1).format("yyyy-MM-dd'T'HH:mm:ss")}}+00:00",
"start": "{{ issue.customfield_10590.format("yyyy-MM-dd'T'HH:mm:ss") }}+00:00"
you are a rock star @Bill Sheboy 👍👌
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Awesome; I am glad we got it working!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.