How to check if received input value matches the allowed list of values

Hi Everyone,

I have a field orderType which can have any value like customer , customer order , cust order etc.
The allowed valued for order type are customer , cut , install , HTYR,… etc.
How can i check if the orderType received in input is the same as allowed list.

I have tried using indexOf service but it fails in the below case
input - customer order
configured allowed type - customer , cut , install , HTYR, GTYU, UITO, UTYFST
pub.string:indexOf gives me output as positive , here 1 , as it takes customer as a value and shows the index of customer , hence it fails . because the actual input is ‘customer order’ which should not be allowed

Kindly suggest me a solution.
Appreciate a quick response.



what about checking the “input validation” checkbox in Designer on the Input/Output-tab of the service?

When the field has a properly configured pick list, this input validation should fail and the service should be bypassed with an error message in the error log or server.log.


“Validate input” won’t force check the pick list choices settings.

To avoid unexpected value, you need check “Validate input” checkbox, and set the content type property of the field as below.

  1. Select “string {XML Schema}”
  2. Click “Customize” button
  3. Add all the allowed value in the “pattern” list

This field OrderType is in a document , which i am using as a reference in mid of the code somewhere. Since its not a part of input i can not select validate input.
I just need a way to compare input string which is customer order with the pre configured values like customer, HGTY, cut, install etc.
If my input string matches the configured string i shall go ahead with the processing.

Also this is just one field which i need to check on , rest other fields has no such condition.

If you can’t update the field definition in document type, you could add Branch step in the flow to choose different way based on the field value.


in this case you can try to use pub.schema:validate using your document definition for the conformsTo parameter if the document contains the values in the constraints for the field.

If pub.schema:validate is not an option, you can use the fallback scenario described by Xiaowei.
Remember to add a $default-Sequence at the end of the branch to log an error message "Unknown value for field ".

Can you provide a snippet which shows how the field is defined in document?