Sending Messages with JavaScriptJavaScript can be used to send a message (either SMS or email) at any time in a Workflow, and can be a quick and easy way to send off messages without agent involvement.
It is also possible to make use of the Script.Email.Send() or Script.Sms.Send() functions to send just emails or SMS respectively.
How ToInside any JavaScript-manipulating Field (Calculate, JavaScript, JavaScript - Button), use the function specified below.
Simple Syntax
The simple syntax requires a list of parameters:
Script.Message.Send(messageType, connectorType, connectorName, subject, recipients, from, body, defer, callback);
Example:
Alternate Syntax
Since many of the arguments for the above syntax are optional, there is an alternate syntax where a JavaScript object is passed instead. This means that only the desired optional parameters need to be passed:
Any optional parameters that are omitted will use their default value, as stated in the above table. As this is a JavaScript object, the order in which the parameters are listed in this alternate syntax doesn't matter, as long as the key:value pairs are preserved.
NotesAs multiple duplicate messages can be queued, it is advised that caution is used if this function is invoked in a Calculate Field, due to the way that Calculate Fields will run every time an action is taken or Field's value is altered.
|