Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
sasmita swain
fetching from expandovalue table
June 28, 2013 12:24 AM
Answer

sasmita swain

Rank: Regular Member

Posts: 185

Join Date: February 24, 2012

Recent Posts

Hi
I have used custom attribute in my create account.jsp.i want to fetch from expando value table.

my code is:

long classpk=Long.parselong(renderRequest.getParameter("classpk"));
ExpandoValue value=ExpandoValueLocalServiceUtil.getValue(10005, "CUSTOM_FIELDS", "Mobile no", classpk);%>

here i am not getting values.how can i solve this problem

Thanks
Sasmita
Tanaji Londhe
RE: fetching from expandovalue table
June 28, 2013 12:52 AM
Answer

Tanaji Londhe

Rank: Regular Member

Posts: 196

Join Date: April 25, 2012

Recent Posts

Can u plz check all parameter are getting correct or not.
getValue(long classNameId, String tableName, String columnName, long classPK)
try to print expandovalue and check what u get.
sasmita swain
RE: fetching from expandovalue table
June 28, 2013 2:07 AM
Answer

sasmita swain

Rank: Regular Member

Posts: 185

Join Date: February 24, 2012

Recent Posts

Tanaji M. Londhe:
Can u plz check all parameter are getting correct or not.
getValue(long classNameId, String tableName, String columnName, long classPK)
try to print expandovalue and check what u get.


Thanks for your reply.if i am giving classpk as 13902,then it is giving data.if i am giving as classpk as dynamically then it is showing null pointer exception
Tanaji Londhe
RE: fetching from expandovalue table
June 28, 2013 3:36 AM
Answer

Tanaji Londhe

Rank: Regular Member

Posts: 196

Join Date: April 25, 2012

Recent Posts

long classpk=Long.parselong(renderRequest.getParameter("classpk"));

You are getting null value because classPK is zero.
Check classPK value.
David H Nebinger
RE: fetching from expandovalue table
June 28, 2013 5:04 AM
Answer

David H Nebinger

Community Moderator

Rank: Liferay Legend

Posts: 11295

Join Date: September 1, 2006

Recent Posts

sasmita swain:
my code is:

long classpk=Long.parselong(renderRequest.getParameter("classpk"));
ExpandoValue value=ExpandoValueLocalServiceUtil.getValue(10005, "CUSTOM_FIELDS", "Mobile no", classpk);%>


Your code is simply wrong.

Since you're doing it during the create account page, that should mean that you're binding it to the User object. You can therefore use the ExpandoBridge in the appropriate way:

1User currentUser = ...;
2
3String mobileNo = (String) currentUser.getExpandoBridge().getAttribute("Mobile no");