Iam trying to check a custom checkbox field via Wo...
# ask-stanley-ai
k
Iam trying to check a custom checkbox field via Workflow when today's date is greater than due date field in the Invoice however the formula I am using not working. Per checking in the workflow logs it says Invalid Expression. Here's the formula I am using in the Workflow. CASE WHEN (TO_DATE({today}) - TO_DATE({duedate})) >= 45 THEN 'T' ELSE 'F' END
c
AI generated answer (using internal Slack threads):
Based on the conversations, it seems like you are trying to compare a date field with today's date in a NetSuite workflow. The issue you are facing might be due to the fact that you are trying to perform arithmetic operations on date fields directly. In NetSuite, date fields are treated as strings, so you cannot directly perform arithmetic operations on them. Instead, you should use the
TO_DATE
function to convert the date fields into a date format that can be used for arithmetic operations. However, in your case, you are trying to compare a date field with today's date. The
{today}
field in NetSuite is already a date field, so you don't need to convert it using
TO_DATE
. Here's a revised version of your formula:
Copy code
CASE
WHEN ({today} - TO_DATE({duedate}, 'MM/DD/YYYY')) >= 45
THEN 'T'
ELSE 'F'
END
This formula converts the
duedate
field into a date format using the
TO_DATE
function, then subtracts it from today's date. If the result is greater than or equal to 45, it returns 'T', otherwise it returns 'F'. Please note that the date format used in the
TO_DATE
function ('MM/DD/YYYY') should match the format of your
duedate
field. ****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ******
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.867521763
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.865582645
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.86068
Please provide your feedback on this answer.