AX D365 FTP Interface with Third Party System - Part 1 Define FTP Interface Parameters

Hi,

AX D365 FTP Interface with Third Party System


Define FTP Interface Parameters - Reference

1.1 Create New Table -  Key Field is extended to ParametersKey

1.2 Add Table Methods - So when creating the new company in the D365 AX, the parameters form should have the default values. To have the default values in the parameters we need to have the following code in the table level of find () of Parameters tables.

public class InterfaceParameters extends common
{

    public static boolean exist()
    {
        return (select RecId from InterfaceParameters).RecId != 0;
    }

    public static InterfaceParameters find(boolean _forupdate = false)
    {
        InterfaceParameters parameter;

        try
        {
            if (_forupdate)
                parameter.selectForUpdate(_forupdate);

            select firstonly parameter
                index Key
                where parameter.Key == 0;

            if (!parameter && !parameter.isTmp())
            {
                Company::createParameter(parameter);
            }

        }
        catch (Exception::DuplicateKeyException)
        {
            retry;
        }
        return parameter;
    }

}

1.3 Create New Form for FTP Interface Parameters

Parameters are FTP Address, FTP Folder, FTP UserName, FTP Password




1.4 Fetching FTP Details Class

public class InterfaceParametersCheck
{
    InterfaceParameters  parameters  = InterfaceParameters::find();

    public boolean FTPParameters()
    {
    if (!parameters.FTPAddress ||
            !parameters.FTPUserName ||
            !parameters.FTPPassword ||
                !parameters.FTPFolder8)
    {
        return checkFailed("FTP Interface Parameters missing");
    }
        return true;
    }

    public InterfaceParameters FTPDetails()
    {
        if (!parameters.FTPAddress ||
            !parameters.FTPUserName ||
            !parameters.FTPPassword ||
                !parameters.FTPFolder8)
        {
            return parameters;
        }
        return parameters;
    }
 }


Comments

Post a Comment