Values of domains using hitTest

09-15-2021 07:37 AM
Occasional Contributor III

Hello there,


I aim using hitTest to get values of features that i have on my map and show them in my HTML  table i do it so: 

graphic.attributes.qselis_kategoria; After this i try to add name, values, alias but nothing works. How can i get values of domains? Help
0 Kudos
1 Reply
Frequent Contributor

There are few a steps to something like this.

The layer has a fields property

Looking at the field, it has a domain property

Domain could be range or codedValue type

CodedValue has a method called getName that I think will do what you are looking for.

Which could end up looking like this.

const field = layer.fields.find((field) => === FIELD_NAME);
const domain = field.domain;
const domainValue = field.getName(attributes[FIELD_NAME]);


I think, I haven't had to do something like this in a while, but that should get you on the right track.

0 Kudos