Selecting drop down options in Salesforce Lightning

Hello fellow Blazers!

I am encountering an obstacle withing Salesforce Lightning and I bet there's a solution out there.

When running a snippet that has to select items from a drop-down menu, if the mouse cursor happens to be positioned in the space where a drop-down is revealed, then no matter what selection is found by the snippet code, if the mouse cursor is touching another item in the list, then most of the time, its the item touched by the mouse cursor that ends up being selected.

  • I have tried coding the snippet to paste the exact text of the item I wish to select from the drop-down list.

  • I have tried coding the snippet to type the characters of the item I wish to select from the drop-down list.

  • I have tried using the {key:downarrow} code however many times it has to key down the list to get to the item I wish to select.

  • Any thoughts or suggestions?

Thank you!

-Brad

This really depends on how the Salesforce dropdown is implemented. Could you post a screenshot and instructions on how to get to it in the SFDC UI (as they often have multiple versions of a widget in use at the same time in different sections of the app) and I'll take a look.

I can provide screenshots, and video capture of the process. Unable to share SFDC info though. Would the other items I can provide, be helpful?

Screenshots and video would be helpful. If you don't feel comfortable posting them publicly, please feel free to email me at scott@blaze.today.

Did you all find a solution to this one? I have the same problem.

@Brad_Hedinger - any suggestions?

@Kevin_Roberts @Cedric_Debono_Blaze Hello gentlemen! Apologies for the delay in my replying. I have tinkered with this quite a bit and have landed on a solution that, so far, has a 100% success rate. The solution is, to not use the simulated arrow keys to navigate a dropdown list. Rather, use the simulated letter keys to spell out the selection you want from the dropdown list. It takes a little testing to figure out exactly what letter keys need to be simulated in order for the drop down list item to be highlighted. You want to figure out what the absolute minimum keys need to be typed to get the desired result. This helps save time in the snippet run. Here's an example:

We have a drop down list in Salesforce Lightning that the snippet needs to select "Student Liaisons" from the Case Team field, and "Course Withdrawal" from the Case Type field. Therefore, the snippet is programmed to do the following:

Example Field{key: tab}
{key: backspace}Example Field{wait: delay=.1s}{key: tab}{wait: delay=.1s}{key: downarrow}{wait: delay=.1s}{key: enter}{key: tab}{key: tab}{click}{key: s}{key: t}{key: u}{key: d}{key: e}{key: n}{key: t}{key: space}{key: l}{key: i}{key: a}{key: enter}{wait: delay=.1s}{key: tab}{key: tab}{key: tab}{click}{key: enter}{wait: delay=.1s}{key: c}{key: o}{key: u}{key: r}{key: s}{key: e}{key: space}{key: w}{key: enter}{wait: delay=.1s}{key: tab}

I used to have the snippet type the "c" key, then the down arrow key 8 times to get to Course Withdrawal. This worked until a new item was added to the dropdown list that started with a "c"; this made Course Withdrawal no longer the 9th item beginning with "c" in the list. So, to get around this issue, code the snippet to type out what you want from the list, including the spacebar key if needed. I'm attaching a short video clip on the above snippet running.

TB_Drowdown List Selection.mov

Hope this helps! If you'd like to jump on a Zoom together to dig into this further, let me know!

Happy Blazing! :fire:
-Brad

Awesome! Thank you so much. I did a quick test and it seemed to be working exactly as you said it would. Looking forward to getting this up and running.

That's great news, @Kevin_Roberts! A piece of advice; you may need to play with the delay timing to find the sweet-spot for your Salesforce environment. Specifically the delays involved in jumping from field to field...especially if you are jumping to a field, or through it to another, and that field you are jumping to/through is a dropdown list as well. Otherwise, should be pretty smooth sailing!

Happy Blazing! :fire:
-Brad

@Kevin_Roberts, quick tip: you can set a variable for all of your delays. That way, once you've found a delay that works, you can set it in the variable and use it in all the wait commands in that snippet :slight_smile:

{note: trim=right}{dly=0.5}
{endnote: trim=right}

text 1
{wait: delay={=dly}s}
text 2
{wait: delay={=dly}s}
text 3
{wait: delay={=dly}s}
text 4
{wait: delay={=dly}s}

1 Like

Great tip @Cedric_Debono_Blaze! Speaking for myself, the only reason I have not employed variables related to wait delays is because Salesforce Lightning can be a little temperamental at times with how long it takes for fields to process what the user (or Text Blaze) has commanded the field to do. I find myself needing to change the delays by 10ths of a second at what seems like random intervals of the delay commands within snippets. I base those tiny changes on feedback I get in real-time from users on my teams. However, maybe it's time I revisit the use of variable with time delays. Definitely will take it for a spin!

1 Like