You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description
Adding a routing based functionality in the piece framework which would act as a branching mechanism on the piece itself. A piece action like "Wait for approval" could be a great example of why routing could be useful, as it is an action that would have possibly 2 or more outputs which would have their paths directly from the piece (without the need to add a branch after the piece to handle the run based on the outcome).
The current method:
What we want to do:
Describe the solution you'd like
A solution would be adding an outcomes array in the piece action, which would then have the branching made according to the possible outcomes array and then returning a Map after running the piece action as key:value, where the key is the name of the outcome and the value is the result of that possible outcome.
Example for "Wait for approval" piece action:
import{createAction}from'@activepieces/pieces-framework';import{ExecutionType,PauseType,branchedPieceResponse}from'@activepieces/shared';exportconstwaitForApprovalLink=createAction({name: 'wait_for_approval',displayName: 'Wait for Approval',description: 'Pauses the flow and wait for the approval from the user',props: {},errorHandlingOptions: {continueOnFailure: {hide: true,},retryOnFailure: {hide: true,},},// Here we define the names of the outputs expected to be branched from the pieceoutputs: [{name: 'approved'},{name: 'denied'}],asyncrun(ctx){if(ctx.executionType===ExecutionType.BEGIN){ctx.run.pause({pauseMetadata: {type: PauseType.WEBHOOK,response: {},},});// Return an empty Map while execution is pausedreturnbranchedPieceResponse()}else{// Return a Map populated with the expected returned datareturnbranchedPieceResponse({approved: ctx.resumePayload.queryParams['action']==='approve',// Branch state for when "approved"denied: ctx.resumePayload.queryParams['action']!=='approve',// Branch state for when "denied"})}},});
We would like to know your feedback about this feature and how it would impact your experience using Activepieces.
In case you have a better solution for implementing routing in the piece framework, we are welcoming all suggestions!
The text was updated successfully, but these errors were encountered:
Description
Adding a routing based functionality in the piece framework which would act as a branching mechanism on the piece itself. A piece action like "Wait for approval" could be a great example of why routing could be useful, as it is an action that would have possibly 2 or more outputs which would have their paths directly from the piece (without the need to add a branch after the piece to handle the run based on the outcome).
The current method:
What we want to do:
Describe the solution you'd like
A solution would be adding an outcomes array in the piece action, which would then have the branching made according to the possible outcomes array and then returning a Map after running the piece action as key:value, where the key is the name of the outcome and the value is the result of that possible outcome.
Example for "Wait for approval" piece action:
We would like to know your feedback about this feature and how it would impact your experience using Activepieces.
In case you have a better solution for implementing routing in the piece framework, we are welcoming all suggestions!
The text was updated successfully, but these errors were encountered: