gs.getUser() dotwalking in catalog item variable

Sascha1
Mega Contributor

Hello Everyone!

I am trying to use dotwalking to set default values for several catalog variables. Somehow it sometimes works the way I do it and sometimes it does not.

find_real_file.png

This way it worked for the Requester and the email address. The other values are still empty (although they are not empty in sys_user table)

In some cases (with some users) I get at least a sys_id in the location field. So I changed the variable type

find_real_file.png

the result is more or less the same with the difference that I get a valid location for some users now.

The following screenshot shows the form from the view of 2 different users (both have all fields filled in sys_user table). You can see that sometimes at least some fields are filled, but still not all of them.

find_real_file.png

 

I hope someone can show me what I am missing.

btw I tried to user gs.getUser().getLocation() (didnt work out) and gs.getUser().getRecord().getValue(‘phone’); (didnt work out either)

 

BR
Sascha

1 ACCEPTED SOLUTION

Sri Harsha3
Tera Expert

You mean for some users the gs.getUser().getRecord().getValue('department'); is working for few it is not. Have you checked the permissions of the fields?

View solution in original post

6 REPLIES 6

Ajaykumar1
Tera Guru

Hi Sascha,

Use methods given in below link.

User Object Cheat Sheet

Mark If Correct/Helpful.

Regards,
Ajay

dvp
Mega Sage
Mega Sage

I don't see any thing wrong the below scripts. Are the values exist for location and phone field on sys_user table?

gs.getUser().getLocation() (didnt work out) and 

gs.getUser().getRecord().getValue(‘phone’);

well i can see the syntax not given correctly.

 

For example

gs.getUser().getEmail() instead of gs.getUser().email

Jagadeesh R1
Tera Expert

Hello,

   I would suggest to use a client script which doesn't involve gs in the catalog item form. Please remove the default values in the variables try to use below code and check once . Try to create onChange clinet script on Requester

          g_form.getReference('requester', function(gr) {
              
              g_form.setValue('email', gr.email);

              g_form.setValue('company',gr.company);
             }
          });

 If this is also not returning the desired output, using GlideAjax and call back function will be the right option

 

Regards,

Jagadeesh