Filter requester for specific people

Hello all, I am currently making an exception to handle the requester from a platform by name, can I create something like a list(user: A, B, C …) or something to make an if, something like: "if requester = list → then do A else do B?

@goncalo.rocha

Welcome to the community

Yes you can do it. Say the requestor name is in variable str …use a if condition with str.Equals("Name to check")

Hope this helps. Happy to help if this is not what you want

cheers

HI @goncalo.rocha

List<string> requesters = new List<string>() {"A", "B", "C"};
string requester = GetRequesterName();

if (requesters.Contains(requester))
{
    // do A
}
else
{
    // do B
}

You can replace GetRequesterName() with the actual method or code that retrieves the requester’s name from the platform.

maybe I was not specific enough,intead of making conditions for eachrequester, can I make an array of requesters for that? If yes what the best function to use? and then search from that array to check what to do next

string[] requesters = new string[]{"A", "B", "C"};
string requester = "A";

if (requesters.Contains(requester))
{
    // Perform actions for requester "A"
}
else
{
    // Perform actions for requesters other than "A", "B", and "C"
}

Hello @Shanmathi I’d gladly try this unfortunately im new to Studio/StudioX and have not found where I can code via code lines instead of dragging and dropping fuctions, would the “Create List” function cut it?

Hi @goncalo.rocha
Using activities,

  1. Create a variable of type “List” to store the list of requesters
  2. Use the “Create List” activity to initialize the list and add the requesters (A, B, C, etc.)
  3. Use an “Assign” activity to store the requester name in a variable
  4. Use a “For Each” loop to loop through the list of requesters
  5. Inside the “For Each” loop, use an “If” activity to check if the requester name matches the current item in the list

Hi @goncalo.rocha,
List can be initialized as below/ assigning it in the sequence.

If the requestor name is in the list can be checked as shown below
image

when I’m creating the list it gives me an error because my names are separated with a coma even puting like (“Doe, John”, “Doe, Jane”) it does not solve my issue, how can I solve this issue? “error BC30311: Value of type ‘(String, String)’ cannot be converted to ‘IList(Of String)’.”

@goncalo.rocha

Can you show how you are creating the list…and …what you are trying after that

Cheers

@Anil_G thanks for the avalability, what I am doing is as follows


when attributing the values to the list I get that error.

@goncalo.rocha

Now in the default value field…you can give the values like this… click on plus and click open advanced editor and key in values you want separated by comma and each enclosed in inverted comma

{"Valuie1","Value2"}

Or use the activity as below

cheers

Got it, so basically what I was missing where the brackets right? thanks a lot to everyone who gave it a little of their time to help me out.

1 Like

got one more question I got 0 errors (thnx for the help), issue now, I run the wizzard and its closing all the tabs that it opens


shouldn’t it only close those that are not on the Exception_List and which Incident_State is equal to Resolved?
thank you.

@goncalo.rocha

Your expectation is correct…

But the question is does your list contain requestor value? If the requestor variable has a extra space or the value is in different case then contains will still return false even if it is present

Please check on them

cheers

it is fetching the requester directly from a field in a webpage


dunno what I did but not it opens but always the same item when I have 4 diferent items for it to open

@goncalo.rocha

So here are few pointers

  1. For getting 4 different values…may be you need to use get text inside a loop and with a dynamic selector may be a row index or idx value or any changed which says to selector that it ahould look for next element
  2. Use a log message and see what value you are getting in requestor …that is how you know if you are comparing properly or if any changes are needed

Hope this helps

Cheers

just found out issue is with email processing, despite having several emails in my inbox it is always opening the same one and not running the others althought it opens what I believe to be the number of issues that I have to open, also if my e-mail is on the sent folder, the wizzard does not run at all

@goncalo.rocha

May I Know what you are trying to do?

If you are usign for each email then you can get all the email details from backend no frontend interaction is needed

The usage is similar

cheers

Hello @Anil_G, what I am trying to do is open an X amount of e-mails on those e-mails there is a link that UiPath should open, on the opened internet tab that it opens it should check the requester and status of the incident that it opened, if the status is set as Resolved it should close the tab unless it is from a specific group of requesters then even if the status is as Resolved it should not close the opened tab.