Interested in a ServiceNow event built for developers? Registration for now[dev]26 is officially open!

Custom view in lead table overrides lead conversion view and the lead interceptor view in workspace

Kanniga_KP
Tera Contributor

We have configured a custom view for the Lead form in the SoW and have created a workspace view rule to override the default workspace view with the custom one based on the logged in user's role. The Experience restricted flag is enabled and the below script is configured.

(function overrideView(view) {
    if (gs.hasRole('customrole') && !gs.hasRole('admin')) {
        return 'customview';
    }
    return '';
})(view);

But this view rule is overriding the view in the new lead interceptor modal and the convert lead wizard as well. Each of these have their own default views already as OOTB feature.
We have also attempted to enforce the views based on the component invoking the view by checking the URL as well.
   (function overrideView(view, is_list) {
    var uri = gs.action.getGlideURI();
    if (uri) {
        var map = uri.getMap();
        var isModal = map.get('sysparm_view_forced') == 'true' || map.get('sysparm_renderer') == 'modal';
        var isWizard = gs.action.getGlideURI().toString().indexOf('wizard_view.do') > -1; // If it's a popup or a wizard interceptor, bypass this view rule
        if (isModal) {
            return 'lead_conversion_view';
        } else if (isWizard) {
            return 'interceptorview';
        } else if(gs.hasRole('customrole') && !gs.hasRole('admin')){
            return 'customview';
        } else
        {
            return '';
        }
    }})(view, is_list);
 
This retrieves the correct view for the interceptor and the conversion views but the custom view doesn't apply for the lead form of existing records.
Any help to resolve this would be much appreciated.
@chucktomasi_biz #SoW #ConfigurableWorkspace
0 REPLIES 0