Round up/down datetime field with BPM or Formula

We have a requirement that I am really struggling with so all help welcome. Using the BPM I am adding SLA targets using Business Hours to our Tasks. This has been nice and easy to achieve using Business Rules and Processes adding onto the Datetime Start field we are using.

We have a need whereby if a Task is received after a certain time then rather than be 4 business hours it will be 14:00 the following day. I can add the hours but utilising a suite of Business rules to work out how many Business Hours to add.

The bit that I cannot figure out is how to round up/down to the nearest hour.

Has anyone been able to achieve this or similar please?

Thanks

*No code changes please. I would like to achieve if at all possible without impacting the core code.

Parents
  • hello Pete

    below is an idea of rounding down to the hour by retrieving hours digits from the datetime field value via conversion to string following conversion to a number - that may help to build back the necessary DateTime value by concatenating datetime components (day, month, year, hour, 00 minutes)
    I hope this helps.

    however, I'd note that having no coding skills I would configure calculating DateTime Start with Logic Builder tool for Sugar - with a few clicks and no-code - on Task is created/assigned (or whatever other logic triggers Datetime Start calculation) and deploy configuring to SUgar via Module Loader

    Best Regards,
    Dmytro Chupylka

    integroscrm.com
    We make work in Sugar CRM system faster, more convenient and efficient

  • Thanks for the suggestion Dmytro. 

    I was going down this path, however the issue I came across was how to get the deconstructed elements back into a datetime format so that the BPM Business Hours logic could work on it as it only works on datetime fields.

Reply Children
  • Oh, seems that I'm also unable to find a way of getting a DateTime field value from the number of datetime components with SugarLogic formulas of CalcFields... 
    again, I would use the Logic Builder to solve the whole task with no-coding in Sugar

    however, some of my experiments with Business Center and Business Rules have led to the results that looks fruitful

    I used the rounded down hour number for Task createdate and set up this Business Rule:





    Where MyBusinessCenter1 is that Business Center:

    If a Task is created before noon, that should BPM sets DateTimeStart to the datetime in 4 business hours (according to MyBusinessCenter1)  from createdate. For tasks created after noon time, the DateTimeStart should be at 14:00 of the upcoming working day  (according to MyBusinessCenter1)

    Note that, Business Center timezone, my real time zone and the time zone of the user profile in Sugar are equal in my test

    Please let me know if the trick worked
    If not, I'll try configure your task's solution with Logic Builder 

    Best Regards,
    Dmytro Chupylka

    integroscrm.com
    We make work in Sugar CRM system faster, more convenient and efficient