Let suppose you want to set the default value for PurAgent.EMailAddress
field in the Buyer Maintenance Form.You have first to open the Buyer Maintenance Form in customization
mode (using Developer mode).
From customization tool dialog open “Wizards” tab and then open “Form
Event Wizard” tab. In this tab you will find a list of events which allow you to
enter code that is activated when specific events occur on a form. You want to
set the default value for Epicor fields so you will select EpiViewNotification
event from the list of event type as you can see below.
Why this event?
You want to set the default value for Epicor fields when the user
add a new record so when the user click on the new item from standard toolbar or file menu,
Epicor called the GetNew method for the business object. The EpiViewNotification
event allows you to enter custom code for the GetNew method.
Once finished from adding the EpiViewNotification event for
PurAgent table it will automatically added a block of code to check if the
NotifyType is an AddRow and that row is greater than -1.
Now you will add your code to set a default value for EmailAddress
field for PurAgent view and you will add this as below:
Save and run your new customization. When you click on the new
button, you should now see that is EmailAddress filled in automatically as you
can see below:
I needed to automatically change my Lot Numbers on a different screen. But this definitely helped me address the fields in correct way.
ReplyDeleteThank you!
Ben
Your Welcome.
ReplyDeleteWaleed, do you have any information on how to manipulate a custom view - add new columns to it, etc.
ReplyDeleteHi Waleed, do you know if it is possible to call a BPM data form from a customization like this and then store the call context BPM data in a table?
ReplyDeleteThis is great, thank you Waleed, your blog is an invaluable resource.
ReplyDeleteThis did not work for me when adding a new row in Quote entry
ReplyDeleteThanks for your comment. Double check your code. it should work with you.
DeleteFor me too, this did not work for me when adding a new row in Quote entry
DeleteDoes this work for Combo boxes as well?
ReplyDeleteDoes this work for Combo boxes as well?
ReplyDeleteYes it works.
DeleteDoes this work for ComboBoxes? I've tried the same method for a combo box but couldn't get it to work.
ReplyDeleteIt works because you are filling the column of the table which linked with the combo box.
DeleteYou have to make sure that you are set the ValueMember of the combo box not the DisplyMember.
got example code for that you are set the ValueMember of the combo box not the DisplyMember.
DeleteThanks Waleed, got it to show up after setting the ValueMember.
ReplyDeleteAlthough for the combo box, the value only appears after saving. Is there a way to get it to show up when clicking on the new button?
it show up when clicking on the new button. Please check your code again and make sure the default value which you set belong to ValueMember.
Deletewhen using this method, the field cannot be changed after that, it always changes back to the default. any way to set it so it is there upon opening but if user changes it, it keeps their changes?
ReplyDeleteHi Walleed
ReplyDeleteThis was a great help successfully managed to default in a value to a field when creating a new record. Thanks Bev