Page Level Script

Posted by Paulh0763 on 09-May-2016 08:23

Good morning,

I could use some help please. I have a lookup field I would like to null out on a page when clicking a workflow action called "Change Branch". I can get that to work using the following code:

document.getElementById("department_level_3").onchange = type1;
function type1(){

The Branch Field will null, however, the page will not let me update it to a new Branch as it wants to maintain the null value. Any thoughts on how I can get this working properly?

Thanks, Paul

All Replies

Posted by Mohammed Siraj on 09-May-2016 08:40

Hi Paul,

From the script shared, it looks like you are resetting the same field i.e. '"department_level_3"' on its onchange event handler.

Can you please confirm.



Posted by Paulh0763 on 09-May-2016 09:25

Well I know the script needs some love. Probably should be onload instead of onchange? What I need it to do is when the workflow action "Change Branch" is performed, I need that field department to be set to null on the status change page...with the ability to set a new value for the department then save it.

Posted by Mohammed Siraj on 09-May-2016 10:11

Please add the following script to Status Change page (Assuming you are on NewUI):


try {

 if (!rbf_isNewUI()) {

   throw 'This Script is written specific to New UI Context';


 rb.newui.util.addEventListener(rb.newui.util.customEvents.rbs_pageRender, function () {

   rbf_setFieldValue("department_level_3",null); //unset this field



catch (err) {

 if (console) {





Posted by Paulh0763 on 09-May-2016 10:15

I am currently on but will be upgrading to 4.0 by end of May. Sorry I should have told you the version.

Posted by Mohammed Siraj on 09-May-2016 10:50

Ok. In that case, please add the following script component to you Status Change page:


$(document).ready(function () {

 rbf_setFieldValue('department_level_3', ''); //unset this field



Note: This is a very generic way of hooking in custom scripts and is not well supported in NewUI pages wherein we have opened up specific API interfaces for the same. Request you to leverage these custom interfaces when upgrading to NewUI.

Also, in NewUI , we have ensured Client-side API, to set,reset, unset fields works well aross all field types.

This thread is closed