Page 1 of 1

Programmatically Forms and Menus

PostPosted: Wed Jul 21, 2021 2:20 pm
by SBarnes
How can you programmatically check for the presence of a menu item and for a form and added them if they are not present?

What i am trying to do is simplify/automate the deployment of a plugin.

Re: Programmatically Forms and Menus  Topic is solved

PostPosted: Tue Jul 27, 2021 5:59 pm
by Mike.Sheen
SBarnes wrote:How can you programmatically check for the presence of a menu item and for a form and added them if they are not present?

What i am trying to do is simplify/automate the deployment of a plugin.


For a form, you can use the Manager.Forms collection - which is a list maintenance of the Form type - so you can look for the form in there, if not present add what you want and then Save it - and then invoke the Read method so the Manager has it's collection refreshed.

For menus - use the menu business logic - that's a normal maintenance business logic - so you will need to read one for a given RecID and then you can look for the menu item you want and add it if not present and save it.