Howdy, again! I know... it's been too long (haha).
How can you abort an Insert procedure without it saving a new record? I have a form with an OK button. On the button, I have source code in an "Control Event Handling, before generated code - Accepted" Embed. In it, there is a condition where if it's not met, it needs to either abort the Insert procedure entirely or return the user back to the form without Inserting a blank or a copy of an existing record. This is what I have so far:
IF LocalRequest = InsertRecord
IF SLSPROSP:ContactID = 0 AND SLSPROSP:CompanyCode = ''
MESSAGE('Record not added: A Company or Contact is required.','INSERT ABORTED')
! DO SyncWindow
! LocalResponse = RequestCancelled
! VCRRequest = VCRNone
! POST(Event:CloseWindow)
! BREAK
! RETURN
! OriginalRequest=''
! Do ProcedureReturn
END
END
I looked through the Module code to see if I can figure out what triggers a clean Cancel. The 4 groups of code after the exclamation point is what I've tried so far. The results return the user to the Browse screen but either it adds a new blank record or a copy of an existing record (what was highlighted in the Browse), depending on which solution I try.
How can you abort an Insert procedure without it saving a new record? I have a form with an OK button. On the button, I have source code in an "Control Event Handling, before generated code - Accepted" Embed. In it, there is a condition where if it's not met, it needs to either abort the Insert procedure entirely or return the user back to the form without Inserting a blank or a copy of an existing record. This is what I have so far:
IF LocalRequest = InsertRecord
IF SLSPROSP:ContactID = 0 AND SLSPROSP:CompanyCode = ''
MESSAGE('Record not added: A Company or Contact is required.','INSERT ABORTED')
! DO SyncWindow
! LocalResponse = RequestCancelled
! VCRRequest = VCRNone
! POST(Event:CloseWindow)
! BREAK
! RETURN
! OriginalRequest=''
! Do ProcedureReturn
END
END
I looked through the Module code to see if I can figure out what triggers a clean Cancel. The 4 groups of code after the exclamation point is what I've tried so far. The results return the user to the Browse screen but either it adds a new blank record or a copy of an existing record (what was highlighted in the Browse), depending on which solution I try.