View Rules do not apply to new records

tahnalos
Kilo Sage

I have a form that is accessed through two different entry points.  Depending on the entry point, a different view will be used.

I created a View Rule that checks to see if the parent that the form is initiated from is of a certain type.  If it is, I expect to use View A.  If not, I expect to use View B.  View A is default, so I created the view rule for View B.

If I attempt to create a new entry of the form with type that is supposed to use View B, I should see view B, but I'm seeing view A.

Can someone clarify where I may have gone wrong here?

Thanks

13 REPLIES 13

Brad Tilton
ServiceNow Employee
ServiceNow Employee

Could you share a screenshot or describe the conditions you've used to determine what the entry point is from the view rule?

Ravish Rawat
ServiceNow Employee
ServiceNow Employee

Please let us know what script or condition you have written in those view rules

tahnalos
Kilo Sage

The condition of the view is as follows:

<parent reference field>.<another reference field>.type = <value>

Someone has suggested that the view rule will not work with dot walking.  Can someone clarify?

Brad Tilton
ServiceNow Employee
ServiceNow Employee

That dotwalking won't work on a new record. The reason is that dot walking uses the relationship between the current record and the referenced record, and I think when the view rule runs when the new record is loaded that relationship doesn't exist yet.

Instead of using a view rule I would consider just passing the view as a url parameter when you redirect the user to the new record screen. Just add &sysparm_view=viewnameA to the end of the url.