Sunday, March 17, 2019

Mass Delete User Notes

1) Create Scheduled Script by navigating to Customization > Scripting > Scripts > New. Type = Scheduled. Use code below for your file (remember to change 151 to the internal id of your user note saved search):

function deleteUserNotes(type) {
 var notes_list = nlapiSearchRecord('note', 151); // where 151 is internal id of your user note saved search
 for(var x = 0; x < notes_list.length; x++) {
  nlapiDeleteRecord('note', notes_list[x].id);

Note:  User should create the User Notes saved search that will be referenced in your script.
2) Create a Deployment for your script and run it. See running ad-hoc scheduled scripts for more details (Solution 10619 in SuiteAnswers)
3) You will be led to the Scheduled Script Status Page. Wait for your scheduled script to finish (Solution 10601 in SuiteAnswers) and confirm
that the user notes in the saved search were indeed deleted.

Note :  System-generated notes cannot be deleted. The script will error out if you try to do so.



No comments:

Post a Comment