I am setting up an automation to sync or copy date fields between a Jira Discovery (JDP) project and JSM project.
So far, I am able to successfully sync the date from the JSM to JDP, but encountering issues when trying to sync from JDP to JSM
JSM FieldName : Deadline // customfield_11307
JDP FieldName : Deadline DP //customfield_11308
I understand that date field in JDP is 'actually an array of two text values representing dates (start & end)' therefore we cannot use JIRA date field on JDP, so I created JDP global field 'Deadline DP'. If there is a supported method to use a standard Jira date field directly within JDP, please do correct me.
Below is the automation for JDP -> JSM, I have separate working rule for JSM-> JDP.
trigger: Value changes
branch: for linked issues
Log action: Extracted start: {{triggerIssue.customfield_11308.substringBetween("start\":\"","\",\"end")}}
edit issue:
{
"fields": {
"customfield_11307": "{{triggerIssue.customfield_11308.substringBetween(\"start\":\"\",\"\",\"end\")}}"
}
}
Log action shows extracted date, but fails to update JIra field
I have tried other options like:
{
"fields": {
"customfield_11307": "{{triggerIssue.customfield_11308.match(\"\\\"start\\\":\\\"(.*?)\\\"\").get(0)}}"
}
}
Audit log:
Error editing issues
TP-218 (The Deadline must be of the format "yyyy-MM-dd" (customfield_11307))
Issues edited successfully
TP-218
Any help or clarification is appreciated.
Thanks,
Sushil
Your JSON expression likely has problems due to the nested, double-quotation marks.
The JPD date format is JSON stored as text, and with the recently added jsonStringToObject() function the values may be extracted:
For example:
{{jsonStringToObject(issue.customfield_12345).start}}
That value will be text. When you need an actual date / time value, add toDate at the end of the expression.
Kind regards,
Bill
Thanks for the help Bill, it worked.
{
"fields": {
"customfield_xxxx": "{{jsonStringToObject(triggerIssue.customfield_yyyy).start.toDate}}"
}
}
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.