2
votes

I have been trying to figure out how to appropriately define a date within a newly created custom field that references the current transaction date and 'adds' an integer value from an existing custom field in NetSuite that's located on the same form (a PO). Each time I submit, I get an error for an invalid expression or the value is simple null.

Here's my code:

CASE WHEN {entity} = 'Test Vendor' THEN 
    {trandate} + {custbody01} 
ELSE 56
END

"custbody01" represents an existing value that has been calculated within a custom field (integer). The idea is for a pre-calculated value (integer) to be added to the current transaction date to calculate a future date in the custom field. I am very new to NetSuite and could really use any help provided.

Thank You

1

1 Answers

0
votes

I've had a similar requirement. I've needed to add an int to a date. I believe you just need to use the TO_DATE() function.

Here's the code I specifically used as a workflow condition, but I believe it would be transferable, so long as custbody01 is indeed an int value. (custbody456 is a custom date field, adding an integer value, to calculate another date field)

Estimated Ship Date=to_date({custbody456}) + 17

So I think for you, you may want to try: TO_DATE({trandate}) + {custbody01})

When executing, this code will reference the existing custom field and add that value to the current transaction date.