Questions tagged [imperativeapex]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
3 votes
1 answer
73 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 = {...
user avatar
  • 33
0 votes
2 answers
131 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 { ...
user avatar
  • 155
0 votes
1 answer
180 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 ...
user avatar
  • 405
0 votes
0 answers
17 views

I just want to iterate the Json response and push those values in an array. Using that Array, display those values in my HTML page

This is my JSON response received from the Apex: "returnValue": [ { "Id": "a3n11000000ck3mAAA", "Name": "18", ...
user avatar
1 vote
1 answer
560 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&...
user avatar
0 votes
1 answer
42 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 ...
user avatar
1 vote
0 answers
17 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: ...
user avatar
  • 334
2 votes
2 answers
1k 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 ...
user avatar
  • 305
1 vote
2 answers
393 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 = ''; ...
user avatar
3 votes
1 answer
751 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 ...
user avatar
  • 501
1 vote
1 answer
885 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, ...
user avatar
  • 134
-1 votes
1 answer
585 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"> <...
user avatar
2 votes
3 answers
843 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 ...
user avatar
  • 197
0 votes
1 answer
650 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 ...
user avatar
6 votes
2 answers
2k 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 ...
user avatar