How to replace text in Workflow template

I have a Template called NewSequenceTemplate.xaml, and within this I have 3 sequences, a Pre, Do Work and Post. In the Pre I have a “Log Message - seq start” with the text “Sequence start”, and in Post I have the same, just with end instead of start.
In this I would love the New Workflow function to replace the text.
I.e: should I create a new Workflow called “GetDataFromDatabase” it would replace the text withing the Log Message to “GetDataFromDatabase start/end”.
The New Workflow function will automatically rename the topmost sequence to the name given in the New Workflow form.


A screenshot of the "New Workflow" dialog box in UiPath, prompting the user to enter a name and location for the workflow and select a template. (Captioned by AI)

@mdiv,

You can use Logs property of Invoke Workflow File for entry and exit of the workflow.

image

It can replace stuff in your workflow if it exactly matches the name of the Workflow template. However, I have had mixed experiences, if I recall correctly it works differently for C# projects compared to VB

You might also find this discussion interesting. Specifically the solution provided by Idris at the end would perhaps meet your logging needs?

1 Like

Sounds great, but this is set by the Invoker, not by the workflow. I’m pretty sure this would result in missing logs, as the developer by 90% chance will forget to set it :slight_smile:

Can’t agree more that developer will forget to set these properties as they are optional :joy:

For now this is the optimal solution I found.

Just put this expression into the Log Message.

1 Like

You can use project settings to change the default settings of the “Invoke workflow” activity if that is what you are worried about.

Be aware that this only works for invoke workflows within the project. So if you want to use a library activity within your robot process it wouldn’t get called with this.

2 Likes

Thank you @ijanszen1, @postwick, @ashokkarale, @Jon_Smith for your replies.
By using @ijanszen1s reply in the thread posted by Jon_Smith, I actually got a oneliner to put into my Log Message. It is in vb.net, but if anyone is looking for the same solution here it is:

BlockquoteSystem.Text.RegularExpressions.Regex.Match(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.AssemblyQualifiedName,“.(.*?)_Expressions”).Groups(1).Value + " start"

I have moved the code to a variable set in the Pre/Post sequence, this looks a lot nicer.

2 Likes

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