Question

Get the value of look up object

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

6 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;

Log in or register to comment