View Rule Not Applied To New Records

Vasil Vasilev
Mega Guru

Hello, 

 

I have issues with custom View Rules. What I want to achieve is to apply a custom view for Emergency Changes - both existing records and when creating new records. 

 

First, I tried with one view rule (see the screenshot), but no luck - the rules was applied either always (when Match conditions = Any) or never (when Match conditions = All).

 

I also tried to create two separate view rules: 

-> One with condition: Model is Emergency 

-> Second one with condition : Model is Emergency  & Created is Empty.

 

The result is: works for existing records, does NOT work for new records.

 

Any help is appreciated.

 

Thanks

1 ACCEPTED SOLUTION

Vasil Vasilev
Mega Guru

 At the end, I ended up scripting an advanced view rule for the new records and a standard one with condition: 

"Model is Emergency" for the existing records.

View solution in original post

11 REPLIES 11

kaushal_snow
Giga Sage

@Vasil Vasilev ,

 

view rules do not apply to a new, unsaved record.......because the evaluation engine treats all fields as empty for a new record and won’t run the view rule until the record is saved......so your rule for emergency will work on existing change records.....but won’t trigger on the new form since emergency isn’t yet stored and the system doesn’t evaluate the condition until after the first save.......

 

If you found my response helpful, please mark it as ‘Accept as Solution’ and ‘Helpful’. This helps other community members find the right answer more easily and supports the community.

 

Thanks and Regards,
Kaushal Kumar Jha - ServiceNow Technical Consultant/Developer

@kaushal_snow 

I am not sure that's exactly true because if I create a view rule as on the screenshot, I see that when I create a new emergency CR, the view is applied.

Utpal Dutta
Tera Guru

HI @Vasil Vasilev ,

Have you tried navigation handler? Please check this URL & try.

 

Let me know if you need more help.

 

If my answer helped then please mark it helpful & accept this solution.

 

Thanks,

Utpal

Hi @Utpal Dutta ,

 

Thanks for that suggestion, it's really useful, I didn't know about the navigation handlers.

 

However, I was hoping to avoid scripting, but in this case I couldn't. So I ended up scripting an advanced view rule.

 

Cheers,

Vasil