Renaming variables does not work in Flow Switch or Flow Decision

Variables used in the Expression or Condition field for Switch and Decision activities are not updated when the variable is renamed.

See attached screenshots:

Before rename
removed due to forum restrictions on new users

After rename

Note how the variable name has been updated in the assign activity but not the Switch activity. This results in an error (since the old variable name is now undefined)

This might be a bug in the UiPath.

Hi folks,

This is indeed a known issue. The workaround is to manually add the renamed variable.

Thanks for pointing it out!

1 Like

Another workaround if you have many variables to rename is to open the .xaml in Notepad, then use the “Replace All” as text. Save it, then reopen in Studio. Just make sure that the text you are replacing is unique enough so you don’t rename other text unintentionally, though.

3 Likes

That’s a hack :slight_smile: We do not recommend manually editing XAML files and project.json for that matter.

3 Likes

Agree just as a lazy developer and I have more than 20-30 format change or the Rename use to edit .xaml file in notepad… till today I didn’t find any errors and it is working as expected… just curiousity is there any affect of we edit xaml file?

@Divyashreem I get you that’s easier to modify in one place only, but sometimes the easiest way is not the safetest one and it could lead to errors or misbehaviour when running your project. Or it could go smoothly like in your case but we wouldn’t want to risk getting errors and being harder for both you and us to debug and get to the bottom of an issue.

3 Likes

yeah @ovi @mircea

I suppose it’s like editing the registry. It’s not recommended to change the registry either unless you know what you are doing and always make a backup (don’t be too lazy like most of us).

What we do need, however, is the ability to replace text or even entire activities within Studio. For example, you have an activity, let’s say a Message Box, and you want to change it to a Write Line you should be able to… if that’s possible. But, more importantly, Replace all text would be very useful. Hopefully, it’s something that is being considered in a future release. :grin: