Skip to main content
February 22, 2023
Question

A dropdown component [label="Type"] has an invalid value for "value". All selected values must be present in the choiceValues array, but value was and choiceValues was 117; 118. (APNX-1-4198-000)

  • February 22, 2023
  • 7 replies
  • 1 view

Getting above error how to resolve .. as value is null ..

7 replies

February 22, 2023

a!localvariables(local!leadData: rule!PRO_qrtLead(leadId: 244).data,

local!credentiallingTypes: if(
a!isNullOrEmpty(
local!leadData['recordType!TRO Lead.fields.credentialingTypeLookupRefId]
),
{},
local!leadData['recordType!TRO Lead.fields.credentialingTypeLookupRefId]
),

a!dropdownField(
label: "Type",
choiceLabels: local!TRO Lookup.fields.label,
choiceValues: local!TRO Lookup.fields.lookupRefId,
placeholder: "---Select Credentialling Types---",
value: local!credentiallingTypes,
saveInto: local!credentiallingTypes
))

February 23, 2023

try using this code

a!localvariables(local!leadData: rule!PRO_qrtLead(leadId: 244).data,

local!credentiallingTypes: if(
a!isNullOrEmpty(
local!leadData['recordType!TRO Lead.fields.credentialingTypeLookupRefId]
),
{},
local!leadData['recordType!TRO Lead.fields.credentialingTypeLookupRefId]
),

a!dropdownField(
label: "Type",
choiceLabels: local!TRO Lookup.fields.label,
choiceValues: local!TRO Lookup.fields.lookupRefId,
placeholder: "---Select Credentialling Types---",
value:if(a!isNullOrEmpty( local!credentiallingTypes),
null(),
local!credentiallingTypes),
saveInto: local!credentiallingTypes
))

harshitb6843
February 23, 2023

Please try to use this feature next time to make the code more readable. 

harshitb6843
February 23, 2023

As the error message indicates, you can only a value in the "value" parameter that is also present in the choice values. This is the basic nature of all the Appian components having multiple options to choose from. 

February 23, 2023

a!dropdownField(
                label: "Select " & cons!TTP_CONFIG_DISPLAY_VALUES[3],
                labelPosition: "ABOVE",
                placeholder: "Select a Data",
                choiceLabels: local!client['recordType!{a3480fb1-15c0-4549-8121-7b4bfe485728}TTP Client.fields.{022666ad-2a5e-48b1-a87a-a30eee29b231}firstName'],
                choiceValues: local!client['recordType!{a3480fb1-15c0-4549-8121-7b4bfe485728}TTP Client.fields.{7cefb235-e416-4c2f-b471-dc52652e4b18}clientId'],
                value: if(
                  and(
                    a!isNotNullOrEmpty(
                      local!client['recordType!{a3480fb1-15c0-4549-8121-7b4bfe485728}TTP Client.fields.{7cefb235-e416-4c2f-b471-dc52652e4b18}clientId']
                    ),
                    contains(
                      local!client['recordType!{a3480fb1-15c0-4549-8121-7b4bfe485728}TTP Client.fields.{7cefb235-e416-4c2f-b471-dc52652e4b18}clientId'],
                      ri!request.clientId
                    )
                  ),
                  ri!request.clientId,
                  null()
                ),
                saveInto: {
                  a!save(ri!request.clientid, save!value),
                  a!save(ri!request.consumerid, null())
                },
                searchDisplay: "AUTO",
                
                required: true,
               
                validations: {}
              )

Check the above code

You can use index function instead of a!isnullOrEmpty

index(recordType!Department(name: "Engineering"), recordType!Department.fields.name, "")

link: docs.appian.com/.../fnc_array_index.html

mikes0011
Brainy
February 23, 2023

As I already pointed out in your duplicate thread, the value must resolve to a non-array NULL when initially loading the dropdown as empty.

The Expression Guru