Error when trying to launch customization from another customization

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

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

When I try to run this code I get the error shown here. AUTOSN is an ID of a Process I have defined. Does anyone see what I have wrong?

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.SelectSerialNumbersEntry.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.

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

Unable to cast object of type ‘Ice.Lib.Framework.LaunchFormOptions’ to type ‘Erp.UI.App.SelectSerialNumbersEntry.SerialNumbersArgs’.

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

Believe that second parameter in your LaunchForm method needs to the MenuID not the processID

OK. I will look at that.

Ok. Not sure what you mean by the second parameter needs to be MenuID. I have the MenuID that’s defined and it is AUTOSN. It is a Process in Menu Maintenance though. Attached is the setup of it.

Theres your issue. Instead of using LaunchFormObject, you need to instantiate a SeriaNumbersArgs (and possible initialize some values)

Ok. I will try to see if I can do that in the future. I resolved the issue by using another existing customization and Environment variable.

Do you an example of code to help me? I am having this issue again and can’t avoid it this time.

I dont have any code, but I presume instead of using teh LaunchFormObject creation, you can do:

var lfo = new Erp.UI.App.SelectSerialNumbersEntry.SerialNumbersArgs();

Thank you. I will try that and let you know if its successful.

I tried this but it didn’t work either. This is on Serial Matching. I was getting the same error.

  1. var lfo = new Erp.UI.App.SerialMatchingEntry.SerialMatchingArgs(oTrans);
    ProcessCaller.LaunchForm(oTrans,“IMGO3420”, lfo);

Result: a message box stating “Could not find Assemblies/Materials to match” immediately on button click and then a message stating “Lower Level Serial Tracking not enabled for this site”.