Need help in UI Action
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-17-2024 02:32 AM - edited 12-17-2024 03:35 AM
Hello Experts,
I created a UI Action where the answer for a choice field is Yes it should bring a UI Page as a pop-up and insert the record in a particular table.
Below is the script i wrote, my script is not reading the value yes or no in the choice field.
Could somebody please advice what is wrong in below script?
function CheckReversal() {
g_form.setMandatory('reversal_error', true);
gsftSubmit(null, g_form.getFormElement(), 'reversal');
}
if (typeof window == 'undefined')
DoReversal();
function DoReversal() {
if (current.getValue('reversal_error') == 'yes') {
var tableName = "x_nuv_rejection_details";
var sysID = g_form.getUniqueValue();
var prd = g_form.getValue('period');
var seg = g_form.getValue('segment');
//Create and open the dialog form
var dialog = new GlideDialogForm('Rejection Details', tableName); //Provide dialog title and table name
dialog.setSysID(-1); //Pass in sys_id to edit existing record, -1 to create new record
dialog.addParm('sysparm_view', 'Default View'); //Specify a form view
dialog.addParm('sysparm_form_only', 'true'); //Add or remove related lists
dialog.setLoadCallback(function(iframeDoc) {
// To get the iframe: document.defaultView in non-IE, document.parentWindow in IE
var dialogFrame = 'defaultView' in iframeDoc ? iframeDoc.defaultView : iframeDoc.parentWindow;
dialogFrame.g_form.setValue('nuv_ticket', sysID);
dialogFrame.g_form.setValue('period', prd);
dialogFrame.g_form.setValue('segment', seg);
dialogFrame = null;
});
dialog.render(); //Open the dialog
} else {
var reversalRec = new x_nuv_rejection_detailActivitiesUtil().createReversal();
action.setRedirectURL(reversalRec);
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-17-2024 07:01 AM - edited 12-17-2024 07:16 AM
Yes , alert did not come !
Below is the UI ACtion snapshot :
The field 'Reversal Error' should become mandatory while clicking the UI Action and suppose if i select Yes , then this UI Page with few of the fields should populate...when I enter the values in these field present in UI Page and submit,it should be inserted as a record in the Rejection table.(x_nuv_rejection_details). And if selected as 'No' then a reversal record will be created in the current table.
@Ankur Bawiskar ..Please help me resolve the issue
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-17-2024 07:49 AM
what came in alert when you added the code I gave?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-17-2024 07:56 AM - edited 12-17-2024 07:58 AM
The alert itself did not pop only , When I am clicking on the UI Action nothing is happening ...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-17-2024 09:00 AM - edited 12-17-2024 09:12 AM
@Ankur Bawiskar Are we trying for something that's not doable? Can it be achieved this way or not? Please suggest
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-17-2024 06:57 PM
are you trying this in native or workspace?
are you sure the fields for which you are checking the value are on form or not?
what came in alert for this field value?
g_form.getValue('reversal_error')
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader