Backend workflow returns strange number when it should return 1

Hello,

I’m sure I’m doing something very dumb here because what I’m seeing is just a little crazy. I’ve got a backend workflow that should just return the number 1, but it’s returning 967…and whenever I click on the Go button to fire the backend workflow again it increments. I didn’t program it to do that. I’m totally confused here. I’ve got other backend workflows that work fine, but not sure what’s going on here. I’m actually trying to get the “GetEmpHoursForWeek” working, but it’s not returning what I expect, and I have no idea what it’s doing.

Any help is greatly appreciated.

Kindest regards,

David

Very difficult to provide insight into what could be happening in the backend workflows to cause a problem without seeing the backend workflows, or having an understanding of what the database structure is.

My assumption from seeing the way it functions is that when the button go is pressed it is creating a new entry in the database and the number you see is the count of the number of entries in the database of the type you are creating when the user presses the go button.

Sorry, I guess I thought you could see the backend stuff in my project, but here are some screen shots. It’s very simple, not creating or updating any Things at all, just trying to return the number 1 because I’m seeing this strange behavior (which is why I created this test).

It should just return the number 1, but it’s incrementing something…I don’t know what or how.


Sorry, other images wouldn’t upload for some reason, here they are…

Workflow4

I’m not sure but the backend workflow return data with no subsequent steps wouldn’t allow you on its own to visualize a number on a page.

I don’t think you can grab the result of the api call itself from the page…at least I’ve never attempted it and could be wrong, because you do have a dynamic expression taking the result to display it. But I don’t see how a backend workflow action would be available on the page from which it is scheduled.

1 Like

As @boston85719 pointed out, there’s no way to get data from the backend workflow back into the page, unless it’s being stored somewhere in the database.

In your on-page workflow you’re using Display Data with the data being the results of step 1.

That will simply give you the Scheduled API Workflow’s ID (i.e. 967), which is what you’re seeing on your page - each time you run it again to schedule another workflow you’ll get the new workflow ID.

1 Like

Or, you can use the app connector plugin to connect the app to itself to trigger an API workflow synchronously. :thinking:

2 Likes

I figured I was doing something really dumb, turns out I was. Thanks for the information, boston85719, and adamhholmes. Much appreciated!

1 Like

Isn’t that what the schedule an api workflow action does? :face_with_raised_eyebrow:

Scheduling an API workflow is an asynchronous flow.
If you trigger an API workflow within the App Connector or API connector, you run it synchronously. So you can access its return data.

Okay, that sounds to be what the OP was trying to do.

@davidayres sounds like @lottemint.md is saying you can do what you were trying to if you incorporated the app connector into the setup.

But that’s pretty rare when I need this option.
If you have the workflow you need to trigger from different places, you can prepare a custom event in the reusable element - and then trigger it from any section you want. You can output parameters as states.

That works faster since an API call has a delay.