Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Code Block
languagegroovyjava
// Simple notification example
api.notificationApi()
        .withRecipient(api.user("loginName"))
        .withTitle("New actionable insight found")
        .withInfoStatus()
        .withSource("2147483653.PL")
		.withContextLink("See more", AppPages.QC_DETAILS_PAGE, [
          id: "2147493269",
          tpTab: 'messages'
        ])
        .withMessage("Dashboards identified an Opportunity for you. ")
        .send()

...

Get NotificationApi object

api.notificationApi()

https://developer.pricefx.eu/pricefx-api/groovy/stagingmaster/net/pricefx/server/dto/calculation/notification/NotificationApi.html

NotificationApi provides builder-like pattern to build notification, when all is set, call send() on it.

...

There always has to be some recipient involved. You can specify a single user by its ID or login name. Or you can specify a list of users based either on IDs or login names.

  • .withRecipient(Long id)

  • .withRecipient(String loginName)

  • .withRecipient(List<Long> ids)

  • .withRecipientLogin(List<String> loginNames)

Other possibilities to set recipients are via user groups with similar inputs, group’s uniqueName, or ID.

  • .withUserGroupId(Long id)

  • .withUserGroupId(List<Long> ids)

  • .withUserGroupUqName(String uniqueName)

  • .withUserGroupUqName(List<String> uniqueNames)

...

  • INFO

    • .withInfoStatus()

    • Provide additional information to users that may not be tied to their current action or task
      Does not require immediate action and can be dismissed on a timer or persist, depending on the content

  • SUCCESS

    • .withSuccessStatus()

    • Confirm a task was completed as expected
      Typically do not require further action and can be dismissed automatically or persist in a nonintrusive manner

  • WARNING

    • .withWarningStatus()

    • Inform users that they are taking actions that are not desirable or might have unexpected results
      Often persist until the user dismisses the notification or continues in their task

  • ERROR

    • .withErrorStatus()

    • Inform users of an error or critical failure, and optionally block the user from proceeding until the issue has been resolved
      Always persist until the user dismisses them or resolves error

...

  • Context Link

    • .withContextLink("See more", AppPages.QC_DETAILS_PAGE, [id: "2147493269", tpTab:'messages'])

    • here the parameters are: link label, target page and target page state.

    • context links for notifications are similar to Context Linking

    • see withContextLink methods in API documentation

  • DOWNLOAD

    • .withDownloadAction(String action)

    • action is command for BE; you have to know the filename you want to download.

  • LINK

    • .withLinkAction(String action)

    • Link for fronted when you can’t or don’t want to use context linking.

  • Messsage LINK

    • .withMessageLinkAction(String action)

    • link to CLIC messages

  • INFO_MESSAGE

    • .withNoAction()

    • means notification serves the purpose as info message only. There is no intended action for a user behind this notification.

Action Label
  • with .withActionLabel(String actionLabel) you can define your action label text; by default, the source field is used.

...