DS Server

Javascript: TrackedChange.getUserName Method

Method|Introduced in 28.0

Description

Gets the name of the user who has done the change.

Syntax

<void> TrackedChange.getUserName(<RequestStringCallback> callback, [<ErrorCallback> errorCallback])

Parameters

ParameterDescription
callback

Receives the name of the user who has done the change.

errorCallback

Optional. Is called when the operation failed with an error.

Examples

The following example demonstrates TrackedChange.getUserName in a practical document-editing workflow. It gets the name of the user who has done the change.

function onTxError(error) {
    console.error("TX Text Control error:", error.msg);
    error.handled = true;
}

TXTextControl.textParts.getMainText(function(mainText) {
    const trackedChanges = mainText.trackedChanges;
    trackedChanges.getItem(function(trackedChange) {
        if (!trackedChange) {
            console.warn("No tracked change is available at the current input position.");
            return;
        }
    
        trackedChange.getUserName(
            function(result) {
                console.log("get user name result:", result);
            },
            onTxError
        );
    }, onTxError);
}, onTxError);