In Microsoft Dynamics 365 FetchXML, is there a way to check a text field with the condition that it begins with "xxABC", where "xx" can be anything?
This is actually possible (to my surprise).
I created a few Account records, named:
"aacd"
"abcde"
"zxcdef"
Using _ as the placeholder for single characters I got the desired result:
<fetch top="50">
<entity name="account">
<attribute name="name" />
<filter>
<condition attribute="name" operator="like" value="__cd%" />
</filter>
</entity>
</fetch>
Under the hood this like condition appears to be translated into T-SQL. Take a look at the documentation LIKE (Transact-SQL) and have fun!
Related
How to unmerge records which are merged from D365 OOB feature? Is there any custom code solution ?
Unfortunately, un-merging cannot be achieved in any OOB option and AFAIK, no community solutions are available.
As this is totally a rare requirement, we can build some console app for this.
We know that the master record will get/copy all the subordinate record field values after merging (based on choice in Merge screen), the subordinate record will get deactivated (still holding its original field values only). All the related records will be remapped to master record. So we have to reverse engineer all this for un-merging.
From my research, looks like the deactivated subordinate record will hold the master record as a link in masterid field. We have to pull all these records using the query below & iterate through each record, and then achieve what we want.
<fetch>
<entity name="contact" >
<attribute name="fullname" />
<attribute name="merged" />
<attribute name="masterid" />
<filter>
<condition attribute="merged" operator="eq" value="1" />
</filter>
</entity>
</fetch>
I want to retrieve records from multiple entities by matching text. Is it possible using fetchxml or web api? I want to use it by javascript.
This is certainly achievable using FetchXML. Specifically you want to use the like operator. For example the following Fetch Query searches contact name and email for a given value:
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
<entity name="contact">
<attribute name="fullname" />
<attribute name="contactid" />
<filter type="and">
<filter type="or">
<condition attribute="fullname" operator="like" value="%[Insert Dynamic Value]%" />
<condition attribute="emailaddress1" operator="like" value="%[Insert Dynamic Value]%" />
</filter>
</filter>
</entity>
</fetch>
Write a similar fetch query for each table you wish to search.
Is it possible to combine all entities together instead of requesting separately using fetchXml?
No, by design FetchXML does not support querying multiple unrelated records. Although you can query against related records in a single fetch expression, you are not able to enforce OR conditions across multiple tables. For example, you cannot write a FetchXML query comparable to the following SQL:
SELECT *
FROM contact
JOIN account on contact.accountid = account.accountid
WHERE contact.fullname like '%foo%'
OR account.name like '%foo%'
It appears to be possible, though unsupported, to access Relevance Search via an API: https://bguidinger.com/blog/relevance-search-api
I am using the below FetchXML
<filter type="and">
<condition attribute="emailaddress" operator="eq" value="jon#gmail.com" />
</filter>
So is there a way to ignore casing in Fetch XML?
It depends on sql server Database Settings. Default is case insensitive.
Although it’s optional, consider accepting the SQL Server default settings for Collation Designator, Sort Order, and SQL Collation. Dynamics 365 for Customer Engagement supports the following collation orders:
Case-sensitive
Case-insensitive
Accent-sensitive
Accent-insensitive
Binary sort order (such as Latin1_General_100_BIN)
https://learn.microsoft.com/en-us/dynamics365/customer-engagement/on-premises/sql-server-requirements-recommendations
I have added a custom table with data in liferay. Now i want to search those data in elastic search.What will be the approach to get the data.
Suppose I add a custom table add entity in service.xml then i want to search these data from elastic search url sample http://localhost:9200.
<entity local-service="true" name="Student" remote-service="true"
uuid="true">
<column name="studentId" primary="true" type="long" />
<column name="name" type="String" />
<column name="sollNumber" type="int" />
<column name="entryDate" type="Date" />
<order by="asc">
<order-column name="name" />
</order>
<finder name="Name" return-type="Collection">
<finder-column name="name" />
</finder>
</entity>
I have added data from mysql script and get those data through elatic search url
You could make your entity an Asset. Liferay uses Indexers for maintaining the external index data (and you'd have to write one). Alternatively (if you don't care about your data being found in Liferay, and shown in Liferay's search results, you could also index to Elasticsearch manually whenever your data changes (e.g. on every add..., update... or delete... method call)
I'm using the following XML to fetch all the contacts.
<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='true'>
<entity name='contact'>
<attribute name='fullname' />
<attribute name='emailaddress1' />
<order attribute='fullname' descending='false' />
<link-entity name='listmember' from='entityid' to='contactid' visible='false' intersect='true'>
<link-entity name='list' from='listid' to='listid' alias='aa'>
<filter type='and'>
<condition attribute='listname' operator='eq' value='myList' />
</filter>
</link-entity>
</link-entity>
</entity>
</fetch>
However, I'd like the CRM also to produce the leads (preferably in the same list). Is it doable and if so, how?
As far as I know this isn't possible.
Mscrm will return zero or more records for a single entity and zero or more records from entities linked to those in a single call.
For example your fetch above gets contacts and list members linked to contacts.
You could retrieve leads linked to your contacts in a single call, but if you want all leads you will have to perform a separate call.
Edit:
"(a) two different <entity> section in the same <fetch>" - This wont work because its not valid schema.
FetchXML Schema
entity element - used for specifying the root element for a fetch,
only
one root entity is allowed in a given fetch, all others
are dependent on this entity and are marked as
link-entity
"(b) on a super class that both contacts and leads inherit from" - This wont work because as far as I know it doesn't exist. Although a single object Entity exists that can be used to represent all records in code, I don't believe this allows querying of multiple entities at once.