AX – D365FO – How to call a method of a calling Form objects

Suppose you ha ve Form A that calls Form B.

In Form B you want to call a method of Form A.

How to do this?

Follow these instructions.

First in Form B declare 2 variables

[Form]
public class Al0VendorActivityVendorSearch extends FormRun
{
FormRun                 callerObject;
Object                  object;

......

Then in the init method set callerobject

   public void init()
    {
        super();

        callerObject = element.args().caller();

......

Then in your method you can call the callerobject method. In this example the name of the callerobject method is “setStatesSelected”

    public void setStatesSelected()
    {
        str selectedStatesString = selectedStatesGrid.text();
        if(sysFormRun::hasMethod(callerObject, identifierStr("setStatesSelected")))
        {
            object = callerObject;
            object.setStatesSelected(selectedStatesString);
        }
    }

Rispondi

Inserisci i tuoi dati qui sotto o clicca su un'icona per effettuare l'accesso:

Logo di WordPress.com

Stai commentando usando il tuo account WordPress.com. Chiudi sessione /  Modifica )

Google photo

Stai commentando usando il tuo account Google. Chiudi sessione /  Modifica )

Foto Twitter

Stai commentando usando il tuo account Twitter. Chiudi sessione /  Modifica )

Foto di Facebook

Stai commentando usando il tuo account Facebook. Chiudi sessione /  Modifica )

Connessione a %s...