Namespace Does Not Exist Error

I am attempting to duplicate and modify the Salesperson Workbench as a new Dashboard. I added a new Tracker View under CRM Calls that should have a button on the tracker to create a new CRM Call or open an existing one by calling Erp.UI.CRMCallEntry.dll. I copied all the code, including all the ‘usings’, from the original Tracker View that included this functionality, then updated the reference to the DashboardViewPanel by changing the DBTVP ID. The new Tracker View originally worked, but once I deleted the original one, I get this error during compilation.

--------compile errors------------
Error: CS0234 - line 36 (35) - The type or namespace name ‘UI’ does not exist in the namespace ‘Erp’ (are you missing an assembly reference?)

The file Erp.UI.CRMCallentry.dll does exist in the client directory.
But the file doesn’t exist in the IIS directory:

I am pretty new to customizations, so the acronym I just learned ELI5 is certainly appropriate for me (Explain Like I’m 5).

Here’s my code:

// **************************************************
// Custom code for c5baf86c-dd94-4331-b6c7-4ac06581970a
// Created: 7/19/2019 8:17:38 AM
// **************************************************
using System;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Windows.Forms;
using Ice.BO;
using Ice.UI;
using Ice.Lib;
using Ice.Adapters;
using Ice.Lib.Customization;
using Ice.Lib.ExtendedProps;
using Ice.Lib.Framework;
using Ice.Lib.Searches;
using Ice.UI.FormFunctions;
using System.Xml;
using Erp.Adapters;
using Erp.BO;
using Erp.UI.App.CRMCallEntry;

public static class Script
{
	// ** Wizard Insert Location - Do Not Remove 'Begin/End Wizard Added Module Level Variables' Comments! **
	// Begin Wizard Added Module Level Variables **

	// End Wizard Added Module Level Variables **

	// Add Custom Module Level Variables Here **

	public static void InitializeCustomCode()
	{
		// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Variable Initialization' lines **
		// Begin Wizard Added Variable Initialization

		// End Wizard Added Variable Initialization

		// Begin Wizard Added Custom Method Calls

		Script.btnUpdateCRM.Click += new System.EventHandler(Script.btnUpdateCRM_Click);
		Script.btnAddCRM.Click += new System.EventHandler(Script.btnAddCRM_Click);

		// End Wizard Added Custom Method Calls
	}

	public static void DestroyCustomCode()
	{
		// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Object Disposal' lines **
		// Begin Wizard Added Object Disposal

		Script.btnUpdateCRM.Click -= new System.EventHandler(Script.btnUpdateCRM_Click);
		Script.btnAddCRM.Click -= new System.EventHandler(Script.btnAddCRM_Click);

		// End Wizard Added Object Disposal

		// Begin Custom Code Disposal

		// End Custom Code Disposal
	}
	private static void btnUpdateCRM_Click(object sender, System.EventArgs args)
	{
		// ** Place Event Handling Code Here **
		AddUpdateCRMCall("Update");
	}

	private static void btnAddCRM_Click(object sender, System.EventArgs args)
	{
		// ** Place Event Handling Code Here **
		AddUpdateCRMCall("AddNew");
	}
	private static void AddUpdateCRMCall(string launchType)
	{
	    IDashboardViewPanel vuPanel = DBTVP_c5baf86c_dd94_4331_b6c7_4ac06581970a as IDashboardViewPanel;
	    if (vuPanel == null) return;
    
	    string custID = string.Empty;
	    string key1 = string.Empty;
	    string key2 = string.Empty;
	    string key3 = string.Empty;
	    string relToFile = string.Empty;
	    string debugString = string.Empty;
	    int callSeqNum = 0;
	    int custNum = 0;
	    bool LaunchOK = true;
		
		try
		{
			if (launchType == "AddNew")
			{

				custNum = Convert.ToInt32(vuPanel.GetCurrentPublishedValue("zCustomer01- Customer Tracker Query: Customer_CustNum").ToString());
				
				if (custNum < 0)
				{
					LaunchOK = false;
				}
				else
				{
					custID = custNum.ToString();
					relToFile = "customer";
					key1 = custNum.ToString();
					key2 = custNum.ToString();
				}
			}
			else
			{
				if (vuPanel.CurrentRow > -1)
				{
					custID = vuPanel.DataViewer.dataView[vuPanel.CurrentRow]["Customer_CustID"].ToString();
					custNum = Convert.ToInt32(vuPanel.DataViewer.dataView[vuPanel.CurrentRow]["CRMCall_CallCustNum"].ToString());
				}
				else
				{
					custID = String.Empty;
					custNum = 0;
				}
				
				if (custNum < 1)
				{
					LaunchOK = false;
				}
				else
				{
					relToFile = vuPanel.DataViewer.dataView[vuPanel.CurrentRow]["CRMCall_RelatedToFile"].ToString();
	                key1 = vuPanel.DataViewer.dataView[vuPanel.CurrentRow]["CRMCall_Key1"].ToString();
	                key2 = vuPanel.DataViewer.dataView[vuPanel.CurrentRow]["CRMCall_Key2"].ToString();
	                key3 = vuPanel.DataViewer.dataView[vuPanel.CurrentRow]["CRMCall_Key3"].ToString();
	                callSeqNum = Convert.ToInt32(vuPanel.DataViewer.dataView[vuPanel.CurrentRow]["CRMCall_CallSeqNum"].ToString());
				}
			}
		}
		catch
		{
		   LaunchOK = false;
		}
		if (LaunchOK)
		{
			XmlDocument xDoc = new XmlDocument();
			XmlNode xDocElem = xDoc.CreateElement("Test");
			XmlNode xNodeMode = xDoc.CreateElement("Mode");
			xNodeMode.InnerText = launchType;
			xDocElem.AppendChild(xNodeMode);
			xDoc.AppendChild(xDocElem);	
			CRMCallArgs crmArgs = new CRMCallArgs(relToFile, key1, key2, key3, callSeqNum.ToString(), custID);
			crmArgs.ValueIn = xDoc;
			ProcessCaller.LaunchForm(DBTVP_c5baf86c_dd94_4331_b6c7_4ac06581970a , "Erp.UI.CRMCallEntry.dll", crmArgs);
		}
	}

}

@alintz, Can you try commenting using Erp.UI.App.CRMCallEntry; and check…

With the using commented out, I get:
--------compile errors------------
Error: CS0246 - line 441 (440) - The type or namespace name ‘CRMCallArgs’ could not be found (are you missing a using directive or an assembly reference?)
Error: CS0246 - line 441 (440) - The type or namespace name ‘CRMCallArgs’ could not be found (are you missing a using directive or an assembly reference?)

I found my problem. I had been focused on copying and double checked all the ‘using’ library statements. What I didn’t really understand was that I had to also have a reference to the dll. So, I opened Tools > Assembly Reference Manager > Add Custom Ref and point to the dll in my client directory, and the error was gone.
image

1 Like