Re-use a screenaction within a screen

By Joop Stringer on 11 May 2010

Now you need to create a public action if you want to reuse a screen action.

Would be nice to have something like "public" screen actions


What would be the avantage of this compared to a user-action?

The most of my screen actions are different (little bits), only getting the records and refresh the screen is used more time. Getting the records workes fine with a user action, refresh is one ajax widget.

Think that this post: Categorize user actions is more handy so everything is together.
Fernando Sousa11 May 2010

Imagine that you have two screen actions:
  • RefreshTable - will load data from the database and populate a table record
  • DeleteRecords - will delete selected records
If after deleting selected records you want to refresh the table record widget you should call the RefreshTable action, but that is not possible.

So you end up with two options:
  • replicate logic from RefreshTable in DeleteRecordsaction
  • use only one screen action with both Delete and Refresh logic and use an input paramenter to identify what operation you intend to execute
I think that beeing able to call screen actions from other screen actions (in the same screen, of course) will be very nice.
I'll think this is more a supplement/expansion to this post: click here
J.11 May 2010

not really, it's the ability of re-using screen actions like they are user-actions only defined within the screen.

which makes perfect sense in the world of c#.

the link you gave is to be able to have a more inheritance-structure with webblocks.


Thats why I called it a supplement / expansion of that post.
J.11 May 2010

Ok, I find it totally 2 different things, so imho it should be seperate ideas ;) now I stop :P
Ana Ramalho14 Jul 2010
Ability to call an screen action from another screen action of the same screen

Merged from 'Ability to call an action screen from another action screen of the same screen' (idea created on 2010-07-14 09:53:43 by Ana Ramalho), on 2010-07-22 10:30:04 by Pedro Oliveira
João Campos17 Jul 2010
I guess this is the same as Re-use a screenaction within a screen


Merged from 'Ability to call an action screen from another action screen of the same screen' (idea created on 2010-07-14 09:53:43 by Ana Ramalho), on 2010-07-22 10:30:04 by Pedro Oliveira
Joop Stringer19 Jul 2010
I'm sure it is

Merged from 'Ability to call an action screen from another action screen of the same screen' (idea created on 2010-07-14 09:53:43 by Ana Ramalho), on 2010-07-22 10:30:04 by Pedro Oliveira
Ana Ramalho19 Jul 2010
yes, it is.

Merged from 'Ability to call an action screen from another action screen of the same screen' (idea created on 2010-07-14 09:53:43 by Ana Ramalho), on 2010-07-22 10:30:04 by Pedro Oliveira
Pedro Ávila20 Aug 2010
Be able to drag a web screen action into another action in the same web screen scope. Is a sort of User Action reuse, but within the scope of a Web Screen. This would save a lot of SUs and work.


Merged from 'Reuse Action in Web Screen Scope' (idea created on 2010-08-20 11:03:21 by Pedro Ávila), on 2010-08-30 15:34:47 by Paulo Tavares
João Campos23 Aug 2010
I guess this is the same as http://secure.outsystems.com/wisdomofthecrowds/IdeaComment_List.aspx?IdeaId=78

Merged from 'Reuse Action in Web Screen Scope' (idea created on 2010-08-20 11:03:21 by Pedro Ávila), on 2010-08-30 15:34:47 by Paulo Tavares
Pedro Ávila23 Aug 2010
Yes, it's de same thing.

Merged from 'Reuse Action in Web Screen Scope' (idea created on 2010-08-20 11:03:21 by Pedro Ávila), on 2010-08-30 15:34:47 by Paulo Tavares
Kilian Hekhuis8 Dec 2010
Hi Joop, I was thinking exactly along the same lines. Probably because I'm thinking to procedural, or something, but it's like having local procedures, which would be great.
Célia Corte13 Jan 2011
Allow use Web Sreen actions in other Web Screen actions

Merged from 'Allow use Web Sreen actions in other Web Screen actions' (idea created on 2011-01-13 18:03:47 by Célia Corte), on 2011-01-24 12:04:17 by Paulo Tavares
Duplicated with http://www.outsystems.com/WisdomOfTheCrowds/IdeaComment_List.aspx?IdeaId=78 ?

Merged from 'Allow use Web Sreen actions in other Web Screen actions' (idea created on 2011-01-13 18:03:47 by Célia Corte), on 2011-01-24 12:04:17 by Paulo Tavares
Célia Corte26 Jan 2011
Use screen actions in other screen actions. Sometimes I need repeat the same code.
Example:


Merged from 'Use screen actions in other screen actions' (idea created on 2011-01-26 09:55:56 by Célia Corte), on 2011-01-31 13:28:04 by Pedro Oliveira
-28 Jan 2011
You can do this right now by

1) creating an action, so that you could reuse the functionality.
2) You can add a widget_Click and call it from another web screen action.



Merged from 'Use screen actions in other screen actions' (idea created on 2011-01-26 09:55:56 by Célia Corte), on 2011-01-31 13:28:04 by Pedro Oliveira
Kilian Hekhuis31 Jan 2011
This has already been suggested here: http://www.outsystems.com/wisdomofthecrowds/IdeaComment_List.aspx?IdeaId=78

Please endorse that one by liking it.

Merged from 'Use screen actions in other screen actions' (idea created on 2011-01-26 09:55:56 by Célia Corte), on 2011-01-31 13:28:04 by Pedro Oliveira
Carlos Henriques29 Feb 2012
This should be implemented in version 7. It's a must have!

I don't like the widget_click option. Why can't we reuse a screen action?
It's like any other action but it's scope is limited to that screen. So, it should be possible to reuse on another screen action of the same screen.

Without this and because I don't see the widget_click as the right solution for this limitation, we are forced to duplicate logic (many Refresh Query and Ajax Refresh Widgets) when we could reuse the same action.

Please, implement this feature. Less code, better logic and less software units (this is just an advantage for us developers :P).
Tim Timperman4 Dec 2013
A big kick.. not being able to do this is a constant source of frustration.
It should be high on the list of things to implement.
Joris Michiels4 Feb 2014
I have  been working with Oustsystems for a week now after bootcamp and this is the first "limit" I have  run into, must have !
Bavitha Sokhi18 Jul 2014
Agreed and endorsed!
Hi guys. Take a look at this forge component, it enables screen action reusability:

https://www.outsystems.com/forge/component/597/event-system/
George Jeffcock24 May 2016
Agreed 2 weeks in and frustrated with this and copy and pasting
André Vieira22 Sep (3 days ago)

Hi all,

We have delivered this functionality in OutSystems 10 for Mobile Apps. So at this point, we will leave it as WIP but I'd like to hear from you guys what you think are the relevant use cases for such functionality in a Web App.

Thanks for your feedback!

Evert van der Zalm22 Sep (3 days ago)

I don't have any, just doesn't make sense in a web application so curious also.

If you would be able to use a screen action through the whole eSpace things can get a real mess.

Kind regards,
Evert

Fernando Sousa22 Sep (3 days ago)

You have a use case posted here on 11 May 2010. I'm talking about reusing a screen action within other screen actions in the same screen (not reusing a screen action of another screen, like it has also been  requested here due to merging ideas).


Why do you think that this is applicable only to Mobile Apps and not Web Apps?

André Vieira22 Sep (3 days ago)

Hi Fernando,

We don't think that this is only applicable in Mobile, but we want to be sure to get the right use cases.

Thanks for your feedback!

Kilian Hekhuis23 Sep (2 days ago)

I would use these types of actions to have a local action that can reuse the screen variables, and doesn't "pollute" the global name space of the eSpace. Current I typically have a folder in the action tab called "ScreenActions", and name three actions ScreenName_MyAction, but that's far from ideal.

The downside is that it perhaps stimulates putting all the business logic in the screen as well, which is of course bad practice. But nevertheless I would welcome it in screen actions, as it's proven pretty usable in mobile apps.

Kilian Hekhuis23 Sep (2 days ago)

Note that I think this idea has been wrongly merged, as I'd be very much opposed to being able to cross-call screen actions (something I think isn't possible technically anyway, given the local state).

Leonardo Fernandes23 Sep (2 days ago)

One use case is to refresh a data source that is bound to some widget.

Example: have a table records listing the result of a web service. The web service call must be placed in the preparation. But, if you want a button to refresh the table, you would have to repeat the same call. Refactoring the web service call into a screen action would isolate it, and the screen action could be called both in the preparation and in the refresh action. Note that this problem is already solved for aggregates, but not for other datasources.


Another use case is when the same transaction could happen in multiple screen actions.

Example: an edit screen which has a button "create" and another button "create & new". Both of them creates a new record on the database, but one of them redirects away from the edit screen, and the other refreshes the edit screen with an empty record. Right now, you have a solution which is to add a boolean input to the screen action and controlling the flow of execution with if nodes. In my opinion, by doing that, you are mixing two use cases into the same screen action, which could be fine if you only have to deal with two use cases in the same screen action, but would become unmanageable if there are more. Another option is to isolate the common parts in user actions, but that comes with its own restrictions, because you are not allowed to refresh widgets nor update validation messages. The ideal solution would be to have a screen action for "create", and another screen action for "create & new", and both could reuse logic from a third screen action.