If unpack.bat is throwing timeout issue then below setting may help…. this property can also be set via app.config/app.settings with the property MaxCrmConnectionTimeOutMinutes Adding the following to ~\..\packages\spkl.1.0.440\tools\spkl.exe.config solved the problem: Hope it helps. Thanks!!
Hide ‘See associated records’ and ‘See all records’ on Sub Grid
As part of UCI two new buttons has been added to the Sub-grid, these are ‘See Associated records’ and ‘See all records’. On click of ‘See Associated records’ will lead us to Associated view of the open record and ‘See al record’ will lead to all records view.
But some time we need to hide those buttons then these button wont show up in ‘Ribbon Workbench’. Thus, to hide these buttons we need to remove from ‘Navigation’ from ‘entity’s form’, you need to just remove only respective navigation not all, ref below image ..
Continue reading “Hide ‘See associated records’ and ‘See all records’ on Sub Grid”Filter Lookups on MSD 365
- Out of box filter No Code: This just configuration on form.
- Simple Lookup filter
function AddCustomFilterToLookup(formContext, fieldName, lookuptypes) {
//below fetchxml will be a custom filter to the lookup
var fetchxml = "<filter type='and'><condition attribute='ownerid' operator='eq-userid'/></filter>";
formContext.getControl(fieldName).addCustomFilter(fetchxml, lookuptypes[0]);
}
- Regarding Object lookup filter
//here fieldName = "regardingobjectid";
// lookuptypes = ["contact", "account", "soft_cust_EntityName", "incident"];
// formContext = executionContext.getFormContext();
function RegardingObjectFilter(formContext, fieldName, lookuptypes) {
var control = formContext.getControl(fieldName);
control.setEntityTypes(lookuptypes);
}
That’s it for now. Thanks!! 🙂
‘Back’ and ‘Save and close’ buttons are not working
Problem: Form navigation within multiple forms ‘Back’ and ‘Save and Close’ buttons stopped working.
Resolution
function Loadform(formId) {
if (!Xrm.Page.ui.formSelector.getCurrentItem) { return; }
var currentForm = Xrm.Page.ui.formSelector.getCurrentItem();
if (currentForm && currentForm.getId() === formId) { return; }
Xrm.Page.ui.formSelector.items.forEach(function (form) {
if (form.getId() === formId)
form.navigate(); });
}
Hope it help!
Thank you!
Linq and Parallel.ForEach loop
If requests are internal then Linq query will perform better over Parallel.ForEach and for external request Parallel.ForEach will perform better than Linq request.
Parller Foreach is faster than traditional For or ForEach loop
private List GetOrganizationRequests(List incidents)
{
var orgRequests = new List();
Parallel.ForEach(incidents.Where(x => x.Contains("statuscode") && x.Contains("qi.queueitemid") && x.Contains("tm.queueid")), incident =>
{
orgRequests.Add(new AddToQueueRequest
{
SourceQueueId = ((EntityReference)((AliasedValue)incident["qi.queueid"]).Value).Id,
Target = new EntityReference("incident", incident.Id),
DestinationQueueId = ((EntityReference)((AliasedValue)incident["tm.queueid"]).Value).Id
});
});
return orgRequests;
}
Linq query for same request
private List GetOrganizationRequests(List incidents) =>
incidents.Where(x => x.Contains("statuscode") && x.Contains("qi.queueitemid") && x.Contains("tm.queueid"))
.Select(z => new AddToQueueRequest()
{
SourceQueueId = ((EntityReference)((AliasedValue)z["qi.queueid"]).Value).Id,
Target = new EntityReference("incident", z.Id),
DestinationQueueId = ((EntityReference)((AliasedValue)z["tm.queueid"]).Value).Id
}).Cast().ToList();
hope its helps !!
Security roles JS updates
UCI has plenty of new features, one it is security roles fetch is very good one though did not creek. Good thing about it is, it will gives us all security roles along with its name in userSettings itself.
Here is code snippet of it
// Get Logged In User's Context
var userSettings = Xrm.Utility.getGlobalContext().userSettings;
// Get Logged In User Security Roles
var loggedInUsersecurityRolesGuids = userSettings.securityRoles;
var loggedInUsersecurityRoles = userSettings.roles;
var isUserAdmin = false;
for (var i = 0; i < loggedInUsersecurityRolesGuids.length; i++) {
if (loggedInUsersecurityRoles._collection[loggedInUsersecurityRolesGuids[i]].name === "System Administrator" || loggedInUsersecurityRoles._collection[loggedInUsersecurityRolesGuids[i]].name === "*System Administrator")
{ isUserAdmin = true; } }
if (isUserAdmin) {
//do something
}
Thanks.
Get the list of the dirty fields on the Dynamics 365
To quickly get the list of all the dirty fields
Open the debugger tool and put the following script in the console window
Xrm.Page.data.entity.getDataXml();
Get logged in user’s Security roles names in UCI
Here is sample code to get security roles name of logged in user.
function GetLoggedInUserSecurityRoleNames() {
// Get Logged In User Context
var userSettings = Xrm.Utility.getGlobalContext().userSettings;
// Get Logged In User Security Roles
var loggedInUsersecurityRolesGuidArray = userSettings.securityRoles;
var totalSecurityRolesArray = new Array();
var rolesOutputText = "";
if (loggedInUsersecurityRolesGuidArray.length > 0) {
Xrm.WebApi.retrieveMultipleRecords("roles", "?$select=name,roleid").then(
function success(result) {
if (result.entities.length > 0) {
// Push Role Names and Role Ids to Array
for (var rolesCount = 0; rolesCount < result.entities.length; rolesCount++) {
totalSecurityRolesArray.push({ RoleName: result.entities[rolesCount].name, RoleId: result.entities[rolesCount].roleid });
}
rolesOutputText = userSettings.userName + " has the below Security Roles\n------------------------------------\n";
// Compare the User Security Roles with Total Security Roles
for (var userSecurityRolesCounter = 0; userSecurityRolesCounter < loggedInUsersecurityRolesGuidArray.length; userSecurityRolesCounter++) {
for (var totalsecurityRolesCounter = 0; totalsecurityRolesCounter < totalSecurityRolesArray.length; totalsecurityRolesCounter++) {
if (totalSecurityRolesArray[totalsecurityRolesCounter].RoleId.toLowerCase() == loggedInUsersecurityRolesGuidArray[userSecurityRolesCounter].toLowerCase()) {
rolesOutputText += totalSecurityRolesArray[totalsecurityRolesCounter].RoleName + "\n";
break;
}
}
}
}
// Show User Roles
Xrm.Utility.alertDialog(rolesOutputText, null);
},
function (error) {
// Show error
Xrm.Utility.alertDialog(error.message, null);
});
}
}
Duplicate workflows in advanced find – CRM 365
While searching for the process in the Advanced Find of my MS Dynamics CRM 365 environment, I noticed that several “duplicates” of the process appeared. Although they had the same name, some of them were in Draft Mode and two were Active. One curious thing that I saw was few processes are same logic and steps, also, whenever I did a change in one of my Active workflow/business rule, the other was replicating the change. This made me had a hard time trying to figure out what was happening, specially because after searching the duplicates in the Default solution to delete them, only one appeared.
Continue reading “Duplicate workflows in advanced find – CRM 365”Xrm.WebApi.online.execute (Client API reference) in MSD 365
Xrm.WebApi.online.execute(request).then(successCallback, errorCallback); can be used for CURD operations, also to execute workflow and action. In the above syntax ‘request’ will be a object which can have all information of the operation. The details of the request can be found here in more depth. Here is some details ..
Continue reading “Xrm.WebApi.online.execute (Client API reference) in MSD 365”