Hot answers tagged

4

If you don't have a Lender Account parent record, then, this error will occur. You can either do a null check in the code or make a calculation field to resolve the name in the database. In the Javascript controller you can extract the name into a variable: let lenderAccountName = opportunity.Lender_Account__c ? opportunity.Lender_Account__r.Name : "&...


2

The base SObject API, extended by all the specific object types, does not include the Name property since not every single SObject in Salesforce has a Name (though most do). You have two choices here: Continue treating the returned data as SObject and use the SObject.get() function to read a named field, like you do in the second example. Treat the result ...


2

The various date literals are all documented to accept a number N. They do not permit you to use a dynamic expression or field reference. You'll have to query the records and filter them in Apex, or change your data model to include a formula field that encapsulates this logic - say, a Checkbox field whose value is True only when the created date of the ...


2

There are two main reasons why you'd get this error. In Lightning (Aura and LWC), this error happens when you use @AuraEnabled(cacheable=true). This is because the result is cached, so if you include DML, those operations may not be carried out in subsequent method calls, leading to situations where the user thinks they've saved their data, but the server ...


1

As per now, it is not possible to do it via SOQL neither Apex. You can upvote that idea here. As an alternative, you can take a look at this post (using UI API) or this one (using Metadata API). Best regards!


1

I suspect you might be using @AuraEnabled(cacheable=true) in your apex method. There is nothing to cache here. Just remove (cacheable=true) from annotation in your apex method. Checkout similar problems questions here:- Storable Action - System.LimitException: Too many DML statements: 1 LWC LimitException: Too many DML statements: 1 To understand when to ...


1

Edit: make sure that CustomPeriod__c isn't a picklist or something. If not, I don't think you can mix the SOQL and the field value like that. But you don't need to query all records. Just query for your criteria, set it as a variable, then query the list. Here's an example that assumes you want the max CustomPeriod__c: Date referencePeriod = [SELECT ...


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