Changing form view while creating a new record

manugupta
ServiceNow Employee
ServiceNow Employee

I want to change view when inserting a new record based on some field which is pre populated.

For example, I have created a new module to insert a new record in a table(incident). Also i am pre-populating category when i am creating record via this module. Now i want a different view when i create record with this module.

I have created a view rule where i have added condition (when category ='pre-populated category value'). This is working only when i am saving the record. I want the form to be loaded with this new view when category matches.

Can anyone please help me on this. Let me know if you need any other details.

TIA

7 REPLIES 7

is your view rule still active? Since for new records your condition does not match "(when category ='pre-populated category value') " your view rule may be getting in the way.

Otherwise remove view from the view name field and try putting the view config in the arguments like:

&sysparm_view=yourview&sysparm_view_forced=true

 

Is this working?

Dnyanesh
Kilo Contributor

The view cannot be changed for unsaved records. To test a view with a new record, you must first populate all mandatory record fields and save the record. It is faster to test views using an existing record.

Regards,
Dnyanesh

Actually, it can.
As mentioned above. Go to System UI -> Views and check the name of the View.
I created a new view and named it "New Model". I tried to use that when creating a new record but that didnt work. And its becuase the real name was "New_Model". So just make sure you use the correct name.