Total Pageviews

18,949

Thursday, December 27, 2018

Trigger logic App from D365 Part 2







In this part we will see how to trigger logic app form D365FO (Dynamics 365 For operations)


For logic App details visit Part 1 

Create a class name :LogicAppHelper
with method : callPostWebAPI


class LogicAppHelper
{
    #define.ApplicationJson('application/json')

    public boolean callPostWebAPI(URL _serviceOperation, Comments _postData, str _header ='')
    {
        RetailWebRequest request;
        RetailWebResponse response;
       
        boolean ret;
        ListEnumerator  listEnmr;
        List dataList;
        RetailCommonWebAPI webApi = RetailCommonWebAPI::construct();
   
        try
        {
            response = webApi.makePostRequest(_serviceOperation, _postData, _header #ApplicationJson);

        }
        catch
        {
            ret = false;
        }
   
        return ret;
    }
}



Now we will create runable class (job)

class LogicAppConnectionJob
{        
    /// <summary>
    /// Runs the class with the specified arguments.
    /// </summary>
    /// <param name = "_args">The specified arguments.</param>
    public static void main(Args _args)
    {    
        LogicAppHelper  appHelper = new LogicAppHelper();
        container       conValues;
        AccountNum custAccount;
        str             callingparam ;
        ;
        
        custAccount = 'US-001';

        callingparam  = "{'CustomerAccount':'" + custAccount +" '}";

       //appHelper.callPostWebAPI(URL ,Comments,_header
       // URL : URL generated while creating logic for details see part 1
       // Comments: passing customer account to logic app as JSON Schema for details see part 1

        appHelper.callPostWebAPI('https://URL-Generated-By-Logic-App-Response-Receiver' ,callingparam);
    }

}

hopefully this will help you all...

No comments:

Post a Comment

D365FO and Sharepoint integration issue on dev box: "You are not authorized to connect to 'https://sharepoint.sharepoint.com/

Troubleshooting SharePoint Integration After Upgrading D365FO to Version .42 After upgrading to Dynamics 365 Finance and Operations (D365FO)...