Tuesday, September 28, 2021

Publisher in Power Platform

Introduction:

 

As per Out of Behavior, Power platform will provide default prefix for custom entities as new_ or cr608_. To create custom prefix we need to create a publisher so that we can use our custom prefix while creating custom entities or custom fields in custom tables or OOB tables.

 

Implementation Steps:

 

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

 

2. Click on Solutions

 

3. Then Click on New Solution then select New Publisher Button

 

rampprakash_0-1632323952857.png

 

4. It will Navigate to another screen to Create a Publisher. Enter the Mandatory Details as Display Name/Name/Prefix

In this Demo am selected my Prefix as demo

 

rampprakash_2-1632324307795.png

 

5. If you want to enter Contact details about the publisher click on Contact and enter the details (Not Mandatory)

 

rampprakash_4-1632324400064.png

 

6. Once Done Click On Save Button to Save the Publisher

 

rampprakash_0-1632325656279.png

 

That's it. This is how we need to create Publisher.

 

Please find the Video for your reference


Youtube link for your reference.

Tuesday, September 21, 2021

Add Custom Icons in Sub-Grid or View in Model Driven Apps or CRM


Introduction:

In this blog we will see how to Add an Image or Icon in SUBGRID / VIEWS in Model Driven Apps or Dynamics CRM


Steps to Follow:

In this example in Opportunity Entity i have created an Option Set field

1. Submitted

2. Sent for Approval

3. Approved

4. Rejected


I have downloaded Four images and store it in CRM as Web Resources(Settings --> Customization--> Customize the system --> WebResource--> New WebResource --> Type as PNG)



As the Above mentioned you need to Process it for storing the PNG


Once Above steps done create an WebResource for JavaScript(Settings --> Customization--> Customize the system --> WebResource--> New WebResource --> Type as JavaScript)

Then write the below code in the TEXT Editor Javascript


function populateImageValuesinGrid(rowDataFromGrid) {

    debugger;

    var getRows = JSON.parse(rowDataFromGrid);

    var currentRecordStatus = getRows.cr608_currentrecordstatus;

    var populateimageValues = "";

    var populateTooltip = "";


    switch (currentRecordStatus) {

        case "Submitted":

            populateimageValues = "SUBMITTED WEBRESOURCE NAME";//cr608_submited

            populateTooltip = "Submitted";

            break;

        case "Approved":

            populateimageValues ="Approved WEBRESOURCE NAME";//cr608_Approved

            populateTooltip = "Approved";

            break;

        case "Rejected":

            populateimageValues = "Rejected WEBRESOURCE NAME";//cr608_rejcted

            populateTooltip = "Rejected";

            break;

        case "Sent For Approval":

            populateimageValues = "SFA WEBRESOURCE NAME";//cr608_sent for approval

            populateTooltip = "Sent For Approval";

            break;

    }


    var returnArrayValues = [populateimageValues, populateTooltip];

    return returnArrayValues;

}


Once Pasted the above script--> Click Save then Publish

Once Publish Done

Open the Opportunity Entity from Solutions --> then click on View(here am going to populate in Opportunity association view)--> Open it then select open Classic View --> then Select the STATUS COLUMN(where you want to show images)

then Input the WebResource Name then Input the FUNCTION name --> Click Ok --> Save and Close --> PUBLISH


Thats it. Now you can see the image automatically gets populated based on the status




Conclusion:


This is how we need to add Images/Icons in Custom View or in Grid



Friday, September 17, 2021

Create and Connect - Multi-factor enabled D365 Dataverse Programmatically

 

Introduction:

In this Blog, we will see how to create Application User in Azure to Access Dynamics CRM/ Model-Driven Apps


Azure Steps to Follow for Application User Registration

1. Login to https://portal.azure.com

2. Search for App Registrations at the top


3. Click New App Registration
4. Enter the Name and Click on Register


5. Once Registration Done 

6. Copy Application ID and Store it in Notepad

7. Search for Certificates and Secrets



8. Select New Client Secret

9. Enter the Description and Click Save

10. You will be getting Client Secret once you save it.

11. Copy that in your Notepad where Application ID Copied



Create Application User in Model-Driven Apps / CRM

1. Login to D365 CDS environment

2. Go to Settings –> Security –>Users

3. Change the view to ‘Application Users’ and click New. Make sure the form is ‘Application User’ form

4. Click New and Change Form to Application User and Input Application ID in the Text Box and Save

5. Then Assign appropriate Security role to this Application User as per your organization’s security set up.

C# Connection String:

String connectionString = “AuthType=ClientSecret; url=<your organization URL>; ClientId=<your application id>; ClientSecret=<client secret key>”;

                CrmServiceClient crmServiceClient = new CrmServiceClient(connectionString ); //Connecting to the D-365 CDS instance

 

                if (crmServiceClient != null && crmServiceClient.IsReady)

                { //Do your operation}









Implement JavaScript in ModelDriven Apps / MSCRM

 

Introduction:

In this blog we will see how to write JavaScript in Model Driven Apps and MSCRM

Events:

    1. On Load Event

    2. On Save Event

    3. On Change Event

Steps to Follow

    a. To Proceed With First Navigate to https://make.powerapps.com

    b. Then Navigate to Table where you want to write JavaScript

    c. Then Click On Form --> Open the main form

     d. then Click on Events and Click Add Library

    e. If you have already Web Resource Available you can select the WebResource if not select New WebResource
 


    f. Then it will open a form there you can enter the WebResource Name then type as JSCRIPT and Click Text Editor then you can input your JAVASCIPRT for the Event 

    e. Once the WebResource Selected you can See the Event Hander Button will get Enabled



    g. You can see the Event Handler click On OnLoad (Event Handler) to Process with On Load Event then On Save(Event Handler) for On Save Operation once added the funciton Name Click ok
    
    h. then we can See the Event Gets Added 

FOR ONCHANGE OPERATION:

    a. Click on the Field in the Form to Proceess with On Change Operation


    b. Here you can see the Events with On Change Operation 

    


    c. Click On Event Handler and Add the On Change Function name in Function Text Box

Then Click on Done 

Save and then Publish


That's It. 

Now if you Open the Screen then You can see the OnLoad(when page Gets Loaded),OnChange(When a Field Gets Changed), OnSave(When a Page gets Saved)

For Script/Demo Solution you can refer to this github













 




Thursday, September 16, 2021

Show or Hide Command Bar using JavaScript in DataVerse/ Dynamics 365

 

Introduction:

In this Blog we will see how to show or hide Command bar using JavaScript in Both Dataverse/Model Driven Apps/ CRM


Below is the Sample Screen Shot for Command bar



If we want to hide any button or edit command we can use RIBBON Workbench or Customize Using XML. But there is no other functionality for hiding whole Command Bar.

To recover from this Situation Microsoft introduced a new Feature for Show or Hide functionality


Script to Use:

formContext.ui.headerSection.setCommandBarVisible(BOOLEAN);


To Utilize in script

function showOrHideCommandBar(executionContext)

{

var formContext = executionContext.getFromContext();

formContext.ui.headerSection.setCommandBarVisible(false); // True to enable // False to hidden

}


That's it :)

Tuesday, September 14, 2021

Step by Step Guidence Calculated Field and Rollup Fields in DataVerse


Introduction:


In this Blog we will see how to Use Calculated Field and Rollup Fields in Dataverse Environment.


Calculated Field:

We can use calculated Field for doing multiple operations like (Add/Subtract/multiple) etc.,.

Example Process Steps:

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

2. Click Solutions

3. Create a Solutions and Add Create an Entity or Add an Existing Entity

4. Consider Entity name (Calculate Table)

5. Open Calculate Table --> Add Column and Create three Fields --> Select Data Type as Whole Number

6. Create a new Field in the same table and Select Data Type as Whole Number and Select Calculated or Rollup as Calculation and Click Done

7. Once save Done Open the Field Again the click Open Calculation

8. Once Page gets opened (write the script in Action Column)



9. Once Done click Tick Symbol and Save the Record 



You can see the Values calculated as per our expectations

POINTS TO BE NOTED


If you leave the Value as NULL then the calculate value wont work. if you want to make it work write a business rule / Javascript to set it to Zero if value is Blank


RollUp Field:

We can use Rollup Field to Rollup Values from Child to Parent Record(SUM/Count/AVG/Min/Max)

Example Process Steps:


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

2. Click Solutions

3. Create a Solutions and Add Create an Entity or Add an Existing Entity

4. Consider Entity name (Opportunity)

5. Create a Field in the Opportunity (Lookup to Account and Total Amount Field)

6. In the Account Entity Create a Field With type as Whole Number and Select Calculate or Rollup fiel d to ROLLUP based on below Image

7. Once field Created open the field


8. As per the screen shot mentioned Click Open Rollup and Select the Related Entity and User the Aggregate Operation (here Am taking Sum of Total Value from Opportunity)

9. Save and Close and publish it.

Conclusion:

Hope you can able to understand technically how to use Calculated and Rollup Fields. Drop me a comment if you have any queries


github for Sample Solution












Monday, September 6, 2021

Command Designer with PowerFx

 Introduction:

In this Blog we will see preview feature of PowerApps for Command Designer

Steps to Follow:

1. If you have Environment available go to https://make.powerapps.com else Create Trail and navigate to https://make.powerapps.com

2. Then Create a model driven app 

3. Once Model Driven app created change to URL to https://make.preview.powerapps.com

4. Navigate to Solutions and open the solution which you have created based on step 2






5. Open solution Opened Click on Apps then select the three Dots of your Model Driven apps then Click Edit and select Edit in Preview






6. Once Page Opened click on the Entities the Edit Command bar(Preview)

7. As it is a preview we cannot edit Out-of-the Box Buttons

8. To Create a new Button click on New Command





9. To change Icon







Select the Icon as Use Icon and select the Icon So that you can see the icon displayed at the Button Level

10. To trigger Action 










Select the Run Formula if you want to user PowerFX like Patch etc

Patch(Contacts,Self.Selected.Item,{'Enable Button':'Enable Button (Contacts)'.Yes})

If you want to update some data in the Record you can use above function         (here Enable Button is a two option Field)

11. To Run JavaScript

Change Action to Run JavaScript and provide the Library and function (add Parameter if needed)

12. To enable and Disable function










Set Visibility to Show on Condition from formula

In the Visible property i written function as if the field is No display else don't display
Self.Selected.Item.'Enable Button'='Enable Button (Contacts)'.No

13. Then you can SaveAndPublish
14. Run to see the changes

15. if you want to see these components


Click on Component Library and Click on the Library inside the Grid to see the components.



Github for more commands

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...