• Laurie Drew
  • NEWBIE
  • 195 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 21
    Questions
  • 16
    Replies
Hello All, 
I am working on an LWC that ultimately should display 1 field from  custom metadata records (Call Script Layout) that I created.  In the process of figuring everything out.  In my apex controller I query to build a map<String, Object>, key is MasterLabel, then all the fields in the mdt object.  I get it pulled into my lwc successfully and filtered down to the 1 record that I was to display 1 time.  Issue I have is it is being displayed 214 times (this is the # of metadata records there are total).  While working through this I was filtering in the HTML, but when I attempt to remove the for:each and display just the one record, it breaks.  I've tried changing the variables in map to Map<String,String> but get error that the field in the second string cannot be found. 

My Apex Controller:

@AuraEnabled(cacheable=true)
public static Map<String, SObject> fetchQuestionMap() {
Map<String, Call_Script_Layout__mdt> questionMap = new Map<String, Call_Script_Layout__mdt>();
for(Call_Script_Layout__mdt csl : [SELECT Id, MasterLabel, Section__c, Question__c, Order__c FROM Call_Script_Layout__mdt ORDER BY Section__c])
questionMap.put(csl.MasterLabel, csl);
return questionMap;
}

LWC: I am calling multiple child LWC's that are not in this code:

HTML:
<template>
<template for:each={mapData} for:item="mapKey">
<c-call-script-_-coverage key = {mapKey.key} question = {mapKey.value}></c-call-script-_-coverage>
</template>
</template>

JS:

import { LightningElement, api, wire, track} from 'lwc';
import { getRecord } from 'lightning/uiRecordApi';
import fetchQuestionMap from '@salesforce/apex/callScript_CustomMetadataController.fetchQuestionMap';
const FIELDS = [
'Lead.Name',
];
export default class CallScript_FetchQuestion extends LightningElement {
@api
recordId;
@wire(getRecord, { recordId: '$recordId', fields: FIELDS })
lead;
@track mapData = [];
// Filter down to be a single question
@wire(fetchQuestionMap) wiredResult(result){
if (result.data) {
var conts = result.data;
for(var key in conts){
if(key ='CoverageType'){
this.mapData.push({value:conts[key], key:key});
}
}
}
}
}

meta file:
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>55.0</apiVersion>
<isExposed>true</isExposed>
<targets>
<target>lightning__AppPage</target>
<target>lightning__RecordPage</target>
<target>lightning__HomePage</target>
</targets>
</LightningComponentBundle>

I would really appreciate it if someone can tell me how I can get just 1 instance of the metadata record to display?
 
I have the requirement to write a trigger to auto convert leads and create just a contact record from prospects that are loaded in Pardot.  My trigger works as intended when simply inserting a lead record in Salesforce.  But when prospects are Imported via Pardot and attempt to sync into Salesforce, the record sync errors out  "This prospect has a sync error: field integrity exception: unknown (Cannot insert a converted lead)". 
I watched the debug log while the sync was running and did not see that my trigger logic even fires before the Pardot sync errors out.

Can anyone help me figure out how to make this work?

 
I have build a form with two columns of fields and 4 of them are bottom justified, is there a way to get them to align by the top of the field, here is a screenshot of what I am referring to:

User-added image

Here is my code:

<lightning:layout pullToBoundary="medium">
        <lightning:layoutItem size="10" smallDeviceSize="5" mediumDeviceSize="5"  padding="around-small">
            <c:customLookup objectAPIName="account" IconName="standard:account" label="Tenant" selectedRecord="{!v.selectedTenantRecord}"/>
        </lightning:layoutItem>
        <lightning:layoutItem size="10" smallDeviceSize="5" mediumDeviceSize="5"  padding="around-small">
            <ui:inputDate aura:id="LeaseEffectiveDate" label="Lease Effective Date" class="field" value="{!v.PropDetails.LeaseEffectiveDate__c}" displayDatePicker="true" />      
        </lightning:layoutItem>
    </lightning:layout>
        
    <lightning:layout pullToBoundary="medium">
        <lightning:layoutItem size="10" smallDeviceSize="5" mediumDeviceSize="5"  padding="around-small">
            <!--<lightning:input label="Lease Opportunity" name="LeaseOpportunity" value="{!v.PropDetails.LeaseOpportunity__c }" /> -->
            <c:customLookup objectAPIName="opportunity" IconName="standard:opportunity" label="Lease Opportunity" selectedRecord="{!v.selectedOpptyRecord}"/>
        </lightning:layoutItem>
        <lightning:layoutItem size="10" smallDeviceSize="5" mediumDeviceSize="5"  padding="around-small">
            <ui:inputDate aura:id="LeaseExpirationDate" label="Lease Expiration Date" class="field" value="{!v.PropDetails.LeaseExpirationDate__c }" displayDatePicker="true" />      
        </lightning:layoutItem>
    </lightning:layout>    
        
    </div> 

Any help that can be provided would be greatly appreciated!
How do I centralize my 2 columns of fields on the page, instead of them being smooshed over to the left like they are currently:

User-added image

I tried adding <div class="slds-align--absolute-center"> around this section of code moved all the fields to one line instead of the 2 columns they are currently in.  I want to keep the way they look now, just move everything over to the right to be more centered on the page.

Here is the portion of my code for this section of the screen:


    <div class="slds-text-heading--medium">Account Information</div>
    
    
      
    <lightning:layout pullToBoundary="medium">
        <lightning:layoutItem size="10" smallDeviceSize="5" mediumDeviceSize="5"  padding="around-small">
            <lightning:input label="Account Name" name="AccountName" value="{!v.AcctForm.Name }" />       
        </lightning:layoutItem>
        <lightning:layoutItem size="10" smallDeviceSize="5" mediumDeviceSize="5"  padding="around-small">
                  
        </lightning:layoutItem>
    </lightning:layout>
    
    <lightning:layout pullToBoundary="medium">
        <lightning:layoutItem size="10" smallDeviceSize="5" mediumDeviceSize="5"  padding="around-small">
            <lightning:input label="Property Number" name="PropertyNumber" value="{!v.AcctForm.PropertyNumber__c }" />       
        </lightning:layoutItem>
        <lightning:layoutItem size="10" smallDeviceSize="5" mediumDeviceSize="5"  padding="around-small">
                  
        </lightning:layoutItem>
    </lightning:layout>
    
    <lightning:layout pullToBoundary="medium">
        <lightning:layoutItem size="10" smallDeviceSize="5" mediumDeviceSize="5"  padding="around-small">
            <lightning:select label="Property Type" name="PropertyType" value="{!v.AcctForm.PropertyType__c}">
                <aura:iteration items="{!v.PropertyType}" var="ptype">
                    <option value="{!ptype}" text="{!ptype}" />
                </aura:iteration>            
            </lightning:select>
        </lightning:layoutItem>
        <lightning:layoutItem size="10" smallDeviceSize="5" mediumDeviceSize="5"  padding="around-small">
            <lightning:input label="Phone" name="Phone" value="{!v.AcctForm.Phone}" />       
        </lightning:layoutItem>
    </lightning:layout>
    
    <lightning:layout pullToBoundary="medium">
        <lightning:layoutItem size="10" smallDeviceSize="5" mediumDeviceSize="5"  padding="around-small">
            <lightning:select label="Property Status" name="PropertyStatus" value="{!v.AcctForm.PropertyStatus__c}">
                <aura:iteration items="{!v.PropertyStatus}" var="pstat">
                    <option value="{!pstat}" text="{!pstat}" />
                </aura:iteration>            
            </lightning:select>            
        </lightning:layoutItem>
        <lightning:layoutItem size="10" smallDeviceSize="5" mediumDeviceSize="5"  padding="around-small">
            <lightning:input label="Website" name="Website" value="{!v.AcctForm.Website}" />       
        </lightning:layoutItem>
    </lightning:layout>
    
    <lightning:layout pullToBoundary="medium">
        <lightning:layoutItem size="10" smallDeviceSize="5" mediumDeviceSize="5"  padding="around-small">
            <lightning:textarea label="Description" name="Description" value="{!v.AcctForm.Description}"/>       
        </lightning:layoutItem>
        <lightning:layoutItem size="10" smallDeviceSize="5" mediumDeviceSize="5"  padding="around-small">
            <lightning:input label="Region" name="Region" value="{!v.AcctForm.Region__c }" />       
        </lightning:layoutItem>
    </lightning:layout>    
    <br/><br/>
    

Thank you in advance for any assistance provided!
I have found a way through CSS to change the colour of the label for all of my <lightning:input> fields using the code below:

.THIS label.slds-form-element__label{
    
    font-size: 1.00rem;
    color: blue;
}

but I have 2 fields that are <ui:inputDate> fields, how do I change the colour of their label?

User-added image

Here is the code for the Purchase Date field:

<ui:inputDate aura:id="PurchaseDate" label="Purchase Date" class="field" value="{!v.AcctForm.PurchaseDate__c}" displayDatePicker="true" /> 

Thank you in advance for any assitance you can provide.
I am creating a custom lightning component to create an Account record and am wanting to make the field 'Description' taller.  Images below will explain better what I am wanting to do.  I want the input section of the field to be taller like this:

User-added image
Instead of what I currently have:

User-added image
I have been googling trying to figure out how to do this and apparenlty am not entering the correct key words to find a solution. 

Here is the section of code for this portion of the screen:

<lightning:layout pullToBoundary="medium">
        <lightning:layoutItem size="10" smallDeviceSize="5" mediumDeviceSize="5"  padding="around-small">
            <lightning:input label="Description" name="Description" value="{!v.AcctForm.Description}"/>       
        </lightning:layoutItem>
        <lightning:layoutItem size="10" smallDeviceSize="5" mediumDeviceSize="5"  padding="around-small">
            <lightning:input label="Region" name="Region" value="{!v.AcctForm.Region__c }" />       
        </lightning:layoutItem>
    </lightning:layout>

Would greatly appreciate any help that can be provided!
I have a batch apex job that basically goes through all invoices and totals the amounts for each sales person for each month and year.  The job works as expected in the sandbox environment with the test data I created.  But when I moved the job to production, it runs without errors, but does not update the fields with the monthly invoice sum totals like it does in sandbox.  In reviewing the logs I found one for example that found totals and shows that it updated the fields for the months.  Then in the very next log that did not find any invoices with totals, it updated the fields with null values for the very same records as in the prior log.  The Forecast and Forecast detail objects were created from scratch for this batch job and have no other triggers or processes running against them to udpate any fields.  My code is below, can anyone see why it is not updating the sum fields properly?

global with sharing class Forecast_Batch implements Database.Batchable<sObject>, Database.Stateful{

        global Database.QueryLocator start(Database.BatchableContext BC)
        {
            return Database.getQueryLocator([SELECT Id,OwnerId FROM Account]); //Query all accounts for ID and OwnerId
        }

    global void execute(Database.BatchableContext BC, List<SObject> scope)
    {        
        Map<Id, Map<String,Decimal>> accountAmountMap = new Map<Id,Map<String,Decimal>>();

        List<Id> accountOwnerIds = new List<Id>();
        Set<Id> accountIds = new Set<Id>();
        
        system.debug('+++ SCOPE SIZE ' + scope.size());
        
        for (SObject s : scope) {
            
            Account acc = (Account)s;
            if(!accountIds.contains(acc.Id)){
                accountIds.add(acc.Id);
            }
            
        }
        
        for (Account acc : [SELECT OwnerId,(SELECT Amount__c,InvoiceDate__c,OwnerDetails__c,Inv_Yr__c FROM Invoice__r ) FROM Account WHERE Id in : accountIds]) {
            
            Map<String, Decimal> amountMap = new Map<String, Decimal>();
            
            for (Invoice__c inv : acc.Invoice__r) {
                 
                Decimal amount = amountMap.get(inv.OwnerDetails__c);
                if (amount != null) {
                    amountMap.put(inv.OwnerDetails__c, inv.Amount__c + amount); 
                } else {
                    amountMap.put(inv.OwnerDetails__c, inv.Amount__c); 
                }
            }
            accountAmountMap.put(acc.Id, amountMap);
            accountOwnerIds.add(acc.OwnerID);
            
        }
        System.debug(accountOwnerIds);

         // Query list of forecast details record based on Account's owner Id

        List<Forecast_Details__c> forecastdetails = [SELECT ID,Name,Month_Total__c,OwnerID__c,FDOwnerDets__c from Forecast_Details__c where OwnerID__c IN : accountOwnerIds];

        // Iterate accounts in for loop
        // iterate forecast details record
        // get invoice amount based on account id and forcast month.
        // update in forecast detail record.

        for (SObject s : scope) {
            Account acc = (Account)s;
            Map<String, Decimal> amountMap = accountAmountMap.get(acc.Id);
            for (Forecast_Details__c forecastDet : forecastdetails) {
                if (forecastDet.OwnerID__c == acc.OwnerId)
                    
                {
                    Decimal amount  = amountMap.get(forecastDet.FDOwnerDets__c);  
                    forecastDet.Month_Total__c = amount;
                    System.debug('match');
                    System.debug(amount);
                }
            }
        }
        System.debug(forecastdetails);
        update forecastdetails;
    }  

    global void finish(Database.BatchableContext BC){}



I really appreciate any assistance that anyone can provide!
Can someone tell me how to change the sizes of input fields in my lightning component, I am using layout and layout item to get them centered on the screen, but I would like both columns to look more uniform.  Also how would I get fields like Description to show more than one line like it does in the OOB Account creation screen? 

Here is the code I have so thus far:

<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" >
    
    <aura:attribute name="PageHeading" type="String" default="New Property Space"/>
    <aura:attribute name="PropertySpaceName" type="String"/>
    <aura:attribute name="SpaceStatus" type="String[]" default="--None--,Vacant, Occupied, Pending"/>
    <aura:attribute name="Property" type="String"/>
    <aura:attribute name="SquareFootage" type="Integer"/>
    <aura:attribute name="DesiredTenantNotes" type="Integer"/>
    <aura:attribute name="PreviousIndustry" type="String[]" default="--None--, TBD"/>
    <aura:attribute name="Tenant" type="String"/>
    <aura:attribute name="LeaseEffectiveDate" type="Date"/>
    <aura:attribute name="LeaseOpportunity" type="String"/>
    <aura:attribute name="LeaseExpirationDate" type="Date"/>
    <aura:attribute name="PropForm" type="PropertySpace__c" default="{'sobjectType': 'PropertySpace__c'}" />
    
    <div class="slds-m-top--xx-large">
    <div class="slds-page-header">
    <div class="slds-align--absolute-center">
    <div class="slds-text-heading--large">{!v.PageHeading}</div>
        </div>
    </div>
    </div>
    
    <br/>
    <div class="slds-text-heading--medium">Information</div>
    
    <div class="c-container">
        
    <lightning:layout verticalAlign="center" class="large">
        <lightning:layoutItem flexibility="auto" padding="around-small">
            <lightning:input label="Property Space Name" name="PropertySpaceName" value="{!v.PropForm.Name}" />       
        </lightning:layoutItem>
        <lightning:layoutItem flexibility="auto" padding="around-small">
            <lightning:select label="Space Status" name="SpaceStatus" value="{!v.PropForm.SpaceStatus__c}">
                <aura:iteration items="{!v.SpaceStatus}" var="sstat">
                    <option value="{!sstat}" text="{!sstat}" />
                </aura:iteration>            
            </lightning:select>       
        </lightning:layoutItem>
    </lightning:layout>    
    
    <lightning:layout verticalAlign="center" class="large">
        <lightning:layoutItem flexibility="auto" padding="around-small">
            <lightning:input label="Property" name="Property" value="{!v.PropForm.Property__c}" />       
        </lightning:layoutItem>
        <lightning:layoutItem flexibility="auto" padding="around-small">
            <lightning:input label="Square Footage" name="SquareFootage" value="{!v.PropForm.SquareFootage__c}" />      
        </lightning:layoutItem>
    </lightning:layout>      
        
    <lightning:layout verticalAlign="center" class="large">
        <lightning:layoutItem flexibility="auto" padding="around-small">
            <lightning:input label="Desired Tenant Notes" name="DesiredTenantNotes" value="{!v.PropForm.DesiredTenantNotes__c }" />       
        </lightning:layoutItem>
        <lightning:layoutItem flexibility="auto" padding="around-small">
            <lightning:select label="Previous Industry" name="PreviousIndustry" value="{!v.PropForm.PreviousIndustry__c }">
                <aura:iteration items="{!v.PreviousIndustry}" var="pind">
                    <option value="{!pind}" text="{!pind}" />
                </aura:iteration>            
            </lightning:select>       
        </lightning:layoutItem>
    </lightning:layout>
        
    <div class="slds-text-heading--medium">Current Tenant</div> 
        
    <lightning:layout verticalAlign="center" class="large">
        <lightning:layoutItem flexibility="auto" padding="around-small">
            <lightning:input label="Tenant" name="Tenant" value="{!v.PropForm.Tenant__c}" />       
        </lightning:layoutItem>
        <lightning:layoutItem flexibility="auto" padding="around-small">
            <ui:inputDate aura:id="LeaseEffectiveDate" label="Lease Effective Date" class="field" value="{!v.PropForm.LeaseEffectiveDate__c}" displayDatePicker="true" />      
        </lightning:layoutItem>
    </lightning:layout>
        
    <lightning:layout verticalAlign="center" class="large">
        <lightning:layoutItem flexibility="auto" padding="around-small">
            <lightning:input label="Lease Opportunity" name="LeaseOpportunity" value="{!v.PropForm.LeaseOpportunity__c }" />       
        </lightning:layoutItem>
        <lightning:layoutItem flexibility="auto" padding="around-small">
            <ui:inputDate aura:id="LeaseExpirationDate" label="Lease Expiration Date" class="field" value="{!v.PropForm.LeaseExpirationDate__c }" displayDatePicker="true" />      
        </lightning:layoutItem>
    </lightning:layout>    
        
    </div>    
    
</aura:component> 

Here is a screenshot of the non-uniformity I am talking about:

User-added image

Thank you in advance for any help provided!
Hi, 

I am trying to build a map that will contain the Account OwnerId as the key and the sum value of the field Amount grouped by Month and Year as the value and receiving the error:

"Loop variable must be a generic SObject or LIst or a concrete SObject or List of: AggregateResult"

Here is my code, can anyone help me fix what I am doing wrong?


Map<Id,Decimal> invoices = new Map<Id,Decimal>();
for(Invoice__c obj:[Select Account__r.OwnerId, sum(Amount__c) FROM Invoice__c group by Account__r.OwnerId, Calendar_Year(InvoiceDate__c), Calendar_Month(InvoiceDate__c)]){
    invoices.put(obj.Account__r.OwnerId,obj.Amount__c);
}
Hello,

I am having issue getting 100% code coverage on the following function:

@AuraEnabled
    public static string grabDetails(){
        User toReturn = [SELECT Id, ContactId,FirstName, LastName FROM User WHERE Id = :UserInfo.getUserId() LIMIT 1];
        Contact communityContact = [Select id,AccountId from contact where id = :toReturn.ContactId];
        // DML operation to save account Details
        Account a = [Select id,name,phone,website,billingStreet,billingCity,billingState,billingpostalcode,billingcountry,FEIN__c,
                     BusinessOrganization__c, progress__c from Account where id =:communityContact.AccountId];
        
        // DML operation to save account Details
        AttachmentStatus ss = new AttachmentStatus();
        
        try
        {
            List<attachment> attchs =[SELECT name FROM Attachment WHERE ParentID=: a.id]; 
            
            for(Attachment at : attchs)
            {
                if(at.name.contains('Contract'))
                {
                    ss.doesRequired1Exist = true;
                    ss.attachment1 = at.name;
                }
                else  if(at.name.contains('Liability'))
                {
                    ss.doesRequired2Exist = true;
                    ss.attachment2 = at.name;
                }
                
            }
            ss.SetDefaults();
        }
        catch(exception e){}
        
        ss.CustomerAccount = a;
        System.debug(a);
        return JSON.serializePretty(ss);
        
    }

Here is my test class thus far:

static testmethod void grabDetailsTest()
    {
        Profile p=[select id from profile where name='Contracting Owner'];
        User toReturn = new User(alias='test123', email='test123@noemail.com',
            emailencodingkey='UTF-8', lastname='Testing', languagelocalekey='en_US',
            localesidkey='en_US', profileid = p.Id, country='United States',
            timezonesidkey='America/Los_Angeles', username='test123@noemail.com');
        
        Contact c= new Contact(LastName='Test');
        
        String pdfContent = 'This is a test string';
        Account a = new Account(Name='Contract',billingStreet='123 Test Street',billingCity='Springfield',billingpostalcode='12345',billingcountry='US',FEIN__c='123456');
        insert a;
               
        
           Attachment attachmentPDF = new Attachment();
        attachmentPdf.parentId = a.id;
        attachmentPdf.name = a.name + '.pdf';
        attachmentPdf.body = blob.toPDF(pdfContent);
        insert attachmentPDF;
        
        test.startTest();
        
        SaveUpdateAccountDetails.grabDetails();
        
        test.stopTest();
    }

I would really appreciate any help that can be provided on this, thank you in advance.
Hi there, I am new to apex and hoping someone can point me in the right direction with my test class, it shows coverage for the 'insert' but not for the return portion.  Can someone tell me what more I need to add?

Here is my function:

public static id SaveUpdateAccountProfileFormDetails(Account accountForm ){
         
        insert accountForm;
        return accountForm.id;

My test class so far:

static testmethod void SaveUpdateAccountProfileFormDetailsTest()
    {
        Account accountForm = new Account(Name='TestAccount',billingStreet='123 Test Street',billingCity='Springfield',billingpostalcode='12345',billingcountry='US',FEIN__c='123456',BusinessOrganization__c='LLC');
        
        test.startTest();
        
                SaveUpdateAccountDetails.SaveUpdateAccountProfileFormDetails(accountForm);
        
        
        test.stopTest();
    }

Thank you in advance for any assistance you can provide!
I have 2 lightning components, the first is a simple search screen with 1 field for data entry, then a button 'Advanced Search' when this button is clicked I want to open a second lightning component that lists more detailed input screens to filter down the search.  How can I open the second component when I click the button.  Here is the code I have so far that is not working:

Component 1:

<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" >

<aura:attribute name="custSearch" type="String" default=""/>


<lightning:input label="Name, Phone Number, Email" name="custSearch" value= "{!v.custSearch}" />

<lightning:button label="Advanced Search" onclick="{!c.CustomerAdvSearch}"></lightning:button>

</aura:component>

Cmp 1 Controller:

({
    CustomerAdvSearch : function(cmp, evt, hlpr) {
        console.log('Enter Here');
        var evt = $A.get("e.force:navigateToComponent");
        console.log('Event '+evt);
        var accountFromId = component.get("v.recordId");
        evt.setParams({
            componentDef  : "c:CustomerAdvSearch" ,
            componentAttributes : {
               
            }
        

        });
      
        evt.fire();
    }      
})


Component 2:

<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" >

    <!-- Attributes -->
    <aura:attribute name="lastName" type="String" default=""/>
    <aura:attribute name="firstName" type="String" default=""/>
    <aura:attribute name="eMail" type="String" default=""/>
    <aura:attribute name="phone" type="String" default=""/>
    <aura:attribute name="streetAddress" type="String" default=""/>
    <aura:attribute name="zipCode" type="String" default=""/>
    <aura:attribute name="cctype" type="String[]" default=" MMC, PLC" />
    <aura:attribute name="fourDigits" type="String" default=""/>
    <aura:attribute name="primeStr" type="String[]" default=" 1, 2" />
    <aura:attribute name="crdNumber" type="String[]" default=" 1, 2" />
    
    <lightning:input label="Last Name" name="LastName" value= "{!v.lastName}" />
    <lightning:input label="First Name" name="FirstName" value= "{!v.firstName}" />
    <lightning:input label="Email" name="Email" value= "{!v.eMail}" />
    <lightning:input label="Phone" name="Phone" value= "{!v.phone}" />
    <lightning:input label="Street Address" name="StreetAddress" value= "{!v.streetAddress}" />
    <lightning:input label="Zip Code" name="ZipCode" value= "{!v.zipCode}" />
    <lightning:select label="CC Type ?" name="Cctype" value="{!v.cctype}">
        <aura:iteration items="{!v.cctype}" var="cct">
            <option value="{!cct}" text="{!cct}" />
        </aura:iteration>
    </lightning:select>    
    <lightning:input label="Last Four" name="FourDigits" value= "{!v.fourDigits}" />
    <lightning:input label="Primary" name="PrimeStr" value= "{!v.primeStr}" />
    <lightning:input label="Card Number" name="CrdNumber" value= "{!v.crdNumber}" />        
    <lightning:button label="Advanced Search" onclick="{!c.CustomerAdvSearch}"></lightning:button>
    
</aura:component>

Thank you in advance for any help that can be provided!
Can you tell me how I would then make Tab 1-4 SubField1 - SubField 12 and SubField2-1 - 2-2 bold in the following code?

<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" >
 <lightning:tabset selectedTabId="{!v.selTabId}" >
        
        <lightning:tab label="Tab 1" id="1">
            <div class="c-container">
        <lightning:layout >
            <lightning:layoutItem padding="around-small">
                <div class="header-column">
                    <div class="slds-text-heading_medium">
                        <p class="field-title" title="SubField1">SubField1</p>
                    </div>    
                        <p>Data</p>
                </div>
                <br/>
            </lightning:layoutItem>
            <lightning:layoutItem padding="around-small">
                <div class="header-column">
                    <p class="field-title" title="SubField2">SubField2</p>
                    <p>*Other</p>
                </div>
                <br/>
                <div class="header-column">
                    <p class="field-title" title="SubField3">SubField3</p>
                    <p>N/A</p>
                </div>
                <br/>
                <div class="header-column">
                    <p class="field-title" title="SubField4">SubField4</p>
                    <p>No</p>
                </div>
                <br/>
                <div class="header-column">
                    <p class="field-title" title="SubField5">SubField5</p>
                    <p>N/A</p>
                </div>
                
            </lightning:layoutItem>
            <lightning:layoutItem padding="around-small">
                <div class="header-column">
                    <p class="field-title" title="SubField6">SubField6</p>
                    <p>No</p>
                </div>
                <br/>
                <div class="header-column">
                    <p class="field-title" title="Gluten-Free">Gluten-Free</p>
                    <p>No</p>
                </div>
                <br/>
                <div class="header-column">
                    <p class="field-title" title="SubField7">SubField7</p>
                    <p>Yes</p>
                </div>
                <br/>
                <div class="header-column">
                    <p class="field-title" title="SubField8">SubField8</p>
                    <p>No</p>
                </div>
                <br/>
            </lightning:layoutItem>
            <lightning:layoutItem padding="around-small">
                <div class="header-column">
                    <p class="field-title" title="SubField9">SubField9</p>
                    <p>No</p>
                </div>
                <br/>
                <div class="header-column">
                    <p class="field-title" title="SubField10">SubField10</p>
                    <p>Aisle 0</p>
                </div>
                <br/>
                <div class="header-column">
                    <p class="field-title" title="SubField11">SubField11</p>
                    <p>Yes</p>
                </div>
                <br/>
                <div class="header-column">
                    <p class="field-title" title="SubField12">SubField12</p>
                    <p>No</p>
                </div>
                <br/>
            </lightning:layoutItem>
            <lightning:layoutItem padding="around-small">
                <div class="header-column">
                    <p class="field-title" title="SubField13">SubField13</p>
                    <p>No</p>
                </div>
            </lightning:layoutItem>
        </lightning:layout>
    </div>      
    
        </lightning:tab>
        
        <lightning:tab label="Tab2" id="2">
            <lightning:layout >
            <lightning:layoutItem padding="around-small">
                <div class="slds-panel slds-size_medium slds-panel_docked slds-is-open slds-size--7-of-8" aria-hidden="false">
                    <table class="slds-table slds-table_cell-buffer slds-no-row-hover slds-table_bordered">
                       <thead>
                      <tr class="slds-line-height_reset">
                          <th class="" scope="col">
                            <div class="slds-truncate" title="SubField2-1">SubField2-1</div>
                          </th>
                          <th class="" scope="col">
                            <div class="slds-truncate" title="SubField2-2">SubField2-2</div>
                          </th>
                      </tr>
                       </thead>
                <br/><br/>            
            </table>
            </div>
            </lightning:layoutItem>
            </lightning:layout> 
        </lightning:tab>
        
        <lightning:tab label="Tab3" id="3">
           
        </lightning:tab>
        
        <lightning:tab label="Tab4" id="4">
           
        </lightning:tab>
   
    </lightning:tabset>    
</aura:component>

I tried this for my CSS:

.THIS.slds-text-heading--large 
    {
        font-weight:bold;
    }
.THIS.header-column
    {
        font-weight:bold;
    }
.THIS.slds-truncate
    {
        font-weight:bold;
    }
Hi new to coding, I have built the following page and cannot figure out how to make the Heading, SubHeading display bold.  Here is my component and style sheet that are not working:

<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" >
    
    <aura:attribute name="selTabId" type="string" default="1" />
    <aura:attribute name="PageHeading" type="String" default="Store 158 - A2 Reduced Fat 2% Milk"/>
    <aura:attribute name="PageSubHeading" type="String" default="Product Images"/>
    
    
    <div class="slds-text-heading--large">{!v.PageHeading}</div>
    <br/><br/>
    <div class="slds-text-heading--large ">{!v.PageSubHeading}</div>
    <br/><br/>

</aura:component>

Here is my CSS:

.THIS .slds-text-heading--large {
     font-weight: bold;
    }

I greatly appreciate any help that can be provided.
I have entered dates 11/10/2018 to 21/10/2018 and reserved 15 seats in a webinar, there are a total of 20 seats available in the webinar each day.  Now if I save another reservation for 20 seats is entered for 12/10/2018 to 24/10/2018   I want to know how to check the dates between two dates and total seats available.  Can anyone help?
Hello,

I am trying to write a test class for a custom JIT controller.

Controller:

global class SSOUserHandler implements Auth.SamlJitHandler {
    
    public string result {get; set;}
    public string debug {get; set;}
    public list<string> emails = new list<string>{'llinnemeier@innovateteam.com'};
 
    //JIT Handler Exception
    private class JitException extends Exception {}
 
    //Handle User
    private void handleUser(boolean create, User u, Map < String, String > attributes, 
        String federationIdentifier, boolean isStandard) {
        system.debug('manual class');
        system.debug('federationIdentifier '+federationIdentifier);
        system.debug('user fed id '+attributes.get('User.FederationIdentifier'));
        if (create && attributes.containsKey('User.FederationIdentifier') && attributes.get('User.FederationIdentifier') != null) {
            u.FederationIdentifier = attributes.get('User.FederationIdentifier');
            federationIdentifier = attributes.get('User.FederationIdentifier');
        }
        else {
            u.FederationIdentifier = federationIdentifier;
        }
        Profile p;
        if (attributes.containsKey('User.ProfileId')) {
            String profileId = attributes.get('User.ProfileId');
            if(profileId != null && profileId != '') {
                p = [SELECT Id FROM Profile WHERE Id =: profileId];
            }
            system.debug('profile1: '+p);
        }
        if(p == null) {
            p = [SELECT Id FROM Profile WHERE Name =: 'Support Community Login User'];
        }
        system.debug('profile2: '+p);
        u.ProfileId = p.Id;
            
        Contact c = [Select ID, Email, FirstName, LastName from Contact where Campus_ID__c =:federationIdentifier];
        if(c != null) {
            u.ContactId = c.Id;
        }
        if (attributes.containsKey('User.FirstName')) {
            u.FirstName = attributes.get('User.FirstName');
        } else if (create) {
            u.FirstName = c.FirstName;
        }
        if (attributes.containsKey('LastName')) {
            u.FirstName = attributes.get('LastName');
        } else if (create) {
            u.LastName = c.LastName;
        }
        if(attributes.containsKey('User.Email')) {
            u.Email = attributes.get('User.Email');
        } else if (create) {
            u.Email = c.Email+'.temp';
        }
        if (attributes.containsKey('UserName')) {
            u.UserName = attributes.get('UserName');
        } else if (create) {
            u.UserName = c.Email;
        }
        if (attributes.containsKey('User.CommunityNickname')) {
            u.CommunityNickname = attributes.get('User.CommunityNickname');
        }
        if (attributes.containsKey('User.IsActive')) {
            String IsActiveVal = attributes.get('User.IsActive');
            u.IsActive = '1'.equals(IsActiveVal) || Boolean.valueOf(IsActiveVal);
        }
        String uid = UserInfo.getUserId();
        User currentUser = [SELECT LocaleSidKey, LanguageLocaleKey, TimeZoneSidKey, EmailEncodingKey FROM User WHERE Id =: uid];
        if (attributes.containsKey('User.LocaleSidKey')) {
            u.LocaleSidKey = attributes.get('User.LocaleSidKey');
        } else if (create) {
            u.LocaleSidKey = currentUser.LocaleSidKey;
        }
        if (attributes.containsKey('User.LanguageLocaleKey')) {
            u.LanguageLocaleKey = attributes.get('User.LanguageLocaleKey');
        } else if (create) {
            u.LanguageLocaleKey = currentUser.LanguageLocaleKey;
        }
        if (attributes.containsKey('User.Alias')) {
            u.Alias = attributes.get('User.Alias');
        } else if (create) {
            String alias = '';
            if (u.FirstName == null) {
                alias = u.LastName;
            } else {
                alias = u.FirstName.charAt(0) + u.LastName;
            }
            if (alias.length() > 5) {
                alias = alias.substring(0, 5);
            }
            u.Alias = alias;
        }
        if (attributes.containsKey('User.TimeZoneSidKey')) {
            u.TimeZoneSidKey = attributes.get('User.TimeZoneSidKey');
        } else if (create) {
            u.TimeZoneSidKey = currentUser.TimeZoneSidKey;
        }
        if (attributes.containsKey('User.EmailEncodingKey')) {
            u.EmailEncodingKey = attributes.get('User.EmailEncodingKey');
        } else if (create) {
            u.EmailEncodingKey = currentUser.EmailEncodingKey;
        }
 
        try { 
            if (!create) {
                update(u);
                } 
            else {
                Insert u;
                }
                system.debug('success ' + u);
                result = 'Success';
                system.debug('result ' + result + ' ' + debug);
        }
        catch(Exception e) {
            result = 'Failure';
            debug += ' User record not inserted';
            system.debug('result ' + result + ' ' + debug + ' ' + e);
            Messaging.SingleEmailMessage email1 = new Messaging.SingleEmailMessage();
            email1.setToAddresses(emails);
            email1.setSubject('Error in JIT Provisioning failed to insert');
            email1.setHtmlBody('Debug: <br/>' + debug + ' <br/> u.federationIdentifier: ' + federationIdentifier + e.getMessage());
            Messaging.sendEmail(new Messaging.Email[]{email1});
        }
    }
    
//Handle JIT
    private void handleJit(boolean create, User u, Id samlSsoProviderId, Id communityId, Id portalId, 
        String federationIdentifier, Map < String, String > attributes, String assertion) {
        if (communityId != null || portalId != null) {
            handleUser(create, u, attributes, federationIdentifier, false);
        } else {
            handleUser(create, u, attributes, federationIdentifier, true);
        }
    }
 
    //For New Users
    global User createUser(Id samlSsoProviderId, Id communityId, Id portalId, 
        String federationIdentifier, Map < String, String > attributes, String assertion) {
        User u = new User();
        handleJit(true, u, samlSsoProviderId, communityId, portalId, federationIdentifier, attributes, assertion);
        return u;
    }
 
    //For Existing Users
    global void updateUser(Id userId, Id samlSsoProviderId, Id communityId, Id portalId,
        String federationIdentifier, Map < String, String > attributes, String assertion) {
        User u = [SELECT Id, FirstName, ContactId FROM User WHERE Id =: userId];
        handleJit(false, u, samlSsoProviderId, communityId, portalId, federationIdentifier, attributes, assertion);
    }
}

Any help or comments would be greatly appreciated.

Thank you
I am trying to set up JIT provisioning, I have SSO set up and functioning properly, the SAML Assertion I receive from the IDP contains the FederationID in the subject, so I have written the following code to search for a contact that has the FederationID in the subject populated in a custom field Campus_id__c, but when I attempt to log in with a test ID a new user account is not being created, can anyone assist?  I really appreciate any help that can be provided.

My Code:

global class SSOUserHandler implements Auth.SamlJitHandler {
 
    //JIT Handler Exception
    private class JitException extends Exception {}
 
    //Handle User
    private void handleUser(boolean create, User u, Map < String, String > attributes, 
        String federationIdentifier, boolean isStandard) {
        if (create && attributes.containsKey('User.FederationIdentifier')) {
            u.FederationIdentifier = attributes.get('User.FederationIdentifier');
        }
        
        if (attributes.containsKey('User.ProfileId')) {
            String profileId = attributes.get('User.ProfileId');
            Profile p = [SELECT Id FROM Profile WHERE Id =: profileId];
            u.ProfileId = p.Id;
        }
            
        Contact c = [Select ID, Email, FirstName, LastName from Contact where Campus_ID__c =:federationIdentifier];
        if (attributes.containsKey('User.FirstName')) {
            u.FirstName = attributes.get('User.FirstName');
        } else if (create) {
            u.FirstName = c.FirstName;
        }
        if (attributes.containsKey('LastName')) {
            u.FirstName = attributes.get('LastName');
        } else if (create) {
            u.LastName = c.LastName;
        }
        if(attributes.containsKey('User.Email')) {
            u.Email = attributes.get('User.Email');
        } else if (create) {
            u.Email = c.Email;
        }
        if (attributes.containsKey('UserName')) {
            u.UserName = attributes.get('UserName');
        } else if (create) {
            u.UserName = c.Email;
        }
        if (attributes.containsKey('User.CommunityNickname')) {
            u.CommunityNickname = attributes.get('User.CommunityNickname');
        }
        if (attributes.containsKey('User.IsActive')) {
            String IsActiveVal = attributes.get('User.IsActive');
            u.IsActive = '1'.equals(IsActiveVal) || Boolean.valueOf(IsActiveVal);
        }
        String uid = UserInfo.getUserId();
        User currentUser = [SELECT LocaleSidKey, LanguageLocaleKey, TimeZoneSidKey, EmailEncodingKey FROM User WHERE Id =: uid];
        if (attributes.containsKey('User.LocaleSidKey')) {
            u.LocaleSidKey = attributes.get('User.LocaleSidKey');
        } else if (create) {
            u.LocaleSidKey = currentUser.LocaleSidKey;
        }
        if (attributes.containsKey('User.LanguageLocaleKey')) {
            u.LanguageLocaleKey = attributes.get('User.LanguageLocaleKey');
        } else if (create) {
            u.LanguageLocaleKey = currentUser.LanguageLocaleKey;
        }
        if (attributes.containsKey('User.Alias')) {
            u.Alias = attributes.get('User.Alias');
        } else if (create) {
            String alias = '';
            if (u.FirstName == null) {
                alias = u.LastName;
            } else {
                alias = u.FirstName.charAt(0) + u.LastName;
            }
            if (alias.length() > 5) {
                alias = alias.substring(0, 5);
            }
            u.Alias = alias;
        }
        if (attributes.containsKey('User.TimeZoneSidKey')) {
            u.TimeZoneSidKey = attributes.get('User.TimeZoneSidKey');
        } else if (create) {
            u.TimeZoneSidKey = currentUser.TimeZoneSidKey;
        }
        if (attributes.containsKey('User.EmailEncodingKey')) {
            u.EmailEncodingKey = attributes.get('User.EmailEncodingKey');
        } else if (create) {
            u.EmailEncodingKey = currentUser.EmailEncodingKey;
        }
 
        if (!create) {
            update(u);
        } else {
            Insert u;
        }
    }
    
//Handle JIT
    private void handleJit(boolean create, User u, Id samlSsoProviderId, Id communityId, Id portalId, 
        String federationIdentifier, Map < String, String > attributes, String assertion) {
        if (communityId != null || portalId != null) {
            handleUser(create, u, attributes, federationIdentifier, false);
        } else {
            handleUser(create, u, attributes, federationIdentifier, true);
        }
    }
 
    //For New User
    global User createUser(Id samlSsoProviderId, Id communityId, Id portalId, 
        String federationIdentifier, Map < String, String > attributes, String assertion) {
        User u = new User();
        handleJit(true, u, samlSsoProviderId, communityId, portalId, federationIdentifier, attributes, assertion);
        return u;
    }
 
    //For Existing User
    global void updateUser(Id userId, Id samlSsoProviderId, Id communityId, Id portalId,
        String federationIdentifier, Map < String, String > attributes, String assertion) {
        User u = [SELECT Id, FirstName, ContactId FROM User WHERE Id =: userId];
        handleJit(false, u, samlSsoProviderId, communityId, portalId, federationIdentifier, attributes, assertion);
    }
}
Dear Community,

I have created a lightning component that contains a lookup field, when an option is chosen the magnifying glass icon and "X" in the right hand side of the result field display over the top of each other.  Does anyone know of a way to not display the magnifying glass when an option is chosen, or maybe dynamically size the results?
User-added image

Any assistance is greatly appreciated!
Hello Friends,

I am getting an error trying to compile my class that I am hoping someone can assist with.  My requirement is to check a box on the Case object when an attachment is added to the case.  I  am getting the message 'Method does not exist or incorrect signature: void startswith(String) from type Id" . 

Any assistance would be greatly appreciated.  Here's my code:

trigger AttachmentPresent on Attachment (after insert) {
    Set<Id> caseIds = new Set<Id>();
    for(Attachment att : Trigger.New) {
        //Check if added attachment is related to Case or not
        if(att.ParentID.startswith('500')) {
            caseIds.add(att.ParentId);
        }
    }
    if(!caseIds.isEmpty()) {
        CaseHandler.attachmentAdded(caseIds);
    }
}

And Class:

public with sharing class CaseHandler {

    public static void attachmentAdded(Set<Id> caseIds) {
        List<Case> updateCases = new List<Case>();
        List<Case> caseList = [SELECT Id, has_Attachment__c FROM Case WHERE Id IN: caseIds];
        for(Case myCase : caseList) {
            if(!myCase.has_Attachment__c) {
                myCase.has_Attachment__c = true;
                updateCases.add(myCase);
            }
        }
        if(!updateCases.isEmpty()) {
            update caseList;
        }
    }
}
Hi All,
Not sure if this is even possible but here we go...
I have 2 custom objects 'History' and 'Data' that are both children of the Contact object.  Is there a way that I can display 'History' as a related list on the page layout for a record in the 'Data' object if both are children of the same contact record?  There can be more than one 'History' record and more than one 'Data' but they are always tied back to the parent Contact.  I would really appreciate any ideas/help anyone can suggest?
Hello All, 
I am working on an LWC that ultimately should display 1 field from  custom metadata records (Call Script Layout) that I created.  In the process of figuring everything out.  In my apex controller I query to build a map<String, Object>, key is MasterLabel, then all the fields in the mdt object.  I get it pulled into my lwc successfully and filtered down to the 1 record that I was to display 1 time.  Issue I have is it is being displayed 214 times (this is the # of metadata records there are total).  While working through this I was filtering in the HTML, but when I attempt to remove the for:each and display just the one record, it breaks.  I've tried changing the variables in map to Map<String,String> but get error that the field in the second string cannot be found. 

My Apex Controller:

@AuraEnabled(cacheable=true)
public static Map<String, SObject> fetchQuestionMap() {
Map<String, Call_Script_Layout__mdt> questionMap = new Map<String, Call_Script_Layout__mdt>();
for(Call_Script_Layout__mdt csl : [SELECT Id, MasterLabel, Section__c, Question__c, Order__c FROM Call_Script_Layout__mdt ORDER BY Section__c])
questionMap.put(csl.MasterLabel, csl);
return questionMap;
}

LWC: I am calling multiple child LWC's that are not in this code:

HTML:
<template>
<template for:each={mapData} for:item="mapKey">
<c-call-script-_-coverage key = {mapKey.key} question = {mapKey.value}></c-call-script-_-coverage>
</template>
</template>

JS:

import { LightningElement, api, wire, track} from 'lwc';
import { getRecord } from 'lightning/uiRecordApi';
import fetchQuestionMap from '@salesforce/apex/callScript_CustomMetadataController.fetchQuestionMap';
const FIELDS = [
'Lead.Name',
];
export default class CallScript_FetchQuestion extends LightningElement {
@api
recordId;
@wire(getRecord, { recordId: '$recordId', fields: FIELDS })
lead;
@track mapData = [];
// Filter down to be a single question
@wire(fetchQuestionMap) wiredResult(result){
if (result.data) {
var conts = result.data;
for(var key in conts){
if(key ='CoverageType'){
this.mapData.push({value:conts[key], key:key});
}
}
}
}
}

meta file:
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>55.0</apiVersion>
<isExposed>true</isExposed>
<targets>
<target>lightning__AppPage</target>
<target>lightning__RecordPage</target>
<target>lightning__HomePage</target>
</targets>
</LightningComponentBundle>

I would really appreciate it if someone can tell me how I can get just 1 instance of the metadata record to display?
 
I am creating a custom lightning component to create an Account record and am wanting to make the field 'Description' taller.  Images below will explain better what I am wanting to do.  I want the input section of the field to be taller like this:

User-added image
Instead of what I currently have:

User-added image
I have been googling trying to figure out how to do this and apparenlty am not entering the correct key words to find a solution. 

Here is the section of code for this portion of the screen:

<lightning:layout pullToBoundary="medium">
        <lightning:layoutItem size="10" smallDeviceSize="5" mediumDeviceSize="5"  padding="around-small">
            <lightning:input label="Description" name="Description" value="{!v.AcctForm.Description}"/>       
        </lightning:layoutItem>
        <lightning:layoutItem size="10" smallDeviceSize="5" mediumDeviceSize="5"  padding="around-small">
            <lightning:input label="Region" name="Region" value="{!v.AcctForm.Region__c }" />       
        </lightning:layoutItem>
    </lightning:layout>

Would greatly appreciate any help that can be provided!
I have a batch apex job that basically goes through all invoices and totals the amounts for each sales person for each month and year.  The job works as expected in the sandbox environment with the test data I created.  But when I moved the job to production, it runs without errors, but does not update the fields with the monthly invoice sum totals like it does in sandbox.  In reviewing the logs I found one for example that found totals and shows that it updated the fields for the months.  Then in the very next log that did not find any invoices with totals, it updated the fields with null values for the very same records as in the prior log.  The Forecast and Forecast detail objects were created from scratch for this batch job and have no other triggers or processes running against them to udpate any fields.  My code is below, can anyone see why it is not updating the sum fields properly?

global with sharing class Forecast_Batch implements Database.Batchable<sObject>, Database.Stateful{

        global Database.QueryLocator start(Database.BatchableContext BC)
        {
            return Database.getQueryLocator([SELECT Id,OwnerId FROM Account]); //Query all accounts for ID and OwnerId
        }

    global void execute(Database.BatchableContext BC, List<SObject> scope)
    {        
        Map<Id, Map<String,Decimal>> accountAmountMap = new Map<Id,Map<String,Decimal>>();

        List<Id> accountOwnerIds = new List<Id>();
        Set<Id> accountIds = new Set<Id>();
        
        system.debug('+++ SCOPE SIZE ' + scope.size());
        
        for (SObject s : scope) {
            
            Account acc = (Account)s;
            if(!accountIds.contains(acc.Id)){
                accountIds.add(acc.Id);
            }
            
        }
        
        for (Account acc : [SELECT OwnerId,(SELECT Amount__c,InvoiceDate__c,OwnerDetails__c,Inv_Yr__c FROM Invoice__r ) FROM Account WHERE Id in : accountIds]) {
            
            Map<String, Decimal> amountMap = new Map<String, Decimal>();
            
            for (Invoice__c inv : acc.Invoice__r) {
                 
                Decimal amount = amountMap.get(inv.OwnerDetails__c);
                if (amount != null) {
                    amountMap.put(inv.OwnerDetails__c, inv.Amount__c + amount); 
                } else {
                    amountMap.put(inv.OwnerDetails__c, inv.Amount__c); 
                }
            }
            accountAmountMap.put(acc.Id, amountMap);
            accountOwnerIds.add(acc.OwnerID);
            
        }
        System.debug(accountOwnerIds);

         // Query list of forecast details record based on Account's owner Id

        List<Forecast_Details__c> forecastdetails = [SELECT ID,Name,Month_Total__c,OwnerID__c,FDOwnerDets__c from Forecast_Details__c where OwnerID__c IN : accountOwnerIds];

        // Iterate accounts in for loop
        // iterate forecast details record
        // get invoice amount based on account id and forcast month.
        // update in forecast detail record.

        for (SObject s : scope) {
            Account acc = (Account)s;
            Map<String, Decimal> amountMap = accountAmountMap.get(acc.Id);
            for (Forecast_Details__c forecastDet : forecastdetails) {
                if (forecastDet.OwnerID__c == acc.OwnerId)
                    
                {
                    Decimal amount  = amountMap.get(forecastDet.FDOwnerDets__c);  
                    forecastDet.Month_Total__c = amount;
                    System.debug('match');
                    System.debug(amount);
                }
            }
        }
        System.debug(forecastdetails);
        update forecastdetails;
    }  

    global void finish(Database.BatchableContext BC){}



I really appreciate any assistance that anyone can provide!
Hello,

I am having issue getting 100% code coverage on the following function:

@AuraEnabled
    public static string grabDetails(){
        User toReturn = [SELECT Id, ContactId,FirstName, LastName FROM User WHERE Id = :UserInfo.getUserId() LIMIT 1];
        Contact communityContact = [Select id,AccountId from contact where id = :toReturn.ContactId];
        // DML operation to save account Details
        Account a = [Select id,name,phone,website,billingStreet,billingCity,billingState,billingpostalcode,billingcountry,FEIN__c,
                     BusinessOrganization__c, progress__c from Account where id =:communityContact.AccountId];
        
        // DML operation to save account Details
        AttachmentStatus ss = new AttachmentStatus();
        
        try
        {
            List<attachment> attchs =[SELECT name FROM Attachment WHERE ParentID=: a.id]; 
            
            for(Attachment at : attchs)
            {
                if(at.name.contains('Contract'))
                {
                    ss.doesRequired1Exist = true;
                    ss.attachment1 = at.name;
                }
                else  if(at.name.contains('Liability'))
                {
                    ss.doesRequired2Exist = true;
                    ss.attachment2 = at.name;
                }
                
            }
            ss.SetDefaults();
        }
        catch(exception e){}
        
        ss.CustomerAccount = a;
        System.debug(a);
        return JSON.serializePretty(ss);
        
    }

Here is my test class thus far:

static testmethod void grabDetailsTest()
    {
        Profile p=[select id from profile where name='Contracting Owner'];
        User toReturn = new User(alias='test123', email='test123@noemail.com',
            emailencodingkey='UTF-8', lastname='Testing', languagelocalekey='en_US',
            localesidkey='en_US', profileid = p.Id, country='United States',
            timezonesidkey='America/Los_Angeles', username='test123@noemail.com');
        
        Contact c= new Contact(LastName='Test');
        
        String pdfContent = 'This is a test string';
        Account a = new Account(Name='Contract',billingStreet='123 Test Street',billingCity='Springfield',billingpostalcode='12345',billingcountry='US',FEIN__c='123456');
        insert a;
               
        
           Attachment attachmentPDF = new Attachment();
        attachmentPdf.parentId = a.id;
        attachmentPdf.name = a.name + '.pdf';
        attachmentPdf.body = blob.toPDF(pdfContent);
        insert attachmentPDF;
        
        test.startTest();
        
        SaveUpdateAccountDetails.grabDetails();
        
        test.stopTest();
    }

I would really appreciate any help that can be provided on this, thank you in advance.
Hi there, I am new to apex and hoping someone can point me in the right direction with my test class, it shows coverage for the 'insert' but not for the return portion.  Can someone tell me what more I need to add?

Here is my function:

public static id SaveUpdateAccountProfileFormDetails(Account accountForm ){
         
        insert accountForm;
        return accountForm.id;

My test class so far:

static testmethod void SaveUpdateAccountProfileFormDetailsTest()
    {
        Account accountForm = new Account(Name='TestAccount',billingStreet='123 Test Street',billingCity='Springfield',billingpostalcode='12345',billingcountry='US',FEIN__c='123456',BusinessOrganization__c='LLC');
        
        test.startTest();
        
                SaveUpdateAccountDetails.SaveUpdateAccountProfileFormDetails(accountForm);
        
        
        test.stopTest();
    }

Thank you in advance for any assistance you can provide!
I have 2 lightning components, the first is a simple search screen with 1 field for data entry, then a button 'Advanced Search' when this button is clicked I want to open a second lightning component that lists more detailed input screens to filter down the search.  How can I open the second component when I click the button.  Here is the code I have so far that is not working:

Component 1:

<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" >

<aura:attribute name="custSearch" type="String" default=""/>


<lightning:input label="Name, Phone Number, Email" name="custSearch" value= "{!v.custSearch}" />

<lightning:button label="Advanced Search" onclick="{!c.CustomerAdvSearch}"></lightning:button>

</aura:component>

Cmp 1 Controller:

({
    CustomerAdvSearch : function(cmp, evt, hlpr) {
        console.log('Enter Here');
        var evt = $A.get("e.force:navigateToComponent");
        console.log('Event '+evt);
        var accountFromId = component.get("v.recordId");
        evt.setParams({
            componentDef  : "c:CustomerAdvSearch" ,
            componentAttributes : {
               
            }
        

        });
      
        evt.fire();
    }      
})


Component 2:

<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" >

    <!-- Attributes -->
    <aura:attribute name="lastName" type="String" default=""/>
    <aura:attribute name="firstName" type="String" default=""/>
    <aura:attribute name="eMail" type="String" default=""/>
    <aura:attribute name="phone" type="String" default=""/>
    <aura:attribute name="streetAddress" type="String" default=""/>
    <aura:attribute name="zipCode" type="String" default=""/>
    <aura:attribute name="cctype" type="String[]" default=" MMC, PLC" />
    <aura:attribute name="fourDigits" type="String" default=""/>
    <aura:attribute name="primeStr" type="String[]" default=" 1, 2" />
    <aura:attribute name="crdNumber" type="String[]" default=" 1, 2" />
    
    <lightning:input label="Last Name" name="LastName" value= "{!v.lastName}" />
    <lightning:input label="First Name" name="FirstName" value= "{!v.firstName}" />
    <lightning:input label="Email" name="Email" value= "{!v.eMail}" />
    <lightning:input label="Phone" name="Phone" value= "{!v.phone}" />
    <lightning:input label="Street Address" name="StreetAddress" value= "{!v.streetAddress}" />
    <lightning:input label="Zip Code" name="ZipCode" value= "{!v.zipCode}" />
    <lightning:select label="CC Type ?" name="Cctype" value="{!v.cctype}">
        <aura:iteration items="{!v.cctype}" var="cct">
            <option value="{!cct}" text="{!cct}" />
        </aura:iteration>
    </lightning:select>    
    <lightning:input label="Last Four" name="FourDigits" value= "{!v.fourDigits}" />
    <lightning:input label="Primary" name="PrimeStr" value= "{!v.primeStr}" />
    <lightning:input label="Card Number" name="CrdNumber" value= "{!v.crdNumber}" />        
    <lightning:button label="Advanced Search" onclick="{!c.CustomerAdvSearch}"></lightning:button>
    
</aura:component>

Thank you in advance for any help that can be provided!
Hi new to coding, I have built the following page and cannot figure out how to make the Heading, SubHeading display bold.  Here is my component and style sheet that are not working:

<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" >
    
    <aura:attribute name="selTabId" type="string" default="1" />
    <aura:attribute name="PageHeading" type="String" default="Store 158 - A2 Reduced Fat 2% Milk"/>
    <aura:attribute name="PageSubHeading" type="String" default="Product Images"/>
    
    
    <div class="slds-text-heading--large">{!v.PageHeading}</div>
    <br/><br/>
    <div class="slds-text-heading--large ">{!v.PageSubHeading}</div>
    <br/><br/>

</aura:component>

Here is my CSS:

.THIS .slds-text-heading--large {
     font-weight: bold;
    }

I greatly appreciate any help that can be provided.
I am trying to set up JIT provisioning, I have SSO set up and functioning properly, the SAML Assertion I receive from the IDP contains the FederationID in the subject, so I have written the following code to search for a contact that has the FederationID in the subject populated in a custom field Campus_id__c, but when I attempt to log in with a test ID a new user account is not being created, can anyone assist?  I really appreciate any help that can be provided.

My Code:

global class SSOUserHandler implements Auth.SamlJitHandler {
 
    //JIT Handler Exception
    private class JitException extends Exception {}
 
    //Handle User
    private void handleUser(boolean create, User u, Map < String, String > attributes, 
        String federationIdentifier, boolean isStandard) {
        if (create && attributes.containsKey('User.FederationIdentifier')) {
            u.FederationIdentifier = attributes.get('User.FederationIdentifier');
        }
        
        if (attributes.containsKey('User.ProfileId')) {
            String profileId = attributes.get('User.ProfileId');
            Profile p = [SELECT Id FROM Profile WHERE Id =: profileId];
            u.ProfileId = p.Id;
        }
            
        Contact c = [Select ID, Email, FirstName, LastName from Contact where Campus_ID__c =:federationIdentifier];
        if (attributes.containsKey('User.FirstName')) {
            u.FirstName = attributes.get('User.FirstName');
        } else if (create) {
            u.FirstName = c.FirstName;
        }
        if (attributes.containsKey('LastName')) {
            u.FirstName = attributes.get('LastName');
        } else if (create) {
            u.LastName = c.LastName;
        }
        if(attributes.containsKey('User.Email')) {
            u.Email = attributes.get('User.Email');
        } else if (create) {
            u.Email = c.Email;
        }
        if (attributes.containsKey('UserName')) {
            u.UserName = attributes.get('UserName');
        } else if (create) {
            u.UserName = c.Email;
        }
        if (attributes.containsKey('User.CommunityNickname')) {
            u.CommunityNickname = attributes.get('User.CommunityNickname');
        }
        if (attributes.containsKey('User.IsActive')) {
            String IsActiveVal = attributes.get('User.IsActive');
            u.IsActive = '1'.equals(IsActiveVal) || Boolean.valueOf(IsActiveVal);
        }
        String uid = UserInfo.getUserId();
        User currentUser = [SELECT LocaleSidKey, LanguageLocaleKey, TimeZoneSidKey, EmailEncodingKey FROM User WHERE Id =: uid];
        if (attributes.containsKey('User.LocaleSidKey')) {
            u.LocaleSidKey = attributes.get('User.LocaleSidKey');
        } else if (create) {
            u.LocaleSidKey = currentUser.LocaleSidKey;
        }
        if (attributes.containsKey('User.LanguageLocaleKey')) {
            u.LanguageLocaleKey = attributes.get('User.LanguageLocaleKey');
        } else if (create) {
            u.LanguageLocaleKey = currentUser.LanguageLocaleKey;
        }
        if (attributes.containsKey('User.Alias')) {
            u.Alias = attributes.get('User.Alias');
        } else if (create) {
            String alias = '';
            if (u.FirstName == null) {
                alias = u.LastName;
            } else {
                alias = u.FirstName.charAt(0) + u.LastName;
            }
            if (alias.length() > 5) {
                alias = alias.substring(0, 5);
            }
            u.Alias = alias;
        }
        if (attributes.containsKey('User.TimeZoneSidKey')) {
            u.TimeZoneSidKey = attributes.get('User.TimeZoneSidKey');
        } else if (create) {
            u.TimeZoneSidKey = currentUser.TimeZoneSidKey;
        }
        if (attributes.containsKey('User.EmailEncodingKey')) {
            u.EmailEncodingKey = attributes.get('User.EmailEncodingKey');
        } else if (create) {
            u.EmailEncodingKey = currentUser.EmailEncodingKey;
        }
 
        if (!create) {
            update(u);
        } else {
            Insert u;
        }
    }
    
//Handle JIT
    private void handleJit(boolean create, User u, Id samlSsoProviderId, Id communityId, Id portalId, 
        String federationIdentifier, Map < String, String > attributes, String assertion) {
        if (communityId != null || portalId != null) {
            handleUser(create, u, attributes, federationIdentifier, false);
        } else {
            handleUser(create, u, attributes, federationIdentifier, true);
        }
    }
 
    //For New User
    global User createUser(Id samlSsoProviderId, Id communityId, Id portalId, 
        String federationIdentifier, Map < String, String > attributes, String assertion) {
        User u = new User();
        handleJit(true, u, samlSsoProviderId, communityId, portalId, federationIdentifier, attributes, assertion);
        return u;
    }
 
    //For Existing User
    global void updateUser(Id userId, Id samlSsoProviderId, Id communityId, Id portalId,
        String federationIdentifier, Map < String, String > attributes, String assertion) {
        User u = [SELECT Id, FirstName, ContactId FROM User WHERE Id =: userId];
        handleJit(false, u, samlSsoProviderId, communityId, portalId, federationIdentifier, attributes, assertion);
    }
}
Hello Friends,

I am getting an error trying to compile my class that I am hoping someone can assist with.  My requirement is to check a box on the Case object when an attachment is added to the case.  I  am getting the message 'Method does not exist or incorrect signature: void startswith(String) from type Id" . 

Any assistance would be greatly appreciated.  Here's my code:

trigger AttachmentPresent on Attachment (after insert) {
    Set<Id> caseIds = new Set<Id>();
    for(Attachment att : Trigger.New) {
        //Check if added attachment is related to Case or not
        if(att.ParentID.startswith('500')) {
            caseIds.add(att.ParentId);
        }
    }
    if(!caseIds.isEmpty()) {
        CaseHandler.attachmentAdded(caseIds);
    }
}

And Class:

public with sharing class CaseHandler {

    public static void attachmentAdded(Set<Id> caseIds) {
        List<Case> updateCases = new List<Case>();
        List<Case> caseList = [SELECT Id, has_Attachment__c FROM Case WHERE Id IN: caseIds];
        for(Case myCase : caseList) {
            if(!myCase.has_Attachment__c) {
                myCase.has_Attachment__c = true;
                updateCases.add(myCase);
            }
        }
        if(!updateCases.isEmpty()) {
            update caseList;
        }
    }
}
Hi All,
Not sure if this is even possible but here we go...
I have 2 custom objects 'History' and 'Data' that are both children of the Contact object.  Is there a way that I can display 'History' as a related list on the page layout for a record in the 'Data' object if both are children of the same contact record?  There can be more than one 'History' record and more than one 'Data' but they are always tied back to the parent Contact.  I would really appreciate any ideas/help anyone can suggest?

Hi I am new to SOQL and trying to write a query on the account object that will return a count of the number of records that have been edited in the last 7 days.

I tried this code but get error on compile Illegal assignment from integer to list

public with sharing class TestDisplayQueryList{ 
public List<Account> Records {get; set;} 
public TestDisplayQueryList(){ 
Records = 
[select count() from account where LastModifiedDate = LAST_N_DAYS:7]; 

}

Any help would be greatly appreciated!