February 9, 2021

setTargetPageRef in Custom Notification in Salesforce

Sample Code:

String pgRef = '{ type: "standard__recordPage",attributes:{recordId:' +  objAcc.Id + ',objectApiName: "Account",actionName: "view"} }';
notification.setTargetPageRef( pgRef );
In the above code, it redirects the user to the Account Record Page based the Account Id from objAcc.Id variable.

For additional PageReference types, check the below link

No comments:

Post a Comment