• fb123
  • NEWBIE
  • 25 Points
  • Member since 2008

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 8
    Replies

Visualforce is adding some Javascript to my email templates that gets displayed in the Activity History and also in at least one email client out on the 'net. The content of the script doesn't even look like it is essential to the template.

 

First, the code as it appears in my .email file:

 

<apex:repeat var="cx" value="{!relatedTo.OpportunityLineItems}">
<tr>
<td>{!cx.PricebookEntry.product2.description}</td>
<td><div align="right"><apex:outputField value="{!cx.UnitPrice}"/></div></td>
<td><div align="right"><apex:outputField value="{!cx.Quantity}"/></div></td>
<td>&nbsp;</td>
</tr>
</apex:repeat>

 

 Pretty straightforward usage, just building a dynamic table of Opportunity Products.

The HTML and Javascript that appears for that exact same portion, when repeated twice for two records, is:

 

<tr>
<td>mCLASS&reg;:DIBELS&reg; Software Annual Student Subscription</td>
<td><div align="right"><script type="text/javascript"> if(!window.sfdcPage){window.sfdcPage = new ApexPage();}
UserContext.initialize({'locale':'en_US','timeFormat':'h:mm a','today':'5\/19\/2009 6:09 PM','userPreferences':[{'value':true,'index':112,'name':'HideInlineEditSplash'}
,{'value':true,'index':114,'name':'OverrideTaskSendNotification'}
,{'value':false,'index':115,'name':'DefaultTaskSendNotification'}
,{'value':false,'index':119,'name':'HideUserLayoutStdFieldInfo'}
,{'value':false,'index':116,'name':'HideRPPWarning'}
,{'value':false,'index':87,'name':'HideInlineSchedulingSplash'}
,{'value':false,'index':88,'name':'HideCRUCNotification'}
,{'value':true,'index':89,'name':'HideNewPLESplash'}
,{'value':false,'index':90,'name':'HideNewPLEWarnIE6'}
,{'value':false,'index':122,'name':'HideOverrideSharingMessage'}
],'startOfWeek':'1','isAccessibleMode':false,'ampm':['AM','PM'],'userId':'00530000000pvUP','dateTimeFormat':'M\/d\/yyyy h:mm a','dateFormat':'M\/d\/yyyy','language':'en_US','siteUrlPrefix':''}
);
</script><span id="j_id0:emailTemplate:j_id3:j_id4:j_id16:0:j_id20">$6.00</span></div></td>
<td><div align="right"><span id="j_id0:emailTemplate:j_id3:j_id4:j_id16:0:j_id22">100.00</span></div></td>
<td>&#160;</td>
</tr>

<tr>
<td>mCLASS&reg; Platform Annual Student Subscription</td>
<td><div align="right"><span id="j_id0:emailTemplate:j_id3:j_id4:j_id16:1:j_id20">$8.00</span></div></td>
<td><div align="right"><span id="j_id0:emailTemplate:j_id3:j_id4:j_id16:1:j_id22">100.00</span></div></td>
<td>&#160;</td>
</tr>

 

I know that Visualforce processes the code and converts it to HTML, but I just cannot figure out what purpose this <script> has:

<script type="text/javascript"> if(!window.sfdcPage){window.sfdcPage = new ApexPage();}
UserContext.initialize({'locale':'en_US','timeFormat':'h:mm a','today':'5\/19\/2009 6:09 PM','userPreferences':[{'value':true,'index':112,'name':'HideInlineEditSplash'}
,{'value':true,'index':114,'name':'OverrideTaskSendNotification'}
,{'value':false,'index':115,'name':'DefaultTaskSendNotification'}
,{'value':false,'index':119,'name':'HideUserLayoutStdFieldInfo'}
,{'value':false,'index':116,'name':'HideRPPWarning'}
,{'value':false,'index':87,'name':'HideInlineSchedulingSplash'}
,{'value':false,'index':88,'name':'HideCRUCNotification'}
,{'value':true,'index':89,'name':'HideNewPLESplash'}
,{'value':false,'index':90,'name':'HideNewPLEWarnIE6'}
,{'value':false,'index':122,'name':'HideOverrideSharingMessage'}
],'startOfWeek':'1','isAccessibleMode':false,'ampm':['AM','PM'],'userId':'00530000000pvUP','dateTimeFormat':'M\/d\/yyyy h:mm a','dateFormat':'M\/d\/yyyy','language':'en_US','siteUrlPrefix':''}
);
</script>

 


Anyone else seen this in their Visualforce templates? Is it normal and I just have to accept that crappier email clients can't deal with JS in the <body>? I find it suspicious that it shows up in Task rendition of the Activity History.

 

Thanks for shedding any light you can,

Luke C

 

 

Message Edited by Always Thinkin on 05-22-2009 03:04 PM
Message Edited by Always Thinkin on 09-23-2009 11:05 AM

Hey all, 

 

I need your help with trying to create a function that sends emails on a recurring basis. I called support but they werent very clear on how I could do this, so I'm turning to you for help. 


My function should send an email to the assigned user every 2 hour if the case priority is high and the status is new

 

So far I've tried the following but I believe it will not work:

 

 

trigger alertUser on Case (after update, after insert) {
datetime now = datetime.now();
datetime created = case.Createddate;
If (math.mod(datetime.getTime(created)  -  datetime.getTime(now), 7200000) == 0){
//send email
}
} 

 Thanks in advance

 

I am getting an error when trying to reference a SelectObject component inside of a Visualforce function.  The following code sample, which attempts to set the default value in a dropdown based on an input parameter, demonstrates the issue.  

 

Visualforce Page:

 

 

<apex:page controller="Bug">

<form action="{!$Page.bug}">

<select name="selected">

<apex:repeat value="{!selectOptions}" var="o">

<option value="{!o.value}" {!IF(o.value = selected, 'selected', '')}>

{!o.label}

</option>

</apex:repeat>

</select>

<input type="submit" value="Go!"/>

</form></apex:page>

 

 

Controller Class:

 

public class Bug {

public List<SelectOption> selectOptions {get; set;}

public String selected {get; set;}

public Bug()

{

selectOptions = new List<SelectOption>();

selectOptions.add(new SelectOption('S1', 'Select One'));

selectOptions.add(new SelectOption('S2', 'Select Two'));

selectOptions.add(new SelectOption('S3', 'Select Three'));

selected = ApexPages.currentPage().getParameters().get('selected');

}

}

 

 

 I get the following error when I try to compile the Visualforce page:

 

Save error: Incorrect parameter for function =(). Expected Object, received Text

 

For whatever reason,  the compiler seems to be think SelectObject.getValue() returns an Object rather than a String.  

 

Interestingly enough, when I swap out the controller with the following functionally identical controller, the Visualforce page compiles without issue:

 

 

public class Bug {

public List<CustomSelectOption> selectOptions {get; set;}

public String selected {get; set;}

 

public class CustomSelectOption

{

public String value {get; set;}

public String label {get; set;}

public CustomSelectOption(String value, String label)

{

this.value = value;

this.label = label;

}

}

 

public Bug()

{

selectOptions = new List<CustomSelectOption>();

selectOptions.add(new CustomSelectOption('S1', 'Select One'));

selectOptions.add(new CustomSelectOption('S2', 'Select Two'));

selectOptions.add(new CustomSelectOption('S3', 'Select Three'));

 

selected = ApexPages.currentPage().getParameters().get('selected');

}

}

 

 

 

Any ideas here?  Obviously there is a simple workaround here - but it seems to me that the original code should have compiled just fine.  

 

Thanks,

Greg 

Message Edited by glorge on 03-08-2010 03:05 PM
Message Edited by glorge on 03-08-2010 03:06 PM
  • March 08, 2010
  • Like
  • 0

How does a before "Rule Trigger Date" work on time dependent workflow? I thought it wouldn't let me create it but it did so i'm curious if there is a condition that will actually make this rung?

 

Thanks 

  • February 22, 2010
  • Like
  • 0

Visualforce is adding some Javascript to my email templates that gets displayed in the Activity History and also in at least one email client out on the 'net. The content of the script doesn't even look like it is essential to the template.

 

First, the code as it appears in my .email file:

 

<apex:repeat var="cx" value="{!relatedTo.OpportunityLineItems}">
<tr>
<td>{!cx.PricebookEntry.product2.description}</td>
<td><div align="right"><apex:outputField value="{!cx.UnitPrice}"/></div></td>
<td><div align="right"><apex:outputField value="{!cx.Quantity}"/></div></td>
<td>&nbsp;</td>
</tr>
</apex:repeat>

 

 Pretty straightforward usage, just building a dynamic table of Opportunity Products.

The HTML and Javascript that appears for that exact same portion, when repeated twice for two records, is:

 

<tr>
<td>mCLASS&reg;:DIBELS&reg; Software Annual Student Subscription</td>
<td><div align="right"><script type="text/javascript"> if(!window.sfdcPage){window.sfdcPage = new ApexPage();}
UserContext.initialize({'locale':'en_US','timeFormat':'h:mm a','today':'5\/19\/2009 6:09 PM','userPreferences':[{'value':true,'index':112,'name':'HideInlineEditSplash'}
,{'value':true,'index':114,'name':'OverrideTaskSendNotification'}
,{'value':false,'index':115,'name':'DefaultTaskSendNotification'}
,{'value':false,'index':119,'name':'HideUserLayoutStdFieldInfo'}
,{'value':false,'index':116,'name':'HideRPPWarning'}
,{'value':false,'index':87,'name':'HideInlineSchedulingSplash'}
,{'value':false,'index':88,'name':'HideCRUCNotification'}
,{'value':true,'index':89,'name':'HideNewPLESplash'}
,{'value':false,'index':90,'name':'HideNewPLEWarnIE6'}
,{'value':false,'index':122,'name':'HideOverrideSharingMessage'}
],'startOfWeek':'1','isAccessibleMode':false,'ampm':['AM','PM'],'userId':'00530000000pvUP','dateTimeFormat':'M\/d\/yyyy h:mm a','dateFormat':'M\/d\/yyyy','language':'en_US','siteUrlPrefix':''}
);
</script><span id="j_id0:emailTemplate:j_id3:j_id4:j_id16:0:j_id20">$6.00</span></div></td>
<td><div align="right"><span id="j_id0:emailTemplate:j_id3:j_id4:j_id16:0:j_id22">100.00</span></div></td>
<td>&#160;</td>
</tr>

<tr>
<td>mCLASS&reg; Platform Annual Student Subscription</td>
<td><div align="right"><span id="j_id0:emailTemplate:j_id3:j_id4:j_id16:1:j_id20">$8.00</span></div></td>
<td><div align="right"><span id="j_id0:emailTemplate:j_id3:j_id4:j_id16:1:j_id22">100.00</span></div></td>
<td>&#160;</td>
</tr>

 

I know that Visualforce processes the code and converts it to HTML, but I just cannot figure out what purpose this <script> has:

<script type="text/javascript"> if(!window.sfdcPage){window.sfdcPage = new ApexPage();}
UserContext.initialize({'locale':'en_US','timeFormat':'h:mm a','today':'5\/19\/2009 6:09 PM','userPreferences':[{'value':true,'index':112,'name':'HideInlineEditSplash'}
,{'value':true,'index':114,'name':'OverrideTaskSendNotification'}
,{'value':false,'index':115,'name':'DefaultTaskSendNotification'}
,{'value':false,'index':119,'name':'HideUserLayoutStdFieldInfo'}
,{'value':false,'index':116,'name':'HideRPPWarning'}
,{'value':false,'index':87,'name':'HideInlineSchedulingSplash'}
,{'value':false,'index':88,'name':'HideCRUCNotification'}
,{'value':true,'index':89,'name':'HideNewPLESplash'}
,{'value':false,'index':90,'name':'HideNewPLEWarnIE6'}
,{'value':false,'index':122,'name':'HideOverrideSharingMessage'}
],'startOfWeek':'1','isAccessibleMode':false,'ampm':['AM','PM'],'userId':'00530000000pvUP','dateTimeFormat':'M\/d\/yyyy h:mm a','dateFormat':'M\/d\/yyyy','language':'en_US','siteUrlPrefix':''}
);
</script>

 


Anyone else seen this in their Visualforce templates? Is it normal and I just have to accept that crappier email clients can't deal with JS in the <body>? I find it suspicious that it shows up in Task rendition of the Activity History.

 

Thanks for shedding any light you can,

Luke C

 

 

Message Edited by Always Thinkin on 05-22-2009 03:04 PM
Message Edited by Always Thinkin on 09-23-2009 11:05 AM
I want to add a contact lookup field to Opportunity object so that I know which contacts related to an Account relate to that Opportunity. This means that when I select the lookup button I want the system to onkly lookup contacts related to that Account.
 
Would I somehow have to limit the lookup list with the use of Apex code?
 
Thanks
 
Stephen
Is there a way to use formulas in Email templates to handle conditional formatting?

For example, I'd like to use the formula UPPER( NAME HERE ) to cause the person's name to appear in all CAPS, even though it may appear as "Name Here" in the SFDC database. This is just one example.

Furthermore, there may be conditions upon which you do or do not want to show certain information in an email response. Using formulas would be helpful. I didn't see any documentation on this when search for "formulas in email templates" -- so I'm not sure if it's possible.

Thanks.