Showing posts with label Javascript. Show all posts
Showing posts with label Javascript. Show all posts

Monday, April 17, 2023

How to Change Label Text in Form using JavaScript in Model Driven Apps

Introduction:

In this Blog we will see how to Change Label Text in Form Using JavaScript in Model Driven Apps.


Implementation Steps:

 

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

 

2. Click More --> Select Tables

 

3. Open the Table where you want to change the Form Text

 

In my Scenario I need to Change the Text Based on Boolean Field.

 

4. Boolean Field

  • Name : Change Text
    • Yes --> If yes then Change Text to Selected Yes
    • No --> If No then Change Text to Selected No

5. Now Create a Web Resource then Upload Below Code

 

function onChangeBooleanField(executionContext) {
    var formContext = executionContext.getFormContext();
    if (formContext.getAttribute("crd20_changetext").getValue()) {
        formContext.getControl('name').setLabel('Selected Yes');
    } else {
        formContext.getControl('name').setLabel('Selected No');
    }
}

 

// crd20_changetext --> Boolean Field Logical Name

//name --> Label to be Changed

 

6. I have Written function in OnChange of Boolean Field

 

7. Once Code Written Refresh the Account Form

 

rampprakash_0-1681723093204.png

 

As i said written Code in On Change

 

Now if i change Value to Yes then You will see Selected Yes as Label

 

rampprakash_1-1681723130587.png

 

 

Now if i change to No then You will see Selected No as Label

 

rampprakash_2-1681723649432.png

 

 

That's it :slightly_smiling_face:

 

Using Change label in JavaScript we can change the Label Text.

Thursday, November 3, 2022

Filter Email To/CC/BCC Column in Email Table

Introduction:


In this Blog we will see how to filter Email To/Cc/Bcc Fields in CRM/Model Driven Apps


Implementation Steps:

 

Consider if I have an Email Table with To/CC/Bcc Fields, but To Fields contains lots of Entities in it, But we need to Restrict to Some of the Entities alone

 

rampprakash_0-1667380238890.png  

 

Here is the List of Entities with TO Fields,

 

rampprakash_1-1667380316045.png

 

Let's See how we can filter this Fields..

 

Steps to Follow :

 

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

 

2. Click Solutions --> Create a New Solution or open an Existing Solution

 

3. Click Add --> Select New Web Resource

 

4. Write Below Code and Save it..

 

function SetDefaultView(executionContext) {
var formContext = executionContext.getFormContext();
var customerControl = formContext.getControl("to");
if (customerControl.getEntityTypes().length > 1) {
customerControl.setEntityTypes(['account','contact']);
}
}

 

the Above code mentioned that we are taking the Control ("TO") and filtering the ENTITYTYPES only to ACCOUNT AND CONTACT Table.

 

5. Once Done , Call this Event in OnLoad of the Form once the Page Loaded you will see only 2 Entity Types with Account and Contact

 

rampprakash_2-1667381715759.png

 

That's it :slightly_smiling_face:

 

Using JavaScript we can Filter the TO/CC/BCC fields in Email table

Friday, April 1, 2022

Hide Command Bar using JavaScript in Model Driven App

Introduction:


In this Blog, we will see how to hide Navigation Bar in Model Driven App using JavaScript.


Implementation Steps:

 

When ever you tried to create a new Record, you will be redirected to a page like below

 

rampprakash_0-1648728054363.png

 

Red Color Highlighted Called Command Bar

 

If we want to hide that Command Bar follow below steps to achieve the same.

 

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

2. Click Solutions --> Create a new Solution

3. Click New --> Click More --> Select Web Resource and add a new Web Resource

 

rampprakash_1-1648728360258.png

4. Write below code in Web Resource

 

 

function onLoadHideCommandBar(executionContext) {
    var formContext = executionContext.getFormContext();
    formContext.ui.headerSection.setCommandBarVisible(booleanValue);
}

 

 

booleanValue : pass true or false as an option

 

true - visible Command bar

false - hide Command bar

 

Once Code Published:

 

Load or Open a new Record

 

rampprakash_0-1648836606039.png

 

Now you cannot see the Navigation Bar.

 

That's it :slightly_smiling_face:

 

Wednesday, January 5, 2022

Retrieve Quick View Value using JavaScript in Dataverse Environment

 Implementation Steps:

 

What is Mean by Quick View?

 

If we want to Populate data from One Entity to Another Entity based on Lookup then we can easily create Quick View Form to display the same.

 

Navigate to Forms --> Open main form --> Select Quick View Component and select respective entity and its Quick Form 

rampprakash_0-1640945694379.png

 

Javascript

 

Quick View Form Name : QuickViewContact

 

 

 

 

function getQuickViewForm(executionContext)
{
// get form Context
   var formContext = executionContext.getFormContext();
// get Quick View Contact
   var quickViewControl = formContext.ui.quickForms.get("quickviewcontact");
// get First name
   var firstNameControl = quickViewControl.getControl("firstname");
// Show Alert Dialog from FirstName
   Xrm.Utility.alertDialog(firstNameControl.getAttribute().getValue());
}

 

 

 

Friday, December 31, 2021

Retrieve Quick View Value using JavaScript in Dataverse Environment


Introduction:

In this Blog we will see how to get Values from Quick View Form

Implementation Steps:

 

What is Mean by Quick View?

 

If we want to Populate data from One Entity to Another Entity based on Lookup then we can easily create Quick View Form to display the same.

 

Navigate to Forms --> Open main form --> Select Quick View Component and select respective entity and its Quick Form 


rampprakash_0-1640945694379.png

 

Javascript:

 

Quick View Form Name : QuickViewContact

 

 

function getQuickViewForm(executionContext)
{
// get form Context
   var formContext = executionContext.getFormContext();
// get Quick View Contact
   var quickViewControl = formContext.ui.quickForms.get("quickviewcontact");
// get First name
   var firstNameControl = quickViewControl.getControl("firstname");
// Show Alert Dialog from FirstName
   Xrm.Utility.alertDialog(firstNameControl.getAttribute().getValue());
}

 

 

That's it :slightly_smiling_face:


Monday, December 20, 2021

How to Create Quick View in Dataverse or MSCRM Environment

Introduction:

In this Blog we will see how to create Quick View in Dataverse/ MSRM Environment.

Scinario:

I have an Account and Opportunity Entity Available, in Opportunity Entity I have Account lookup Available, I need to display Account related fields in Opportunity form without any custom code.

Lets see how we can achieve this Behavior.

Implementation Steps:


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

2. Click Dataverse

3. Open Account Table and Click Forms

4. Check Quick View Form Already Available

5. If Already Available we can use else we can create a new One.

6. For Creating a New One Click ADD FORM and Select Quick View Form


7. Once selected it will Open the Form --> Add all the Field Which needed in Quick View Form

8. Once Done Provide Name --> Save and then Publish.

9. Now Navigate to Tables Again and Open Related(in my case its Opportunity). Click on Form and Open Main Form or where you want to display Quick View Form

10. Click Components and Select Quick View Form


11. It will show a Popup Select the Lookup and then Select the Form Which we have created

12. Then Position it in Respective place in the Form.


That's it :)

Save Now and Publish.

Open the Opportunity Form Select the Account lookup you will be popped up with Account Related Information

Note:

It will be a Read only Field. 





How to Import Data from Excel to Multiple tables in PowerApps

Introduction:   I have created a view on how to import data from excel to multiple tables in Canvas PowerApps   Implemented Steps: ...