You need to sign in to do that
Don't have an account?
adflint
Lightning Quick Action Error in Salesforce1
Hi All,
I'm trying to create a Lightning Component for a Global Quick Action in order to create a detail object "Billable__c" for a Master Object "Project__c".
I've got it working in Salesforce Lightning Experience, however I'm having issues using the global quick action in the Salesforce1 app. I'm getting the following error:
Here is my component:
Here is my Controller:
Apex Controller:
Any help is appreciated.
I'm trying to create a Lightning Component for a Global Quick Action in order to create a detail object "Billable__c" for a Master Object "Project__c".
I've got it working in Salesforce Lightning Experience, however I'm having issues using the global quick action in the Salesforce1 app. I'm getting the following error:
Error in $A.getCallback() [undefined is not an object (evaluating 'a.attributes')]
Callback failed: serviceComponent://ui.chatter.components.aura.components.forceChatter.chatter.QuickActionLoaderController/ACTION$getQuickActions
(https://stratusg.lightning.force.com/auraFW/javascript/xH6sVFQUmvLYLsBsK3q02Q/aura_prod.js:2)
Callback failed: serviceComponent://ui.chatter.components.aura.components.forceChatter.chatter.QuickActionLoaderController/ACTION$getQuickActions
(https://stratusg.lightning.force.com/auraFW/javascript/xH6sVFQUmvLYLsBsK3q02Q/aura_prod.js:2)
Here is my component:
<aura:component implements="force:lightningQuickActionWithoutHeader" controller="HoursController" access="GLOBAL"> <aura:attribute name="newBillable" type="Billable__c" default="{ 'sobjectType': 'Billable__c'}"/> <aura:attribute name="options" type="list" default="[{ 'class': 'optionClass', label: '- None -', value: '' }]"/> <aura:handler name="init" value="{!this}" action="{!c.doInit}" /> <div class="slds-page-header" role="banner"> <h1 class="slds-page-header__title slds-m-right--small slds-truncate slds-align-left">Log Hours</h1> </div> <label class="slds-form-element__label">Number of Hours</label> <force:inputField aura:id="hours" value="{!v.newBillable.Numer_of_Hours__c}" /> <lightning:select aura:id="project" name="project" label="Project" value="{!v.newBillable.Project__c}" required="true"> <aura:iteration items="{!v.options}" var="item" > <option text="{!item.label}" value="{!item.value}" selected="{!item.selected}"/> </aura:iteration> </lightning:select> <label class="slds-form-element__label">Date</label> <force:inputField aura:id="date" value="{!v.newBillable.Date__c}" /> <label class="slds-form-element__label">Description</label> <force:inputField aura:id="desc" value="{!v.newBillable.Description__c}" /> <lightning:button label="Save Billable" onclick="{!c.handleSaveBillable}" variant="brand" class="slds-m-top-medium"/> </aura:component>
Here is my Controller:
({ doInit : function (component, event, helper) { helper.loadProjects(component); }, handleSaveBillable : function(component, event, helper) { var newBillable = component.get("v.newBillable"); helper.upsertBillable(component, newBillable); } })Helper:
({ loadProjects : function(component) { var action = component.get("c.getProjects"); action.setCallback(this, function(response) { var state = response.getState(); if(state === "SUCCESS") { //component.set("v.projects", response.getReturnValue()); //var projects = component.get("v.projects"); var projects = response.getReturnValue(); var opts = new Array(); opts.push({value: "", label: "- None -"}); for(var i=0; i<projects.length; i++){ var p = projects[i]; console.log(p); opts.push({value: p.Id, label: p.Name}); } console.log(opts); component.set("v.options", opts); } else { console.log('Problem getting Projects, response state: '+state); } }); $A.enqueueAction(action); }, upsertBillable : function(component, billable) { var action = component.get("c.saveBillable"); action.setParams({ "billable": billable }); $A.enqueueAction(action); } })
Apex Controller:
public with sharing class HoursController { @AuraEnabled public static List<Project__c> getProjects(){ return [SELECT Id, Name FROM Project__c WHERE Status__c = 'Active']; } @auraEnabled public static Billable__c saveBillable(Billable__c billable){ upsert billable; return billable; } }
Any help is appreciated.
All Answers
Did you manage to solve this? I got the very same error and looking for a solution. do post if you get something.
Regards,
Nitish
I have not solved this. I will definitely post something if I find a solution. Does anyone know of any other forums or places to post this issue?
Regards,
Anthony