Adding Months to date in workflow

When we want to add months to a date in the ‘after field edit’ trigger it is unable to get the ‘ADD_MONTHS’ function in the formula field. So to add months to the date after the field edit,

nlapiDateToString(nlapiAddMonths(nlapiStringToDate(nlapiGetFieldValue(‘custrecord_date’)),{custrecord_month}),’date’)

custrecord_date: Id of the date field
custrecord_month: Id of the month field

eg: add ‘6’ months with the ‘1 January 2023’, result will be 7 July 2023

nlapiDateToString(nlapiAddMonths(nlapiStringToDate(nlapiGetFieldValue(‘1 January 2023′)),{6}),’date’)

the output will be: 7 July 2023

Leave a comment

Your email address will not be published. Required fields are marked *