Questions tagged [aura-enabled]
The aura-enabled tag has no usage guidance.
31
questions
0
votes
0
answers
99
views
SOQL doesn't work on pc (person account) fields
I have enabled Person Account in my organization.
I also created a field on Contact Object named LinkedUser__c (Lookup User), which can be different from Owner field.
Now, I have created a new LWC ...
0
votes
1
answer
90
views
Aura: calling an AuraEnabled method multiple times and waiting for it to finish
I have an AuraEnabled method which does a callout. I'd like to call this multiple times from my Aura component. How can I do this and then execute code after all of them have finished?
I tried doing $...
0
votes
0
answers
323
views
How to test a function that does a callout from another function?
In the code below, I'm calling GetBusinessDetails, which does a callout, from another function. The problem is, the lines with the asterisks are not getting hit when I run a test and that lowers the ...
0
votes
0
answers
131
views
RestResource to convert Apex-Defined Data Type for Flow Interview
I am attempting to use Flow as a low-code API development platform. The plan is to expose an endpoint with a RestResource, convert the request to an Apex-Defined variable, pass to a Flow and let the ...
-4
votes
2
answers
70
views
How to change this method into @auraEnable method
public PageReference back() {
PageReference pgRef = new PageReference('/' + oppId);
return pgRef;
}
2
votes
1
answer
649
views
Lightning: Need help understanding @AuraEnabled(cacheable=true)
Going through the Developer Guide I found this statement.
To set cacheable=true, a method must only get data. It can’t mutate data.
Does data mutation only refer to DML operations?
I have a method ...
1
vote
1
answer
1k
views
AuraEnabled function gets not value from lwc using class type as parameter
i have the following object:
public class myType {
public String name {get; set;}
public String fields {get; set;}
public Integer page {get; set;}
public Integer pageSize { get; set; }
}
...
2
votes
0
answers
998
views
Aura component unable to find apex controller method
This problem is going on and on on my orgs.
I use VS code as my IDE and whenever I deploy a freshly written @AuraEnabled method in a controller, for some time my org does not seem to recognize it. I ...
0
votes
1
answer
1k
views
Display record detail of child record in parent record's aura lightning component
I am designing a custom lightning component to display a list of OrderItem records in a tabular format on parent Order record detail page. The requirement is to display the record detail page of an ...
0
votes
1
answer
617
views
Illegal assigment from Object to String
I'm trying to update a field with the OldValue, but I'm receiving the following error: Illegal assigment from Object to String
@AuraEnabled
public static String updateRecordAfterReturned(Id ...
2
votes
1
answer
2k
views
Problem passing a wrapper class from LWC to Apex
I am having trouble passing an apex wrapper class from LWC into APEX.
Apex
@AuraEnabled
public static void myMethod(SomeData theData) {
system.debug('theData is ' + theData);
}
public class ...
1
vote
1
answer
162
views
List has no rows for assignment exception on AuraEnabled method
I have created an Apex Class with an AuraEnabled method, which I am calling from a Lightning component.
After the method is called I am receiving the below error.
There was an exception List has no ...
0
votes
0
answers
218
views
Is there a way to invoke AuraEnabled methods form browser's dev tools?
as title states I am looking for a way to invoke aura enabled functions by using only browser capabilities not via javascript written inside org, especially in lwc context. In the end when we add a ...
0
votes
1
answer
575
views
lightning:tabClosed event throwing error when calling apex method
I am calling apex method on lightning:tabClosed event to update a record on closing the tab. I can see the record Id being passed to controller method but query is throwing an error saying
{"...
0
votes
1
answer
209
views
Test data not visible by Dynamic SOQL
I have an seemingly simple aura enabled class for agreement lookup which returns maximum 8 records using dynamic SOQL. This class works fine from UI perspective. No issues so far while testing.
My ...
0
votes
1
answer
50
views
AuraEnabled Apex Class Returning Following Error: System.QueryException: List has no rows for assignment to SObject
In my following AuraEnabled class, I am trying to clone the current record displayed in my lightning component page. This lightning component implements force:hasRecordId and should insert it as new ...
0
votes
2
answers
113
views
List has no rows for assignment to SObject when cloning record
I an encountering the following error in my Auraenabled apex class:
List has no rows for assignment to SObject
I am aware that this occurs if the query doesn't return any rows, so I included a null ...
2
votes
1
answer
2k
views
LWC pass date to @wire apex - how to initialise date variable?
I have a component that on first load should display all accounts where a last verified date is 2 years or older.
The component has a date selection field where the user can select a different date, ...
0
votes
2
answers
408
views
Critical update not activated but is past the Auto activation date and no Activate button is available
In my dev org, these two critical updates haven't been activated by admins within the Auto activation date. So as per salesforce, shouldn't this be activated automatically? As the screenshot reads ...
0
votes
1
answer
157
views
Previously annotated identifier with @AuraEnabled(cacheable=true) must still be annotated: AuraEnabled(cacheable=true)
I am getting this error when I tried to remove the cacheable=true from the below method.
@AuraEnabled(cacheable=true)
global static boolean packageNotExpired() {
/// my code;
}
Previously ...
0
votes
2
answers
6k
views
MIXED_DML_OPERATION, DML operation on setup object is not permitted Contact User
Hi i have a problem cuz I'm trying do sth like below:
this method has adnotation AuraEnabled
Contact contact = getContact((Id)contactId);
contact.Inactive__c = true;
User user = getUserByContactId(...
2
votes
1
answer
2k
views
Getting results 'undefined' in LWC from Apex call
I've simplified my code drastically to try and get to the bottom of what's wrong, but I'm still getting the 'undefined' result and am at my wit's end.
This is in my html which triggers the event:
&...
1
vote
1
answer
475
views
Is it safe to directly return a SOQL query from a AuraEnabled Apex method
Is it safe to directly return a SOQL query from a AuraEnabled Apex method like this:
@AuraEnabled(cacheable=true)
public static List<Opportunity> getRecords() {
return [SELECT ... FROM ...
5
votes
1
answer
699
views
Can an @AuraEnabled method be added in a managed package patch release?
I have a managed package with an LWC component. I need to enhance this LWC in a patch to allow it to receive some additional data during its initialization, which is done using an @wire.
The data ...
3
votes
3
answers
955
views
AuraEnabled Method Causes Internal Server Error for non-Admin Profile
I have an Aura Enabled method in my class that accepts a Case record and a list of a related object records and inserts both of them. The code works fine when I'm logged in as the admin, but the ...
1
vote
2
answers
234
views
Store reference to an AuraEnabled Apex method in a JS property
Is it possible to store a dynamic reference to an AuraEnabled Apex method in the LWC JavaScript controller? Something like this:
import myMethodA from '@salesforce/apex/MyController.myMethodA';
...
0
votes
2
answers
79
views
Problem with unit test and Custom Setting with @AuraEnabled
There was a problem writing a unit test. I tried to use the usual HttpRequest and Mosk, but they do not work with Costom Setting. Here is my controller and test, which does not completely cover the ...
7
votes
1
answer
826
views
Good way to offer both LWCs and a REST API in the same code?
We are building a product that will make use of multiple Lightning Web Components (LWCs), and some of those will make use of @AuraEnabled Apex methods. We also plan to provide an API that non-LWC UI ...
0
votes
0
answers
177
views
Aura Enabled Apex Action - param not getting set
I am using action.setParams, but when I check the params they are not being set.
I'm not getting any error messages, the variable I'm using to populate the parameter is populated, but when I check ...
3
votes
1
answer
777
views
How can i create a Map for unrelated objects?
Background
We create shadow records for Contacts that are Inactive (record type) and I am working on building a UI for the user to Activate one or more shadow records associated to that Account. ...
9
votes
0
answers
4k
views
Winter '20 Critical Update "Restrict Access to @AuraEnabled Apex Methods for Authenticated Users Based on User Profile"
I was wondering if somebody has already dealt with this critical update:
When this critical update is activated, an authenticated user can
access an @AuraEnabled Apex method only when the user’s ...