In some instances, your clients may require individual date offsets for stages in your workflows: one client may require an action to be taken one week after a milestone, and in the same workflow another client could instead require one month. 


This guide is designed to show you how to set up a field in your client record that will record an individual offset for each client, which can then be used to schedule events in a workflow, including key dates, start dates or due dates.


TABLE OF CONTENTS


Setting up flexible date offsets


Step 1: Set up an offset field

        

        The offset information will need to be stored on your client's record for you to edit it manually. You might want to add this into a form prompted by the client take-on service or on a form filled in for a service setup, for instance an offset to be used for your VAT jobs could be added in a field on your 'VAT details' form. 


It is advisable to make this field mandatory if you are going to use it in your workflows. This will prevent the workflows from encountering errors when this value is missing.


       When you've selected a form to hold your offset, click 'Add field'. Set it as a 'Text box' field type, select 'Yes' to setting the field as mandatory and make sure to add a field reference. Save the changes to your form and it will be ready to use. 

        In my example I've chosen the field reference 'offset'.

 


Step 2: Populate the offset field

        

       Now that your field has been added into a form you'll be able to edit it if it's already present on a client's record, otherwise you'll be asked to add it when the form is first filled in. 

        The value of the field needs to be in the standard offset format, which you can check in our article "What are date offsets?".

       In my example below I've added my field into the 'VAT details' form, and added an offset value of "+14d", which adds 14 days to a date.




Step 3: Test the offset


       Once you're able to see this field on your client record and you've added a value to it, you can now test it with the expression tester. This is a recommended step when first setting up flexible offsets to ensure that both the field reference and the offset value are working correctly.

       When viewing a client record where you've added an offset value to your field, open the expression tester and add the below expression. 


 Client.offset


If you've used a different field reference to the example of 'offset' you'll need to substitute this value for the one you have chosen in all of the expression examples.




       Check that this expression brings up the matching value to ensure that the field reference is correct. If this does not work correctly then return to the form and check the field reference you've added. Make a note of it before returning to the client record and retrying.


       Once the result of the expression is matching the displayed value on your client record, we can test the date offset.

       The function that will be used in our expression is DATEOFFSET. The change we're implementing is that instead of manually inputting an offset we will be using the field reference of our offset field.

       We will check the offset against today's date using the function TODAY.

       Enter the following expression:


Dateoffset(TODAY,client.offset)



        In my example today's date is 21st September 2023, illustrating that my 14 day offset is working correctly.


        If your expression is not working, check that the value of your offset field is in the correct format here.

        Alternatively you can test your offset value in the Date Offset Workbench by adding /s/d/t to your workspace URL.

        i.e. https://yourworkspacename.senta.co/s/d/t



       Once your date offset expression is bringing up the correct result, it's ready to be added into your workflow.



Step 3: Add the offset to a workflow


       There are multiple ways to use your flexible offset inside your workflows, but generally the expression will offset from a date from inside the job, such as job.date.

       You can add the flexible offset to a key date so that the timing of that key date varies by client. Open up the configuration of a job, go to the 'Dates' tab and create or edit a key date with this expression in the 'Offset' field:


Dateoffset(job.date,client.offset)



       The same expression can also be used in a task's Start Date or Due Date:




       When the job is run for my example client on 21st September 2023, the key date and the start date both reference the value in this client's 'Offset' field. As this client's offset value is "+14d", Key Date 1 and Task 1 have both offset 14 days after the job date.



        In a second example client I've added an offset value of "+2d".



       When I run the same job for this client Key Date 1 and the start date of Task 1 are now offset by only 2 days.




Troubleshooting


       If you're finding that your flexible offset is not working please follow the following steps to locate the problem.


1. Check that the client has a value added into the offset field:


 

2. Check that the field reference in the form exactly matches the field reference in your expressions:


2. Check that the offset value is a valid offset format in the expression tester. Use the Dateoffset expression and manually enter the offset value in speech marks.


3. Check that the expression now works with the field reference added and that there are no extra spaces or formatting problems in the field.


4. Check that the reference date in your expressions is a valid date reference. Copy it into the expression tester on the client's active job:


5. Check that the expressions in your workflow are written and structured correctly. Copy them into the expression tester on the client's active job: