Kentico 10 Forms and customizing bizforms

Austin Harmon asked on June 5, 2019 17:08

Hello,

I am looking to add custom functionality to the bizforms that are created through the forms application. I found this post with an option and I am currently creating a new web part modeled after the native BizForm control. Here is the link:

https://devnet.kentico.com/questions/how-to-customize-submit-action-event-in-kentico-biz-forms

Is this the correct approach. To create another web part and in the viewBiz_OnAfterSave method add custom functionality and if needed custom fields for the form to use?

Thank you,

Austin Harmon

Recent Answers


Brenden Kehren answered on June 5, 2019 17:12

I'd say, it depends on what you want to do. You can create a custom webpart but I'd suggest looking at a global event handler for something more robust and global. The problem with using a custom webpart, is you are typically customizing it for a specific form. Webparts are supposed to be "generic" in a sense that it could be used for any form.

If you use a global event handler, you can specify the form you want to take action on and have all your code in a centralized place. I'm not saying you can't check the specific form on a custom webpart but I'm saying it's more robust to do it in a global event handler.

0 votesVote for this answer Mark as a Correct answer

Austin Harmon answered on June 5, 2019 22:49

The issue I'm running into with using the WebPart is that I need values from the form and since the form doesn't reside in the web part I can't access the fields the user entered.

So are you saying in a global event handler I could call out the form and pass the fields I need to a method that did what I needed it to do?

Or is this not possible to get form data from the form directly and not from the database.

I was going to do it by calling the database but the problem with that is right now I don't have a unique identifier to query with to get back the right results.

Please let me know if this global event handler will be the solution for this.

Thank you.

0 votesVote for this answer Mark as a Correct answer

Austin Harmon answered on June 5, 2019 22:56

After looking into the event handler, I don't think this will work for my purposes because this custom functionality will be different depending on the form.

So for example the goal is to pass a set of data to a external web service. However I need to pass the form data the the person entered. However on the web part I don't have access to the fields of the form. So is there a way to access those fields? Or would that require further customization in the module?

Thank you.

0 votesVote for this answer Mark as a Correct answer

Juraj Ondrus answered on June 6, 2019 09:58

You should have access to the data when modifying the web part. See this sample in the documentation. It is on how to customize the form web part and in the code you can see how to get e.g. to the FirstName column/field - viewBiz.GetDataValue("FirstName") in the same way you can get other fields too.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.