Dot notation to access properties on several levels

Hi!

I am unable to access properties beyond the first level. In the screenshot provided, I can successfully log the maintenance object itself, but when I attempt to log maintenance.description , it results in undefined . Please note the all the maintenance objects has a description.


Screenshot 2023-12-21 at 12.46.25

Hi Sinan,

Thank you for submitting a question to our Community.

When defining ‘maintenance’, you are defining a reference to the maintenance field. This returns an ID, as you’ve seen, but you are not able to access the properties of a reference.

Instead, you could try directly referring to the description field by defining maintenance as let maintenance = workorderInContext.maintenance.description on the first line, and then returning this value.

Another option could be to have a Runtime Property on the workOrder object, which fetches the description. You could then return this value straight away in this function, as it would be calculated for each object already.

Rhys

Thank you for your reply, @rhys :slight_smile: However, I have tried this before, and it still returned undefined. Please see the attached screenshots.

I am trying to avoid using a runtime property, because it should be easier to just do it directly in the function.


Hi,

Maybe you could double check that the node name is “description”, as maybe this could throw undefined if the node name is something else.

Have you checked in the client Dev Tools that the maintenance objects have a description stored as expected?

You can also try taking in the description directly as a function parameter by clicking through the menu on the left hand side, to refer to the description directly.

Rhys