Can we edit the dropdown label which will populated dynamically and save that into table

Certified Associate Developer

Hi I have a requirement  I want to edit the prepopulated dropdown  label name   which will be coming from ref table and save that  into other table.  My first doubt is can we do that ?

  Discussion posts and replies are publicly visible

  • 0
    Certified Lead Developer

    Can you elaborate on your use case? Normally labels are not saved it database but the respective values are stored in fields in the table. 

  • 0
    Certified Associate Developer
    in reply to Harsha Sharma

    Yes as you said only Ids will be getting stored in the table.  in my case also  for a particular client some pre existing plans are coming from ref table which i will be showing in the drop down  and User can select some plans from the dropdown and selected plan ids are getting stored into new  client plan table. later using the query for I am displaying those plan in another task . this is easy normal flow. But now I want to edit the plan names which showing in the dropdown it should not affect the ref table value but to show in the other task it need to be edited.

  • 0
    Certified Lead Developer
    in reply to iswarya2812

    Got it. In cases like this, generally below approach is followed : 

    In the reference table,  include a value labelled 'Other'. If a user wants to input something that isn't available in the dropdown list, they can select 'Other' from the dropdown.

    As a developer, when the user selects 'Other', you should display a text field near the dropdown. This allows the user to manually enter their custom value.

    In the main data table where you store the selected dropdown value, you should save the ID corresponding to 'Other'. Additionally, you’ll need a separate column to store the custom value entered by the user in the text field.

    Whenever 'Other' is selected, this custom value field becomes mandatory and must be filled in before the data can be saved.

    In other tasks you can add an if condition checking if selected dropdown value relates to 'Other' then show the value from the related otherColumn in record else show the value from ref table. 

    Hope that clears things up!

  • 0
    Certified Associate Developer
    in reply to Harsha Sharma

    Hi I think I failed to explain the requirements properly. ref table is not really like ref table its the main table also plan id plan name everything is there  so for a particular client multiple plans lined for them is stored in there and it will used across multiple applications .If I add others then i need to add   it for all the clients right. I want to edit the pre displaying plan name without affecting the original table .

  • 0
    Certified Lead Developer

    Yes, it's possible. Create a separate override table to store client-specific plan names. When displaying, check override table first - if custom name exists, show that; otherwise show original. Editing saves only to override table, never touching your main plans table.

  • 0
    Certified Associate Developer
    in reply to Shubham Aware

    Hi, Can you elaborate it more please. Thank you.

  • 0
    Certified Lead Developer
    in reply to iswarya2812

    In that case when you query the dropdown can you put a filter with particular client only 'Other' option is visible and not for others

    f I add others then i need to add   it for all the clients right.
  • 0
    Certified Lead Developer
    in reply to iswarya2812

    Create Override Record Type with fields : id, clientId, planId, overrideName, etc...

    Add Relationship & Custom Field : In your existing Main Plans Record Type, add a one-to-many relationship to the Override record using planId as the common field. Create a custom record field called "displayName" that checks if an override exists - if yes, show the overrideName from the override record, otherwise show the original plan name.

    Query Expression Rule: Build an expression rule named that accepts clientId as input. Query the Main Plans record type filtered by clientId and include the related Plan Name Override records also filtered by the same clientId. The query should return planId, original planName, and the custom displayName field.

    Interface Setup : Create an interface with local variables for storing the plans query result, selected plan ID, edit mode flag, and temporary custom name(local!tempName). Display a dropdown field that uses the displayName from your query results as labels and planId as values. Place an Edit link next to the dropdown.

    Implement Edit Mode When Edit link is clicked, switch the interface to show a text field instead of dropdown. Pre-populate the text field with the current display name. Change the Edit link to show Save. The text field should save into your local custom name variable(local!tempName).

    Save the Override On Save click, use writeRecords to create or update a record in the Override record type with the clientId, planId, and custom name(local!tempName.). After successful save, refresh your plans query to show the updated name and switch back to dropdown view.

  • 0
    Certified Associate Developer
    in reply to Shubham Aware

    HI  , thanks  you so much for providing the detailed implementation. one question if 5 plans are there in the dropdown then I need to show 5 text field right.

  • 0
    Certified Lead Developer
    in reply to iswarya2812

    No, you only need one textField. Dropdown is replaced by ONE text field showing only the selected plan’s name.

    This makes interface simple for dev and user experience.