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);
}
}
No comments:
Post a Comment