Filling a DataView With the Output of a Function Call [Tutorial]

This example will cover using a function that calls a BAQ that accepts an input paramater and then returns the result dataset as an output parameter from the function to the calling Kinetic app and populates a dataview and displays some of the fields.

  1. It is assumed that a BAQ has already built and has been configured to accept at least one parameter:

  2. The Epicor Function will be set up as follows (you don’t actually need the “custom code widget” flag):

Since we are only passing one parameter, we’ll use the set field widget

  1. Navigate to App Studio for the screen that you will want to call the function from

  2. Create a new layer or use an existing one

  3. For this example we are going to create an event that triggers when a part number is populated on an order detail line in order entry

  4. Create a DataView to hold the results of our function response:

    1. We populate the DataSetID fields with whatever we called our DataSet output parameter in our function. We called our DataSet output parameter dsBAQResults so we need to use that same value for our DataSetID otherwise Epicor will not be able to parse it and populate our DataView.
  5. Create a new event:

  6. Give the event a name

  7. Set the event trigger to the following:

  8. Add an erp-function widget to the designer:

  9. Set it up as follows:
    1)Top level settings:

    1. Set each method parameter (these are the inputs for your Epicor Function). Note: Earlier versions of Kinetic do not automatically populate your function input parameters, in that case you will just create one Method Parameter in this panel for each Function Input Parameter you have and set the field name and data type to match what is defined in your function.

    2. Navigate to the Respose Parameters panel and create a new response parameter (we only have one in this case as we are only returning one thing from our function: the dsBAQResults DataSet)

    3. Populate it with the following information:

  10. Let’s confirm that we are indeed now populating our Custom_BAQResults DataView.

    1. Make sure you have saved your changes

    2. Click on the Play button on the top right of App Studio to launch your layer

    3. Enable Debugging:

    4. Load in a record and navigate to the Line Detail page:

    5. Open the dev tools panel with Ctrl + Shift + i

    6. Change the part number or add a line/part if not using an existing line

    7. This should have triggered our event, so let’s log our DataViews to the dev console by using Ctrl + Alt + v:

      1. The red text indicates that a DataView has been updated
    8. Expand the Custom_BAQResults DataView to make sure we populated it:

    9. Success!

  11. Now we will set up a new field to hold the value of one of our results

  12. Navigate back to the App Studio tab and on the Application Map, select the Lines → Detail page and click on the Pencil Icon to edit:

  13. Add a new text box

  14. Set the boxes EpiBinding to be one of the columns in our Custom_BAQResults DataView, the names will match the Alias column from our BAQ:

    1. Set the EpiBinding of the text box:

    2. Run the layer to test:

  15. Success!

Please roast me in the comments for anything I got wrong. :slight_smile:


Don’t worry I will when I actually have time to read it.

For now I’ll give you a :clap: for what I’m sure is an awesome post.

Wondering when you would show up.

1 Like

You can leave the Api-Key blank. Still shows as required but it’s not for internal calls anymore.

No need to store sensitive information in the layer anymore.

Correct! I can’t recall exactly which version still required it. If someone is following along in an older version then know that you may require that field. But if you are on cloud you definitely don’t need it.

1 Like

Not sure this is a good long-term security strategy though…