You are viewing limited content. For full access, please sign in.

Question

Question

ProgrammaticallyRemove A User From Drop Down List

asked on June 2

Hello All,

Please can some help on this.

Is there a way to programmatically remove a name from a drop down list when that user is the current user?

I have a template field with a drop down which has the names of users. You open a document, picka a name and that document is forwarded to the folder of the person picked. When the receive opens the document forwarded to his fold, his name is displayed on the metadata field. I want to remove the name of the current user from the displayed list.

See screenshot below. IS there a way to prgrammatically (or otherwise) remove the name of the logged in user from the list?

 

Thanks

0 0

Replies

replied two days ago Show version history

I have not done this exactly, so these instructions might not work perfectly, but here's the basic concept of how it would work.

The functionality in the client that allows for options in a dropdown to be populated based on another field/value is called Dynamic Fields.  This allows a database to be set-up with a list of options for Field A that filters the list of options made available for Field B.

If you have never used Dynamic Fields before, you may want to get your VAR involved to help you set it up.  EDIT TO ADD: I just noticed you are a VAR, haha - sorry.

This is going to require a database you can set-up a View on - preferably one that already has a list of your users, so that you can just create a View from that existing Table.

Your database view will need to list all possible combinations of users between Field A and Field B, excluding when Field A = Field B.  You probably also need to include all options for Field B when Field A is blank.  The query for that View might look something like this: 

SELECT '' AS FieldA, e.employee_name AS FieldB
FROM employees AS e

UNION ALL

SELECT e1.employee_name AS FieldA, e2.employee_name AS FieldB
FROM employees AS e1
LEFT JOIN employees AS e2 ON e2.employee_name <> e1.employee_name

That should give you a list something like this:

Field A             Field B
------------------  ------------------
                    Employee One
                    Employee Two
                    Employee Three
Employee One        Employee Two
Employee One        Employee Three
Employee Two        Employee One
Employee Two        Employee Three
Employee Three      Employee One
Employee Three      Employee Two

 

On the template, setup Field A based on the Dynamic Field from FieldA with no filters and the Field B based on the Dynamic Field from FieldB filtered based on the selection of Field A.

The initial user will see it without Field A or Field B populated, so Field B should dynamically populate from the Dynamic Fields based on Field A being blank (that's the first half of the query where it lists FieldA as blank instead of an actual value).  This is the part I'm not entirely certain will work as expected and you might need to have Field A populate via a token of the current user instead of being blank.

On your workflow that is moving the document to the selected folder, you'll have it used Field B to route it and move the value from Field B to Field A, clearing the contents of Field B when it does it.

I hope this helps.

1 0
replied two days ago

Thanks @Matthew. This sounds interesting but will be a bit complex to implement because of the many combinations of Users which are very many.

I used Assign Field Value activity Tool to clear the list.

But I dont want to clear the list: I want to remove specific Item in the list which corresponds to the current User. Below is the List, say I want to remove specific name in the list rather than clear all...

 The problem however is how to add a condition to Assign Values tool to only void specific name in the list.

0 0
replied one day ago Show version history

As far as I know, Dynamic Fields is the only way to automatically modify options in a drop-down list in a field within the client.  At least during versions 10 and 11.

Workflow can clear the selected value or set the selected value in the field.  But it is not going to be able to manipulate the options available to select from the list in the dropdown.

The Advanced Metadata in version 12 might have more flexibility - I haven’t explored it enough yet.  But even with that, I’m guessing it still won’t be able to manipulate the drop down values available.  Doing a warning if they select themselves, kind of like Jennifer’s initial suggestion, is likely possible on version 12.

Bottom-line is that Dynamic Fields is really the only way within the client to change the options in a drop down field based on something else from the fields.

Also - you mentioned it isn’t feasible because of the large number of combinations.  You are right that it is a lot - that list of 3 in my example had 9 combinations.  Lists of hundreds of users will have tens of thousands of combinations.  But that doesn’t matter, because the dynamic fields will filter the list down, it won’t present tens of thousands of options to the user.

0 0
replied one day ago

Workflow can modify the options associated with a list field. See Append List Field Choices.

0 0
replied one day ago

What!? No way!  I totally missed that activity even existed.

However...

I'm looking at it now - and it sounds like it can just append options to the field, not remove options.

Also, it doesn't look like it targets a specific entry, so I'm thinking it is impacting that field universally through the repository.

If those two points are accurate - then it still isn't going to be helpful for this question.

0 0
replied one day ago

I just set up a Dynamic Fields example in my test environment to demonstrate.

Here's my database table with 10 employees listed.

Here's my database view with 100 combinations.

The number of combinations should be the square of the number of employees.  So before I had 3 employees with 9 combinations.  This is 10 employees with 100 combinations.  100 employees should have 10,000 combinations, etc.  But that still shouldn't matter because it is a view and thus generating the list of the fly and the client will filter the list on the fly.

On the Administration Console, you'll use the External Tables page to set-up the link to the view you set-up in the database.  I have a database that I only use for Dynamic Fields, so I have named it LFDynamicFieldsDB, your database will likely have a different name.

Once the External Table is set-up in the Administration Console, you can set-up the Dynamic Fields on the Template itself.

  • This is showing that Field A on the template is loading from Field A in the external table, and has no parent.
  • Field B on the template it loading from Field B on the external table, and has Field A as the parent (meaning whatever is selected on Field A will filter the results for Field B).

The end result looks like this in the Web Client...

Field A will always give us all ten employee names (now in alphabetical order).

And if Field A is blank, Field B will also present us with all ten employee names.

But if a name is selected on Field A, that name will no longer be an option in Field B, and we are only presented with nine options.

Since Field A is only being used to select the employee to exclude from Field B - you could make it hidden or read-only for your users, and only populate it via the Workflow.  When the first employee interacts with it and Field A is blank, they get the full list of all employees for Field B.  But later in the process, when your workflow has populated Field A, they now only get a filtered list of options for Field B, that is excluded whatever is populated on Field A.

1 0
replied on June 2

Others may know if this is possible, but here's how I've handled something similar in the past:

In a hidden field, I've collected the name of the current user, then I have displayed a warning message and disabled the Submit button using Field Rules when current user = selected name.

It's not exactly what you're asking, but may be an idea?

0 0
replied two days ago Show version history

Something like this might work on version 12 with the enhanced metadata functionality - but since the post is tagged as version 10 that functionality doesn't exist yet in the Web Client.

0 0
replied two days ago Show version history

I threw together a quick test, and in v10, you would just need a third field with a formula that can be used to trigger the Field Rule (in v10, Submit can't be disabled in the Field Rule, but this can be done using JS if you'd like - I would use a Field Rule to display an HTML message if TRUE, warning that you shouldn't select yourself in the drop down).

=IF(current_user = dropdown_selection, TRUE, FALSE)

no_match.JPG
is_match.JPG
no_match.JPG (11.25 KB)
is_match.JPG (11.26 KB)
0 0
replied two days ago

Sorry @████████- but I believe you are confusing Forms and the Web Client.  The question is about fields in the Web Client.

0 0
replied two days ago

You are absolutely correct. Apologies!

0 0
replied two days ago

Thanks for your comments. I have filed it a way in case i want to do similar things with forms. :)

0 0
replied two days ago

If you are well-versed in SQL you could save all the user names in a table/view and have a lookup that runs a stored procedure that passes the current username to the procedure and selects everyone except that person to load the list.

You are not allowed to follow up in this post.

Sign in to reply to this post.