cancel
Showing results for 
Search instead for 
Did you mean: 

How to format datetime fields to display only date in smart docs

Highlighted
Sushi Chef
Sushi Chef

How to format datetime fields to display only date in smart docs

Hi Guys, does any one know how to format date/time fields to display only date in the output document?

In the below screenshot it is the Created date and I would like to remove the time and display only the date.

Thanks,

Srikanth.

0 Likes
Reply
Highlighted
Employee
Employee

Re: How to format datetime fields to display only date in smart docs

This can be achieved by creating a custom field of type Date and populating it with the value from the Created Date field using ServiceMax Formula. The following the step shows you how to achieve it:

  1. Create a custom field of type Date for the required object.
  2. On any SFM transaction (except View Record and Smart Docs type processes), configure a formula using the Date Function – DATEVALUE, such that the value of the target field (in this case the custom date field) is populated with the Created Date value. Ensure both the fields (source and target for the formula) are included in the page layout.
    For example:
    Target Field: Work Order > Date Field (custom date field created)
    Formula: $F.DATEVALUE($D.Work_Order.CreatedDate)
    For more information on ServiceMax Formula Functions, see Formula Functions.
  3. In the template designer for Output Docs, set the field value of Date to custom date field created.
    For example:
    DATE: {{$D.Work_Order.DateField__c}}
    Here, {{$D.Work_Order.DateField__c}} is the field value of the custom date field created.
  4. Now, execute the SFM transaction on which the formula is configured first and then execute the SFM transaction of type Output doc. You will see that the Date field displays only the date part and not the time.

This solution can be used with any date time field. Using ServiceMax formula makes the solution work in both online and in iPad & MFL mobile apps (offline mode also).

0 Likes
Reply
Highlighted
Sushi Chef
Sushi Chef

Re: How to format datetime fields to display only date in smart docs

Hi Harshini, I think it's not clear for me. I  wanna display Work order created date(Only Date) in the Smart doc,but as the Createddate is a date/time field in Salesforce it is displaying both date and time in the smart doc, So I tried adding the following formula

{{$F.DATEVALUE($D.Work_Order.CreatedDate)}}

but I don't know why it isn't working.  I can create a custom formula field to display created date(DATEVALUE(Createddate)) in the Work Order object and replace standard Createddate field with it, but if there is any option to do it without adding any additional fields then I would be glad to use it..

Thanks,

Srikanth.

0 Likes
Reply
Highlighted
Employee
Employee

Re: How to format datetime fields to display only date in smart docs

Hi Srikanth,

Currently, there is no way to do this without creating additional custom fields (at least not that I am aware of).

Regarding the formula not working, do you have both the new field (that has the formula configured on it) and the CreatedDate field on any of your SFM pagelayouts? ServiceMax formulas work only when both the source and target fields for the formula are included in the pagelayout, and that SFM process is invoked. Formula evaluation happens on-load and on-save. Hence, it is important that the specific SFM transaction is invoked as well, at lease once before launching the SmartDocs report.

Please try this and let us know if it still does not work for you.

Regards,

Aruna

0 Likes
Reply