Cancelling a document based on the date

This sample Dynamics GP Integration Manager script is placed in the 'Before Document' script area, and is used to cancel the document based on the date. This specific example will not allow dates greater than or equal to the first of the next month.

 

dtEOM = dateadd("m",1,Now())
dtEOM = month(dtEOM) & "/1/" & year(dtEOM)
 
if SourceFields("DOC DATE") >= dtEOM then
       CancelDocument("The document date is in the future, document cancelled")
       'msgbox("cancelled")
end if

RealWorldCode gives developers practical, real‑world solutions with clean, working code — no fluff, no theory, just answers.
Links
Home
Knowledge Areas
Sitemap
Contact
Et cetera
Privacy Policy
Terms and Conditions
Cookie Preferences