UI Action doesn't perform OnClick and Server side function
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-27-2017 04:55 AM
Hi Team,
I am trying to create a UI Action in which I want user to type in a text (On click) of that action and once they type in the text in the box then the server side function should execute.
Below is my script which is not working presently and I am not sure what I have missed out here.
function clientCode() {
var tableName = g_form.getElement("name").value;
var tableLabel = g_form.getElement("label").value || tableName;
var keyword = new GwtMessage().getMessage("cancel").toLowerCase();
var msg = new GwtMessage().format("Type the word \"{0}\" here", keyword);
var name = prompt(new GwtMessage().format("To cancel the action {0}", tableLabel), msg);
if (name || name.toLowerCase() == keyword) {
{
var fields = g_form.getEditableFields();
for(var x=0; x<fields.length; x++){
if (fields[x]!='sys_created_on' && fields[x] != 'sys_created_by' && fields[x]!= 'sys_updated_on' && fields[x] != 'sys_updated_by')
g_form.setMandatory(fields[x],false);
}
return;
}
gsftSubmit(null, g_form.getFormElement(), 'cancel_now');
}
}
if(typeof window == 'undefined')
runSumrule();
function runSumrule(){
current.deleteRecord();
var gr3 = new GlideRecord('x_governa_pm_sl_s');
gr3.addQuery('sys_id',current.getValue('sum_id'));
gr3.query();
if(gr3.next()){
gs.addInfoMessage('Clarification Request has been Cancelled');
action.setRedirectURL(gr3);
//current.deleteRecord();
}
}
Appreciate your quick response.
Regards,
Narmi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-27-2017 06:48 AM
Narmi,
If you put an "alert("something")" right before the gsftSubmit instruction, is the message shown? Your UI Action seems to be ending on the return before it reaches the gsft instruction, and therefore not executing the server side part of your code.
Thanks,