Hot answers tagged

11

The reason only one item could be returned as the result of a find() call is that we keep a map of ID to component in our services. "myId": "1:0" If you register two components with the same ID, we convert it to an array. "myId": ["1:0", "42:0"] If you then destroy one of those components, it stays an array. "myId": ["1:0"] I do think there might be a ...


9

Okay, this seems to be because of how aura:id is cached and the Lightning life cycle. Here's a reproduction of the problem: <aura:application > <aura:attribute name="dyn" type="Aura.Component[]" /> {!v.dyn} <hr /> <ui:button press="{!c.dynamicReset}" label="Reset" /> </aura:application> ({ dynamicReset: ...


3

Your solution will really depend on how many levels you need to be able to support. For instance, if you can rely on only going 10 levels deep then you can just use a formula field as per Adrian's answer to Need a custom field Grand parent Account which has highest level of account hierarchy. Another alternative is to use a text field to maintain the ...


2

As Phil W mentioned, you cannot filter long text fields in SOQL. You can vote for the idea to allow this. You didn't really specify the context for this. If it's a trigger context, then you already have the records. I'd be worried about your query size if you have millions of accounts and no real way to narrow down which ones you want to check the Notes of ...


1

Based on what you have shared, it looks like you are missing the value attribute, which is why currentBoatTypeChoice returns undefined. as well as the currently selected option using the 'selected' attribute. <option text="{!type.Name}"></option> //component.find("currentBoatTypeChoice").get("v.value") == undefined should be <option text="{...


1

Your arguments to FIND are reversed From the doc: https://help.salesforce.com/s/articleView?id=sf.customize_functions_a_h.htm&type=5 FIND(search_text, text[, start_num]) and replace search_text with the string you want to find, replace text with the field or expression you want to search, and replace start_num with the number of the character from which ...


1

If you always use the same (partial match) criteria for finding values (here you match the Text value), the best solution is to actually use a Map not a List. Something like this: public class SelectItem { public String Text { get; set; } public String Value { get; set; } } public void FooMethod() { Map<String, SelectItem> items = new Map&...


1

The arrow functions don't exist in Apex. This is plain JavaScript. You can conceptually find an element if you already have it: SelectOption[] options = new SelectOption[] { new SelectOption('a','a'), new SelectOption('b','b') }; SelectOption target = new SelectOption('b','b'); System.assertEquals(1, options.indexOf(target)); This operation is ...


1

Taking Kris's answer a little further, if the context is outside the Account trigger, in order to get a set of candidate Accounts that may be what you are looking for - i.e. ones that include the search term at least once, somewhere (may not be in your long text field, but it may be) - tha you can then filter down, try something like: String searchTerm = '...


1

There are a couple of problems with this approach. You haven't added the component - you would need to do this dynamically. Component encapsulation means that your find will not work if called from the parent component. To solve this issue, first add the component dynamically: doInit : function(cmp) { $A.createComponent( "c:test", {"...


Only top voted, non community-wiki answers of a minimum length are eligible