Last active
December 20, 2020 13:50
-
-
Save pmalicki11/72af421c57109e4e81106b12100fc4b7 to your computer and use it in GitHub Desktop.
Using callback form in Epicor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Sometimes after launching form from modification you want to get some data back to the form from which it was launched. | |
Short example shows the mechanism. | |
1. In CaseForm there is button that launch CustomerForm. | |
2. When we click it CustomerForm opens and we fill all data we need. | |
3. When everything is filled we save it and close CustomerForm. | |
4. The newly added customer is going back to the CaseForm Customer field. | |
*/ | |
// CaseForm | |
private void btnCreateNewCustomer_Click(object sender, System.EventArgs args) | |
{ | |
LaunchFormOptions lfo = new LaunchFormOptions(); | |
lfo.CallBackMethod = getCustomerCallback; | |
lfo.IsModal = true; | |
ProcessCaller.LaunchForm(oTrans, "CustomerForm", lfo); | |
} | |
private void getCustomerCallback(object sender, object CallBackArgs) | |
{ | |
if (CallBackArgs != null && CallBackArgs.ToString() != "System.EventArgs") | |
{ | |
edvHDCase.CurrentDataRow["CustNumCustID"] = CallBackArgs.ToString(); | |
oTrans.Update(); | |
} | |
} | |
// CustomerForm | |
private void CustomerEntryForm_Closing(object sender, System.ComponentModel.CancelEventArgs args) | |
{ | |
EpiDataView edvCustomer = (EpiDataView)oTrans.EpiDataViews["Customer"]; | |
DataRow dataRow = edvCustomer.CurrentDataRow; | |
if (dataRow != null && dataRow["CustID"].ToString() != string.Empty) | |
{ | |
if (CustomerEntryForm.LaunchFormOptions != null && CustomerEntryForm.LaunchFormOptions.CallBackMethod != null) | |
{ | |
CustomerEntryForm.LaunchFormOptions.CallBackMethod(oTrans, dataRow["CustID"].ToString()); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment