• steve nabors 7
  • NEWBIE
  • 15 Points
  • Member since 2019
  • Developer
  • Infosys/Charles Schwab

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 3
    Replies

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

We have a nightly queueable job that runs on the Contact object that does ranking.  All the process does is update 1 field, possibly on up to 12,000 contacts.  No extra processing needs to occur since this field isn't used for anything else (read-only, info only).  We are running into CPU limits because of all the normal processing in the Trigger.  I have decided to exit the trigger if it detects if that field has changed (the batch job is the only thing that can change it).  I've got this working and wanted to know if the below was the best way to do this:

trigger MasterContactTrigger on Contact (
    before insert, after insert, 
    before update, after update) {

   if (Trigger.isUpdate) {
      for(Contact cont : Trigger.new) {
         Contact oldContact = Trigger.oldMap.get(cont.Id);
         if (cont.field__c != oldContact.field__c) return;
      }
   }

...........
I'm having a problem passing the recordId to the controller of my lightning component when that component is on the utility bar.  I can see the recordId just fine in the component, but when I access it from the controller, I get undefined.  If I add the very same component to a record page, it works fine.  I tried a few different things just using some basic code:
Component:
<aura:component implements="flexipage:availableForAllPageTypes, force:hasRecordId">
    <aura:attribute name="TestString" type="String" access="global" default="Test String" />
    <aura:attribute name="TestRecordId" type="String" access="global" default="{!v.recordId}" />
    <aura:handler name="init" value="{!this}" action="{!c.init}" />
    <p>The RecordId is: {!v.recordId}</p>	
    <p>The TestRecordId is: {!v.TestRecordId}</p>	
    <p>The TestString is: {!v.TestString}</p>	
</aura:component>

Controller:
({
    init : function(component) {
        console.log("RecordID: " + component.get("v.recordId"));
        console.log("TestRecordID: " + component.get("v.TestRecordId"));
        console.log("TestString: " + component.get("v.TestString"));
    }
})

When on a Record Page:
RecordPage
When on the Utility Bar:
Utility Bar
Which is better in an iteration over a Map,  get methods, or an object instance?

Example:

Map<Id, SObject> mapName = new Map<Id, SObject>([ SOQL Query ]);
for (Id key : mapName.keySet()){

EITHER THIS:
var1 = mapName.get(key).field1
var2 = mapName.get(key).field2
var3 = mapName.get(key).field3
.......

OR THIS:
SObject o = mapName.get(key);
var1 = o.field1
var2 = o.field2
var3 = o.field3
.......

 

We have a nightly queueable job that runs on the Contact object that does ranking.  All the process does is update 1 field, possibly on up to 12,000 contacts.  No extra processing needs to occur since this field isn't used for anything else (read-only, info only).  We are running into CPU limits because of all the normal processing in the Trigger.  I have decided to exit the trigger if it detects if that field has changed (the batch job is the only thing that can change it).  I've got this working and wanted to know if the below was the best way to do this:

trigger MasterContactTrigger on Contact (
    before insert, after insert, 
    before update, after update) {

   if (Trigger.isUpdate) {
      for(Contact cont : Trigger.new) {
         Contact oldContact = Trigger.oldMap.get(cont.Id);
         if (cont.field__c != oldContact.field__c) return;
      }
   }

...........
I am looking at creating a custom home page template in Lighting but I can't seem to get a header added into this. I currently have the three regions displaying fine but for some reason am a bit lost on how to add a header that spans all three regions accross the top.

Here is my component markup:
<aura:component implements="lightning:homeTemplate" 
                description="A home page you always dreamed of, 3 columns." >
    <aura:attribute name="region_header" type="Aura.Component[]" />
    <aura:attribute name="column1" type="Aura.Component[]" />
    <aura:attribute name="column2" type="Aura.Component[]" />
    <aura:attribute name="column3" type="Aura.Component[]" />
    
    <div>
        <lightning:layout horizontalAlign="spread" pullToBoundary="small">
            <lightning:layoutItem size="4" flexibility="grow" 
                                  padding="around-small">
                {!v.column1}
            </lightning:layoutItem>
            <lightning:layoutItem size="4" flexibility="grow" 
                                  padding="around-small">         
                {!v.column2}
            </lightning:layoutItem>
            <lightning:layoutItem size="4" flexibility="grow" 
                                  padding="around-small">
                {!v.column3}
            </lightning:layoutItem>
        </lightning:layout>
    </div> 
</aura:component>

And here is the design markup:
<design:component label="3 Column Page">
    <flexipage:template >
        <flexipage:region name="region_header"    defaultWidth="Medium" />
      <flexipage:region name="column1" defaultWidth="Medium" />
      <flexipage:region name="column2" defaultWidth="Medium" />
      <flexipage:region name="column3" defaultWidth="Medium" />
  </flexipage:template>
</design:component>
Hi ,
I was trying to solve the trailhead challenge under "Using Static Resources".

Am getting following message:
Challenge not yet complete... here's what's wrong: 
The page does not include a reference to the specified image

Following code am using.
<apex:page >
            <apex:pageBlock title="Pic" >
                    <apex:pageBlockSection >
                         <apex:image value="{!URLfor($Resource.vfimagetest, '/cats/kitten1.jpg')}"/>
                    </apex:pageBlockSection>
             </apex:pageBlock>
</apex:page>
Am I missing something here?

Regards,
Manjunath C Sarashetti