You need to sign in to do that
Don't have an account?
Catch the external application error and show own error message
Hi ,
I have installed an external application to find duplicates while creating lead records.
I am creating lead records through vf page,
<apex:pageMessage></apex:pagemessage>
try {
insert lead;
}
catch(DMLException e) {
String err = String.valueOf(e);
ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.ERROR,'The referral email or phone already existing with brigade group' );
ApexPages.addMessage(myMsg);
}
The page Messages showing both application error as well as my own exception.
ex:
- <script src="/js/functions.js" type="text/javascript"></script><script src="/soap/ajax/20.0/connection.js" type="text/javascript"></script><script src="/soap/ajax/20.0/apex.js" type="text/javascript"></script><script type="text/javascript"> window.onload = SFSSDupeCatcher_doWork; function SFSSDupeCatcher_doBlockedDuplicate() {var issueTime = '1384764518550'; var sessionId = '00Df0000002KWPO!AQIAQC7RJBmJo7d1mSsbNRnPYJXFKyZ7sYxjTjo86mOTmlKdB7ZsSeNpRteo7_ysAFBovApCx7PSAMPvUzAk1o_y_XaPX3Mu'; var scenarioId = 'a0Jf0000000aDvEEAU'; try{SFSSDupeCatcher_incrementCounter(scenarioId, sessionId, issueTime)}catch(err){};} function SFSSDupeCatcher_doWork() { SFSSDupeCatcher_doBlockedDuplicate(); } function SFSSDupeCatcher_incrementCounter(scenarioId, sessionId, issueTime) {var scenarioQuery = 'Select Name, Id, SFSSDupeCatcher__Blocked_Duplicates__c from SFSSDupeCatcher__Scenario__c where (Id = \'' + scenarioId + '\')'; var state = {output : 'hello', startTime : new Date().getTime() }; var callback = { onSuccess: SFSSDupeCatcher_handleResults,onFailure: SFSSDupeCatcher_queryFailed,timeout: 1200,source: state}; sforce.connection.sessionId = sessionId; sforce.connection.clientId = 'SymphonicSource/DupeCatcher/'; sforce.connection.query( scenarioQuery , callback); } function SFSSDupeCatcher_handleResults(queryResult, source) { var records = queryResult.getArray('records'); for (var i = 0; i < records.length; i++) { var thisscenario = records[i]; thisscenario.SFSSDupeCatcher__Blocked_Duplicates__c++; records = sforce.connection.update(records); } } function SFSSDupeCatcher_queryFailed(error, source) { } </script><font color="blue"><br/>DUPECATCHER WARNING! The Lead that you created was not saved.</font><br/><font color="blue">It has been blocked because the value of the Lead 'Mobile Phone' field that you entered is similar to the 'Mobile Phone' field of the Contacts listed below.</font><br/><br/><font color="green">Click on the links below to view or edit the potential duplicate records.</font><br/>Potential duplicate Contact record: <a href="../003f00000097SVAAA2">Rama Raju</a><br/>Potential duplicate Contact record: <a href="../003f0000008s5PRAAY">Luke Roy</a><br/>Potential duplicate Contact record: <a href="../003f0000009e9FUAAY">Vijay Reddy</a><br/>Potential duplicate Contact record: <a href="../003f0000009AV9dAAG">Vijay Reddy</a><br/>Potential duplicate Contact record: <a href="../003f0000009e9H6AAI">Madhu R</a><br/>
- The referral email or phone already existing with brigade group
I wdon't want show application error, i justwant show my own error message. is there any way to handle this exception?
Thanks
siva.
All Answers
Thanks Bhawani
I did not get the solution that you provided above. Could you please explain it more.