Hi All,
I have a use case as below:
Appian case documents push to SFTP:
Please advise how do I write a Query rule to fetch case Id and folder id from database and pass this to a process model that would call the SFTP Smart Service. Do I need to use both "SFTP Create Folder" & "SFTP Send File" smart services for this use case.
Below is the query rule I've written to fetch the case Ids and folder Ids from database. How do I map this to a process Model?
a!queryEntity_22r2( entity: cons!ABC_CASES, query: a!query( pagingInfo: a!pagingInfo( startIndex: 1, batchSize: -1,) ), selection: a!querySelection( columns: { a!queryColumn(field: "caseId"),a!queryColumn(field: "folderId") } ), logicalExpression: a!queryLogicalExpression( operator: "AND", filters: { a!queryFilter( field: "caseId", operator: "=", value: ri!abc_cases.caseId, applyWhen: not( rule!APN_isBlank(ri!abc_cases.caseId) ) ), ) } ) ))
Discussion posts and replies are publicly visible
In the query rule you should add a filter for doc_sent <> 1. So that the rule returns all the cases whose document is not sent already. Apart from this call the rule in the process model script task and store in the a pv. the pv should be of the same data type as the output returned by the rule.
Thanks for the response Harsha Sharma . And once I call this rule in the process model script task, how do I fetch the folder Id based on one case per run to pass it further to SFTP folder ?
your output is having folder id and case id both right.You can use index() to extract the folder if and case id.
In your main process model call this rule and get the list of cases. then call a sub process (or start process smart service) using MNI. within this sub process you will be having one case and one folder at a time. within this sub process have the sftp smart service to send document for one case. Like wise depending on the number of cases that many sub process instances will trigger and docs will be transferred.
In above rule you have paging done as -1. See MNI usage considerations to verify if your output can reach the maximum activity instances limit permitted or else adjust the paging using loops in process model to get cases and folders in batches.