Close Code and Close notes mandatory for Change Request in 'Canceled' state

anubhavr
Giga Expert

As 'Cancel Change' is a UI Actions and it is not Client so we cannot use g_form.setMandatory function in UI Action. I tried to do it using Script include with 'Client Callable' but still I guess I can't use Glide Form functions in Script Include. I Tried with UI Policies also but not working. Can anyone suggest me solution for this??

11 REPLIES 11

Hi,



Yes I was also having same Issues.



Add 2 more lines in the script.



1. To set value of state to 'Cancelled' using g_form.setValue function in the first line of function.



2. Add g_form.save() else it will not save your records if u click 'cancel change' again instead it will reload the form. Add this function after setting all the values and making it mandatory or read only. Before 'return false;' statement.


Community Alums
Not applicable

Hi ,,


I am using same code but its not working..



Could you help me



Code..



function cancelChange(){


  var wn = g_form.getValue('work_notes');


  if (wn == ''){


  g_tabs2Sections.setActive(3);


  g_form.flash('work_notes','red',1);


  g_form.clearMessages('work_notes');


  g_form.showFieldMsg('work_notes','Work Notes are Mandatory when Cancelling a Change','error');


  g_form.setMandatory('work_notes', true);


  return false;


  }


  gsftSubmit(null, g_form.getFormElement(), 'cancel_change'); //MUST call the 'Action name' set in this UI Action



}


  //Ensure call to server-side function with no browser errors


  if (typeof window == 'undefined')


  moveToCancel();





function moveToCancel(){


  action.setRedirectURL(current);



  if (new ChangeRequestStateHandler(current).moveTo("canceled"))


  current.update();


}



Function   : cancelChange()



Note : Which table to select task or change request



Thanks


Roopa


Hi Roopa,



What is Your requirement Exactly?   And what error or issue are you getting??


Community Alums
Not applicable

Hi Anubhav,



I got it resolved ...



I was trying for new UI action,



I added some of lines in the Cancel Change UI action which is OOB..Then its working fine.



Thanks,


Roopa


Hi Roopa,



That is Good.