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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / PCF - Model - Driven D...
Power Apps
Unanswered

PCF - Model - Driven Dynamic Forms Questionnaires

(0) ShareShare
ReportReport
Posted on by 1,710

Hello,

I have a table where users can define dynamically the questionnaires of a checklist. The type of questions is very similar to a survey (Text, Date Only, Choices, Yes/no, etc..)

Example:

Julien2_0-1687781623632.png

Whenever they want to complete the checklist, they will select from a lookup field which Form or Checklist, and onSave event will generate all the lines that should be filled according to their types.

I need advice on how we will be able to handle and validate that the points are being filled in as per their datatypes?

Example:

  • If the type is DateOnly for the question -> Date Calendar Control should be added to the question automatically using the PCF.
  • I might have for example to Choose one Sauce as a point -> The sauce datatype is a lookup that reads from a table their respective value hence the PCF should add the lookup control.
  • The temperature is decimal as a datatype meaning that the only value that will be accepted is a number.

Clearly, we will need a PCF that adds the right component as per the questionnaire datatypes.

I noticed that this functionality is already done by Reza on Power Apps canvas but now the requirement is different and should be in a model-driven app. I know that a custom page is an option but the process of storing/viewing data will be different because we need to store it in a JSON format and if the users want to see it directly in model-driven the only way is to have access to the custom page and JSON length text might vary based on the questionnaires so we need to avoid exceeding the characters limits. I also think we could have a cloud flow that parses the JSON and splits the records.

This functionality is very similar to how we can add/edit product properties in the sales modules as Microsoft already has this component available:

Julien2_1-1687781836181.pngJulien2_2-1687781858250.png

 


What will be the most effective approach to achieving such a requirement? Could you provide some documentations that can guide us?

Any help is greatly appreciated.

 

Thank you!

I have the same question (0)
  • Diana Birkelbach Profile Picture
    3,072 Most Valuable Professional on at

    Hi @Julien2 , 

     

    The format for saving the data depends on how you need to evaluate the data.

    You could save it as a JSON or save it in several fields, depending on the type. 

     

    On Ignite 2022, Brandom Colburn shown a similar PCF (he called it Shapeshifter): https://learn.microsoft.com/en-us/events/ignite-2022/cdb11-shapeshifter-a-power-app-pcf-showcase

    I think the code for his PCF can be found here: https://github.com/microsoft/shapeshifter/tree/master.

     

    Following the idea from Brandon (you have a PCF, and base on the type you have a date, a text, a number...), you can  create a field PCF: binding properties for field, date value, text value, number value. But of course that works also if you use a JSON field.

     

    If you want to have an editable grid for that, maybe you could use the Power Apps Grid customizer control. If you work with the column containing the JSON, you can use the customizer control to show the JSON as text/date/number controls and save the data in your JSON format. 
    If you choose the text/date/number columns for value (so not the JSON idea), you could bind the customizer control for your "DataType" column and show Shapeshifter control there (using the other column values). The easier way is to have the other columns inside your view (read-only), but there are ways to fetch the data from the control.

    I've tried to show some possibilities. Depending on which way you choose, we can go on with more details in case you have questions. 
    I have a few blogs on what you can do with the Power Apps Grid customized control: https://dianabirkelbach.wordpress.com/category/power-apps-grid-control/

    or have a look to this youtube video for an overview: https://www.youtube.com/watch?v=37q_-tD6gTo&ab_channel=DianaBirkelbachakaDianamicsPCFLady

     

     

    Hope it helps.

     

     

  • Linn Zaw Win Profile Picture
    2,996 on at

    With the Custom Page approach, we can show the questions based on the number of items and render (show/hide) the controls (datetime picker, textbox, dropdown) based on the type of each questionnaire and validate the answers, right?

    I think that will be an easier/faster approach than building your own Editable Grid PCF control which could take weeks depending on the front-end development skillset of the team.

     

     

  • EBMRay Profile Picture
    1,710 on at

    Hi @LinnZawWin,

    Thank you for your reply.

    No not specifically in JSON format but I was wondering if it should be stored that way because I have seen the same canvas that was done in Canvas and this is why I mention it.

    It is clear how they will be generated. However, the main goal is to validate the type of each questionnaire. This means if the question type was a number I cannot input text. The only solution will be a PCF to validate the "Value" field where they will provide their answers.

    Once the questions are generated as line times with their respective data types can we add to the "Value" column of the PCF control to validate the DataTypes in an Editable Grid?

    I hope we can use D365 Inspections for FS because this is exactly what we need. However, unfortunately, we don't have the FS module in our environment.

    Best regards,
    Julien

  • Linn Zaw Win Profile Picture
    2,996 on at

    Hi @Julien2 

    Is there any particular reason why the data needs to be stored in a JSON format?

    As you mentioned about the product properties in the sales modules, you can create the template for the questionnaires with the question line items. And when the users want to complete the checklist, generate the lines by creating the line items as multiple rows in a child table (lookup back to the questionnaire question line).

    If you have all the questions and details as records, I don't think you need to worry about the JSON-length text by going for the custom page approach.

     

    In the past, we used the D365 Inspections (which is Customer Voice based solution) for similar requirements but I don't think you can select a lookup as a field type though.

     

     

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
Kalathiya Profile Picture

Kalathiya 403

#2
WarrenBelz Profile Picture

WarrenBelz 338 Most Valuable Professional

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 320 Super User 2025 Season 2

Last 30 days Overall leaderboard