function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Anthony Wheeler 1Anthony Wheeler 1 

Standard New Note Button Refreshes Page

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;
	}


}

​​​​​​​​​​​​​​​​​​​​​
Anthony Wheeler 1Anthony Wheeler 1
Once I posted this, I realized that there was an Apex and Javascript method with the same name. Changing this however did not resolve the issue. Any and all help is appreciated.