Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Is there a way to add a webhook URL to a form through the IFormsRepository interface or something similar?

Vote:
 

I can see how to pull data, but not how to update the form. Are there any methods to do that in Episerver 11?

#299838
Apr 10, 2023 15:52
Vote:
 

A form is just a special kind of block. You can load the form (an instance of FormContainerBlock; from some sort of reference), update the SendEmailAfterSubmissionActor or CallWebhookAfterSubmissionActor properties and save the changes.

But these properties do not exist as typed properties on the FormContainerBlock. Instead, You need to set them in the form property bag. Something like this:

var writableForm = (FormContainerBlock)myForm.CreateWritableClone();
// TODO: If there are already web hook configurations on the form, add your new model to the existing one.
writableForm.Property["CallWebhookAfterSubmissionActor"] = new[]{ new WebhookActorModel() };
// TODO: Save the form.
#299845
Apr 10, 2023 19:59
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.