4

I have a custom entity, Duration calculation, which is used to calculate duration of Sales stage on Opportunity. In that entity, I have a calculated field which calculates duration between the stage start time and endtime (image attached). When I try to save the error is shown "Invalid XAML formula". What's wrong in this ?

enter image description here

Mahmood
  • 177
  • 2
  • 10
  • The editor accepts it if I use any formula other than "DiffInMinutes" which is used in first step. Wierd!!! But it doesn't do the job, since I want to have minimum time units to calculate the duration. – Mahmood Oct 19 '15 at 08:04
  • Are the fields both Date & Time fields? – Yacine Zine Oct 21 '15 at 12:32
  • 1
    Yes, they are both date and time fields. – Mahmood Oct 21 '15 at 12:35
  • Duration is it a wholenumber or decimal? – Yacine Zine Oct 26 '15 at 13:58
  • Have you upgraded to Update 1 ? – Alex Oct 28 '15 at 13:59
  • 2
    I have the same issue in a brand new CRM Online 2016 environment (8.0.1.88). I tried with a whole number field formatted as Duration, or as "None". My formula is pretty much an exact replica of yours, except I just test End Date so my conditions are simpler (I am creating the records in workflow so I know they must have a start date). – AdamV Apr 20 '16 at 12:53

1 Answers1

0

according with the image you are train to set the field "Duration", the result of the function DiffInMinutes is possibly a Negative number, and assuming that "Duration" is a Whole Number typed "Duration" this will throw an exception

a similar problem was consulted related to set a duration attribute using a Plugin (Link)

Could try to make the DiffInMinutes between EndTime and StartTime instead of StartTime and EndTime

Hope it helps