Component/Sequence/Workflow Name

uiautomation
studio
i_considering

#1

Is there any way (using the assign activity and a string variable) to get the name of the current sequence/component/workflow name?


#2

Hey Delme - small world!

I still haven’t found a way. Wondering if you could potentially reference the XAML? Bit dirty if you do.

I think this would be quite a nice feature to implement.

Rich


#3

What will be the use?


#4

One example would be for logging. It would be easier to reference workflow.name for example (and other attributes of the file such as location), rather than creating a variable which you have to update each time you create a new workflow - and sometimes forget!!

Richard

Get Outlook for Androidhttps://aka.ms/ghei36


Get Name Activity on Cath
#5

Moved it to ideas. What do you mean by component?

For exception logging you can use exception.Source property. Run the main.xaml in the attached example. .Logging.zip (7.6 KB)

Otherwise we need to investigate


Try Catch Printing Exception Source
#6

Sorry I meant workflow/sequence :slight_smile:

No this doesn’t quite answer the question. We’re talking about being able to self-reference the workflow that you are in. So, for example, if your workflow is called Workflow.xaml you would be able to call that dynamically by referencing UiPath.WorkflowName or something to that effect.

Therefore every time you want to log a message or throw an exception you could start it with UiPath.WorkflowName + " bla bla bla" rather than having a variable called StringWorkflowName and having to update it every time you create a new workflow.

I don’t think that it’s a massive thing but it feels like something you should be able to do and in certain circumstances could be really useful.

Richard


#7

Hey Denton! Small world indeed ;o)

That’s exactly why I want this. At the moment I have a variable name for a component (sequence) so when I log any messages I can add the component (sequence) name to the log. I also have to remember to update this variable each time I create a new component or rename an existing one. Not a game changer but would be a lot smarter if you were able to get an object returned (kind of like a trace stack) showing each sequence call with properties for current workflow/sequence and parent workflow/sequence and full stack path. Can make debugging a lot smarter and supporting for CoE a lot easier.


#8

Current workflow name is by default logged under filename node in the log json:
13:37:57.9454 Trace {"message":"UiPath.Core.SelectorNotFoundException: Cannot find the UI element corresponding [...]r\n at UiPath.UiNodeClass.FindFirst(UiFindScope scope, String nodeID)\r\n at [...]","level":"Trace","timeStamp":"2017-02-07T13:37:57.9454027+01:00","windowsIdentity":"[...]","agentSessionId":"00000000-0000-0000-0000-000000000000","processName":"Test5","fileName":"TerminationTest","jobId":"e9da7713-174d-4495-b88a-aefc00435fa0"}

But it’s true it could come in handy, especially with exceptions, as they’d show the fileName for where they’re catched, not where they were thrown.
Having a call stack would be great too, especially for resuable workflows, where the path how it got there is sometimes as important as where the issue occurred.

What do you mean by logging properties, though? Argument values?

Either way - thumbs up, could be a useful addition.


#9

I mean example properties I could access on the stack object. As for the filename you’re correct, just being able to get the information yourself means you can document your own messages to look for at CoE an be able to dictate the format of them


#10

Hi guys - any update on this?

My use-case is that I’d like to be able to save a screen-shot to a shared folder if I run into an exception - and would like to add the robot’s name or the flow name to the screenshot filename for some context, like: “[RobotName]-2017-07-11-12-16-33.png”


#11

Why not using the environment variables machine and user?


#12

Many thanks - that’s exactly what I needed.


#13

Hi Richard,

I would like to do exactly the same. Do you find a way to do this?


#14

How can you access to Workflow Name or Sequence Name? Thanks :wink:


#15

Nope :frowning:


#16

jiji … Me neither


#17

I also want to retrieve name of workflow. I need that so that I can easily add comment on the very beginning and end of invoked workflow for instance. As logging is encouraged when building workflow, I hope this will be a help of everyone :slight_smile:


#18

It’s almost like you were reading my mind, cause I was doing the same thing today.
System.Environment.CurrentDirectory gives you the directory but I couldn’t find the workflow name.

I do know that you can get the Sequence name when an exception occurs by using an Invoke inside a Try/Catch with exception.Source in the Catch.

But for workflow name, I ultimately hardcoded it into my Start Log string. I will keep an eye if there is ever a solution presented though.

EDIT: also, a possible idea would be to use GetFiles with the CurrentDirectory and filter it by a keyword, like “MAIN” then that will give you the workflow filename.


#19

Nice idea Clayton,

Just thinking if you have component name as a variable you could then use that to determine the file name - assuming it’s identical.

Or does having that variable negate the need for obtaining the workflow name? I can’t remember a scenario where I needed it.

RD


#20

In each activity execution log entry there is a “filename” attribute which is the name of the parent xaml of this activity.