Hot answers tagged

36

We're running into this too. We expected it to be the case that if we navigate to a Lightning Component URL once, then walk through other pages, then navigate back to it with a different URL, we'll get a brand new instance and see the init method fire. Instead we get a stale older version with no init fired. So it's not clear what to do if what we really ...


26

This is probably because when you divide an Integer by an Integer you get an Integer back which has the same value as Decimal.round(RoundingMode.DOWN). system.assertEquals(1, 8/5); system.assertEquals(8/5, (8.0/5).round(RoundingMode.DOWN); system.assertEquals(-1, -8/5); system.assertEquals(-8/5, (-8.0/5).round(RoundingMode.DOWN); system.assertEquals(2, 7/...


15

Integer Division In Apex Code, similar to Java, when there are two like numeric data types (e.g. both Integers), then they are calculated in a way that returns the same data type. Integers cannot store fractions, so when you do something like 7/3, the fraction is silently discarded. As far as I know, integer division works in the same for every programming ...


13

You can track this bug at https://success.salesforce.com/issues_view?id=a1p3A000000eshdQAA It's scheduled to be fixed in the next patch release. We've identified the exact set of circumstances that cause this to appear. Suppose you have n picklist values. If one of those picklist values is a number m < n, and that value is not the m th value created, ...


12

It took 2 months, but this is the "final" answer we got from Support on this topic. Note that the investigation by Tier 3 resulted in this Known Issue being filed which was ultimately the cause for our documented behavior (i.e. by setting a log filter override on a class with a hashCode()/equals() implementation, it effectively disabled hashCode() from being ...


11

Looks weird,might be a bug. As a workaround, try passing the stages array as string from the component and deserialize the string to List<BpiStage> in the apex controller. Controller.js ction.setParams({ bpiId : component.get("v.recordId"), stages : JSON.stringify(component.get("v.stages")) }); AuraMethod: public static void ...


11

As it turns out the overflow properties had to be set to visible not just on the slds-scrollable_y class but also on the slds-scrollable_x class. Problem solved.


11

You've forgotten a required attribute. The radioGroup is grounded in HTML's <input type="radio" />, which uses a "name" attribute to determine groups. If you forget to specify the name, the options actually behave like independent radio groups. The following change is necessary for proper operation: <lightning:radioGroup name="recordTypes" options="...


10

I found a relevant approach. In the component with lightning:isUrlAddressable simply add a change handler for the pageReference state. Component: <aura:handler name="change" value="{!v.pageReference}" action="{!c.reInit}" /> Controller.js: reInit : function(component, event, helper) { $A.get('e.force:refreshView').fire(); }


9

While cropredy's answer cites the correct documentation: The style class used to display the output field component, used primarily to designate which CSS styles are applied when using an external CSS stylesheet. This attribute may not work for all values. If your text requires a class name, use a wrapping span tag. From this VF documentation on ...


9

I just did some research on this and found an answer in the Salesforce developer documentation page "Isolation of Test Data from Organization Data in Unit Tests": https://www.salesforce.com/us/developer/docs/apexcode/Content/apex_testing_data_access.htm Under the last major bullet ("There might be some cases where you can’t create certain types of data from ...


9

Unfortunately, I don't have an answer for you in terms of a workaround. I did spend some time trying to figure this out because I have a package that makes use of getSelected() on a list view and is in use in lots of orgs so was/am concerned about this breaking too. I'm now of the opinion that the problem is org specific. Here are the tests that I ...


8

This appears to be a defect, and I can tell you why. There are two functions that determine a key's behavior: equals and hashCode. The map implementation checks the results from equals and hashCode to see if a value is truly equal. Try the following: System.assertEquals(System.hashCode(1234), System.hashCode(1234.0)); You'll find that you'll get an ...


8

The reason for this seems to be that the framework replaces the first line's asterisk character with the \u002A Unicode escape sequence before serving the files to the browser. I'd report a bug if it was possible. Hopefully someone here can raise the issue!


8

See the idea HTML tags in the error message are escaped even if escape = false is specified at sObject.addError() in Lightning UI and Salesforce1 Sounds like they aren't going to fix/change it. This limitation has been documented at https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_system_sobject.htm#...


8

This occurs because of an optimization during the "query planning" phase of a query. The query optimizer removes null values from filters on required fields. This optimization allows Salesforce to use standard indexes instead of a full table scan on those fields, which can improve performance by many orders of magnitude on large tables. If Salesforce fixed ...


8

Logically, yes, because the empty string does not contain any disallowed characters. Disallowed characters are any characters not explicitly listed in the "only" specification. So in this case it is any letter other than "W". If I were implementing this method myself I would do something like: public Boolean containsOnly(String allowed) { ...


7

UPDATE: SOLUTION (4/16/15) Thanks to a buddy at SF I found this documentation that shows you how to clear the cache I was referring to so that the perceived code coverage (that which appears from "running all test") will now match actual code coverage (that which is calculated at deployment along with your changes of course). Follow the steps provided ...


7

I really don't know how catch the uploaded file error using apex (server-side), but I've avoided that limitation using javascript (client-side) before the form is submitted in order to notify the user about the limitation. This is an example: <apex:page standardController="document" > <apex:form styleClass="js-wrapp"> ...


7

It seems that you can set a CreatedDate on a record in the future, but when querying for that record you cannot use a date in the future as condition Although it is not likely that you will want to set a CreatedDate in the future, it is something easily forgotten when creating unit-tests. Could we mark this as a bug in Salesforce?


7

I wrote some unit tests: @isTest public class q359389 { static final Boolean IS_PERSON = true, IS_BUSINESS = false; static Account createAccountAndTask(Boolean isPerson) { RecordType rt = [SELECT Id FROM RecordType WHERE IsPersonType=:isPerson AND sObjectType='Account' LIMIT 1]; Account a = new Account(RecordTypeId=rt.Id); a....


6

I don't think this is a new behaviour in Spring 14. In the discussion forums - Table rows repeating for each Child Record present in Parent to Child Query there is a comment from @bob-buzzard in 2011: It seems to be a problem when the set contains sobjects - I've just checked back on mine and they've been primitives. It smacks that the "SetValue" in ...


6

The image file logo180.png is obviously deleted or moved (or was never there). I found that this error also shows in our org as well if you you open developer tools and refresh the page. I did a little digging and it appears the file is related to some marketing survey Salesforce created. Here's the line in my org: <script>var SFDCMktUrl='https://...


6

I have been informed by technical support that R&D has investigated the issue, and that this value will be removed from the UI at some point. As such, we shouldn't use this value for debugging.


6

I believe this is a bug, because the following code does work: <apex:page standardController="Opportunity"> <apex:variable value="{!0}" var="totalItemCount" /> <apex:variable value="{!0}" var="totalPrice" /> <apex:repeat value="{!Opportunity.OpportunityLineItems}" var="lineItem"> <apex:variable var="...


6

We hit this error this morning and tracked the problem down to our use of the lightning:card component. The title attribute changed from Component[] to String. We were using the title attribute as a facet using aura:set. The error is saying that the component array cannot be converted to a string. We removed the facet and set the title attribute as a string ...


6

You'll want to log a bug with this; it appears that the quotes do need to be matched in Spring 17, and this behavior also does not appear in Winter 16. For now, you should be able to escape one quote to bring the balance back. Here's an example of a broken regex in Spring 17: var r = /src="([^"]+)"/g; Here's a way to fix it: var r = /src="([^\"]+)"...


5

The documentation suggests that it does support the syntax, and no error arises when you use it (so, it's accepted by the parser), but it appears you'll have to have to separate scheduler, because it will only schedule it for one day a month. I also tried "0 0 10 ? * 6#2,4." It lets me manage it (in Scheduled Jobs) as the "second Sunday of every month" with ...


5

I thought it'd be good to share my solution with you. I ended up contacting Salesforce support and after some messages back and forth it turned out that there's some sort of backend setting that needs switched on: Tier 3 has enabled the permission "Apex queueable" in this Org. Now, you should be able to implement queueable interface. Maybe someone ...


5

My understanding is that when you divide an integer by an integer, it will always result in an integer. So when you divide 7/3, it's actually returning 2, which is why the Math.ceil() function is returning 2. Try doing Math.ceil(7.0/3.0) Or you can use code such as: Double seven = 7.0; Double three = 3.0; Integer pageNumber = (Integer)Math.ceil(seven/...


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