Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Friendly Names #882

Closed
dmkweima opened this issue Mar 14, 2023 · 7 comments
Closed

Friendly Names #882

dmkweima opened this issue Mar 14, 2023 · 7 comments

Comments

@dmkweima
Copy link

Hello,

I would like to know what FetchXML is required to render the results I get when Friendly Names us enabled. My results are what I need but the FetchXML code doesn't render those results.

Its Business Unit with the name attribute displayed rather than the busniessunitid.

Thanks
Dean Krueger

@rappen
Copy link
Owner

rappen commented Mar 15, 2023

Hi

I hope you like code, to see how I get the Friendly Names... 🤓

Start in this repo: https://github.com/rappen/Rappen.XTB.Helper/

Details in the XRMDataGridView is here: https://github.com/rappen/Rappen.XTB.Helper/blob/18166e771343e7419a84dea7f8b11d236d34f817/Rappen.XTB.Helpers/Controls/XRMDataGridView.cs#L841-L851

This is calling the AttributeToString method: https://github.com/rappen/Rappen.XTB.Helper/blob/18166e771343e7419a84dea7f8b11d236d34f817/Rappen.XRM.Helpers/Serialization/EntitySerializer.cs#L384-L452

Click on from there...

Summary: it's not one only in FetchXML.

@rappen
Copy link
Owner

rappen commented Mar 15, 2023

Another way to get what you need is probably a looot easier....

Don't only get these query:

<fetch>
  <entity name='account'>
    <attribute name='name' />
    <attribute name='owningbusinessunit' />
  </entity>
</fetch>

But get the actual name from the related Business Unit:

<fetch>
  <entity name='account'>
    <attribute name='name' />
    <attribute name='owningbusinessunit' />
    <link-entity name='businessunit' from='businessunitid' to='owningbusinessunit' alias='B'>
      <attribute name='name' />
    </link-entity>
  </entity>
</fetch>

Result now shows their name also:
image

(ok, boring "name" of the BU, sorry about that in my environment)

@rappen
Copy link
Owner

rappen commented Aug 1, 2023

Related to this improvement: rappen/Rappen.XTB.Helper#31 and rappen/Rappen.XTB.Helper#34

@dmkweima
Copy link
Author

dmkweima commented Aug 7, 2023

The Friendly Name is great, would be even greater to be able to see the XML required to generate the XML that I see when Friendly Names is on. IE I am trying to pull a few fields that are Choice fields in the Dataverse. When I return the Dynamics field, I am getting the number Value rather than the Lable. Your Friendly Names shows it correctly, but of course the code only renders out the number.

I have looked all over the internet to try to get the syntax to do this.

image

Can it be done with a filter or link-entity? Sorry, this is new to me.

Thanks
Dean

@rappen
Copy link
Owner

rappen commented Aug 8, 2023

Ah, sorry... the "Friendly names" of choices, for example, is not found in the fetch XML. You have to query the metadata to get them. Might be a bit difficult, that is why I have done it in my controls to show meta-related info automagical.

@dmkweima
Copy link
Author

dmkweima commented Aug 8, 2023

I have to return the "Choice" Label name in my FetchXML. Are you saying this is not possible using FetchXML?

I know if I was using C# I could make it happen, but I am limited to returning all the data in FetchXML syntax.

Thank you!
Dean

@rappen
Copy link
Owner

rappen commented Aug 10, 2023

image

image

rappen added a commit that referenced this issue Aug 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants