Wednesday, January 23, 2013

Last Modified Date in Salesforce - SFDC

This may be a somewhat silly thing to say to the outer world. But I thought to write this post, assuming that there is at least one people who is suffering from this problem ;)

 In SFDC for all the Standard objects as well as for the custom objects, there is a standard field called LastModifiedDate which is invisible in the field list. But if we are accessing these objects through API calls, then we can replicate this field as well into SQL Database or similar. There we can see that, the field is in DataTime format.

Even though the field is invisible in the field list, when we run a report on SFDC we can see that that field is available in the left panel. Ok, now I'll turn into the problem that I faced and the workaround.

I wanted to check the last modified time of each record(let say Opportunity object). But when I ran a report what the last modified date was giving is only the last modified date(as the name is saying itself ;) ). But I got to know that this field is in the type of DataTime. So, with following workaround, I could able to get the DataTime format of this field.

  • Add a new field to the particular object. In my case, for the Opportunity object.
  • Click on Your Name|Setup|Customize|Opportunities|Fields
  • Under Opportunity Custom Fields & Relationships, click on New 
  • Select the Formula as the Data Type of the field 
  • Give a name to the field and select DataTime as the Return Type and click Next 
  • In the Insert Field section, select the Last Modified Date 
  • Now this is your formula.In the formula area it should only appear LastModifiedDate 
  • That's it. Click Next and Follow the formal instructions if any. 

Finally go back to your report type and add the newly added field there. If you unfamiliar with adding a new fields to existing report type, have a look at here. It should now show the DateTime format of the LastModifiedDate field.

No comments:

Post a Comment