...
Notice methods of Notifications API and usage of builder pattern.
...
As an example we will use a Dashboard with some buttons to generate notifications with.
Code Block | ||||
---|---|---|---|---|
| ||||
// Info notification with a link to the quote and download action
def user = api.user("admin")
def quote = "896.Q"
api.notificationApi()
.withRecipient(api.user("loginName"))
.withTitle("Quote review requested ")
.withSuccessStatus()
.withSource("896.Q")
.withContextLink("Go to P-896", AppPages.QC_DETAILS_PAGE, "896.Q")
.withDownloadAction("asyncdownloadmanager.download/whatever.zip")
.withMessage("Quote created by $user needs your attention.")
.send() |
Code Block | ||||
---|---|---|---|---|
| ||||
// Creates a notifications with a deep-link to a specific Quote to a particular tab. E.g. P-896, tab: dashboard. api.notificationApi() .withRecipient(api.user("loginName")) .withTitle("New insight found") .withInfoStatus() .withSource("896.Q") .withContextLink("P-896.", AppPages.QC_DETAILS_PAGE, [id: "896", tpTab: 'dashboard']) .withMessage("We found an issue with the Quote P-896. Go to") .send() |
...