Get ZipCodeS on Marketing Documents via FunctionButton
berbericz
Hi Experts,I have a complex program behind a function button for freight calculation.
At the moment I do the freightcalculation based on defined ZipCode in Business Partner Addresses.
In the marketing document I can get the chosen ShipTo-Address-ID of the BP for example with this coding:
[CODE]
shiptocode = ComboBox.GetFromUID(pVal.Form, "40").Selected.Value;
[/CODE]
This works fine and I get the ZipCode of the Address via SQL.
Now I want to make it more flexible because the Ship To Address can be overwritten and I would like to use the ZipCodeS-Field which I can get on the marketing Documents when I click on the [...]-Button.
I need the value before saving so I can not make a sql-query on the XXX12-Tables (e.g. RDR12).
Following Code will not fill the ZipCode-Variable. How to get value of fields? At the moment I can get only value in other coding from a matrix.
[CODE]
SwissAddonFramework.UI.EventHandling.ItemEvents.FormLoadEventHandler del1 = null;
del1 = delegate (SwissAddonFramework.UI.EventHandling.ItemEvents.FormLoad evnt){
SwissAddonFramework.UI.Components.Form.RemoveHandler("13000000", SwissAddonFramework.UI.Components.ModeComponent.FormModes.ALL, del1);
ZipCodeS = customize.UI.Components.TextEdit.GetFromUID(evnt.Form, "10000013").Value; //ZipCodeS -> is empty!!!
};
SwissAddonFramework.UI.Components.Form.AddHandler_Load("13000000", SwissAddonFramework.UI.Components.ModeComponent.FormModes.ALL, del1);
SwissAddonFramework.UI.Components.Button.GetFromUID(pVal.Form, "10002101").Click(SwissAddonFramework.UI.Components.Item.ClickType.Regular);
[/CODE]
Thanks,
Gerrit
Anders Olsson
Hi Gerrit,The address components are actually in a matrix, not a textedit. Try this:
ZipCodeS = Matrix.GetFromUID(evnt.Form, "10000003").GetValue("10000013", 0);
Regards,
Anders
0
Please sign in to leave a comment.
Comments
0 comments