<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.appian.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Run WebAPI Onload</title><link>https://community.appian.com/discussions/f/integrations/14829/run-webapi-onload</link><description>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</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Run WebAPI Onload</title><link>https://community.appian.com/thread/75563?ContentTypeID=1</link><pubDate>Fri, 24 Jul 2020 20:51:29 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:ac4e7a4c-f07c-42c4-9a08-c8a5a73c566b</guid><dc:creator>Omkar Ambardekar</dc:creator><description>&lt;p&gt;Erik,&lt;/p&gt;
&lt;p&gt;Your expression has onSuccess/onError with a!save() which means you are trying to modify data after calling the integration. On loading an expression/interface you will only be able to call integrations that query data, not the ones that modify data - see here:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://docs.appian.com/suite/help/20.2/Call_an_Integration.html#call-an-integration-to-modify-data-in-an-interface-component-or-web-api"&gt;https://docs.appian.com/suite/help/20.2/Call_an_Integration.html#call-an-integration-to-modify-data-in-an-interface-component-or-web-api&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;quot;Integrations that modify data are called like&amp;nbsp;&lt;/span&gt;&lt;em&gt;smart service functions&lt;/em&gt;&lt;span&gt;&amp;nbsp;using the&amp;nbsp;&lt;/span&gt;&lt;code class="highlighter-rouge"&gt;rule!&lt;/code&gt;&lt;span&gt;&amp;nbsp;domain and can only be used in the&amp;nbsp;&lt;/span&gt;&lt;a href="https://docs.appian.com/suite/help/20.2/executing_smart_services.html"&gt;saveInto parameter of a component&lt;/a&gt;&lt;span&gt;&amp;nbsp;or in a&amp;nbsp;&lt;/span&gt;&lt;a href="https://docs.appian.com/suite/help/20.2/Designing_Web_APIs.html#executing-a-smart-service"&gt;Web API&lt;/a&gt;&lt;span&gt;.&amp;quot;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Check &lt;em&gt;hania&amp;#39;s&amp;nbsp;&lt;/em&gt;response above where the Integration object&amp;#39;s Usage was changed from Modified Data to &lt;strong&gt;Queries Data&lt;/strong&gt;. If you do that you can then get the result directly in your local!trigger variable.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://docs.appian.com/suite/help/20.2/images/Create_an_Integration/integration_definition_connection_auth.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Run WebAPI Onload</title><link>https://community.appian.com/thread/75555?ContentTypeID=1</link><pubDate>Fri, 24 Jul 2020 10:55:44 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:937df63b-262c-44fc-8c3c-7d87e76dec09</guid><dc:creator>Erik</dc:creator><description>&lt;p&gt;Hello, I am facing a very similar issue.&amp;nbsp;I try to trigger the integration on page load by assigning it to a local variable in the following fashion:&lt;/p&gt;
&lt;p&gt;local!Trigger:a!refreshVariable(&lt;br /&gt;&amp;nbsp; value:rule!TheIntegration(&lt;br /&gt;&amp;nbsp; &amp;nbsp; inputs:&amp;quot;inputs&amp;quot;,&lt;br /&gt;&amp;nbsp; &amp;nbsp; onSuccess:{&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; a!save(local!Result,a!fromJson(fv!result.Result))&lt;br /&gt;&amp;nbsp; &amp;nbsp; },&lt;br /&gt;&amp;nbsp; &amp;nbsp; onError:a!save(local!RTError,fv!error.message)&lt;br /&gt;&amp;nbsp; ),&lt;br /&gt;&amp;nbsp; refreshAlways: true&lt;br /&gt; )&lt;/p&gt;
&lt;p&gt;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 &amp;quot;Smart Service&amp;quot; but I am getting no result or error. Note that I had to include &amp;quot;a!refreshVariable()&amp;quot; so that I did&amp;#39;t get an error message saying &amp;quot;... &lt;span&gt;smart service functions cannot be used in a local variable unless &amp;quot;refreshAlways&amp;quot; is true for that local variable using the a!refreshVariable() function.&lt;/span&gt;&amp;quot;&lt;/p&gt;
&lt;p&gt;Note: The API is tested and works perfectly&amp;nbsp;on button click.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Run WebAPI Onload</title><link>https://community.appian.com/thread/66392?ContentTypeID=1</link><pubDate>Tue, 07 May 2019 18:21:13 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:2f6f9e2e-a60c-473f-997d-9220716c0778</guid><dc:creator>Jim Beckley</dc:creator><description>&lt;p&gt;Great to hear! Glad you were able to sort it out.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Run WebAPI Onload</title><link>https://community.appian.com/thread/66391?ContentTypeID=1</link><pubDate>Tue, 07 May 2019 18:08:10 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:8f843104-eb49-49f0-b4a8-c7070c33d4f0</guid><dc:creator>hania</dc:creator><description>&lt;p&gt;Thanks Jim!&lt;/p&gt;
&lt;p&gt;I had tried every possible way to extract the web api call through the integration object. I realized that my issue was with the integration object setting. I erroneously used &amp;quot;Modify Data&amp;quot;. Issue resolved now. Thanks!!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Run WebAPI Onload</title><link>https://community.appian.com/thread/66381?ContentTypeID=1</link><pubDate>Tue, 07 May 2019 08:50:30 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:1471c04f-df73-45f3-9a4f-1e03bc4c2c8a</guid><dc:creator>Jim Beckley</dc:creator><description>&lt;p&gt;Have you tried&amp;nbsp;setting the integration&amp;nbsp;as the value of a local variable, then using that local variable in the grid?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://docs.appian.com/suite/help/19.1/Grid_Tutorial.html#paging-and-sorting-configurations"&gt;https://docs.appian.com/suite/help/19.1/Grid_Tutorial.html#paging-and-sorting-configurations&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;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&amp;nbsp;set your datasubset&amp;nbsp;variable for your paging grid (let&amp;#39;s use the same local!datasubset variable name to be consistent)&amp;nbsp;and&amp;nbsp;specify your integration as its value. So, yours might be.&amp;nbsp; local!datasubset: rule!XYZ_MyWebApiIntegtation()&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>