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()
Hi Harshit,
Thanks for reply.
I don't know how to send the data of local!selectedSuiteName in the process ? Could u pls insist ?
You can pass the value in a variable if you mark that variable as a parameter. Refer this article for more info - docs.appian.com/.../Start_Process_Smart_Service.html
a!startProcess( processModel: cons!ACC_PM_COMMENT_ON_TASK, processParameters: { nameOfTheVariable: local!selectedSuiteName } )
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 ?