Go back to a previous Sequence

activities

#1

Hi there,

Is it possible to go back to a previous activity or sequence?

I have an IF condition which check the results of my Element Exists. If the condition is True then I want it to move to the next activity but ELSE I want it to first set a Delay activity, and then move back to the Element Exists before the IF condition (so loop back and recheck the element)

Surely this must be possible somehow? I am not using Flowchart, just Sequences.

Please see attached screenshot.

Thanks!
Sequence|621x500


#2

Hi,
Did you try Retry Scope.

reference.


#3

Hi,
Use a While loop and check for a boolean variable defaulted to false.

In your workflow, in the else part make this boolean variable true.
Please refer to the attached sample sequence calling itself.xaml (8.7 KB)
Workflow.


#4

It is good to use loop for recheck and execution of some steps but their might be some issues as well.
Like if you will check Element Exists inside any looping construct and by setting flags you will set the loop running condition. So suppose Due to site changes or in case of sectors will fail then loop can go to infinite run.

There is one option to use Retry Scope because here you can pass the number of retries so even if nothing will work instead of to stuck on the infinite loop it will either terminate or gracefully stop the termination or will perform rest steps depended on your workflow logic.

Even with loop you can do this to check for particular count by maintaining the counter because when you are processing huge records then just because of one error with record you can not wait for it to complete. best thing you can skip it with an error log and process next items.

Regards…!!
Aksh


#5

So do you mean like this? See attached please.

The Delay activity in the Action box seems to always be triggered. I thought it would only trigger if the Condition (Element Exists) fails?


#6

Retries the contained activities as long as the condition is not met or an error is thrown.


#7

So if it is like you are saying, then I dont even need a Delay timer activity in the Action box? I can just add the activity that I want it to run/try? Like the way I have done in the screenshot attached. I even have the RetryInterval set to 10 seconds.

This doesn’t work though, it throws an error because it’s trying to click the Export button before the page has fully loaded.


#8

just set the Click activity property of “wait for ready” to complete and also define some timeout. if you will not pass the timeout it will take the default activity timeout of 30 seconds.

image

Regards…!!
Aksh


#9

Hi there,

I set WaitForReady = Complete for ‘Element Exists’ and Click BUTTON. Still no luck, still getting an error ( I have pasted the error below)


Main has thrown an exception

Source: Click ‘I’

Message: Cannot find the UI element corresponding to this selector:

Exception Type: SelectorNotFoundException

UiPath.Core.SelectorNotFoundException: Cannot find the UI element corresponding to this selector: —> System.Runtime.InteropServices.COMException: Cannot find the UI element corresponding to this selector:
at UiPath.UiNodeClass.FindFirst(UiFindScope scope, String nodeID)
at UiPath.Core.UiElement.FindFirst(FindScope scope, Selector selector)
— End of inner exception stack trace —
at UiPath.Core.Activities.ScopeActivity.OnFaulted(NativeActivityFaultContext faultContext, Exception propagatedException, ActivityInstance propagatedFrom)
at System.Activities.Runtime.FaultCallbackWrapper.Invoke(NativeActivityFaultContext faultContext, Exception propagatedException, ActivityInstance propagatedFrom)
at System.Activities.Runtime.FaultCallbackWrapper.FaultWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)


#10

This didn’t work because click event is occurring before you are testing if the element exists. You can get around a few ways the cleanest IMO is set the condition to continueOnError = true on the click event