ContextGetEmails
Gets all email addresses in context, excluding ones given.
- Type
- javascript
- Pack
- CommonScripts
Source
var excludedEmails;
if (args.excludedEmails) {
excludedEmails = args.excludedEmails.split(',');
}
var flat = {};
var res = [];
var currentValue;
flattenFields(invContext,undefined,flat);
keysArr = Object.keys(flat);
for (var i = 0; i < keysArr.length; i++) {
currentValue=flat[keysArr[i]];
if (emailRegex.test(currentValue) && res.indexOf(currentValue) === -1) {
if (excludedEmails) {
if (excludedEmails.indexOf(currentValue) === -1) {
res.push(currentValue);
}
} else {
res.push(currentValue);
}
}
}
var md = '### Email addresses in context\n';
for (var i = 0; i<res.length; i++) {
md += '- ' + res[i] + '\n';
}
return {
Type: entryTypes.note,
Contents: res,
ContentsFormat: formats.json,
HumanReadable: md
};
README
Gets all email addresses in context, excluding ones given.
Script Data
| Name | Description |
|---|---|
| Script Type | javascript |
| Tags |
Inputs
| Argument Name | Description |
|---|---|
| excludedEmails | The email addresses to exclude (comma-seperated). |
Outputs
There are no outputs for this script.