RP Not working in UI Action

German Alvarez2
Tera Expert

Given the UI Action: "Save Proposed Changes" https://instance.service-now.com/nav_to.do?uri=sys_ui_action.do?sys_id=7ff1db77a9fe3dba00f4b327dc2cc... It doesn't work, giving in the logs the next error:

org.mozilla.javascript.EcmaError: "RP" is not defined.

Caused by error in sys_ui_action.7ff1db77a9fe3dba00f4b327dc2cc731.script at line 1

==> 1: (function(current, action, RP) {

2: var taskciId = RP.getParameterValue("sysparm_changeset");

3: var base = new SNC.CMDBUtil();

4: base.baselineProposedChangesGenDIFF(current, taskciId);

Given this, and checked that RP is not available in any Scope during the execution of the UI Action Script (but available in the condition evaluation!) I moved to get "sysparm_changeset" in other way, by using the approach from this ticket:

"RP" is not defined on sys_user_has_role list control

So, the code now looks like:

(function(current, action) {

    //var taskciId = RP.getParameterValue("sysparm_changeset");

    var map = gs.action.getGlideURI().getMap();

    var taskciId = map.get('sysparm_changeset').toString();

    var base = new SNC.CMDBUtil();

    base.baselineProposedChangesGenDIFF(current, taskciId);

    var taskci = new GlideRecord("task_ci");

    if (taskci.get(taskciId)) {

          taskci.manual_proposed_change = true;

          taskci.update();

    }

    action.setRedirectURL("chg_close_proposed_change_popup.do");

})(current, action);

Working fine.

I hope it would help others on upgrading to Jakarta or any other version.

2 REPLIES 2

Gowrisankar Sat
Tera Guru

Hi German,



Probably you should blog this or mark this discussion as answered, so that people won't get confused with the solved/unsolved discussions.



Anyways thanks for the code which should help someone who come here for help.


I tried, but I couldn't, or I don't know how :s