While creating a 'simple' Lightning QuickAction to update case date/time field I get this unexpected token case.
StartTiming: function(component, event, helper) {
console.log('save:1');
var action = component.get("c.case");
action.setParams({"case": case });
Some help to overcome this would be great. Now the controller is not finished but I need to overcome this issue first.
You do not happen to have a complete example using lightning quick actions to update case date/time field ? It would be a huge time saver and steep learning curve for me :)
The problem with a quick action for a case is that you could have already a quick action in the feed tab for a quick creation so the new quick action will be like below and you need a new button "Click to update".
<aura:component controller="CaseLEX" implements="force:lightningQuickAction,force:hasRecordId,force:hasSObjectName">
<!-- aura:handler name="init" value="{!this}" action="{!c.updateMyCase}" / -->
<aura:attribute name="recordId" type="Id" />
<aura:attribute name="sObjectName" type="String" />
<aura:attribute name="myCase" type="Case" />
===> recordId:<b>{!v.recordId}</b><br/>
===> sObjectName:<b>{!v.sObjectName}</b><br/>
===> myCase LastModifiedDate:<b>{!v.myCase.LastModifiedDate}</b><br/>
<ui:button aura:id="button" buttonTitle="Click to update" class="button" label="Click to update" press="{!c.updateMyCase}"/>
</aura:component>
updateMyCase : function(component, event, helper) {
var action = component.get("c.updateCase");
action.setParams({"caseId": component.get("v.recordId")});
action.setCallback(this, function(response) {
var state = response.getState();
if(state === "SUCCESS") {
component.set("v.myCase",response.getReturnValue());
var resultsToast = $A.get("e.force:showToast");
var toastEvent = $A.get("e.force:showToast");
toastEvent.setParams({
"title": "Success!",
"message": "Case updated."
toastEvent.fire();
// var wasDismissed = $A.get("e.force:closeQuickAction");
// wasDismissed.fire();
} else {
console.log('Problem updating the case, response state: ' + state);
$A.enqueueAction(action);
public class CaseLEX {
@AuraEnabled
public static Case updateCase(String caseId) {
Case cas = [select id,lastmodifieddate from case where id = :caseId];
update cas;
cas = [select id,lastmodifieddate from case where id = :caseId];
return cas;
The problem is case .
The solution could be: action.setParams({"case": component.get("v.case") });
But without seeing your controllers and your component, it is just a possibility.
All Answers
The problem is case .
The solution could be: action.setParams({"case": component.get("v.case") });
But without seeing your controllers and your component, it is just a possibility.
Where will the button of this quick action be located?
Regards
tot ziens!