February 8, 200619 yr I have a layout that uses a plug-n called MMEmail. I have three fields I have set as Required but users can still use the MMEmail function to email portions of the layout even if they haven't filled out the required fields yet. The plug-in simply calls up an email window which is populated with merge fields and emails it using a local email client as support. When the user clicks on the button to summon the email window I would like to see that script validate those three fields. The fields are a Date filed, and two Text fields. Any ideas? Let ( [ To = Purchase::SendToMail ; Subject = "Purchase Request Approval Needed" ; Body = "Your approval is requested for the following purchase order by <>¶¶Purchase ID#: <>¶Product: <>¶Quantity: <>¶Total Cost: <>¶¶Date Requested: <>¶Program: <>¶Vendor: <>¶Pro Card Purchase: <>¶¶Comments: <>" ; Attachment1 = "" ; Attachment2 = "" ; Attachment3 = "" ; MergeFields = "" ; SendEmail = "True" ]; MMEmail_ShowMessageDialog( To ; Subject ; Body ; Attachment1 ; Attachment2 ; Attachment3 ; MergeFields ; SendEmail ) )
February 9, 200619 yr Add a commit records/requests script step prior to the script step that calls the plugin. This will trigger the validation, and if you Set Error Capture [on], you can use Get(LastError) in an if statement to control the flow of your script based on the validation. Commit Records [] If[Get(LastError)=0] //no error found Set Field [pluginField;pluginFunctionCalls] Else Show Custom Dialog [you need values in blah blah fields...] EndIf You can make it more complicated than this to test for more different things, but that's the basic idea.
Create an account or sign in to comment