Can I use dot walking in a UI Action condition?

David165
Mega Expert

Hi All

I've a use case where I want a user to be able to perform a UI Action on a record if that user created the parent of that record.

In my UI Action condition I have the code:

current.u_parent_statement.sys_created_by == gs.getUserName();

Which isn't working - the UI action is available whoever the user is. (u_parent_statement is a Reference to the parent record);

This code:

current.sys_created_by == gs.getUserName();

does work, but doesn't satisfy the use case.

I'm assuming that the dot walk isn't working. Do I need to create a script include function to call from the condition instead?

Regards

David

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

Hi David,

yes dot walking will work here; is u_parent_statement a reference field then it should work; don't add semicolon at the end and try once

current.u_parent_statement.sys_created_by == gs.getUserName()

Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

View solution in original post

6 REPLIES 6

siva_
Giga Guru

No dot walking definetely works here, just that you might be using it wrong 

Can you log the same and check if the values are coming as expected 

Thanks,

Siva

 

 

Ankur Bawiskar
Tera Patron
Tera Patron

Hi David,

yes dot walking will work here; is u_parent_statement a reference field then it should work; don't add semicolon at the end and try once

current.u_parent_statement.sys_created_by == gs.getUserName()

Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Not working

Are you using correct field name u_parent_statement

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader