• jo dev
  • NEWBIE
  • 29 Points
  • Member since 2014

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 2
    Questions
  • 8
    Replies
Hi folks,
           Can anyone tell me how to execute Soql in java script(VisualforcePage) and gine me the some example



Thanks in advance
Karthick


<apex:page controller="sample" tabstyle="sampletab__tab">
<script type="text/javascript">
  location.href = '/jodev19/0019000000vh5Xh';
</script>
</apex:page>
i tried this one..But the tab style didn't work after reloading the page...Any idea??
  • August 14, 2014
  • Like
  • 0
Hi,

(level1 is parent of level2)
[level1 only having relationship with level2….not with other objects]

(level2 is parent of level3)
[level2 only having relationship with level3….not with other objects]

(level3 is parent of level4)
[level3 only having relationship with level4….not with other objects]

(level4 is parent of level5)
[level4 only having relationship with level5….not with other objects]

(level5 is parent of level6)
[level5 only having relationship with level6….not with other objects]

I Want to dispaly records like below : In treeview structure 

Level1record
          level2record
                 level3record
                       level4record
                             level5record
                                   level6record

    
this is the only relationship between the objects…need to display all level records in tree view…
Hi folks,
           Can anyone tell me how to execute Soql in java script(VisualforcePage) and gine me the some example



Thanks in advance
Karthick
Please let me know how to display the SOQL query result in VF page in tabular form when the SOQL object type and the associated attributes are dynamic.




  • August 22, 2014
  • Like
  • 0


<apex:page controller="sample" tabstyle="sampletab__tab">
<script type="text/javascript">
  location.href = '/jodev19/0019000000vh5Xh';
</script>
</apex:page>
i tried this one..But the tab style didn't work after reloading the page...Any idea??
  • August 14, 2014
  • Like
  • 0
Hi,

(level1 is parent of level2)
[level1 only having relationship with level2….not with other objects]

(level2 is parent of level3)
[level2 only having relationship with level3….not with other objects]

(level3 is parent of level4)
[level3 only having relationship with level4….not with other objects]

(level4 is parent of level5)
[level4 only having relationship with level5….not with other objects]

(level5 is parent of level6)
[level5 only having relationship with level6….not with other objects]

I Want to dispaly records like below : In treeview structure 

Level1record
          level2record
                 level3record
                       level4record
                             level5record
                                   level6record

    
this is the only relationship between the objects…need to display all level records in tree view…

Hello All,

Just want to share my experience in creating Visualforce Email template where you want to display date and time in User timezone

 

***Overview
You are in MST time zone.
Let's say we have Date/Time field TaskDateTime__c and use it in Visualforce email template to show recipient the time in email.

<apex:outputText value="{0,date,EEEE, MMMM d, yyyy, HH:mm:ss}"><apex:param value="{!RelatedTo.TaskDateTime__c}" /></apex:outputText>

 

In email time will be converted and showed to GMT instead of EST.

 

The outputField (which convert time to user locale automatically) does not
work in Visualforce Email templates (not supported).

 

So how do I tell to display in Visualforce Email template time in User
timezone? For example MST?

 

***Implementation Details (worarounds)***

 

I found two workarounds:

 

Workaround 1: Use Controller class for the Component to use in template

In order to format the date in various TimeZone in Email Template, we can follow the steps:

1. First create a Controller class for the Component

Setup|App Setup|Develop|Apex Classes|New

Formatted_DateTime_Controller Class Code
----------------------------------------------------------

public class controller_formatted_datetime
{
public DateTime date_time { get; set; } //property that reads the datetime value from component attribute tag
public String defined_format { get; set;} //property that reads the string value from component attribute tag
public String getFormattedDatetime()
{
if (date_time == null) {return ''; }
else { if (defined_format == null) {
return date_time.format(); //return the full date/time in user's locale and time zone
}
else { return date_time.format(defined_format,'MST'); //Specify Time zone like IST,CST
}}}}

 

2. Create a Component

Setup|App Setup|Develop|Components

VF Component Code (Name: VFEmailTempComp)

<apex:component access="global" controller="controller_formatted_datetime">{!FormattedDatetime}
<apex:attribute assignTo="{!date_time}" description="The DateTime value to be rendered" name="date_time_value" type="DateTime"></apex:attribute>
<apex:attribute assignTo="{!defined_format}" description="The optional format to use for the DateTime value to be rendered" name="date_time_format" type="String"></apex:attribute>
</apex:component>

 

 

3. Create an Email Template and embed the component.

Setup|Administration Setup|Communication Templates|Email Templates

Email Template Code
---------------------------------

<messaging:emailTemplate subject="Testing DateTime Format" recipientType="Contact" >
<messaging:plainTextEmailBody >
Formatted: <c:VFEmailTempComp date_time_value="{!NOW()}" date_time_format="EEE MMM d kk:mm:ss z yyyy" />
</messaging:plainTextEmailBody>
</messaging:emailTemplate>

 

It will display current time in MST timezone.


Workaround 2: Calculate difference in the apex:param value (for MST (-7) it will be 7/24=0.291666666

Date: <apex:outputText value="{0,date,EEEE, MMMM d, yyyy}"><apex:param value="{!RelatedTo.Scheduled_Clock_In__c - 0.291666666}" /></apex:outputText>
Time: <apex:outputText value="{0,date,h:ma}"><apex:param value="{!RelatedTo.Scheduled_Clock_In__c - 0.291666666}" /></apex:outputText> MST

  

  • August 28, 2012
  • Like
  • 4

Hello All,

Just want to share my experience in creating Visualforce Email template where you want to display date and time in User timezone

 

***Overview
You are in MST time zone.
Let's say we have Date/Time field TaskDateTime__c and use it in Visualforce email template to show recipient the time in email.

<apex:outputText value="{0,date,EEEE, MMMM d, yyyy, HH:mm:ss}"><apex:param value="{!RelatedTo.TaskDateTime__c}" /></apex:outputText>

 

In email time will be converted and showed to GMT instead of EST.

 

The outputField (which convert time to user locale automatically) does not
work in Visualforce Email templates (not supported).

 

So how do I tell to display in Visualforce Email template time in User
timezone? For example MST?

 

***Implementation Details (worarounds)***

 

I found two workarounds:

 

Workaround 1: Use Controller class for the Component to use in template

In order to format the date in various TimeZone in Email Template, we can follow the steps:

1. First create a Controller class for the Component

Setup|App Setup|Develop|Apex Classes|New

Formatted_DateTime_Controller Class Code
----------------------------------------------------------

public class controller_formatted_datetime
{
public DateTime date_time { get; set; } //property that reads the datetime value from component attribute tag
public String defined_format { get; set;} //property that reads the string value from component attribute tag
public String getFormattedDatetime()
{
if (date_time == null) {return ''; }
else { if (defined_format == null) {
return date_time.format(); //return the full date/time in user's locale and time zone
}
else { return date_time.format(defined_format,'MST'); //Specify Time zone like IST,CST
}}}}

 

2. Create a Component

Setup|App Setup|Develop|Components

VF Component Code (Name: VFEmailTempComp)

<apex:component access="global" controller="controller_formatted_datetime">{!FormattedDatetime}
<apex:attribute assignTo="{!date_time}" description="The DateTime value to be rendered" name="date_time_value" type="DateTime"></apex:attribute>
<apex:attribute assignTo="{!defined_format}" description="The optional format to use for the DateTime value to be rendered" name="date_time_format" type="String"></apex:attribute>
</apex:component>

 

 

3. Create an Email Template and embed the component.

Setup|Administration Setup|Communication Templates|Email Templates

Email Template Code
---------------------------------

<messaging:emailTemplate subject="Testing DateTime Format" recipientType="Contact" >
<messaging:plainTextEmailBody >
Formatted: <c:VFEmailTempComp date_time_value="{!NOW()}" date_time_format="EEE MMM d kk:mm:ss z yyyy" />
</messaging:plainTextEmailBody>
</messaging:emailTemplate>

 

It will display current time in MST timezone.


Workaround 2: Calculate difference in the apex:param value (for MST (-7) it will be 7/24=0.291666666

Date: <apex:outputText value="{0,date,EEEE, MMMM d, yyyy}"><apex:param value="{!RelatedTo.Scheduled_Clock_In__c - 0.291666666}" /></apex:outputText>
Time: <apex:outputText value="{0,date,h:ma}"><apex:param value="{!RelatedTo.Scheduled_Clock_In__c - 0.291666666}" /></apex:outputText> MST

  

  • August 28, 2012
  • Like
  • 4