You need to sign in to do that
Don't have an account?
Valli K
not able to migrate my javascript button in lightning experience. please help me to convert the below button. I am new to Lightning. current onclick javascript action: window.location.href ='/apex/RequestType?&id={!Opportunity.Id}';
not able to migrate my javascript button in lightning experience. please help me to convert the below button. I am new to Lightning. current onclick javascript action: window.location.href ='/apex/RequestType?&id={!Opportunity.Id}';
controller
All Answers
Please refer below link, this might give you some information for the same.
https://trailhead.salesforce.com/modules/lex_javascript_button_migration/units/javascript_button_alternatives
component
controller
I would strongly advice you go through this trailhead Module:
https://trailhead.salesforce.com/modules/lex_javascript_button_migration/units/javascript_button_alternatives
Also, refer to this link to see how to navigate to URLs from lightning components.
https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/ref_force_navigateToURL.htm
let me know if it helps.
Thanks!
@GhanshyamChoudhari
The code which you have provided with this its redicting to a Opportunity.Id, but i want this to redirect to a another Vf page.
How& where should i use the below link in the given code.
window.location.href ='/apex/RequestType?&id={!Opportunity.Id}';
Try this:
window.open("/apex/RequestType?id="+component.get("v.recordId"),'_blank');
Let me know if it helps.
Thanks!
<aura:component implements="force:lightningQuickAction,force:hasRecordId">
<!--<aura:handler name="init" value="{!this}" action="{!c.handleClick}" /> -->
<lightning:button variant="brand" label="New RFI" onclick="{! c.handleClick }" />
</aura:component>
({
handleClick : function(component, event, helper) {
var id=component.get("v.recordId");
window.open("/apex/P2EvRequestType?id="+id,'_blank');
}
})
controller
I created a component to test the above and it's working just fine. It redirects me to my VF page on a single click.
Access= global means what, because in lightning created a new button for this. May be because of the my old javascript button which is existing in classic that is not working. Access =global, are we making it as a global for both class & lightning?
if yes what about the old one?
It may because of in lightning when i click on the button, redirection of vf page is opening in new tab, but in classic in the opportunity page itself vf page is redirecting. can we do something here to fix this.
A quick question, you want to redirect to the vf page in same window or you want to open it in a new tab?
In controller instead of _black use _self or _parent and try
instead of _blank use _self and make sure you are refreshing you record at least 2 times and then click on the action button.
please, markthe best answer if it helps you.
thanks
Try this in your controller:
This should do the trick.
P.S: Sorry for the late reply.
Another alternative solution:
Let me know if it helps.
Thanks!
I tried this code in my component, its not giving any pop-up.
This is my JS controller code:
I place this component on the Account record Page. But you can use it as a lightning quick Action, it won't make any difference.
Let me know if this solves your purpose.
Thanks!
I see now what your problem is.
And sorry but unfortunately there is no way to hide that pop-up because it's a standard functionality. Nothing can be done about this.
What you can do is add a spinner and show a custom message, like "Redirecting to ABC page" to your lightning component.
Please mark a best answer so that the others with similar kind of issue can benefit from this post.
Thanks!
Thank you very much. it was useful