ConfiForms - Smart Checkbox & Update ConfiForms Entry IFTTT
Asked by OneMinuteSand:

I'm trying to do something like the Simple stock - warehouse example here:

<https://wiki.vertuna.com/display/TEST/Simple+stock+-+warehouse+with+ConfiForms>

Instead of a smart dropdown, I'm using smart checkboxes and want it to decrement the quantity of multiple selected items. However, I'm not sure how to update the "Create/Update ConfiForms Entry" IFTTT portion so that it will update multiple quantities. Is there a way to do something like this?


Answers:
author: Alex Medved _ConfiForms_
body: Hi

And welcome to this community

Consider the following demo: <http://recordit.co/uzlolzy11C>

Storage format for it below

```
<p>In this example we will demo a simple setup of 2 forms, which emulate the stock / warehouse</p>
<p>
<br/>
</p>
<p>Stock form</p>
<ac:structured-macro ac:macro-id="ea7db6d6-4aaa-44d4-82bb-94c487bd5913" ac:name="confiform" ac:schema-version="1">
<ac:parameter ac:name="formName">stock</ac:parameter>
<ac:parameter ac:name="registrationFormTitle">Stock</ac:parameter>
<ac:rich-text-body>
<ac:structured-macro ac:macro-id="abf41b82-7f09-423e-bea5-2fb2bf62abbc" ac:name="confiform-entry-register" ac:schema-version="1">
<ac:parameter ac:name="registrationButtonLabel">Register stock item</ac:parameter>
<ac:parameter ac:name="atlassian-macro-output-type">INLINE</ac:parameter>
<ac:rich-text-body>
<p>
<br/>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<p>
<ac:structured-macro ac:macro-id="16735a0c-2732-4cf8-825e-414eb2dc591d" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="fieldName">item</ac:parameter>
<ac:parameter ac:name="fieldLabel">item</ac:parameter>
<ac:parameter ac:name="type">text</ac:parameter>
<ac:parameter ac:name="required">true</ac:parameter>
</ac:structured-macro>
</p>
<p>
<ac:structured-macro ac:macro-id="22a54919-25fd-42aa-8670-6dfbeca28705" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="fieldName">quantity</ac:parameter>
<ac:parameter ac:name="fieldLabel">Quantity</ac:parameter>
<ac:parameter ac:name="type">number</ac:parameter>
</ac:structured-macro>
</p>
<p>
<ac:structured-macro ac:macro-id="db9f48aa-06d3-4fe7-8358-c487f2415be8" ac:name="confiform-field-definition-rules" ac:schema-version="1">
<ac:parameter ac:name="condition">id:[empty] AND quantity:&lt;0</ac:parameter>
<ac:parameter ac:name="fieldName">Quantity shall be non negative</ac:parameter>
<ac:parameter ac:name="action">Validation rule</ac:parameter>
</ac:structured-macro>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<ac:structured-macro ac:macro-id="7013aab1-1ea4-4594-a88e-481ed3b46a3d" ac:name="confiform-table" ac:schema-version="1">
<ac:parameter ac:name="formName">stock</ac:parameter>
<ac:rich-text-body>
<p>
<br/>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<ac:structured-macro ac:macro-id="5d01f7a6-37c4-4d10-8f2b-f74b9255b4b3" ac:name="confiform" ac:schema-version="1">
<ac:parameter ac:name="formName">orderForm</ac:parameter>
<ac:rich-text-body>
<ac:structured-macro ac:macro-id="4a184218-8a09-4085-8e20-6d4177af9c8e" ac:name="confiform-entry-register" ac:schema-version="1">
<ac:parameter ac:name="registrationButtonLabel">Order</ac:parameter>
<ac:parameter ac:name="atlassian-macro-output-type">INLINE</ac:parameter>
<ac:rich-text-body>
<p>
<br/>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<p>
<ac:structured-macro ac:macro-id="06057102-0357-4fbb-a2b3-89b75de3a4ab" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="fieldName">orderItem</ac:parameter>
<ac:parameter ac:name="fieldLabel">Item to order</ac:parameter>
<ac:parameter ac:name="values">[93389671|stock|item|true||]</ac:parameter>
<ac:parameter ac:name="type">smartcheckbox</ac:parameter>
</ac:structured-macro>
</p>
<p>
<ac:structured-macro ac:macro-id="86231268-91d6-46a8-b8fa-3b38fbdbd322" ac:name="confiform-field-definition-rules" ac:schema-version="1">
<ac:parameter ac:name="fieldName">orderItem</ac:parameter>
<ac:parameter ac:name="values">quantity:&gt;0</ac:parameter>
<ac:parameter ac:name="action">Apply Filter on a field</ac:parameter>
</ac:structured-macro> ? show only items with quantity &gt; 0</p>
<p>
<ac:structured-macro ac:macro-id="f004b282-3bbc-4c67-9e86-6faea01e4ac2" ac:name="confiform-field-definition-rules" ac:schema-version="1">
<ac:parameter ac:name="condition">id:[empty] AND orderItem.quantity:&lt;1</ac:parameter>
<ac:parameter ac:name="fieldName">Sorry, we dont have this item in stock anymore</ac:parameter>
<ac:parameter ac:name="action">Validation rule</ac:parameter>
</ac:structured-macro>
</p>
<ac:structured-macro ac:macro-id="b032c0d8-2020-4fa9-af62-306d45c36dee" ac:name="confiform-ifttt" ac:schema-version="1">
<ac:parameter ac:name="action">Update ConfiForms entries by filter</ac:parameter>
<ac:parameter ac:name="event">onCreated</ac:parameter>
<ac:parameter ac:name="title">quantity=([entry.id.asEntryRef(entry.quantity)]-1)</ac:parameter>
<ac:parameter ac:name="extras2">id:[entry.orderItem.transform(id).join( OR id:)]</ac:parameter>
<ac:parameter ac:name="who">stock</ac:parameter>
<ac:rich-text-body>
<p>id:[entry.orderItem.transform(id).join( OR id:)]</p>
</ac:rich-text-body>
</ac:structured-macro>
</ac:rich-text-body>
</ac:structured-macro>
<ac:structured-macro ac:macro-id="6490db44-bf19-408f-bd61-d3334884a7b9" ac:name="confiform-table" ac:schema-version="1">
<ac:parameter ac:name="formName">orderForm</ac:parameter>
<ac:rich-text-body>
<p>
<ac:structured-macro ac:macro-id="25d125bd-27fd-4bb5-b9f9-412e3b11dcd0" ac:name="confiform-field" ac:schema-version="1">
<ac:parameter ac:name="overrideLabel">ordered item</ac:parameter>
<ac:parameter ac:name="fieldName">orderItem</ac:parameter>
</ac:structured-macro> <ac:structured-macro ac:macro-id="f4dcb615-2dbf-47ed-97f0-9af7b27ec775" ac:name="confiform-field" ac:schema-version="1">
<ac:parameter ac:name="overrideLabel">order time</ac:parameter>
<ac:parameter ac:name="fieldName">created</ac:parameter>
</ac:structured-macro>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<p>
<br/>
</p>
<p>
<br/>
</p>

```

Hope it helps

Alex

comments: author: OneMinuteSand
body: Thank you, Alex! The demo and the code was all very helpful for me. Everything worked!


Tags: confiforms

confluence-server

server