Javascript: ApplicationField.setParameters Method
Description
Sets the field's parameters.
Syntax
<void> ApplicationField.setParameters(<string[]> parameters, [<EmptyRequestCallback> callback], [<ErrorCallback> errorCallback])Parameters
| Parameter | Description |
|---|---|
| parameters | The parameters. |
| callback | Optional. Is called when the operation completed. |
| errorCallback | Optional. Is called when the operation failed with an error. |
Examples
The following example changes the current application field into an invoice-number merge field while keeping its definition consistent.
function onTxError(error) {
console.error("TX Text Control error:", error.msg);
error.handled = true;
}
TXTextControl.textParts.getMainText(function(mainText) {
mainText.applicationFields.getItem(function(applicationField) {
if (!applicationField) {
console.warn("Place the input position in an application field.");
return;
}
applicationField.setTypeName("MERGEFIELD", function() {
applicationField.setParameters(
["InvoiceNumber", "\\* MERGEFORMAT"],
function() {
console.log("The merge field now targets InvoiceNumber.");
},
onTxError
);
}, onTxError);
}, onTxError);
}, onTxError);