Automation error: Cloning "location" to new ticket

Thomas Talving April 12, 2024

Hi! 

We are trying to setup a simple clone of tickets, in the ticket we have a vendor app custom field called "location" (customfield_10105)

When trying to clone this field i get 

(The value must be a JSON object. (customfield_10105))


For testing i created a test automation that manually triggers, stores the location in "VarLocation" outputs the "VarLocation" to the logs and then edits the field with advance Json editor:



{
   "fields": {
      "customfield_10105": "{{varLocation}}"
   }
}


Logs:
Skärmbild 2024-04-12 092026.png

Rest API:
Skärmbild 2024-04-12 092208.png


Vendor app (Maps, Locations and Territories for Jira):
Maps, Locations and Territories customer documentation - Confluence (atlassian.net)



Any ideas out there? :) 

4 answers

2 accepted

2 votes
Answer accepted
wojciechka April 16, 2024

Hi, the author of the app here.

When cloning the Issue through Automation, please make sure to copy the JSON field by field, e.g.:

{ "fields":{ "Location":{
"lat": {{triggerIssue.Location.lat}},

"lng": {{triggerIssue.Location.lng}},

"morton": {{triggerIssue.Location.morton}},

"address": "{{triggerIssue.Location.address}}",

"addressAux": "{{triggerIssue.Location.addressAux}}",

"mode": "{{triggerIssue.Location.mode}}" }

} }

Thomas Talving April 16, 2024

Works like a charm, thanks! 

1 vote
Answer accepted
wojciechka April 16, 2024

Hi, I am the author of the plugin. Please use the following Custom JSON:

{
"fields":{
"customfield_10044":{
"lat": {{triggerIssue.customfield_10044.lat}},
"lng": {{triggerIssue.customfield_10044.lng}},
"morton": {{triggerIssue.customfield_10044.morton}},
"address": "{{triggerIssue.customfield_10044.address}}",
"addressAux": "{{triggerIssue.customfield_10044.addressAux}}",
"mode": "{{triggerIssue.customfield_10035.mode}}"
}
}
}

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.
April 12, 2024

Hi @Thomas Talving -- Welcome to the Atlassian Community!

Given that field has different attributes, and is from a marketplace addon, I suspect you will need to set each attribute in the JSON from the source location: lat, lng, etc.

Checking the vendor's documentation will help to confirm what is needed.

Kind regards,
Bill

Thomas Talving April 14, 2024

Unfortunately their documentation isn't really that helpful.. :/ 

Maps, Locations and Territories customer documentation - Confluence (atlassian.net)

 

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.
April 15, 2024

In that case, I recommend contacting their support team from the marketplace:

https://marketplace.atlassian.com/apps/1231271/maps-locations-and-territories-core?hosting=cloud&tab=support

Thomas Talving April 15, 2024

Tried reaching out. No help so far. 

wojciechka April 16, 2024

I hope that the provided answer works for you and is helpful.

0 votes
Stephen_Lugton
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.
April 12, 2024

@Thomas Talving have you tried creating a manually triggered automation to create a clone of the current issue?  Then under fields to set chose  "location" (customfield_10105) copy from current issue.

Clone issue.png

 

Thomas Talving April 12, 2024

The location field isn't showing up as a field. so need to use the advance editor to access it. Because its an app, they have a custom type called - Object - Location

Otherwise this would 100% be the way to go. :) 

Stephen_Lugton
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.
April 12, 2024

The only other thing I can suggest is that since the value must be a JSON object you use either replace or replaceAll to change the '=' in varLocation to a ','

https://support.atlassian.com/cloud-automation/docs/jira-smart-values-text-fields/#replace-String-target--String-replacement- 

Stephen_Lugton
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.
April 12, 2024

and you'll also have to put quotes around the address

Thomas Talving April 14, 2024

Not 100% how to do this, could you maybe elaborate? 

Stephen_Lugton
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.
April 15, 2024

I created a new variable with the smart value

{{varLocation.replace("address=","address=\"").replace(", addressAux","\", addressAux").replace("=",", ")}}

 

Create Variable.png

Since I can't test against the app, I just used log actions

Log varAction.png

This has taken out the equals signs and replaced them with commas which is more like JSON, and putting equals around the address text 'should' work but I can't test that.

You may also have to add in additional replaces to remove the { and } at the start and end but I don't know:

.replace("{","").replace("}","")

I don't know if all of this will work, but it's all I can think of to get round the requirement for it to be a JSON object

Thomas Talving April 15, 2024

Unfortunately no luck using the new Var with Replace..
 
Skärmbild 2024-04-15 104959.png

Stephen_Lugton
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.
April 15, 2024

I think I made a mistake and it should be replacing = with : and surrounding the key names with quotes, try this:

{{varLocation.replace("lat","\"lat").replace("lng","\"lng").replace("morton","\"morton").replace("mode","\"mode").replace("address=","\"address=\"").replace(", addressAux","\", \"addressAux").replace("=","\":")}}

Thomas Talving April 15, 2024

Same issue, Got contact with the vendor now but they didn't have a solution. They are apparently looking into how to do this.

Skärmbild 2024-04-15 110957.png 

Stephen_Lugton
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.
April 15, 2024

One last thing I can suggest is to replace auto with "auto":

{{varLocation.replace("lat","\"lat").replace("lng","\"lng").replace("morton","\"morton").replace("mode","\"mode").replace("auto","\"auto\"").replace("address=","\"address=\"").replace(", addressAux","\", \"addressAux").replace("=","\":")}}

 

And possibly remove addressAux as it is empty in your example: 

{{varLocation.replace("lat","\"lat").replace("lng","\"lng").replace("morton","\"morton").replace("mode","\"mode").replace("auto","\"auto\"").replace("address=","\"address=\"").replace(", addressAux=,","\", ").replace("=","\":")}}

 

Beyond that I don't think I can help, but good luck with it

Thomas Talving April 15, 2024

Same :( 

Skärmbild 2024-04-15 113333.png

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