web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Check if not required ...
Power Apps
Answered

Check if not required fields are used

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi 

 

I have a PCF with a few properties, and not all properties are required. 
Depending wheter the properties are set to a CRM-field or not, i want to have different behaviour in my code. 

Is this somehow possible? 

For example by checking the value if it's undefined or something alike? 

 

Kind regards! 

I have the same question (0)
  • Ben Thompson Profile Picture
    1,400 on at

    That is exactly how most of our PCF controls work.

     

    Each PCF control has to have a single bound field but you can add as many other fields as you want as either bound (has to be an attribute) or input (can be either an attribute field or a design time value*) fields. So all our backend business logic (which used to be 1,000s of lines of complex Javascript) are now made up of the appropriate PCF components which will consist of 1 editable fields (for instance trigger attributes) and secondary input or bound field say "Select Entity" which will be displayed higher up the form (in the case of Select Entity it's usually at the top).

     

    The other thing to note is that apart from the first main parameter the PowerApp form will not be aware that secondary values need to be loaded unless you explicitly add those secondary parameters as fields on the form. The attributes can be hidden fields on the form but they do need to there as otherwise the form's lazy loading logic will not request the values and will just pass null or empty values to your components.

     

    * text fields are limited to 100 characters at the moment but the bound value can be far larger than that. 

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @ben-thompsonThanks for answerring! But I'm afraid you didn't really understand my question...
    I know there's the possibility to add extra parameters that are not required. 
    The thing I want to find out in code is; if those extra, not required, fields were bound to a crm field when the control was added to the main field or not. 

    Because there's the possibility to leave those extra fields unused. 


  • Ben Thompson Profile Picture
    1,400 on at

    snip - as unhelpful

  • Verified answer
    Community Power Platform Member Profile Picture
    Microsoft Employee on at

    I looked further into it and found the following: 

     

    • A non-required field that is configured in crm to a field, returns in the componentframeworkcontext the following : 
      context.parameters.<myconfiguredproperty>.type  = SingleLine.Text (or to what type of field you configured it was configured)
    • context.parameters.<mynotconfiguredproperty>.type = null 

    Can someone confirm this will always be the case? 

     

     

     

  • Diana Birkelbach Profile Picture
    3,072 Most Valuable Professional on at

    Hi @Anonymous , 

    The way you've found out seems to work. Since the value (raw) "null" doesn't tell if the customizer set the property or not,  I am not aware of another way to implement your requirement, but this could work by hazard for now, you're right.

     

    In my components I don't rely on the fact that the customizer set an extra property or not. I prefer to define another property of type "Enum", where the customized defines how the control should work. 

    For instance, the control for a metadata autocomplete, lets the user decide if he/she wants it to perform as an "Entity" or an "Attribute" autocomplete. If it's an "Attribute", then I consider the parameter "entityName".

    Maybe you know about this already, but in case it helps you design your component, here is the definition of the properties in my  manifest:

    <property name="controlValue" ... of-type="SingleLine.Text" usage="bound" required="true" />
    <property name="behavior" ... of-type="Enum" usage="input" required="true">
     <value name="Entity" display-name-key="Entity" description-key="Entity names" default="true">Entity</value>
     <value name="Attribute" display-name-key="Attribute" description-key="Attributes for an entity" >Attribute</value>
    </property>
    <property name="entityName" ... of-type="SingleLine.Text" usage="input" required="false" /> 

     Best 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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 633

#2
11manish Profile Picture

11manish 588

#3
Valantis Profile Picture

Valantis 457

Last 30 days Overall leaderboard