Unable to insert date variable into date field

Deleted user December 13, 2022

I am attempting to automatically get the Start Date from the description for new staff, this does successfully retrieve the date and works when I'm commenting the variable, however the variable doesn't work with the Start Date field.

 

I have attempted to paste the commented date into the Start Date field and that works fine.

Untitled.png

2 answers

1 accepted

0 votes
Answer accepted
Carlos Faddul
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 13, 2022

Hi @[deleted] , can you share a example of description that you are using ?

Maybe the format the in the Jira are wrong or maybe the description have some wrong format to match.

Deleted user December 13, 2022

You can see the description at the bottom-right of my screenshot, it is

"Start Date: 15/12/2022

TEST"

Carlos Faddul
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 14, 2022

Hello @[deleted] 

I recorded a video/tutorial to help you to solve this.

I apologize for my bad english to speak

https://youtu.be/aRxAXZ7m0TU

But if you don't want to see the video, you just need one action that is to convert your variable (text) to Date then set in the correctly desirable field

I hope I helped you.

If this post was helpful, mark it as "Accept Answer" , so you can help others who may have the same difficulties.

If your question has not been resolved, please post again with more details.

Deleted user December 14, 2022

Hi @Carlos Faddul ,


That video was brilliant, thank you for your help, however it didn't fix the issue. I've pasted my audit log alongside my Automation configuration.

Untitled.png

Carlos Faddul
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 15, 2022

@[deleted]

I run the automation like your automation and the automation runs without problems, follow the json file

{
"cloud": true,
"rules": [
{
"id": 9567540,
"clientKey": "1970ac34-1f27-35b3-b5e4-1b83c6409f94",
"name": "Community Date Convert",
"state": "ENABLED",
"description": "https://community.atlassian.com/t5/Jira-Software-questions/Unable-to-insert-date-variable-into-date-field/qaq-p/2216037?utm_source=atlcomm&utm_medium=email&utm_campaign=immediate_general_answer&utm_content=topic&lightbox-message-images-2216037=230357iFEF26DF132AA3000",
"authorAccountId": "5a871346cad06b3537342818",
"actor": {
"type": "ACCOUNT_ID",
"value": "557058:f58131cb-b67d-43c7-b30d-6b58d40bd077"
},
"created": 1671065392688,
"updated": 1671114221023,
"trigger": {
"id": "195670657",
"component": "TRIGGER",
"parentId": null,
"conditionParentId": null,
"schemaVersion": 1,
"type": "jira.jql.scheduled",
"value": {
"schedule": {
"cronExpression": "",
"method": "BASIC",
"rate": 0,
"rateInterval": 86400,
"rRule": "BEGIN:VEVENT\nDTSTART;TZID=America/Sao_Paulo:20221214T204553\nRRULE:FREQ=WEEKLY;BYHOUR=9;BYMINUTE=0;BYSECOND=0;BYDAY=WE;INTERVAL=1\nEND:VEVENT\n"
},
"jql": "key = EK-1129",
"executionMode": "jql",
"onlyUpdatedIssues": false
},
"children": [],
"conditions": [],
"connectionId": null
},
"components": [
{
"id": "195670658",
"component": "ACTION",
"parentId": null,
"conditionParentId": null,
"schemaVersion": 1,
"type": "jira.create.variable",
"value": {
"id": "_customsmartvalue_id_1671064636412",
"name": {
"type": "FREE",
"value": "StartDate"
},
"type": "SMART",
"query": {
"type": "SMART",
"value": "{{issue.description.match(\"Start Date:\\s(.*)\")}}"
},
"lazy": false
},
"children": [],
"conditions": [],
"connectionId": null
},
{
"id": "195670659",
"component": "ACTION",
"parentId": null,
"conditionParentId": null,
"schemaVersion": 1,
"type": "codebarrel.action.log",
"value": "StartDate - {{StartDate}}",
"children": [],
"conditions": [],
"connectionId": null
},
{
"id": "195670660",
"component": "ACTION",
"parentId": null,
"conditionParentId": null,
"schemaVersion": 1,
"type": "jira.create.variable",
"value": {
"id": "_customsmartvalue_id_1671065001299",
"name": {
"type": "FREE",
"value": "StartDateFormat"
},
"type": "SMART",
"query": {
"type": "SMART",
"value": "{{StartDate.toDate(\"dd/MM/yyyy\")}}"
},
"lazy": false
},
"children": [],
"conditions": [],
"connectionId": null
},
{
"id": "195670661",
"component": "ACTION",
"parentId": null,
"conditionParentId": null,
"schemaVersion": 10,
"type": "jira.issue.edit",
"value": {
"operations": [
{
"field": {
"type": "ID",
"value": "duedate"
},
"fieldType": "duedate",
"type": "SET",
"value": "{{StartDateFormat}}"
}
],
"advancedFields": null,
"sendNotifications": true
},
"children": [],
"conditions": [],
"connectionId": null
},
{
"id": "195670662",
"component": "ACTION",
"parentId": null,
"conditionParentId": null,
"schemaVersion": 1,
"type": "jira.issue.comment",
"value": {
"comment": "{{StartDateFormat}}",
"publicComment": false,
"commentVisibility": null,
"sendNotifications": true,
"addCommentOnce": false
},
"children": [],
"conditions": [],
"connectionId": null
}
],
"canOtherRuleTrigger": false,
"notifyOnError": "FIRSTERROR",
"projects": [
{
"projectId": "10029",
"projectTypeKey": "software"
}
],
"labels": [],
"tags": [
{
"id": 19798714,
"tagType": "IS_RULE_UPDATED",
"tagValue": "true"
}
],
"ruleScope": {
"resources": [
"ari:cloud:jira:a94c6a97-c44c-49bd-a6f6-d6dbab8ce06b:project/10029"
]
},
"writeAccessType": "UNRESTRICTED",
"collaborators": []
}
]
}
Like # people like this
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 15, 2022

@[deleted] when you create the StartDateFormat variable you have a period between the words Start and Date, creating a null value rather than the value you expected...and...to then use a mask you must use the format() function.

Untitled.png

Like Deleted user likes this
Deleted user December 15, 2022

It works, thank you both for helping me with this issue!!

Like Bill Sheboy likes this
0 votes
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 14, 2022

Hi @[deleted] 

Created variables are text type, and you can set them in a date or date/time field by converting with toDate, such as with this:

{{StartDate.toDate}}

Kind regards,
Bill

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events