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

Jaspal Singh
Mega Patron
Mega Patron

Hi David,

 

Considering u_parent_statement is a reference field can you try something as below.

 

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

 

Thanks,

Jaspal Singh

 

Hit Helpful or Correct on the impact of response.

Not working