I was playing around with Lightning Trail Head Examples and couldn't figure out how to update a record. When I asked google Yoda master, master referred me here,to this post. I was able to replicate this for 'Account' but not for 'Lead'. I checked my console logs, I see there was an error related to loading script(console log error : because it violates the following Content Security Policy directive: "script-src 'self' chrome-extension: 'unsafe-inline' 'unsafe-eval' https://ssl.gstatic.com/accessibility/"). I'm not trying to load any scripts, I'm simply minding my business with Lead.

I followed each and every step as it is (basically copy pasted and changed it to Lead SObject, posting the code as well.) and I still get nothing. please shed some wisdom of light here.

I really appreciate you taking time to reply :)

my component

<aura:component controller="leadController" implements="forceCommunity:availableForAllPageTypes">
    <aura:handler name="init" value="{!this}" action="{!c.init}"/>
    <aura:attribute name="lead"  type="Lead" />
        <ui:inputText aura:id="client"
        <br />
        <ui:button class="form-control" aura:id="button" label="Save" press="{!c.save}"/>
        <br />
    <br />

my client- side controller:

    init : function(component, event, helper) {
        var action2 = component.get("c.getLead");        
        action2.setCallback(this, function(response) {
            component.set("v.lead", response.getReturnValue());
    save : function(component, event, helper) {
        var action = component.get("c.saveLead");
        var lead = component.get("v.lead");
            "lead": lead}
        action.setCallback(this, function() {  console.log('SAVED.');  } );

my apex controller :

public with sharing class leadController {

     public static Lead getLead(){
        return (Lead) Database.query( ' SELECT Name FROM Lead LIMIT 1 ' )[0];
    public static Lead saveLead(Lead lead){
        upsert lead;
        return lead;

1 Answer 1


The answer is in two parts to this question:

  1. I realized my company firewall stops some scrips while loading hence i get the error 'unsafe-eval' https://ssl.gstatic.com/accessibility/". So its just the company firewall.
  2. I found a workaround by following this post.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .