Is there a way to display record picker as a dropdown?

Hello everyone,

Is there a way to display record picker as a dropdown?

  Discussion posts and replies are publicly visible

Parents
  • No, if you want to display a dropdown, you'll have to use the dropdown component instead and populate the list of options with a query.

  • Hello

    Thank you for replying. 

    I am not sure how to write the query and the configuration of dropdown when using a query,

    Could you please give some sample examples of them

    Thanks and regards,

    Aishwarya

  • 0
    Certified Lead Developer
    in reply to aishwaryap0266

    a!localVariables(
    local!pickedState,
    local!dropdowndata: rule!qe_getallStates().data,
    local!stateLabels: index(local!dropdowndata, "state", null()),
    local!stateAbbreviations: index(local!dropdowndata, "id", null()),
    a!dropdownField(
    label: "States",
    instructions: "Enter the employee's state of residence.",
    choiceLabels: local!stateLabels,
    choiceValues: local!stateAbbreviations,
    placeholder: "Select a US state",
    value: local!pickedState,
    saveInto: local!pickedState,

    )
    )

  • 0
    Certified Senior Developer
    in reply to aishwaryap0266

    a!queryRecordType(
    recordType: 'recordType!{SYSTEM_RECORD_TYPE_USER}User',
    fields: {
    'recordType!{SYSTEM_RECORD_TYPE_USER}User.fields.{SYSTEM_RECORD_TYPE_USER_FIELD_username}username'
    },
    filters: a!queryLogicalExpression(
    operator: "AND",
    filters: {
    a!queryFilter(
    field: 'recordType!{SYSTEM_RECORD_TYPE_USER}User.fields.{SYSTEM_RECORD_TYPE_USER_FIELD_active}active',
    operator: "=",
    value: true
    )
    },
    ignoreFiltersWithEmptyValues: true
    ),
    pagingInfo: a!pagingInfo(
    startIndex: 1,
    batchSize: 100
    )
    ).data

    (if you are using community site use this as it is, Cause(User record type holds all the users data of your site)), or if you working in server try to write query to database where it holds user data(Use a!queryentity) & in choice values directly reference this in choice values & choice labels

Reply
  • 0
    Certified Senior Developer
    in reply to aishwaryap0266

    a!queryRecordType(
    recordType: 'recordType!{SYSTEM_RECORD_TYPE_USER}User',
    fields: {
    'recordType!{SYSTEM_RECORD_TYPE_USER}User.fields.{SYSTEM_RECORD_TYPE_USER_FIELD_username}username'
    },
    filters: a!queryLogicalExpression(
    operator: "AND",
    filters: {
    a!queryFilter(
    field: 'recordType!{SYSTEM_RECORD_TYPE_USER}User.fields.{SYSTEM_RECORD_TYPE_USER_FIELD_active}active',
    operator: "=",
    value: true
    )
    },
    ignoreFiltersWithEmptyValues: true
    ),
    pagingInfo: a!pagingInfo(
    startIndex: 1,
    batchSize: 100
    )
    ).data

    (if you are using community site use this as it is, Cause(User record type holds all the users data of your site)), or if you working in server try to write query to database where it holds user data(Use a!queryentity) & in choice values directly reference this in choice values & choice labels

Children