Advertisement
Guest User

Untitled

a guest
Nov 27th, 2014
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 KB | None | 0 0
  1. try{
  2. this.acctURL = (Account)controller.getRecord();
  3. }catch(system.DMLException e){
  4. displayIDError = true;
  5. errorMessage = 'Salesforce cant find an account with an ID of: ' + acctIDPage + ' Please contact your Salesforce Administrator';
  6. }
  7.  
  8. this.acctURL = (Account)controller.getRecord();
  9.  
  10. public class AccountIdChecker
  11. {
  12. public PageReference Init()
  13. {
  14. String acctId = ApexPages.currentPage().getParameters().get('Id');
  15.  
  16. if(acctId == '')
  17. {
  18. ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.Error, 'No id specified!'));
  19. return null;
  20. }
  21.  
  22. try
  23. {
  24. Id realAcctId = acctId;
  25. if(Schema.Account.SObjectType != realAcctId.getSobjectType())
  26. {
  27. ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.Error, 'Id specified is not an account id!'));
  28. return null;
  29. }
  30. }
  31. catch (Exception e)
  32. {
  33. ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.Error, 'Bad id specified!'));
  34. return null;
  35. }
  36.  
  37. <<return reference to existing page here>>
  38. }
  39. }
  40.  
  41. <apex:page controller="AccountIdChecker" action="{!Init}">
  42. <apex:pageMessages/>
  43. </apex:page>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement