Extend the Person search report
The Person search report for Microsoft Dynamics 365 for Finance and Operations is backed by an intelligent search processor that is designed to manage a collection of entities for a single person. The Person search report searches Finance and Operations data and creates a set of resulting identifiers. Each result references a search category (for example, Customer) and a result record in a related table. For information about using the Person search report, refer the Person search report topic.
The Person search report will be available in an upconming release for Finance and Operations, Microsoft Dynamics 365 for Retail, and Microsoft Dynamics 365 for Talent. References to Finance and Operations in this topic also apply to Retail and Talent. The Person search report is not currently available for Microsoft Dynamics AX 2012.
Add another entity to the default template
You can add any entity to the default Person search report template. Open the Data management workspace, and select Templates. Add the entity to the template. The entity that you add must include at least one of the fields that are used to filter the Person search report.
Create a new search category
- Use the PersonSearchResultCategory enumeration to distinguish different categories of results, such as workers versus applicants.
- Extend the PersonSearchResultCategory enumeration as needed to create new result types.
Create search processing for the new search category
In this example, you will create a new processor class.
Extend the PersonSearchModule enumeration with a new search area.
Create a class that extends the PersonSearchProcessor class and includes the PersonSearchProcessorFactoryAttribute attribute, with the new person search module area as a parameter.
In the PersonSearchProcessor extended class, override the doSearch method with your desired search logic. As shown in the following example, extend the PersonSearchResult table to create new table relationships.
PersonSearchResultCategory::Customer needs a relation:PersonSearchResult.ResultRecId = CustTable.RecId,PersonSearchResult.ResultTableId = CustTable.TableId
Integrate with the Global address book (Optional)
If you want to integrate with the Global address book, insert any discovered party numbers into the PersonSearchPartyNumberTmp table. The findPartyLink method of PersonSearchProcessor tries to link party numbers to other search artifacts, such as users, customers, or vendors.
This method has a delegate, onFindPartyLink, that lets you specify additional artifacts to search, based on the party numbers.
The PersonSearchCriteria tables let end users specify the parameters by which to search the system for personal data.
Create new search criteria
If you need new search criteria, follow these steps.
- Extend the PersonSearchCriteriaName, PersonSearchCriteriaAddress, and PersonSearchCriteriaKnownId tables, or create your own tables.
- Extend the PersonSearchDialog form to show these new data fields.
- Use the new criteria during search processing.
The PersonSearch form shows the set of results that was discovered by a person search.
Show the new search category in the PersonSearch form
Create a new view on the PersonSearchResult table. This view should restrict results to only your new PersonSearchResultCategory.
Join the view to your result record, and create the view fields that are needed (for example, PersonSearchResultCustomerView).
Extend the PersonSearchResult table to create a new relationship to the new view. This relationship should join on the person search ID.
Extend the PersonSearch form:
Add the new view as a data source.
Add a new tab to the results with the result grid and the Include/Exclude buttons.
Create event handlers for the Include/Exclude buttons to update the PersonSearchResult records.
The PersonSearchEventHandler::updateMarkedOnButtonClicked() method is provided for convenience.
If you want to see the record count in the result caption, create an event handler on the OnQueryExecuted view data source event. Next, call the setResultCountOnGridCaption() method on the PersonSearch form to update the count.
Each PersonSearchEntityFilterRelation record specifies the conditions when a filter should apply, and the filter table and field to apply.
The set of filter relations is compared to the template metadata when the package is built.
For a filter to be created, a PersonSearchResult record with the matching filter category must exist. After it's found, the PersonSearchResult references the table field where the filter value resides.
Create new filters
Use the Chain of Command to extend the PersonSearchEntityFilterRelation table.
Decide on the type and source of the new filter:
- If the filter is an extended data type (EDT) or enumeration, set the MetadataTypeId to the data type ID.
- If the filter is a source table field, specify the source table and source field IDs.
- If the filter is an entity field, specify the entity field ID.
Decide on the filter table and filter field.
The filter table must be available as a PersonSearchResult with a matching category. Otherwise, no filters will be created.
Insert the new filter record.
The person search framework will automatically manage initialization of all exclusions when the form is first opened. Exclusions let you suppress the filter building functionality for specific entity fields.
Create new exclusions
Use the Chain of Command (COC) to extend the PersonSearchEntityExclusion table.
In the CoC method, specify the entity, the entity field, and whether the exclusion is active.
Insert the new exclusion record.
The person search framework will automatically manage initialization of all exclusions when the form is first opened.
If you're extending the Person search report as part of a response to a request for data under the General Data Protection Regulation (GDPR) in the European Union, more information about that regulation is available in the Guide to the GDPR for Microsoft Dynamics 365 for Finance and Operations.
(c)2018 Microsoft Corporation. All rights reserved. This document is provided "as-is." Information and views expressed in this document, including URL and other Internet Web site references, may change without notice. You bear the risk of using it. This document does not provide you with any legal rights to any intellectual property in any Microsoft product. You may copy and use this document for your internal, reference purposes.