You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
var latestVersion = grSSA.getValue('latest_version');
53
-
var installedArray = installedVersion.split('.');
54
-
var latestArray = latestVersion.split('.');
56
+
var installedVersion = grSSA.getValue("version");
57
+
var latestVersion = grSSA.getValue("latest_version");
58
+
var installedArray = installedVersion.split(".");
59
+
var latestArray = latestVersion.split(".");
55
60
var len = Math.max(installedArray.length, latestArray.length);
56
61
for (var i = 0; i < len; i++) {
57
62
var installed = installedArray[i] ? parseInt(installedArray[i]) : 0;
@@ -65,16 +70,38 @@ function updateAvailable(grSSA) {
65
70
return false;
66
71
}
67
72
if (appsArray.length > 0) {
73
+
gs.info("\n\n------------------------------------------------\n\nLinks to track progress below the payload information\n\n(scroll down)\n\n-----------------------------------------------\n\n");
74
+
68
75
var appsPackages = {};
69
76
appsPackages.packages = appsArray;
70
-
appsPackages.name = 'Update Apps';
77
+
appsPackages.name = "Update Apps";
71
78
var data = new global.JSON().encode(appsPackages);
72
79
73
-
var url = gs.getProperty('glide.servlet.uri') +'$restapi.do?ns=sn_cicd&service=CICD%20Batch%20Install%20API&version=latest';
74
-
gs.info('\\nOpen the following URL in a new tab:\\n\\n' + url + '\\n\\ncopy/paste the following JSON into the "Raw" Request body\\n\\n' + data);
80
+
var baseUrl = gs.getProperty("glide.servlet.uri");
81
+
var update = new sn_appclient.AppUpgrader().installBatch(data);
82
+
var updateObj = JSON.parse(update);
83
+
gs.info(
84
+
"\n\n------------------------------------------------\n\nOpen the Batch install link to monitor the installation progress. It may take some time for the apps to all populate in the related list. After all apps have populated the install will start and the State will change to In progress.\n\nBatch install:\n" +
var grSBIP = new GlideRecord('sys_batch_install_plan');
95
+
if (grSBIP.get(updateObj.batch_installation_id)) {
96
+
grSBIP.setValue('notes','It may take some time for the apps to all populate in the related list below (you can refresh the list as needed to see them populating). \n\nAfter all apps have populated the install will start and the State (above) will change to In progress. \n\nWhen the batch is done the state will update to Installed');
97
+
grSBIP.update();
98
+
}
75
99
} else {
76
-
gs.info("\\nNo apps to update found.\\nIf you think this is incorrect please try running this script again with \`updateCheck\` set to \`true\`. This will check the store for any new updates.\\n\\n(sometimes there are apps in the Application Manager that say that there are updates but you can't actually update them)");
100
+
gs.info(
101
+
"\n\n-----------------------------------------------\n\nAll apps appear to be up-to-date. \n\nIf you think this is incorrect please try running this script again with `updateCheck` set to `true`. This will check the store for any new updates.\n(sometimes there are apps in the Application Manager that say that there are updates but you can't actually update them)\n\n-----------------------------------------------\n\n"
0 commit comments