1

I have a list of departments (store, administration.. ). In my component I've set this list as the datasource for a droplist. One of the departments has name "storeOutside" and a display name "Store/Outside". When I add this department to my component, the value in this field is set to "storeOutside" instead of the display name "Store/Outside".

Do I have to create a graphQL to get the displayname, or is there a way to get the displayname in the component?

0

2 Answers 2

1

If you have the possibility to use Droplink instead of Droplist do that. Droplist field stores only the current name of the selected item but Droplink stores the item ID reference which would work in your case. With the ID reference you should able to get the display name of the selected item.

1

Droplist is simply an item name (string) and it does not know anything about what item you have selected. Better you go with DropLink and get the TargetItem and take out the display name. However I will suggest you to create a new Field in your datasource items and fetch them for your component.

((LookupField)item.Fields["DropLinkField"]).TargetItem.DisplayName

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.