Datatype not set error for input parameter CheckAdminRole()?
Application Type
Traditional Web
Service Studio Version
11.10.22 (Build 42083)

In my core module I created an additional Role (Admin).  
When I use this function in a consumer module I am getting errors for each of the role actions that the datatype for the UserId parameter is not set.


Any idea how I can solve this? It worked for the past 2 days without any issues, no idea to what this is related.


It is solved. No idea why it has worked. I checked out the documentation and old forumpost related to roles...

So, you should check this in a serveraction.

What I did:

  • in my core module create admin role , this role is not public.
  • create a serverAction called "checkIfuserIsAdmin"  where I use the CheckAdminRole.
  • publish my core module
  • update dependencies in my other module to have acces to checkIfUserIsAdmin function.
  • in my if widget on the screen update the condtion where the condition now just is CheckIfUserIsAdmin

    tested and is working.

    Question: if the automaticcaly generated actions when creating a role can only be used in serveractions, why do I see them in a screenaction?

    Geert

Did you deleted or removed the entity Users of the system? if not, add the User identifier to the data type

Regards,

Márcio

Hi Marcio,

The user entity of the system was not deleted. I am unable to type in the field for the user Identifier, as in the screenshot where the datatype field has a red border.

To give some more detail what worked and stopped working:

Module tvshows_core which has all my dbtables , also in that module I created the role "Admin". As you see in the first screenshot the type for the userId inputparameter is set as "User Identifier".

Module tvshows has a dependency for tvshows_core. In one of my screens I have a table with a delete button for each record. That button is wrapped in an if-statement with condition CheckAdminRole(Userid: )

This worked, I tested it with a user without and with the AdminRole, the buttons were only rendered when having that role.

The first screenshot is the logic tab of my tvshows_core module, where the datatype is set.
The second one is the logic tab of my tvshows module where I get the error, but typing in that field is not possible.

I still don't get this.

Geert

Hello Geert

The challenge could be of name as well? you are using Admin that could be a conflicting name... Can you try with another name once please! 

It is solved. No idea why it has worked. I checked out the documentation and old forumpost related to roles...

So, you should check this in a serveraction.

What I did:

  • in my core module create admin role , this role is not public.
  • create a serverAction called "checkIfuserIsAdmin"  where I use the CheckAdminRole.
  • publish my core module
  • update dependencies in my other module to have acces to checkIfUserIsAdmin function.
  • in my if widget on the screen update the condtion where the condition now just is CheckIfUserIsAdmin

    tested and is working.

    Question: if the automaticcaly generated actions when creating a role can only be used in serveractions, why do I see them in a screenaction?

    Geert
Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.