• Shiva Mali 13
  • NEWBIE
  • 0 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 2
    Replies

I have string 2017-12-22T09:21:00Z.. 

Need to convert this to Date and compare with Variable(Date datatype);

written the code like this. 

Date tempdate;

if(date.valueof(2017-12-22T09:21:00Z)> tempdate) {

tempdate = date.valueof(2017-12-22T09:21:00Z);
system.debug('I am In IF now');
}

Code is getting compiled.. but if part is not returning true.. hence not able to print I am In IF now..
Please advice how to proceed.. 

Thanks in advance

<<apex:page Controller="TestWeather" tabStyle="Country__c">
    <style>
        .inputStyle{
        width:200px;
        height:20px;
        margin:10px;
    </style>
    <apex:stylesheet value="{!$Resource.BootStrap}"/>
    <apex:includeScript value="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" />
    <apex:form >
        <apex:pageBlock >
            <apex:messages />
            <div style = "float:right; color:red; Display:none" id="madatoryMarker"><b>* All the fields are mandatory</b></div>
            <div><b>Hi {!$User.firstName},  Which data of city you have ?.</b> </div>
            <div style="margin:10px">
                <b>Name </b> <apex:inputcheckbox style="margin-right:50px" id="nameMarker" />
                <b >Co-Ordinates </b><apex:inputcheckbox style="margin-right:50px" id="cordMarker"/>
                <b >ID </b><apex:inputcheckbox id="IDMarker" />
            </div>
            <div style="display:block" id = "nameAndCountryDiv">
                <b style="Margin-right:25px">Name: </b> <apex:inputtext styleClass="inputStyle" style="Margin-right:100px"/>
                <b style="Margin-right:25px">Country: </b> <apex:inputtext styleClass="inputStyle"/>
            </div>
            <div style="display:none" id = "co-ordinatesDiv">
                <b style="Margin-right:6px">Lattitude: </b> <apex:inputtext styleClass="inputStyle" style="Margin-right:100px"/>
                <b style="Margin-right:15px">Longitude: </b> <apex:inputtext styleClass="inputStyle"/>
            </div>
            <div style="display:none" id = "IdDiv">
                <b style="Margin-right:20px">City id: </b> <apex:inputtext styleClass="inputStyle"/>
            </div>
            <br/>
        </apex:pageBlock>
        
        
        <apex:pageBlock title="{!cityName} city's weather" id="outputPageblock" rendered="{!toggleDecider}">
            <apex:pageBlockSection title="Location details" collapsible="false">
                <apex:outputText label="City name :">{!cityName}</apex:outputText>
                <apex:outputText label="City country :">{!cityCountry}</apex:outputText>
                <apex:outputText label="City ID :">{!cityIDFromServer}</apex:outputText>
                <apex:outputText label="City co-ordinates(Lon,Lat) :">{!lon_Co_ord},{!lat_Co_ord}</apex:outputText>
            </apex:pageBlockSection>
            <apex:repeat value="{!weatherDataList}" var="wb">
                <apex:pageBlockSection title=" Weather at {!wb.weather_forcast_date}">
                    <apex:outputText label="Tempreture :">{!wb.temp_at_forcasted_time}</apex:outputText>
                    <apex:outputText label="Max Tempreture :">{!wb.max_temp_at_forcasted_time}</apex:outputText>
                    <apex:outputText label="Min Tempreture :">{!wb.min_temp_at_forcasted_time}</apex:outputText>
                    <apex:outputText label="Humidity(%) :">{!wb.humidity_in_percent}</apex:outputText>
                    <apex:outputText label="Atmosphric pressure :">{!wb.pressure_at_ground_level_hpa}</apex:outputText>
                    <apex:outputText label="Rain(mm) :">{!wb.rain_volume_in_last_3h}</apex:outputText>
                    <apex:outputText label="Weather Condition id :">{!wb.weather_condition_id}</apex:outputText>
                    <apex:outputText label="Weather condition :">{!wb.weather_condition_type}</apex:outputText>
                    <apex:outputText label="Weather Condition icon :">
                        <apex:image id="weatherIcon" value="{!wb.weather_condition_icon}"/>
                    </apex:outputText>
                    <apex:outputText label="Weather condition description :">{!wb.weather_condition_description}</apex:outputText>
                    <apex:outputText label="Wind speed :">{!wb.wind_speed}</apex:outputText>
                    <apex:outputText label="Wind direction :">{!wb.wind_direction}</apex:outputText>
                </apex:pageBlockSection>
            </apex:repeat>
            
        </apex:pageBlock>
    </apex:form>
    <script type="text/javascript">
        
    j$ = jQuery.noConflict();
    j$(document).ready(function() {
        
        $('[id$=nameMarker]').click(function(){
            alert('InputText clicked');
            
        });
    });  
    </script>
    
</apex:page>>
<<apex:page Controller="TestWeather" tabStyle="Country__c">
    <style>
        .inputStyle{
        width:200px;
        height:20px;
        margin:10px;
    </style>
    <apex:stylesheet value="{!$Resource.BootStrap}"/>
    <apex:includeScript value="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" />
    <apex:form >
        <apex:pageBlock >
            <apex:messages />
            <div style = "float:right; color:red; Display:none" id="madatoryMarker"><b>* All the fields are mandatory</b></div>
            <div><b>Hi {!$User.firstName},  Which data of city you have ?.</b> </div>
            <div style="margin:10px">
                <b>Name </b> <apex:inputcheckbox style="margin-right:50px" id="nameMarker" />
                <b >Co-Ordinates </b><apex:inputcheckbox style="margin-right:50px" id="cordMarker"/>
                <b >ID </b><apex:inputcheckbox id="IDMarker" />
            </div>
            <div style="display:block" id = "nameAndCountryDiv">
                <b style="Margin-right:25px">Name: </b> <apex:inputtext styleClass="inputStyle" style="Margin-right:100px"/>
                <b style="Margin-right:25px">Country: </b> <apex:inputtext styleClass="inputStyle"/>
            </div>
            <div style="display:none" id = "co-ordinatesDiv">
                <b style="Margin-right:6px">Lattitude: </b> <apex:inputtext styleClass="inputStyle" style="Margin-right:100px"/>
                <b style="Margin-right:15px">Longitude: </b> <apex:inputtext styleClass="inputStyle"/>
            </div>
            <div style="display:none" id = "IdDiv">
                <b style="Margin-right:20px">City id: </b> <apex:inputtext styleClass="inputStyle"/>
            </div>
            <br/>
        </apex:pageBlock>
        
        
        <apex:pageBlock title="{!cityName} city's weather" id="outputPageblock" rendered="{!toggleDecider}">
            <apex:pageBlockSection title="Location details" collapsible="false">
                <apex:outputText label="City name :">{!cityName}</apex:outputText>
                <apex:outputText label="City country :">{!cityCountry}</apex:outputText>
                <apex:outputText label="City ID :">{!cityIDFromServer}</apex:outputText>
                <apex:outputText label="City co-ordinates(Lon,Lat) :">{!lon_Co_ord},{!lat_Co_ord}</apex:outputText>
            </apex:pageBlockSection>
            <apex:repeat value="{!weatherDataList}" var="wb">
                <apex:pageBlockSection title=" Weather at {!wb.weather_forcast_date}">
                    <apex:outputText label="Tempreture :">{!wb.temp_at_forcasted_time}</apex:outputText>
                    <apex:outputText label="Max Tempreture :">{!wb.max_temp_at_forcasted_time}</apex:outputText>
                    <apex:outputText label="Min Tempreture :">{!wb.min_temp_at_forcasted_time}</apex:outputText>
                    <apex:outputText label="Humidity(%) :">{!wb.humidity_in_percent}</apex:outputText>
                    <apex:outputText label="Atmosphric pressure :">{!wb.pressure_at_ground_level_hpa}</apex:outputText>
                    <apex:outputText label="Rain(mm) :">{!wb.rain_volume_in_last_3h}</apex:outputText>
                    <apex:outputText label="Weather Condition id :">{!wb.weather_condition_id}</apex:outputText>
                    <apex:outputText label="Weather condition :">{!wb.weather_condition_type}</apex:outputText>
                    <apex:outputText label="Weather Condition icon :">
                        <apex:image id="weatherIcon" value="{!wb.weather_condition_icon}"/>
                    </apex:outputText>
                    <apex:outputText label="Weather condition description :">{!wb.weather_condition_description}</apex:outputText>
                    <apex:outputText label="Wind speed :">{!wb.wind_speed}</apex:outputText>
                    <apex:outputText label="Wind direction :">{!wb.wind_direction}</apex:outputText>
                </apex:pageBlockSection>
            </apex:repeat>
            
        </apex:pageBlock>
    </apex:form>
    <script type="text/javascript">
        
    j$ = jQuery.noConflict();
    j$(document).ready(function() {
        
        $('[id$=nameMarker]').click(function(){
            alert('InputText clicked');
            
        });
    });  
    </script>
    
</apex:page>>
Trailhead Module 3:  Create a formula field that determines the number of days between today and the last activity date for a case's account.
Your support team has asked for improved visibility on account activity level at the time they’re helping with customer issues. Specifically, when they’re looking at a case, they’d like to see an at-a-glance view of the number of days since the case’s related account was last active. Create the formula using these requirements.The formula should be on the Case object.
The formula should be of return type Number.
The formula should be named 'Days Since Last Update' and have a resulting API Name of 'Days_Since_Last_Update__c'.
The formula should return the number of days between the account’s Last Activity Date and today.

I created the following:

I created a new custom formula field with return type number and called Days Since Last Update.
I created this formula: Account.LastActivityDate - TODAY()

I get this error message:

Challenge not yet complete... here's what's wrong: 
The 'Days_Since_Last_Update__c' formula field did not return the correct number of days between an Account’s Last Activity Date and today

Can you please assist what I did wrong?  I'm not sure if my formula is even correct with the challenge.  Please help!

Thank you.