32
Views
4
Comments
Solved
GetUserId() inside service

the GetUserId() is not record the correct user ID right !!  shall i pass the user ID from the UI or is it corerct to use the GetUserId() inside the service and it will return the current logged in user no matter if you used it inside service or inside the end user applications ! 


Solution

Hi,

Yes you can use GetUserId() in a service action.

When making a remote call to a Service Action, OutSystems passes the following information from the client session:

  • UserId and TenantId, which enables the usage of built-in functions such as GetUserId() and CheckRole() within the implementation of the Service ActionL

  • Locale, which enables the usage the built-in function GetCurrentLocale() within the implementation of the Service Action.R

  • Request Key, which enables the correlation of all logs in Service Center from the same top level request.

See https://success.outsystems.com/documentation/11/developing_an_application/reuse_and_refactor/use_services_to_expose_functionality/

Regards,

Daniel 

Thanks your excellency 

Hello,

If somehow GetUserId() is not getting the correct user ID inside service module, make it a parameter and pass it from the end user module.

I have seen some instances where we have to pass it from UI module, from UI you can pass GetUserId() to the parameter.

Regards 

Anees

Solution

Hi,

Yes you can use GetUserId() in a service action.

When making a remote call to a Service Action, OutSystems passes the following information from the client session:

  • UserId and TenantId, which enables the usage of built-in functions such as GetUserId() and CheckRole() within the implementation of the Service ActionL

  • Locale, which enables the usage the built-in function GetCurrentLocale() within the implementation of the Service Action.R

  • Request Key, which enables the correlation of all logs in Service Center from the same top level request.

See https://success.outsystems.com/documentation/11/developing_an_application/reuse_and_refactor/use_services_to_expose_functionality/

Regards,

Daniel 

Thanks your excellency 

Champion

Hi @Omar AbdElhadi 

You can use GetUserId() inside the service action but if it not works then pass from UI.

Best

Arun

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