Tuesday, June 18, 2019

Mass Update Script Owner

Sample Use Case: IT Manager has left the company. He is the only one set to receive e-mails regarding unhandled errors on his more than 150 scripts.


1) Create Mass Update Script by navigating to Setup > Customization > Scripts. Use the following code for your .js file:
*For more information on creating a Script Record, see Answer 10553 - Steps for Creating a Script Record
  function massUpdateScriptOwner(rec_type, rec_id) {
   nlapiSubmitField(rec_type, rec_id, 'owner', -5); // set the script's owner field to employee with internal id -5
  }
*note: The inactive checkbox and Unhandled Error notifications can also be modified through SuiteScript. Refer to Answer 10511 for more information on the SuiteScript Records Browser, where the internal IDs of records, fields and sublists available to SuiteScript can be viewed.


2) Deploy the Mass Update Script from step 1 to the following script types. Remember to select the appropriate Audience and Release Status:
*For more information on creating a Script Record, see Answer 10554 - Steps for Defining a Script Deployment
 - Bundle Installation Script
 - Client Script
 - Massupdate Script
 - Restlet
 - Scheduled Script
 - Suitelet
 - Userevent Script
 - Workflow Action Script
*note: For script types where the previous owner only has a few scripts, it might be more efficient to just manually change the owner field. The mass update script is recommended for script types where the previous owner has about 20 scripts or more.


3) Trigger the Mass Updates by navigating to Lists > Mass Update > Mass Updates > Custom Updates, and finding the Mass Update Script Deployment created in step 2. Use the search criterion below:
 - 'Owner' is any of *Employee you would like to replace*


4) Click on 'Preview' to retrieve a list of Scripts where the update will be executed. Users can select and deselect records to be updated by checking and unchecking the 'Apply' column. Once the list of records is confirmed, click on 'Perform Update' to start the Mass Update.
Note that when running a mass update, processing 50 records or less begins instantly. When processing more than 50 records, there may be a delay of up to one minute before the job begins. Once a mass update is in process, it cannot be cancelled.

No comments:

Post a Comment