Skip to main content
July 13, 2023
Question

Dropdown based on record field values

  • July 13, 2023
  • 2 replies
  • 0 views

Hi! I wanted to create a dropdown for each id generated in one of my records. How can I reference the values into the choice labels and choice values?

I thought about pointing to a constant of the record type column "id", but I´m not sure how to generate it

Thanks a lot!

    2 replies

    mikes0011
    Brainy
    July 13, 2023

    Query your records into local!dropdownValue (for example only)

    choiceLabels: local!dropdownValue[recordType!myRecordType.readableValue],
    choiceValues: local!dropdownValue[recordType!myRecordType.id],

    In the above i'm assuming fields named "readableValue" (basically whatever field in the record type you'd like to show as a text label for the dropdown entries), and "id" which you mentioned.

    The Expression Guru
    ignacio.moran
    July 14, 2023

    Hi Carlos, If I understand well the use case, you just need to save a value that is taken for a dropdown to a field of the record, right?

    Then what I would do is:

    1. Generate a constant with the Choice values
    2. Generate a constant with the Choice labels
    3. Put those constants as choiceLabels and choiceValues in the a!dropdownField
    4. In the SaveInto of the a!dropdownField, save the value selected to the record field: saveInto: {recordType!myRecordType.Whatever}

    I hope it helps.