How to retrieve the logged in userID in a gadget

Hello,

We have designed one gadget under business console to capture some business data from end users. When they finish and submit the gadget, it actually triggrer a business process and this process has several user task screens. In the user task screen, we want to display the applicant userId as one of the field along with other business data fields. How can we capture the logged in userid from a business console gadget?. Is there any script by which we can achieve this? Or shold we call any other public service for this ?

Any help would be much appreciated.

Regards,
Anish

you can use the getCurrentUser() API available in the SharedService.

e.g.
You can try including this code snippet you can include it in your gadget controller.js,

this.$scope.sharedService = SharedService;
var userName=this.$scope.sharedService.getCurrentUser();

note: pass SharedService as param to the init function of gadget controller.

1 Like

Dear Yashwanth,

Thanks a lot, It worked :slight_smile:

Regards,
Anish