1

TLDR; Is there a way to directly redirect to a module while running the serverside code? Taking into account the modules filter settings etc.

Hello, quite new to SN so sorry for the newbi question :)

Basically I need to redirect the user to a different module after running some serverside code. The module have some filter setting set in "Link type". Guess I could copy these and hard code them into the redirect via action.setRedirectURL(), but that wouldn't update should the modules filter change.

Help would be much appreciated, thank you :)

Sulec
  • 23
  • 7

1 Answers1

1

I've done something similar so that records could be opened in a new window. This UI action will open a knowledge article in kb portal.

function openRecordInKBPortal() {
    var url = 'kb?id=kb_article&sys_id=' + g_form.getUniqueValue();
    g_navigation.openPopup(url);
}
  • I thought about using the sys_id in the redirect, but I've been unable to get it to work so far. The module is referenced in the url under "sysparm_userpref_module", which afaik uses the modules sys_id. Unfortunately just adding this to the redirect doesn't seem to do much. Example of a modules url looks like this: https://< my instance id >.service-now.com/nav_to.do?uri=%2Fu_my_movies_list.do%3Fsysparm_userpref_module%3D218a20312fb130108f2f55f62799b662%26sysparm_query%3Du_ratingSTARTSWITHgood%255EEQ%26sysparm_clear_stack%3Dtrue – Sulec Aug 07 '21 at 18:38
  • If the redirect actually send the user through to the module, you would assume all the search parameters within it would be re-applied (should they be missing), but something like https://< my instance id >.service-now.com/nav_to.do?uri=%2Fu_my_movies_list.do%3Fsysparm_userpref_module%3D218a20312fb130108f2f55f62799b662 doesnt work. – Sulec Aug 07 '21 at 18:47