Register abillity for users on login splash screen for mobile app

Hi, I'm new to Outsystems. I followed the web + mobile developer guided paths. I am almost finishing a mobile app to present to a company and be an Outsystems advocate :-). Im working with the free outsystems service studio 11. 

WISH: I'd like users of this company to register themselves on the login splash screen that came pre-installed when using the blank mobile template.

ISSUE: I cannot get the GrantUserManagerRole Action onto the Action canvas.

WHAT I'VE DONE AND TRIED: 

1. Created DB Entity in Data Tab.

2. Created 3 attributes to Entity of step 1; Name (text), E-mail (e-mail), Password (text)

3. Created form on Login Screen and added the 3 attributes of step 2 to it.

4. Created Action for Save button.

5. In Action flow used the following shapes:

5.1 Start

5.2 Server Action: User_Create (took from Users reference in Logic tab)

5.3 EcryptPassword: (took from Users reference in Logic tab)

5.3.1 Username property = email attribute from step 2.

5.3.2 Password property = password attribute from step 2.

5.4. Destination: current screen


I just cannot drag the GrantUserManagerRole as a Action to put it after step 5.3. 


Any tips how I can accomplish this?



Hello,

Where are you attempting to drag the Grant action to? Are you working in the context of a server action or a client action? Can you show us a screenshot of your logic?

Hi,

You can't drag GrantUserManagerRole. But you can open it and inside you have a GrantUserManagerRoleGrant action and that one you can drag and use.

Regards,

Marcelo

Afonso Carvalho wrote:

Hello,

Where are you attempting to drag the Grant action to? Are you working in the context of a server action or a client action? Can you show us a screenshot of your logic?


Hi Afonso, Im dragging if from the Logic Tab as I can see it only there. Attatched a screenshot. Thank you.


Marcelo Ferreira wrote:

Hi,

You can't drag GrantUserManagerRole. But you can open it and inside you have a GrantUserManagerRoleGrant action and that one you can drag and use.

Regards,

Marcelo


Hi Marcelo, when i expand it, there is just an input variable available. 

See my screenshot. Thank you.

I don't think you can drag a Grant action into a mobile action. You'll have to create a server action, do your Grant logic there, and then use your server action in that mobile action.

In a mobile action, you can't use those actions:

But you can place them in a server action, and then use that server action:

Afonso Carvalho wrote:

I don't think you can drag a Grant action into a mobile action. You'll have to create a server action, do your Grant logic there, and then use your server action in that mobile action.

In a mobile action, you can't use those actions:

But you can place them in a server action, and then use that server action:

You solved it. I am going to try this now:

1. Drag a "Run Server Action" in my existing flow.

2. When popup appears click "New Server Action"

3. In this new flow drag the "GrantUserManagerRole" action from Logic tab.


I get the error: "UserManager role is required to create users". 

Happens after I click "Save" on my "register" form. The "Save" button kicks of an action (screenshot-3a). And that action kicks off the GrantUserManagerRole action (screenshot 3-b).

I am using the correct action to create users?


That error is being triggered by the User_Create action. It's an action used in the context of the Users application, and it's not completely suited for your use case, since it checks your role:

Whenever you are in doubt of what happens inside an action you are referencing, you can right click on it and press "Open in..." to see the code.

To overcome this you can try writing your own User_Create function, that doesn't check this role (the first If condition in the screenshot).

I am still confused on how to build a simple register account page.

DOUBT: So, I got the login credentials of my app that i am building after signing up with outsystems.com. Then I went to downloads and downloaded the Service Studio. So this account would be the UserManager account? 

Then, how do I let other users create account on the app?

WHAT I'VE TRIED 5MIN AGO:

1. Added "Form" shape to login splash screen.

2. Added "User" entity from "Data" tab: Entities>Database>System.

3. All Attributes get imported into "Form" from step 1 except the password attribute.

4. I kept the "Name" and "Username" attribute in the form and deleted the rest.

5. Connected an "Action" to the "Save" button.

6. In "Action" flow from step 5 added:

6.1 Added Start shape

6.2 Added CreateUser entity shape from "Data" from Entities>Database>System>User


When I "view the data" of the "User" entity from "Data" tab: Entities>Database>System I can see the newly created user I tested registered with "Name" and "Username".

MY QUESTION: How to get the "Password" attribute in the "Form" from Step 1?


Ok, I figured it out now after playing a bit. I will write a tutorial in this thread shortly. So far, my Action flow that runs the registration process:

Glad you got it sorted out. Let us know if there's something that's still giving you problems.