The CustomNotification has a notification target , a
targetId, that when clicked directs you to the record's page in question.
The notification target is used by the receiving client application to
navigate to an appropriate record or page when a user responds to a
notification. For example, when a user is notified that a record was
updated, responding to the notification can open the relevant record.
Considerations for Notification Builder mentions that
CaseComment throws that error because it's a special object that doesn't actually have its own detail page to navigate to as the error message kind of hints at
When you send a custom notification from a process, the Target ID for
the notification is the record that started the process. However,
target records that don't have their own detail page (for example, a
case comment, which appears only in a Case Comment related list) don't
support direct navigation. Use Flow Builder to send the notification
from a flow and specify either a different Target ID or Target Page
If you do not want this behavior, you could customize your logic. You can't do this in Process Builder as it sets the target object automatically based on the object the PB runs against. However, both Flow and Apex would allow you to set an appropriate
targetId (ex. the
Case instead of the
CaseComment record). If you didn't want navigation at all, you can set a dummy value as noted in the docs so no redirect happens.
You must specify a target for a notification. The target can be
specified using either the targetID or the targetPageRef attribute.
Neither attribute is required, but if both are omitted, send() throws
an exception. If there’s no natural target for a notification, set the
targetID to a dummy value, such as 000000000000000AAA. A dummy value
prevents the exception, and also prevents automatic navigation when
responding to the notification in the client app.