Custom Lookup Control with multi select and with multiple entities

Hi Learners,

Here is the supported / documented way of creating a custom Lookup input control using Client Side Scripting (JavaScript). We can use this to capture multiple records across multiple entities (Just like Party List control in Email Activities). It can be called from form events / HTML web resource to prompt input from users using Lookup control.

JavaScript Sample Code:



When invoked, this function prompts a lookup control as a model dialog (aligned to the right, like Quick Create Form)

Search will be performed across the entities specified in entityTypes property (Accounts, Leads and Contacts in this Sample)

We can select multiple records from the results

When we click on “Add“, the selected entity reference objects are passed to the Success Call back function as below. We can use this information further in our JavaScript Code based on the requirement.


lookupOptions object defines the look and behavior of the lookup control. It has got all the properties that an OOB lookup control on the form would have, like view selection control, disabling most recently used items etc.

Below is the list of properties available. More information available HERE

Property NameTypeRequiredDescription
allowMultiSelectBooleanNoIndicates whether the lookup allows more than one item to be selected.
defaultEntityTypeStringNoThe default entity type to use.
defaultViewIdStringNoThe default view to use.
disableMruBooleanNoDecides whether to display the most recently used(MRU) item.
entityTypesArrayYesThe entity types to display.
filtersArray of objectsNoUsed to filter the results. Each object in the array contains the following attributes:
searchTextStringNoIndicates the default search term for the lookup control.
showBarcodeScannerBooleanNoIndicates whether the lookup control should show the barcode scanner in mobile clients.
viewIdsArrayNoThe views to be available in the view picker. Only system views are supported.

References:

1) https://docs.microsoft.com/en-us/powerapps/developer/model-driven-apps/clientapi/reference/xrm-utility/lookupobjects

Use SQL Connection to Query CDS / Dynamics 365 Data (Works with SSMS and Power BI)

Hello Learners, here is the key take-away from Microsoft Business Applications Summit (MBAS)-2020.

Power Platform provides Tabular Data Stream (TDS) endpoint for CDS, using which we can access environment’s data using SSMS just like how we access the data in on-premise environment (*Only Read is permitted, cannot perform Updates)

**Image Source – Microsoft Docs


Below are the key points to remember.

  1. Its in Preview and not available for all regions. It works only with version 9.1.0.17437 and above. Check if the latest version is available for your region here. Alternatively you can check the version of your Environment from Settings –>About.

2. To use the SQL connection, you need to enable the Tabular Data Stream (TDS) endpoint using below options

a) Using OrgDBOrgSettingsToolStep-By-Step guidance for the same is available here.
b) Go to https://admin.powerplatform.microsoft.com -> Environments ->(select environment)-> Settings -> Features , and turn Enable TDS EndPoint on.



3. SQL Connection’s Server Name would be <organization url>,5558 (5558 is the port used for TDS endpoint. it is same for all organizations). For authentication, we can use the same Active Directory Credentials that we use to access the Organization. Application Users with Azure Client ID are not supported for now. Step-By-Step guidance is available here

4. The same SQL Connection Can be used in Power BI to analyse data. Step-By-Step guidance HERE

References for more details:

1) https://docs.microsoft.com/en-us/powerapps/developer/common-data-service/cds-sql-query
2) https://docs.microsoft.com/en-us/powerapps/maker/common-data-service/view-entity-data-power-bi
3) https://mymbas.microsoft.com/sessions/5b645f84-8689-4545-9b8a-af94fa2fad7c