Confiforms: use id in IFFFT post from Dynamic Dropdown (webservice) field
Asked by Steffen Menzel:

Hi,

I just can't get the ID of a "Dynamic Dropdown (Webservice)" to be sent in an IFFFT POST using the proxy feature.

Instead, the content of the field is always transmitted.

See screenshot:  
![grafik.png](https://community.atlassian.com/t5/image/serverpage/image-id/244935i0E029A77F77B5E2E/image-dimensions/196x233?v=v2 "grafik.png")  
I have stored "\[entry.name\]" as "ID", which is also correctly displayed in the display name (screenshot 2):

![Screenshot 2023-03-10 114448.jpg](/t5/image/serverpage/image-id/244934i475BD36E732F16DD/image-dimensions/272x34?v=v2 "Screenshot 2023-03-10 114448.jpg")

I send in IFFFT-POST: "\[entry.field_name.id\]"

However, I get the following error back

"customfield_10457":"user 'Groupware Test 1###gtest1' was not found in system"}}

Is it even possible to IFFFT post a parameter received via proxy?


Answers:
author: Alex Medved _ConfiForms_
body: Hi

What web-service mapping does this call generate and if that has an "id" in fields returned for the "result row"?

I understand that "id" is what you have redefined with \[entry.name\] value

Alex

comments: author: Steffen Menzel
body: Hi, many thanks for the answer. The web service is a Jira system and I wanted to make the existing users available there in Confiforms. The FullDisplayName should be displayed, but of course the user name (in Jira = "name" or "key") should be sent.

The json structure sent by Jira looks like this (searched for "am"):

```
[
?? ?{
?? ??? ?"recordId": 1,
?? ??? ?"total": 2,
?? ??? ?"created": 1678691580862,
?? ??? ?"header": "2 von 2 der entsprechenden Benutzer werden angezeigt",
?? ??? ?"id": "5e91c4d1ae94f60812c75f3607285f28",
?? ??? ?"users": [
?? ??? ??? ?{
?? ??? ??? ??? ?"displayName": "Ann-Marie M?ller",
?? ??? ??? ??? ?"name": "amueller",
?? ??? ??? ??? ?"html": "Ann-Marie M?ller - ann-marie.mueller@test.de (<strong>am</strong>ueller)",
?? ??? ??? ??? ?"key": "amueller"
?? ??? ??? ?},
?? ??? ??? ?{
?? ??? ??? ??? ?"displayName": "Anita Maier",
?? ??? ??? ??? ?"name": "amaeier",
?? ??? ??? ??? ?"html": "Anita Maier - anita.Maier@test.de (<strong>am</strong>aier)",
?? ??? ??? ??? ?"key": "amaier"
?? ??? ??? ?}
?? ??? ?]
?? ?}
]
```

I assumed that I have to store the web service key in the field definition, which is processed by Confiforms as "\[entry.field_name.id\]". That's why I put "\[entry.name\]" there and entered "\[entry.field_name.id\]" in the IFFFT. I've tried various different variants (e.g. "\[entry.field_name.name\]"), but all without success. That's why I was wondering if this would work at all with a dynamic dropdown (web service) field...


author: Alex Medved _ConfiForms_
body: Hi

But you literally**dont have any** *id* field in the "users" object

```
{
?? ??? ??? ??? ?"displayName": "Ann-Marie M?ller",
?? ??? ??? ??? ?"name": "amueller",
?? ??? ??? ??? ?"html": "Ann-Marie M?ller - ann-marie.mueller@test.de (<strong>am</strong>ueller)",
?? ??? ??? ??? ?"key": "amueller"
?? ??? ??? ?},
```

Alex


author: Steffen Menzel
body: Hi,

indeed, but what do I have to write as field name into the IFFFT-body so that the (JSON-) name string is submitted and not the displayname? Maybe I don't describe my use case enough:  

When I start entering some letters, it should be displayed the full display name in the field. Then the user can select it and this will be displayed in the field box. But when the user submits the formular, the username ("name") should be sent to the server.

\[entry.field_name.asJSON.name\] - does not work  
\[entry.field_name.name\] - transmitts the displayname  
\[entry.field_name\] - transmitts the displayname

Thanks and regards,

Steffen


author: Steffen Menzel
body: Hi,

I went through the documentation a little more and here (<https://wiki.vertuna.com/display/CONFIFORMS/Accessing+field+values+and+properties>) my last question was explained in more detail:

"Each dropdown choice has ID and LABEL  
\[entry.myfield\] returns ID"

That is, while displaying the LABEL field to the user, I can IFFFT-POST the ID field by \[entry.field_name\]. So in my "ID" field I have to put string "name" (or "key").

And indeed, the ID string is transmitted via IFFFT if I remove the "Proxy" check mark and replace the "\[entry.field_name\]" string in the service URL with a random string for searching a username.

But that brings me back to my first sentence in the first POST:

I just can't get the ID of a "Dynamic Dropdown (Webservice)" to be sent in an IFFFT POST using the proxy feature.

Only the LABEL is ever sent (or what was entered in the text field...).


author: Steffen Menzel
body: For documentation: My solution:

In the field definition I defined "\[entry.displayName\] (\[entry.name\])" as LABEL. In the IFFFT macro, I parse out \[entry.name\] using velocity.  
By doing this I am displaying something different to the user than what is being sent via POST.


Tags: confiforms

confluence-server

server