Monday, March 21, 2022

Form Notification in Model Driven Apps Using JavaScript

Introduction:


In this blog we will see how to show Form Notification using JavaScript in Model Driven Apps.


Scenario:

Consider i have an Account Screen, with Annual Revenue field as 5000, if the value exceed more than 5000 i need to show an Notification.

 

rampprakash_0-1647868347721.png

 

Implementation Steps:

 

1. Create a WebResource 

2. Open the JavaScript (Web Resource which you have Created).

 

Creating WebResource:

 

rampprakash_1-1647869035635.png

 

Adding Web Resource to Form

 

rampprakash_2-1647869115049.png

 

In My Scenario, am triggering alert on Change of Field Value.

 

 So, Open the Form --> Click on the Field --> Click Events --> Then Input the Event name (Function name) and WebResource where the Function residing --> Save --> Publish

 

rampprakash_3-1647869168393.png

 

 

Write the below Code in the JavaScript

 

function onChange(executionContext){
var formContext = executionContext.getFormContext();
if(formContext.getAtrribute("annualrevenue").getValue()>5000){
formContext.ui.setFormNotification("Annual Revenue should be less than 5000", "INFO", "1");
}
else{
formContext.ui.clearFormNotification("1")
}
}

 

Notification Pop-up:

 

rampprakash_4-1647869413150.png

 

No Notification(Because we are Clearing the Notification):

 

rampprakash_5-1647869439486.png

 

 

Once written above code, just save and publish.

 

That's it :slightly_smiling_face:

Thursday, March 10, 2022

Create Notes / Move Notes and Attachments from One Entity to another

Introduction:

In this blog we will see how to move Notes from One Entity to Another

Implementation Steps:

 

Consider when ever I Qualify a Lead to Contact, I need to Move the Respective Lead(Notes/Attachment) from Lead to Contact.

 

Let's see how can we do that.

 

Create a Plugin 

 

string getNotes = @"<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>
  <entity name='annotation'>
    <all-attributes />
    <order attribute='subject' descending='false' />
    <link-entity name='lead' from='leadid' to='objectid' link-type='inner' alias='aa'>
      <filter type='and'>
        <condition attribute='leadid' operator='eq' value='{objectid}' />
      </filter>
    </link-entity>
  </entity>
</fetch>";

                getNotes = getNotes.Replace("{objectid}", "LEADGUID");
                EntityCollection collectNotes = service.RetrieveMultiple(new FetchExpression(getNotes));

                foreach (var loopColelctNotes in collectNotes.Entities)
                {
                    Entity _annotation = new Entity("annotation");
                    _annotation.Attributes["objectid"] = new EntityReference("contact", getContactDetails.Id);
                    _annotation.Attributes["objecttypecode"] = "contact";
                    if (loopColelctNotes.Attributes.Contains("subject"))
                    {
                        _annotation.Attributes["subject"] = loopColelctNotes.Attributes["subject"];
                    }

                    if (loopColelctNotes.Attributes.Contains("documentbody"))
                    {
                        _annotation.Attributes["documentbody"] = loopColelctNotes.Attributes["documentbody"];
                    }

                    if (loopColelctNotes.Attributes.Contains("mimetype"))
                    {
                        _annotation.Attributes["mimetype"] = loopColelctNotes.Attributes["mimetype"];
                    }

                    if (loopColelctNotes.Attributes.Contains("notetext"))
                    {
                        _annotation.Attributes["notetext"] = loopColelctNotes.Attributes["notetext"];
                    }

                    if (loopColelctNotes.Attributes.Contains("filename"))
                    {
                        _annotation.Attributes["filename"] = loopColelctNotes.Attributes["filename"];
                    }

                    service.Create(_annotation);

                }

 

Trigger the above code on Create of an Entity in Async Operation.

Wednesday, March 9, 2022

How to Show Hyper link in Canvas PowerApps

Introduction:


In this Blog we will see how to show HyperLink in PowerApps Canvas.


Implementation Steps:

 

1. Navigate to https://make.powerapps.com

 

2. Click Apps --> Select new --> Select Canvas App (Tablet/Phone)

 

3. Once Page Loaded --> Click Insert --> Click Text --> Select HTML Text

 

rampprakash_0-1646847718775.png

 

 

4. Once HTML Loaded  --> Click HTML TEXT in fx and write below code

 

"<a href='https://microsoftcrmtechie.blogspot.com'>Open Ram Blog</a>"

 

rampprakash_1-1646847853941.png

 

 

5. Now Run the Application 

 

rampprakash_2-1646847882821.png

 

That's it :slightly_smiling_face: if you click on the Link it will open up in Another Page :slightly_smiling_face:

Tuesday, March 8, 2022

Quick Create not opening from Sub grid?

Introduction:


In this blog we will see how to show Quick Create form from Sub grid.


Implementation Steps:

 

Consider I have two entities 

 

1. Table 1 

2. Table 2.

 

I need to Open Table 1 as a Quick create from Table 2 SUBGRID.

 

Lets see how we can do that.

 

1. Navigate to https://make.powerapps.com

 

2. Click Gear Icon at the Top --> Select Advance Settings

 

3. Click Settings--> Customization --> Customize the System

 

4. It will Open a Page --> Expand Entities --> Click Table1 --> Make Sure you will Check ALLOW QUICK CREATE

 

rampprakash_0-1646730374879.png

 

 

5. Once the Above Step Done --> Click Save and Publish

 

6. Once Publish done --> Navigate to https://make.powerapps.com 

 

7. Click Apps --> Select your Model Driven Apps --> Click Edit --> Expand Entity View --> Select the Table --> Select Quick Create Form 

 

rampprakash_1-1646730673075.png

 

8. Once Check Box done --> Click Save --> Click Publish

 

9. Once done --> Close all the window and Publish All Customization.

 

That's it :slightly_smiling_face:

Monday, March 7, 2022

How to Patch Person Lookup with PowerApps

Introduction: 

In this Blog we will see how to Patch Person Lookup with PowerApps with SharePoint.


Implementation Steps:


Consider a Scenario, we need to Update or Set Person Lookup Field from PowerApps


Patch Logged in User to a Lookup Field:


Patch(

    'TABLE NAME',

        PERSONLOOKUPNAME: {

           '@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",

           Claims: "i:0#.f|membership|"&User().Email,

           Department: "",

           DisplayName: User().DisplayName,

           Email: User().Email,

           JobTitle: "",

           Picture: ""

        }

    }

);


Patch different User to a Lookup Field:

 Patch(

    'TABLE NAME',

        PERSONLOOKUPNAME: {

           '@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",

           Claims: "i:0#.f|membership|email@emaildomain.com",

           Department: "",

           DisplayName: "USER FULLNAME",

           Email: "email@emaildomain.com",

           JobTitle: "",

           Picture: ""

        }

    }

);


Hope this helps.

Monday, February 21, 2022

Sort and SortBy Columns in PowerApps

Introduction: 

In this Blog we will see what is the main difference between Sort and SortBycolumns in PowerApps


Description:

Table Name "ACCOUNT"

Field Name "AccountName"


Sort: 


Consider i have a COMBOBOX Available i need to show the AccountName in the ComboBox.

So i Set ITEMS of ComboBox = "Account"

Now i want to Sort the Table Account in the Combobox using Account Name, What i can do. I can user SORT query there 


Sort(Account,"AccountName",Ascending)

Account - DataSource (table)

AccountName - Column (Column in Table)

Ascending - Sorting Type (Ascending/Descending)


SortByColumns: 


Now i want to Sort the Table Account in the Combobox using ONLY Account Name, What i can do. I can user SORT query there 


SortByColumns(Account,"AccountName",Ascending)

Account - DataSource (table)

AccountName - Column (Column in Table)

Ascending - Sorting Type (Ascending/Descending)



Tuesday, February 15, 2022

Is Application User View Not Displaying in User Table for Creating Application User ?

Introduction: 


In this Blog we will see how to create application user without legacy mode.


Implementation Steps:

 

Usually when create an Application User in Azure, we will directly navigate to https://orgname.crm.dyanmics.com then Go to Settings --> then Click Security --> Then User --> Then Change the View to Application User --> Click NEW --> Change View to Application User and Input Client ID and Save.

 

This is how we will follow to create application user, but unfortunately sometimes you cannot see APPLICATION USER View in the User Table in legacy mode.

 

Lets see how to create Application User without Legacy Mode.

 

1. Navigate to https://admin.microsoft.powerplatform.com and click Environments

 

rampprakash_0-1644924357619.png

 

 

2. Open the Respective Environment where you want to create Application user --> Once Opened --> Click Settings

 

rampprakash_1-1644924436048.png

 

3. Once Settings page Opened --> Click Users + permissions --> then Click Application Users

 

rampprakash_2-1644924483815.png

 

4. Click Application User 

 

rampprakash_3-1644924560271.png

 

if you want Add, New app User then Click + New app user

 

5. Once Clicked On App user -> Select Add an App

 

rampprakash_4-1644924630087.png

 

it will Load all the Application User from https://portal.azure.com

 

rampprakash_5-1644924726972.png

 

Now Search for the User and Click Add Once Done --> Add Business Unit and Select Security Role to the User

 

rampprakash_6-1644924806647.png

 

For Adding Security Role--> Click Pencil Symbol --> Add the Security Role and Click Save

 

rampprakash_7-1644924886508.png

 

 

That's it :slightly_smiling_face:

Day 11 - Customizing Option Sets Dropdown Fields with JavaScript

  In this Blog, we will see how to Customizing Option Sets Dropdown Fields with JavaScript label1 = formContext.getAttribute( "bosch_op...