Add a portal user form within an app.

Add a portal user form within an app.

Hi,
Is it possible to add a portal user via a button from within an app? I tried some code from ChatGPT, but unsurprisingly it didn't work. I want to this as a time-saving measure, i.e. one customer can have a different role and be able to allocate users.