Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Power Apps Pro Dev & ISV
Unanswered

PCF - Can you load native JS into the controls themselves (i.e. The CRM Xrm api)?

(0) ShareShare
ReportReport
Posted on by

For instance, we would like to build a masking control. That would format a number based on the country the record is associated with. Furthermore we are adding the control to Dynamic CRM. Is there a way the we could load/access the form API (i.e. Xrm.Page.getAttribute("name").getValue()) vs making a call to the database?

  • Hemant Gaur Profile Picture
    on at
    Re: PCF - Can you load native JS into the controls themselves (i.e. The CRM Xrm api)?
    You can build the control today and when the address fields are available eventually you can just use them for configuration. There is no other way to replace the field in the system .

    Hemant
  • Community Power Platform Member Profile Picture
    on at
    Re: PCF - Can you load native JS into the controls themselves (i.e. The CRM Xrm api)?

    Does that mean, at some point down the road the PCF might be a better fit for this?

  • Hemant Gaur Profile Picture
    on at
    Re: PCF - Can you load native JS into the controls themselves (i.e. The CRM Xrm api)?
    Had a call with PM for composite control this morning. The issue is being tracked.


    Thanks for your patience.
  • Community Power Platform Member Profile Picture
    on at
    Re: PCF - Can you load native JS into the controls themselves (i.e. The CRM Xrm api)?

    @HemantG ,

     

    I appreciate the options and It looks like there are ways to kind of do it. However at the moment, it is forcing a fit. Maybe down the road it will open up more.

  • Hemant Gaur Profile Picture
    on at
    Re: PCF - Can you load native JS into the controls themselves (i.e. The CRM Xrm api)?

    Curently there is a restriction that the composite fields cannot be configured to the custom control so address-country is not available. 

    STEP1: 

    What you can do is create a placeholder address field for country and add a PBL to set the value of this fields base on the country in the address. Hide the field on the form so that the user does not sees two addresses. 

    OR

    use the placeholder address - country field on the form and and add a sync workflow to write this value into actual address-country on form save.  

     

    STEP2: 

    Add additional input property to the Business phone field which is of type text and configure it to the placeholder address feild. 

     

    STEP3: 

    The additional property is now available in the business phone and control can access it to know what country is in the form. 

     

    HTH,

    Hemant

  • Community Power Platform Member Profile Picture
    on at
    Re: PCF - Can you load native JS into the controls themselves (i.e. The CRM Xrm api)?

     

    @HemantGhopfully the below screenshot will provide some extra clearity. We want to put a PCF on the "Business Phone", so that it can be formated. However, based on the country. We want the format to change.

     

    Phone Formatting Explanation.png

  • Hemant Gaur Profile Picture
    on at
    Re: PCF - Can you load native JS into the controls themselves (i.e. The CRM Xrm api)?

    @Anonymous wrote:

    It sounds like the PCF is not the right fit for a scenario like this.


    Lets try one more time. Can you explain what is the end user expereince expected, possibly with some mock screens if that helps. We can then see whats the best fit. 

  • Community Power Platform Member Profile Picture
    on at
    Re: PCF - Can you load native JS into the controls themselves (i.e. The CRM Xrm api)?

    It sounds like the PCF is not the right fit for a scenario like this.

  • Hemant Gaur Profile Picture
    on at
    Re: PCF - Can you load native JS into the controls themselves (i.e. The CRM Xrm api)?
    XRM should not be accessed from the control. Only framework APIs.
  • Community Power Platform Member Profile Picture
    on at
    Re: PCF - Can you load native JS into the controls themselves (i.e. The CRM Xrm api)?

    Hemant, unless I am missing something. This will only load files that I have pre-defined. In this scenario, the Xrm API would not be available until run time, as it is full managed by the application itself.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Apps - Power Apps Pro Dev & ISV

#1
WarrenBelz Profile Picture

WarrenBelz 85 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 65 Super User 2025 Season 1

#3
mmbr1606 Profile Picture

mmbr1606 55 Super User 2025 Season 1

Overall leaderboard