• Tye Harrison
  • NEWBIE
  • 0 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 4
    Replies
I have two VF pages. They are both controlled by an Apex class. The first page has many prepopulated fields that the user can change. The second page is a differently layed out page using the updated data but saved as a PDF attachment. I would post but it's over 1000 lines of code.

My situation/question is this:
The user edits the first VF page and clicks submit. Once the data passes some sanity checks it is saved. I can see all of these saved values in the Apex controller in the System.debug logs I generate. All values are the expected values from the user edits.
However, when I generate/save the PDF, all the values are correct *except* the values from two picklists (which are country code address single picklists). These values appear in the PDF page as the value that was previously on the user editable page (in other words, the value *before* the user edited the page). The strange thing is that when I look at the incorrect values/variables in the debug, they are the update values. I am calling the PDF generation code immediately after the above mentioned System.debug.
So, does anyone have an idea why the original values from the first VF page are used instead of the updated values I see in the logs? All the other values are the updated values.

I can try to post code snippets if needed but it's a lot to post here. 
I am getting a "Syntax Error. Missing ')' " with the code below and have not got a clue why.
The issue has something to do with the IF statement inside the value attribute (around line 30) but if I replace the condition with something really simple like 0<1 I get no syntax error.
I left in a couple of commented out lines as an example of what I'm ultimately trying to accomplish.
Just let me know any other questions you have or details you need.
Thank you.

<messaging:emailTemplate subject="Statement" recipientType="Contact" relatedToType="c2g__codaMassEmailAccount__c">
    <messaging:htmlEmailBody >
        <p align="center">
            <img src="{!relatedTo.c2g__OwnerCompany__r.c2g__LogoURL__c}"/><br/>
            <small><apex:outputField value="{!relatedTo.c2g__OwnerCompany__r.c2g__Street__c}"/><br/>
            <apex:outputField value="{!relatedTo.c2g__OwnerCompany__r.c2g__City__c}"/><apex:outputText value=", "/><apex:outputField value="{!relatedTo.c2g__OwnerCompany__r.c2g__StateProvince__c}"/><br/>
            <apex:outputField value="{!relatedTo.c2g__OwnerCompany__r.c2g__ZipPostCode__c}"/><br/>
            <apex:outputField value="{!relatedTo.c2g__OwnerCompany__r.c2g__Country__c}"/><br/>
            <apex:outputText value="Phone: "/><apex:outputField value="{!relatedTo.c2g__OwnerCompany__r.c2g__Phone__c}"/><apex:outputText value=" Fax: "/><apex:outputField value="{!relatedTo.c2g__OwnerCompany__r.c2g__Fax__c}"/><br/><br/></small>
        </p>
        <p>
            <c2g:CODAFormatterController date="{!TODAY()}"/>
            <br/><br/>
            <apex:outputField value="{!relatedTo.c2g__Account__r.Name}"/>
            <br/><br/>
            Hello,
            <br/><br/>
            Please find attached a statement of your account with us. We would appreciate prompt payment of these items.
        </p>
        <br/><br/>
        <apex:dataTable value="{!relatedTo.c2g__MassEmailAccountLineItems__r}" var="line" border="1" cellpadding="3">
            <apex:column style="text-align:left"   headervalue="Document Type"      value="{!line.c2g__Transaction__r.c2g__TransactionType__c}"/>
            <apex:column style="text-align:left"   headervalue="Document Number"    value="{!line.c2g__Transaction__r.c2g__DocumentNumber__c}"/>
            <apex:column style="text-align:left"   headervalue="Document Reference" value="{!line.c2g__Transaction__r.c2g__DocumentReference__c}"/>
            <apex:column style="text-align:center" headervalue="Due Date"           value="{!line.c2g__DueDate__c}"/>

            <apex:column style="text-align:left"   headervalue="Currency"           value="{!line.c2g__TransactionLineItem__r.c2g__DocumentCurrency__r.Name}"/>


            <apex:column style="text-align:left"   headervalue="Debit"              value="{!IF(0 < line.c2g__DocumentOutstandingValue__c, 0,1)}" />
            <apex:column style="text-align:left"   headervalue="Credit"              value="{!line.c2g__DocumentOutstandingValue__c}"/>
        

<!--
            <apex:column style="text-align:left"   headervalue="Credit"             value="{!IF(line.c2g__DocumentOutstandingValue__c<0, ABS(line.c2g__DocumentOutstandingValue__c), 0)}" />
-->
        </apex:dataTable>

        <br/>
        <!--
            <apex:column style="text-align:right"  headervalue="Outstanding Amount"><c2g:CODAFormatterController number="{!IF(line.c2g__Transaction__r.c2g__TransactionType__c!='Journal',ABS(line.c2g__DocumentOutstandingValue__c),line.c2g__DocumentOutstandingValue__c)}" currency="{!line.c2g__TransactionLineItem__r.c2g__DocumentCurrency__r.Name}"/>
        -->
        <p>
            If you have any questions about this payment please do not hesitate to contact us.    
            <br/><br/>
            Thank you,
            <br/><br/>
            {!$User.FirstName} {!$User.LastName}
        </p>
    </messaging:htmlEmailBody>
</messaging:emailTemplate>
I have two VF pages. They are both controlled by an Apex class. The first page has many prepopulated fields that the user can change. The second page is a differently layed out page using the updated data but saved as a PDF attachment. I would post but it's over 1000 lines of code.

My situation/question is this:
The user edits the first VF page and clicks submit. Once the data passes some sanity checks it is saved. I can see all of these saved values in the Apex controller in the System.debug logs I generate. All values are the expected values from the user edits.
However, when I generate/save the PDF, all the values are correct *except* the values from two picklists (which are country code address single picklists). These values appear in the PDF page as the value that was previously on the user editable page (in other words, the value *before* the user edited the page). The strange thing is that when I look at the incorrect values/variables in the debug, they are the update values. I am calling the PDF generation code immediately after the above mentioned System.debug.
So, does anyone have an idea why the original values from the first VF page are used instead of the updated values I see in the logs? All the other values are the updated values.

I can try to post code snippets if needed but it's a lot to post here. 
I am getting a "Syntax Error. Missing ')' " with the code below and have not got a clue why.
The issue has something to do with the IF statement inside the value attribute (around line 30) but if I replace the condition with something really simple like 0<1 I get no syntax error.
I left in a couple of commented out lines as an example of what I'm ultimately trying to accomplish.
Just let me know any other questions you have or details you need.
Thank you.

<messaging:emailTemplate subject="Statement" recipientType="Contact" relatedToType="c2g__codaMassEmailAccount__c">
    <messaging:htmlEmailBody >
        <p align="center">
            <img src="{!relatedTo.c2g__OwnerCompany__r.c2g__LogoURL__c}"/><br/>
            <small><apex:outputField value="{!relatedTo.c2g__OwnerCompany__r.c2g__Street__c}"/><br/>
            <apex:outputField value="{!relatedTo.c2g__OwnerCompany__r.c2g__City__c}"/><apex:outputText value=", "/><apex:outputField value="{!relatedTo.c2g__OwnerCompany__r.c2g__StateProvince__c}"/><br/>
            <apex:outputField value="{!relatedTo.c2g__OwnerCompany__r.c2g__ZipPostCode__c}"/><br/>
            <apex:outputField value="{!relatedTo.c2g__OwnerCompany__r.c2g__Country__c}"/><br/>
            <apex:outputText value="Phone: "/><apex:outputField value="{!relatedTo.c2g__OwnerCompany__r.c2g__Phone__c}"/><apex:outputText value=" Fax: "/><apex:outputField value="{!relatedTo.c2g__OwnerCompany__r.c2g__Fax__c}"/><br/><br/></small>
        </p>
        <p>
            <c2g:CODAFormatterController date="{!TODAY()}"/>
            <br/><br/>
            <apex:outputField value="{!relatedTo.c2g__Account__r.Name}"/>
            <br/><br/>
            Hello,
            <br/><br/>
            Please find attached a statement of your account with us. We would appreciate prompt payment of these items.
        </p>
        <br/><br/>
        <apex:dataTable value="{!relatedTo.c2g__MassEmailAccountLineItems__r}" var="line" border="1" cellpadding="3">
            <apex:column style="text-align:left"   headervalue="Document Type"      value="{!line.c2g__Transaction__r.c2g__TransactionType__c}"/>
            <apex:column style="text-align:left"   headervalue="Document Number"    value="{!line.c2g__Transaction__r.c2g__DocumentNumber__c}"/>
            <apex:column style="text-align:left"   headervalue="Document Reference" value="{!line.c2g__Transaction__r.c2g__DocumentReference__c}"/>
            <apex:column style="text-align:center" headervalue="Due Date"           value="{!line.c2g__DueDate__c}"/>

            <apex:column style="text-align:left"   headervalue="Currency"           value="{!line.c2g__TransactionLineItem__r.c2g__DocumentCurrency__r.Name}"/>


            <apex:column style="text-align:left"   headervalue="Debit"              value="{!IF(0 < line.c2g__DocumentOutstandingValue__c, 0,1)}" />
            <apex:column style="text-align:left"   headervalue="Credit"              value="{!line.c2g__DocumentOutstandingValue__c}"/>
        

<!--
            <apex:column style="text-align:left"   headervalue="Credit"             value="{!IF(line.c2g__DocumentOutstandingValue__c<0, ABS(line.c2g__DocumentOutstandingValue__c), 0)}" />
-->
        </apex:dataTable>

        <br/>
        <!--
            <apex:column style="text-align:right"  headervalue="Outstanding Amount"><c2g:CODAFormatterController number="{!IF(line.c2g__Transaction__r.c2g__TransactionType__c!='Journal',ABS(line.c2g__DocumentOutstandingValue__c),line.c2g__DocumentOutstandingValue__c)}" currency="{!line.c2g__TransactionLineItem__r.c2g__DocumentCurrency__r.Name}"/>
        -->
        <p>
            If you have any questions about this payment please do not hesitate to contact us.    
            <br/><br/>
            Thank you,
            <br/><br/>
            {!$User.FirstName} {!$User.LastName}
        </p>
    </messaging:htmlEmailBody>
</messaging:emailTemplate>