You need to sign in to do that
Don't have an account?
David Jordan 20
Issue with custom component for Lightning for Gmail not firing events
Hi,
I'm making a custom lighting component for showing the lightning for gmail widget, using this sample code
https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/components_custom_for_app_builder_email_app_pane.htm
In short, it queries a "global suppression" custom object for records which match the list of emails a user enters in a gmail compose email frame. If there is a match then it shows a "Do not email" warning.
It works great for the first email, but when the gmail user enter the 2nd and subsequent emails the component doesn't call the apex controller. Using chrome debugging tools, it appears that the 2nd event to call the component never fires. Here are code snippits from the component
From the component controller
Sceenshots from chrome network monitor attached. Note that the first email is found and the response is correct. The 2nd email on the list is not found in the network capture
Any suggestions would be very very welcome as I'm completely blocked by this :(
I'm making a custom lighting component for showing the lightning for gmail widget, using this sample code
https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/components_custom_for_app_builder_email_app_pane.htm
In short, it queries a "global suppression" custom object for records which match the list of emails a user enters in a gmail compose email frame. If there is a match then it shows a "Do not email" warning.
It works great for the first email, but when the gmail user enter the 2nd and subsequent emails the component doesn't call the apex controller. Using chrome debugging tools, it appears that the 2nd event to call the component never fires. Here are code snippits from the component
<aura:handler name="init" value="{!this}" action="{!c.handlePeopleChange}" /> <aura:attribute name="suppressions" type="List" /> <aura:iteration items="{!v.suppressions}" var="gs"> DO NOT EMAIL: {!gs.Email} <i>{!gs.Notes}</i> </aura:iteration>
From the component controller
handlePeopleChange: function(component, event, helper) { var people = component.get("v.people"); var peopleEmails = helper.filterEmails(people); var action = component.get("c.findSuppressions"); action.setParam("emails", peopleEmails); action.setCallback(this, function(response) { var state = response.getState(); if(state === "SUCCESS") {component.set("v.suppressions", response.getReturnValue());} else {component.set("v.suppressions",[]);} } ); // End setCallback $A.enqueueAction(action);Apex controller
@AuraEnabled public static List<Map<String, Object>> findSuppressions(List<String> emails) { List<Map<String, Object>> ret = new List<Map<String, Object>>(); for(Global_Suppression__c gs:[select id, email__c, Notes__c, Reason__c,Suppressed_Date__c from Global_Suppression__c where email__c in :emails]) { Map<String, Object> item = new Map<String, Object>(); item.put('Email', gs.email__c); item.put('Notes', gs.Notes__c); item.put('Reason', gs.Reason__c); item.put('DateSuppressed', gs.Suppressed_Date__c); ret.add(item); } System.debug('findSuppressions: emails '+emails+' and ret: '+ret); return ret; }
Sceenshots from chrome network monitor attached. Note that the first email is found and the response is correct. The 2nd email on the list is not found in the network capture
Any suggestions would be very very welcome as I'm completely blocked by this :(