All selected values must be present in the choiceValues array

Certified Associate Developer

Hi, 
Dropdown field is getting error, can anyone provide inputs to resolve.

a!localVariables(
local!refData: rule!EC_getReferenceData(
appName: "EC",
category: cons!EC_REFERENCE_CATEGORY[{ 2, 3, 4, 5 }]
),
local!departmentList: rule!EC_filterRefData(
refData: local!refData,
category: cons!EC_REFERENCE_CATEGORY[2]
),
local!Existing_Emp_ID: if(
rule!APN_IsBlank(
ri!Employee['recordType!{13a37d27-9cf0-4b44-aa16-596960c2aeb6}EC Employee.fields.{5dd14089-6372-498b-bdd4-49221479de4c}id']
),
false(),
true()
),
local!Emp_Data: length(
rule!EC_getEmployeeDetails(
empRefId: ri!Employee['recordType!{13a37d27-9cf0-4b44-aa16-596960c2aeb6}EC Employee.fields.{5dd14089-6372-498b-bdd4-49221479de4c}id']
)
),
local!EMP_Code: if(
rule!APN_IsBlank(
ri!Employee['recordType!{13a37d27-9cf0-4b44-aa16-596960c2aeb6}EC Employee.fields.{5dd14089-6372-498b-bdd4-49221479de4c}id']
),
concat("EC" & local!Emp_Data + 1),
ri!Employee['recordType!{13a37d27-9cf0-4b44-aa16-596960c2aeb6}EC Employee.fields.{190fbb44-7340-4745-adf2-285aee6f93ef}code']
),
local!roles: if(
a!isNotNullOrEmpty(
ri!Employee['recordType!{13a37d27-9cf0-4b44-aa16-596960c2aeb6}EC Employee.fields.{5dd14089-6372-498b-bdd4-49221479de4c}id']
),
rule!EC_getRoles(
refData: rule!EC_filterRefData(
refData: local!refData,
category: cons!EC_REFERENCE_CATEGORY[{ 3, 4, 5 }]
),
departRefData: local!departmentList,
departRefId: ri!Employee['recordType!{13a37d27-9cf0-4b44-aa16-596960c2aeb6}EC Employee.fields.{7a819dc1-9f65-45cb-8f81-431b676275ab}dept']
),
{}
),
local!label: if(
a!isNullOrEmpty(
ri!Employee['recordType!{13a37d27-9cf0-4b44-aa16-596960c2aeb6}EC Employee.fields.{5dd14089-6372-498b-bdd4-49221479de4c}id']
),
"Onboard New Employee",
"Update Employee Details"
),
local!skills: rule!EC_getSkillsDetails(id: null),
a!sectionLayout(
label: "",
contents: {
a!richTextDisplayField(
value: a!richTextItem(
text: local!label,
color: "#4F91CD",
size: "LARGE",
style: "STRONG"
),
align: "CENTER"
),
a!cardLayout(
contents: {
a!sectionLayout(
label: "Personal Details",
labelColor: "#DD7E6B",
contents: {
a!columnsLayout(
columns: {
a!columnLayout(
contents: {
a!textField(
label: "First Name",
labelPosition: "ABOVE",
placeholder: "Enter Employee First Name",
value: ri!Employee['recordType!{13a37d27-9cf0-4b44-aa16-596960c2aeb6}EC Employee.fields.{6ce6cae6-d431-48e4-a89c-c681a5cc08fb}firstname'],
saveInto: ri!Employee['recordType!{13a37d27-9cf0-4b44-aa16-596960c2aeb6}EC Employee.fields.{6ce6cae6-d431-48e4-a89c-c681a5cc08fb}firstname'],
characterLimit: 255,
required: true,
requiredMessage: "Enter First Name"
),
a!textField(
label: "Username",
labelPosition: "ABOVE",
placeholder: "Enter Employee Username",
value: ri!Employee['recordType!{13a37d27-9cf0-4b44-aa16-596960c2aeb6}EC Employee.fields.{6b268b44-0ced-4748-a0f5-0fc618042134}username'],
saveInto: a!save(
ri!Employee['recordType!{13a37d27-9cf0-4b44-aa16-596960c2aeb6}EC Employee.fields.{6b268b44-0ced-4748-a0f5-0fc618042134}username'],
stripwith(save!value, " ")
),
characterLimit: 255,
required: true,
requiredMessage: "Enter Username",
readOnly: local!Existing_Emp_ID
),
a!textField(
label: "Email",
labelPosition: "ABOVE",
placeholder: "Example: abc@bitsinglass.com",
value: ri!Employee['recordType!{13a37d27-9cf0-4b44-aa16-596960c2aeb6}EC Employee.fields.{87701692-70a2-46be-8ddb-87de0517fefa}email'],
saveInto: ri!Employee['recordType!{13a37d27-9cf0-4b44-aa16-596960c2aeb6}EC Employee.fields.{87701692-70a2-46be-8ddb-87de0517fefa}email'],
characterLimit: 255,
required: true,
requiredMessage: "Enter Email",
readOnly: local!Existing_Emp_ID
),
a!textField(
label: "Gender",
labelPosition: "ABOVE",
value: ri!Employee['recordType!{13a37d27-9cf0-4b44-aa16-596960c2aeb6}EC Employee.fields.{45c54222-c953-41c9-906e-01187d108117}gender'],
showWhen: local!Existing_Emp_ID,
readOnly: local!Existing_Emp_ID
)
}
),
a!columnLayout(
contents: {
a!textField(
label: "Last Name",
labelPosition: "ABOVE",
placeholder: "Enter Employee Last Name",
value: ri!Employee['recordType!{13a37d27-9cf0-4b44-aa16-596960c2aeb6}EC Employee.fields.{baaa7f3f-fa45-4488-987e-0b7fae95c549}lastname'],
saveInto: ri!Employee['recordType!{13a37d27-9cf0-4b44-aa16-596960c2aeb6}EC Employee.fields.{baaa7f3f-fa45-4488-987e-0b7fae95c549}lastname'],
characterLimit: 255,
required: true,
requiredMessage: "Enter Last Name"
),
a!dateField(
label: "Date Of Birth",
labelPosition: "ABOVE",
value: ri!Employee['recordType!{13a37d27-9cf0-4b44-aa16-596960c2aeb6}EC Employee.fields.{8743278d-f9a0-4409-8118-1f58f1e9238c}dob'],
saveInto: ri!Employee['recordType!{13a37d27-9cf0-4b44-aa16-596960c2aeb6}EC Employee.fields.{8743278d-f9a0-4409-8118-1f58f1e9238c}dob'],
required: true,
requiredMessage: "Select DOB",
readOnly: local!Existing_Emp_ID,
validations: {}
),
a!dropdownField(
label: "Gender",
labelPosition: "ABOVE",
placeholder: "--- Select Gender ---",
choiceLabels: { "Male", "Female" },
choiceValues: { "Male", "Female" },
value: ri!Employee['recordType!{13a37d27-9cf0-4b44-aa16-596960c2aeb6}EC Employee.fields.{45c54222-c953-41c9-906e-01187d108117}gender'],
saveInto: ri!Employee['recordType!{13a37d27-9cf0-4b44-aa16-596960c2aeb6}EC Employee.fields.{45c54222-c953-41c9-906e-01187d108117}gender'],
searchDisplay: "AUTO",
showWhen: not(local!Existing_Emp_ID),
required: true,
requiredMessage: "Select Gender",
validations: {}
)
}
)
}
)
},
divider: "ABOVE",
dividerWeight: "MEDIUM"
),
a!sectionLayout(
label: "Job Details",
labelColor: "#DD7E6B",
contents: {
a!columnsLayout(
columns: {
a!columnLayout(
contents: {
/*a!textField(*/
/*label: "Type of the User",*/
/*labelPosition: "ABOVE",*/
/*value: index(*/
/*rule!EC_getDepbyFilterApnTable(*/
/*id: ri!Employee['recordType!{13a37d27-9cf0-4b44-aa16-596960c2aeb6}EC Employee.fields.{7a819dc1-9f65-45cb-8f81-431b676275ab}dept']*/
/*),*/
/*'recordType!{cc3afe66-5963-414d-be82-e3024edecf43}EC Reference Types.fields.{5517dd61-7e88-4f2d-a439-1d84d6661ae6}label',*/
/*{}*/
/*),*/
/*showWhen: local!Existing_Emp_ID,*/
/*readOnly: local!Existing_Emp_ID*/
/*),*/
a!dropdownField(
label: "Type of the User",
labelPosition: "ABOVE",
placeholder: "--- Select a Value ---",
choiceLabels: index(local!departmentList, "label", {}),
choiceValues: index(local!departmentList, "id", {}),
value: {
if(
count(
wherecontains(
ri!Employee['recordType!{13a37d27-9cf0-4b44-aa16-596960c2aeb6}EC Employee.fields.{7a819dc1-9f65-45cb-8f81-431b676275ab}dept'],
index(local!departmentList, "id", {})
)
),
ri!Employee['recordType!{13a37d27-9cf0-4b44-aa16-596960c2aeb6}EC Employee.fields.{7a819dc1-9f65-45cb-8f81-431b676275ab}dept'],
null
)
},
saveInto: {
ri!Employee['recordType!{13a37d27-9cf0-4b44-aa16-596960c2aeb6}EC Employee.fields.{7a819dc1-9f65-45cb-8f81-431b676275ab}dept'],
a!save(
ri!Employee['recordType!{13a37d27-9cf0-4b44-aa16-596960c2aeb6}EC Employee.fields.{2bb43728-f1d2-4eee-bad1-b86f7c45813a}role'],
null()
),
a!save(
local!roles,
rule!EC_getRoles(
refData: rule!EC_filterRefData(
refData: local!refData,
category: cons!EC_REFERENCE_CATEGORY[{ 3, 4, 5 }]
),
departRefData: local!departmentList,
departRefId: ri!Employee['recordType!{13a37d27-9cf0-4b44-aa16-596960c2aeb6}EC Employee.fields.{7a819dc1-9f65-45cb-8f81-431b676275ab}dept']
)
)
},
searchDisplay: "AUTO",
/*showWhen: not(local!Existing_Emp_ID),*/
required: true,
requiredMessage: "Select Type of the User",
validations: {}
)
}
),
a!columnLayout(
contents: {
a!dropdownField(
label: "Role",
labelPosition: "ABOVE",
placeholder: "--- Select a Value ---",
choiceLabels: if(
a!isNullOrEmpty(local!roles),
{},
index(local!roles, "label", {})
),
choiceValues: if(
a!isNullOrEmpty(local!roles),
{},
index(local!roles, "id", {})
),
value: if(
a!isNullOrEmpty(local!roles),
null(),

if(
count(
wherecontains(
ri!Employee['recordType!{13a37d27-9cf0-4b44-aa16-596960c2aeb6}EC Employee.fields.{2bb43728-f1d2-4eee-bad1-b86f7c45813a}role'],
index(local!roles, "id", {})
)
),
ri!Employee['recordType!{13a37d27-9cf0-4b44-aa16-596960c2aeb6}EC Employee.fields.{2bb43728-f1d2-4eee-bad1-b86f7c45813a}role'],
null()
)

),
saveInto: ri!Employee['recordType!{13a37d27-9cf0-4b44-aa16-596960c2aeb6}EC Employee.fields.{2bb43728-f1d2-4eee-bad1-b86f7c45813a}role'],
searchDisplay: "AUTO",
required: true,
requiredMessage: "Select Role",
validations: {}
)
}
)
}
),
a!columnsLayout(
columns: {
a!columnLayout(
contents: {
a!sideBySideLayout(
items: {
a!sideBySideItem(
item: a!pickerFieldCustom(
label: "Manager Username",
labelPosition: "ABOVE",
placeholder: "Search Employee by UserName",
maxSelections: 1,
suggestFunction: rule!EC_PickerFieldExpression(
labels: rule!EC_GetGroupUsers(cons!EC_GROUP_MANAGER).username,
identifiers: rule!EC_GetGroupUsers(cons!EC_GROUP_MANAGER).username,
filter: _
),
selectedLabels: if(
a!isNotNullOrEmpty(
ri!Employee['recordType!{13a37d27-9cf0-4b44-aa16-596960c2aeb6}EC Employee.fields.{7283ee4f-ceb0-4ac5-8dcb-9819e19bcb9a}manager']
),
{
ri!Employee['recordType!{13a37d27-9cf0-4b44-aa16-596960c2aeb6}EC Employee.fields.{7283ee4f-ceb0-4ac5-8dcb-9819e19bcb9a}manager']
},
{}
),
value: if(
a!isNotNullOrEmpty(
ri!Employee['recordType!{13a37d27-9cf0-4b44-aa16-596960c2aeb6}EC Employee.fields.{7283ee4f-ceb0-4ac5-8dcb-9819e19bcb9a}manager']
),
{
ri!Employee['recordType!{13a37d27-9cf0-4b44-aa16-596960c2aeb6}EC Employee.fields.{7283ee4f-ceb0-4ac5-8dcb-9819e19bcb9a}manager']
},
{}
),
saveInto: a!save(
ri!Employee['recordType!{13a37d27-9cf0-4b44-aa16-596960c2aeb6}EC Employee.fields.{7283ee4f-ceb0-4ac5-8dcb-9819e19bcb9a}manager'],
save!value
),
required: true
)
),
a!sideBySideItem(
item: a!dropdownField(
label: "Skills",
labelPosition: "ABOVE",
placeholder: "-- Select Skills --",
choiceLabels: local!skills['recordType!{edc80661-1356-45a7-95fb-e30db614cb5b}EC Skill.fields.{325a786a-3a66-43f9-8898-c192b79a2319}name'],
choiceValues: local!skills['recordType!{edc80661-1356-45a7-95fb-e30db614cb5b}EC Skill.fields.{1b1e1263-478e-45b3-9b93-bcf0d8f7b848}id'],
value: ri!Employee['recordType!{13a37d27-9cf0-4b44-aa16-596960c2aeb6}EC Employee.fields.{b10472c1-fe3c-4929-ae78-fdf30ed82cdb}skillRefIds'],
saveInto: ri!Employee['recordType!{13a37d27-9cf0-4b44-aa16-596960c2aeb6}EC Employee.fields.{b10472c1-fe3c-4929-ae78-fdf30ed82cdb}skillRefIds'],
required: true
)
)
}
)
}
)
}
),
a!columnsLayout(
columns: {
a!columnLayout(
contents: {
a!sideBySideLayout(
items: {
a!sideBySideItem(
item: a!dateField(
label: "Date Of Joining",
labelPosition: "ABOVE",
value: ri!Employee['recordType!{13a37d27-9cf0-4b44-aa16-596960c2aeb6}EC Employee.fields.{c0537d99-858e-43c4-9c28-f8507fac78de}doj'],
saveInto: ri!Employee['recordType!{13a37d27-9cf0-4b44-aa16-596960c2aeb6}EC Employee.fields.{c0537d99-858e-43c4-9c28-f8507fac78de}doj'],
required: true,
requiredMessage: "Select DOJ",
readOnly: local!Existing_Emp_ID
)
)
}
)
}
)
}
)
},
divider: "ABOVE",
dividerWeight: "MEDIUM",
marginAbove: "MORE"
),
a!buttonLayout(
primaryButtons: {
a!buttonWidget(
label: if(
a!isNullOrEmpty(
ri!Employee['recordType!{13a37d27-9cf0-4b44-aa16-596960c2aeb6}EC Employee.fields.{5dd14089-6372-498b-bdd4-49221479de4c}id']
),
"SUBMIT",
"UPDATE"
),
value: true(),
saveInto: {
ri!submit,
a!save(
ri!Employee['recordType!{13a37d27-9cf0-4b44-aa16-596960c2aeb6}EC Employee.fields.{190fbb44-7340-4745-adf2-285aee6f93ef}code'],
local!EMP_Code
)
},
submit: true,
style: "PRIMARY",
validate: true
)
},
secondaryButtons: {
a!buttonWidget(
label: "Cancel",
value: false(),
saveInto: a!save(ri!submit, save!value),
submit: true,
style: "NORMAL",
validate: false
)
}
)
}
)
}
)
)

  Discussion posts and replies are publicly visible

Parents
  • Please use the insert code feature to make it more readable and indented. 
    Now coming to error, the dropdown works in a way where the selected item has to be in the list of items that can be selected (choiceValues) else Appian will error out. 

    Now you will have to find that why the value is coming as a space and not something from the choiceValues. Also, one more thing I noticed in your code is that the dropdown "Type of the user" has a weird value condition. You have wrapped the value in count() function but never compared it to anything. In this case, it will give you true for every non zero value and false if it returns 0

Reply
  • Please use the insert code feature to make it more readable and indented. 
    Now coming to error, the dropdown works in a way where the selected item has to be in the list of items that can be selected (choiceValues) else Appian will error out. 

    Now you will have to find that why the value is coming as a space and not something from the choiceValues. Also, one more thing I noticed in your code is that the dropdown "Type of the user" has a weird value condition. You have wrapped the value in count() function but never compared it to anything. In this case, it will give you true for every non zero value and false if it returns 0

Children
No Data