Ok, got it to work. Woo hoo.
I did the button script:
retVal = oUIObj.SetMessageType(-1)
oScript.InvokeButton("BT_OK")
Put it in place of the Cancel button & hid the original button & it works!
I don't know why it wasn't working the first time because this is Option 2 you gave me. Those same 2 lines were in that error, but now it works fine.
And, I had to switch it to the Cancel button because as long as there is no Serial Number listed, the OK would work, but as soon as it was distributed, the OK button gave a script error.
Thank you so much!!!
Follow up note, is there a way to avoid the Distribution window from auto-opening at all?
------------------------------
Dana Young
Lehman Wesley & Associates
Lansing MI
------------------------------
Original Message:
Sent: 05-30-2019 14:06
From: Alnoor Cassim
Subject: SO Lot/Serial Distribution popup
In Option 1 finding the exact place to run it from in Customizer Selection can be tricky since you have to find DDistribute under module Common Information > Common Entry. Also since @Kevin Moyes showed you UI scripting on your other thread, note the event here is Panel OnExit instead of Panel PostLoad in case that's relevant. Also, you should add a MessageBox in this OnExit script to see if it's working but firing off AFTER the system pops the Distribution is OOB msg. That's why I mentioned Option 2.
On Option 2 prolly you need to Set oUIObj = oSession.AsObject(oScript.UIObj) first before the SetMessageType and InvokeButton. Either that or in the button properties you have Execute Script on Client set instead of Execute Script on Server.
Option 3 was a shot in the dark. Hope that all helps. If you still need me then let's setup for next week.
------------------------------
Alnoor Cassim
Free Agent Developer and Consultant
CallForHelp.biz
Email: alnoor@callforhelp.biz
Orange County, CA
------------------------------
Original Message:
Sent: 05-30-2019 11:12
From: Dana Young
Subject: SO Lot/Serial Distribution popup
Hey Alnoor, thanks for the suggestions, but I can't get it to work.
Option 1 - does nothing
Option 3 - does nothing
Option 2 - error, attached.
Please let me know a good time that we could connect for a short session to review.
Thx! ~Dana
------------------------------
Dana Young
Lehman Wesley & Associates
Lansing MI
Original Message:
Sent: 05-21-2019 16:30
From: Alnoor Cassim
Subject: SO Lot/Serial Distribution popup
It's a good question. I've done this with mods. If you think of S/O Invoice Data Entry, you are prompted to ship complete and if you say Yes, any Lot / Serial items from the order will NOT auto-pop the "Distribution is out of balance" message despite Qty Shipped <> Qty Ordered at that point but the yellow triangle will still show indicating an undistributed line. So to tap into that you need to do a SetMessageType(-1) from the Tier Dist UI object BEFORE user presses the OK or Cancel button.
You will have to test this. The correct choice is the one that works.
1. Panel OnExit script for CI_CommonTierDistribution_UI / SO_SalesOrderTierDistribution_UI
In this case oUIObj was already passed in and set so it's just:
retVal = oUIObj.SetMessageType(-1)
If it doesn't work it's prolly b/c OnExit processed AFTER the system popped the Dist is OOB msg so try to:
2. Create your own button that does above then oScript.InvokeButton("BT_OK")
3. Alternately try a PostRead business script from the Tier Dist biz object.
If oScript.UIObj Then
Set oUIObj = oSession.AsObject(oScript.UIObj)
retVal = oUIObj.SetMessageType(-1)
End If
------------------------------
Alnoor Cassim
Free Agent Developer and Consultant
CallForHelp.biz
Email: alnoor@callforhelp.biz
Orange County, CA