• Beatrice Dick
  • NEWBIE
  • 0 Points
  • Member since 2021

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 2
    Replies
Hello All,

I have just tried my first lightning page, the page contains two text fields and one button. Once click on button account record should be create. After click on preview i can able to see the form but when i entered the data in the text box i am getting below error. Could you please help me on this.

User-added image

Please find the lightning code below:
 
<aura:component >
    <aura:attribute name="NewAccount" type="Account"/>
	<lightning:input label="AccountName" name="myname" required="true" value="{!v.NewAccount.Name}" />
    <lightning:input label="Fax" name="fax" required="true" value="{!v.NewAccount.fax}"/>
    <lightning:button variant="brand" label="Submit" onclick="{!c.createAccount}"/> 
</aura:component>


({
	myAction : function(component, event) {
	var newAcc = component.get("v.NewAccount");
    var action = component.get("c.createAccount");
    action.setParams({ 
        "acc": newAcc
    });	
      action.setCallback(this, function(a) {
           var state = a.getState();
            if (state === "SUCCESS") {
                var name = a.getReturnValue();
               alert("hello from here"+name);
            }
        });
    $A.enqueueAction(action)   
        
	}
})

Advance thanks,
VSK98​
  • February 27, 2018
  • Like
  • 0

Hi All,

 

I am trying to pull in the Account Owner's Name to a custom object using a formula. However just see an option for the Account Owner ID.

 

TIA

 

David