I am trying to create an in-tran BPM to stop users from receiving a PO earlier than 30 days before the promised date.
They mainly use mass receipts to receive the POs. No matter how I try to compare the dates. Nothing happens. Any thoughts?
Code Below.
First, I believe you have an error in the 3rd line, near the end, you are comparing rdPORelNum to rd.PORelNum… it should be y.PORelNum.
But I also converted this to use an “Any” statement which reduces the number of lines needed by multiple lines of code. I did this by combining you last IF statement directly into the query (afterall, queries ARE big if statements). So now, the query returns a TRUE or FALSE if a record is found. Since that is the case, we dont have to set tooSoon to false first. it will automatically get set to true or false
I also added an IF to make sure we dont do this if the tt record is not found.
That is one reason I always break up my queries into multiple lines rather than one long string. While it takes more vertical space, it makes it easier to spot simple mistakes like that. I only saw it when I was breaking into multiple lines.