function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Bryan Leaman 6Bryan Leaman 6 

"salesforce.com refused to connect" when submitting for approval causes error msg in trigger

We have a trigger to provide certain validations that were difficult as validation rules (and need to be enforced even when created by pushing through an approval process). 

We're also in the process of moving to lightning. So I've placed our VF page in a lightning component, but when the "Submit for Approval" button on the approval related list is used and the result violates the rule in the trigger, we just get a gray screen that looks like a Chrome connection error with the message: 
     "... salesforce.com refused to connect" 

I found that if I postpone the error until the next step in the approval process, then trying to submit the record works and the error is correctly displayed when trying to approve the next step. I suspect this is an issue of using the "Submit for approval" button on a VisualForce page embedded in a lightning VF component.

The custom error message is also handled correctly when using the native lightning submit button.
MagulanDuraipandianMagulanDuraipandian
Did you try to generate debug logs to find the root cause when the button is clicked and when the VF page is loaded?

--
Magulan Duraipandian
www.infallibletechie.com
Bryan Leaman 6Bryan Leaman 6
Yes. There's nothing significant in the logs other than seeing my error being generated by the trigger. I believe it's because in lightning the submit button generates a pop-up dialog with room for comments and the error message is handled by that dialog. But when I use the submit button from the Approval related list on a VF page then there's no pop-up for comments and if it fails, that native dialog isn't there to handle the error message.