• Anthony Wheeler 1
  • NEWBIE
  • 30 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 2
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 3
    Replies
User-added image
Users have been reporting to me that the standard 'New' button on the 'Notes' related list on the lightning page displayed above will refresh the page whenever a checkbox in a custom component(circled above) I created is toggled by the user before clicking the 'New' button. I understand this is probably a niche issue or Salesforce glitch, but wanted to throw this out there and see if anyone had any solutions. The code for my custom component is really simple and displayed below

Markup
<aura:component controller="SF_Task_Email_Checkbox_Controller" implements="flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes" access="global" >
	
	<aura:attribute name="recordId" type="Id"/>
	<aura:attribute name="task" type="GNS_Task__c"/>
	
	<aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
	
	<aura:if isTrue="{!v.task != null}">
		<ui:inputCheckbox aura:id="fileCheckbox" label="Send File/Note Email To Case Owner: " value="{!v.task.Send_File_Notification__c}" change="{!c.boxChange}"/>
	</aura:if>
	
</aura:component>

Controller
({
	doInit : function(component, event, helper) {
		helper.getTaskInfo(component, event, helper);
	},
	
	boxChange : function(component, event, helper){
		helper.saveTask(component, event, helper);
	}
})

Helper
({
	getTaskInfo : function(component, event, helper) {
		var action = component.get("c.getTask");
		action.setParams({
			taskId : component.get("v.recordId")
		});
		action.setCallback(this, function(response){
			var state = response.getState();
			if(state === "SUCCESS"){
				component.set("v.task", response.getReturnValue());
			}
		});
		$A.enqueueAction(action);
	},
	
	saveTask : function(component, event, helper){
		var action = component.get("c.saveTask");
		action.setParams({
			task : component.get("v.task")
		});
		$A.enqueueAction(action);
	}
	
})

Apex
public without sharing class SF_Task_Email_Checkbox_Controller {

	@AuraEnabled
	public static GNS_Task__c getTask(Id taskId){
		return [SELECT Id, Send_File_Notification__c FROM GNS_Task__c WHERE Id = :taskId];
	}
	
	@AuraEnabled
	public static void saveTask(GNS_Task__c task){
		update task;
	}


}

​​​​​​​​​​​​​​​​​​​​​
<!-- Subscription Table -->
<div class="slds-scrollable_y" style="height: 30rem;">
	<table class="slds-table slds-table_bordered">
		<tbody>
			<aura:iteration items="{!v.subscriptions}" var="sub">
				<tr class="slds-hint-parent">
					<td>
						<div class="slds-grid">
							<div class="slds-col slds-size_1-of-8 slds-p-left_small" ondblclick="{!c.editOn}">
								<aura:if isTrue="{!v.edit}">
									<ui:inputCheckbox value="{!sub.subscribed}"/>
									<aura:set attribute="else">
										<ui:outputCheckbox value="{!sub.subscribed}"/>
									</aura:set>
								</aura:if>
							</div>
							<div class="slds-col slds-size_7-of-8 slds-text-align_left slds-has-flexi-truncate">
								<p class="slds-truncate" title="{!sub.productName}">
									{!sub.productName}
								</p>
							</div>
						</div>
					</td>
				</tr>
			</aura:iteration>
		</tbody>
	</table>
</div>
<!-- Subscription Table -->
User-added image
I'm developing a component that allows users to mass subscribe customers to Product email alerts. I want the listed product names to truncate once the length reaches the width of the component. However, the names are currently extending past the component and not truncating as expected. I've attached the portion of my markup in question and the resulting component. Any and all help is appreciated.

Thanks
I'm wondering if this is just a glitch in Salesforce and if anyone has any workaround. I currently have a Trigger on ContentDocumentLink that sends an email to the owner of a custom object record when a File or Note is created and attached to that record. The trigger also attaches file information and the body of the Note if it's a ContentNote being inserted. The trigger handles the logic in differentiating Notes from other file types. The problem is when the user hits the button to create a new Note in classic or in the Console, an empty, untitled, new note record is inserted instantly firing my trigger before the user has time to add content to the body. In Lightning it at least allows the user to fill out the header of the note before saving, but saves before the note body is filled out. Cancelling out of creating the note still leaves the blank note saved and attached to the record. Any help in understanding why the note saves before the user hits the save button would be appreciated.
I've been running into an issue for the past couple days with a custom Lightning component. I'm trying to create a "Note" component where the user/admin in Lightning App Builder selects an Object and a Record to add the note too. Once I click the lightning button to Save, it throws the following error:

Uncaught AuraClientService.postProcess: error in processing [Maximum call stack size exceeded]
throws at https://jeppesen--anthonydev.lightning.force.com/auraFW/javascript/H9Yiy9uuE9726-4_PM7fkQ/aura_prod.js:34:15.


Here is my component and the controller/helper/Apex methods that are running when the error is thrown.

Markup
<aura:component implements="flexipage:availableForAllPageTypes" access="global" controller="Lightning_Note_Controller"> 
        <aura:attribute name="note" type="Lightning_Note__c"/> 
        <aura:attribute name="recordId" type="String"/> 
        <aura:attribute name="objectType" type="String"/> 
        <aura:attribute name="editNote" type="Boolean" default="false"/> 

        <aura:handler name="init" value="{!this}" action="{!c.doInit}" /> 

        <aura:if isTrue="{!and(v.note.Id == null, !v.editNote)}"> 
                <lightning:button label="Add Note" title="Add Note" onclick="{!c.addNote}"/> 
                <aura:set attribute="else"> 
                        <aura:if isTrue="{!v.editNote}"> 
                                <lightning:button label="Save Note" title="Save Note" onclick="{!c.saveNote}"/> 
                                <lightning:inputRichText value="{!v.note.Note__c}"/> 
                                <aura:set attribute="else"> 
                                        <lightning:button label="Edit Note" title="Edit Note" onclick="{!c.editNote}"/> 
                                        <lightning:formattedRichText value="{!v.note.Note__c}"/> 
                                </aura:set> 
                        </aura:if> 
                </aura:set> 
        </aura:if> 
</aura:component>

Controller
saveNote : function(component, event, helper){
        helper.save(component, event, helper); 
}

Helper
//Saves note record 
save : function(component, event, helper){
        var saveNoteAction = component.get("c.saveNote"); 
        saveNoteAction.setParams({ 
                note : JSON.stringify(component.get("v.note")) 
        }); 
        saveNoteAction.setCallback(this, function(response2) { 
                var responseState2 = response2.getState(); 
                if (responseState2 == "SUCCESS") { 
                        var note = response2.getReturnValue(); 
                        component.set("v.note", note); 
                        component.set("v.editNote", false); 
                } 
        }); 
        $A.enqueueAction(saveNoteAction); 
}

Apex Controller
@AuraEnabled 
public static Lightning_Note__c saveNote(String note){ 
        Lightning_Note__c noteObject = (Lightning_Note__c)JSON.deserialize(note, Lightning_Note__c.class); 
        upsert noteObject; 
        System.debug('Upserted Note: ' + noteObject); 
        return noteObject; 
}

The Apex never shows up in the debug log whenever I check. Also, if I try to insert console log statements in my JS methods, the error is not displayed. Instead, all the console.log() statments repeatedly display in the console and take up all my CPU til I force quit my browser. It's as if the method is running recursively, but I don't see how this could be happening. 

Any help is greatly appreciated.
I'm wondering if this is just a glitch in Salesforce and if anyone has any workaround. I currently have a Trigger on ContentDocumentLink that sends an email to the owner of a custom object record when a File or Note is created and attached to that record. The trigger also attaches file information and the body of the Note if it's a ContentNote being inserted. The trigger handles the logic in differentiating Notes from other file types. The problem is when the user hits the button to create a new Note in classic or in the Console, an empty, untitled, new note record is inserted instantly firing my trigger before the user has time to add content to the body. In Lightning it at least allows the user to fill out the header of the note before saving, but saves before the note body is filled out. Cancelling out of creating the note still leaves the blank note saved and attached to the record. Any help in understanding why the note saves before the user hits the save button would be appreciated.
User-added image
Users have been reporting to me that the standard 'New' button on the 'Notes' related list on the lightning page displayed above will refresh the page whenever a checkbox in a custom component(circled above) I created is toggled by the user before clicking the 'New' button. I understand this is probably a niche issue or Salesforce glitch, but wanted to throw this out there and see if anyone had any solutions. The code for my custom component is really simple and displayed below

Markup
<aura:component controller="SF_Task_Email_Checkbox_Controller" implements="flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes" access="global" >
	
	<aura:attribute name="recordId" type="Id"/>
	<aura:attribute name="task" type="GNS_Task__c"/>
	
	<aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
	
	<aura:if isTrue="{!v.task != null}">
		<ui:inputCheckbox aura:id="fileCheckbox" label="Send File/Note Email To Case Owner: " value="{!v.task.Send_File_Notification__c}" change="{!c.boxChange}"/>
	</aura:if>
	
</aura:component>

Controller
({
	doInit : function(component, event, helper) {
		helper.getTaskInfo(component, event, helper);
	},
	
	boxChange : function(component, event, helper){
		helper.saveTask(component, event, helper);
	}
})

Helper
({
	getTaskInfo : function(component, event, helper) {
		var action = component.get("c.getTask");
		action.setParams({
			taskId : component.get("v.recordId")
		});
		action.setCallback(this, function(response){
			var state = response.getState();
			if(state === "SUCCESS"){
				component.set("v.task", response.getReturnValue());
			}
		});
		$A.enqueueAction(action);
	},
	
	saveTask : function(component, event, helper){
		var action = component.get("c.saveTask");
		action.setParams({
			task : component.get("v.task")
		});
		$A.enqueueAction(action);
	}
	
})

Apex
public without sharing class SF_Task_Email_Checkbox_Controller {

	@AuraEnabled
	public static GNS_Task__c getTask(Id taskId){
		return [SELECT Id, Send_File_Notification__c FROM GNS_Task__c WHERE Id = :taskId];
	}
	
	@AuraEnabled
	public static void saveTask(GNS_Task__c task){
		update task;
	}


}

​​​​​​​​​​​​​​​​​​​​​
I'm wondering if this is just a glitch in Salesforce and if anyone has any workaround. I currently have a Trigger on ContentDocumentLink that sends an email to the owner of a custom object record when a File or Note is created and attached to that record. The trigger also attaches file information and the body of the Note if it's a ContentNote being inserted. The trigger handles the logic in differentiating Notes from other file types. The problem is when the user hits the button to create a new Note in classic or in the Console, an empty, untitled, new note record is inserted instantly firing my trigger before the user has time to add content to the body. In Lightning it at least allows the user to fill out the header of the note before saving, but saves before the note body is filled out. Cancelling out of creating the note still leaves the blank note saved and attached to the record. Any help in understanding why the note saves before the user hits the save button would be appreciated.
I've been running into an issue for the past couple days with a custom Lightning component. I'm trying to create a "Note" component where the user/admin in Lightning App Builder selects an Object and a Record to add the note too. Once I click the lightning button to Save, it throws the following error:

Uncaught AuraClientService.postProcess: error in processing [Maximum call stack size exceeded]
throws at https://jeppesen--anthonydev.lightning.force.com/auraFW/javascript/H9Yiy9uuE9726-4_PM7fkQ/aura_prod.js:34:15.


Here is my component and the controller/helper/Apex methods that are running when the error is thrown.

Markup
<aura:component implements="flexipage:availableForAllPageTypes" access="global" controller="Lightning_Note_Controller"> 
        <aura:attribute name="note" type="Lightning_Note__c"/> 
        <aura:attribute name="recordId" type="String"/> 
        <aura:attribute name="objectType" type="String"/> 
        <aura:attribute name="editNote" type="Boolean" default="false"/> 

        <aura:handler name="init" value="{!this}" action="{!c.doInit}" /> 

        <aura:if isTrue="{!and(v.note.Id == null, !v.editNote)}"> 
                <lightning:button label="Add Note" title="Add Note" onclick="{!c.addNote}"/> 
                <aura:set attribute="else"> 
                        <aura:if isTrue="{!v.editNote}"> 
                                <lightning:button label="Save Note" title="Save Note" onclick="{!c.saveNote}"/> 
                                <lightning:inputRichText value="{!v.note.Note__c}"/> 
                                <aura:set attribute="else"> 
                                        <lightning:button label="Edit Note" title="Edit Note" onclick="{!c.editNote}"/> 
                                        <lightning:formattedRichText value="{!v.note.Note__c}"/> 
                                </aura:set> 
                        </aura:if> 
                </aura:set> 
        </aura:if> 
</aura:component>

Controller
saveNote : function(component, event, helper){
        helper.save(component, event, helper); 
}

Helper
//Saves note record 
save : function(component, event, helper){
        var saveNoteAction = component.get("c.saveNote"); 
        saveNoteAction.setParams({ 
                note : JSON.stringify(component.get("v.note")) 
        }); 
        saveNoteAction.setCallback(this, function(response2) { 
                var responseState2 = response2.getState(); 
                if (responseState2 == "SUCCESS") { 
                        var note = response2.getReturnValue(); 
                        component.set("v.note", note); 
                        component.set("v.editNote", false); 
                } 
        }); 
        $A.enqueueAction(saveNoteAction); 
}

Apex Controller
@AuraEnabled 
public static Lightning_Note__c saveNote(String note){ 
        Lightning_Note__c noteObject = (Lightning_Note__c)JSON.deserialize(note, Lightning_Note__c.class); 
        upsert noteObject; 
        System.debug('Upserted Note: ' + noteObject); 
        return noteObject; 
}

The Apex never shows up in the debug log whenever I check. Also, if I try to insert console log statements in my JS methods, the error is not displayed. Instead, all the console.log() statments repeatedly display in the console and take up all my CPU til I force quit my browser. It's as if the method is running recursively, but I don't see how this could be happening. 

Any help is greatly appreciated.