Tag Archives: powerapps

WebForm sessions in PowerApps/ Dynamics 365 portals–All you need to know

Webforms are wonderful things in PowerApps portals. It allows you to design wizard control providing user with multiple steps to complete an operation.

And one of the wonderful things with WebForms in PowerApps portals is to maintain sessions. Say a Webform have three steps – Step 1, Step 2 and Step 3.

Say a portal user named Joe starts a webform and fills in till step 2 and then leaves the portal. When Joe again login to the portal and start web form, he will start from Step 2 instead from beginning, basically from where he left off. That’s an awesome feature.

Now the first question – Does webform always maintain session? The answer is No. It depends on the setting of the WebForm.

There is a field on the webform – “Start New Session on Load”. If you set this to Yes, it won’t save user’s session. If set to No, then the user’s session shall be saved.

image

Now the next question – Where are session information saved? How does Portal load session information specific to user?

Well, it’s pretty simple. On the WebForm record, there is “Sessions” tab. As you can see from the below screenshot, we can see the session saved for my login.

image

It’s no brainer that Portal loads session information from this record. Before we close this blog, let’s see what’s there on the session record.

image

As you can from the above screenshot, the portal user information and the entire step journey is stored in this record. And guess what, the step the user was last in, is stored in the Step History field. Below is the step history for one my sessions in json viewer.

image

As I highlighted, the IsActive: true is the step the user was last in and hence when the same portal user browse the webform, the active step shall be loaded.

And for some reason if a portal user request to start afresh a webform session, all you need to do is identify the session record for the portal user and he/ she shall start afresh.

Hope this helps!

Debajit Dutta

(Dynamics MVP)

For consultation/ corporate training visit www.xrmforyou.com or reach out to us at info@xrmforyou.com

Our product offerings:

CRM-Sharepoint Attachment uploader and metadata manager (http://www.xrmforyou.com/sharepoint-integrator.html)

Notes Manager (https://debajmecrm.com/2019/02/28/add-metadata-to-your-notes-and-attachments-in-dynamics-notes-metadata-manager-from-xrmforyou-com/)

Role based views for Dynamics 365 (http://www.xrmforyou.com/role-based-views.html)

Record Cloner for Dynamics 365 (http://www.xrmforyou.com/record-cloner.html)

All you want to know about “Rollup View“ Entity Relationship behavior in Dynamics 365

You might be wondering this is a pretty old feature and why I am writing this blog now. As I do quite a few trainings I always get lot of questions on relationship behavior. And specially related to Rollup behavior on entity relationship.I am not going to explain in this blog what this feature is and how you can use it. Rather I am going to list most frequently asked questions that I face on this topic.

Q1. What is rollup view relationship behavior?

Answer: Rollup relationship behavior allows activities of the related entity would show up in ‘Activity Associated View’ of the primary entity.

Q2. Can I have Rollup view relationship behavior for custom entities?

Answer: Yes, it is supported for custom entities.

Q3. Rollup view relationship behavior is not getting enabled when I am creating a relationship for the custom entity. What can be the reason?

Answer: There can be multiple reasons why the rollup view relationship behavior is not getting enabled.

  • Rollup view relationship behavior is only enabled when you enabled the Activities for the participating entities in the relationship.
  • It is only enabled  when you are trying the to create a relationship with Account, Opportunity and contact entity
  • Either Account/ Contact/ Opportunity should be the parent entity in the relationship.

Q4. I have a relationship where my custom entity is the parent and Account is the child entity. Will rollup view relationship behavior be enabled?

Answer: This has been answered in Question 3 itself. You can only configure rollup view relationship behavior where Account/ Contact/ opportunity is the parent and your custom entity is the child entity in the relationship. In other words, you cannot rollup account/ contact/ opportunity activities to your custom entity.

Q5. Can I change rollup view behavior anytime post creating the relationship?

Answer: Yes  you can do it anytime. Just edit the relationship and choose the options of “Cascade All” or “Cascade None”.

Hope this helps!

Debajit Dutta

(Dynamics MVP)

For consultation/ corporate training visit www.xrmforyou.com or reach out to us at info@xrmforyou.com

Our product offerings:

CRM-Sharepoint Attachment uploader and metadata manager (http://www.xrmforyou.com/sharepoint-integrator.html)

Notes Manager (https://debajmecrm.com/2019/02/28/add-metadata-to-your-notes-and-attachments-in-dynamics-notes-metadata-manager-from-xrmforyou-com/)

Role based views for Dynamics 365 (http://www.xrmforyou.com/role-based-views.html)

Record Cloner for Dynamics 365 (http://www.xrmforyou.com/record-cloner.html)

{knowhow} How to refer a JavaScript file in your PowerApps/ Dynamics 365 Portal which is not accessible via public URL?

This is a big question I face whether I am conducting a training or whether I am working on PowerApps portal in customer location. And I am really not surprised.

Say you have a custom .js file where you have scripted some wonderful functions and want to reuse in the portal. It’s a really big file and you just want to reference it and start using. Not only that, there may be some external .js files which you may want and just use it. If it is some jquery or bootstrap, you can just use the CDN url to refer to the file. However what if it is something internal or not accessible on a publicly available URL.

The first option that comes to mind is upload the .js file using webfile. Can you do that? Off course you can do this. While this is possibility, the probability of .js file being allowed for upload is slim. Whenever you upload a web file, it is basically uploaded as note attachment in your CDS/ Dynamics 365 environment and more often that not, it is not comprehensive solution.

Below is the error I receive when I try to upload a .js file in webfile.

image

So what are we left with. You may think, the only other option is to upload the file on some public repository which can be accessed by the portal and then referencing the file using the script template in your webtemplate or Page copy. So much for so little.

Well there is another way. What if you could load the content of your javascript file at runtime? You guessed it right. We are going to to do the same stuff now.

Let’s go ahead and create a content snippet of type HTML

image

In the Value box, i select the HTML option and paste the entire content inside the javascript file within the script tag.

image

Easy – Isn’t it? Not so fast. Notice carefully the code above. The entire content including the script tag is included with {% raw %} {% endraw %} tag.

What is the function of this tag and why is this even necessary? The {% raw %} is absolute necessary to render the script as is when the snippet is used. Javascript contains liquid specific operators like curly braces ( { } ) % and so many other. If you don’t put them in the {% raw %} tag, it would try to evaluate while you try to use the snippet and your content shall never work.

Ok Good stuff! Now let’s use this snippet on a page.

Open the “Content Page” your webpage.

image

Scroll down and navigate to the Copy (HTML) section of the page. To include the script file, all you need to do is select the HTML tab and use the snippet we created in the earlier step.

image

Trust me that’s all. Now when the page is rendered in the portal, I see my entire JS Content being in the HTML source. Great to finally see it.

image 

Now let’s put this to action. In the custom javascript section of the Content Page, on change I write code to invoke func1();

image

And when I login to the portal and change the SIC code, I can see the alert firing. Wonderful isn’t it. A simple liquid tag and a quick workaround can sometime do wonders.

image

For multiple .JS files, you can create multiple snippets and refer it.

Hope this helps!

Debajit Dutta

(Dynamics MVP)

For consultation/ corporate training visit www.xrmforyou.com or reach out to us at info@xrmforyou.com

Our product offerings:

CRM-Sharepoint Attachment uploader and metadata manager (http://www.xrmforyou.com/sharepoint-integrator.html)

Notes Manager (https://debajmecrm.com/2019/02/28/add-metadata-to-your-notes-and-attachments-in-dynamics-notes-metadata-manager-from-xrmforyou-com/)

Role based views for Dynamics 365 (http://www.xrmforyou.com/role-based-views.html)

Record Cloner for Dynamics 365 (http://www.xrmforyou.com/record-cloner.html)

Strip HTML characters using Liquid in PowerApps/ Dynamics 365 Portals

I have been working lately a lot on PowerApps portals and one of the requirement that we got from customer is to render some HTML text as text in Portals. The customer had a field in Dynamics 365 which was storing rich text.

We would retrieve the field value using fetchxml in liquid and the requirement was to strip the HTML characters and show the text in plain text. We did that initially in JS, only to realize later that there is a specific filter available in liquid – “strip_html”.

And guess what it worked like a charm.

Input:

{{ “<span>This liquid filter <b>can work wonders</b> with stripping HTML<br />” | strip_html}}

Output:

This liquid filter can work wonders with stripping HTML

As I am working more and more on liquid, I am simply falling in love with it. Simple yet quite powerful language. And as I keep exploring, I will post some interesting stuffs over the next few weeks.

Hopes this helps!

Debajit Dutta

(Dynamics MVP)

For consultation/ corporate training visit www.xrmforyou.com or reach out to us at info@xrmforyou.com

Our product offerings:

CRM-Sharepoint Attachment uploader and metadata manager (http://www.xrmforyou.com/sharepoint-integrator.html)

Notes Manager (https://debajmecrm.com/2019/02/28/add-metadata-to-your-notes-and-attachments-in-dynamics-notes-metadata-manager-from-xrmforyou-com/)

Role based views for Dynamics 365 (http://www.xrmforyou.com/role-based-views.html)

Record Cloner for Dynamics 365 (http://www.xrmforyou.com/record-cloner.html)

Working with custom DateTime formats in PowerApps/ Dynamics 365 Portals

By default in PowerApps portals, the date and time is showed in the format as configured in CDS/ Dynamics 365. However you can override the default date/ time format to be used on portals with the below site settings.

  • DateTime/DateFormat: The date format used on the portal.
  • DateTime/TimeFormat: The time format used on the portal.
  • DateTime/DateTimeFormat: The format for full date and time used on the portal.

We have a requirement to display the date field in particular format such as 20-May-2020 in Power Apps Portals. This can be achieved by creating site setting in the below format.

Now let us create a site setting

Name – DateTime/DateFormat

Value – dd-MMM-yyyy

Screenshot for reference

clip_image002[4]

Once you clear your portal cache, you should see the date time values now reflected in the portal accordingly.

clip_image004[4]

It displays time as my date field is of type date-time format.  For the benefit of readers, sharing some other format which can be of help.

1. yyyy-MM-dd – 2020-05-16

2. MMM dd yy – May 13 20

3. dd/MM/yyyy – 27/05/2020

4. dd/MM/yyyy HH:mm – 14/05/2020 12:27

5. dd/MM/yyyy hh:mm:ss – 12/05/2020 12:30:52 – 12 Hour format

6. dd/MM/yyyy HH:mm:ss – 27/05/2020 19:32:02 -24 Hour format

Hope this helps!

Debajit Dutta

(Dynamics MVP)

For consultation/ corporate training visit www.xrmforyou.com or reach out to us at info@xrmforyou.com

Our product offerings:

CRM-Sharepoint Attachment uploader and metadata manager (http://www.xrmforyou.com/sharepoint-integrator.html)

Notes Manager (https://debajmecrm.com/2019/02/28/add-metadata-to-your-notes-and-attachments-in-dynamics-notes-metadata-manager-from-xrmforyou-com/)

Role based views for Dynamics 365 (http://www.xrmforyou.com/role-based-views.html)

Record Cloner for Dynamics 365 (http://www.xrmforyou.com/record-cloner.html)

Could not find a part of the path … bin\roslyn\csc.exe. Error while setting up of OAuth implicit 2.0 API for PowerApps portal

IF you are not aware of OAuth 2.0 Implicit grant for PowerApps portal, I suggest you refer this Microsoft Docs link.

To put in Microsoft words –

“This feature allows a customer to make client-side calls to external APIs and secure them by using OAuth implicit grant flow. It provides an endpoint to obtain secure access tokens that will contain user identity information to be used by external APIs for authorization following OAuth 2.0 implicit grant flow. The identity information of a signed-in user is passed in a secured manner to the external AJAX calls. This will not only help developers to pass authentication context but will also help users to secure their APIs by using this mechanism”.

The docs link is pretty extensive to make your understand the various nuances of this concept. My blog talks about a specific issue which you may encounter when you try to download the sample API from this link – https://github.com/microsoft/PowerApps-Samples/tree/master/portals/ExternalWebApiConsumingPortalOAuthTokenSample and try to build the same.

When you build you may get the following error – Could not find a part of the path … bin\roslyn\csc.exe

Trust me if you are not aware on how to resolve this, you may waste significant time of the day in trying to build the project instead of getting it up and running the wonderful feature.

So basically there are two ways to resolve this.

Uninstall the Nuget packages

1. Microsoft.CodeDom.Providers.DotNetCompilerPlatform
2. Microsoft.Net.Compilers

After you do this, find references of compiler tag in your web.config

<system.codedom>
     <compilers>
       <compiler language=”c#;cs;csharp” extension=”.cs” type=”Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, ……….”></compiler>
       <compiler language=”vb;vbs;visualbasic;vbscript” …………></compiler>
     </compilers>
</system.codedom>

If you find this, simply delete it. This should get you up and running.

If you ask me, this is workaround and not really a good solution. This is because you can’t use the new compiler and new features. The other way is

copying file from “<your path>\packages\Microsoft.Net.Compilers.1.3.2\tools\csi.exe” to “bin\Debug\roslyn\csi.exe”. This is an easier and simple way to do it and your Sample API would be up and running.

Hope this helps!

Debajit Dutta

(Dynamics MVP)

For consultation/ corporate training visit www.xrmforyou.com or reach out to us at info@xrmforyou.com

Our product offerings:

CRM-Sharepoint Attachment uploader and metadata manager (http://www.xrmforyou.com/sharepoint-integrator.html)

Notes Manager (https://debajmecrm.com/2019/02/28/add-metadata-to-your-notes-and-attachments-in-dynamics-notes-metadata-manager-from-xrmforyou-com/)

Role based views for Dynamics 365 (http://www.xrmforyou.com/role-based-views.html)

Record Cloner for Dynamics 365 (http://www.xrmforyou.com/record-cloner.html)