How to use automation to populate a custom date field
Asked by Kristi Shaw:

I am trying to set up an automation rule that will sync the Target end date (a custom date field) if it changes in the epic, with the same field in its child issues. But when I run the rule, I get this message in the audit log for each child issue:   
CED-XXXX (The Target end must be a string (customfield_11548))  

I set up my rule as follows:

- When Value Changes for "Target End" (trigger) \<---this step passes

- If IssueType = Epic \<----this step also passes

- Create variable with Variable Name EpicTargetEnd, smart value {{customfield_11548.value}}

- Branch for children of the epic

- Edit issue fields using this jql:

{  
"fields": {  
"customfield_11548": {"value": "{{customval}}"}  
}  
}

Can anyone tell me where I've gone wrong?

Note: I've also tried to use the solution in the comments of [this thread](https://community.atlassian.com/t5/Jira-Product-Discovery-questions/Automation-to-Sync-Dates-Between-an-Initiative-in-JIRA-Software/qaq-p/2212438#M1268)

but that doesn't work either, I then get the audit log message "(The Target end must be of the format "yyyy-MM-dd" (customfield_11548))"


Answers:
author: Kalyan Sattaluri
body: Hello [@Kristi Shaw](/t5/user/viewprofilepage/user-id/5436403)

Welcome to the community.

I understand you want to sync Target End date field from Epic to children, BUT, can you confirm that you have that field (Target End) available in your issues under the epic?

Or is it the "Due Date" field which you want the "Target End" field to sync over. Just wanted to confirm..

For example: if it is in fact Target End field, you could use below:

{  
"fields": {  
"Target End": "{{triggerissue.Target End}}"  
}  
}

OTOH, if you want to sync it to Due Date, you would use below:

{  
"fields": {  
"Due Date": "{{triggerissue.Target End}}"  
}  
}

BTW, as you can see, you dont need the variable before branch to store the date, you can directly reference the epic's target date like above..

I have attached a screenshot of how it should look like, please try and let us know if issues. Please share screenshots of your rule and audit log if some thing does not work so we can help.

![image.png](https://community.atlassian.com/t5/image/serverpage/image-id/308237iF8C26D86F3C0BF12/image-size/large?v=v2&px=999 "image.png")

comments: author: Kristi Shaw
body: This worked perfectly, thank you!


author: Jason M_
body: In the solution you mentioned, you mean you tried appending *.jiraDate* to the variable? Have you tried appending the suggested format to it?

```
.toDate("yyyy/MM/dd")
```

or

```
.toDate("yyyy-MM-dd")
```

comments: author: Kristi Shaw
body: ```
{
"fields": {
"customfield_11548":"{\"start\":\"{{triggerIssue.customfield_11548.jiraDate}}\",\"end\":\"{{triggerIssue.customfield_11548.jiradate}}\"}"
}
}
```

Above is what I used. Are you suggesting instead to replace *jiraDate*with the format instead, like this?

```
{
"fields": {
"customfield_11548":"{\"start\":\"{{triggerIssue.customfield_11548.toDate("yyyy-MM-dd")}}\",\"end\":\"{{triggerIssue.customfield_11548.toDate("yyyy-MM-dd")}}\"}"
}
}
```

I did try that and got the same error. I'm relatively new to automation and this is advanced logic for me, so thanks for your patience if I'm misunderstanding something.