添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
才高八斗的西红柿  ·  MachineLearning 32. ...·  1 月前    · 
谦逊的盒饭  ·  view component tree ...·  7 月前    · 
星星上的热带鱼  ·  VS ...·  1 年前    · 

Welcome to Support!

Search for an answer or ask a question of the zone or Customer Support.

Need help? Dismiss Show All Questions sorted by Date Posted

Show

sorted by

Jos Vervoorn 2 Jos Vervoorn 2

Parsing error: Unexpected token case

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.

Many thanks on advance.
Best Answer chosen by Jos Vervoorn 2
Alain Cabon Alain Cabon
Hi,

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

Alain Cabon Alain Cabon
Hi,

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.

This was selected as the best answer
Jos Vervoorn 2 Jos Vervoorn 2
Thanks Alain, that was the trick :)
Jos Vervoorn 2 Jos Vervoorn 2
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 :)
Alain Cabon Alain Cabon
"lightning quick actions to update case date/time field."

Where will the button of this quick action be located?
Jos Vervoorn 2 Jos Vervoorn 2
It will be on the case page itself. So the idea is to view a case and press a button to set a date/time stamp.
Alain Cabon Alain Cabon
The goal is to set the dates wtih predefined field values.(calculated with the current date or other dates) in the form of the quick action?
Jos Vervoorn 2 Jos Vervoorn 2
Just current date & time stamp. So one would press the button and a timestamp is set ... as this would trigger another process (process builder) ..
Alain Cabon Alain Cabon
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;
User-added image
Regards
Jos Vervoorn 2 Jos Vervoorn 2
Hi Alain, thanks for your amazing support. You really help me here. !!
Alain Cabon Alain Cabon
Ok Good.
tot ziens!