How can I create a delayed field in the report of contracts

How can I create a delayed field in the report of contracts (based on day)

For example, if the end date of the any contract was 3 days ago, it should be printed in the my custom report -3

this is very important for me.please help me

What’s your SuiteCRM version?

Do you really want this in a Report? Not simply on a List view?

Are you a PHP developer or do you need only solutions made through the user interface?

1 Like

im not PHP developer .
But if you guide me, I can write the code and make changes

This field should be selectable in the Reports and be in the List view

very thanks

It’s not simple, and I can give you some pointers, but I don’t have time to actually try it out and write detailed instructions… but something like this should work:

  1. Create a custom field in Contracts called DaysFromEnd (number), and another one called DaysFromEndUpdatedWhen (date)

  2. Create a Workflow

  • Contracts module

  • on scheduler

  • all records

  • repeated runs checked

  • condition: if DaysFromEndUpdatedWhen < Today

  • actions:

    • set DaysFromEndUpdatedWhen to Today (this prevents running more than once each day)
    • set DaysFromEnd to the correct value, using date functions from “Calculated Fields” option. This should be a simple subtraction of dates, but you need to try things and get this right
  1. At this point, you should have a custom field that is updated shortly after midnight to make every Contract have the correct (positive or negative) DaysFromEnd value.

  2. Add this field to any Report or Detail View or List View you wish.

See the Workflow Docs for help, there’s a long page explaining Calculated Fields.
Good luck

1 Like

It was Great, Thanks

I’m glad you got it working. If you don’t mind, I’d like to ask you to please share the details. I want to add this as an example Workflow in the Documentation, because I know other people sometimes ask for similar things.

Can you please show us how you set up the Calculated field formula? What about my instructions, were they all correct or did you have to change something to make it work?


with pleasure
I did not change the steps you said And In the Calculated field, I used the following function (p1 is DaysFromEndUpdatedWhen and p0 is today )
{datediff({P1};{P0}; days)}

1 Like