Forums

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

Setting/appending values to a ConfiForms Smart Select field using an IFTTT Macro?

Wade Meredith August 4, 2020

I have an Update Confiforms Entry by Filter IFTTT Macro triggering on update on form "A".

There is a Smart Multiselect named "children" on form "B" that references entries on form "A".

I have the macro targeting the correct entries and can set other fields, but I'm having trouble with the syntax to set/append values to the smart Multiselect. I want it to set the value by appending the current Form "A" entry to any existing values on the form "B" smart multiselect.

"Parameters to set on the entry" for the macro is currently as follows:

children=[entry.children.append(entry.id)]

1 answer

1 accepted

1 vote
Answer accepted
Alex Medved _ConfiForms_
Community Champion
August 5, 2020

Hi

As multi-value fields are stored as comma separated lists then you will need to do something like

children=[entry.children.transform(id).asList],[entry.id]

Alex

Wade Meredith August 5, 2020

Thanks, that was fast! The output of [entry.children.asList],[entry.id] is as follows:

[RegEntry{created=1596480578608, id='a32d2fb2-d53c-474c-9848-4de9f0728ffc', ownedBy='Wade.Meredith@vmlyr.com', recordId='39', createdBy='Wade.Meredith@vmlyr.com', fields={recordDetailName=Record Detail 01, recordDetailVersion=1, detailVersionIteration=2, recordParents=<values><value label="P 2">5be73161-74ab-4aff-a9b2-6c1e8f01f898</value><value label="P 3">305e2ce8-2586-49a8-8432-b5a47ce7aa60</value></values>}},RegEntry{created=1596554505720, id='ee54478a-89dd-4cfa-b464-4dd4bac73a08', ownedBy='Wade.Meredith@vmlyr.com', recordId='42', createdBy='Wade.Meredith@vmlyr.com', fields={recordDetailName=Record Detail 04, recordDetailVersion=1, detailVersionIteration=143, recordParents=<values><value label="P 1">95f00605-5fe7-4e65-9939-46cce36bdee8</value><value label="P 2">5be73161-74ab-4aff-a9b2-6c1e8f01f898</value></values>}},5be73161-74ab-4aff-a9b2-6c1e8f01f898]

This makes me think the multi-value fields aren't actually stored as a comma-separated list. And obviously this output does not add the value to the multi-value field.

Wade Meredith August 5, 2020

Note: If I hard code the value to set as children=ee54478a-89dd-4cfa-b464-4dd4bac73a08,f20c45d3-9741-42ef-ab42-dc3f84442337

Then the multi-valve field accepts the input.

I can build something like this dynamically using [entry.children.transform(id).asList],[entry.id], but the output has brackets on both ends: [ee54478a-89dd-4cfa-b464-4dd4bac73a08,f20c45d3-9741-42ef-ab42-dc3f84442337] and the multi-value field won't accept that.

I suppose I could manually trim the brackets with string manipulation functions, but I would think there is a way to get at that string without the brackets.

EDIT: After some investigating, it seems the brackets are coming from the fact that I'm doing all of this inside an EntryRef like this: [entry.id.asEntryRef([entry.children.transform(id).asList],[entry.id])]

Alex Medved _ConfiForms_
Community Champion
August 5, 2020

OK, having the complexity like that explains the brackets

Put it like (if I understand your setup right)

[entry._func.asEntryRef(entry.children.transform(id).asList),[entry.id]]

Wade Meredith August 5, 2020

[entry._func.asEntryRef(entry.children.transform(id).asList),[entry.id]] just outputs a text string of "_func"

EDIT: This was just a typo in the function provided. It should be [entry._func.asEntryRef([entry.children.transform(id).asList],[entry.id])]

But even that still gives me brackets. If I change asEntryRef to asRef, they go away.

Wade Meredith August 5, 2020

I got it working. You set me on the track. Here's the final function that worked:

someMVField=[entry._func.asRef([entry.someMVField.transform(id).asList])],[entry.id]

Here's the complete source of my actual macro for others who find this:

<ac:structured-macro ac:macro-id="7cc5ac83-4601-48b4-97fa-faeb07d7691d" ac:name="confiform-ifttt" ac:schema-version="1">
<ac:parameter ac:name="extras3">true</ac:parameter>
<ac:parameter ac:name="action">Update ConfiForms entries by filter</ac:parameter>
<ac:parameter ac:name="event">onModified</ac:parameter>
<ac:parameter ac:name="title">children=[entry._func.asRef([entry.children.transform(id).asList])],[entry.id]</ac:parameter>
<ac:parameter ac:name="extras2">id:[entry.recordParents.transform(id).join( OR id:)]</ac:parameter>
<ac:parameter ac:name="who">**REDACTED FORM NAME**:**REDACTED PAGE ID**</ac:parameter>
<ac:rich-text-body>
<p>
<br/>
</p>
</ac:rich-text-body>
</ac:structured-macro>

If you want to update your answer with an edit containing the function string above, I'll accept the answer.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events