• JimInSRQ
  • NEWBIE
  • 25 Points
  • Member since 2017
  • Tech Service Mgr, Part time SFDC Admin
  • Clare Controls

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 7
    Questions
  • 6
    Replies

Hi,

I have a VF email where relatedToType="Account".  I am able to get a list of all contact for the account associated with the email using the following...
 

<table border="1">
        
        <apex:repeat var="cx" value="{!relatedTo.Contacts}">
        
                       
            <tr style='border-bottom: 1px solid #ddd;'>
                <th style="width:150px" align="Right">Name:</th><td valign="center" align="left">{!cx.FirstName} {!cx.LastName}</td>
            </tr>  
            
            
            </apex:repeat>
</table>

What I need to do is return a specfic record instead of the entire list using an IF statement.  
 
if(!relatedTo.Contacts.Dealer_Primary_Contact__c  == true){
}

Unfortunately I am both unable to get the correct syntax as the if statement simply diaplays in the result as text and I still get the entire list.  Any guidance/help is greatly appreciated. 

Thank you!!

Visualforce Email with APEX lookup, need to find record with specific value. Related to type = Accounts.

I'm trying to find specific contacts using APEX code, but I need the results to list only contact records on which a specific field (Checkbox) = True.  As I'm still new to VF and Apex I'm not sure how to define the if value and I've had no luck searching.

The field is called "Dealer_Authorizer__c", I want only those records where Dealer_Authorizer__c=true.  How do I define that in the following code which returns all contact records...

 

<table border="1">
        
        <apex:repeat var="cx" value="{!relatedTo.Contacts}">
        
        <tr>
            <td>Name:</td><td valign="center" align="left">{!cx.FirstName} {!cx.LastName}</td>
        </tr>

        </apex:repeat>
</table>

I have a custom date field to which I want to add 3 business days.
The field starts out blank on all new records and is updated via a workflow. 
If the field has a date in it, I want to add to the existing date. 
There are instances when the date will be reset to null and updated again based on another workflow.
The logic to this works fine until I put in the IF statement
To simplify my testing I created tested each of the following formulas in the field update.
 

IF( ISNULL(Pending_Next_Follow_up_Date__c ) ,TODAY()+3 , 
TODAY()- 3)
IF( ISBLANK(Pending_Next_Follow_up_Date__c ) ,TODAY()+3 , 
TODAY()- 3)
Regardless of what I do, the IF ISNULL and ISBLANK always seems to return a false and sets the date to TODAY()-3
The actual forumula is as follows, it just never works for null and I've tried both ISNULL and ISBLANK
IF( ISBLANK(Pending_Next_Follow_up_Date__c ) , 
CASE( 
MOD( TODAY() - DATE( 1900, 1, 7 ), 7 ), 
3, TODAY()+ 2 + 3, 
4, TODAY()+ 2 + 3, 
5, TODAY()+ 2 + 3, 
6, TODAY()+ 1 + 3, 
TODAY()+ 3 
), 
CASE( 
MOD( Pending_Next_Follow_up_Date__c - DATE( 1900, 1, 7 ), 7 ), 
3, Pending_Next_Follow_up_Date__c + 2 + 3, 
4, Pending_Next_Follow_up_Date__c + 2 + 3, 
5, Pending_Next_Follow_up_Date__c + 2 + 3, 
6, Pending_Next_Follow_up_Date__c + 1 + 3, 
Pending_Next_Follow_up_Date__c + 3 
))


 

There is also the occasion where another workflow will do a field update and change the date field to null.  What I'm findin

I have a VF Email on which I want to output the text "Backup restored from backup dated" {!relatedTo.ZWave_Date_of_Backup__c} if the checkbox {!relatedTo.ZWave_Backup_Restored__c} = True.  Not sure of the syntax.   This works...
{!if(relatedto.ZWave_Backup_Restored__c, (relatedTo.ZWave_Date_of_Backup__c), "No Backup to restore")}
but when true, I need to concatenate "Was restored from backup created on " with (relatedTo.ZWave_Date_of_Backup__c),  using this syntax I get an error Syntax error. Missing ')
{!if(relatedto.ZWave_Backup_Restored__c, "Were restored with backup from " AND (relatedTo.ZWave_Date_of_Backup__c), "No Backup to restore")}
OR 
{!if(relatedto.ZWave_Backup_Restored__c, "Were restored with backup from " (relatedTo.ZWave_Date_of_Backup__c), "No Backup to restore")}
using this syntax I get an error Incorrect parameter type for operator '&'. Expected Text, received Date
{!if(relatedto.ZWave_Backup_Restored__c, "Were restored with backup from " & (relatedTo.ZWave_Date_of_Backup__c), "No Backup to restore")}

 

I have the following which returns a date in my VF email, but I want to display that date + 3 days.  No search I've tried is yielding any results.
 

{!relatedTo.HW_Received_Complete_Date__c}
 

Thanks

I have two custom objects, a parent and a child.  I have a requirement to be able to clone the child object record.  

  • The Clone button is avialable when I edit the page layout, but is not visible on the live layout.
  • I have searched for a permission I may have missed but am having no luck.  
  • The child object records are not governed by record types.
  • I do not need a custom clone button, I simply want to clone the record and edit where required.
Looking forward to your response.

 

I have two custom objects, RMA (Parent) and RMA Device (Child).  I'm trying to use apex:repeat in a VF email template to list the all Devices in RMA Device related to RMA.  I receive "Error: Invalid field RMA_Device__c for SObject RMA__c", when trying to save the template.
 
RMA_Device__c is the API name for the child object.

Below is the entire code set for the template
 
<messaging:emailTemplate subject="Return Material Authorization" recipientType="Contact" relatedToType="RMA__c">

<messaging:htmlEmailBody >
<html>
<div style='width:800px;margin:auto;' >
<body>
<p>This is a list of all RMA Devices related to: {!relatedTo.name}</p>
    <table border="0" >
        <tr>
            <th style="width:175px" align="left">RMA Dev ID</th>
            <th style="width:175px" align="left">Part Number</th>
            <th style="width:175px" align="left">Serial</th>
            <th style="width:275px" align="left">RMA Category</th>
        </tr>
        
        <apex:repeat var="cx" value="{!relatedTo.RMA_Device__c}">
        
        <tr>
            <td><a href = "https://***yourInstance***.salesforce.com/{!cx.id}">{!cx.Name}
            </a></td>
            <td>{!cx.Part_Number__c}</td>
            <td>{!cx.Contact.Serial__c}</td>
            <td>{!cx.RMA_Category__c}</td>
        </tr>
        
        </apex:repeat>
    </table>
    <p/>
    <center>
    <apex:outputLink value="http://www.salesforce.com">
    For more detailed information login to Salesforce.com
    </apex:outputLink>
    </center>
</body>
</div>
</html>
</messaging:htmlEmailBody>


<messaging:plainTextEmailBody >
Congratulations!
This is your new Visualforce Email Template.
</messaging:plainTextEmailBody>
</messaging:emailTemplate>


 

Hi,

I have a VF email where relatedToType="Account".  I am able to get a list of all contact for the account associated with the email using the following...
 

<table border="1">
        
        <apex:repeat var="cx" value="{!relatedTo.Contacts}">
        
                       
            <tr style='border-bottom: 1px solid #ddd;'>
                <th style="width:150px" align="Right">Name:</th><td valign="center" align="left">{!cx.FirstName} {!cx.LastName}</td>
            </tr>  
            
            
            </apex:repeat>
</table>

What I need to do is return a specfic record instead of the entire list using an IF statement.  
 
if(!relatedTo.Contacts.Dealer_Primary_Contact__c  == true){
}

Unfortunately I am both unable to get the correct syntax as the if statement simply diaplays in the result as text and I still get the entire list.  Any guidance/help is greatly appreciated. 

Thank you!!

Visualforce Email with APEX lookup, need to find record with specific value. Related to type = Accounts.

I'm trying to find specific contacts using APEX code, but I need the results to list only contact records on which a specific field (Checkbox) = True.  As I'm still new to VF and Apex I'm not sure how to define the if value and I've had no luck searching.

The field is called "Dealer_Authorizer__c", I want only those records where Dealer_Authorizer__c=true.  How do I define that in the following code which returns all contact records...

 

<table border="1">
        
        <apex:repeat var="cx" value="{!relatedTo.Contacts}">
        
        <tr>
            <td>Name:</td><td valign="center" align="left">{!cx.FirstName} {!cx.LastName}</td>
        </tr>

        </apex:repeat>
</table>

I have a custom date field to which I want to add 3 business days.
The field starts out blank on all new records and is updated via a workflow. 
If the field has a date in it, I want to add to the existing date. 
There are instances when the date will be reset to null and updated again based on another workflow.
The logic to this works fine until I put in the IF statement
To simplify my testing I created tested each of the following formulas in the field update.
 

IF( ISNULL(Pending_Next_Follow_up_Date__c ) ,TODAY()+3 , 
TODAY()- 3)
IF( ISBLANK(Pending_Next_Follow_up_Date__c ) ,TODAY()+3 , 
TODAY()- 3)
Regardless of what I do, the IF ISNULL and ISBLANK always seems to return a false and sets the date to TODAY()-3
The actual forumula is as follows, it just never works for null and I've tried both ISNULL and ISBLANK
IF( ISBLANK(Pending_Next_Follow_up_Date__c ) , 
CASE( 
MOD( TODAY() - DATE( 1900, 1, 7 ), 7 ), 
3, TODAY()+ 2 + 3, 
4, TODAY()+ 2 + 3, 
5, TODAY()+ 2 + 3, 
6, TODAY()+ 1 + 3, 
TODAY()+ 3 
), 
CASE( 
MOD( Pending_Next_Follow_up_Date__c - DATE( 1900, 1, 7 ), 7 ), 
3, Pending_Next_Follow_up_Date__c + 2 + 3, 
4, Pending_Next_Follow_up_Date__c + 2 + 3, 
5, Pending_Next_Follow_up_Date__c + 2 + 3, 
6, Pending_Next_Follow_up_Date__c + 1 + 3, 
Pending_Next_Follow_up_Date__c + 3 
))


 

There is also the occasion where another workflow will do a field update and change the date field to null.  What I'm findin

I have the following which returns a date in my VF email, but I want to display that date + 3 days.  No search I've tried is yielding any results.
 

{!relatedTo.HW_Received_Complete_Date__c}
 

Thanks

I have two custom objects, a parent and a child.  I have a requirement to be able to clone the child object record.  

  • The Clone button is avialable when I edit the page layout, but is not visible on the live layout.
  • I have searched for a permission I may have missed but am having no luck.  
  • The child object records are not governed by record types.
  • I do not need a custom clone button, I simply want to clone the record and edit where required.
Looking forward to your response.

 

I have two custom objects, RMA (Parent) and RMA Device (Child).  I'm trying to use apex:repeat in a VF email template to list the all Devices in RMA Device related to RMA.  I receive "Error: Invalid field RMA_Device__c for SObject RMA__c", when trying to save the template.
 
RMA_Device__c is the API name for the child object.

Below is the entire code set for the template
 
<messaging:emailTemplate subject="Return Material Authorization" recipientType="Contact" relatedToType="RMA__c">

<messaging:htmlEmailBody >
<html>
<div style='width:800px;margin:auto;' >
<body>
<p>This is a list of all RMA Devices related to: {!relatedTo.name}</p>
    <table border="0" >
        <tr>
            <th style="width:175px" align="left">RMA Dev ID</th>
            <th style="width:175px" align="left">Part Number</th>
            <th style="width:175px" align="left">Serial</th>
            <th style="width:275px" align="left">RMA Category</th>
        </tr>
        
        <apex:repeat var="cx" value="{!relatedTo.RMA_Device__c}">
        
        <tr>
            <td><a href = "https://***yourInstance***.salesforce.com/{!cx.id}">{!cx.Name}
            </a></td>
            <td>{!cx.Part_Number__c}</td>
            <td>{!cx.Contact.Serial__c}</td>
            <td>{!cx.RMA_Category__c}</td>
        </tr>
        
        </apex:repeat>
    </table>
    <p/>
    <center>
    <apex:outputLink value="http://www.salesforce.com">
    For more detailed information login to Salesforce.com
    </apex:outputLink>
    </center>
</body>
</div>
</html>
</messaging:htmlEmailBody>


<messaging:plainTextEmailBody >
Congratulations!
This is your new Visualforce Email Template.
</messaging:plainTextEmailBody>
</messaging:emailTemplate>