Launch form with parameters: how can I get back information from the called form?

Hello all,

I am using the following code to call the CRMCall form

private void OpenCRMCall()
	{
		LaunchFormOptions launchObject = new LaunchFormOptions();
		launchObject.IsModal = false;
		
		launchObject.ValueIn = "TASK"; //valuein property can be accessed when the other form loads.
		ProcessCaller.LaunchForm(oTrans,"CRGO6100",launchObject); //parameters are as follows: 

	}````
The user is asked for some information in the CRM call form that I want to retreive back into the calling form.

How about I could do that?
Can the launchObject.ValueIn be other than a string?  like an array[]?

Thank you.
1 Like

Value in can be any object. I’ve put together a little example on my github (not sure if I’m breaking any site rules, so sorry in advance)

1 Like

Thanks Aaron,

I did something similar by declaring a string array as the “object”
When in the called form, Got an SQL error and it resulted with the ContextValue being null…

I tried with a DataRow to pass through and got same error, and same null value.

Revert back to not use launch form options and it opened ok.

So must be something in the setup of the lfo…

I need to pass to plan B to resolve my issue… but will try to pursue my testing in a near future…

Thanks for your input.

Pierre

On your “recipient form” what does your code look like to accept the LaunchFormOptions?

CRMCallForm expects a special lfo strongly typed. Search the forum I believe that @Chris_Conn has an example somewhere

Thanks Jose,

This aspect just put me out of my sleep this morning… ( I admit … I dream of Epicor !!! :sleeping:) and remembered some recent post about what you mentionned…

But my plan B worked finally.

Nevertheless I shall test this for a future use… :wink:

Thanks.

Pierre

Sounds like he is looking for a callback to the original form. Luckily Jose, has figured this out.

//calling form

 // Create new LaunchFormOptions and set the CallBackToken
        LaunchFormOptions lfo = new LaunchFormOptions();
        // the CallBackMethod allows us to respond to specific callback
        lfo.CallBackMethod = specificCallBackHandler;
        ProcessCaller.LaunchForm(oTrans, "UD01", lfo);



//also on the form
  // handle the response from the specific Callback delegate
    void specificCallBackHandler(object sender, object CallBackArgs)
    {
        // verify there is CallBack args
        if (CallBackArgs == null) return;
        EpiMessageBox.Show("ShipVia form handles callback with message:  " + CallBackArgs.ToString());
    }

//Called Form Customization

//On the Called Form you can Call Back to the calling form with this code
if (UD01Form.LaunchFormOptions != null &&
            UD01Form.LaunchFormOptions.CallBackMethod != null)
            UD01Form.LaunchFormOptions.CallBackMethod(oTrans, "This is a Message from UD01::CallBackMethod delegate");
3 Likes

Yes exactly. The called form was poping the user to enter specific info that the calling form needed to use.
And in this specific issue… unfortunatly it was the CRMCallForm …which is more complex to address than other forms, as per Jose indicated…

Thanks Chris for your post it will be usefull.

Will test eventually…

Pierre

Using this code:
LaunchFormOptions LFO = new LaunchFormOptions();
LFO.ContextValue = new DataView(ds.Tables[“UD20”]);
LFO.IsModal = false;
LFO.SuppressFormSearch = true;
LFO.CallBackMethod = MyCallBackHandler(oTrans, CallBackArgs);
ProcessCaller.LaunchForm(oTrans, “UDSUBSEL”, LFO);

void MyCallBackHandler(object sender, object CallBackArgs)
{
    // verify there is CallBack args
    if (CallBackArgs == null) return;
    EpiMessageBox.Show("CallBack message:" + CallBackArgs.ToString());
}

I receive the error " Cannot implicitly convert type ‘void’ to ‘Ice.Lib.Framework.ProcessCallerCallBack’ "

What am I doing wrong here? (Besides trying to be a programmer)

Try changing this:
LFO.CallBackMethod = MyCallBackHandler(oTrans, CallBackArgs);

To this:
LFO.CallBackMethod = MyCallBackHandler;

That worked! Thanks!

Hi, I am calling MES end activity form vi launch form on a new button click added in Work Queue form. but I got error “Object reference not set to an instance”
Can you help me how I can load the form with active work data?
My code is as follow:
private void btn_End_Click(object sender, System.EventArgs args)
{
// ** Place Event Handling Code Here **
EpiDataView edv= (EpiDataView)(oTrans.EpiDataViews[“ActiveWork”]);
LaunchFormOptions lfo = new LaunchFormOptions();
lfo.ContextValue = edv;
ProcessCaller.LaunchForm(WorkQueueForm,“OP-06.01”,lfo);
}

Please see attached error and button I added