Tip #1201: Working with integer variables in Microsoft Flow

In tip 1199, Leon Tribe talked about the power of using variables in Microsoft Flow. Leon astutely pointed out that using variables can simplify process development by allowing reuse of values between steps in Flow, and they can also be used for calculation purposes and building strings.

One challenge with working with integer type variables in Flow from a CDS/Dynamics 365 perspective is that you cannot directly write the value from an integer variable into a Dynamics 365 field.

Recently I created a Flow to calculate a contact score based on data quality–more about this in a future tip. As part of this flow, I created an integer variable called “score” to be used to calculate the data quality score.

Integer variable in Microsoft Flow

At the end of the Flow when I wanted to update the contact with the data quality score, I tried the three types of number fields in Dynamics 365/CDS–whole number, floating point, and decimal. The variable was being calculated, but I could not get the flow to update any standard number field (or text field) with the value of the integer variable.

The solution was to use the int() transformation expression. By using the expression int(variables(‘score’)), I was able to update a decimal number field in Dynamics 365 with the value of my integer variable.

(Cover photo by Nick Hillier on Unsplash)

Tip #1200: Placeholders, colors & lorem ipsum

To celebrate 1,200 tips I picked up a topic completely unrelated to Dynamics 365/CDS, as one cwshould. Well, sort of. I was working on some
materials related to Dynamics 365 Portals and, lo and behold, I needed some placeholders besides qwerty asdf.

Text

As a placeholder text, you can’t go past lorem ipsum and the original https://lipsum.com. But wouldn’t you rather have fun? Thanks to the ingenious Any Ipsum WordPress plugin, we now have literally dozens generators on a topic of your liking. Some of my favorites:

GenWhatSample
Bacon LipsumAdd some meat to your text, literally. My favorite by a long streak of bacon.Pancetta filet mignon shoulder ham, flank cow sirloin short ribs buffalo andouille brisket t-bone venison leberkas spare ribs.
Hipster IpsumArtisanal filler text for your project.Chillwave portland ullamco cliche pop-up. Occupy pork belly fixie af raw denim quinoa duis drinking vinegar.
Samuel L. IpsumA NSFW tribute to Samuel L. Jackson (and not using the plugin as far as I can tell)The path of the righteous man is beset on all sides by the iniquities of the selfish and the tyranny of evil men.

Image

But what is the web site without those proverbial 1,000 words? As regular readers probably have noticed, my goto site for images is https://unsplash.com/ and has been for a long time. Just do the right thing and attribute when you can.

Sometimes you don’t need a fancy image of a “woman looking thoughtfully at a microchip schemata”, you just need a placeholder of a specific size. https://placeholder.com/ to the rescue. Need 128×64, green, and with the word w00t? Here you go (https://via.placeholder.com/128×64/00ff00/?text=w00t):

Green background w00t

Color

Again, tons to choose from. Couple that I use

  • Coolors – nice and easy
  • Adobe Color CC – can match uploaded images
  • Canva – less options than Adobe but seems to pick the colors from an image better
  • COLOURLovers – community site to get some inspiration from others

 

Tip #1199: Embrace Variables in your Flows

As you begin to use Flow as part of your Business Applications projects, you will discover that it pays dividends to adopt some of the good habits of our coding brethren. This is what I refer to as ‘disciplined development’. The tool adopted may be different but the habits are the same.

Embracing good developer habits will make your life easier in the long term. One such habit is the use of variables. Variables may be unfamiliar to old-school Dynamics consultants used to Workflows as we never had variables to play with. We did with Actions but, like many features of the platform, Actions were not widely adopted. Certainly not as much as Workflows, which is a pity, but I digress…

For Flow, Variables are particularly useful both for bookkeeping and also for debugging. You create a variable with an ‘Initialize variable’ step. This is simply a placeholder for a piece of information. You can also set the initial value, if desired.

Then, as your Flow progresses, you can refer to the variable’s value or update it with the ‘Set variable’ step.

So why is this so useful? Well, rather than having to define a complex value multiple times throughout a Flow (and updating it multiple times as you modify your Flow), you do it once and from then on just refer to the variable. Easy stuff.

For debugging, variables make life easy by showing exactly what value the variable has been set to.

In this case the TweetAuthor variable has been set to our favourite kiwi explorer nz365guy aka Mark Smith. Not buggy at all.

If you are not using variables in your Flow to hold and carry values, you should. Not only will the coders appreciate your ‘l33t skillz’ but it will make working with Flows a whole lot easier.

(Cover photo by Adi Goldstein on Unsplash)

Tip #1198: Add email address to recipients in javascript

The advantage of having access to friendly brainpower is that the problems are getting resolved much quicker. The disadvantage is that it breeds inattentive coding. Daryl “Always Raising” LaBar almost threw in a towel but recovered and redeemed himself with the snippet how to add an arbitrary email address to the list of the email recipients on the email form.

function appendToEmail(executionContext)
{
var formContext = executionContext.getFormContext();
// prior to v9: Xrm.Page

var att = formContext.getAttribute('to'); // or 'cc'
var emails = att.getValue() || [];
emails.push({name: 'george@foobar.com', type: '9206'});
att.setValue(emails);
}

Potential gotchas:

  • the property is type not entityType as one would expect
  • sending emails to arbitrary recipients must be enabled in System settings

image

(Facebook and Twitter Cover photo by Mathyas Kurmann on Unsplash)

Tip #1197: Unified Interface lookup changes

Change to how lookups behave in Unified Interface is coming in December.

&tl;dr

Up until now Unified Interface used Lookup View to perform the search. After the change is rolled out, Unified Interface will use Quick Find view (with resulting columns are still coming from the Lookup View), as the classic interface does.

With this upcoming change Unified Interface will be better aligned with the classic web interface. However, if you don’t do anything, the side effects could be loss of functionality (missing search columns) or performance implications (too many search columns).

For more details, see this blog article. Make follow the steps in the article to maintain your application’s lookup capabilities.

Tip #1196: Flow does not contain data

Being a mature product, Dynamics 365 rarely lends itself to short tips these days. Microsoft Flow, new kid on the block, on the other hand, is ripe for short bursts of wisdom. Today’s one is from Rob Dawson (and you can send your nugget to jar@crmtipoftheday.com too!)

With the drive toward use of Flow instead of background workflows, some condition operators are not the same. Like this easy but frequently used one.

It’s always good practice to check if a value exists before overwriting it in a workflow. Dynamics 365 CE or CDS Workflow condition is Does Not Contain Data. This is how to do it in Flow. Select the field from the Dynamic content then null function from the Expression builder.

clip_image002

(Facebook and Twitter cover photo by Jonas Jacobsson on Unsplash)

Tip #1195: Your D365 V9 On Premise Questions Answered

We had a chance to check out Dynamics 365 v9 On Premise, and in the process answered some of our lingering questions.

Does v9 On Premise have Unified Interface?

Yes — Unified Interface is included in V9OP. You can create new model driven apps and select between web and classic UI. Note it is the 9.0.2 version of Unified Interface — some of the goodies like Advanced Find that are available in Unified Interface online are not available in V9OP. Also, configuration of the Outlook App Module is not available in V9OP.

What about mobile?

Since Unified Interface is available in V9OP, the mobile app experience will reflect the Unified Interface. Like with V9 Online, the Mobile Express forms are also gone.

Virtual entities

Virtual entities are supported in V9OP.

Got other questions about Dynamics 365 v9 On Premise? Send them to us at jar@crmtipoftheday.com.

(Facebook and Twitter coverphoto by Dayne Topkin on Unsplash )

Tip #1194: When the App for Outlook shows a random dashboard

You provision the Dynamics 365 v9 App for Outlook and click the Dynamics 365 button in Outlook, but what you see is a random dashboard from Dynamics 365, not the Outlook App pane with the set regarding options.

The thing you need to know is that the Outlook app pane is a dashboard in Dynamics 365 v9, and like all dashboards, it can be security role enabled. If a system administrator mistakenly selects that App for Outlook dashboard in Customization and removes associated roles, the App for Outlook will not work correctly–users will see their default Dynamics 365 dashboard, not the App for Outlook.

If this happens to you, navigate to Settings->Customization->Customize The System. Click the Dashboard node, then select App for Outlook dashboard. Click the “Enable Security Roles” button.

Enable the dashboard for everyone.

Save and publish customization, now users App for Outlook should display correctly.

(Facebook and Twitter cover photo by Carson Arias on Unsplash)

Tip #1193: When Case attachments exceed your limitations

I’m setting up automatic case creation from email in Dynamics 365–what is the expected outcome if someone sends an email to my queue that has an attachment that exceeds my attachment file size limits in Dynamics?

A reader

Not finding any official documentation about what the expected result should be, I set up a simple test to find out how this scenario would be handled. I was confident that the attachment would not be created in Dynamics (because of the limit in file size), but would the email and associated case record still get created?

I set up a queue and kept the default file size limitation of 5 MB. Note that for most real world deployments using Exchange Online, I would probably increase that to 15-20 MB.

I then sent myself two emails, one with a small attachment, and one with a large attachment.

The result was that two cases were created in Dynamics 365–the small attachment case included the attachment, the large attachment case was created, but no attachment was created.

The takeaway is that you don’t have to worry about losing cases should an email arrive that exceeds your attachment file size limitations; however, you may get cases referring to attachments that are not included in the case. If this is a concern, you should probably increase your attachment file size limitations to match the file size limitations of your email server.

(Facebook and Twitter cover photo by DiEGO MüLLER on Unsplash)

Tip #1192: Quick Create for custom entities in Unified Interface

Remember the problems with viewing custom activity in Timeline? The unified monster

Do I need to sell my left or my right kidney to make the feature X work in Unified Interface?

is back. This time, Quick Create was not showing up for custom entities neither for me nor for Guido “Future Olive Farmer” Preite. False alarm. Make sure that

  1. Entity is enabled for Quick Create (it’s a subtle checkbox on the “classic” entity properties dialog)
  2. At least one Quick Create form is included in your app (using App Designer). Apps seem to be now not showing what’s not included.

Build: 9.1.0.638

(Facebook and Twitter cover photo by David Clode on Unsplash)