You can use the following script in a Javascript Task.
- require("validation.js");
- task.parameters = {
- MailVariable: {
- description: "The variable containing IMailInfo mail item.",
- category: "Settings",
- type: { id: "variable", variableTypes: "object" },
- order: 1,
- validate: validation.required
- },
- MailIDVariable: {
- description: "The variable that will receive the MailId.",
- category: "Settings",
- type: { id: "variable", variableTypes: "string" },
- order: 2,
- validate: validation.required
- }
- };
- task.run = function () {
- var mi = this.variables[this.parameters.MailVariable.value].value;
- this.variables[this.parameters.MailIDVariable.value].value = mi.ID;
- };
Pass in a variable of type object with your mail item.
Get back the ID for the mail item in the variable of type string you specify in MailIDVariable.