Auto answer system message
jbissot
I have an optimizer rule (CSCODE) that changes the value of the combo box Item Group on the Item Master Data form (150). Once the selection is changed a system message window pops up and asks if you want to update the item information. What is the easiest and or the best way to automatically answer this system message so that no user intervention is required?
Paolo Manfrin
Hi jbissot,
this is not an easy task. You would have to intercept the messagebox (e.g. with a timer) and use the sendkey command to send an "ENTER" command.
All messagebox have formtype 0. So either you "listen" for the formtype zero but then you need to get the xml of the form and check that it is the form you want using e.g. the title or you get the current active form and send an enter command as soon as you do the operation that triggers that form (in this case you might need to add a delay of few milliseconds to ensure that the messagebox is there)
hth
paolo
Gerhard Bienen
Hello jbissot,
you can create a rule with the CS Optimizer.
the Trigger is only the FormType 0
Event is Form Load
Then you have to check the Message of the System Message Box.
In this case i suppress the Mesage "Update document rows according to new BP's data?"
but be carefull, this is Language dependend
Try
Dim strMessage As String = Label.GetFromUID(pVal.Form, "7").Value
Dim dicTexts As System.Collections.Generic.Dictionary(Of String,String) = New System.Collections.Generic.Dictionary(Of String,String)
dicTexts.Add("Update document rows according to new BP's data?", "1")
If dicTexts.ContainsKey(strMessage) And pVal.Form.IsSystem = True Then
'Messagebox.Show("Messagebox Content : " + strMessage , "OK")
Dim btnNo As Button = Button.GetFromUID(pVal.Form, "2")
btnNo.Click(customize.UI.Components.Item.ClickType.Regular)
End If
Return True
Catch Ex As Exception
End Try
Please sign in to leave a comment.
Comments
0 comments