Skip to content

ApplicationUpdate

Application update action allows the client to manually check for an application update. Check is considered successful if the application checks for a new version or downloads a new version. However, check is considered a failure if the application fails to either check for a new version or download the new version.

The properties defined in Action are also applicable to this action.

ApplicationUpdate Properties

Property Type Required
_Type const Required

_Type

  • type: const

The value of this property must be equal to:

"Action.Type.ApplicationUpdate"

Action Result

Refer to the MDK Guide to understand what an action result is.

The success ActionResult of this action is a message containing the version (and revision) or a text message for

  1. Current version is already up to date
  2. AppUpdate feature is not enabled or no new revision found

The failure ActionResult is an error message.


Examples

{
    "_Type": "Action.Type.ApplicationUpdate",
    "ActionResult": {
      "_Name": "AppUpdate"
    },
    "OnSuccess": "/MyMDKApp/Rules/AppUpdateSuccessResult.js",
    "OnFailure": "/MyMDKApp/Actions/OnFailure.action"
}
export default function AppUpdateSuccessResult(clientAPI) {
  let actionResult = clientAPI.getActionResult('AppUpdate');
  if (actionResult) {
    let result = actionResult.data;
    if (result.startsWith('Current version is already up to date')) {
      let versionNum = result.split(': ')[1];

      return clientAPI.getPageProxy().executeAction({
        "Name": "/MyMDKApp/Actions/GenericToastMessage.action",
        "Properties": {
          "Message": `Current version: ${versionNum} is already up to date`
        }
      });
    } else if (result === 'AppUpdate feature is not enabled or no new revision found.') {
      return clientAPI.getPageProxy().executeAction({
        "Name": "/MyMDKApp/Actions/GenericToastMessage.action",
        "Properties": {
          "Message": result
        }
      });
    }
    // New version found don't display any message, OnWillUpdate will fire
  }
}
{
  "_Type": "Action.Type.Message",
  "Message": "#ActionResults:AppUpdate/#Property:error",
  "Title": "Error",
  "OKCaption": "OK"
}