Hot answers tagged

52

Salesforce platform has a feature ROW LEVEL Security. This feature ensures that sharing and visibility set by salesforce administrators for the records have to be maintained. As a part of this feature, there are sharing calculations that the platform has to perform when the record ownership is changed or child records are created/modified. Assume that a ...


22

Curly brackets are used to indicate scope in Apex (and other C-like languages). It could be the scope of your class, method, or a separate scope that you've defined within one of those. You can access variables that have been declared in your current scope and parent scope(s), but not those defined in child scopes or parallel scopes. In addition to this ...


20

Copy the Deployment ID in your clipboard, and head to: https://[INS].salesforce.com/[PUT-DEPLOYMENT-ID] Click on the Delete button to delete the deployment record, and everything should be back to normal.


20

You are most likely encountering ESLint errors in VS Code. As an example below is how my code looks like with those warnings. However I am still able to save the component and utilize alert or console.log statements specifically for debugging purposes. Your options are: Just ignore those warnings You can choose to suppress those warnings by right ...


16

Because you wait until the execute() method to query for the records to delete, you are not utilizing the scope parameter (the second parameter of the Database.executeBatch method--in your case, 200) to limit the size of your batches. Because of this, you are attempting to delete too many records of too many types in a single call. If three different sObject ...


15

As an alternative, you can click on the Progress panel in the developer console and click "Cancel All Deployments." What is going on? Apex and VF are interesting because they need to be compiled to ensure the saved state of the org is valid. Before, the only way to do this was a deploy in the Metadata API, which requires a ZIP file and a lot more time. ...


14

1 - Is using 'escape = false' the only way to display a hyperlink in an error message? Yes, otherwise it'll display as raw HTML. 2 - Is it ok to go ahead and use this technique in my scenario since only internal devs will be able to modify it? As long as the messages cannot be modified or influenced by the user, this should be okay. If the user can ...


11

This is a rather interesting situation since according to the docs Process is not the outer class but the namespace itself. Since you're not just shadowing a class name but instead an entire namespace I'm not sure there's a way around this; in fact I strongly doubt that there is.


11

Apex is case insensitive. Apex is trying to use the variable you are declaring instead of referencing the class. To Apex, pattern and Pattern are the same thing, and at the moment pattern is closest in scope. Try renaming it to p or patternA or whatever makes most sense for your code.


11

You can add an error to a specific field using the addError method as follows: SObject someRecord; someRecord.SomeField__c.addError('Custom Message'); //or someRecord.someField__c.addError(someException); Note that you cannot add it to a field dynamically. This error mapping can only be done with a hard-coded field. See also: Provide an additional ...


10

Since a is declared inside a separate method, it isn't visible from other methods. Here's one way to deal with it by passing the Account to the createContact method. @isTest public class AccountSaveTestSuite { public static Account createOneAccount(){ Account testAccount = createAcct('ABC Computing inc.'); Contact testContact = ...


10

Each field may return an independent error (e.g. multiple validation rules failed). In this case, the API allows to report each error on the appropriate field. Remember, this is an API that can be used to show errors on a third-party application, so reducing the number of round-trips is important. It could be from, for example, a half-dozen validation rules ...


10

Precision is the total number of digits allowed both left and right of the decimal, and scale is the number of digits to the right of the decimal. The number of digits just to the left of the decimal is precision-scale, or in other words, 2 significant digits. As configured, the field's maximum value is 99.99999999. You'd want to edit the field to allow 3 ...


9

I'm not sure it's related, but I noticed this on twitter: .@salesforce users please update your Google Chrome to 31.0.1650.57. This fixes the display issue. Nate Lipke I think this comes back to the known issue: Unexpected display issue after updating to Google Chrome 31 with embedded Visualforce Pages


9

I agree with @ca_peterson. There is no way to do it. The Type Resolution documentation indicates the parser will look for an inner type on a class as it has precedence over a top-level class in a namespace (see last line of the doc quoted below). In your case, the parser would not find an inner type "Plugin" defined on your "Process" class, resulting in the ...


9

So, this is the Maximum number of unique namespaces referenced limit, which currently maxes out at 10. The explanation from the linked documentation: In a single transaction, you can only reference 10 unique namespaces. For example, suppose you have an object that executes a class in a managed package when the object is updated. Then that class updates a ...


9

You're missing a configuration file for some reason. Try the following. Close all files and folders in Visual Studio Code, then close it entirely. Create a new folder in your project directory called .vscode. Windows Explorer won't let you do this, so do it from a terminal: mkdir ".vscode" Go in to this folder and create a new file called settings.json. ...


8

I had a line like following Project p = projectsMap.get( projId ); When I changes this line to Project__c p = projectsMap.get( projId ); everything has been saved ok. Actually I meant Project__c (custom object), not sure what Project could be.


8

I have two suggestions. Firstly, see if anything useful has been written to your trace file "traceLogs.txt" as this should contain the full response. Secondly, be aware that Java 7 and lower does not use TLS1.1 or higher by default, so if you're not using Java 8, you'll need to add a JVM parameter of -Dhttps.protocols=TLSv1.1,TLSv1.2 Without the JVM ...


8

There are two errors on your code. First, the getValues() method for list custom settings, must receive a parameter that is the name of a custom setting 'record'. And it doesn't return a list. The other error is that you are referencing a field from a list variable (wich doesn't exist), you need to reference the field from the sObject variable. So instead ...


8

You are going to have to move your logic to a future method to create a separate transaction. To do so, you will need to move this logic to a separate class (which you should be doing anyway). Note that you also should not be calling any DML, futures, etc within a for loop. This is bulkification 101. Create a collection of names, then pass them in once your ...


8

There is no .set() method on a Javascript object. Although you have called it a Map when you wrote this: <aura:attribute name="fieldValues" type="Map" default="{}"/> Lightning pretty much ignores the value in the type there. In most cases, it has no effect. So, the type of the default value is what you actually get in ...


8

The CPU time limit is a cumulative limit across the whole transaction. Essentially, what is happening is that your Flow, plus your Process invocations, plus the NPSP triggers that are run consequent upon the updates you are making, are taking too long to execute in a single transaction (10 seconds of CPU time). Because the CPU time limit is a cumulative ...


8

Solution Add super() as the first statement in your constructor: constructor() { super(); // this is required console.log('constructing'); } Reason The requirement for a custom element constructor's first statement to be a call to construct the parent class (LightningElement) comes from the HTML: Custom elements spec and is referenced in the LWC ...


7

Please add the column Unsolicited_Bid__c to your oppQuery. That is what the exception System.SObjectException: SObject row was retrieved via SOQL without querying the requested field: Opportunity.Unsolicited_Bid__ was trying to relay, that there was an attempt to get/set a field on an sobject from a query that originally did not query that field. As an ...


7

The problem is in "FROM Contact" You can't subselect on an object,but on a relationship to an other object. So you have to use the name of the relationship, which is Contacts in this case SELECT Name, (SELECT LastName,id,Email from Contacts) from Account limit 10 Note that limit also doesn't require an : or = if you have the value in the query directly. ...


7

You must specify UserRoleId as null. Reference: You can insert a user in a transaction with other sObjects in Apex code saved using Salesforce API version 15.0 and later if UserRoleId is specified as null. The obvious conclusion is that your DataFactory.createUser method is setting the UserRoleId to some other value. If you must specify this field for ...


7

You should convert the Object to String first. And then String to Decimal: Object o = '2.52'; String s = String.valueOf(o); Decimal d = Decimal.valueOf(s); In the Decimal docs: the valueOf(...) method can take as parameter: Double String Long but not the Object! So in your code use: Decimal.valueOf(String.valueOf(data.get('agreement')))


7

As noted in the comments, you've escaped the wrong single quote. Incorrect 'WHERE Id = \'' + someId + \'' ' Correct 'WHERE Id = \'' + someId + '\'' Also noted in the comments, you can use bind variables if you cache the Id itself as a top level property. Id someId = objectVar.Id; objectVar = Database.query('SELECT ... FROM ... WHERE Id = :someId');


7

The problem is with how you are looking to reference the trigger.new context. The binding expression : must be used as follows. trigger AccountAddressTrigger on Account (after insert, after update) { List<Account> accs = [ SELECT ShippingPostalCode, BillingPostalCode FROM Account WHERE Id IN :Trigger.New ]; }


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