Run WebAPI Onload

Context:

I have an integration associated with a webapi. Requests are successfully submitted and received on button click. 

Instead of the button click, I want to populate a paging grid using the webapi results on page load.

Tried placing the integration call in the "onload" and "with", however the webapi call doesn't seem to be triggered at all.

Disclaimer: I'm a newbie and there may be a simpler way to accomplish what I want.. simply populating a grid using an api call without user intervention.

  Discussion posts and replies are publicly visible

Parents
  • Have you tried setting the integration as the value of a local variable, then using that local variable in the grid? 

    https://docs.appian.com/suite/help/19.1/Grid_Tutorial.html#paging-and-sorting-configurations

    For example, in the docs for the paging grid, (which you can find if you scroll slightly *up* from the anchor tag in the link above) they include an example of how to set value of a local variable called local!datasubset using the queryrecord() function. In the same way, you can set your datasubset variable for your paging grid (let's use the same local!datasubset variable name to be consistent) and specify your integration as its value. So, yours might be.  local!datasubset: rule!XYZ_MyWebApiIntegtation() 

  • Hello, I am facing a very similar issue. I try to trigger the integration on page load by assigning it to a local variable in the following fashion:

    local!Trigger:a!refreshVariable(
      value:rule!TheIntegration(
        inputs:"inputs",
        onSuccess:{
          a!save(local!Result,a!fromJson(fv!result.Result))
        },
        onError:a!save(local!RTError,fv!error.message)
      ),
      refreshAlways: true
    )

    I do not get any errors but the result of calling the API is not stored anywhere. The variable local!Trigger will have the value "Smart Service" but I am getting no result or error. Note that I had to include "a!refreshVariable()" so that I did't get an error message saying "... smart service functions cannot be used in a local variable unless "refreshAlways" is true for that local variable using the a!refreshVariable() function."

    Note: The API is tested and works perfectly on button click.

Reply
  • Hello, I am facing a very similar issue. I try to trigger the integration on page load by assigning it to a local variable in the following fashion:

    local!Trigger:a!refreshVariable(
      value:rule!TheIntegration(
        inputs:"inputs",
        onSuccess:{
          a!save(local!Result,a!fromJson(fv!result.Result))
        },
        onError:a!save(local!RTError,fv!error.message)
      ),
      refreshAlways: true
    )

    I do not get any errors but the result of calling the API is not stored anywhere. The variable local!Trigger will have the value "Smart Service" but I am getting no result or error. Note that I had to include "a!refreshVariable()" so that I did't get an error message saying "... smart service functions cannot be used in a local variable unless "refreshAlways" is true for that local variable using the a!refreshVariable() function."

    Note: The API is tested and works perfectly on button click.

Children