Displaying an alert box while deleting a record from related list

balakumar1
Kilo Contributor

Hi,

I am looking for a way to display an alert box while deleting a record from the related list.

Like, "You are about to delete this record" with Ok and Cancel buttons. Clicking ok should delete the record and clicking cancel should abort the delete operation.

I could do it while deleting the record directly from the form, but not while deleting from the list.

Sorry if the solution is simple and obvious. Could you please help.

Regards,

Bala

7 REPLIES 7

so problem solved?


-Anurag

Yes, it's resolved. I wrote a new function "proceedWithDeleteFromContextMenu" in the "DeleteRecordAjax" script include and used that from the UI Action



UI Action:


--------------



if(g_list.getTableName() == 'the_table_where_we_want_this_functionality') {


          var answer = confirm("Delete the selected item?");


          if(answer) {


                deleteThisRecord();


          }


}


else {


    deleteThisRecord();


}



function deleteThisRecord() {


    var tableName = g_list.getTableName();


    var ids = g_sysId;


    var ga = new GlideAjax('DeleteRecordAjax');


    ga.addParam('sysparm_name', 'proceedWithDeleteFromContextMenu');


    ga.addParam('sysparm_sys_id', ids);


    ga.addParam('sysparm_table_name', tableName);


    ga.getXMLWait();


    ga.getAnswer();


    window.location.reload();


}


Hi Balakumar,



Can you please send me the code that you have written in "DeleteRecordAjax" script include. I am trying to implement the same with the List choice.



Thanks,


Vamsee.