I have this look up object name Category (Please see image below)

 

 

Now, How can I get the value "Hardware" from "Category" look up object and pass it in the variable?

I tried 

var a = this.get("Category");

but this doesn't work

 

Like 0

Like

8 comments

Dear Fulgen,

If you are at the Category edit page and need to get Hardware field which is a column of Category table or an attribute of the edit page:

var hardware = this.get("Hardware");

Peter Vdovukhin,

Hi Peter,

Good Day

Category is the column, "Hardware" is the selected value from the look up. Now I want to get the ID of "Hardware" from the look up

 

Thanks

Then

 var category = this.get("Category");

should work. Please check that you have a column named "Category". Perhaps it is called "UsrCategory"

Peter Vdovukhin,

I am facing the same issue. I have the right field name, however, when I try to use the value of the lookup, it keep returning [object Object] instead of the caption column value.

I tried the String(variableName) and the JSON.stringify(variableName) approaches and got the same result.

Any thought?

Thanks.

Danilo Lage,

Lookup value is js object with two fields (displayValue and value)

this.get("Category") ==  {value: "410006e1-ca4e-4502-a9ec-e54d922d2c00", displayValue: "Hardware"}

Danilo Lage,

Hi Danilo,

1. To get the look up id -  var category = this.get("Category").value;

2. To get the look up name -  var category = this.get("Category").displayValue;

Fulgen Ninofranco,

this.get("Usrlookupname")returns undefined.

It does not work in a custom function.

It works in init or save function which are part of parent class. But I can not get it work in my custom function

RAMNATH SHARMA,

Can you provide more code in which this.get does not work as expected? 

 

Best regards,

Angela

Show all comments