Reference Type

radhamanchi
Tera Contributor

In catalog creation, I created one variable "requested for" type "Reference", if I login with Radha Manchi the name should be populate in that variable. How should I do this?

9 REPLIES 9

Bhimashankar H
Mega Sage

Hi @radhamanchi ,

 

Go to that requested for variable and in default tab enter the "javascript:gs.getUserID()", so it will be auto populated logged in user name. Make sure your referred from sys_user table only.

 

As shown in below screenshot.

BhimashankarH_0-1755835752502.png

 

 

Thanks,
Bhimashankar H

 

-------------------------------------------------------------------------------------------------
If my response points you in the right directions, please consider marking it as 'Helpful' & 'Correct'. Thanks!

Thank you so much!!

Hi @radhamanchi ,

 

Thank you for marking as helpful.

 

You can also make reply as "Accept as Solution". This helps in removing this question from unanswered list and helps users to learn from your thread. Future readers with similar kind of question will easily find out. Thanks in advance!

Regards,
Bhimashankar H

pavankenche
Tera Contributor

Hello @radhamanchi 
for this requirement there are many ways to achieve

simply you can use onLoad Catalog client script

1.get the logged in user by -var requester = g_user.getUserID();

and set the value in the requested for variable

g_form.setValue('requested_for',requester) ;

function onLoad() {
var currentUser = g_user.getUserID();
g_form.setValue('requested_for',currentUser) 
}



if this answer helpful please mark as helpful and correct