You need to sign in to do that
Don't have an account?
James Kacerguis 5
Cannot get quickaction to close after clicking lightning component quick action
Hello All,
I'm extremely new to lightning components and trying to replace some of our custom javascript buttons with lightning compatible options. One button takes ownership of a lead. I found a post that does something similar for cases and tried to modify it for my purpose: https://learnownlightning.blogspot.com/2018/01/change-owner-update-record-using.html
It seems to be doing the record update based on apex code, but it launches a quickaction screen with a cancel button that doens't go away. I've seen it posted that you can use
Here is my code so far:
Component:
Apex Class:
Any ideas?
I'm extremely new to lightning components and trying to replace some of our custom javascript buttons with lightning compatible options. One button takes ownership of a lead. I found a post that does something similar for cases and tried to modify it for my purpose: https://learnownlightning.blogspot.com/2018/01/change-owner-update-record-using.html
It seems to be doing the record update based on apex code, but it launches a quickaction screen with a cancel button that doens't go away. I've seen it posted that you can use
$A.get("e.force:closeQuickAction").fire();It is not working for me. I'm not sure if I'm not puting that code in the right place but I'm hoping someone can help me figure out a way to click the quick action button, have the lead change ownership, and that's it.
Here is my code so far:
Component:
<aura:component implements="force:lightningQuickAction,force:hasRecordId" controller="LightningComponent_MoveToMarketing" access="global" > <aura:handler name="init" value="{!this}" action="{!c.doInit}"/> </aura:component>Controller:
({ doInit : function(component, event, helper) { var leadId = component.get("v.recordId"); var action = component.get("c.changeOwnerMethod"); action.setParams({ leadId : leadId }); action.setCallback(this, function(response) { if(response.getState() === "SUCCESS") { console.log("Lead Owner Changed To Current login User"); var rec = response.getReturnValue(); console.log(rec.OwnerId); } }); $A.enqueueAction(action); $A.get("e.force:closeQuickAction").fire(); $A.get('e.force:refreshView').fire(); } })
Apex Class:
public class LightningComponent_MoveToMarketing { @AuraEnabled public static Lead changeOwnerMethod(Id leadId) { if(leadId != null) { Lead l = [SELECT OwnerId FROM Lead WHERE Id = :leadId]; l.OwnerId = UserInfo.getUserId(); //update case Ownerid with loggedin userid. update l; return l; } return null; } }
Any ideas?
inside the callback function. It should be good then.
Your controller should be like this.
Please mark it solved if this is working for you.
Thanks.
All Answers
inside the callback function. It should be good then.
Your controller should be like this.
Please mark it solved if this is working for you.
Thanks.
What I'm thinking would be more useful than just closing the quick action window would be displaying a notificaiton that the lead was was reassigned and then closing. Is there a way to set a timeout value of a few seconds and then closing? Would that be done in the setCallback function area?
Thanks again!
Yes $A.enqueueAction(action) is running apex.
$A.enqueueAction(action) sends the request to server. More precisely, it adds the call to the queue of asynchronous server calls. That queue is an optimization feature of Lightning.
Also, to display the notification check and try replacing your controller code with below snippet.
controller.js
then go back to your lead page and edit it, search for your component name in the component list on the left side drag it and drop into the flexi page whereever you want.
It should look something like
Here by implementing the interface flexipage:availableForAllPageTypes in your component, it is available to drop it on flexipage.
Let me know if you have any other questions.
Thanks.
Regards : YRKKH Upcoming Story (https://serialstalk.com/yeh-rishta-kya-kehlata-hai-upcoming-story/ )
please check out this katmoviehd (https://moviesnotes.com/katmoviehd), 7starhd (http://moviesnotes.com/7starhd/), 9xmovies (http://moviesnotes.com/9xmovies), moviesflix (http://moviesnotes.com/moviesflix/), downloadhub (http://moviesnotes.com/downloadhub)
I have applied the code and it runs properly.
Grade Calculator (https://www.gradecalculator.tech/) and Password Generator (https://www.password-generator.tech) and Convert Decimal to Fraction (https://www.decimal-to-fraction.com/)
Thanks Every One for Sharing this valuable info. Regards Movierulz (https://tricksnhub.com/movierulz/)
Xiaomi redmi note 8 (https://aperfectreview.com/redmi-note-8-discover-smartphone/)
fix 500 internal server error (https://aperfectreview.com/fix-500-internal-server-error/)
9xmovies (https://becurious.co.in/9xmovies-9xmovie-download/)
Filmywap (https://becurious.co.in/filmywap-filmyzilla-filmyhit-2019/)
Moviescounter (https://becurious.co.in/movies-counter-2019-free-download-hd-movies/)
https://www.khabarsbollywood.com/moviesda-2020-download-latest-moviesda-tamil-hd-movies/
https://www.khabarsbollywood.com/downloadhub-2020-latest-300mb-dual-audio-bollywood-movies-online/
tamilrockers (https://techliso.com/tamilrockers-malayalam-2020-full-hd-movies-download/)
isaimini (https://techliso.com/tamilrockers-malayalam-2020-full-hd-movies-download/)
tamilrockers malayalam (http://techliso.com/tamilrockers-malayalam-2020-full-hd-movies-download/)
worldfree4u (https://techliso.com/worldfree4u-movies-2020-latest-720p-hd-download/)
khatrimaza (https://techliso.com/khatrimaza-2020-full-hd-movies-download-watch-720p-1080p/)
todaypk movies (http://techliso.com/todaypk-movies-2020-hd-download/)
todaypk (https://techliso.com/todaypk-movies-2020-hd-download/)
todayspk
todaypkmovies (https://www.google.it/url?sa=t&url=https://picslash.com/todaypk/)
picslash (https://www.google.nl/url?sa=t&url=https://picslash.com/todaypk/)
Also want to know how these sites Movierulz ms (https://www.techdeskindia.com/2020/02/movierulz-movies.html) sells their movies illegalyy??
photolooks (https://photoslooks.com/)
disha patani hot pics (https://photoslooks.com/disha-patani-hot-pics/)
tool for vimeo thumbnail downloader (https://youtubethumbnaildownload.online/vimeo.html)
tool for dailymotion thumbnail downloader (https://youtubethumbnaildownload.online/dailymotion.php)
Python training (https://www.technobridge.in/python-training-course.php)in Pune
Very nice to see. But i would like to mention this site https://www.google.nl/url?sa=t&url=https://webmusic.to/ (https://www.google.nl/url?sa=t&url=https://webmusic.to/) or you can visit: Webmusic (https://webmusic.to)
sikhlens film festival
I am a developer at these two sites; visit mybag.pk and naturebounty.pk
More details here
https://salesforcerealm.com/2021/12/13/headless-lwc-actions/