• Deepu B 5
  • NEWBIE
  • 0 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 2
    Replies
AccountFormAndList.cmp:
<aura:component controller="CampingListController">
    <aura:attribute name="cont" type="Account" />
    <lightning:layout >
        <lightning:layoutItem size="3">
        <form>
            <lightning:input name="conName" label="Name" aura:id="conForm" 
                                     value="{!v.cont.Name}" required="true" 
                                     messageWhenValueMissing="Name is required"
                                     placeholder="ACC Name"/>
            <lightning:button label="Create" onclick="{!c.clickCreate}" />
        </form>
        </lightning:layoutItem>
    </lightning:layout>
</aura:component>

Controller:
({
    clickCreate : function(component, event, helper) {
        var getCon=component.get("v.cont");
        var action=Component.get("c.saveContact");
        action.setParams({
            "con": getCon
        });
        action.setCallback(this,function(response){
         //  component.set("v.contacts",response.getReturnValue());
         var state=response.getState();
            if(state==="SUCCESS"){
                var name=a.getReturnValue();
                alert("Hello from here"+name);
            }
        });
        $A.enqueueAction(action);
    }
})

Apex Class:

@AuraEnabled
    public static Account saveContact(Account con){
        upsert con;
        return con;
    }


I am getting below error when we type any letters in the input text box;
User-added image

Help me in this.

Thanks
Srinivas
Hello!

Please, could you help me to write the test class for this code where I am using the SandboxPostCopy interface to modify an account field after refreshing a sandbox? I have tried by creating a test class that updates Account records but the code coverage is 0...
global class AfterSandboxRefresh implements SandboxPostCopy {
	global void runApexClass(SandboxContext context) {

	List<Account> listOfAccounts = new List<Account>();

	List<Account> accountsToUpdate = [SELECT Id, Email__c
									  FROM Account
									  WHERE Email__c != NULL AND Email__c Like '%_@__%.__%'];

	if(!accountsToUpdate.isEmpty()) { 
		For (Account acc : accountsToUpdate) {
			Email__c = Email__c + '.noemail';
			listOfAccounts.add(acc);            
		}
	Database.Update(listOfAccounts, false);
	}
	}
}

Thank you very much!
J