Can I get the non-coded values through a webhook?

537
3
07-17-2018 08:17 AM
by Anonymous User
Not applicable

I have a drop down list of names which uses initials as the coded value and I would like the actual display value to be sent through a webhook. can I do this?

e.g. the value is JS for John Smith, right now JS is the only attribute I am able to show.

Thanks

Tags (2)
3 Replies
JohnathanHasthorpe
Esri Regular Contributor

Hi Joel

Only codes (i.e. values) are included in the survey payload. Not names (i.e. labels). The name is actually a property of the service and it is not included in the survey submission.

I'll get this added as an enhancement request.

Thanks

John

by Anonymous User
Not applicable

Hi Joel Meier‌,

I came across the same issue earlier.

To get around this I just wrote an IF condition. A bit archaic but gets the job done

if value equals codeA, display labelA, otherwise ......

IsmaelChivite
Esri Notable Contributor

Geethaka Fernando‌  Joel Meier‌  Johnathan Hasthorpe

As of version 3.1, we can use the jr:choice-name function.

  • jr:choice-name: This function takes a choice list value as an input and returns its label. The syntax goes as follows:

jr:choice-name(${activity},'${activity}')

The first parameter represents the choice name. In the example above, I am passing the choice name selected in the 'activity' question.  The second parameter is the question in the form using the list where the choice has been made.  Very often, the first and second parameters will reference the same question, but note that the second parameter is enclosed with quotes, because it does not refer to the value (response) of the question, but to the actual question itself.

This is a very handy function in a handful of scenarios. For example, when you want to pass the label of a choice into a webhook, when you want to store a selection in a feature layer using the label or when you want to use the choice label in a note.

You can use this function in a calculate or hidden question. The label stored in your calculate or  hidden question will be part of the payload of your webhook.

I thought some of this would be cool to have documented in a more formal way, so I published a post with some details: https://community.esri.com/groups/survey123/blog/2018/12/02/survey123-tricks-of-the-trade-xlsform-fu...