Is it possible to create a job to add a custom field to all existing forms?

Vote:
 

I'm working on creating a custom field. This field will need to be added to all existing forms and there's hundreds of them. I wanted to create a job that added the field if it didn't exist. Is it possible to add a field programmatically to an existing form like this? I was having trouble finding examples.

#303569
Jun 15, 2023 15:05
Vote:
 

Hi,

In theory yes, though I haven't done this myself.

I would look into the interface 'IFormRepository' along with the 'IContentRepository'.

The first should be able to get you the forms the second should be able to get the form and it's content / elements.

Then you should be able to add a new element to the form or so I imagine.

There is code here which should help https://www.aperturelabs.biz/blog/creating-episerver-forms-via-the-api/.

Paul

#303571
Jun 15, 2023 17:42
* 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.