• Lee Engelhardt
  • NEWBIE
  • 0 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 3
    Replies
Alright, I'm sure this just has to do with me being very new to Salesforce coding and sites and not knowing what I'm doing but I've beaten my head against this rock enough and beg the wisdom of those more experianced.

I'm making a very simple public page. I'm not even using a custom controller, just the standard contact one.  The premise is that the contact will have recieved an email asking for their permission to send them some information about services.  The email will have a link to my page with the contact id in the url (?id=<the id number>).  The form lets them see their email address on record and check a box to give us permission to email them more.  They click submit, the info gets saved and they get a thank you page.  Thats it, and it works flawlesly when I'm logged in, and it looks fine when I open the page as an anonymous user and don't give it a contact id to work with, however, the moment I put in a contact id when viewing anonymously, I get the Authorization Required page.

<apex:page standardController="Contact" sidebar="false" showHeader="false">
    <div style="width:500px; margin-top:100px; margin-left:auto; margin-right:auto;">
    <apex:pageBlock >
        <h1>Thank you for your interest!</h1><br />
        <p>Please check the box below and click submit to recieve further information.</p><br />
        <apex:pagemessages />
        <apex:form >
        <apex:actionFunction name="saveAndThanks" action="{!Save}" oncomplete="window.parent.location.href='http://abstraktmg.force.com/emailoptin/Email_OptIn_ThankYou'"/>
        <p>Your Email:</p>
        <apex:inputField value="{!Contact.Email}" /><br/>
        <apex:inputCheckbox value="{!Contact.Email_Opt_In__c}"/>I want to know more.<br />
        <apex:CommandButton onClick="saveAndThanks();" value="Submit" />
        </apex:form>
    </apex:pageBlock>
    </div>
</apex:page>
I've tried a lot of the normal debugging advice but since it only gets the error when an id is added, I'm kind of stuck since most of the debugs, like "Preview as Admin" don't seem to run properly with a url argument included.  I did get the guest account added for monitoring but the log doesn't seem to be generating anything usefull.

31.0 APEX_CODE,DEBUG;APEX_PROFILING,INFO;CALLOUT,INFO;DB,INFO;SYSTEM,DEBUG;VALIDATION,INFO;VISUALFORCE,INFO;WORKFLOW,INFO
19:41:15.077 (77125771)|EXECUTION_STARTED
19:41:15.077 (77165945)|CODE_UNIT_STARTED|[EXTERNAL]|066G0000002LFVU|VF: /apex/Email_OptIn
19:41:15.077 (77189102)|CODE_UNIT_STARTED|[EXTERNAL]|VF Controller Save
19:41:15.077 (77213288)|CODE_UNIT_FINISHED|VF Controller Save
19:41:15.946 (189796502)|CUMULATIVE_LIMIT_USAGE
19:41:15.946|LIMIT_USAGE_FOR_NS|(default)|
  Number of SOQL queries: 0 out of 100
  Number of query rows: 0 out of 50000
  Number of SOSL queries: 0 out of 20
  Number of DML statements: 0 out of 150
  Number of DML rows: 0 out of 10000
  Maximum CPU time: 0 out of 10000
  Maximum heap size: 0 out of 6000000
  Number of callouts: 0 out of 10
  Number of Email Invocations: 0 out of 10
  Number of future calls: 0 out of 10
  Number of Mobile Apex push calls: 0 out of 10

19:41:15.946|CUMULATIVE_LIMIT_USAGE_END

19:41:15.189 (189846151)|CODE_UNIT_FINISHED|VF: /apex/Email_OptIn
19:41:15.191 (191580457)|EXECUTION_FINISHED

Any and all help is much appreciated.  Thank you.

Alright, I'm sure this just has to do with me being very new to Salesforce coding and sites and not knowing what I'm doing but I've beaten my head against this rock enough and beg the wisdom of those more experianced.

I'm making a very simple public page. I'm not even using a custom controller, just the standard contact one.  The premise is that the contact will have recieved an email asking for their permission to send them some information about services.  The email will have a link to my page with the contact id in the url (?id=<the id number>).  The form lets them see their email address on record and check a box to give us permission to email them more.  They click submit, the info gets saved and they get a thank you page.  Thats it, and it works flawlesly when I'm logged in, and it looks fine when I open the page as an anonymous user and don't give it a contact id to work with, however, the moment I put in a contact id when viewing anonymously, I get the Authorization Required page.

<apex:page standardController="Contact" sidebar="false" showHeader="false">
    <div style="width:500px; margin-top:100px; margin-left:auto; margin-right:auto;">
    <apex:pageBlock >
        <h1>Thank you for your interest!</h1><br />
        <p>Please check the box below and click submit to recieve further information.</p><br />
        <apex:pagemessages />
        <apex:form >
        <apex:actionFunction name="saveAndThanks" action="{!Save}" oncomplete="window.parent.location.href='http://abstraktmg.force.com/emailoptin/Email_OptIn_ThankYou'"/>
        <p>Your Email:</p>
        <apex:inputField value="{!Contact.Email}" /><br/>
        <apex:inputCheckbox value="{!Contact.Email_Opt_In__c}"/>I want to know more.<br />
        <apex:CommandButton onClick="saveAndThanks();" value="Submit" />
        </apex:form>
    </apex:pageBlock>
    </div>
</apex:page>
I've tried a lot of the normal debugging advice but since it only gets the error when an id is added, I'm kind of stuck since most of the debugs, like "Preview as Admin" don't seem to run properly with a url argument included.  I did get the guest account added for monitoring but the log doesn't seem to be generating anything usefull.

31.0 APEX_CODE,DEBUG;APEX_PROFILING,INFO;CALLOUT,INFO;DB,INFO;SYSTEM,DEBUG;VALIDATION,INFO;VISUALFORCE,INFO;WORKFLOW,INFO
19:41:15.077 (77125771)|EXECUTION_STARTED
19:41:15.077 (77165945)|CODE_UNIT_STARTED|[EXTERNAL]|066G0000002LFVU|VF: /apex/Email_OptIn
19:41:15.077 (77189102)|CODE_UNIT_STARTED|[EXTERNAL]|VF Controller Save
19:41:15.077 (77213288)|CODE_UNIT_FINISHED|VF Controller Save
19:41:15.946 (189796502)|CUMULATIVE_LIMIT_USAGE
19:41:15.946|LIMIT_USAGE_FOR_NS|(default)|
  Number of SOQL queries: 0 out of 100
  Number of query rows: 0 out of 50000
  Number of SOSL queries: 0 out of 20
  Number of DML statements: 0 out of 150
  Number of DML rows: 0 out of 10000
  Maximum CPU time: 0 out of 10000
  Maximum heap size: 0 out of 6000000
  Number of callouts: 0 out of 10
  Number of Email Invocations: 0 out of 10
  Number of future calls: 0 out of 10
  Number of Mobile Apex push calls: 0 out of 10

19:41:15.946|CUMULATIVE_LIMIT_USAGE_END

19:41:15.189 (189846151)|CODE_UNIT_FINISHED|VF: /apex/Email_OptIn
19:41:15.191 (191580457)|EXECUTION_FINISHED

Any and all help is much appreciated.  Thank you.