function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
steve nabors 7steve nabors 7 

Using Apex-Defined data Types in LWC

I have a need to embed an LWC in Flow and output an Apex Defined Data Type using a wrapper class.  I've gotten this to work if the Wrapper class is a standalone Apex Class,  i.e. not an inner class and I'm wondering if I'm doing something wrong or just how it is.

This works:

Apex Class:
public class Wrapper {
    @AuraEnabled
    public String sampletext {get;set;}
    @AuraEnabled
    public Integer sampleinteger {get;set;}
    
    public ToV_Fund_Wrapper(String sampletext, Integer sampleinteger) {
        this.sampletext = sampletext;
        this.sampleinteger  = sampleinteger;
    }
}

LWC xml:

<targets>
        <target>lightning__FlowScreen</target>
    </targets>
    <targetConfigs>
        <targetConfig targets="lightning__FlowScreen">
            <property name="wrap" label="wrap" type="apex://Wrapper" role="outputOnly"/>
        </targetConfig>
    </targetConfigs>


This, however, does not work, and just curious why:

Apex:
public class AllWrappers {
	
   public class Wrapper {
      // Same as above
   }
}

LWC:
<property name="wrap" label="wrap" type="apex://Wrapper" role="outputOnly"/> - NOPE
<property name="wrap" label="wrap" type="apex://AllWrappers.Wrapper" role="outputOnly"/> - NOPE