Email Us: sales@initiativeits.com.au
HomePostsPosts › Patch OptionSets From Text

Patch OptionSets From Text

When customising some functions or controls, we have found that sometimes you have a text version of a OptionSet value. If you want to patch this then Power Apps will error.

The following has helped.

Use "With" and a LookUp to get the value

If the custom control is called for example, ddCustomDropdown:

With(
    {
        locNameOfTheVarable LookUp(
            Choices('Table'.'choiceName'),
            Text(Value) = ddCustomDropdown.SelectedItem.Value
        ).Value
    },

Patch in the value that we stored in the "With" function

We stored the value as locNameOfTheVarable. We can now call that when we patch.

Patch(
            'Table Name',
            Defaults('Table Name'),
            {
                ChoiceToPatch: locNameOfTheVarable
            }
        )

Don't forget to put another ")" but you should be right to go.


Leave a Comment

First and Last Names
E-mail Address



Ready to Organise and Automate?

Message Us Message Us

Copyright © 2021 Initiative IT. Powered by Oncord