Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics 365 | Integration, Dataverse...
Answered

PCF control with one "input" usage type parameter

Posted on by 5

Hi everyone!

I'm sorry if this topic has been already discussed, I just failed to find any information or solution.

My question is how to utilize PCF control with only one property with usage type "input".

The thing is that if the PCF control has no bound properties it would not appear in the list of controls when I try to place it for, as an example, address1_line1 attribute. If I make the property "bound" it would appear. Both entity attribute and control property are singleline.text. 

So, how could I use such a PCF control?

Thanks in advance!

  • Zharko Hristov Profile Picture
    Zharko Hristov 5 on at
    RE: PCF control with one "input" usage type parameter

    Agree, but as there's no other way to get the formContext inside PCF, I'll use it until a replacement is announced some day.

    Here docs.microsoft.com/.../important-changes-coming they say  "c) If the getContentWindow  method doesn't work, you can use parent.Xrm to get to the Xrm object inside an HTML web resource. If the HTML web resource is opened in a new window, then you should use opener.Xrm instead."

    I'll get this as a recommendation :).

  • Diana Birkelbach Profile Picture
    Diana Birkelbach 140 Most Valuable Professional on at
    RE: PCF control with one "input" usage type parameter

    Maybe this will work in your case, but even if the code checker doesn't complain, I think is still unsupported. I saw quite a few answers from Microsoft on this subject in the PCF Community Forum.

    I personally never make use of Xrm inside a PCF, because I think that might break some day. I think there will be changes because the Custom Pages where we will be able to combine several forms in a page or Xrm.Navigation.navigateTo which opens a form as a dialog without leaving the old one. I am afraid that I might land on the wrong Xrm object if I did that.

    Kind regards,

    Diana

  • Zharko Hristov Profile Picture
    Zharko Hristov 5 on at
    RE: PCF control with one "input" usage type parameter

    Thank you, Diana!

    That's my current approach - I've added a dummy property, which won't be used.

    For interacting with other form's controls I use parent.Xrm, which currently is still supported, as this is the only way for a web resource to interact with the form, where it is placed. It is not reported as issue by code checker.

  • Verified answer
    Diana Birkelbach Profile Picture
    Diana Birkelbach 140 Most Valuable Professional on at
    RE: PCF control with one "input" usage type parameter

    Replacing a HTMLWebResource without bound parameter means the "Unbound PCF Controls". That's on the roadmap, but for now the only workarround available is taking a dummy attribute and bind it to a field type PCF. It doesn't matter which attribute you take, since you won't ever change the value. You can of course place the same attribute multiple times on the form.

    Regarding the recommandation to replace keyup/keydown with PCFs, I've understood that they recommend to make you own String/Number Controls There you can handle the keyDown/keyUp, since you are allowed to make everything you want inside the DIV container you get. Having this "Unbound" would have a few disadvantages, since it's not notified if the rest of the values on the form are changed, and it cannot notify the other Controls and cannot interact with the form scripting. The PCF itself is not allowed to interact with the form or other controls, the only supported way it through changing values.

    In case it helps, you can find a lot of answered question about PCFs, in the ProDev (PCF) Power Apps Community Forum: powerusers.microsoft.com/.../pa_component_framework

    Hope it helps!

    Kind regards,

    Diana

  • Zharko Hristov Profile Picture
    Zharko Hristov 5 on at
    RE: PCF control with one "input" usage type parameter

    Thank you for the prompt reply!

    I see I've been unclear with my question... I don't want to bind the property to any of the entity's attribute. I need this property to be able to have arbitrary value, that should be set at design time.

    Some history may help in explanation.

    I need to handle keyup/keydown events. As those handlers were removed from Dynamics 365 some time ago, Microsoft has suggested to use custom controls. So, this is the purpose of this control.

    In order this typing to be parsed, the control needs, let say, a key word. And this key word needs to be set separately for each of the used controls (same control may be used many times in one or more forms).

    Basically, I look for a way to use the custom control as I would use Iframe or web resource, but having PCF in the same time...

  • Diana Birkelbach Profile Picture
    Diana Birkelbach 140 Most Valuable Professional on at
    RE: PCF control with one "input" usage type parameter

    Do you have the code for it?

    If yes, change the usage to bound. The PCF doesn't need to change a value, so it can be read-only.

    Kind regards,

    Diana

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans