Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

With Confiforms, Create multiple Insight Object from TextArea

Edited

Dear all,

I try to create a small confluence page, which allow creation of one or multiple Insight object depending of value entered in a Custom Field.

This works when I entered only one value, but copy/paste of multi rows return this kind of error:

 

Could not prepare JSON: '{ "objectTypeId": 1, "attributes": [{ "objectTypeAttributeId": 11, "objectAttributeValues": [{ "value": 123456 4523657 }] } ] }'. Invalid format. Expected a ',' or '}' at 150 [character 1 line 7]

 

On My IFTTT integration rules, I use a Create Insight Object, and then on No Format macro the following code:

{
"objectTypeId": 1,
"attributes": [{
"objectTypeAttributeId": 11,
"objectAttributeValues": [{
"value": [entry.mymultivalueareafield.transform(id).asArrayOfKVPairs(key)]
           }]
}
]
}

 

How I can implement that?

thanks in advance.

regards

 

1 answer

Hi

are you using NoFormat or Code macro to wrap (and pass) your Insight Object JSON mapping to ConfiForms?

Also, you have [entry.mymultivalueareafield.transform(id).asArrayOfKVPairs(key)] in the mapping, but shared something else in the error message

As this instruction, when properly used, will produce something like

{"key": "someID", "key": "anotherID"}

Alex

Dear Alex,

thank you for your quick answer.
Yes, I use a "No Format" macro in the IFTTT macro to store the JSON. And indeed, the error message is strange, I don't understand it. It's like if the tool didn't recognize the line break.

Is there a way to log/ debug such kind of script (i.e console which step by step shows the values...) ?

regards,

Xavier

The error is actually correct, as 

"value": 123456 4523657

is not a correct JSON

So, your instruction 

[entry.mymultivalueareafield.transform(id).asArrayOfKVPairs(key)]

is incorrect

I suggest to do the following

Create a ConfiForms PlainView and put this expression inside the macro body

See what it produces

Alex

Dear Alex,

thank you for your post. this product data with blank data instead comma, line break...

will check for correct formatting

regards

What field type this 

mymultivalueareafield

field actually is?

Alex 

Sorry, I am confused now.. you are talking about textarea in the subject of the ticket, but in your JSON you have something like 

mymultivalueareafield

using transform function... 

What is your question really? How does this textarea field plays here!?

Alex

So, On my form, I have one field (of type textarea, with the name mymultivalueareafield) on which I would like to entered or copy/paste values, eventually separate by carriage return

So, on the IFTTT, (Create Insight Object), I add a No Format macro, and entered 

{
"objectTypeId": 1,
"attributes": [{
"objectTypeAttributeId": 11,
"objectAttributeValues": [{
"value": [entry.mymultivalueareafield.transform(id).asArrayOfKVPairs(key)]
           }]
}
]
}


Honestly, I dont understand what are you trying to "transform by id" in text area... this field has no "id"... and is not multi-value (multi-select). 

Something like this might work...

[entry.mymultivalueareafield.replaceCRLFWithBR.split(<br/>).asArrayOfKVPairs(key)]

Alex

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Apps & Integrations

Send an Email or Publish to Confluence - What should you do with your release notes?

Background When you hear the words ‘Release notes’, almost always you think of an unsolicited email from a software vendor. But I am here to tell you that from our data, sending release notes via E...

227 views 1 2
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you