Error when Calling CRM Call Entry screen from Receipt Entry screen

Hi,

using 10.1.400.31 and trying to open a menu from another screen (like I usually do) but seems that trying to open “CRM Call Entry” screen from “Receipt Entry” using the following code:

LaunchFormOptions lfo = new LaunchFormOptions();
lfo.ContextValue = “test”;
ProcessCaller.LaunchForm(oTrans, “CRGO6100”, lfo);

is giving the error below:

Application Error

Exception caught in: Ice.Lib.EpiClientLib

Error Detail

Message: The process caller failed to invoke method LaunchForm in Ice.Lib.App.Launch in Erp.UI.CRMCallEntry.dll
Inner Exception Message: Exception has been thrown by the target of an invocation.
Program: Ice.Lib.EpiClientLib.dll
Method: InvokeReflectedMethod

Client Stack Trace

at Ice.Lib.Framework.PCallReflector.InvokeReflectedMethod(MethodInfo Method, Object Object, Object[] MethodParams, String className, String assemblyName)
at Ice.Lib.Framework.PCallReflector.LaunchDotNet(String assemblyName, String className, Hashtable ctorList, String methodName, Hashtable methodList)

Inner Exception

Exception has been thrown by the target of an invocation.

Inner Stack Trace

at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Ice.Lib.Framework.PCallReflector.InvokeReflectedMethod(MethodInfo Method, Object Object, Object[] MethodParams, String className, String assemblyName)

Inner Exception

Object reference not set to an instance of an object.

Inner Stack Trace

at Ice.Lib.App.Launch.LaunchForm(Object LaunchObject)

.
.

.

.
If I try to call it without parameters like this:

ProcessCaller.LaunchForm(oTrans, “CRGO6100”);

the screens opens but gives this error below:

Server Side Exception

Error accessing the database: Incorrect syntax near ‘)’.

Exception caught in: Epicor.ServiceModel

Error Detail

Description: Error accessing the database: Incorrect syntax near ‘)’.
Program: System.Data.dll
Method: OnError
Original Exception Type: SqlException
SQL Line Number: 9
SQL Error Number: 102
Framework Method: b__1
Framework Line Number: 278
Framework Column Number: 36
Framework Source: b__1 at offset 1245 in file:line:column c:_Releases\ICE\3.1.400.31\Source\Framework\Epicor.Ice\Services\TablesetBound.cs:278:36

Server Trace Stack: at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action1 wrapCloseInAction) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) at System.Data.SqlClient.SqlDataReader.TrySetMetaData(_SqlMetaDataSet metaData, Boolean moreInfo) at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData() at System.Data.SqlClient.SqlDataReader.get_MetaData() at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption) at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
at System.Data.SqlClient.SqlCommand.ExecuteReader()
at Ice.TablesetBound`3.<>c__DisplayClass8.b__1() in c:_Releases\ICE\3.1.400.31\Source\Framework\Epicor.Ice\Services\TablesetBound.cs:line 278

Client Stack Trace

at Epicor.ServiceModel.Channels.ImplBase`1.ShouldRethrowNonRetryableException(Exception ex, DataSet[] dataSets)
at Erp.Proxy.BO.CRMCallImpl.GetRows(String whereClauseCRMCall, String whereClauseCRMCallAttch, String whereClauseCRMCallCnt, String whereClauseCRMCallHistory, Int32 pageSize, Int32 absolutePage, Boolean& morePages)
at Erp.Adapters.CRMCallAdapter.OnGetRows(SearchOptions opts, Boolean& MorePages, String[] whereClauses)
at Ice.Lib.Framework.EpiBaseAdapter.GetRows(SearchOptions opts, Boolean& morePages)
at Ice.Lib.Searches.EpiSearchEngine.SearchUsingAdapterMethod(SearchOptions options)
at Ice.Lib.Searches.EpiSearchEngine.SearchIt(SearchOptions options, DataSet& results, Boolean& usedAdapter)
at Ice.Lib.Searches.EpiSearchEngine.SearchIt(SearchOptions options)
at Ice.Lib.Framework.EpiBaseAdapter.InvokeSearch(SearchOptions opts)
at Erp.UI.App.CRMCallEntry.CRMCallTransaction.adapterInvokeSearch(SearchOptions o)
at Ice.Lib.Framework.EpiMultiViewTransaction.InvokeSearch(SearchOptions opts)
at Erp.UI.App.CRMCallEntry.CRMCallTransaction.GetCallHistory()

Inner Exception

Incorrect syntax near ‘)’.

Inner Stack Trace

Any idea?

thanks,

Without digging too much I figured I’d offer a couple things to check:

It appears the CRM screen only likes to be called from the following screens:
“CustomerEntry”
“HelpDeskEntry”
“QuoteEntry”
“TaskListEntry”
“VendorEntry”

It seems to want this as your contextValue (not just a text value):
string[] nodeKeyList = new string[]
{
“Table.KeyNum”,
“Customer.CustNum”,
“Customer.CustID”,
“Table.TaskID”,
“Table.TaskSeq”,
“Table.RelatedToFile”
};

the values of the strings I mean - those are there for you to reference what vals it wants

Thanks for replying Chris.

However, are you sure of that? I tried launching the “CRM Call Entry” screen from both “Supplier Maintenance” (VendorEntry) and “Case Entry” (HelpDeskEntry) with the same errors when testing:

ProcessCaller.LaunchForm(oTrans, “CRGO6100”, lfo);

or

ProcessCaller.LaunchForm(oTrans, “CRGO6100”);

Ive also tried passing a string[] as the lfo.ContextValue, but same behavior. Any idea?

thanks,

I’m never sure :slight_smile: I based all of this info from the code in Erp.UI.CRMCallEntry

Specifically, I was looking at the override of the Launch object-> public class Launch : EpiBaseLaunch

string[] nodeKeyList = new string[]
						{
							"Table.KeyNum",
							"Customer.CustNum",
							"Customer.CustID",
							"Table.TaskID",
							"Table.TaskSeq",
							"Table.RelatedToFile"
						};
						EpiContextValue[] valuesByNodeKey = ContextValueProvider.GetValuesByNodeKey(nodeKeyList, launchFormOptions.ContextValue);
						if (valuesByNodeKey.GetValue(0) != null)
						{
							primaryID = valuesByNodeKey[0].Value;
						}
						if (valuesByNodeKey.GetValue(1) != null)
						{
							text = valuesByNodeKey[1].Value;
						}
						if (valuesByNodeKey.GetValue(2) != null)
						{
							customerName = valuesByNodeKey[2].Value;
						}
						if (valuesByNodeKey.GetValue(3) != null)
						{
							taskID = valuesByNodeKey[3].Value;
						}
						if (valuesByNodeKey.GetValue(4) != null)
						{
							taskSeqNum = valuesByNodeKey[4].Value;
						}
						if (valuesByNodeKey.GetValue(5) != null)
						{
							taskRelatedToFile = valuesByNodeKey[5].Value;
						}

Also I am not sure if it matters but in the code, it is look for the RELATEDTOFILE to be set in some cases (not sure it applies to you):

//In forms constructor - looks like it going to search with it (and you error appears to be search related)
	if (this.trans.PrimaryAdapter != null && Args != null)
			{
				this.SearchName = ((EpiBaseAdapter)this.trans.PrimaryAdapter).PrimarySearchForm + "-" + Args.RelatedToFile.ToUpper();
			}

Chris,

thanks for sharing the code. However, I tried to use all alterations I could think of for the ContextValue but always the same result. The thing is I dont need to instantiate any new or existing record. I simply need the screen to open with no error and do custom action based on a string I want to pass (I dont think I need the code you posted to do anything). My last attempt:

string[] nodeKeyList = new string[]
{
“”,
“”,
“”,
“”,
“”,
“”
};
lfo.ContextValue = nodeKeyList;

	ProcessCaller.LaunchForm(oTrans, "Erp.UI.CRMCallEntry", lfo);

If anyone has other idea, feel free to share :slight_smile:

thanks,

CRMCallEntry is a pain in the rear because it doesn’t expect a regular LFO Object but rather an implementation of CRMCallArgs which requires several parameters. What is the end goal here? are you trying to make a New CRM Call?

Thanks for the quick reply Jose,

The ultimate goal would be to have a new call ready to save (not saved yet though, but user wouldn’t have to click New Call button) with some fields being pre-filled (depending on the parameters being passed). We would like to have the call linked to a specific receipt. Fields to be pre-filled:

-Supplier (VendorNum/VendorID)
-PurPoint
-PONum (UD field we added to CRMCall_UD)
-PackSlip (UD field we added to CRMCall_UD)

While not being sure if this is possible, my attempt was to at least try to pass the parameters to the CRM Call Entry screen for having the fields mentioned pre-filled when user click New Call.

thanks,

It is not impossible just pretty dificult becasue of the extensive use of LFO in that particular screen
Try this
Pass in CRMCallArgs with a ContextValue == null
and a ValueIn that is an XMLDocument where it has a child node with the name “Mode” and hthe innerText of “AddNew”
Then you can passs other nodes into that XML document and parse it back when the form loads.
This should cause the screent o click “new Call” for you and that’s it.

I am getting this error when I try to launch the Serial Matching screen on a button click. I have to have this working fast. Does anyone know what I need to do to make it work? Here is my launch code.

LaunchFormOptions lfo = new LaunchFormOptions();
lfo.IsModal = false;
lfo.ValueIn = “”;

ProcessCaller.LaunchForm(oTrans, “IMGO3420”, lfo);