Get the root activity of a workflow

I am trying to get the annotation of a workflow, but I don’t find any programmatic way to get the root activity. Does anyone know a pattern that works for all workflows? Best thing I could figure out was first tag after </TextExpression.ReferencesForImplementation>

Thanks in Advance!

Hi @Ionut_Matei

You should look into Deserialize XML activity in the context of UiPath xaml files.

It is not trivial, but is doable and you can find a few topics on the forum about it (in relation to properly handling namespaces).

Hi @loginerror

Thanks for your response, but it doesn’t response to my question. My challenge is not the deserialization of the XML file. I want to know how to find the root activity. In the picture attached to the question, the root activity is a sequence, but it could be any other activity like a flowchart or a try-catch.

In that case you can use Regex expression to get it.

This one will work.

See also attached project: (3.2 KB)

You are not reading my question. I asked for a pattern, not an implementation

You were correct that it will be the first tag after </TextExpression.ReferencesForImplementation>

As such, the attached example returns the name of the root container. You can test it on different workflows to see the results.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.