cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Julien2
Super User
Super User

PCF - Custom Dialog with a submit button

Hello everyone,

In a table ribbon, I have a custom button.

What I am trying to achieve when the button is clicked are the following:

When I click on this button I would like to launch a dialogue box that will contain inside it a text field and a submit button.
When the submit button is clicked inside the dialogue I want to create around 2-5k records in a table in one shot.

I did some research and found that custom pages using powerapps canvas will allow us to create this dialogue by checking the below amazing posts by @DianaBirkelbach :
https://dianabirkelbach.wordpress.com/?s=dialog.

If I want to proceed with powerapps canvas to build this dialogue, later the number of records will grow that should be created in the other table and I don’t think the power apps canvas will be the solution as I might have more complex logic to validate data before doing the creation of the records.

I would like to know what is the best option and the tools that should be used for the above scenario to create this dialogue and perform a create operation for a small set of records 2-5K?

Behind the PCF there should be a background process that should be fired when the submit button is clicked from the dialogue to perform the creation of the records.

Could you suggest what can be the solution for the above requirements? Can you provide some documentation, resources, or a sample?

Any help is highly appreciated!
Best regards,
Julien

4 REPLIES 4
DianaBirkelbach
Super User
Super User

Hi @Julien2 , 

 

If all you want to show in the dialog is a text field and a button, I agree that the code for the generation shouldn't be inside the CustomPage. It will be better for checking the data before the generation. Also having the logic on the server side will be convenient if you'll need it somewhere else too (re-generation, reorganization of data).

I think the best would be to define a CustomAPI (the "upgraded" Custom Action), containing plugin code to check the data and make the generation.

 

I guess the second part of the question is about using low code in Custom Pages in order to call a server code (Custom API).

- I guess you could use Cloud Flows.

- I have no idea if we can call the CustomAPI directly from the Custom Page using PowerFx. 

- Another option would be to make a dummy PCF, without UI (so the div of the PCF will be almost invisible and transparent), and you could use PowerFx in your CustomPage to change the property of the PCF which will trigger the Custom API. Or maybe the PCF will be just showing a "Processing" message, while it executes the Custom API.

 

Another way to trigger server code is of course to make a "dummy" update (the old trick to trigger plugins😞 change a column/value of a record, and register a PlugIn on that attribute/column. Or write a row inside a "trigger" table.
The PlugIn will make the whole checking/generation.

That can be implemeneted inside the CustomPage: it's just a PATCH command using PowerFx. Only one record inside the trigger table needs to be created/changed.

 

Hope it helps!

 

PS: Thank you for the nice words! Happy to hear that my blogs helped! 🙂

 

Kind regards,
Diana
----------
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

Hello @DianaBirkelbach ,

 

Thank you so much for your reply.

Regarding the second part, I have never tried to call the custom API directly from a custom page but I could create a flow that can be triggered when the button is clicked and call the custom action.

For the option to show a progress bar or processing message we need to find a way how we can do it because we need to avoid executing the button again and over again from the client-side when the background process is triggered.
As for the plugin, it is a known and nice trick however it will not help us in our requirements due to the 2 min timeout constraint we have in plugins because in our requirement the approximate number of records that will be created when the button is clicked will be around 60k records and not 2-5k based on the study that we did today.

I am still doing my research to find this handy tool that we should use to develop our logic based on the previously mentioned requirements and perform the creation of those records.

Please let me know if you have any other suggestions or a different way to achieve this requirement.

Best regards,
Julien

DianaBirkelbach
Super User
Super User

Hi @Julien2 , 

 

In case you expect to reach the 2 minutes timeout, the CustomAPI is also not an option, since in has the same restrictions.

In that case I would go with a PCF inside the CustomPage. The PCF would show the progress bar while it makes the checks and the changes. You can use batch requests to keep them in a transaction.

 

The Flows are still an option too. 

 

Hope this helps!

Kind regards,
Diana
----------
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."
Julien2
Super User
Super User

Hello @DianaBirkelbach ,

Thank you for your reply.

Yes, the flow can be an option in case we decided to use Power Automate. However, I didn't find an example of the strategies that we should follow to design our flow in a way to apply batch requests.

In addition, we found that we can leverage Azure functions to send those requests to dataverse for the creation of records and we can create it based on our requirement but also it has timeout based on the pricing plan, so most probably we might go for this option.

Best regards,
Julien

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Users online (3,162)