I am trying to integrate Jira with another system and the integration does not allow me to directly integrate the estimates (Original, Remaining, Spent) so I have copied the values into their own custom fields. I can set the original and remaining estimates fine but not the time spent.
I am using JMWE to automate and found a build your own (scripted) post function that allows me to set the time spent to a fixed amount
{{ "/rest/api/2/issue/:issue/worklog" | callJira(verb=("post"), params={"issue":issue.key},
body={
"timeSpent": "1h"
}
) | dump(2) }}
This works fine except I want to use the value of the custom time spent field {{ issue.fields.customfield_10172 }} to set the value.
I have tried to insert this as the following but
"timeSpent": "{{ issue.fields.customfield_10172 }}h"
"timeSpent": {{ issue.fields.customfield_10172 }}"h"
Does anyone have an idea of what to try next?
Thanks
Hi @Annika ,
What is the problem you are encountering with that attempt?
Also, what is the field type of customfield_10172 ?
Hi David
Thanks for your response - I referenced the wrong custom field in my
If I put the customer field in front of the '' ''
{{ "/rest/api/2/issue/:issue/worklog" | callJira(verb=("post"), params={"issue":issue.key},
body={
"timeSpent": {{ issue.fields.customfield_10174 }}"h"
}
) | dump(2) }}
then the error I get is
(string) [Line 3, Column 16] parseAggregate: expected colon after dict key
And if I put it inside of the ""
{{ "/rest/api/2/issue/:issue/worklog" | callJira(verb=("post"), params={"issue":issue.key},
body={
"timeSpent": "{{ issue.fields.customfield_10174 }}h"
}
) | dump(2) }}
then the response is
(string) Error: Unexpected response: 400 Worklog must not be null. timeLogged: Invalid time duration entered.
I am sure it is a syntax error and I have tried googling but no luck.
Hope you can help :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Annika
actually, the correct syntax is:
{{ "/rest/api/2/issue/:issue/worklog" | callJira(verb=("post"), params={"issue":issue.key},
body={
"timeSpent": issue.fields.customfield_10174 + "h"
}
) | dump(2) }}
I believe this should work, although there might still be a conversion problem between number and string.
David
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.