how to get field values using g_list in ui action and passed through confirm message
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-29-2017 12:11 AM
Hi Firends,
I have created one ui action as a list choice and in that i used a g_listChecked(). By using this i get the how many selected list records i checked an alert in that it is showing of sys_id's of selected records. Based on that sys_id's i want to get the task number and pass to a confirm message. How it can be please help me as soon as possible.
Regards,
Kranthi.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-29-2017 12:16 AM
Hi Friends,
This is the code and screenshots of that ui action as shown in below
var ajaxHelper;
var selSysIds;
var numbs = 0;
var list = 0;
var arr [];
var i;
function confirmAndDeleteFromList() {
tblName = g_list.getTableName();
selSysIds = g_list.getChecked();
list = selSysIds.split(',');
numbs = list.length;
alert(numbs);
for(i=0;i<=numbs;i++)
{
var gr = new GlideRecord("incident_task");
gr.addQuery("sys", "value");
gr.query();
if (gr.next()) {
}
}
ajaxHelper = new GlideAjax('DeletingRecords');
DeleteRecord();
}
function DeleteRecord() {
ajaxHelper.addParam('sysparm_name', 'deleteMultipleTasks');
ajaxHelper.addParam('sysparm_objList',selSysIds);
ajaxHelper.getXMLWait();
}
Regards,
Kranthi.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-29-2017 12:44 AM
Hello,let me think I understand what your meaning is.
First in line 16,it should be gr.addQuery('sys_id',list[i]),and in line 19,I think you can add confirm('Your confirm message which contains' + gr.task_number)
replace task_number with the true field name and 'Your confirm message which contains' is just sample of the confirm message,type your real message here.
Finally, line 5 has a syntax spelling mistake.Convert it to var arr = [];
I wish it will help you.
* If you think my answer correct please mark Like/Helpful/Answered
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-29-2017 02:52 AM
Hi Wang,
i wrote a code what you said but it is showing one task number after i click on ok it is not done any action but i reload the form the selected tasks are deleted can you tell me the code for this problem please see the below
Thanks & Regards
Kranthi kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-04-2018 10:31 PM
Hi,kranthi.
So sorry to reply to you too late.
Maybe you've found the solution.Still I give my suggestion here:
The method 'DeletingRecords' now delete all the records by the parameter 'selSysIds'.
So each deleting action you just need to pass the sysid of one record:In UI Action Delete1,line 22 should be 'DeleteRecord(gr.sys_id);'.
,and in line 35 the declare must be added a parameter: function DeleteRecord(sys_id).Finally,in line 37, replace 'selSysIds' with 'sys_id'.
May this will help you.
Best Regards
Wang Wenchuan
* If you think my answer correct please mark Like/Helpful/Answered