Tip #839: Convert workflow into action

HomeomorphismMy friend Mehmet “Sputnik” Ozdemir is insane. When he asked me how to convert a long and tedious workflow into an action, instead of painstakingly reproducing it step-by-step, I told him that it’s not possible, he’s dreaming and the only sensible thing to do is to call that workflow from the newly minted action.

Did I mention he’s insane? Because he managed to come up with the instructions on how to convert a workflow into an action. Sounds too good to be true? Well, actually it does work every time in 83% of the cases. Readers digest version:

  • Start with a realtime workflow. Convert an asynchronous into a realtime. Less chances of failure.
  • Backup the orgs
  • Create a temp solution (let’s call it: Workflow To Action Conversion)
  • Add the existing Workflow that you want to convert to an action into this solution (eg: Generate Sales Metrics)
  • Create an empty action in the temp solution (eg: Generate Sales Metrics Action)
  • Export the solution (WorkflowToActionConversion.zip)
  • Extract WorkflowToActionConversion.zip and browse to Workflow folder
  • If everything has gone to plan you should have two files in here that correspond the workflow and the empty action. Open both *.xaml files into a tabbed editor (I like Notepad++)
  • In the Action*.xaml file search for: <mva:VisualBasic.Settings>Assembly references and imported namespaces for internal implementation</mva:VisualBasic.Settings>
    Select this line and everything below it and replace it with the same section from the Workflow*.xaml file. Save the Action*.xaml file.
  • Put the Action*.xaml file back into the WorkflowToActionConversion.zip
  • Import the WorkflowToActionConversion.zip

Tip #838: Fantasy Sales Team vs. Gamification

When looking at solutions available for my Dynamics 365 organization, I saw that there were two solutions available for Gamification. “Fantasy Sales Team” and “Gamification.”

So what is the difference between these solutions? Does “Gamification” include all of the functionality in Fantasy Sales Team?

Scott Durow to the rescue:

FST was essentially a preview and should no longer be used – Gamification replaces FST and is fully supported. There are some nice UI improvements but the biggest thing for me is that logins are now controlled using O365 rather than a separate username/password.

Other reasons to use the new Gamification solution:

  • Total players (sum of all games): From 250 in FST to 15 Simultaneous Games with 500 players each in Gamification
  • Expanded Roles:  From a user being locked into a Player or Fan role to determining the role by game (e.g. Player in one game, fan in another)
  • KPI Manager Role in CRM:  The ability for a non-admin user (e.g. Sales Manager) to create KPIs
  • Default KPIs: 10 default KPIs to get from install to first game in minutes
  • Quick Setup: From install to active in minutes rather than the 24-48 delay in FST
  • Enabling Public Stream in StreamTV
  • Upgraded User Interface including responsive UI for mobile devices
  • Single Sign On with Office 365 / Dynamics 365
  • Multi Language Support

Tip #837: How to find out what’s new in portals

Wanted to know what’s in the latest Microsoft Portals release but were afraid to ask? Fear no more and point your browser to a kb article Portal Capabilities for Microsoft Dynamics 365 Releases.

Now we only need to pursuade the other teams like Field Services and PSA to do the same.

And I’m out of words at this point – that must be my shortest tip ever.

Tip #836: Where are my mobile stacked components?

My production CRM Online environment was upgraded to Dynamics 365 last week, and I was very excited to use the new stacked UI on mobile. If you haven’t heard, Dynamics 365 mobile will now display multiple dashboard charts on the same screen in mobile, reducing the amount of left/right swiping users must do when viewing dashboards on mobile.

IMG_0992However, when I logged in the next morning after my upgrade, I still saw the old “one chart per screen” view. What gives?

Turns out that when the mobile app is connected to a CRM 2016 environment that is upgraded, the new “compact” view is disabled by default.

Here’s how to enable it:

  • Click the home button to go to the start screen.
  • Tap the (…) button in the lower right corner.
  • Tap Settings.
  • Tap “Contact View.”
  • Toggle “Stacked Components” to Enable
  • Click OK.

You will now enjoy a more productive, less “swipey” Dynamics mobile experience.

Tip #835: “Owner equals current user” in Microsoft Flow

On the most recent episode of CRM Audio we discuss using Microsoft Flow to create a task in Wunderlist when a task is assigned to me in Dynamics 365. On the surface, this looks like an easy process. Have a flow triggered when a task is created in Dynamics, have a condition that ownerid=me, and then create the task.

After trying this and failing miserably, I knew something was missing. I tried “ownerid = Joel Lindstrom” and “ownerid = [my user id GUID in CRM]”, and neither would work.

Thanks to a helpful example from David Yack, I learned the error of my ways.

Instead of specifying the ID of the user, the follow approach will actually work.

  • When a task is created.
  • Add a step to get current user’s O365 profile.
  • Add a step to get the CRM user record of the task owner in Dynamics
  • Add a condition to compare an attribute of the user record with the same field on the O365 user profile. In this example I used primary email address.
  • If they match, create your task.

flow

Though this is a few more steps than my original failed attempt, it is actually better, as it doesn’t hard code the user name or ID.

Tip #834: Avoiding SQL Server timeouts when deleting records

Once upon a time, CRM wouldn’t delete records when you pressed the kill switch. It would mark the records for deletion and quietly eradicate them in the darkness of the night. But, hey, the said, we now have better servers, they said, and our SQL Servers are much smarter, they said, and gave us a real delete bullet to go with every button push.

It all works well until you have a large number of child records that need to be deleted alongside with the parent and a large number of the relationships that need to be cleared up. Then you may get the evil “SQL Server Timeout” error. While most of the timeout errors are outside of your control, and generally difficult to isolate, timeouts during the deletes can be dealt with.

  1. Find out the relatinship(s) that is causing all the drama. You can make an educated guess by looking at number of the related records and then doing some dry runs to see if you can summon the SQL Server Timeout error.
  2. Create a new status reason for the record, something like Pending Delete.
  3. Instead of deleting the record, set its status to Pending Delete. You can do it by replacing Delete button with something like Submit for Delete that would run a simple script setting the status of the record. Use Ribbon Workbench, naturally, to create the button. Alternatively, just tell users to set status reason to Pending Delete.
  4. Create a recurrent batch delete job that finds and deletes related records where parent has that magic status. This is what the job might look like for the Invoice Products (yes, I was part of the implementation where invoices frequently contained 3-5 thousand line items). Canceled status is used instead of Pending Delete in this instance.Bulk delete invoice details
  5. Follow that with another recurrent batch delete job that deletes Pending Delete records that do not have any related records. I know, it’s a big ask (suggested merely 6 years ago). You can try manually creating a view with NOT IN clause (using XrmToolbox, for example) and then using that view as a base for the bulk delete job. It may or may not work so you can cheat the system by only deleting the parent records that were modified before yesterday. Or create a rollup field counting children and only delete parents where this field is zero. Or something else.

Seal of approvalThe outcome is a reliable record deletion system that avoids the timeouts and gives back control to the user almost instantly. Win-win.

Tip #833: Creating closed tasks on mobile

Dear Tipsters,

How can I create and close a task in one step on mobile, similar to the create and mark complete process in Dynamics 365 in browser experience?

Signed Taskmaster

Taskmaster:

  • In the Dynamics 365 mobile app, create a task.
  • From the edit form, click the options (…) button in the lower right corner.
  • Click close task.

Alternative approach: create a task flow process to create the task and have the task flow trigger a workflow to close the task, giving you a quick “create and close task” button on mobile.

Tip #832: Dynamic does not work in sandbox

Dynamic not DynamicS. The reference is to dynamic keyword making C# developer’s life easier since 2010. As Rickard “Ikea Frysta Köttbullar” Norström has discovered, the following code works in a sandbox on-premises but spits the dummy in Dynamics 365 Online environment. Not all sandboxes were created equal, it seems.

string outstring = "get it from an external service";
if (!string.IsNullOrEmpty(outstring))
{
   dynamic outp = JArray.Parse(outstring);
   if (outp.Count == 1)
   {
      var objekt = outp[0];
      if (objekt["ProjectTypeID"] != "ART")
      ...
   }
}

Avoiding dynamic and using explicit cast (instead of relying on var seems to be the key:

JArray outp = JArray.Parse(outstring);
string outstring = "get it from an external service";
if (!string.IsNullOrEmpty(outstring))
{
   JArray outp = JArray.Parse(outstring);
   if (outp.Count == 1)
   {
      JToken objekt = outp[0];
      if (objekt["ProjectTypeID"] != "ART")
      ...
   }
}

Tipp Jarr’s $0.02 + GST

If object coming down the wire is well known in advance, entire Newtonsoft assembly can be avoided by using DataContractJsonSerializer instead.

Tip #831: Avoiding pain when renewing certificates in AD FS

Expiring certificate for https://adfs.contoso.com, you say? Considering Let’s Encrypt goodness, that should be easy to fix, right?

  • Import new certificate (make sure to include private key)
  • Grant permission to AD FS service account to read the private key
  • Open AD FS manager, navigate to AD FS > Service > Certificates
  • Click Set Service Communications Certificate… and select new certificate

Done, right? So why all these ERR_CONNECTION_RESET errors and general snafu? That’s because old certificate is still lurking around in the configuration and a bit of PowerShell is needed to oust it out.

# that will show old thumbprint hanging around
Get-AdfsSslCertificate

# get the thumbprint of the new certificate
$thumb = (Get-AdfsCertificate -CertificateType `
     Service-Communications).Thumbprint

# and fix it
Set-AdfsSslCertificate -Thumbprint $thumb

The restart AD FS service and it’ll be as good as new! The mix of UI and PowerShell can be very confusing, especially for noob administrators like me.

Tip #830: Calendar items lost after revoking O365 global administrator role

We did write about the consequences of granting and then removing global administrator roles. As Oswin Kroon has discovered, there is more to it if you’re actually using that O365 account to organize things in your life.

tl;dr

Removing global administrator role from an O365 account may result in a loss of calendar appointments.

A tale of disappearing appointments

as told by Oswin Kroon

Last week a rather strange event took place in my Outlook calendar as most of my items suddenly disappeared from one day to another. I had a bit of a search (more like 3-4 hours of wasted time) I managed to get the items back.

You may ask yourself “What does this have to do with CRM/D365?” Well, allow me to explain what when wrong:

The day before I revoked my O365 admin role and replaced it with a regular user role. Nothing wrong with that, but as it happens this also means that you will lose your D365 sysadmin role as well. Since that was the only role I had, I was left without a valid role and became a D365 outcast. Still, this shouldn’t have too much impact on Outlook. But it does! As I later found out it were only my tracked calendar items that I lost in Outlook, resulting in the conclusion that losing your D365 privileges equals to losing the privilege to even read your personal calendar items if they were tracked.

After I regained my D365 sysadmin role all items were restored (although I actually started to like a blank calendar on Fridays).

Anyway, feel free to test out this scenario on your own and see if you notice the same behavior.