createEmailNotifier

Back to index

Summary

Create an EmailNotifier on a property sheet container specified by an emailNotifierSelector.
You must specify a notifierName and object locators for a job, job step, procedure, or procedure step.
notifierName
Stringrequired
The name of the email notifier.
applicationName
Stringoptional
The name of the application which is related to the target email container (Process/ProcessStep).
componentName
Stringoptional
The name of the component which is related to the target email container (Process/ProcessStep).
condition
Stringoptional
A fixed text or text embedding property references that is evaluated into a logical TRUE or FALSE. An empty string, a 0 or false is interpreted as FALSE. Any other result string is interpreted as TRUE.
configName
Stringoptional
Name for an email configuration; or a text that - through property expansion - results into such an email configuration name.
description
Stringoptional
Comment text describing this object that is not interpreted at all by CloudBees CD/RO.
destinations
Stringoptional
A list of space-separated user names, email addresses or email aliases or a text that - through property expansion - results into such a list.
environmentName
Arrayoptional
Name of the environments.
eventType
Stringoptional
An enumeration of valid event categories recognized by the email notifiers.
Possible values: "onCompletion", "onEnter", "onStart", "onWaitOnError"
flowName
Stringoptional
The name of the flow container of the email notifier.
flowRuntimeId
UUIDoptional
The primary key or name of the flowRuntime container of the email notifier.
flowRuntimeStateId
UUIDoptional
The primary key or name of the flowRuntimeState container of the email notifier.
flowStateName
Stringoptional
The name of the flow container of the email notifier.
formattingTemplate
Stringoptional
String containing email formatting instructions for generating notifications.
gateType
Stringoptional
The type of the gate.
Possible values: "POST", "PRE"
groupName
Arrayoptional
A list of names of the groups which receives the notification.
jobId
Stringoptional
The primary key or name of the job container of the email notifier.
jobStepId
UUIDoptional
The primary key of the job-step container of the email notifier.
notificationType
Stringoptional
The notification type which will be stored to the ec_notificationType property.
Possible values: "always", "failure", "success"
pipelineName
Stringoptional
The name of the pipeline container of the email notifier.
procedureName
Stringoptional
The name of the procedure container of the email notifier.
processName
Stringoptional
The name of the process container of the email notifier.
processStepName
Stringoptional
The name of the process step container of the email notifier.
projectName
Stringoptional
The name of the project container of the email notifier.
releaseName
Stringoptional
The name of the release containing the pipeline.
stageName
Stringoptional
The name of the stage container of the email notifier.
stateDefinitionName
Stringoptional
The name of the state definition container of the email notifier.
stateName
Stringoptional
The name of the state container of the email notifier.
stepName
Stringoptional
The name of the step container of the email notifier.
userName
Arrayoptional
A list of names of the users who receives the notification.
workflowDefinitionName
Stringoptional
The name of the workflow definition container of the email notifier.
workflowName
Stringoptional
The name of the workflow container of the email notifier.

Usage

Perl

$cmdr->createEmailNotifier( "test-notifierName" # notifierName # optionals );

ectool

ectool createEmailNotifier \ "test-notifierName" `# notifierName` \ # optionals

Examples

Perl

$cmdr->createEmailNotifier("testNotifier", {eventType => "onStart", condition => "$[/javascript if(myJobStep.outcome == 'warning') 'true'; else 'false';]", destinations => 'user1@abc.com user2@abc.com emailAlias1@example.com', configName => "testConfiguration", projectName => "Project_test", procedureName => "Procedure_test", formattingTemplate => "Subject: Job started Notification: Job: $[/myJob/jobName] $[/myEvent/type] Job: $[/myJob/jobName] $[/myEvent/type] at $[/myEvent/time]",});

ectool

ectool createEmailNotifier testNotifier --condition "$[/javascript if(myJobStep.outcome == 'warning') 'true'; else 'false';]" --destinations "user1@abc.com user2@abc.com emailAlias1@example.com" --configName EmailConfig_test --formattingTemplate "Notification: Job: $[/myJob/jobName] $[/myEvent/type] Job: $[/myJob/jobName] $[/myEvent/type] at $[/myEvent/time]" --projectName Project_test --procedureName Procedure_test --description "This is a test email notifier for Job completion"