AgileApps Support Wiki Pre Release

deleteUser

From AgileApps Support Wiki

Delete a user.

Syntax

Result result = Functions.deleteUser(String userID);

Parameters

userID
The identifier of the user to delete.


Return
Result object
Example
This example calls deleteUser, assigning the returned value to an instance of Result and calling Result.getCode to assign the error code to a variable which is then conditionally checked to determine the code to execute. If the call was not successful, the code calls throwError to display an error dialog.
String userID = "";
// Some logic to populate userID variable.
Result result = Functions.deleteUser(userID);
int resultCode = result.getCode();
if(resultCode < 0)
{
    // Some error happened.
    String msg = "User could not be deleted";
    Logger.info(msg + ":\n" + result.getMessage(), "Delete");  // Log details
    Functions.throwError(msg + ".");                     // Error message
}
else 
{
    // Take other actions on successful addition
    // of the user.
}