Hi Team,
I have a use case where if some user clicks on a link, then first, some data needs to be deleted and then second, an api integration needs to be triggered with a query parameter whose value basically is the value of the link clicked.(local!selectedSuiteName)
See below screenshot:
So, if someone clicks on the first link, then first I need to delete the related data from db and secondly then I need to call an integration which is configured basically to call an API. But I want to pass the selected link value as a query parameter to the API, I am not sure how to do it in expression. What I know is I can call an integration using rule!<Integration name>, however I don't know how to pass the parameter which is basically saved in local!selectedSuiteName.
So the full flow is like,
1. When user clicks on a link, some related data need to be deleted from an appian table.
2. Now, I need to populate the same table with some data and that data basically I want to fetch from an integration which I have discussed above.
Below is the screenshot, How I am trying to achieve this.
Code:
a!localVariables( local!msg, a!cardLayout( contents: a!gridField( label: "Suites", labelPosition: "ABOVE", data: 'recordType!{cb3c545e-904d-4198-9ce7-1044eb68e4f6}BTUA_v2_GetAllSuites_RecordType', columns: { a!gridColumn( label: "Suite Name", sortField: 'recordType!{cb3c545e-904d-4198-9ce7-1044eb68e4f6}BTUA_v2_GetAllSuites_RecordType.fields.{50f36e4d-df17-4fd3-ad80-17401b261035}suitename', value: a!linkField( links: { a!dynamicLink( label: fv!row['recordType!{cb3c545e-904d-4198-9ce7-1044eb68e4f6}BTUA_v2_GetAllSuites_RecordType.fields.{50f36e4d-df17-4fd3-ad80-17401b261035}suitename'], saveInto: { a!deleteFromDataStoreEntities( dataToDelete: { a!entityDataIdentifiers( entity: cons!BTUA_v2_Script_tbl_constant, identifiers: rule!BTUA_getListOfScriptIdentifiersForUser("abc@bc.cd"), /*identifiers: rule!BTUA_getListOfScriptIdentifiersForUser(loggedInUser()),*/ ) }, onSuccess: a!save(local!msg, "Success"), onError: a!save(local!msg, "Failure") ), a!writeToDataStoreEntity( dataStoreEntity: cons!BTUA_v2_Script_tbl_constant, valueToStore: rule!BTUA_v2_GetMappedScriptsForSelectedSuite(), onSuccess: a!save(local!msg, "Success"), onError: a!save(local!msg, "Failure") ), a!save(ri!isSuiteSelected, true()), a!save(ri!isScriptSelected, false()), a!save( ri!selectedSuiteName, fv!row['recordType!{cb3c545e-904d-4198-9ce7-1044eb68e4f6}BTUA_v2_GetAllSuites_RecordType.fields.{50f36e4d-df17-4fd3-ad80-17401b261035}suitename'] ) } ) } ) ) }, validations: {}, refreshAfter: "RECORD_ACTION", showSearchBox: true, showRefreshButton: false, actionsDisplay: "LABEL_AND_ICON" ) ), )
Line no. 32 basically calling an API integration for which I don't know how to pass query parameter which is basically local!selectedSuiteName.
Now here the main catch is that I can't call two smart services in a single expression. I want to simulate this somehow.
Could u guyz pls help me in this ?
Let me know if other data is required.
Discussion posts and replies are publicly visible
You cannot execute more than one smart service on a button. I would advice you to go with a process and start the process using a!startProcessLink()
Unknown said:go with a process and start the process using a!startProcessLink()
no - you would want a!startProcess() to start the process headless in the background, then feed any results of that process's transactions back into your curent interface.
Yes. That was a typo. I added the code for startProcess only
Also, What about the integration part, I am having an integration which basically calls an API. While calling the integration, I want to pass quey parameters to the API. How to do that ?
Add the call integration smart service to that process and pass the data first to the process into process variables and then to the integration.
yes - as says, anything you can pass to an API in on-form calls, you can pass into a process instead and then pass into equivalent smart services directly within the process. Except in a process you have essentially no limit how many you stack together (other than the node chaining limit, which you'd never even start to approach in such a use case).
How to call that integration with query parameters if using inside expression ? Is it possible ?
docs.appian.com/.../Call_an_Integration.html
Hey Stefan, I did not get my answer in the documentation.
My question is rather simple now,
See the below Process Model
Now see the call integration screenshot below,
You can see that, there is a query parameter called name, in this API integration. Now my question is, how to configure this query parameter in the Call Integration Smart Service ?
See screenshot below where you can see, what I have done ?
Could u pls help here ?
Hi, You can create a rule input into Integration and map that rule input for the particular query Parameter by using the expression Editor, and while calling the integration into Process Model pass the value to that rule input.
Can u pls share the expression rule example ? It will be very helpful to me.
Expression Rule example?