94
Views
6
Comments
Solved
"No role validation found" error when a server action is called from setTimeout
Application Type
Reactive
Platform Version
11.27.0 (Build 42539)

I have a client action, which calls a server action inside. And the problem is, when I attempt to call that from JS with setTimeout() like this:

window.setTimeout(function() {  

$actions.Action();

}, $parameters.Timeout);

It fails with this error:

Uncaught (in promise) 

message: "No role validation found" 

name: "System.InvalidOperationException"


However, if I call the same action from normal client action or javascript - this doesn't happen. I suppose, normally it uses user information from context, but when called from setTimeout - that is not available. I tried to debug inside the server action, but breakpoint was not hit.

Does anyone know if there is a workaround for this?

2024-07-05 14-16-55
Daniël Kuhlmann
 
MVP
Solution

Hi Igor,

I think the reason for your problem might be because you didn't include a $resolve(); in your Javascript. This is necessary uses Async execution of JS function.

Attached a working application that delays the execution of a client action 5 seconds, and then displays a hello message.

Here is also the documentation then explains that you have to resolve or reject the promise (the client action().

https://success.outsystems.com/documentation/11/integration_with_external_systems/javascript/defining_asynchronous_javascript_code/

Regards,

Daniel

DelayClientAction.oap
2025-01-17 13-16-27
Igor Kirtak

Thank you, adding resolve solved the problem.

Even though I don't understand how it is related to the error, but the main thing is that it works.

2019-03-14 16-24-46
Nelson Freitas

Hey Igor,

did you end up with a solution for this?

I'm having the same issue, it looks like the action runs, but it creates that "No role validation found" error log.

Do you know if we could at least catch that error and not log it?

Thanks,

Nelson

2025-01-17 13-16-27
Igor Kirtak

Hi Nelson. No, I gave it up and not using setTimeout in that case. I had to do what I wanted to do in a different way.

2024-07-05 14-16-55
Daniël Kuhlmann
 
MVP

Why do you need the setTimeout?

2025-01-17 13-16-27
Igor Kirtak

Because I wanted to execute an action after a delay.

I have client actions in expressions in different parts of the screen. They can (or can not) add values to a javascript array, which I then need to send to server. The idea was to start a wait on first such addition, then few seconds later send whatever was accumulated. Instead, I had to add a call in OnReady. Sometimes it gets executed before all those functions are done, so it's not fully reliable, but there should be another OnReady later... I don't have any better idea yet.

2024-07-05 14-16-55
Daniël Kuhlmann
 
MVP
Solution

Hi Igor,

I think the reason for your problem might be because you didn't include a $resolve(); in your Javascript. This is necessary uses Async execution of JS function.

Attached a working application that delays the execution of a client action 5 seconds, and then displays a hello message.

Here is also the documentation then explains that you have to resolve or reject the promise (the client action().

https://success.outsystems.com/documentation/11/integration_with_external_systems/javascript/defining_asynchronous_javascript_code/

Regards,

Daniel

DelayClientAction.oap
2025-01-17 13-16-27
Igor Kirtak

Thank you, adding resolve solved the problem.

Even though I don't understand how it is related to the error, but the main thing is that it works.

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