import { LightningElement } from 'lwc';
import startFlow from '@salesforce/apex/ExerciseOrchestrator.startFlow';

export default class ClientOperator extends LightningElement {
    firstName = '';
    lastName = '';
    email = '';

        this.firstName = event.target.value;

        this.lastName = event.target.value;

        this.email = event.target.value;


        const myClient = {
            firstName : this.firstName,
            lastName : this.lastName,
            emailAddress : this.email



        startFlow({ client: myClient })
            .then((result) => {
                this.error = undefined;
            .catch((error) => {
                this.error = error;


public with sharing class ExerciseOrchestrator {
    public static String startFlow(Client client){
        String encodedClientKey = ClientService.searchClient(client);

        System.debug('Starting process.');

        if(encodedClientKey == null){
            System.debug('Client does not exist. Creating client.');
            encodedClientKey = ClientService.createClient(client);

            System.debug('Creating loan account for the client.');

            System.debug('Creating deposits account for the client.');
            System.debug('Client exists.');

            if(DepositAccountService.searchAccount(encodedClientKey) == False){
                System.debug('Creating deposits account for the client.');
                System.debug('Client has deposits account.');

            if(LoanAccountService.searchAccount(encodedClientKey) == False){
                System.debug('Creating loan account for the client.');
                System.debug('Client has loan account.');

        System.debug('Process finished. Exiting..');
        return 'OK';

The call results in the following error:

h {status: 500, body: {…}, headers: {…}}
body: {message: "An internal server error has occurred\nError ID: 442818567-43157 (-1279386781)"}
headers: {}
status: 500
ok: (...)
statusText: (...)

And the Apex logs says:

07:40:37.9 (9901954)|CODE_UNIT_STARTED|[EXTERNAL]|apex://ExerciseOrchestrator/ACTION$startFlow
07:40:37.9 (11645846)|EXCEPTION_THROWN|[EXTERNAL]|System.TypeException: Client does not have a no-arg constructor
07:40:37.9 (18262156)|CODE_UNIT_FINISHED|apex://ExerciseOrchestrator/ACTION$startFlow

What am I missing? How is the object that I sent empty (no-arg)?

I'm aware that a work-around would be to pass a JSON string from LWC to Apex, then deserialize it in the Orchestrator class. But I'm still curious to know why the mentioned error happens (I've seen plenty of topics exactly like mine but people don't seem to encounter this error).

  • I am getting same error. although I do have public no-arg constructor. It is showing this error only in orgs I created today not in old orgs. which is weird . I wonder if it is related to some recent release. public class PaymentAccountAndSiteRequestItem { AuraEnabled public string SFCurrentBaseUrl { get; set; } AuraEnabled public string PaymentAccountId { get; set; } public PaymentAccountAndSiteRequestItem() { } } Oct 31, 2022 at 1:14

2 Answers 2


If your class has no constructors, you get a "free" zero-argument, do-nothing constructor. If you have at least one constructor defined, this "free" constructor goes away, and you need to explicitly specify a zero-argument constructor if you want one. This appears to be relevant to your situation, because the system is attempting to call a zero-argument constructor on the Client that is passed in, but since that constructor doesn't exist, you're getting the error. Just adding the line public Client() {} to your Client class should fix the problem.


Please refer to this article : https://stackoverflow.com/questions/11337542/how-do-i-fix-this-error-xyz-does-not-have-a-no-arg-constructor

All you need to do is creating a no-arg(w/o parameter) constructor inside Client class.

  • How would it help if I want to call the constructor with params? Or is the no-arg constructor necessary in order for the one with params to work for some reason? Aug 13, 2021 at 8:57
  • Well, the exception basically tells that somewhere in your codebase, there is an empty instance for Client class. Maybe its triggered from LWC when you pass it as a param idk but this is the issue you have. Alternatively, you can serialize your object and pass a string into your class and deserialize, cast on apex side as you already mentioned.
    – umithuckan
    Aug 13, 2021 at 9:04
  • I indeed proceeded to solve the task by (de)serialising the object.. I tried creating a default constructor, seems like the error disappeared but the application manifests itself quite weird. Aug 13, 2021 at 9:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .