web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Customer Service forum

CIF's getEntityMetadata API always returns plain object for Attributes

(1) ShareShare
ReportReport
Posted on by 5

Hi, I am recently working on CIF but a problem troubles me a lot.

I'd like to make my own query statements to simulate the same behaviors of Search, since the param `$search` doesn't work for the returned result if I specified it and make `searchOnly` true in the API `searchAndOpenRecords`.

So, one thing I need to do is to find out these attributes that may be associated with searchText. For example, If searchText is a telephone number, then I need to know telephone1, telephone2, and mobilephone are the related attributes, so that I can make a query like `$filter=contains(telephone1, 'xxx')  or contains(telephone2, 'xxx') or contains(mobilephone, 'xxx')`.

It's easy to get metadata if I use OData, however, for CIF it's difficult. I tried to call `getEntityMetadata` by `const rawRes = await Microsoft.CIFramework.getEntityMetadata('account')`. The command was successfully executed, but in the returned object I found that 'Attributes' is always a plain object.

3872.cif_2D00_1.png

Could you help me with it? Is this a bug in CIF or a wrong operation I've done, if it's the latter, how can I do to achieve my purpose?

Thanks very much!

Categories:
I have the same question (0)
  • Henry J. Profile Picture
    5,237 on at

    Hi Ruphi,

    I've moved your post from the Unified Interface forum to the Customer Service one, more appropriate for Channel Integration Framework questions.

    Henry

  • Ruphi Profile Picture
    5 on at

    Thank you so much @Henry Jammes. By the way, I'd like to make a further description for the issue. I've found that a request were successfully sent and responded when I inspected Network, from the responsive JSON data I could see that 'Attributes' is not an empty property. So it makes me confused, do some unexpected behaviors occur when CIF's API is converting the JSON data to API's returned results?

    And I can meet my requirements by using OData in the following way:

    async function getPhoneFields() {
    const baseUrl =
    `/api/data/v9.0/EntityDefinitions(LogicalName='contact')/Attributes/Microsoft.Dynamics.CRM.StringAttributeMetadata`
    const condition = '?$select=DisplayName,LogicalName,FormatName&$filter=IsSearchable eq true'
    const res = await fetch(`${baseUrl}${condition}`, new Headers({ credentials: true }))
    const data = await res.json()
    return data ? data.value : []
    }


Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

News and Announcements

Season of Giving Solutions is Here!

Quick Links

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard > Customer Service

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans