Tuesday, January 5, 2021
Set Optionset value transition validation
Monday, January 4, 2021
Create Email in Power automate using Email address string / for unresolved recipients
WE come across scenarios where the Email recipients are not the CRM Users/ Contacts/ Queues which can get resolved when chosen in the Activity Party field as To. In such cases, we can use the addressused property of the activity Party to intake the email address string directly.
In the below example, I am going to use a CRM user having a valid address as a sender and direct Email address for the 'To' field.
Steps:
1)Set the, "Allow messages with unresolved email recipients to be sent" option to Yes in System Settings.
2)Set the sender variable with the record type and Guid(Optional, This can also be input directly in the step 4, or the Email address can also be set directly instead of record type-guid)
Store in a variable using compose step - this I did environment specific by storing in a custom config entity. and below is what I have for the dev environment.
systemusers/336e28c4-bdc4-ea11-a812-000d3a79607c
3)In the Create Email Action, at the right top corner of Activity Party section, click on "Switch to detail inputs for an array item".
4)Input the string as below:
[
{
"participationtypemask": 1,
"partyid@odata.bind": @{variables('EmailSender')}
},
{
"participationtypemask": 2,
"addressused": "testemail@fabrikam.com"
}
]
In the above expression,
"participationtypemask": 1 corresponds to Sender,
"participationtypemask": 2 corresponds to recipient.
@{variables('EmailSender')}--> should resolve to the Email sender variable. Sender can also use "addressused" in place of "partyid@odata.bind" in case want to use Email address string instead of the user with guid.
Below is a snapshot
Tuesday, September 8, 2020
LinPadQuery to connect to an org with username, password
<Query Kind="Program">
<NuGetReference>Microsoft.CrmSdk.Deployment</NuGetReference>
<NuGetReference>Microsoft.CrmSdk.Workflow</NuGetReference>
<NuGetReference>Microsoft.CrmSdk.XrmTooling.CoreAssembly</NuGetReference>
<NuGetReference>Microsoft.CrmSdk.XrmTooling.PackageDeployment</NuGetReference>
<Namespace>Microsoft.Xrm.Sdk</Namespace>
<Namespace>Microsoft.Xrm.Sdk.Messages</Namespace>
<Namespace>Microsoft.Xrm.Sdk.Query</Namespace>
</Query>
string authType = "Office365"; // AD, IFD, OAuth, Office365
string user = ".com";
string password = "#########";
string domain = ""; //not required
Microsoft.Xrm.Sdk.IOrganizationService _orgService;
Microsoft.Xrm.Sdk.ITracingService _tracer;
{
_orgService = CreateOrgService();
var account = _orgService.RetrieveMultiple(new Microsoft.Xrm.Sdk.Query.FetchExpression($@"<fetch>
<entity name='account'>
<attribute name='name' />
<attribute name='accountid' />
</entity>
</fetch>"));
}
Microsoft.Xrm.Sdk.IOrganizationService CreateOrgService()
{
var connectionString = $"Url={orgUrl};AuthType={authType};RequireNewInstance=true";
if (!string.IsNullOrEmpty(user))
{
connectionString += $";UserName={user}";
}
if (!string.IsNullOrEmpty(password))
{
connectionString += $";Password={password}";
}
if (!string.IsNullOrEmpty(domain))
{
connectionString += $";Domain={domain}";
}
connectionString.Dump();
return new Microsoft.Xrm.Tooling.Connector.CrmServiceClient(connectionString);
}
Mock XmlHttpRequest /odata request's response in Jasmine Unit test, without using any other module
WE first need to replace the XmlHttpRequest With a Custom one that we can use for responding to the calls:
Mock Xrm.WebApi.retrieveRecord(...).then in Jasmine Unit test without using any other node module
In the describe/beforeEach/it add below :
For Successful call:
Xrm: {
WebApi: {
Sunday, August 2, 2020
Check User Roles - Power Automate
There's a different challenge going this way! the intermediate entity name to be used for list Records action in the flow is not same as the name that we see in the CRM solution, we need to get that from the API service. You can get the same by searching for the relation in the page: https://[OrganisationName].api.crm [Version] .dynamics.com/api/data/v9.0/ (Source : https://ajitpatra.com/2019/08/26/microsoft-flow-retrieve-nn-records-in-d365/)
<entity name="systemuserroles" >
<attribute name="systemuserroleid" />
<filter>
<condition attribute="systemuserid" operator="eq" value="XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX" />
</filter>
<link-entity name="role" from="roleid" to="roleid" link-type="inner" alias="Roles" >
<filter type="or" >
<condition attribute="name" operator="eq" value="roleName1" />
<condition attribute="name" operator="eq" value="roleName2" />
<condition attribute="name" operator="eq" value="roleName3 />
</filter>
</link-entity>
</entity>
And you are ready!


