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.
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!
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 : []
}
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
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 290,900 Super User 2024 Season 2
Martin Dráb 229,297 Most Valuable Professional
nmaenpaa 101,156