Confiforms: trouble with asFilteredBy
Asked by Piotr Gugnowski:

Hey [@Alex Medved _ConfiForms_](/t5/user/viewprofilepage/user-id/781630)

I have nothiced something really strange when I use asFilteredBy with smart fields!

It is really important for me to make it work (really).

I will try my best to describe the situation:

(every smart field has 'reference to records' checked and every smart dropdown is 'advanced')

\> I have 3 forms: relationForm, workerForm, jobForm

\> workerForm: workerName (text), takenJobs (smart multi-select: IDs from jobForm)

\> jobForm: jobName (text), assignedWorkers (smart multi-select: IDs from workerForm)

\> relationForm: worker (smart dropdown: ID from workerForm), job (smart dropdown: ID from jobForm), it also has two integration rules (iftt0, iftt1):

\> iftt0: onCreated, Update Confiforms entries by filter, PARAMETERS-\> takenJobs=\[entry.worker.takenJobs.transform(id).asList\],\[entry.job\], form1:@self, FILTER-\> id:\[entry.worker\]

\> iftt1: onDeleted, Update Confiforms entries by filter, PARAMETERS-\> takenJobs=\[entry.worker.takenJobs.asFilteredBy(!id:\[entry.job\]).transform(id).asList\], form1:@self, FILTER-\> id:\[entry.worker\]

The problem that I encounter is that when i have 3 values set in one row in takenJobs via relationForm and try to remove something (for ex. middle value) via relationForm other labals also disappear.


Answers:
author: Alex Medved _ConfiForms_
body: Hi

Is it possible for you to share the storage formats for your forms?

Alex

comments: author: Piotr Gugnowski
body: I think this will not be possible, because the space that I have access has blocked ability to add new macros.

This is the reason I described the stucture.


author: Alex Medved _ConfiForms_
body: This is how you can get the storage format - <https://confluence.atlassian.com/confkb/how-to-retrieve-confluence-storage-format-1014270532.html>

This way I can easily import it in my test server and see what you have and understand your question better

Alex


author: Piotr Gugnowski
body: Hey [@Alex Medved _ConfiForms_](/t5/user/viewprofilepage/user-id/781630) , I'm unable to get a plugin that is required to get storage format directly from my server page, but I made copy of it in Confluence Cloud, where I am free to copy that storage (I guess code might differ to original "server" version that I'm interested in).  
The structure below seems not to work on Cloud Server also, but I want to show you the structure that I'm trying to enhance.   

Basically when you add or remove a row form relation form respectful assignedWorkers and takenJobs shall be updated so they also show estabilished relation properly. (in storage format i have written only takenJobs integration rules, because if it works out, writing integration rules for assignedWorkers would be the same.  

To be clear, when you try to adjust smart-multiselect field takenJobs with:  
takenJobs=\[entry.worker.takenJobs.asFilteredBy(!id:\[entry.job\]).transform(id).asList\]

or

takenJobs=\[entry.worker.takenJobs.asFilteredBy(!id:\[entry.job\])\]

everything filters out, not just \[entry.job\].

This is how it goes in Confluence Server.

Could you please show me how to do it properly?

```
<ac:structured-macro ac:name="confiform" ac:schema-version="1" data-layout="default" ac:local-id="470c913a-04d9-43e5-b25c-370c5190f940" ac:macro-id="9c7d0495e7af9979bc73856e12ae49b9"><ac:parameter ac:name="formName">relationForm</ac:parameter><ac:parameter ac:name="registrationFormTitle">Relation</ac:parameter><ac:rich-text-body><ac:structured-macro ac:name="confiform-field-definition" ac:schema-version="1" data-layout="default" ac:local-id="f5dd2c89-c9e0-4fa2-843b-165404270dfe" ac:macro-id="0c2059c4-b1fd-4eb7-aca2-62a4d02a8da0"><ac:parameter ac:name="fieldName">worker</ac:parameter><ac:parameter ac:name="fieldLabel">worker</ac:parameter><ac:parameter ac:name="values">[65550|workerForm|workerName|true||]</ac:parameter><ac:parameter ac:name="type">smartselect2</ac:parameter><ac:parameter ac:name="macroHash">-246133216</ac:parameter></ac:structured-macro><ac:structured-macro ac:name="confiform-field-definition" ac:schema-version="1" data-layout="default" ac:local-id="43467bd8-8dfe-44bd-a8f2-d857da794baa" ac:macro-id="b2d850f1-c119-429a-a7a9-98bf21198a1e"><ac:parameter ac:name="fieldName">job</ac:parameter><ac:parameter ac:name="fieldLabel">job</ac:parameter><ac:parameter ac:name="values">[65550|jobForm|jobName|true||]</ac:parameter><ac:parameter ac:name="type">smartmultiselect</ac:parameter><ac:parameter ac:name="macroHash">178773469</ac:parameter></ac:structured-macro><p /></ac:rich-text-body></ac:structured-macro><ac:structured-macro ac:name="confiform-ifttt" ac:schema-version="1" data-layout="default" ac:local-id="f4db6651-c1f5-4306-8803-7ede15977993" ac:macro-id="8acfdec8-2c3c-4d36-9fc8-e6a15f761011"><ac:parameter ac:name="formName">relationForm</ac:parameter><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">takenJobs=[entry.worker.takenJobs.transform(id).asList],[entry.job]</ac:parameter><ac:parameter ac:name="extras2">id:[entry.worker]</ac:parameter><ac:parameter ac:name="who">workerForm:this</ac:parameter><ac:parameter ac:name="macroHash">1996864112</ac:parameter><ac:rich-text-body><p /></ac:rich-text-body></ac:structured-macro><ac:structured-macro ac:name="confiform-ifttt" ac:schema-version="1" data-layout="default" ac:local-id="63c44129-6389-4c07-9683-6f66cfae09c9" ac:macro-id="dbbf1b10-6ff2-434d-ad7b-1349382505e3"><ac:parameter ac:name="formName">relationForm</ac:parameter><ac:parameter ac:name="action">Update ConfiForms entries by filter</ac:parameter><ac:parameter ac:name="event">onDeleted</ac:parameter><ac:parameter ac:name="title">takenJobs=[entry.worker.takenJobs.asFilteredBy(!id:[entry.job]).transform(id).asList]</ac:parameter><ac:parameter ac:name="extras2">id:[entry.worker]</ac:parameter><ac:parameter ac:name="who">workerForm:this</ac:parameter><ac:parameter ac:name="macroHash">1241104894</ac:parameter><ac:rich-text-body><p /></ac:rich-text-body></ac:structured-macro><ac:structured-macro ac:name="confiform-entry-register" ac:schema-version="1" data-layout="default" ac:local-id="34170905-c44f-4a43-9651-f5180735aca2" ac:macro-id="2cc78431e37a2efde7c263f5b49d98ac"><ac:parameter ac:name="redirectMode">View</ac:parameter><ac:parameter ac:name="formName">relationForm</ac:parameter><ac:parameter ac:name="showMessageAs">Below the form</ac:parameter><ac:rich-text-body><p /></ac:rich-text-body></ac:structured-macro><ac:structured-macro ac:name="confiform-table" ac:schema-version="1" data-layout="default" ac:local-id="02cf0007-1d0d-41ff-b9e0-e91409b8dd7a" ac:macro-id="45da5be23b68b3537d3894363c317472"><ac:parameter ac:name="formName">relationForm</ac:parameter><ac:rich-text-body><p /></ac:rich-text-body></ac:structured-macro><p /><ac:structured-macro ac:name="confiform" ac:schema-version="1" data-layout="default" ac:local-id="4937ec99-7f81-4878-828f-d37f31eaa97f" ac:macro-id="127181f82f502c21cab4c2b6bf10df2c"><ac:parameter ac:name="formName">workerForm</ac:parameter><ac:parameter ac:name="registrationFormTitle">Add worker</ac:parameter><ac:rich-text-body><ac:structured-macro ac:name="confiform-field-definition" ac:schema-version="1" data-layout="default" ac:local-id="c92d2ba0-4c4f-481b-861c-9f9fb4a87b6e" ac:macro-id="e9b319b1-5647-48b8-abea-eea428ca8e07"><ac:parameter ac:name="fieldName">workerName</ac:parameter><ac:parameter ac:name="fieldLabel">workerName</ac:parameter><ac:parameter ac:name="type">text</ac:parameter><ac:parameter ac:name="macroHash">-1928161866</ac:parameter></ac:structured-macro><ac:structured-macro ac:name="confiform-field-definition" ac:schema-version="1" data-layout="default" ac:local-id="47ba8997-e2a6-424c-a81d-1646271e7678" ac:macro-id="fd273408-d7c6-43d4-9711-25374f4dd138"><ac:parameter ac:name="fieldName">takenJobs</ac:parameter><ac:parameter ac:name="fieldLabel">takenJobs</ac:parameter><ac:parameter ac:name="values">[65550|jobForm|jobName|true||]</ac:parameter><ac:parameter ac:name="type">smartmultiselect</ac:parameter><ac:parameter ac:name="macroHash">202151837</ac:parameter></ac:structured-macro></ac:rich-text-body></ac:structured-macro><ac:structured-macro ac:name="confiform-entry-register" ac:schema-version="1" data-layout="default" ac:local-id="5247b030-017d-4f40-97b0-aea2234cd359" ac:macro-id="3b2aab70eeff5b24f67b13100198431d"><ac:parameter ac:name="redirectMode">View</ac:parameter><ac:parameter ac:name="formName">workerForm</ac:parameter><ac:parameter ac:name="formTitle">Add worker</ac:parameter><ac:parameter ac:name="showMessageAs">Below the form</ac:parameter><ac:rich-text-body><p><ac:structured-macro ac:name="confiform-field" ac:schema-version="1" ac:local-id="a35adbc8-6b99-41fc-b918-ab56a2b580a3" ac:macro-id="9d53979f-6aed-40a1-8be1-89fbc5a619ac"><ac:parameter ac:name="fieldName">workerName</ac:parameter><ac:parameter ac:name="macroHash">1698054672</ac:parameter></ac:structured-macro></p></ac:rich-text-body></ac:structured-macro><ac:structured-macro ac:name="confiform-table" ac:schema-version="1" data-layout="default" ac:local-id="ede8d464-aa03-45bd-9a67-8f1cb3d390a4" ac:macro-id="b5a7c7b4646bef47c577c1b144655733"><ac:parameter ac:name="formName">workerForm</ac:parameter><ac:rich-text-body><p /></ac:rich-text-body></ac:structured-macro><p /><p /><ac:structured-macro ac:name="confiform" ac:schema-version="1" data-layout="default" ac:local-id="19324c5d-2cd5-4abf-ad09-736d71b9babe" ac:macro-id="f39ed34c598c3aa41f33467eb2f5865f"><ac:parameter ac:name="formName">jobForm</ac:parameter><ac:parameter ac:name="registrationFormTitle">Add worker</ac:parameter><ac:rich-text-body><ac:structured-macro ac:name="confiform-field-definition" ac:schema-version="1" data-layout="default" ac:local-id="95cb8c27-2119-4a7e-b89b-93594087cedc" ac:macro-id="49b900ea-da4b-446b-97b6-ee5bcf4477f5"><ac:parameter ac:name="fieldName">jobName</ac:parameter><ac:parameter ac:name="fieldLabel">jobName</ac:parameter><ac:parameter ac:name="type">text</ac:parameter><ac:parameter ac:name="macroHash">-306646284</ac:parameter></ac:structured-macro><ac:structured-macro ac:name="confiform-field-definition" ac:schema-version="1" data-layout="default" ac:local-id="c5779ca1-c839-40c6-8556-8e6af1bb4111" ac:macro-id="e96fa1b0-4cd4-4bdf-8c60-2a842f7900e8"><ac:parameter ac:name="fieldName">assignedWorkers</ac:parameter><ac:parameter ac:name="fieldLabel">assignedWorkers</ac:parameter><ac:parameter ac:name="values">[65550|workerForm|workerName|true||]</ac:parameter><ac:parameter ac:name="type">smartmultiselect</ac:parameter><ac:parameter ac:name="macroHash">-611441773</ac:parameter></ac:structured-macro></ac:rich-text-body></ac:structured-macro><ac:structured-macro ac:name="confiform-entry-register" ac:schema-version="1" data-layout="default" ac:local-id="78ef3e4c-c6d6-4bef-b782-6554042011e7" ac:macro-id="35ea044686f3e7ceaa683bc1377290c5"><ac:parameter ac:name="redirectMode">View</ac:parameter><ac:parameter ac:name="formName">jobForm</ac:parameter><ac:parameter ac:name="formTitle">Add job</ac:parameter><ac:parameter ac:name="showMessageAs">Below the form</ac:parameter><ac:rich-text-body><p><ac:structured-macro ac:name="confiform-field" ac:schema-version="1" ac:local-id="2321362d-bf9c-4ab6-8c18-5126dd6dd40a" ac:macro-id="9b21325b-8f01-40b5-8ee1-d5f656688bf6"><ac:parameter ac:name="fieldName">jobName</ac:parameter><ac:parameter ac:name="macroHash">-1767462537</ac:parameter></ac:structured-macro></p></ac:rich-text-body></ac:structured-macro><ac:structured-macro ac:name="confiform-table" ac:schema-version="1" data-layout="default" ac:local-id="21e540df-1216-4e6b-8b2e-46576038398a" ac:macro-id="53a416bb61264a261dcbb91d0262b16b"><ac:parameter ac:name="formName">jobForm</ac:parameter><ac:rich-text-body><p /></ac:rich-text-body></ac:structured-macro>
```


author: Piotr Gugnowski
body: Hey [@Alex Medved _ConfiForms_](/t5/user/viewprofilepage/user-id/781630) , the code that I pasted below is not 1-1 code from my confluence server page. In fact I am unable to use a plugin that would allow me to get storage format. Instead I tried to reproduce everything on Confluence Cloud version just to get that storage format, so I geuss this code shall not be applied to the 'sever' version that I am really interested.

The purpose of this code is just to show you the structure that I want to enhance with integration rules on takenJobs and assignedWorkers fields. When you add new row to relation the same information about relation should show up in assignedWorkers and takenJobs. When you delete a row the same information should dissapear from mentioned fields.

On a server side usage of:

takenJobs=\[entry.worker.takenJobs.asFilteredBy(!id:\[entry.job\]).transform(id).asList\]

or

takenJobs=\[entry.worker.takenJobs.asFilteredBy(!id:\[entry.job\])\]

clears every information from takenJobs field, not just \[entry.job\] :(

I would really like you to show me how can I do that properly, so other information in takenJobs stays untouched.

Note: In the given code I didn't write integration rules about assignedWorkers, because it's just the same case as takenJobs.

```
<ac:structured-macro ac:name="confiform" ac:schema-version="1" data-layout="default" ac:local-id="470c913a-04d9-43e5-b25c-370c5190f940" ac:macro-id="9c7d0495e7af9979bc73856e12ae49b9"><ac:parameter ac:name="formName">relationForm</ac:parameter><ac:parameter ac:name="registrationFormTitle">Relation</ac:parameter><ac:rich-text-body><ac:structured-macro ac:name="confiform-field-definition" ac:schema-version="1" data-layout="default" ac:local-id="f5dd2c89-c9e0-4fa2-843b-165404270dfe" ac:macro-id="0c2059c4-b1fd-4eb7-aca2-62a4d02a8da0"><ac:parameter ac:name="fieldName">worker</ac:parameter><ac:parameter ac:name="fieldLabel">worker</ac:parameter><ac:parameter ac:name="values">[65550|workerForm|workerName|true||]</ac:parameter><ac:parameter ac:name="type">smartselect2</ac:parameter><ac:parameter ac:name="macroHash">-246133216</ac:parameter></ac:structured-macro><ac:structured-macro ac:name="confiform-field-definition" ac:schema-version="1" data-layout="default" ac:local-id="43467bd8-8dfe-44bd-a8f2-d857da794baa" ac:macro-id="b2d850f1-c119-429a-a7a9-98bf21198a1e"><ac:parameter ac:name="fieldName">job</ac:parameter><ac:parameter ac:name="fieldLabel">job</ac:parameter><ac:parameter ac:name="values">[65550|jobForm|jobName|true||]</ac:parameter><ac:parameter ac:name="type">smartmultiselect</ac:parameter><ac:parameter ac:name="macroHash">178773469</ac:parameter></ac:structured-macro><p /></ac:rich-text-body></ac:structured-macro><ac:structured-macro ac:name="confiform-ifttt" ac:schema-version="1" data-layout="default" ac:local-id="f4db6651-c1f5-4306-8803-7ede15977993" ac:macro-id="8acfdec8-2c3c-4d36-9fc8-e6a15f761011"><ac:parameter ac:name="formName">relationForm</ac:parameter><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">takenJobs=[entry.worker.takenJobs.transform(id).asList],[entry.job]</ac:parameter><ac:parameter ac:name="extras2">id:[entry.worker]</ac:parameter><ac:parameter ac:name="who">workerForm:this</ac:parameter><ac:parameter ac:name="macroHash">1996864112</ac:parameter><ac:rich-text-body><p /></ac:rich-text-body></ac:structured-macro><ac:structured-macro ac:name="confiform-ifttt" ac:schema-version="1" data-layout="default" ac:local-id="63c44129-6389-4c07-9683-6f66cfae09c9" ac:macro-id="dbbf1b10-6ff2-434d-ad7b-1349382505e3"><ac:parameter ac:name="formName">relationForm</ac:parameter><ac:parameter ac:name="action">Update ConfiForms entries by filter</ac:parameter><ac:parameter ac:name="event">onDeleted</ac:parameter><ac:parameter ac:name="title">takenJobs=[entry.worker.takenJobs.asFilteredBy(!id:[entry.job]).transform(id).asList]</ac:parameter><ac:parameter ac:name="extras2">id:[entry.worker]</ac:parameter><ac:parameter ac:name="who">workerForm:this</ac:parameter><ac:parameter ac:name="macroHash">1241104894</ac:parameter><ac:rich-text-body><p /></ac:rich-text-body></ac:structured-macro><ac:structured-macro ac:name="confiform-entry-register" ac:schema-version="1" data-layout="default" ac:local-id="34170905-c44f-4a43-9651-f5180735aca2" ac:macro-id="2cc78431e37a2efde7c263f5b49d98ac"><ac:parameter ac:name="redirectMode">View</ac:parameter><ac:parameter ac:name="formName">relationForm</ac:parameter><ac:parameter ac:name="showMessageAs">Below the form</ac:parameter><ac:rich-text-body><p /></ac:rich-text-body></ac:structured-macro><ac:structured-macro ac:name="confiform-table" ac:schema-version="1" data-layout="default" ac:local-id="02cf0007-1d0d-41ff-b9e0-e91409b8dd7a" ac:macro-id="45da5be23b68b3537d3894363c317472"><ac:parameter ac:name="formName">relationForm</ac:parameter><ac:rich-text-body><p /></ac:rich-text-body></ac:structured-macro><p /><ac:structured-macro ac:name="confiform" ac:schema-version="1" data-layout="default" ac:local-id="4937ec99-7f81-4878-828f-d37f31eaa97f" ac:macro-id="127181f82f502c21cab4c2b6bf10df2c"><ac:parameter ac:name="formName">workerForm</ac:parameter><ac:parameter ac:name="registrationFormTitle">Add worker</ac:parameter><ac:rich-text-body><ac:structured-macro ac:name="confiform-field-definition" ac:schema-version="1" data-layout="default" ac:local-id="c92d2ba0-4c4f-481b-861c-9f9fb4a87b6e" ac:macro-id="e9b319b1-5647-48b8-abea-eea428ca8e07"><ac:parameter ac:name="fieldName">workerName</ac:parameter><ac:parameter ac:name="fieldLabel">workerName</ac:parameter><ac:parameter ac:name="type">text</ac:parameter><ac:parameter ac:name="macroHash">-1928161866</ac:parameter></ac:structured-macro><ac:structured-macro ac:name="confiform-field-definition" ac:schema-version="1" data-layout="default" ac:local-id="47ba8997-e2a6-424c-a81d-1646271e7678" ac:macro-id="fd273408-d7c6-43d4-9711-25374f4dd138"><ac:parameter ac:name="fieldName">takenJobs</ac:parameter><ac:parameter ac:name="fieldLabel">takenJobs</ac:parameter><ac:parameter ac:name="values">[65550|jobForm|jobName|true||]</ac:parameter><ac:parameter ac:name="type">smartmultiselect</ac:parameter><ac:parameter ac:name="macroHash">202151837</ac:parameter></ac:structured-macro></ac:rich-text-body></ac:structured-macro><ac:structured-macro ac:name="confiform-entry-register" ac:schema-version="1" data-layout="default" ac:local-id="5247b030-017d-4f40-97b0-aea2234cd359" ac:macro-id="3b2aab70eeff5b24f67b13100198431d"><ac:parameter ac:name="redirectMode">View</ac:parameter><ac:parameter ac:name="formName">workerForm</ac:parameter><ac:parameter ac:name="formTitle">Add worker</ac:parameter><ac:parameter ac:name="showMessageAs">Below the form</ac:parameter><ac:rich-text-body><p><ac:structured-macro ac:name="confiform-field" ac:schema-version="1" ac:local-id="a35adbc8-6b99-41fc-b918-ab56a2b580a3" ac:macro-id="9d53979f-6aed-40a1-8be1-89fbc5a619ac"><ac:parameter ac:name="fieldName">workerName</ac:parameter><ac:parameter ac:name="macroHash">1698054672</ac:parameter></ac:structured-macro></p></ac:rich-text-body></ac:structured-macro><ac:structured-macro ac:name="confiform-table" ac:schema-version="1" data-layout="default" ac:local-id="ede8d464-aa03-45bd-9a67-8f1cb3d390a4" ac:macro-id="b5a7c7b4646bef47c577c1b144655733"><ac:parameter ac:name="formName">workerForm</ac:parameter><ac:rich-text-body><p /></ac:rich-text-body></ac:structured-macro><p /><p /><ac:structured-macro ac:name="confiform" ac:schema-version="1" data-layout="default" ac:local-id="19324c5d-2cd5-4abf-ad09-736d71b9babe" ac:macro-id="f39ed34c598c3aa41f33467eb2f5865f"><ac:parameter ac:name="formName">jobForm</ac:parameter><ac:parameter ac:name="registrationFormTitle">Add worker</ac:parameter><ac:rich-text-body><ac:structured-macro ac:name="confiform-field-definition" ac:schema-version="1" data-layout="default" ac:local-id="95cb8c27-2119-4a7e-b89b-93594087cedc" ac:macro-id="49b900ea-da4b-446b-97b6-ee5bcf4477f5"><ac:parameter ac:name="fieldName">jobName</ac:parameter><ac:parameter ac:name="fieldLabel">jobName</ac:parameter><ac:parameter ac:name="type">text</ac:parameter><ac:parameter ac:name="macroHash">-306646284</ac:parameter></ac:structured-macro><ac:structured-macro ac:name="confiform-field-definition" ac:schema-version="1" data-layout="default" ac:local-id="c5779ca1-c839-40c6-8556-8e6af1bb4111" ac:macro-id="e96fa1b0-4cd4-4bdf-8c60-2a842f7900e8"><ac:parameter ac:name="fieldName">assignedWorkers</ac:parameter><ac:parameter ac:name="fieldLabel">assignedWorkers</ac:parameter><ac:parameter ac:name="values">[65550|workerForm|workerName|true||]</ac:parameter><ac:parameter ac:name="type">smartmultiselect</ac:parameter><ac:parameter ac:name="macroHash">-611441773</ac:parameter></ac:structured-macro></ac:rich-text-body></ac:structured-macro><ac:structured-macro ac:name="confiform-entry-register" ac:schema-version="1" data-layout="default" ac:local-id="78ef3e4c-c6d6-4bef-b782-6554042011e7" ac:macro-id="35ea044686f3e7ceaa683bc1377290c5"><ac:parameter ac:name="redirectMode">View</ac:parameter><ac:parameter ac:name="formName">jobForm</ac:parameter><ac:parameter ac:name="formTitle">Add job</ac:parameter><ac:parameter ac:name="showMessageAs">Below the form</ac:parameter><ac:rich-text-body><p><ac:structured-macro ac:name="confiform-field" ac:schema-version="1" ac:local-id="2321362d-bf9c-4ab6-8c18-5126dd6dd40a" ac:macro-id="9b21325b-8f01-40b5-8ee1-d5f656688bf6"><ac:parameter ac:name="fieldName">jobName</ac:parameter><ac:parameter ac:name="macroHash">-1767462537</ac:parameter></ac:structured-macro></p></ac:rich-text-body></ac:structured-macro><ac:structured-macro ac:name="confiform-table" ac:schema-version="1" data-layout="default" ac:local-id="21e540df-1216-4e6b-8b2e-46576038398a" ac:macro-id="53a416bb61264a261dcbb91d0262b16b"><ac:parameter ac:name="formName">jobForm</ac:parameter><ac:rich-text-body><p /></ac:rich-text-body></ac:structured-macro>
```


author: Alex Medved _ConfiForms_
body: No extra plugin needed to get the storage format, but OK. let me see what you have

Could you check the ConfiForms version you are using on the server?


author: Alex Medved _ConfiForms_
body: In this expression the issue is with "current context"

```
takenJobs=[entry.worker.takenJobs.asFilteredBy(!id:[entry.job])]
```

See, you navigate to takenJobs field and ask it to evaluate the expression \[entry.job\]

Agains the context of the record that takenJobs field is in

It evaluates to empty... and therefore the filter removes everything (all that dont have the id field empty)

Alex


author: Piotr Gugnowski
body: [@Alex Medved _ConfiForms_](/t5/user/viewprofilepage/user-id/781630) do you have any suggestions how to retrieve \[entry.job\] data?


author: Alex Medved _ConfiForms_
body: Consider this example (please note that you will need to reconfigure the smart fields to point at your form's page)

```
<ac:structured-macro ac:macro-id="f18ed1f3-6177-4d95-ab0b-c1d75b518752" ac:name="confiform" ac:schema-version="1">
<ac:parameter ac:name="formName">relationForm</ac:parameter>
<ac:parameter ac:name="debugMode">true</ac:parameter>
<ac:parameter ac:name="registrationFormTitle">Relation</ac:parameter>
<ac:rich-text-body>
<ac:structured-macro ac:macro-id="0c2059c4-b1fd-4eb7-aca2-62a4d02a8da0" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="fieldName">worker</ac:parameter>
<ac:parameter ac:name="fieldLabel">worker</ac:parameter>
<ac:parameter ac:name="values">[151552086|workerForm|workerName|true||]</ac:parameter>
<ac:parameter ac:name="type">smartselect2</ac:parameter>
<ac:parameter ac:name="macroHash">-246133216</ac:parameter>
</ac:structured-macro> <ac:structured-macro ac:macro-id="2cefcef5-46df-4fe2-beb1-9bcc6695ee95" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="fieldName">job</ac:parameter>
<ac:parameter ac:name="fieldLabel">job</ac:parameter>
<ac:parameter ac:name="values">[151552086|jobForm|jobName|true||]</ac:parameter>
<ac:parameter ac:name="type">smartmultiselect</ac:parameter>
<ac:parameter ac:name="macroHash">178773469</ac:parameter>
</ac:structured-macro>
<ac:structured-macro ac:macro-id="06f44f39-724b-4c22-8c16-ded2a7aa2f86" ac:name="confiform-ifttt" ac:schema-version="1">
<ac:parameter ac:name="formName">relationForm</ac:parameter>
<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">takenJobs=[entry.worker.takenJobs.transform(id).asList],[entry.job.transform(id).asList]</ac:parameter>
<ac:parameter ac:name="extras2">id:[entry.worker]</ac:parameter>
<ac:parameter ac:name="macroHash">1996864112</ac:parameter>
<ac:parameter ac:name="who">workerForm:this</ac:parameter>
<ac:rich-text-body>
<br/>
</ac:rich-text-body>
</ac:structured-macro>
<ac:structured-macro ac:macro-id="b6c5f3d6-73a4-4167-bd28-e321d9365f3a" ac:name="confiform-ifttt" ac:schema-version="1">
<ac:parameter ac:name="extras5">true</ac:parameter>
<ac:parameter ac:name="condition">hasChanged(job):true</ac:parameter>
<ac:parameter ac:name="formName">relationForm</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">jobsToRemove=id:[entry.job.transform(id).join( OR id:)]</ac:parameter>
<ac:parameter ac:name="extras2">id:[entry.worker]</ac:parameter>
<ac:parameter ac:name="macroHash">1241104894</ac:parameter>
<ac:parameter ac:name="who">workerForm:this</ac:parameter>
<ac:rich-text-body>
<p>
<br/>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<br/>
<br/>
</ac:rich-text-body>
</ac:structured-macro>
<ac:structured-macro ac:macro-id="2cc78431e37a2efde7c263f5b49d98ac" ac:name="confiform-entry-register" ac:schema-version="1">
<ac:parameter ac:name="redirectMode">View</ac:parameter>
<ac:parameter ac:name="formName">relationForm</ac:parameter>
<ac:parameter ac:name="showMessageAs">Below the form</ac:parameter>
<ac:rich-text-body>
<p>
<br/>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<ac:structured-macro ac:macro-id="45da5be23b68b3537d3894363c317472" ac:name="confiform-table" ac:schema-version="1">
<ac:parameter ac:name="formName">relationForm</ac:parameter>
<ac:rich-text-body>
<p>
<br/>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<ac:structured-macro ac:macro-id="21f377c0-b4be-4c6e-9331-8c463819d880" ac:name="confiform" ac:schema-version="1">
<ac:parameter ac:name="formName">workerForm</ac:parameter>
<ac:parameter ac:name="debugMode">true</ac:parameter>
<ac:parameter ac:name="registrationFormTitle">Add worker</ac:parameter>
<ac:rich-text-body>
<p>
<ac:structured-macro ac:macro-id="e9b319b1-5647-48b8-abea-eea428ca8e07" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="fieldName">workerName</ac:parameter>
<ac:parameter ac:name="fieldLabel">workerName</ac:parameter>
<ac:parameter ac:name="type">text</ac:parameter>
<ac:parameter ac:name="macroHash">-1928161866</ac:parameter>
</ac:structured-macro> <ac:structured-macro ac:macro-id="fd273408-d7c6-43d4-9711-25374f4dd138" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="fieldName">takenJobs</ac:parameter>
<ac:parameter ac:name="fieldLabel">takenJobs</ac:parameter>
<ac:parameter ac:name="values">[151552086|jobForm|jobName|true||]</ac:parameter>
<ac:parameter ac:name="type">smartmultiselect</ac:parameter>
<ac:parameter ac:name="macroHash">202151837</ac:parameter>
</ac:structured-macro>
</p>
<ac:structured-macro ac:macro-id="f22ea623-c992-49e8-8137-4cb856787409" ac:name="confiform-ifttt" ac:schema-version="1">
<ac:parameter ac:name="condition">!jobsToRemove:[empty] AND hasChanged(jobsToRemove):true</ac:parameter>
<ac:parameter ac:name="formName">relationForm</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">takenJobs=[entry.takenJobs.asFilteredBy([entry.jobsToRemove]).transform(id).asList]&amp;jobsToRemove=</ac:parameter>
<ac:parameter ac:name="extras2">id:[entry.id]</ac:parameter>
<ac:parameter ac:name="macroHash">1241104894</ac:parameter>
<ac:parameter ac:name="who">workerForm:this</ac:parameter>
<ac:rich-text-body>
<p>
<br/>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<p>??</p>
</ac:rich-text-body>
</ac:structured-macro>
<ac:structured-macro ac:macro-id="3b2aab70eeff5b24f67b13100198431d" ac:name="confiform-entry-register" ac:schema-version="1">
<ac:parameter ac:name="redirectMode">View</ac:parameter>
<ac:parameter ac:name="formName">workerForm</ac:parameter>
<ac:parameter ac:name="formTitle">Add worker</ac:parameter>
<ac:parameter ac:name="showMessageAs">Below the form</ac:parameter>
<ac:rich-text-body>
<p>
<ac:structured-macro ac:macro-id="9d53979f-6aed-40a1-8be1-89fbc5a619ac" ac:name="confiform-field" ac:schema-version="1">
<ac:parameter ac:name="fieldName">workerName</ac:parameter>
<ac:parameter ac:name="macroHash">1698054672</ac:parameter>
</ac:structured-macro>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<ac:structured-macro ac:macro-id="b5a7c7b4646bef47c577c1b144655733" ac:name="confiform-table" ac:schema-version="1">
<ac:parameter ac:name="formName">workerForm</ac:parameter>
<ac:rich-text-body>
<p>
<br/>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<p>
<br/>
</p>
<ac:structured-macro ac:macro-id="ac6daa90-740a-43b3-8818-821604f892a5" ac:name="confiform" ac:schema-version="1">
<ac:parameter ac:name="formName">jobForm</ac:parameter>
<ac:parameter ac:name="debugMode">true</ac:parameter>
<ac:parameter ac:name="registrationFormTitle">Add job</ac:parameter>
<ac:rich-text-body>
<ac:structured-macro ac:macro-id="49b900ea-da4b-446b-97b6-ee5bcf4477f5" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="fieldName">jobName</ac:parameter>
<ac:parameter ac:name="fieldLabel">jobName</ac:parameter>
<ac:parameter ac:name="type">text</ac:parameter>
<ac:parameter ac:name="macroHash">-306646284</ac:parameter>
</ac:structured-macro> <ac:structured-macro ac:macro-id="e96fa1b0-4cd4-4bdf-8c60-2a842f7900e8" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="fieldName">assignedWorkers</ac:parameter>
<ac:parameter ac:name="fieldLabel">assignedWorkers</ac:parameter>
<ac:parameter ac:name="values">[151552086|workerForm|workerName|true||]</ac:parameter>
<ac:parameter ac:name="type">smartmultiselect</ac:parameter>
<ac:parameter ac:name="macroHash">-611441773</ac:parameter>
</ac:structured-macro>
</ac:rich-text-body>
</ac:structured-macro>
<ac:structured-macro ac:macro-id="35ea044686f3e7ceaa683bc1377290c5" ac:name="confiform-entry-register" ac:schema-version="1">
<ac:parameter ac:name="redirectMode">View</ac:parameter>
<ac:parameter ac:name="formName">jobForm</ac:parameter>
<ac:parameter ac:name="formTitle">Add job</ac:parameter>
<ac:parameter ac:name="showMessageAs">Below the form</ac:parameter>
<ac:rich-text-body>
<p>
<ac:structured-macro ac:macro-id="9b21325b-8f01-40b5-8ee1-d5f656688bf6" ac:name="confiform-field" ac:schema-version="1">
<ac:parameter ac:name="fieldName">jobName</ac:parameter>
<ac:parameter ac:name="macroHash">-1767462537</ac:parameter>
</ac:structured-macro>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<ac:structured-macro ac:macro-id="53a416bb61264a261dcbb91d0262b16b" ac:name="confiform-table" ac:schema-version="1">
<ac:parameter ac:name="formName">jobForm</ac:parameter>
<ac:rich-text-body>
<p>
<br/>
</p>
</ac:rich-text-body>
</ac:structured-macro>
```

Alex


author: Piotr Gugnowski
body: [@Alex Medved _ConfiForms_](/t5/user/viewprofilepage/user-id/781630) hey, I've reproduced your solution and it seems not to work. When you add 3 jobs to one worker and edit relation in such a way, that you remove the middle one suddenly everything disappears from a row.  

Is it even possible to do it in a manner that i originally presented with minor corrections? Because now, it's not really symmetrical solution, if i decide to extend it to assignedWorkers field I cannot use relationForm in a similar manner as in takenJobs.


author: Alex Medved _ConfiForms_
body: It is working for me

One thing was missing in my answer is the IFTTT for the "relationForm" to handle removals (should be similar to what I have in the onCreated)

```
 <ac:structured-macro ac:macro-id="57065a35-794e-4373-8251-c8faf09bc927" ac:name="confiform-ifttt" ac:schema-version="1">
<ac:parameter ac:name="condition">hasChanged(job):true</ac:parameter>
<ac:parameter ac:name="formName">relationForm</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">takenJobs=[entry.worker.takenJobs.transform(id).asList],[entry.job.transform(id).asList]</ac:parameter>
<ac:parameter ac:name="extras2">id:[entry.worker]</ac:parameter>
<ac:parameter ac:name="macroHash">1996864112</ac:parameter>
<ac:parameter ac:name="who">workerForm:this</ac:parameter>
<ac:rich-text-body>
<br/>
</ac:rich-text-body>
</ac:structured-macro>
```

Not sure I understand your other questions, **feel free to extend the configuration to satisfy your needs**. I am just trying to demonstrate the concept you can use to do what you asked

Alex


author: Piotr Gugnowski
body: Yeah, your idea to add extra field and use ifttt rule on workerForm side worked out :) Thank you so much.


Tags: confiforms

confluence-server

server