Using variables in Object Repo UI Descriptors

Hi,

We’ve found the object repo a really useful feature and it’s helped us expand our reuse first approach however we’re struggling to find a way to dynamically set the URL of the Browser or FilePath of an application when using the Use Application/Browser activity with an application from the Object Repo.

What we would like to be able to do is set the value of the URL or filepath by using a variable or argument but it appears we can only hardcode a string in these fields as any value we input has double quotes added at runtime.

image

image

The only way we’ve found so far that comes close to working is to pull in the application from the Object repo and then unlink it so that we can add a variable. This gives us a degree of reuse but means that if we make any updates to the UI Descriptor it won’t get picked up by any activities where we have unlinked from the Object Repo.

Is there any way we can set URLs or Filepaths in the applications in the Object Repo dynamically and for the descriptor in the Use Application/Browser to remain linked to the Object Repo

1 Like

Hi @grlawlf,
You are correct that it is not currently possible to write a variable in the url field once the object is in the object repository
But, it is possible to have a variabile there if the url field is a variable before you link the “use app browser” to the object repository
So, you need to have an “use app browser” with url as in_URL and then link it to OR

2 Likes

Hi @Pablito,

Thanks for coming back on this and for the suggestion. This is something we already tried but it doesn’t work for us as UiPath adds quotes to the variable name and at runtime it takes the variable as the url. Essentially it tries to launch “in_url” instead of the value we assigned to in_url.

Do you have an example you can share where this solution works please?

Here is an example:
Example.zip (157.2 KB)

Thanks for this @Pablito. I can see in this that the variable is able to be used without delinking.

Just as a confirmation I think the difference between how you have added the screen to the Object Repo and how I have done it is that I didn’t add it from an existing Use Application/Browser that was in a sequence but just added a descriptor in the Object repo. Whereas I think from what you’re saying you added the screen to the repo via the the menu option in the Use application/browser activity.

From now on we’ll just create a use application/browser and link to the repo from there. I’ve just tried it that way and it looks to give us the ability to use variables without delinking from the repo.

Thanks for your help again.

1 Like

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

@Pablito can you provide more clarity on how to include this URL as a variable before adding it to the repo. Also, what packages do I need in order to view your example you provided in the initial topic?

My example contains whole project so you don’t need to install anything additional as project file have all needed dependencies in source.

You should be able to see how variable is added there:
image

I’ve added the variable like you have but in order for it to use that value I have to unlink from the object repository. Is there any way to do it without unlinking?

Also, I’m still unable to open your example. I get this error “Could not find member ‘Area’ in type ‘http://schemas.uipath.com/workflow/activities/uix:TargetApp’. Row: 122, Column: 24” .
I’m on 20.10 and using the modern design experience with all update dependencies.

Look like the only way to have dynamic URL (URL as a variable) without unlinking/relinking (a lot of rework) is to erase all the hardcoded browser URL from all the screens in the Object Repo. After that, we’ll just need to use Go to URL activity in the InitAllApplication workflow inside Use Application/Browser. This assume all selectors are the same, just the URL is different.

1 Like

@grlawlf @Pablito I have yet to try this out but I believe you can use the {{variableName}} syntax and that should allow you to reference a variable so that it’s value is used … e.g. Url

1 Like

Hi Pablito, I created a new topic that is similar (but I think different) to this one.
If you have time I’d appreciate if you can take a look and advise.
Thank you

Please follow following steps to pass variable as Browser URL to object repository.

  1. Open library/project folder
  2. Open .objects folder. You will find repository application folders.
  3. Open application folder which you want to update. You will find application version folders.
  4. Open application version folder which you want to update. You will find all the screen folders of respective application.
  5. Open screen folder which you want to update
  6. Under screen folder open file .data\TargetApp.content or .data\ObjectRepositoryScreenData.content in notepad.
  7. If field exists then Replace Url=“Your Url” with Url="[in_BrowserURL]" where in_BrowserURL will be the variable name need to be created in the project
  8. If field doent exists then add Url="[in_BrowserURL]" inside TargetApp where in_BrowserURL will be the variable name need to be created in the project
  9. Create Variable with same name in your project and pass it in URL property to object repository

Error

Give me a like if it works for you.

4 Likes

Thank you @DHANRAJ.C.K_SHETTY , You are the champ. It works :grinning:

1 Like

I’m trying to follow along here to get this to work with the ACME Calculate Client Security Hash exercise from the Advanced Developer training, and it seems much more difficult than it should be.

So, I did what @Pablito mentioned. I edited my Work Item Details descriptor to have an empty URL field.
Work Item Details Descriptor

Then, I went to my project files that use this screen and inputted the URL into the specific properties for my Use Application/Browser activity.

This works, but my issue with this is that it is not reliable. Let’s say someone clicks the Descriptor for the screen to edit it. They open it up, see that there is no URL and change it; then they realize their mistake, go back and delete it. Or even let’s say they don’t change it at all the first time; they just click OK and move on.
At this point, we need to re-enter ALL the custom URLs for these other files because the “update” in OR has cleared the URLs for these activities since they are linked!
See below:
Edit descriptor
Work Item Details Descriptor
Clicked OK here, and then…

I’ve tested this out, and it’s the unfortunate truth. We can’t rely on “don’t ever open the descriptor and click OK” as the solution to this.

I also tried what @DHANRAJ.C.K_SHETTY suggested, and I can’t get past step 3. I open the .objects folder, and there is nowhere to go from there.
objects folder

1 Like

sEqM is your application folder.

Ok, thanks. Not an intuitive name for an application folder. Now I am in that folder, and I’m guessing my “Application version folder” that you mentioned is this one called “DNw0”??

Also, I just had to update one of the objects in my repository for the Work Item Details page, and sure enough, now I need to go through and update the Browser URLs for the components that use the Work Item Details page. Just decided to put the URL in a variable so it’s easier to update every time this happens. Is there any other solution to this that doesn’t involve opening the specific object file and editing the code within it?


@loginerror @Pablito

You’re right @Joe_Matuch, The folder names are not intuitive. You need to identify the folders. Also, there should be an easier way to handle the URL as a variable. Hope Uipath will fix this bug in coming versions. My answer was just a workaround to solve the problem as of now.

2 Likes

Easy way to identify the folder name is -

  • Right click on the screen object
  • click Edit screen.
  • You should see Unique ID value.
  • The first 4 character after / will be your Browser screen folder.
1 Like