Forcing a custom view on a form on Service Portal

ads4
Kilo Guru

Hello, 

I need to force a custom view on an incident form present on service portal. What are the best options of achieving this?

If possible, pls provide solution with an example. Thanks

4 REPLIES 4

Anil Lande
Kilo Patron

Hi,

You need to pass view name in the URL as a parameter when you are opening any record using form page.

Also check below link:

https://community.servicenow.com/community?id=community_question&sys_id=ad386c3ddb840914904fa9fb1396...

https://community.servicenow.com/community?id=community_blog&sys_id=003d2ae5dbd0dbc01dcaf3231f961932

 

Thanks,

Anil Lande

Please appreciate the efforts of community contributors by marking appropriate response as correct answer and helpful, this may help other community users to follow correct solution in future.
Thanks
Anil Lande

Hey Anil, 

Thanks for replying. 

I'm using this data table from instance definition widget to show the list of records, and basically when i click a record a form opens on which i have forced a custom view as i did not want the 'sp' view. 

So in order to force a custom view, i made changes in the server script of data table from instance def widget. 

Just replaced view: "custom view name" under widget parameters mentioned in the script. 

So, i want to know if there's any downside of using this approach in case you're aware

find_real_file.png

Hi,

As you have customized OOB widget and added view as per your requirement there is no issue as long as no one is using this widget.

In future if anyone decide to use custom data table widget then they will be farced to use your hardcoded view.

 

Thanks,
Anil Lande

Please appreciate the efforts of community contributors by marking appropriate response as correct answer and helpful, this may help other community users to follow correct solution in future.
Thanks
Anil Lande

Instead of hardcoding you can make it dynamic by using Options schema.

Please check below documentation.

https://docs.servicenow.com/bundle/rome-servicenow-platform/page/build/service-portal/concept/c_Widg...

 

If you add options schema then you can specify view in options when you add it in multiple places.

 view: options.view_name,

 

Thanks,

Anil Lande

Please appreciate the efforts of community contributors by marking appropriate response as correct answer and helpful, this may help other community users to follow correct solution in future.
Thanks
Anil Lande