• Suresh Dupada pdII
  • NEWBIE
  • 35 Points
  • Member since 2017

  • Chatter
    Feed
  • 1
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 4
    Replies
Hi,

I'd like some help trying to figure out the following. I am trying to build a visualforce email template that starts at object "case". "case" is a child object to parent object "Quote". I am attempting to do an <apex:repeat> in which I grab another child object "quote line items" which is child object to parent object "Quote". Is this possible? Here is my code:
 
<messaging:emailTemplate subject="Quote-to-Order Submission Received:{!relatedTo.Account}" recipientType="User" relatedToType="Case">
<messaging:htmlEmailBody>
<html>
    <body>
        <p>Dear {!relatedTo.Created_By_Quote__c},</p>
        <p>Thank you for submitting your quote-to-order request for Account Name: {!relatedTo.Account}. Your Case# is {!relatedTo.CaseNumber}. Below are you quote details: </p>
        
        <p><table border="1" cellpadding="5">
                        <tr > 
                            <th>Line Number</th><th>Part Number</th><th>Quantity</th><th>Unit Price</th><th>Line Total</th>
                        </tr>
                        <apex:repeat var="qline" value="{!relatedTo.Quote__r}">
                            <tr>
                            </tr>
                        </apex:repeat>                 
            </table>
        </p>
        
    </body>
</html>
</messaging:htmlEmailBody>
</messaging:emailTemplate>

 
Hi Folks,

Probem Description -
I have two difrrent class and diffrent visualforce. Earch class has findaddress() method.. and in the method I am trying to find the address based on user input..check the below class with method.

Question -
How to put the findaddress() logic in the helper method so that I can call in the both class without reating the same code..

something like this
findaddress(string streeaddress, string city, string zip ){

//?

}



Class A:
public PageReference Findaddress(){ 
        myaddress request = new myaddress (); //another class for address parameter
        String strSplittedAddress;
        //assign data
        if(project!=null && myproject.Street_Address__c!=''){  //myproject is an object instance
            strSplittedAddress=myProject.Street_Address__c;
         
            if(strSplittedAddress.contains(' ')){
                integer spaceIndex= strSplittedAddress.indexof(' ');
              
                String strHno=strSplittedAddress.subString(0,spaceIndex);
                              String strStreet=strSplittedAddress.subString(spaceIndex+1,strSplittedAddress.length());
               
                request.houseNumber = new List<String>{strHno};
               
            } else{
                ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR,'Please correct Number along with Street'));
            }
        }
        else{
         
            return null;
        }
        request.locality= new List<String>{myProject.City__c};
        request.province = new List<String>{myProject.State__c};
        request.postalCode = new List<String>{myProject.Zip__c};
        request.country = new List<String>{'United States'};

       //some other logic contiune 


Class B
 
public PageReference Findaddress(){ 
        myaddress request = new myaddress (); //another class for address parameter
        String strSplittedAddress;
        //assign data
        if(project!=null && anotherProject.Street_Address__c!=''){  //anotherProject is an object instance
            strSplittedAddress=anotherProject.Street_Address__c;
         
            if(strSplittedAddress.contains(' ')){
                integer spaceIndex= strSplittedAddress.indexof(' ');
              
                String strHno=strSplittedAddress.subString(0,spaceIndex);
                              String strStreet=strSplittedAddress.subString(spaceIndex+1,strSplittedAddress.length());
               
                request.houseNumber = new List<String>{strHno};
               
            } else{
                ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR,'Please correct Number along with Street'));
            }
        }
        else{
         
            return null;
        }
        request.locality= new List<String>{anotherProject.City__c};
        request.province = new List<String>{anotherProject.State__c};
        request.postalCode = new List<String>{anotherProject.Zip__c};
        request.country = new List<String>{'United States'};

       //some other logic contiune



 
Hi,

I'd like some help trying to figure out the following. I am trying to build a visualforce email template that starts at object "case". "case" is a child object to parent object "Quote". I am attempting to do an <apex:repeat> in which I grab another child object "quote line items" which is child object to parent object "Quote". Is this possible? Here is my code:
 
<messaging:emailTemplate subject="Quote-to-Order Submission Received:{!relatedTo.Account}" recipientType="User" relatedToType="Case">
<messaging:htmlEmailBody>
<html>
    <body>
        <p>Dear {!relatedTo.Created_By_Quote__c},</p>
        <p>Thank you for submitting your quote-to-order request for Account Name: {!relatedTo.Account}. Your Case# is {!relatedTo.CaseNumber}. Below are you quote details: </p>
        
        <p><table border="1" cellpadding="5">
                        <tr > 
                            <th>Line Number</th><th>Part Number</th><th>Quantity</th><th>Unit Price</th><th>Line Total</th>
                        </tr>
                        <apex:repeat var="qline" value="{!relatedTo.Quote__r}">
                            <tr>
                            </tr>
                        </apex:repeat>                 
            </table>
        </p>
        
    </body>
</html>
</messaging:htmlEmailBody>
</messaging:emailTemplate>