In Microsoft Dynamics 365 F&O, you can create a custom extension for the Experlogix integrator logic. The most common extension is to build a method that can be triggered using a Query in the Configurator that calls logic in Microsoft Dynamics 365 F&O. This page covers creating a chain of command for retrieving a single quote and a set of records.
The code examples provided on this page are for illustrative purposes only and do not constitute a functional solution.
Click below to download the example project zip file.
Retrieve a Single Value
This is used for retrieving a single value using a Query in the Configurator.
Unless otherwise specified, these steps should be executed in Microsoft Visual Studio.
-
In Visual Studio, create or select a model. This model must have Experlogix Integrator as a Referenced Package.
-
Add a class that extends
XplWebFunctionStd.[ExtensionOf(classStr(XplWebFunctionStd))] final class XplExampleWebFunction_Extension { … -
Create a void method with the name process in this class.
-
In the void method, create a variable to remember the current value of the
returnMessage. If the method being called is not defined in this class, it should be defined in another one (called before or after this one). -
Add as many cases to the switch statement as you need to call the methods. If the alias name passed in does not occur in this switch, restore the message text.
protected void process() { str retMessage; next Process(); retMessage = this.returnMessage; this.returnMessage = ''; switch (this.callFunctionName()) { case 'aliascustommethod': this.myCustomMethod(); break; default: this.returnMessage = retMessage; break; } } -
Add a wrapper method for all distinct calls.
private void myCustomMethod() { container callParms = this.getRequestParameters(); str retVal = XplExampleRequestFunctionValue::returnHelloWorld(callParms); this.valueOut(retVal); } -
Create another new class and give it a name. This class will contain the method(s) you wish to use. It gives you the framework for extending the methods that can be called in the standard Experlogix Integrator functionality with own methods.
internal final class XplExampleRequestFunctionValue { static str returnHelloWorld(container callArgs) { //declare variables that will hold values passed in ItemId itemId; AccountNum custId; int i, argslen, dim; str label, value; argslen = conLen(callArgs); label = conPeek(callArgs, 1); if (label && !strStartsWith(label, 'parameter')) { for (i = 1; i <= argslen; i+=2) { label = conPeek(callArgs, i); value = conPeek(callArgs, i + 1); switch (subStr(strLwr(label),1,3)) { case 'acc': case 'cus': custId = value; break; case 'ite': itemId = value; break; } } } if (itemId == 'bye') { return 'hello world'; } return 'not found'; } }
The container holds all arguments passed into Microsoft Dynamics 365 F&O in the request.
-
Test the logic using the Experlogix Logging functionality. For more information on Logging, see Logging.
-
Create a file and give it a name starting with QV.
-
Include the following text in the file, for example:
{ "name": "getvalue", "description": "", "queryType": "procedure", "queryText": "aliascustommethod", "parameters": [ { "name": "customer", "valueType": "String", "value": "US-001", "parameterType": "Undefined" }, { "name": "item", "valueType": "String", "value": "D0011", "parameterType": "Undefined" } ] } -
Open Experlogix logging in Microsoft Dynamics 365 F&O.
-
Select Process from File.
-
Start the log or trace monitor.
-
View the response.
The system retrieves the values for a single quote.
-
Retrieve a Set of Records
This is used for retrieving a set of records using a query in the Configurator.
-
In Visual Studio, create or select a model. This model must have Experlogix Integrator as a Referenced Package.
-
Add a class that extends
XplWebFunctionStd.[ExtensionOf(classStr(XplWebFunctionStd))] final class XplExampleWebFunction_Extension { …
This class is a wrapper class that calls logic, which is located elsewhere. What logic it runs is determined by examining the content of the request.
-
Create a void method with the name Process in this class.
-
In the method, create a variable to remember the current value of the
returnMessage. If the method being called is not defined in this class, it should be defined in another one (called before or after this one). -
Add as many cases to the switch statement as you need to call the methods. If the alias name passed in does not occur in this switch, restore the message text.
protected void process() { str retMessage; next Process(); retMessage = this.returnMessage; this.returnMessage = ''; switch (this.callFunctionName()) { case 'aliascustommethod': this.myCustomMethod(); break; default: this.returnMessage = retMessage; break; } }
-
Test the logic using the Experlogix Logging functionality more information on Logging, see Logging.
-
Create a file and give it a name starting with QV.
-
Add those columns that you wish returned from the record set.
{ "name": "getvalue", "description": "", "queryType": "procedure", "queryText": "getfilteredvendorgroups", "columns": [ { "name": "VendGroup", "column": "VendGroup" }, { "name": "Name", "column": "Name" } ], "parameters": [ { "name": "filter", "valueType": "String", "value": "company", "parameterType": "Undefined" } ] } -
Open Experlogix logging in Microsoft Dynamics 365 F&O.
-
Select Process from File.
-
Start the log or trace monitor.
-
View the response.
The system retrieves the values for a set of records.
-