SumanthDosapati
Mega Sage
Mega Sage

QUICK MOVE MULTIPLE CUSTOMER UPDATES FROM ONE UPDATE SET TO OTHER

 

As a Developer, there are multiple scenarios where we make some configurations in our instance and then wanted to move all those updates to a different update set.

In these cases we usually open each customer update record we wanted to move, change the update set field to required update set.

If we wanted to move multiple updates then it would be difficult to open each record and update.

This article helps you to create a UI action through which you can move multiple updates with just one click.

    • Navigate to System Definitions > UI Actions
  •  
    • Click on New
  •  
    • Fill the form as below :

                > Name : Move to current update set

                > Table : Customer Update [sys_update_xml]

                > Action name : move_to_current_update_set  (you can give as you wish)

                > List choice : True (Tick the check box)

    • Leave the other fields as is
  •  
    • In Script field add below script
      var currentUpdateSet = gs.getPreference('sys_update_set');
      var count = 0;
      var updateSetGR = new GlideRecord('sys_update_set');
      updateSetGR.get(currentUpdateSet);
      try 
      {
          current.setValue('update_set', currentUpdateSet);
          current.update();
      	count++;
      }
      catch(e) 
      {
          gs.log('ERROR while moving customer updates: ' + e);
          gs.addErrorMessage('An error occurred.');
      }
      gs.addInfoMessage(count + " updates moved to current update set");

       

    •  Save the Record

Done! You are all set with creating a new UI Action.

 

    • Now open any update set from which you wanted to move few customer updates to current update set
  •  
    • Scroll down to Customer updates related list
  •  
    • Select all the updates you wanted to move find_real_file.png
  •  
    • Click on 'Action on selected rows drop downfind_real_file.png
  •  
    • Click on 'Move to current update set' in the dropdownfind_real_file.png

That's it !!  Done !!

Now your selected customer updates are moved to your current update set.

You will see an info message with number of updates moved to your current update set.

You will get an error message if any error occurred while moving. You can check system logs for more info on the occurred error.

 

Note : You may also have other methods to do this via background script or list view or fix script, but this is more enhanced way through which you can have better developer experience and you can do this in the same update set form itself.

 

Feel free to comment for any queries or suggestions. If this article helps you, share it with your fellow developers and mark as helpful and bookmark for future reference.

Regards,
Sumanth

Comments
OlaN
Giga Sage
Giga Sage

Do you know that this already exists as a Share project?
It's been around for a couple of years...

SumanthDosapati
Mega Sage
Mega Sage

Not aware of that. And this has small difference that it will move selected updates to current update set automatically instead of giving an update set name in the UI page pop up.
BTW Thanks for sharing that as well 🙂

Version history
Last update:
‎07-11-2022 05:37 AM
Updated by: