596
Views
28
Comments
Solved
How to refresh a screen that is coming from a destination widget?
Question
Application Type
Reactive

Hi there,

I have a client button action from a screen:

in the submit button, there is an action to go to another screen and change the record that is listed in that screen:



However in the destination screen, the updated record is not shown automatically, but i need to click browser button refresh:

How to refresh automatically?

regards

2020-11-13 07-48-15
Khuong Truong
Solution

Hi Indra,

I guess inside ApproveApplication you do update status right? If you update it directly make sure to use CommitTransaction from System.

In other case, if you using Timer or BPT to update status, then you need to wait a bit and refresh. Because they execute asynchronous.

Regards,

Khuong 

2025-01-09 14-56-57
IQ78

Hi Khuong, tq

I have put the commit, with no luck:

Actually, this is only a simple go to the other screen, although i update the status for closing a human activity by updating a record:

regards

2020-11-13 07-48-15
Khuong Truong

Hi Indra,

First try using RedirectToURL instead.

Another approach is wrap table widget with IF widget and show table when IsDataFetched = True.

If both way not working then just try a simple screen update value and using Destination to go to a List (table widget) as your case but not related to any BPT. If issue still (not refresh when navigation by using Destination as end node) then I think it seems a bug.

Regards,

Khuong

2025-01-09 14-56-57
IQ78

Hi, Truong, thanks

I tried the RedirectURL, but fail also.

regards

2025-01-15 08-35-04
Vignesh Sekar

Hi Indra,

                        you don't need to refresh a screen in reactive. reactive was just a single page application you need to refresh your aggregate or functional in on initialize of that screen.



Thanks,

Vignesh S

2025-01-09 14-56-57
IQ78

Hi Vignesh, thanks,

I tried and unfortunately it does not work. I also tried in the call back on OnReady, but the same result. OnRender, it will be looping:

 

regards

2020-11-13 07-48-15
Khuong Truong
Solution

Hi Indra,

I guess inside ApproveApplication you do update status right? If you update it directly make sure to use CommitTransaction from System.

In other case, if you using Timer or BPT to update status, then you need to wait a bit and refresh. Because they execute asynchronous.

Regards,

Khuong 

2025-01-09 14-56-57
IQ78

Hi Khuong, tq

I have put the commit, with no luck:

Actually, this is only a simple go to the other screen, although i update the status for closing a human activity by updating a record:

regards

2020-11-13 07-48-15
Khuong Truong

Hi Indra,

First try using RedirectToURL instead.

Another approach is wrap table widget with IF widget and show table when IsDataFetched = True.

If both way not working then just try a simple screen update value and using Destination to go to a List (table widget) as your case but not related to any BPT. If issue still (not refresh when navigation by using Destination as end node) then I think it seems a bug.

Regards,

Khuong

2025-01-09 14-56-57
IQ78

Hi, Truong, thanks

I tried the RedirectURL, but fail also.

regards

2025-01-09 14-56-57
IQ78

I already try to clear the browser cache, with no luck. Is it Outsystems' bug?

regards

2020-09-01 10-42-42
Stefano Valente

This should even work without the commit. I have seen it working many times, because it is the standard way to interact betweend list and detail screens.

the only thing i would think of is that your data doesn't load from start.


You should set a breakpoint in the onafterfetch to see if your data refreshes.


2025-01-09 14-56-57
IQ78

Hi Valente,

But it is refreshed when i clicked the refresh button (near the URL input in the browser).

regards and thanks


2020-09-01 10-42-42
Stefano Valente

Thank you for checking.

If you have the fetch at start, then please don't refresh data in an event like OnReady or Init. 

The Commit Transaction is also not necessary.


Your code works on the Sample Accounts Databse, so it has to be the fact you are updating a (human)  Activity, which has triggers to async processes. If so, this is a timing issue, as @Khuong Truong mentioned before.


2025-01-09 14-56-57
IQ78

I debug, after fetch the value is the old one:

but in the database, it is already 6:

The updating in the bpt, and it is async, so the updating not yet complete when the screen fetch happen.


regards 


2020-09-01 10-42-42
Stefano Valente

Since this should work if no BPT is used, i would think the problem lies there.

Can you share your code?


Edit:

https://success.outsystems.com/Documentation/11_x_platform/Developing_an_Application/Use_Processes_(BPT)/Best_Practices_for_Designing_Processes/Separate_Process_Logic_from_Application_Logic

Is the way to close your Human activities.

2025-01-09 14-56-57
IQ78

Ok, thanks, Valente

I think i can guess what is happenning:

1. the updating happens inside bpt

2. when the destination widget is reached at screen action, the updating is not yet finished

3. as they are asynchronous, so there is some kind of race condition and dirty reads.

regards and many thanks all - u are both legends  

2020-09-01 10-42-42
Stefano Valente

I just tried something similar in my testapplication and it updated the screen right away.


You closed this thread, but i am still curious on how you close your human activity in the BPT. Can you send a screen?

2025-01-09 14-56-57
IQ78

But the case is not in that human activity (inside approval process), the updating is happening in the process below the human activity process (End Process). So when the human activity closed, the end process is beginning (and OS create the process in the runtime - not design time - so it takes a bit longer time).


regards.

2020-09-01 10-42-42
Stefano Valente

It's connected to your outpuparameter?

In my example i connect it to the Id i ask when starting the process...

does your process activity closes?

2020-09-01 10-42-42
Stefano Valente

I don't think the update takes longer, because the process activity reacts after the update is finished...

I think something else is not going as intended.

2025-01-09 14-56-57
IQ78

yes, it close. First, i must understand what the parameters means - and it is only filtering which record that can close the activity - in this case i have a variable name LOSWaitAPprovalId - and if you see they are only identifiers (non identifiers will not show up).

in service studio:

2020-09-01 10-42-42
Stefano Valente

That statement tells that your activity will close whenever the record in that entity with the Id you pass on, is updated. 

But you send your parameter that you use as outputparameter for the human activity. don't you have the id as a variable in the process ?


like this:


also: I see 2 different entities: LosApproval and LosWaitApproval ?

2025-01-09 14-56-57
IQ78

The sequence is like this:

1. In the human activity (inside the approval process), it is waiting to close if table LOSWAITApproval is updated

2. IN the screen action, update the LOSWAITApproval, so the human activity is closed, and then the navigation go to the destiny widget, meanwhile the execution thread in bpt is going to another process (end process) that update a LOSWorkflow table.

3. As the LOSWorkflow table is not finished updated in the END PROCESS, the fecth in the destination screen have a dirty read (it is because of asynchronous between the button action and bpt).

regards

2020-09-01 10-42-42
Stefano Valente

Yes!

Now i understand the lag. If it was the same entity you were updating in screen as well as BPT, there would be no lagging.


Ok, thank you.

2025-01-09 14-56-57
IQ78
2025-01-09 14-56-57
IQ78

absolutely correct!

I use two tables because one table will be updated many times and it is hard to handle, so i introduce another 'dummy' table just to make the bpt easier to maintain.

thanks

2020-09-01 10-42-42
Stefano Valente

I understand.

I don't really understand why you split the waitworkflow and not use the original entity workflow, but you probably have a good reason to do so.


From what i have seen untill now it probably wasn't necessary. You can use the On close of the human activity if you only want to close when a certain element of your record is updated.

2025-01-09 14-56-57
IQ78

Yes, i have some reason, suppose that one table is updated in a sql editor, it could break the workflow. So, i need the 'dummy'(trivial) one such that the workflow not broken incidentally.

ANd that one table (main) is most likely will be updated in many places those has nothing to do with the workflow.

regards

2025-01-09 14-56-57
IQ78

Note also, 

The  "certain element " are identifiers only, but the entity attribute can be non-identifier. This is weird, that i create two columns with the same semantic - isfinished (boolean type) and isterminated (identfier to static entity) :). May OS improve this feature in the next release.

2020-09-01 10-42-42
Stefano Valente

Since you want to wait untill your real entity is updated, you can implement a "wait" in your save action that checks if the the real entity is updated, before returning to the list.


Not sure if that is desired as the action would take longer...

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.