Support » Plugin: Dataverse Integration » FetchXML: How to output formatted values / labels

  • Resolved kimineko

    (@kimineko)


    Hi there,

    probably a quick question. After switching to the new plugin I am getting only the int values of option set fields – how can I display their labels instead?

    Currently I am getting the following results:

    {{ ud_tutorial.udc_executionmode }} –> 752400001
    {{ ud_tutorial.ineko_booking_status }} –> 745500000
    {{ dump(ud_tutorial.ineko_booking_status) }} –> int(745500000)

    {{ dump(ud_tutorial) }}

    object(AlexaCRM\Xrm\Entity)#30323 (6) {
      ["Attributes"]=>
      array(7) {
        ["ineko_booking_status"]=>
        int(745500000)
        ["ud_name"]=>
        string(7) "EAM2205"
        ["udc_executionmode"]=>
        int(752400001)
        ["ud_enddatetime"]=>
        string(20) "2022-06-12T00:00:00Z"
        ["ud_tutorialid"]=>
        string(36) "a753d6f0-b2f6-eb11-94ef-00224884a08b"
        ["ud_startdatetime"]=>
        string(20) "2022-05-14T00:00:00Z"
        ["udc_seminartype1.udc_workshopsdays"]=>
        int(6)
      }
      ["FormattedValues"]=>
      array(5) {
        ["ineko_booking_status"]=>
        string(4) "🟢"
        ["udc_executionmode"]=>
        string(18) "virtuelle Präsenz"
        ["ud_enddatetime"]=>
        string(10) "12.06.2022"
        ["ud_startdatetime"]=>
        string(10) "14.05.2022"
        ["udc_seminartype1.udc_workshopsdays"]=>
        string(1) "6"
      }
      ["attributeState":protected]=>
      object(AlexaCRM\Xrm\AttributeState)#30465 (0) {
        ["attributes":protected]=>
        uninitialized(array)
      }
      ["Id"]=>
      string(36) "a753d6f0-b2f6-eb11-94ef-00224884a08b"
      ["LogicalName"]=>
      string(11) "ud_tutorial"
      ["KeyAttributes"]=>
      NULL
    }

    Thanks in advance.

    Best
    Kim

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author alexacrm

    (@alexacrm)

    Kim,

    have a look at https://alexacrm.com/kb/dataverse/twig-dv/accessing-choice-columns-metadata/

    Thanks
    AlexaCRM Support
    — If you find our plugin useful, please consider rating it and leaving a review

    Thread Starter kimineko

    (@kimineko)

    Hi,

    thank you for the quick reply.

    I implemented it as described, but that gives me the whole optionset as a dropdown. What I need is to just display the fields label as set on the record.

    To clarify I am not trying to display a form but the results of a FetchXML-query.

    The information is present in the dump of said query – e.g. [“udc_executionmode”]=> string(18) “virtuelle Präsenz” where the string is what I need to output for each record.

    Could you help me with that?

    Best
    Kim

    • This reply was modified 5 months, 4 weeks ago by kimineko.
    Plugin Author alexacrm

    (@alexacrm)

    You need to use formatted_value filter as documented

    {{ ud_tutorial | formatted_value("udc_executionmode") }}

    Thread Starter kimineko

    (@kimineko)

    Thank you! That was excatly what I was looking for.

    Kind regards
    Kim

    Plugin Author alexacrm

    (@alexacrm)

    Glad it’s working. As you can see from the dump, you can also use FormattedValues collection to access the value.

    Thanks
    AlexaCRM Support
    — If you find our plugin useful, please consider rating it and leaving a review

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.