+ Start a Discussion

LastModified date and ADI_LAst_Calculated Date


 There is a problem in getting the dates. I update the Opportunity table and insert the ADI_Last_Calculated_date as the Server Timestamp and at the same time SalesForce updates the last modified date for the opportunity. So there is difference in the Time. Can anyone suggest why is it so? I have tried using different date formats.

***********************************Function Description*********************************

Public Function updateRevenueToOpportunity(ByVal ID As String, ByVal Opp_ExpTotalValue As Integer, ByVal Opp_TotalValue As Integer, ByVal Opp_PeakAnnualValue As Integer, ByVal Opp_ExpPeakAnnualValue As Integer)

Dim saveResults() As SaveResult

Dim updateOpp As sObject = New sObject

Dim ilength = 0, iError As Integer = 0

Dim xElemnt(6) As System.Xml.XmlElement

Dim Doc As New System.Xml.XmlDocument


xElemnt(0) = Doc.CreateElement("ADI_Expected_Total_Amount__c")

xElemnt(0).InnerText = Opp_ExpTotalValue

xElemnt(1) = Doc.CreateElement("ADI_Total_Amount__c")

xElemnt(1).InnerText = Opp_TotalValue

xElemnt(2) = Doc.CreateElement("ADI_Peak_Annual_Amount__c")

xElemnt(2).InnerText = Opp_PeakAnnualValue

xElemnt(3) = Doc.CreateElement("ADI_Expected_Peak_Annual_Amount__c")

xElemnt(3).InnerText = Opp_ExpPeakAnnualValue

xElemnt(4) = Doc.CreateElement("ADI_Last_Calculated_Date__c")

xElemnt(4).InnerText = Replace(Format(objService.getServerTimestamp.timestamp, "yyyy-MM-ddThh:mm:ss.millisZ"), "illi", "", 1)

xElemnt(5) = Doc.CreateElement("ADI_Generate_Forecast__c")

xElemnt(5).InnerText = "False"

updateOpp.Id = ID

updateOpp.Any = xElemnt

updateOpp.type = "Opportunity"

saveResults = objService.update(New SFPartner.sObject() {updateOpp})

Dim Err As [Error]

While (ilength < saveResults.Length)

If saveResults(ilength).success Then

_Logger.LogInfo("OpportunityLineItem successfully updated with " + saveResults(ilength).id + " as the ID")


While (iError < saveResults(ilength).errors.Length)

Err = saveResults(ilength).errors(iError)

_Logger.LogError("Opportunity Line Item could not be updated : '" + Err.message + "'", "updateRevenueToOpportunitylineItem")

iError = iError + 1

End While

End If

ilength = ilength + 1

End While

Catch ex As Exception

Throw New Exception("Failed to update Opportunity")

End Try

End Function

*************************************Output Result***************************************

OpportunityID - 006000000077XUuAAM  

LastModifiedDate - 5/19/2005 5:01 PM   

Name - Punit Opportunity 1 Product

ADI_Last_Calculated_date  -  5/19/2005 10:31 AM

You're not taking timezone offsets into account.


Thanks Simon for letting us know