Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Project Automation JSON script Error

Dolly Kirubavathi
Contributor
March 3, 2022

I have this JSON script under Additional Fields in Project Automation (for Cloning project):

{
"update": {
"labels": [{
"add": "cloned"
}],
"fields": [{
"customfield_12903": "{{triggerIssue.customfield_12903}}"
}],
"issuelinks": [{
"add": {
"type": {
"name": "Cloners"
},
"outwardIssue": {
"key": "{{issue.key}}"
}
}
}]
}
}

 

 

When I try to publish the rule, I get this error:

Additional fields contains invalid field(s) in 'update' or 'fields' section: fields

 

the customfield_12903 is present in both projects.

1 answer

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.
March 4, 2022

Hi @Dolly Kirubavathi 

What is the type of your customfield_12903? The syntax you are trying works for a plain text field, so if it is something else please check the examples in the documentation for any missing attributes: https://confluence.atlassian.com/automation/advanced-field-editing-993924663.html

You also appear to have some extra square brackets for the "fields" section, and your "issuelinks" should be in the "update" section rather than stand-alone.  Perhaps try this:

 

{
"update": {
"labels": [ { "add": "cloned" } ],
"issuelinks": [ { "add": {
"type": { "name": "Cloners" },
"outwardIssue": { "key": "{{issue.key}}" }
} } ]
},
"fields": {
"customfield_12903": "{{triggerIssue.customfield_12903}}"
}
}

 

Kind regards,
Bill

Dolly Kirubavathi
Contributor
March 7, 2022

Thank you!

It is a date field. 

Does it make a difference in the formatting of the fields statement?

Dolly Kirubavathi
Contributor
March 7, 2022

Good news! it works!!!! thanks much!!!

 

Since its a date, it is copied over as a previous date. Any thoughts? For eg, 18 Mar 2022 is copied over as 17 Mar 2022

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.
March 7, 2022

That is curious...as both are for the same custom field it does not appear to be a date/time to date conversion issue. 

I wonder are both for the same time zone?  You could test that by forcing the value to your time zone before using it with convertToTimeZone()

https://support.atlassian.com/cloud-automation/docs/jira-smart-values-date-and-time/

Dolly Kirubavathi
Contributor
March 9, 2022

Still having the same error!

Do you know how to maybe use plus/minusDays function to overcome this issue?

 

I tried this but it didn't seem to work(Solved: plusdays function not working when I pass in a var... (atlassian.com)

Maybe my syntax is wrong....not a valid JSON is the error I get:

"fields": {

{{"customfield_12903"}}func=plusBusinessDays({{triggerIssue.customfield_12903|1}})

}

 

 

Appreciate the help!

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.
March 9, 2022

If both fields are the same type and it is not a time zone issue, you may want to submit a support ticket to Atlassian first.  Just adding/subtracting the day to solve this may mask a different problem we are not noticing.

Dolly Kirubavathi
Contributor
March 10, 2022

Both fields are of the same type and I agree with your reply. Will try and create an Atlassian ticket. Do you have a link for it?

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.
March 10, 2022

Here is the link: https://support.atlassian.com/contact/#/

If you are a site admin permission (or higher) you can submit the ticket; otherwise ask your site admin to do so and to add you to notifications.

Once you hear back from them, please post what you learn to help the community.  Thanks!

Suggest an answer

Log in or Sign up to answer