All selected value must be present in the choiceValues array, but value was 2;4 and choiceValues was 4;3

hi team.

I have a requirement as:

I have to create data using some dropdown values and after creation of that data user can delete that data from where that drop data is coming and once data is deleted from frontend then

when user tries to edit that created data then error throws as:

since value of that dropdown is deleted by the user then while editing how to handle this error

please suggest any answer 

   

  Discussion posts and replies are publicly visible

Parents Reply Children
  • 0
    Certified Senior Developer
    in reply to Stefan Helzle

      

    Sample code for you reference:

    a!localVariables(
      /*Query the selected Ids saved*/
      local!selectedValues: { 1, 2, 3, 4 },
      local!allStatusList: {
        a!queryRecordType(
          recordType: 'recordType!{c7aaff95-ce56-464f-8cee-382355601ed8}CSCM Lookup',
          filters: a!queryLogicalExpression(
            operator: "AND",
            ignoreFiltersWithEmptyValues: true(),
            filters: {
              a!queryFilter(
                field: 'recordType!{c7aaff95-ce56-464f-8cee-382355601ed8}CSCM Lookup.fields.{16b61379-08fe-4d34-a71f-54c7366c94e4}lookupType',
                operator: "=",
                value: cons!CSCM_TXT_LOOKUP_TYPE_SERVICE_TYPE
              )
            }
          ),
          pagingInfo: a!pagingInfo(
            startIndex: 1,
            batchSize: cons!CSCM_INT_BATCH_SIZE_EXTRA_SMALL,
            sort: a!sortInfo(
              field: 'recordType!{c7aaff95-ce56-464f-8cee-382355601ed8}CSCM Lookup.fields.{c43d180d-159f-47b2-9e59-5487550b9bed}id',
              ascending: true
            )
          )
        ).data
      },
      local!activeStatusList: index(
        local!allStatusList,
        wherecontains(
          true(),
          toboolean(
            index(
              local!allStatusList,
              'recordType!{c7aaff95-ce56-464f-8cee-382355601ed8}CSCM Lookup.fields.{2bc67ffb-5c05-4e04-9d61-55fa46bc27a9}isActive',
              null
            )
          )
        ),
        null
      ),
      local!activeStatusListIds: index(
        local!activeStatusList,
        'recordType!{c7aaff95-ce56-464f-8cee-382355601ed8}CSCM Lookup.fields.{c43d180d-159f-47b2-9e59-5487550b9bed}id',
        null
      ),
      local!deletedIdsFromList: difference(
        tointeger(local!selectedValues),
        tointeger(local!activeStatusListIds)
      ),
      local!currentlyActiveSelectValues: difference(
        local!selectedValues,
        local!deletedIdsFromList
      ),
      {
        a!multipleDropdownField(
          label: "Status",
          placeholder: "--Select a value--",
          choiceLabels: index(
            local!activeStatusList,
            'recordType!{c7aaff95-ce56-464f-8cee-382355601ed8}CSCM Lookup.fields.{2bfd5d5e-b8b3-4cb8-aa22-f72c594b2c63}lookupValue',
            null
          ),
          choiceValues: index(
            local!activeStatusList,
            'recordType!{c7aaff95-ce56-464f-8cee-382355601ed8}CSCM Lookup.fields.{c43d180d-159f-47b2-9e59-5487550b9bed}id',
            null
          ),
          value: local!currentlyActiveSelectValues,
          saveInto: local!currentlyActiveSelectValues
        ),
        a!richTextDisplayField(
          showWhen: a!isNotNullOrEmpty(local!deletedIdsFromList),
          value: a!richTextItem(
            color: "NEGATIVE",
            text: "Attention: The below values which are selected are not currently active now -" & index(
              index(
                local!allStatusList,
                wherecontains(
                  tointeger(local!deletedIdsFromList),
                  tointeger(
                    index(
                      local!allStatusList,
                      'recordType!{c7aaff95-ce56-464f-8cee-382355601ed8}CSCM Lookup.fields.{c43d180d-159f-47b2-9e59-5487550b9bed}id',
                      null
                    )
                  )
                ),
                null
              ),
              'recordType!{c7aaff95-ce56-464f-8cee-382355601ed8}CSCM Lookup.fields.{2bfd5d5e-b8b3-4cb8-aa22-f72c594b2c63}lookupValue',
              null
            )
          )
        )
      }
    )
     S