Hello Everyone.
I'm looking at injecting a custom validation code using customization manager in Automatic Invoice Creation (BI.AIC.00) screen. I want to validate few fields on this screen when "Create Invoices" button is clicked. To this effect, I have managed to successfully place a click event on this button. See the code below:
Private Sub cBegProcessing_Click()
Dim S As String
S = GetObjectValue("cGLSub")
If Not ChkGLSub(S) Then
MsgBox "GL validation fails"
' I want to stop further processing of this here... How?
End If
End Sub
In my code, look at the comment "I want to stop...". Here what should I write so that this event does not move forward and go about creating invoices.
TIA.
Nayan
*This post is locked for comments
I would like to try and use SetObjectValue in VB.Net code to set value to a control as MyApp.Controls("ccustid").Value = "12321" is not setting value. The control on VB.net is showing as enabled = false. I've tried setting to true however property is not changing.
that worked. thanks Paul!
No problem on the terminology - I just wanted to make sure that other folks who read this post don't get confused. The two are very similar and it is a common mixup.
Instead of using SetObjectValue, this might work instead:
sivMyApp.Controls("cBegProcessing").value = True
sivMyApp should be a global reference to the Object Model SIVApplication object, which in this case refers to the screen itself in VBA. I don't think you will need to declare it first before using it. If memory serves sivMyApp has gone away in later versions, but for 6.5 hopefully this will work for you. I don't have a 6.5 environment handy at the moment to test.
Regards,
Paul
Forgot to mention that I'm on SL 6.5.
Thanks Paul. I did what you have mentioned but SetObjectValue on cBegProcessing is throwing System Message 9203 "The specified object is not user enterable: SetObjectValue".
And sorry for mixing up VBTools and Customization Manager.
TIA
Nayan
One quick clarification of terminology to avoid confusion - VBTools (SL SDK in v7) is used for creating new SL application screens using visual basic 6 (Solomon v6.5 and before) or VB.net (SL v7). Customization manager / VBA is used for modifying existing screens at run-time without recompiling them. VBA runs as a layer on top of an existing screen.
I don't believe that it is possible to override the base screen's events in VBA. Even if it were, it would not be advisable because it could interfere with the standard processing logic and have bad side effects.
In order to accomplish what you want, the typical pattern that SL customizers follow is to add a new button to the screen and set the existing cBegProcessing button's 'visible' property to false. Then make the new button have the same caption as the old, and move it to where the old one was.
Then, you can put whatever logic you desire in the button. Once you have finshed your custom validation code, you can click the hidden original button to start processing by setting its value to true, e.g.:
serr1 =
SetObjectValue("cBegProcessing", "True")It is important that the button still be on the form because some other applications such as object model or application server may be launching the screen and automating it, expecting the button to be there and enabled.
From the user's standpoint, they won't see any difference in the screen as long as you make the caption, button location, style, etc. the same for your replacement button.
Regards,
Paul
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,240 Super User 2024 Season 2
Martin Dráb 230,149 Most Valuable Professional
nmaenpaa 101,156