How can I get a resulting thing back from a custom workflow?

I have a simple popup where the purpose is to add an Action thing to the database. (In this context, an Action is something to do, i.e. a step, as part of a Project.)

There are two operative buttons, ignoring the Cancel button.

image

Save adds the Action thing and closes the popup.

Add More Detail adds the Action thing and goes to another page where all Action details can be edited.

Because there are quite a few details that need to be right when the Action thing is created, such as the two-way linking of Action to Project, that functionality is in a custom workflow, “Add New Action”.

The Save button works beautifully. The Add More Detail button does not.

As far as I can tell, using a custom workflow to add the Action thing, the Add More Detail button workflow cannot work.

The action-detail page is of type Action. Because the Action is created in the custom workflow, the Add More Detail button workflow doesn’t have knowledge of the Action that was created. Therefore, it cannot pass the newly created Action to the action-detail page.

I know I can work around this by creating a skeleton Action in the button workflow and have the custom workflow just add the details and Action-Project link. That way, the button workflow would “own” the new Action thing. (Result of step 1 (Create a new Action)).

However, I’d rather delegate all the work of creating the new Action to the custom workflow where it really belongs.

Is there any way of getting the newly created thing back from the custom workflow so the invoking workflow can use it?

As you ‘Go to page action-detail’, you are losing info. Using the URL (action Go to page) to pass the info you needed to the new page.

I don’t quite understand.

The problem as I see it is that the “btnAddMoreDetail is clicked” workflow doesn’t know the Action that was added in the “Add New Action” custom workflow. Whether passing as Data to send (the Type of content of the action-detail page) or as a URL parameter, the button workflow doesn’t know the Action created by the custom workflow, so it has nothing to send to the action-detail page.

@laurence, set a custom state to temporarily remember the new Action. Bubble will wait until your custom workflow is complete before it hits the Go to Page action, so by then, the custom state will have a value.

In the custom workflow, add a “Set State” action. Create a new state (on the popup, page, button, wherever) with state type = Action and set the value of this state to the result of Step 1 (new Action)

The Go to Page action sends the value of this custom state.

2 Likes

Thanks, Gaby.

I get that a custom state can be accessed from outside the popup. Thanks for putting that into perspective.

My experience with invoking the popup was that the invoking workflow didn’t wait until the popup closed but went on in parallel. Are you saying that by having the invoking workflow refer to a custom state in the popup, Bubble will suspend the workflow until the popup closes?

Separately, I saw a mention by @mebeingken of a when popup closes event. Might that be the answer I’m looking for?

This topic was automatically closed after 70 days. New replies are no longer allowed.