Create user from within a workflow

Hi in workflow creation we have “User Create” but I do not see anything like “User Maker” like we have in “Compose Record Maker”. So how can we create a new User from the workflow?

You can use an expression step with an empty User variable assignment and then use the User create function to create the user.

Most other resources that don’t have a creator function can be initialized following the same pattern.

See my example here user_create.json · GitHub

1 Like

Got it thanks. Any way to set the password from the workflow?

No(, not at the moment).

An alternative (or a better approach) would be to firstly create the user, and then send them an email message that points them to the password reset page (https://latest.cortezaproject.org/auth/request-password-reset for our latest instance).

I’ll check internally if we wish to (and if its even possible) add this to workflows as well.

1 Like

Thanks.
I tried to run the workflow from my account which is a admin and did not work. I noticed that the workflow works only if the “Create new user” permission is enabled for “everyone”.

Also how can we set a role to the user?

One of us will take a look, sounds like a bug or a miss configuration.

There is a Role membership add function; use that one

Is it in the workflow? Cannot seems to find it.

Oh dear, the version was not yet released 2021.3.11, apologies.
It should be released sometime this week.

I’ll try to remember to update this thread when we do release it, but do keep an eye out in case I forget.

1 Like

Thank @tjerman.

I will keep an eye out. :slight_smile:

Found the Functions on new release. Will try it out. Thanks.

1 Like

I tried running a similar workflow on a fresh Corteza instance and it worked as expected.
You do need to have the permission you’ve mentioned in order to create users.

I would assume that you were either upgrading from an older release that may have had an issue with default permissions or there was a lapsus when tweaking permission settings.

I will mark this as resolved unless someone else expresses a similar issue.

@tjerman any update here if we can set the password from the automation?

No, this is not possible as of now.

Can I ask for your use case? Are you making login credentials for your clients?

I would suggest you try to use the solution suggested above – after you create the user you send an email with the link to the password reset page.

1 Like