Questions tagged [imperativeapex]
The imperativeapex tag has no usage guidance.
23
questions
-2
votes
1
answer
146
views
Apex wrapper variable with null values are not returning in LWC [closed]
I have an apex method which is returning Wrapper List.Some of the Wrapper Variables has values as null.Those null values and there variable names are not returning in LWC.
Wrapper Data:
[AccountNo = ...
-1
votes
1
answer
64
views
How to use imperative apex from Salesforce Sites?
I am surfacing a LWC on Salesforce Sites however, I am not able to implement imperative apex from a button click.
When I add the same LWC to a record page in Salesforce and click the button, then the ...
1
vote
1
answer
253
views
Gack Error Id : 2020409769-104966 (551437190) when there is no constructor without parameters
When a Lightning Action is called from LWC and a DTO model instance is passed, where the corresponding DTO Model class doesn't have no arguments constructor, an internal error is shown:
Gack Error Id ...
0
votes
1
answer
733
views
How to loop each list's column and assign them to an array (LWC)
I have a list returned from apex (imperative). How can I loop through each column and assign them to an array in js?
I can't seem to populate the arrays properly. I can get the results but I cannot ...
0
votes
0
answers
125
views
recordId is blank in imperative call
I have an lwc action button that loads the popup. When i load the component for first time, recordId is present. But when i close and open it again(without reloading the whole page), recordId is lost. ...
1
vote
1
answer
248
views
I'm trying to call method Imperatively based on the wired result but not getting result
I have one LWC component. In my JS file, I'm trying to call one apex method imperatively as it is not cache enabled, based on the result of wired method.
I'm not receiving the result of my wired ...
0
votes
1
answer
85
views
Too many DML Statements: 1 In LWC
I've been trying to research on how to solve this issue but it doesn't seem like I've been having much luck. I've cut out all of the additional functionality so that it only remains with a single ...
0
votes
0
answers
364
views
refresh datatable data in lwc while using imperative method
I have used the Braintree payment gateway to payments on 'Order' object. For this I have created the datatable to fetch the 'TotalAmount' field from the particular record and I'm calling it ...
0
votes
1
answer
307
views
Calling Apex function results in a "default(...).this is not a function" error, a similar function works perfectly
Previous functions I wrote which called Apex classes (see the below) work fine. New ones (one example included) do not, I do not see why. The second call throws the following error in a try/catch: &...
3
votes
1
answer
1k
views
Error calling Apex imperatively from LWC in a JavaScript method. Error gotten -> [F.default(...).then(...).error is not a function],
This is the import statement on my LWC
import checkSize from '@salesforce/apex/XFiles.checkSize';
This is what the function looks like on my lwc
handleCheckingFileSize(fileId) {
let resultSize = {...
0
votes
2
answers
381
views
Imperative Apex call under guest user results in List has no rows for assignment to SObject, anonymous execution works fine
I have the following Apex Method which is called in the Experience Cloud under unauthenticated guest user:
@AuraEnabled(cacheable=true)
public static string test(String ref) {
try {
...
0
votes
1
answer
742
views
unescape String APEX
Premise: I have a list of string which I have to pass it from LWC to APEX and in APEX I have to put this List in SOQL where clause to get the data. Finally I have to return the SOQL result list back ...
1
vote
1
answer
2k
views
Apex Method Overloading is not working when called from LWC javascript Controller
Recently i have observed this weird behaviour and i am not sure is this expected behaviour or i am doing some kind of syntactical error.
I have two method with same name(suppose "methodOfClassA&...
0
votes
1
answer
354
views
Typecast/Assign data from event.detail or event.target to Salesforce custom object
I am trying to pass Salesforce object record to imperatively called apex method.
Javascript method is being called from onsubmit of record-edit-from, which in turn calls apex method.
But assignment ...
1
vote
0
answers
28
views
`ldsNetwork.js` error when performing imperative APEX call
I have a very strange issue with one of my imperative APEX call, I get the following error :
Here is my calling code :
const dto = {
listId: this.selectedListId,
name: ...
3
votes
2
answers
4k
views
Display error in toast from imperative call
I am trying to show the error message from the apex method exception as a toast message while doing imperative call in lwc. I am using ldsUtil.js to simplify the error message. But either way, I am ...
3
votes
2
answers
1k
views
passing object from LWC to Apex not working as expected (Class does not have no-arg constructor error)
JS:
import { LightningElement } from 'lwc';
import startFlow from '@salesforce/apex/ExerciseOrchestrator.startFlow';
export default class ClientOperator extends LightningElement {
firstName = '';
...
3
votes
1
answer
2k
views
LWC Jest test fails when testing data returned after apex imperative call
I believe it is a simple fix, but I am new to everything and Jest being the latest one I am exposed to.
I am trying to test if the lightning-combobox received the data to fill its options after the ...
1
vote
1
answer
3k
views
LWC Imperative APEX with Parameters not taking Ids
I'm creating a LWC QuickAction. From a lookup field for accounts I need to fetch the external Id of the Account. I get the account ID from the lookup, but when I pass them to APEX, I get Error 500, ...
-1
votes
1
answer
1k
views
Unable to insert contact record on button click using lwc and apex controller [closed]
Button is created in quick action bar on an account record.
HTML FILE
<template>
<lightning-card title="New contact" icon-name="standard:contact">
<...
2
votes
3
answers
3k
views
@track decorated property not updating LWC after imperative call
I can't seem to figure out what I am missing.
I have a component that is supposed to display data after it receives an id of the exact record hence I am using an imperative call. I can see in the log ...
0
votes
1
answer
1k
views
How to refresh Related records & get the latest Count in LWC
I have a LWC Component added on Case object. Purpose of the component is to Change Ownership of the records and updates other fields on Case object. Once Ownership is changed, I have trigger which ...
11
votes
3
answers
6k
views
LWC + Jest: Mocking imperative Apex and returning a value
I'm going to do a Q&A-style entry here, since I couldn't find anything on the web describing this use case. I have seen several threads here describing how to do an empty mock on an Apex call in ...