Business logic method call error

I used the Wizard to Add a business logic method call for CRM Call. The Wizard put in the code. When I try to compile I am getting this error: The type or namespace name "CRMCAllAdapter could not be found (are you missing a using directive or an Assembly reference?

I have at the top:
using Ice.Adapters;
Code the Wizard inserted:

	{
		try
		{
			// Declare and Initialize EpiDataView Variables
			EpiDataView edvGS_Order_Detail_DataView = ((EpiDataView)(this.oTrans.EpiDataViews["GS_Order_Detail_DataView"]));

			// Check if valid EpiDataView Row(s) are selected
			if ((edvGS_Order_Detail_DataView.Row < 0))
			{
				return;
			}

			// Declare and create an instance of the Adapter.
			CRMCallAdapter adapterCRMCall = new CRMCallAdapter(this.oTrans);
			adapterCRMCall.BOConnect();

			// Declare and Initialize Variables
			// TODO: You may need to replace the default initialization with valid values as required for the BL method call.
			string key1 = ((string)(edvGS_Order_Detail_DataView.dataView[edvGS_Order_Detail_DataView.Row]["OrderDtl_OrderNum"]));

			// Call Adapter method
			bool result = adapterCRMCall.GetNewCRMCall(relatedToFile, key1, key2, key3);

			// Cleanup Adapter Reference
			adapterCRMCall.Dispose();

		} catch (System.Exception ex)
		{
			ExceptionBox.Show(ex);
		}
	}```

Add this to the top

using Erp.Adapters;

Also make sure there is an assembly reference to Erp.Adapters.CRMCall.dll

Okay I got this compiling…Thank you. Now do you know how to add this call to a button click. I’ve added the button but when I put the call in there I get this error:

No overload for method ‘CallCRMCallAdapterGetNewCRMCallMethod’ takes 0 arguments

Code so far:

	{
		try
		{
			// Declare and Initialize EpiDataView Variables
			EpiDataView edvGS_Order_Detail_DataView = ((EpiDataView)(this.oTrans.EpiDataViews["GS_Order_Detail_DataView"]));

			// Check if valid EpiDataView Row(s) are selected
			if ((edvGS_Order_Detail_DataView.Row < 0))
			{
				return;
			}

			// Declare and create an instance of the Adapter.
			CRMCallAdapter adapterCRMCall = new CRMCallAdapter(this.oTrans);
			adapterCRMCall.BOConnect();

			// Declare and Initialize Variables
			// TODO: You may need to replace the default initialization with valid values as required for the BL method call.
			string key1 = ((string)(edvGS_Order_Detail_DataView.dataView[edvGS_Order_Detail_DataView.Row]["OrderDtl_OrderNum"]));
			// Call Adapter method
			bool result = adapterCRMCall.GetNewCRMCall(relatedToFile, key1, key2, key3);

			// Cleanup Adapter Reference
			adapterCRMCall.Dispose();

		} catch (System.Exception ex)
		{
			ExceptionBox.Show(ex);
		}
	}

	private void tbOrderNotesNew_Click(object sender, System.EventArgs args)
	{
		CallCRMCallAdapterGetNewCRMCallMethod();
	}

Can you post the definition of your function CallCRMCallAdapterGetNewCRMCallMethod?

Umm…okay where would I find that?

Your button click is attempting to call a function called CallCRMCallAdapterGetNewCRMCallMethod. This may be the function you’ve listed in your main code block in your previous post, but I’m not sure. If you’re unsure, can you copy and paste here all of the lines that contain CallCRMCallAdapterGetNewCRMCallMethod along with the line number?

Oh okay, yes it is the code that was above. But here as well.

	{
		try
		{
			// Declare and Initialize EpiDataView Variables
			EpiDataView edvGS_Order_Detail_DataView = ((EpiDataView)(this.oTrans.EpiDataViews["GS_Order_Detail_DataView"]));

			// Check if valid EpiDataView Row(s) are selected
			if ((edvGS_Order_Detail_DataView.Row < 0))
			{
				return;
			}

			// Declare and create an instance of the Adapter.
			CRMCallAdapter adapterCRMCall = new CRMCallAdapter(this.oTrans);
			adapterCRMCall.BOConnect();

			// Declare and Initialize Variables
			// TODO: You may need to replace the default initialization with valid values as required for the BL method call.
			string key1 = ((string)(edvGS_Order_Detail_DataView.dataView[edvGS_Order_Detail_DataView.Row]["OrderDtl_OrderNum"]));
			// Call Adapter method
			bool result = adapterCRMCall.GetNewCRMCall(relatedToFile, key1, key2, key3);

			// Cleanup Adapter Reference
			adapterCRMCall.Dispose();

		} catch (System.Exception ex)
		{
			ExceptionBox.Show(ex);
		}
	}

Can you post just one more line above your opening curly bracket?

private void CallCRMCallAdapterGetNewCRMCallMethod(string relatedToFile, string key2, string key3)
{

Okay, perfect. The problem is that your function, private void CallCRMCallAdapterGetNewCRMCallMethod(string relatedToFile, string key2, string key3) is expecting three different arguments / parameters. What you want to do is modify your function to accept no parameters, because you’re calculating them within that method.
So, replace that header definition with private void CallCRMCallAdapterGetNewCRMCallMethod()

After that, your code will complain about not having real values for key2, key3, and related to file. As is mentioned in your TODO section of code, you’ll need to assign these before making the final call.
If I had to guess, you’d want to do change this line bool result = adapterCRMCall.GetNewCRMCall(relatedToFile, key1, key2, key3);
to
bool result = adapterCRMCall.GetNewCRMCall("OrderHed", key1, "", ""); but I don’t remember off the top of my head what key2 and key3 values hold. You probably will want to create a CRMCall for an order, then look at if they hold nothing or hold the customer, etc.

Okay I’ll try that.

Okay, and magically nothing happened lol. No record was created in the CRMCall.

My code so far

	{
		try
		{
			// Declare and Initialize EpiDataView Variables
			EpiDataView edvGS_Order_Detail_DataView = ((EpiDataView)(this.oTrans.EpiDataViews["GS_Order_Detail_DataView"]));

			// Check if valid EpiDataView Row(s) are selected
			if ((edvGS_Order_Detail_DataView.Row < 0))
			{
				return;
			}

			// Declare and create an instance of the Adapter.
			CRMCallAdapter adapterCRMCall = new CRMCallAdapter(this.oTrans);
			adapterCRMCall.BOConnect();

			// Declare and Initialize Variables
			// TODO: You may need to replace the default initialization with valid values as required for the BL method call.
			string key1 = ((string)(edvGS_Order_Detail_DataView.dataView[edvGS_Order_Detail_DataView.Row]["OrderDtl_OrderNum"].ToString()));
			// Call Adapter method
			bool result = adapterCRMCall.GetNewCRMCall("orderhed", "1411", "1 ", " 1");

			// Cleanup Adapter Reference
			adapterCRMCall.Dispose();

		} catch (System.Exception ex)
		{
			ExceptionBox.Show(ex);
		}
	}

	private void tbOrderNotesNew_Click(object sender, System.EventArgs args)
	{
		MessageBox.Show("New Note");
		CallCRMCallAdapterGetNewCRMCallMethod();
		MessageBox.Show("New Note Done");
	}```

Calling the GetNewCRMCall method loads a new call into your adapter object. However, this is all in-memory and is wiped out when the adapter is disposed. You need to commit the adapter’s data to the database with the adapter’s Update method.

bool result = adapterCRMCall.GetNewCRMCall("orderhed", "1411", "1 ", " 1");
if (result)
    adapterCRMCall.Update();

Perfect that worked. Now it says I have to enter a call type. How do I add other fields that I want to update in the CRM Call. I’m sure I delcare them somewhere in the code but forgive me this is my first time doing this type of update.

To set other fields add this line (replacing [code] with the code in your system)

adapterCRMCall.CRMCallData.CRMCall[0].CallTypeCode = [code]

after

if (result)

and replace [code] with whatever the correct code is in your system

Okay, this still isn’t actually adding a record. I’m not getting any errors though.

Have you done a trace and identified what fields are being populated?

No, I haven’t I suppose I could just populate them all. The only reason I’m having to do it this way is my Dashboard isn’t subscribing properly. ugh!

This works if you still want to do it this way, you may have to close the Call Log and reopen so it will refresh

adapterCRMCall.BOConnect();
if (adapterCRMCall.GetNewCRMCall("OrderHed", "1411", string.Empty, string.Empty))
{
    adapterCRMCall.CRMCallData.CRMCall[0].CallTypeCode = [code];
    adapterCRMCall.CRMCallData.CRMCall[0].CallDesc = "TEST";
    adapterCRMCall.Update();
}