1

This is what happens in our org, when you click on a notification that was produced by a process in Process Builder as a reaction to the creation of a CaseComment:

INVALID_TYPE: sObject type 'CaseComment' is not supported in describeCompactLayouts.

Even I as a sysadmin get this error. The notification itself is perfectly clear, it consists only of plain text, but if you hover over it, the cursor suggests that the text is a link. Clicking then leads to a screen with just the error message.

I cannot find in the Salesforce documentation what is supposed to happen when you click on a notification.

The following question is of course: how can I prevent the notification from being clickable or how can I control the result of the click?

1 Answer 1

2

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 Reference.

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.

1
  • Thanks! As we have to migrate our processes to flows, we will use that opportunity to handle this as well. Commented Nov 3, 2021 at 14:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .