Adding days in date

Hi ,

I have created a field ‘duedate’(date type)which will take value from ‘fromdate’ (date type) and 'Max days(int type).

I am writing the code in modified field (table) as:

but its not working


Code is as follows :

public void modifiedField(fieldId _fieldId)



SmylAssigned asgnd;

ToDate ToDate;

FromDate FromDate;

Date _date;


ToDate = FromDate + asgnd.MaxDays;


You should handle all the possible situations


When the fromDate is modified, fromdate+maxdays

When the maxDays is modified, fromdate+maxdays

The modifiedField will generally have the switch cases, handling the logic for the required field modifications

Look at \Data Dictionary\Tables\InventJournalTrans\Methods\modifiedField

I have to repeat myself:

  • “it’s not working” is not a description of a problem. Please be so kind and describe the observed behavior and explain what problem you have with it.
  • Use the debugger to debug your code. Asking in forums is not a replacement of debugging.

Your method doesn’t do anything, as you can easily see in debugger. FromDate variable is always empty and ToDate variable is dropped when the method ends. You have to replace the local variables (fromDate, toDate) with tables fields.

I created a method in the table and call that method in modified field (table) as :

void setDueDate()


smylLibParameters smylLibParameters = smylLibParameters::find();


this.DueDate = this.ToDate + smylLibParameters.MaxDays;



case 6 : this.DueDate+=2; break;

case 7 : this.DueDate+=1; break;

default: break;



and in modified field i called it as :

public void modifiedField(fieldId _fieldId)





case fieldnum(smylAssigned,ReferenceName):

this.ReferenceId = ‘’;


case fieldnum(smylAssigned,ToDate):





Now it works :slight_smile: thanks