@josephmarkovich take a look at boolean column type metadata. It’s an optionset but uses BooleanOptionSetMetadata. See https://docs.microsoft.com/power-apps/developer/data-platform/webapi/reference/booleanoptionsetmetadata?view=dataverse-latest. Instead of Options you’d use TrueOption and FalseOption.
-
This reply was modified 3 years, 7 months ago by
alexacrm.
So am I essentially doing something like this?
{% set optionfalse = metadata["contact"].Attributes["jcma_showonexpertdirectory"].BooleanOptionSet.FalseOption %}
{% set optiontrue = metadata["contact"].Attributes["jcma_showonexpertdirectory"].BooleanOptionSet.TrueOption %}
And then to get the data in the form, this?
<option value=”{{ optionfalse.Value }}”>{{ optionfalse.Label }}</option>
Or do I need do a for loop like other option sets?
Thank you.
Joe
@josephmarkovich not quite. You still need to access OptionSet object:
{% set optionfalse = metadata["contact"].Attributes["donotemail"].OptionSet.FalseOption %}
{% set optiontrue = metadata["contact"].Attributes["donotemail"].OptionSet.TrueOption %}
<div>
<select>
<option value="{{optionfalse.Value}}">{{optionfalse.Label.UserLocalizedLabel.Label}} ({{optionfalse.Value}})</option>
<option value="{{optiontrue.Value}}">{{optiontrue.Label.UserLocalizedLabel.Label}} ({{optiontrue.Value}})</option>
</select>
</div>
You can debug object hierarchy (php format) using dump function (enabled when WP_DEBUG is true):
{{ dump(metadata["contact"].Attributes["donotemail"] }}