Redirect back to the VF page
Clash Royale CLAN TAG#URR8PPP
In Classic: There is a New button on the VF page. On click of this button default new record create a page of the custom object gets open. On saving of the record, the page gets redirected to the VF page(On which new button was clicked).
Now we converted this VF page to lightning experience and we are facing a problem following problem.
On click of New button on VF page, a pop-up appears to create a new record (custom object) but in the background, VF page redirects to the blank page. So when we save this record, we are not redirected to the previous VF page.
New Button:
Popup:
Code used in contoller for returning url in classic:
Schema.DescribeSObjectResult ppConfigObj = Priority_Points_Settings__c.sObjectType.getDescribe();
String url = ApexPages.currentPage().getUrl();
PageReference pageRef = new PageReference('/'+ppConfigObj.getKeyPrefix()+'/e?retURL='+url);
return pageRef;
On VF page, above function is called:
<apex:commandButton value="New" id="newButtonConfig" action="!createNewPriorityPointConfig"/>
Please suggest a solution to solve this issue.
visualforce custom pagereference redirect
add a comment |
In Classic: There is a New button on the VF page. On click of this button default new record create a page of the custom object gets open. On saving of the record, the page gets redirected to the VF page(On which new button was clicked).
Now we converted this VF page to lightning experience and we are facing a problem following problem.
On click of New button on VF page, a pop-up appears to create a new record (custom object) but in the background, VF page redirects to the blank page. So when we save this record, we are not redirected to the previous VF page.
New Button:
Popup:
Code used in contoller for returning url in classic:
Schema.DescribeSObjectResult ppConfigObj = Priority_Points_Settings__c.sObjectType.getDescribe();
String url = ApexPages.currentPage().getUrl();
PageReference pageRef = new PageReference('/'+ppConfigObj.getKeyPrefix()+'/e?retURL='+url);
return pageRef;
On VF page, above function is called:
<apex:commandButton value="New" id="newButtonConfig" action="!createNewPriorityPointConfig"/>
Please suggest a solution to solve this issue.
visualforce custom pagereference redirect
add a comment |
In Classic: There is a New button on the VF page. On click of this button default new record create a page of the custom object gets open. On saving of the record, the page gets redirected to the VF page(On which new button was clicked).
Now we converted this VF page to lightning experience and we are facing a problem following problem.
On click of New button on VF page, a pop-up appears to create a new record (custom object) but in the background, VF page redirects to the blank page. So when we save this record, we are not redirected to the previous VF page.
New Button:
Popup:
Code used in contoller for returning url in classic:
Schema.DescribeSObjectResult ppConfigObj = Priority_Points_Settings__c.sObjectType.getDescribe();
String url = ApexPages.currentPage().getUrl();
PageReference pageRef = new PageReference('/'+ppConfigObj.getKeyPrefix()+'/e?retURL='+url);
return pageRef;
On VF page, above function is called:
<apex:commandButton value="New" id="newButtonConfig" action="!createNewPriorityPointConfig"/>
Please suggest a solution to solve this issue.
visualforce custom pagereference redirect
In Classic: There is a New button on the VF page. On click of this button default new record create a page of the custom object gets open. On saving of the record, the page gets redirected to the VF page(On which new button was clicked).
Now we converted this VF page to lightning experience and we are facing a problem following problem.
On click of New button on VF page, a pop-up appears to create a new record (custom object) but in the background, VF page redirects to the blank page. So when we save this record, we are not redirected to the previous VF page.
New Button:
Popup:
Code used in contoller for returning url in classic:
Schema.DescribeSObjectResult ppConfigObj = Priority_Points_Settings__c.sObjectType.getDescribe();
String url = ApexPages.currentPage().getUrl();
PageReference pageRef = new PageReference('/'+ppConfigObj.getKeyPrefix()+'/e?retURL='+url);
return pageRef;
On VF page, above function is called:
<apex:commandButton value="New" id="newButtonConfig" action="!createNewPriorityPointConfig"/>
Please suggest a solution to solve this issue.
visualforce custom pagereference redirect
visualforce custom pagereference redirect
edited Dec 27 '18 at 5:40
asked Dec 25 '18 at 8:03
Ajinkyasd
62
62
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
In your code, you are setting the page reference as follows:
PageReference pageRef = new PageReference('/'+ppConfigObj.getKeyPrefix()+'/e?retURL='+url);
In particular, you are calling a method ppConfigObj.getKeyPrefix()
that looks as though you're getting the object name or something from a map. It's not exactly clear what it is since you don't show that part of your code. For all I know it could be the full path to the page like: /Apex/thisVisualForcePageName
.
I think what you want to be doing is one of two things. Either converting that button to an Action (the action would work the same in Lightning) or convert the link to the proper format that Lightning expects it to have; one that includes the Object Name. When constructing the button link, I think you probably want to do something like the following:
!URLFOR( $Action.Case.NewCase, $ObjectType.Case )
See Constructing Effective Custom URL Buttons and Links in the Salesforce Documentation for more on this subject with additional details and considerations that might apply to your situation.
In classic, on click of the new button on the VF page, the default new create record page of the custom object gets open. On saving the record, the page is redirecting back to the VF page(on which new button was clicked). For returning URL, we used the following code: PageReference pageRef = new PageReference('/'+ppConfigObj.getKeyPrefix()+'/e?retURL='+url); where the ppConfigObj.getKeyPrefix() gets the custom object id prefix.
– Ajinkyasd
Dec 27 '18 at 5:35
Lightning will be expecting the Object name, not the object Id prefix. That may be something you'll want to change in your map code. If you look at all of the lightning component methods, they reference the object name. That prefix will change from org to org for custom objects of the same name.
– crmprogdev
Dec 27 '18 at 5:54
I am using the above logic to open the create new record create page. for example, if we use 'https://<lightning.domain.com>/001/e', the new account popup will open. But I am unable to return to the original vf page from this popup page.
– Ajinkyasd
Dec 27 '18 at 11:29
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "459"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f244599%2fredirect-back-to-the-vf-page%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
In your code, you are setting the page reference as follows:
PageReference pageRef = new PageReference('/'+ppConfigObj.getKeyPrefix()+'/e?retURL='+url);
In particular, you are calling a method ppConfigObj.getKeyPrefix()
that looks as though you're getting the object name or something from a map. It's not exactly clear what it is since you don't show that part of your code. For all I know it could be the full path to the page like: /Apex/thisVisualForcePageName
.
I think what you want to be doing is one of two things. Either converting that button to an Action (the action would work the same in Lightning) or convert the link to the proper format that Lightning expects it to have; one that includes the Object Name. When constructing the button link, I think you probably want to do something like the following:
!URLFOR( $Action.Case.NewCase, $ObjectType.Case )
See Constructing Effective Custom URL Buttons and Links in the Salesforce Documentation for more on this subject with additional details and considerations that might apply to your situation.
In classic, on click of the new button on the VF page, the default new create record page of the custom object gets open. On saving the record, the page is redirecting back to the VF page(on which new button was clicked). For returning URL, we used the following code: PageReference pageRef = new PageReference('/'+ppConfigObj.getKeyPrefix()+'/e?retURL='+url); where the ppConfigObj.getKeyPrefix() gets the custom object id prefix.
– Ajinkyasd
Dec 27 '18 at 5:35
Lightning will be expecting the Object name, not the object Id prefix. That may be something you'll want to change in your map code. If you look at all of the lightning component methods, they reference the object name. That prefix will change from org to org for custom objects of the same name.
– crmprogdev
Dec 27 '18 at 5:54
I am using the above logic to open the create new record create page. for example, if we use 'https://<lightning.domain.com>/001/e', the new account popup will open. But I am unable to return to the original vf page from this popup page.
– Ajinkyasd
Dec 27 '18 at 11:29
add a comment |
In your code, you are setting the page reference as follows:
PageReference pageRef = new PageReference('/'+ppConfigObj.getKeyPrefix()+'/e?retURL='+url);
In particular, you are calling a method ppConfigObj.getKeyPrefix()
that looks as though you're getting the object name or something from a map. It's not exactly clear what it is since you don't show that part of your code. For all I know it could be the full path to the page like: /Apex/thisVisualForcePageName
.
I think what you want to be doing is one of two things. Either converting that button to an Action (the action would work the same in Lightning) or convert the link to the proper format that Lightning expects it to have; one that includes the Object Name. When constructing the button link, I think you probably want to do something like the following:
!URLFOR( $Action.Case.NewCase, $ObjectType.Case )
See Constructing Effective Custom URL Buttons and Links in the Salesforce Documentation for more on this subject with additional details and considerations that might apply to your situation.
In classic, on click of the new button on the VF page, the default new create record page of the custom object gets open. On saving the record, the page is redirecting back to the VF page(on which new button was clicked). For returning URL, we used the following code: PageReference pageRef = new PageReference('/'+ppConfigObj.getKeyPrefix()+'/e?retURL='+url); where the ppConfigObj.getKeyPrefix() gets the custom object id prefix.
– Ajinkyasd
Dec 27 '18 at 5:35
Lightning will be expecting the Object name, not the object Id prefix. That may be something you'll want to change in your map code. If you look at all of the lightning component methods, they reference the object name. That prefix will change from org to org for custom objects of the same name.
– crmprogdev
Dec 27 '18 at 5:54
I am using the above logic to open the create new record create page. for example, if we use 'https://<lightning.domain.com>/001/e', the new account popup will open. But I am unable to return to the original vf page from this popup page.
– Ajinkyasd
Dec 27 '18 at 11:29
add a comment |
In your code, you are setting the page reference as follows:
PageReference pageRef = new PageReference('/'+ppConfigObj.getKeyPrefix()+'/e?retURL='+url);
In particular, you are calling a method ppConfigObj.getKeyPrefix()
that looks as though you're getting the object name or something from a map. It's not exactly clear what it is since you don't show that part of your code. For all I know it could be the full path to the page like: /Apex/thisVisualForcePageName
.
I think what you want to be doing is one of two things. Either converting that button to an Action (the action would work the same in Lightning) or convert the link to the proper format that Lightning expects it to have; one that includes the Object Name. When constructing the button link, I think you probably want to do something like the following:
!URLFOR( $Action.Case.NewCase, $ObjectType.Case )
See Constructing Effective Custom URL Buttons and Links in the Salesforce Documentation for more on this subject with additional details and considerations that might apply to your situation.
In your code, you are setting the page reference as follows:
PageReference pageRef = new PageReference('/'+ppConfigObj.getKeyPrefix()+'/e?retURL='+url);
In particular, you are calling a method ppConfigObj.getKeyPrefix()
that looks as though you're getting the object name or something from a map. It's not exactly clear what it is since you don't show that part of your code. For all I know it could be the full path to the page like: /Apex/thisVisualForcePageName
.
I think what you want to be doing is one of two things. Either converting that button to an Action (the action would work the same in Lightning) or convert the link to the proper format that Lightning expects it to have; one that includes the Object Name. When constructing the button link, I think you probably want to do something like the following:
!URLFOR( $Action.Case.NewCase, $ObjectType.Case )
See Constructing Effective Custom URL Buttons and Links in the Salesforce Documentation for more on this subject with additional details and considerations that might apply to your situation.
answered Dec 25 '18 at 13:17
crmprogdev
35.1k73793
35.1k73793
In classic, on click of the new button on the VF page, the default new create record page of the custom object gets open. On saving the record, the page is redirecting back to the VF page(on which new button was clicked). For returning URL, we used the following code: PageReference pageRef = new PageReference('/'+ppConfigObj.getKeyPrefix()+'/e?retURL='+url); where the ppConfigObj.getKeyPrefix() gets the custom object id prefix.
– Ajinkyasd
Dec 27 '18 at 5:35
Lightning will be expecting the Object name, not the object Id prefix. That may be something you'll want to change in your map code. If you look at all of the lightning component methods, they reference the object name. That prefix will change from org to org for custom objects of the same name.
– crmprogdev
Dec 27 '18 at 5:54
I am using the above logic to open the create new record create page. for example, if we use 'https://<lightning.domain.com>/001/e', the new account popup will open. But I am unable to return to the original vf page from this popup page.
– Ajinkyasd
Dec 27 '18 at 11:29
add a comment |
In classic, on click of the new button on the VF page, the default new create record page of the custom object gets open. On saving the record, the page is redirecting back to the VF page(on which new button was clicked). For returning URL, we used the following code: PageReference pageRef = new PageReference('/'+ppConfigObj.getKeyPrefix()+'/e?retURL='+url); where the ppConfigObj.getKeyPrefix() gets the custom object id prefix.
– Ajinkyasd
Dec 27 '18 at 5:35
Lightning will be expecting the Object name, not the object Id prefix. That may be something you'll want to change in your map code. If you look at all of the lightning component methods, they reference the object name. That prefix will change from org to org for custom objects of the same name.
– crmprogdev
Dec 27 '18 at 5:54
I am using the above logic to open the create new record create page. for example, if we use 'https://<lightning.domain.com>/001/e', the new account popup will open. But I am unable to return to the original vf page from this popup page.
– Ajinkyasd
Dec 27 '18 at 11:29
In classic, on click of the new button on the VF page, the default new create record page of the custom object gets open. On saving the record, the page is redirecting back to the VF page(on which new button was clicked). For returning URL, we used the following code: PageReference pageRef = new PageReference('/'+ppConfigObj.getKeyPrefix()+'/e?retURL='+url); where the ppConfigObj.getKeyPrefix() gets the custom object id prefix.
– Ajinkyasd
Dec 27 '18 at 5:35
In classic, on click of the new button on the VF page, the default new create record page of the custom object gets open. On saving the record, the page is redirecting back to the VF page(on which new button was clicked). For returning URL, we used the following code: PageReference pageRef = new PageReference('/'+ppConfigObj.getKeyPrefix()+'/e?retURL='+url); where the ppConfigObj.getKeyPrefix() gets the custom object id prefix.
– Ajinkyasd
Dec 27 '18 at 5:35
Lightning will be expecting the Object name, not the object Id prefix. That may be something you'll want to change in your map code. If you look at all of the lightning component methods, they reference the object name. That prefix will change from org to org for custom objects of the same name.
– crmprogdev
Dec 27 '18 at 5:54
Lightning will be expecting the Object name, not the object Id prefix. That may be something you'll want to change in your map code. If you look at all of the lightning component methods, they reference the object name. That prefix will change from org to org for custom objects of the same name.
– crmprogdev
Dec 27 '18 at 5:54
I am using the above logic to open the create new record create page. for example, if we use 'https://<lightning.domain.com>/001/e', the new account popup will open. But I am unable to return to the original vf page from this popup page.
– Ajinkyasd
Dec 27 '18 at 11:29
I am using the above logic to open the create new record create page. for example, if we use 'https://<lightning.domain.com>/001/e', the new account popup will open. But I am unable to return to the original vf page from this popup page.
– Ajinkyasd
Dec 27 '18 at 11:29
add a comment |
Thanks for contributing an answer to Salesforce Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f244599%2fredirect-back-to-the-vf-page%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown