Skip to main content

How to Set the Default Value for Fields in Epicor Customization

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:


Comments

  1. I needed to automatically change my Lot Numbers on a different screen. But this definitely helped me address the fields in correct way.
    Thank you!
    Ben

    ReplyDelete
  2. Waleed, do you have any information on how to manipulate a custom view - add new columns to it, etc.

    ReplyDelete
  3. Hi 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?

    ReplyDelete
  4. This is great, thank you Waleed, your blog is an invaluable resource.

    ReplyDelete
  5. This did not work for me when adding a new row in Quote entry

    ReplyDelete
    Replies
    1. Thanks for your comment. Double check your code. it should work with you.

      Delete
    2. For me too, this did not work for me when adding a new row in Quote entry

      Delete
  6. Does this work for Combo boxes as well?

    ReplyDelete
  7. Does this work for Combo boxes as well?

    ReplyDelete
  8. Does this work for ComboBoxes? I've tried the same method for a combo box but couldn't get it to work.

    ReplyDelete
    Replies
    1. It works because you are filling the column of the table which linked with the combo box.

      You have to make sure that you are set the ValueMember of the combo box not the DisplyMember.

      Delete
    2. got example code for that you are set the ValueMember of the combo box not the DisplyMember.

      Delete
  9. Thanks Waleed, got it to show up after setting the ValueMember.

    Although 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?

    ReplyDelete
    Replies
    1. 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.

      Delete
  10. when 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?

    ReplyDelete
  11. Hi Walleed

    This was a great help successfully managed to default in a value to a field when creating a new record. Thanks Bev

    ReplyDelete

Post a Comment

Popular posts from this blog

Epicor 9 ToolBars

Like any other application, Epicor has list of toolbars and it uses the Infragistics controls and you can modify these toolbars in your code by adding new tools or change the properties for the existing toolbars and Tools.

How to Use the Business Activity Query Export Process

Business Activity Query Export Process let you export the BAQ data in XML or CSV format. You can export the BAQ data manually and you can schedule it to run automatically (Daily, Weekly, ,Monthly,Once,startup..etc) and you can configure this in the “system agent maintenance” and I will explain this later in this article.