{Code Tip} Control Activate/Deactivate Privilege on CRM entities

Requirement: Client wants the ability to control Activate/Deactivate privilege on CRM entities.

Solution: Out of box, there is no ability to control Activate/Deactivate privilege. This is one of the classical CRM problems.So this one will require a little code solution.

image

In the proposed solution, I suggest two approaches:

· Create Additional Configuration entity to collect the permissions by role at Entity level and then allow/disallow Activate/Deactivate

· Create a Team for users : If user is part of the team user has privileges to Activate/Deactivate the record, else doesn’t have the privilege

Thereafter Plugin will read the configuration or team information and then allow/disallow Activate or Deactivate.

Finally, A decision was made to choose the team approach.

Here is the code to be used in the plugin then

using (var serviceContext = new OrganizationServiceContext(service))

{

if (context.InputParameters.Contains(“Target”) && context.InputParameters[“Target”] is Entity)

{

Entity entity = (Entity)context.InputParameters[“Target”];

if (!IsTeamMember(new Guid(“Team Guid”), context.UserId, service))

{

throw new InvalidPluginExecutionException(“You do not have permission to Activate/Deactivate. Please contact System Administrator”);

}

}

}

Here is the IsTeamMember method code:

public static bool IsTeamMember(Guid teamID, Guid userID, IOrganizationService service)

{

QueryExpression query = new QueryExpression(“team”);

query.ColumnSet = new ColumnSet(true);

query.Criteria.AddCondition(new ConditionExpression(“teamid”, ConditionOperator.Equal, teamID));

LinkEntity link = query.AddLink(“teammembership”, “teamid”, “teamid”);

link.LinkCriteria.AddCondition(new ConditionExpression(“systemuserid”, ConditionOperator.Equal, userID));

var results = service.RetrieveMultiple(query);

if (results.Entities.Count > 0)

{

return true;

}

else

{

return false;

}

}

Next, register this on Update of status field:

clip_image002

Now until the users are added to the Team, they will not be able to Activate/Deactivate record.

Hope it helps and Happy CRMing!

If you want to know more on Dynamics CRM, just get in touch.

Do not forget to share! Sharing knowledge is true power!

Twitter: https://twitter.com/msdynamicsblog
LinkedIn: https://www.linkedin.com/in/deepesh-somani-00296932

Google Play Store:

https://play.google.com/store/apps/details?id=com.dynamicsofdynamicscrm.msdynamicsblog&hl=en

{Quick Tip} How to learn making GRID HTML Web Resource in Dynamics CRM

Let me start here: Thanks for getting me to 150k hits!

image

I get lot of queries and it takes lot of time sometimes to research and point you to an approach and a direction to solve a CRM problem.

Today I am going to discuss one of such problems which people keep asking in Dynamics CRM regarding custom web resource development a lot. Specially, I have got a lot of queries about this.

Requirement: Create a Grid HTML web resource of unrelated entity data on a CRM form

Solution: We will point to a solution available from SDK.

Go to \SDK\SampleCode\JS\RESTEndpoint\JavaScriptRESTRetrieveMultiple

You will find a solution file to upload there:

clip_image002

Go to Settings->Solutions in your CRM organisations and Import the solution:

clip_image004

Once you double click and open the solution, you will see the following:

clip_image006

Page has dynamic binding for record counts(Setting to 10):

clip_image008

JavaScript used are available to view:

clip_image010

Also as Visual Studio solution in SDK:

clip_image012

I hope this is a good starting point for learning.

Hope it helps and Happy CRMing!

If you want to know more on Dynamics CRM, just get in touch.

Do not forget to share! Sharing knowledge is true power!

Twitter: https://twitter.com/msdynamicsblog
LinkedIn: https://www.linkedin.com/in/deepesh-somani-00296932

Google Play Store:

https://play.google.com/store/apps/details?id=com.dynamicsofdynamicscrm.msdynamicsblog&hl=en

{Error Resolution}DateTime is less than minimum value supported by CrmDateTime error in Dynamics CRM 2016 in a plugin

Recently users started randomly reporting an error when they hit a custom ribbon button on a custom entity which used to trigger a plugin.

The log they were able to download had the following error:

clip_image001

Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=7.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: DateTime is less than minumum value supported by CrmDateTime. Actual value: 01/01/0001 00:00:00, Minimum value supported: 01/01/1753 00:00:00Detail:

<OrganizationServiceFault xmlns:i=”http://www.w3.org/2001/XMLSchema-instance&#8221; xmlns=”http://schemas.microsoft.com/xrm/2011/Contracts”&gt;

  <ErrorCode>-2147220935</ErrorCode>

  <ErrorDetails xmlns:d2p1=”http://schemas.datacontract.org/2004/07/System.Collections.Generic&#8221; />

  <Message>DateTime is less than minumum value supported by CrmDateTime. Actual value: 01/01/0001 00:00:00, Minimum value supported: 01/01/1753 00:00:00</Message>

  <Timestamp>2016-07-12T11:19:59.489724Z</Timestamp>

  <InnerFault i:nil=”true” />

  <TraceText>

[CRM.Plugins:.CRM.Plugins.PreCreateUpdate]

[944f9582-fb77-e511-8102-3863bb357c38: CRM.Plugins.PreCreateUpdate: Update of]

</TraceText>

</OrganizationServiceFault>

 

Issue Resolution:

A quick check on the code told the reason. A developer had set CRM Date Time field to 01/01/0001.

Smallest Date Time possible to be set in CRM is 01/01/1753.

Here is the official Note on MSDN:

clip_image003

Detailed Read: https://msdn.microsoft.com/en-us/library/dn996866.aspx

Hope it helps and Happy CRMing!

If you want to know more on Dynamics CRM, just get in touch.

Do not forget to share! Sharing knowledge is true power!

Twitter: https://twitter.com/msdynamicsblog
LinkedIn: https://www.linkedin.com/in/deepesh-somani-00296932

Google Play Store:

https://play.google.com/store/apps/details?id=com.dynamicsofdynamicscrm.msdynamicsblog&hl=en

{New announcements} Microsoft Dynamics 365 and Microsoft AppSource

Microsoft announced two keys things today – we are indeed in exciting times:

Microsoft Dynamics 365 evolves Microsoft’s current CRM and ERP cloud solutions into one cloud service with new purpose-built apps to help manage specific business functions, including: Financials, Field Service, Sales, Operations, Marketing, Project Service Automation and Customer Service

Microsoft AppSource – Microsoft’s new destination for business users to find and try out line-of-business SaaS apps from Microsoft and our partners. At launch AppSource contains more than 200 business SaaS apps, add-ins and content packs, including exclusive new industry-specific business apps from.

More Details:

https://blogs.microsoft.com/blog/2016/07/06/turning-business-process-into-business-advantage-for-organizations-everywhere/#sm.00001gtt4hqsjkdl0y2q9g1159qfn

https://community.dynamics.com/b/msftdynamicsblog/archive/2016/07/06/insights-from-the-engineering-leaders-behind-microsoft-dynamics-365-and-microsoft-appsource

Hope it helps and Happy CRMing!

If you want to know more on Dynamics CRM, just get in touch.

Do not forget to share! Sharing knowledge is true power!

Twitter: https://twitter.com/msdynamicsblog
LinkedIn: https://www.linkedin.com/in/deepesh-somani-00296932

Google Play Store:

https://play.google.com/store/apps/details?id=com.dynamicsofdynamicscrm.msdynamicsblog&hl=en

{Quick Tip} 3 Tips to keep your CRM skills updated in a fast developing Dynamics CRM product roadmap

I haven’t written a post out for a while. Trying to reach out in this post to a broader topic of what I guess many of us are facing currently in the Dynamics CRM world.

Dynamics CRM releases have been on like a fast paced train at the moment. There have been acquisitions, releases, enhancements, fixes – all happening at a very rapid pace.

Many of consultants and people I talk to are trying to learn new features and utilize them daily at work.

In this post, I am putting up few pointers that you can benefit from to keep up with the latest releases of Dynamics CRM.

· CHOOSE THE FEATURES YOU NEED, NOT EVERYTHING:

clip_image001

With such a vast variety of features that have come up with each release, its best to focus on what you need to use or learn then start figuring out everything. For example, if you are using Surveys in your implementation or trying to understand Field service, you might not as well start learning about Portals at the same stage. It will make sense to focus on each feature that you need – this is important as all the features are vast in the current release.

· FIND OUT RESOURCES YOU CAN USE:

clip_image002

There are variety of resources you can use including Books, CRM community, blogs, webinars, tutorials, blogs, etc.

Fastest way to go through the resources you can use is to keep up to date with CRM community – that is straight out the best resource I keep using and then contributing back to.

· PRIORITIZE THE TIME TO USE THE RESOURCES:

clip_image004

No matter how strong a content you develop, in order to learn even one feature you need to prioritize time for what you need to be learning. One approach which has always worked is if I have to learn feature X first for business requirements, I put time out to learn that first.

Other CRM specific things which might benefit are:

· Go for the latest CRM online certification

· Go for the free CRM webinars on latest versions in community or the ones conducted by MVPs.

· Attend a CRM boot camp or training from an authorized Microsoft partner or Microsoft Training partner.

· Take the latest CRM online trial and do it on your own.

Hope it helps and Happy CRMing!

If you want to know more on Dynamics CRM, just get in touch.

Do not forget to share! Sharing knowledge is true power!

Twitter: https://twitter.com/msdynamicsblog
LinkedIn: https://www.linkedin.com/in/deepesh-somani-00296932

Google Play Store:

https://play.google.com/store/apps/details?id=com.dynamicsofdynamicscrm.msdynamicsblog&hl=en

{Quick Tip}Steps to convert UTC Date time fields to local format in POWER BI for CRM online

Recently in CRM online project, our customer started reporting that Date fields are off by a day on some random data rows.

The reason to that is the time zone is not considered automatically.

image

Here is a step by step resolution:

https://community.dynamics.com/crm/b/scaleablesolutionsblog/archive/2016/03/25/convert-utc-date-format-into-local-time-format-in-power-bi

Hope it helps and Happy CRMing!

If you want to know more on Dynamics CRM, just get in touch.

Do not forget to share! Sharing knowledge is true power!

Twitter: https://twitter.com/msdynamicsblog
LinkedIn: https://www.linkedin.com/in/deepesh-somani-00296932

Google Play Store:

https://play.google.com/store/apps/details?id=com.dynamicsofdynamicscrm.msdynamicsblog&hl=en

{CRM 2016 Update 1} Overview and Step by Step for Relevance search in Dynamics CRM

Relevance search is a new feature that came up with CRM 2016 Update 1. In case of Relevance search basically uses concept of scoring – so more the score more relevant is a search term.

Underneath Relevance search utilizes same concepts as Azure Search.

So, here is a quick overview:

Since it’s a preview feature you will need to enable it in Settings->Administration->System settings->Preview.

clip_image002

Once you select yes and enable it, we need to navigate to Customizations:

clip_image004

clip_image006

Select the entities you want and click ok.

Now, field level, you can configure fields to include under Quick find columns:

clip_image007

Above is sample for Account entity.

Next thing when I try to search for Datum under Search box:

clip_image009

Nothing is found, but we also have an option for Use Relevance search:

clip_image011

It finds it using power of Azure! Great feature.

How does it work? Here is the architecture referred from Technet:

clip_image013

There are some limitations and considerations. Detailed Read:

https://technet.microsoft.com/en-us/library/mt723654.aspx

Hope it helps and Happy CRMing!

If you want to know more on Dynamics CRM, just get in touch.

Do not forget to share! Sharing knowledge is true power!

Twitter: https://twitter.com/msdynamicsblog
LinkedIn: https://www.linkedin.com/in/deepesh-somani-00296932

Google Play Store:

https://play.google.com/store/apps/details?id=com.dynamicsofdynamicscrm.msdynamicsblog&hl=en