Project WorkSpace redirection.

prash4
Tera Expert

If a user (non admin) attempts to open a project, resource assignment, or resource plan in the backend view they need to auto take to the project workspace.

 

How do i achieve it? client script or Display BR? 

2 REPLIES 2

Fabian Kunzke
Mega Sage

Hello,

I'd do it with an onLoad client script, something like this: https://www.servicenow.com/community/itsm-forum/can-we-redirect-using-client-script/m-p/385003

 

That way you can make sure it does not trigger in the workspace - which a Business Rule would do. Also, its good practice to make sure UI interactions happen on the client side, so the amount of potential chaos throughout the interaction is reduced.

 

Regards
Fabian

Ankur Bawiskar
Tera Patron

@prash4 

you will require onLoad client script on project table and take them to that particular project in Project workspace if they are on native

something like this, you can enhance it to check role !g_user.hasRole('admin')

function onLoad() {
    //Type appropriate comment here, and begin script below
    if (top.location.href.indexOf('/pm_project.do') > -1 && !g_user.hasRole('admin')) {
        var sysId = g_form.getUniqueValue();
        var url = '/now/workspace/project/home/sub/planning/pm_project/' + sysId + '/1770889580736/params/page-name/planning';
        top.location.href = url;
    }

}

AnkurBawiskar_1-1770889928646.png

 

Output: enhance similarly for other table

project workspace redirection.gif

I believe I shared a working approach

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader