Home > Application Integration Framework > AIF – Adding user parameters in dialog

AIF – Adding user parameters in dialog

While working on AIF, I had a requirement for adding user parameters in AIF dialog so that AIF batch runs based on those parameters . I found that you to have perform following steps in order to so :

  1. Create a new Class that extends from  AxdSendContext Class.

class AxdSendQASalesItemContext extends AxdSendContext
{
    boolean             deliverNow;

    #define.CurrentVersion(2)
    #define.version1(2)
    #localmacro.CurrentList
        deliverNow
    #endmacro

}

2 . Override the pack and unpack method in the above class for required dialog fields  and add parm methods for each of dialog fields to be added  the   Send     dialog.

public boolean parmdeliverNow(boolean _deliverNow = deliverNow)
{
    if (! prmisdefault(_deliverNow))
    {
        deliverNow = _deliverNow; 
        return deliverNow;

}

3.  Add the dialog fields required in Send class

public Object dialog(DialogRunbase _dialog)
{
    DialogRunbase               dialogRunbase;
    ;

   dialogRunbase = super(_dialog);

   dlgDeliverNow = dialogRunbase.addField(typeid(NoYesId));
   dlgDeliverNow .value(this.parmdeliverNow());

   return dialog;

}

4.   Override the packSendContext method in corresponding Send Class and get the instance of your Context Class ( created in Step 1) and call the dialog parm     methods to get the values of dialog fields using the instance.

protected container packSendContext()
{
    AxdSendQASalesItemContext     axdSendQASalesItemContext;
    if (classidget(axdSendContext) == classnum(AxdSendQASalesItemContext))
    {
        axdSendQASalesItemContext = axdSendContext ;

        axdSendQASalesItemContext.parmdeliverNow(this.parmdeliverNow());
        axdSendQASalesItemContext.parmXMLDocPurpose(this.parmXmlDocPurpose());
    }

   return super() ;

}

5.  Override the unpackPropertybag method in corresponding Axd Class and get the instance of instance of  Context Class ( created in Step 1) and set the value

of dialog field obtained from Context Class.

protected void unpackPropertyBag(AifPropertyBag _aifPropertyBag)
{
    AxdSendQASalesItemContext axdSendQASalesItemContext = AxdSendQASalesItemContext::create(_aifPropertyBag);
    this.parmDocPurpose(axdSendQASalesItemContext.parmXMLDocPurpose());
    this.parmdeliverNow(axdSendQASalesItemContext.parmdeliverNow());

}

6. And finally you are able to select  the parameter value in Send dialog 🙂 .You can write necessary logic in Axd Class , for example, in the prepareforsave  method , you can write the logic to select all the records from SalesLine where DeliverNow field is not null based on this parameter.

Delivernow

Advertisements
  1. Sukrut
    June 25, 2010 at 10:43 am

    Thanks Sumit! This information is very useful looking for such a information on AIF

  2. June 29, 2010 at 4:23 pm

    This is a very informative blog

  3. August 30, 2010 at 10:45 am

    Nice info 🙂 Keep blogging.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: