6 Replies Latest reply on Mar 15, 2016 11:04 AM by SteveGutierrez

    Format date field?


      When using a date field in a Service Request, it is stored in the database with a default time, when we only want a date.


      So when we drop the date field into a Notification workflow, instead of giving us just a date, it comes across as 2/2/2016 5:00:00 AM (UTC) - Etc/UTC


      The time never changes but is always there...does anyone know how to strip that off or not store it at all?

      I have confirmed a date field is being used and not a date/time field.

        • 1. Re: Format date field?

          You can use the substring function to essentially chop off the time from the field.

          We've tried this on one of our Service requests and it did the job for us as we had a similar issue. In our environment we used:


          $(SUBSTRING(GetSRPValue(RecId, "Baseline_Date"),  1,  10))


          Baseline_Date was our date field




          The example given in the Admin help explains the syntax you need:


          $(Substring(Symptom, 21, 7))

          If the Symptom field in the current business object contains the following:

          Printer seems to be working fine for others. His setup for the printer is fine.

          It returns the substring starting with the 21st character and continues for 7 characters. The result of this function in this example is working.





          • 2. Re: Format date field?
            louise.piper@it.ox.ac.uk Apprentice

            You can also use the FormatDate function.


            Using the same example as Ian did in his previous comment where Baseline_Date is the date field:

            $(FormatDate(GetSRPValue(RecId,  "Baseline_Date"),  "dd-MMM-yyyy"))


            Returns a date in the format: 04-Feb-2016

            3 of 3 people found this helpful
            • 3. Re: Format date field?

              have you had any experience using this FormatDate command on a non-mandatory field?


              We are experience an issue where when using this command on a non-mandatory field, it still wants to format something so if the user does not select a date it drops in the current date so that it can format something.

              • 4. Re: Format date field?
                SteveGutierrez Rookie

                If you put that FormatDate expression in an IF statement, you could tell it to format only if the date is !null. So I think it would look like:


                $(If !isnull(Baseline_Date)

                     then FormatDate(GetSRPValue(RecId,  "Baseline_Date"),  "dd-MMM-yyyy")

                     else Baseline_Date)


                You might have to play around with the formula above though. Good luck!

                2 of 2 people found this helpful
                • 5. Re: Format date field?

                  thanks Steve,


                  this would work if we were not trying to format the date within a notification

                  • 6. Re: Format date field?
                    SteveGutierrez Rookie

                    You're welcome. It should still work in an email notification as well - we've successfully formatted email notifications based on IF expressions in our environment. For example, we've formatted task escalation notifications to include Service Request Requestor, Service Request Requested For, or Incident full name. In the example below, I've stacked two separate conditions instead of building them together since the same task will never be for both Incident and Service Request at the same time.



                    $([Incident#.Rev3]ProfileFullName)$(if Isnull([ServiceReq#.ServiceReqAssocTaskAssignment]CC_RequestedFor) then [ServiceReq#.ServiceReqAssocTaskAssignment]ProfileFullName else [ServiceReq#.ServiceReqAssocTaskAssignment]CC_RequestedFor)

                    1 of 1 people found this helpful