• Sylvie Serplet 1
  • NEWBIE
  • 10 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 10
    Replies
Hi,

I am trying to write a query to get a list of the last 5 cases from the contact in the current case. A Visualforce page will display this list in the Case layout. That is what I have come with but I could not make the In clause to work. Any ideas?
Select Id, CaseNumber, CreatedDate, Status, Subject, ContactId FROM Case Where ContactId In:.............. Order by CaseNumber DESC Limit 5

Thank you for your help.
Sylvie
I have created a calendar view in Salesforce using Full Calendar V2 in a Visualforce page. I have different types of events (standard and custom objects). All one day event works fine, but when I have multi days event it displays one day short on the calendar. I have made a lot of research without finding a solution that works for me. I do not need to works with time only date.  The code I use was done before the addition of Momentjs. I suspect this is to do about the way the date is calculated but could not figure it how. Any help will be greatly appreciate.

Please see below my controller (to limit the lenght of the code I have put only one type of event):
public class LeaveCalendar_Controller {
public list<calEvent> events {get;set;}
 String dtFormat = 'd MMM yyyy';
 public PageReference pageLoad() {
    events = new list<calEvent>();
//Get Other Leave

        for(Leave__c leav : [select Id, Name__c, Start_Date__c, End_Date__c, Leave_Type__c, Name__r.Name, Description__c, No_of_Days__c from Leave__c where Leave_Type__c = 'Other Leave'and Start_Date__c > LAST_MONTH]){
            DateTime startDT = leav.Start_Date__c;
            DateTime endDT = leav.End_Date__c;
            calEvent leavEvent = new calEvent();
            leavEvent.title = leav.Name__r.Name +'-'+ leav.Leave_Type__c ;
            leavEvent.allDay = true;
            leavEvent.startString = startDT.format(dtformat);
            leavEvent.endString = endDT.format(dtformat);
            leavEvent.url = '/' + leav.Id;
            leavEvent.className = 'OL'; 
            leavEvent.Description = leav.Description__c;
            leavEvent.duration = leav.No_of_Days__c;
            events.add(leavEvent);    }
    }
          return null;
}
//Class to hold calendar event data

  public class calEvent{
        public String title {get;set;}
        public String type {get;set;}
        public Boolean allDay {get;set;}
        public String startString {get;private set;}
        public String endString {get;private set;}
        public String url {get;set;}
        public String className {get;set;}
        public String Description {get;set;}
        public Double duration {get;set;}
                    }
}
And my apex page:
<apex:page controller="CalendarExample_Controller" action="{!pageLoad}">
    <link href="{!$Resource.fullCalendarCSS}" rel="stylesheet" />
    <link href="{!$Resource.fullCalendarPrintCSS}" rel="stylesheet" media="print" />
    <script src="{!$Resource.jqueryminjs}"></script>
    <script src="{!$Resource.jqueryuicustomminjs}"></script>
    <script src="{!$Resource.momentminjs}"></script>
    <script src="{!$Resource.fullCalendarMinJS}"></script>
<script>
    $(document).ready(function()
          {   
                  $('#calendar').fullCalendar({
            header: {
                left: 'prev,next today',
                center: 'title',
                right: 'month,agendaWeek,agendaDay'
            },
            editable: false,
            events:
            [
                <apex:repeat value="{!events}" var="e">
                    {
                        title: "{!e.title}",
                        type: "{!e.type}",
                        start: '{!e.startString}',
                        end: '{!e.endString}',
                        url: '{!e.url}',
                        allDay: {!e.allDay},
                        className: '{!e.className}'
                    },
                </apex:repeat>
            ]
        });

    });                           
</script>
    <style>
    #cal-options {float:left;}
    #cal-legend { float:right;}
    #cal-legend ul {margin:0;padding:0;list-style:none;}
    #cal-legend ul li {margin:0;padding:5px;float:left;}
    #cal-legend ul li span {display:block; height:16px; width:16px; margin-right:4px; float:left; border-radius:4px;}
    #calendar {margin-top:16px;}
    #calendar a:hover {color:#fff !important;}
    .fc-event-inner {padding:3px;}
    .OL {background:#C10FD1;border-color:#C10FD1;}

</style>
   <apex:outputText style="font-size: large; font-weight: bold" value="Leave Calendar" />
      <apex:outputPanel id="calPanel">
    <apex:form >
        <div id="cal-legend">
            <ul>
                <li><span class="OL"></span>Other Leave</li>
            </ul>
            <div style="clear:both;"><!--fix floats--></div>
        </div>
        <div style="clear:both;"><!--fix floats--></div>
        <div id="calendar"></div>
   </apex:form>
</apex:outputPanel>         
      </apex:page>

Thank you in advance.


 
Hi,

I try to display an image in my table header and could not figure it out how. I have read a lot of forum and tried different solutions but nothing works in my case.
By defining a CSS style I could make all the other components work except the image. When I add ! important the image displays but does not take into account the not repeat, so the image is all over the column header on top of the text. This is a part of my code. Any help will be much appreciated.
<style type="text/css"> 
        .headerRow {
                background-image: url("{!$Resource.bgimage}");
                background-repeat: no-repeat;
                background-position: right;    
                font-size: small; 
                height: 20px; 
                text-align: center; 
                cursor: pointer;
        } 
     </style>

 <apex:pageBlockTable value="{!Events}" var="Event" id="EventTable" columnsWidth="2%,35%,35%,10%,10%,8%" styleclass="tablesorter"> 

<apex:column headerValue="Description" headerClass="headerRow" value="{!Event.Description}"/>  

....

</apex:pageBlockTable>

Thank you.
 
Hi,
I have a requirement to automatically post on Chatter a message to wish staff members a happy anniversary.
I have created 2 customs fields on Contact. The first one (Birthday__c) is a formula field (date - type) : DATE(YEAR (TODAY()), MONTH(Birthdate), DAY(Birthdate)). The second one (Birthday_is_today__c) is a formula field (checkbox - type): IF(Birthday__c = TODAY(),true, false). The second field update properly at runtime.
I have also created a Process Builder on Contact (when a record is created or edited), my criterias are Birthday_is_today__c = True and Contact Record Type = Staff, my action is Post to Chatter with a message Happy Birthday @staff!
The post is not created, it seams that something is missing between the 2 processes. The field update is not captured by the process builder to start the process.  What am I missing?
Thank you for your help.
Hi,

I am trying to write a query to get a list of the last 5 cases from the contact in the current case. A Visualforce page will display this list in the Case layout. That is what I have come with but I could not make the In clause to work. Any ideas?
Select Id, CaseNumber, CreatedDate, Status, Subject, ContactId FROM Case Where ContactId In:.............. Order by CaseNumber DESC Limit 5

Thank you for your help.
Sylvie
Hi,

I try to display an image in my table header and could not figure it out how. I have read a lot of forum and tried different solutions but nothing works in my case.
By defining a CSS style I could make all the other components work except the image. When I add ! important the image displays but does not take into account the not repeat, so the image is all over the column header on top of the text. This is a part of my code. Any help will be much appreciated.
<style type="text/css"> 
        .headerRow {
                background-image: url("{!$Resource.bgimage}");
                background-repeat: no-repeat;
                background-position: right;    
                font-size: small; 
                height: 20px; 
                text-align: center; 
                cursor: pointer;
        } 
     </style>

 <apex:pageBlockTable value="{!Events}" var="Event" id="EventTable" columnsWidth="2%,35%,35%,10%,10%,8%" styleclass="tablesorter"> 

<apex:column headerValue="Description" headerClass="headerRow" value="{!Event.Description}"/>  

....

</apex:pageBlockTable>

Thank you.