You need to sign in to do that
Don't have an account?
Oliver Westlake-Simm
lightning component to update field
I'm trying to create a lightning component that updates a boolean field on the case object, I've been playing around with it for a few days and can't work it out. I'm getting an error : Uncaught Action failed: c:UnEscalate$controller$unescalate [FALSE is not defined]
Using the following to trying and achieve the desired outcome.
Component
Using the following to trying and achieve the desired outcome.
Component
<aura:component controller="UnescalateController" implements="flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,flexipage:availableForRecordHome,force:hasRecordId" access="global" > <aura:at>tribute name="CaseObj" type="Case" default="{ 'sobjectType' : 'case'}"/> <lightning:button label="Unescalate" onclick="{! c.unescalate}"/> </aura:componentJS Controller
({ unescalate : function(component, event, helper) { var caseObject = component.get("v.CaseObj"); caseObject.Admin_Escalation__c = FALSE; var action = component.get("c.updateAdmin_Escalation__c"); action.setParams({ obj: caseObject, oId : component.get("v.recordId") }); // set call back action.setCallback(this, function(response) { var state = response.getState(); if (state === "SUCCESS") { alert('This case has been unescalated!'); $A.get('e.force:refreshView').fire(); } else if (state === "INCOMPLETE") { alert("From server: " + response.getReturnValue()); } else if (state === "ERROR") { var errors = response.getError(); if (errors) { if (errors[0] && errors[0].message) { console.log("Error message: " + errors[0].message); } } else { console.log("Unknown error"); } } }); // enqueue the action $A.enqueueAction(action); } })Apex Controller
public class UnescalateController { @AuraEnabled public static void updateStatus(case obj,String oId){ system.debug('obj' + obj); case cc = obj; cc.Id = oId; update cc; } }
What i'm encountering now, is that this function can only be used once.
All Answers
Please update the line:
caseObject.Admin_Escalation__c = false;
What i'm encountering now, is that this function can only be used once.