cancel
Showing results for 
Search instead for 
Did you mean: 

How to get User Menus using the NetWeaver UI Services?

Former Member
0 Kudos

Hi

I am trying to get the User Menus using NetWeaver UI Services, however it doesnot return the correct entries. The services are activated in SICF, I can get the User Details but not able to get the Menus

Here is the code,

              var user = sap.ui2.shell.getUser();

              user.load(

                       {

//                       depthAtRoot: 1,

//                       nodeId: " ",

//                       depthAtNode: 1

                       },

                       function() {                            

                             //set user data in the json model

                 Alert(user.getFullName());

        //Get the Menus

                            var menus = user.getMenu().getEntries();

                            var length = menus.length;

               alert("length::"+length); //Length returned is Zero

 

             }, 

                       function(sErrorMessage) {

                             /* failure handler: e.g. display load error */             

               alert(sErrorMessage);

             } 

             );

            

            

What could be wrong here?

Regards

Accepted Solutions (0)

Answers (1)

Answers (1)

jmoors
Active Contributor
0 Kudos

Have you checked the backend configuration, i.e. have you created/assigned a role to the user?

If you used Chrome devtools what do you see in the response?

Jason

Former Member
0 Kudos

Jason

Thank you for your reply.

in the Devtools, if I click on the Start up file - here is I see

{"client":"400","dateFormat":"1","email":"","firstName":"Test","fullName":"Test_GW","id":"Test_GW","language":"EN","languageBcp47":"en","lastName":"Test ID -","menu":null,"numberFormat":"","rtl":false,"system":"BB2","theme":"","timeFormat":"0","timeZone":"UTC","welcomeMessage":"","isJamActive":false,"initialTarget":[]}

Is this the correct response I am looking at? Looks like Menu field is null.

In the backend, the User does have a role assigned..And if I open up the role in PFCG - I can see 3 items under menu.

Is this the correct way to assign the links?

Thank you

Former Member
0 Kudos

Any help here?

What could be wrong? The user is assigned a PFCG role which has few links.

How do get the role menu info?

Thank you