Dynamics 365 v9 Virtual Entity using OOB OData v4 Provider - PART 3
In the previous post Dynamics 365 v9 Virtual Entity using OOB OData v4 Provider - PART 2, we created the virtual entity Jobs in Dynamics 365.
In this post, we are going to run a few testing scenarios with this virtual entity.
Viewing, sorting & searching
When I created the virtual entity, I ticked the Sales area to display the entity. So navigate to Sales -> Jobs. The home grid will display.
Click the column Scheduled Start to sort by ascending.
Page 1:
Page 2:
Sorting works fine for all other columns.
Type in Job 14 in grid search text box, and job with Job Name 14 is shown.
Query sent to API:
$filter=startswith(JobName,'Job%2028')&$top=25&$select=JobName,ScheduledStart,CustomerId,JobId&$count=true
Type in 31/12/2018 in grid search text box, and job with Scheduled Start on that day is shown.
Query sent to API:
/Jobs?$filter=ScheduledStart ge 2019-01-09T00:00:00Z and ScheduledStart le 2019-01-10T00:00:00Z or startswith(JobName,'9/01/2019')&$top=25&$select=JobName,ScheduledStart,CustomerId,JobId&$count=true
Type in Adventure in grid search text box, and no result is found.
It seems like Dynamics 365 doesn't allow searching on lookup field of virtual entity. The request sent to the API was using filter on JobName only, not Customer.
/Jobs?$filter=startswith(JobName,'Adventure')&$top=25&$select=JobName,ScheduledStart,CustomerId,JobId&$count=true
Global Search
Firstly, make sure you add Job virtual entity for Categorized Search.
Go to Settings -> Administration -> System Settings
Then add Job from Available Entities.
Save the settings.
Go to Global Search text box and type in Job 23 for example.
What about Relevance Search? We can go back to system settings and enable Relevance Search. You need to wait for Azure Search to index the data. You can try searching an account that you know it exists, the indexing process is finished when you see the account shows up in the relevance search result.
Now type in Job 12 in global search text box. There is no job data being displayed, which is expected. The Azure Search indexing process indexes data in Dynamics 365 database rather than querying Dynamics 365 Web API to retrieve data. During indexing process and searching for the job name, there is no request to our custom OData API.
Advanced Find:
Use advanced find, and construct queries using the available fields.
And results:
Marketing List Query
It is quite common to segment customer using related data in Dynamics 365 using marketing list query. We will see if virtual entity can be used here.
We would like to send out email to accounts who have jobs scheduled. Remember in our Job virtual entity there is a Customer lookup column. This relationship links jobs to an account. It is One to Many from Account to Job.
So we create a marketing list, either dynamics or static, it doesn't matter, and select Account for Targeted At field. After it is saved, click on Management Members button at the top command bar.
In the query screen, we would like to select the related entity Jobs (Customer). After carefully search through the list, this One to Many relationship doesn't appear in the list.
So, One to Many relationship doesn't work in Marketing List query. How about Many to One relationship?
To test this, we will create a new Lookup field in the Account entity. The lookup field will be called "Primary Job" and it looks up the Job virtual entity.
Now open any of the accounts and fill in the Primary Job by looking up a job record. Save the account record.
Go back to the marketing list, and click Manage Members button in the top command bar. In the query screen, we want the query to say "accounts with primary job being scheduled on or after 01/12/2018".
Unfortunately again, we can't find Primary Jobs in related entities. So Many to One relationship also doesn't work.
However, you can see Primary Job field of the Account entity in the query though. But that's as much as you can use virtual entity for in Marketing List.
Activities, Notes and Document Management
They are all supported.
When you create the virtual entity, make sure you tick the tick boxes for Activities, Notes and Documents. And everything will work like the normal entities.
Enable Document Management for virtual entity.
Update document to a job record.
In addition to above, the entity form of the virtual entity is fully customizable. Business rules can be created and activated for virtual entity. However, Business Process Flow is not available.
Further more, chat is not available for virtual entity. But, FetchXML SSRS report can use and display virtual entity data and it can be run against a list of virtual entity records or a single virtual entity record.
Export to Excel also works fine. You just can't make changes in dynamics worksheet and publish the changes back.
This series of virtual entity blog posts end here. I will let you to explore the remaining.
In this post, we are going to run a few testing scenarios with this virtual entity.
Viewing, sorting & searching
When I created the virtual entity, I ticked the Sales area to display the entity. So navigate to Sales -> Jobs. The home grid will display.
Click the column Scheduled Start to sort by ascending.
Page 1:
Page 2:
Sorting works fine for all other columns.
Type in Job 14 in grid search text box, and job with Job Name 14 is shown.
Query sent to API:
$filter=startswith(JobName,'Job%2028')&$top=25&$select=JobName,ScheduledStart,CustomerId,JobId&$count=true
Type in 31/12/2018 in grid search text box, and job with Scheduled Start on that day is shown.
Query sent to API:
/Jobs?$filter=ScheduledStart ge 2019-01-09T00:00:00Z and ScheduledStart le 2019-01-10T00:00:00Z or startswith(JobName,'9/01/2019')&$top=25&$select=JobName,ScheduledStart,CustomerId,JobId&$count=true
Type in Adventure in grid search text box, and no result is found.
It seems like Dynamics 365 doesn't allow searching on lookup field of virtual entity. The request sent to the API was using filter on JobName only, not Customer.
/Jobs?$filter=startswith(JobName,'Adventure')&$top=25&$select=JobName,ScheduledStart,CustomerId,JobId&$count=true
Global Search
Firstly, make sure you add Job virtual entity for Categorized Search.
Go to Settings -> Administration -> System Settings
Then add Job from Available Entities.
Save the settings.
Go to Global Search text box and type in Job 23 for example.
What about Relevance Search? We can go back to system settings and enable Relevance Search. You need to wait for Azure Search to index the data. You can try searching an account that you know it exists, the indexing process is finished when you see the account shows up in the relevance search result.
Now type in Job 12 in global search text box. There is no job data being displayed, which is expected. The Azure Search indexing process indexes data in Dynamics 365 database rather than querying Dynamics 365 Web API to retrieve data. During indexing process and searching for the job name, there is no request to our custom OData API.
Advanced Find:
Use advanced find, and construct queries using the available fields.
And results:
Marketing List Query
It is quite common to segment customer using related data in Dynamics 365 using marketing list query. We will see if virtual entity can be used here.
We would like to send out email to accounts who have jobs scheduled. Remember in our Job virtual entity there is a Customer lookup column. This relationship links jobs to an account. It is One to Many from Account to Job.
So we create a marketing list, either dynamics or static, it doesn't matter, and select Account for Targeted At field. After it is saved, click on Management Members button at the top command bar.
In the query screen, we would like to select the related entity Jobs (Customer). After carefully search through the list, this One to Many relationship doesn't appear in the list.
So, One to Many relationship doesn't work in Marketing List query. How about Many to One relationship?
To test this, we will create a new Lookup field in the Account entity. The lookup field will be called "Primary Job" and it looks up the Job virtual entity.
Now open any of the accounts and fill in the Primary Job by looking up a job record. Save the account record.
Go back to the marketing list, and click Manage Members button in the top command bar. In the query screen, we want the query to say "accounts with primary job being scheduled on or after 01/12/2018".
Unfortunately again, we can't find Primary Jobs in related entities. So Many to One relationship also doesn't work.
However, you can see Primary Job field of the Account entity in the query though. But that's as much as you can use virtual entity for in Marketing List.
Activities, Notes and Document Management
They are all supported.
When you create the virtual entity, make sure you tick the tick boxes for Activities, Notes and Documents. And everything will work like the normal entities.
Enable Document Management for virtual entity.
Update document to a job record.
In addition to above, the entity form of the virtual entity is fully customizable. Business rules can be created and activated for virtual entity. However, Business Process Flow is not available.
Further more, chat is not available for virtual entity. But, FetchXML SSRS report can use and display virtual entity data and it can be run against a list of virtual entity records or a single virtual entity record.
Export to Excel also works fine. You just can't make changes in dynamics worksheet and publish the changes back.
This series of virtual entity blog posts end here. I will let you to explore the remaining.
Comments
Post a Comment