Get name of standard action overriden in Visualforce contorller The 2019 Stack Overflow Developer Survey Results Are Inapex:actionFunction action doesn't seem to work the same as apex:commandButton actionVisualforce page(table) doesn't rerenderShowing visualforce pages to Communities users, but standard Salesforce pages to all other users, without writing a dozen controller extensions!How to detect button action in controller that is associated with overriden Visualforce page?standard delete button on a custom vf pageOverride Standard View Button and Inline Editing DisabledCan a single VF page override both a standard action and a list action?Issue with StandardController addFields() on WorkOrder sObjectVisualforce - infinite redirection loopStandard controller and extension method with same name
Are spiders unable to hurt humans, especially very small spiders?
Straighten subgroup lattice
Pokemon Turn Based battle (Python)
Kerning for subscripts of sigma?
Is it ok to offer lower paid work as a trial period before negotiating for a full-time job?
writing variables above the numbers in tikz picture
How to translate "being like"?
Why does the nucleus not repel itself?
Can a flute soloist sit?
What information about me do stores get via my credit card?
Relationship between Gromov-Witten and Taubes' Gromov invariant
The phrase "to the numbers born"?
What does Linus Torvalds mean when he says that Git "never ever" tracks a file?
Why don't hard Brexiteers insist on a hard border to prevent illegal immigration after Brexit?
How can I add encounters in the Lost Mine of Phandelver campaign without giving PCs too much XP?
What do these terms in Caesar's Gallic wars mean?
What is this business jet?
Old scifi movie from the 50s or 60s with men in solid red uniforms who interrogate a spy from the past
Falsification in Math vs Science
Star Trek - X-shaped Item on Regula/Orbital Office Starbases
Does HR tell a hiring manager about salary negotiations?
Inverse Relationship Between Precision and Recall
Can withdrawing asylum be illegal?
How to display lines in a file like ls displays files in a directory?
Get name of standard action overriden in Visualforce contorller
The 2019 Stack Overflow Developer Survey Results Are Inapex:actionFunction action doesn't seem to work the same as apex:commandButton actionVisualforce page(table) doesn't rerenderShowing visualforce pages to Communities users, but standard Salesforce pages to all other users, without writing a dozen controller extensions!How to detect button action in controller that is associated with overriden Visualforce page?standard delete button on a custom vf pageOverride Standard View Button and Inline Editing DisabledCan a single VF page override both a standard action and a list action?Issue with StandardController addFields() on WorkOrder sObjectVisualforce - infinite redirection loopStandard controller and extension method with same name
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I have a visualforce page that overrides both the 'New' and 'Edit' Buttons of a custom object. In my controller extension how can I get the name of the action that called this page ? I don't see anything in the StandardController
, there are methods to redirect to the standard edit and view pages but nothing that will return the button clicked.
apex visualforce controller-extension standardcontroller salesforce-classic
add a comment |
I have a visualforce page that overrides both the 'New' and 'Edit' Buttons of a custom object. In my controller extension how can I get the name of the action that called this page ? I don't see anything in the StandardController
, there are methods to redirect to the standard edit and view pages but nothing that will return the button clicked.
apex visualforce controller-extension standardcontroller salesforce-classic
add a comment |
I have a visualforce page that overrides both the 'New' and 'Edit' Buttons of a custom object. In my controller extension how can I get the name of the action that called this page ? I don't see anything in the StandardController
, there are methods to redirect to the standard edit and view pages but nothing that will return the button clicked.
apex visualforce controller-extension standardcontroller salesforce-classic
I have a visualforce page that overrides both the 'New' and 'Edit' Buttons of a custom object. In my controller extension how can I get the name of the action that called this page ? I don't see anything in the StandardController
, there are methods to redirect to the standard edit and view pages but nothing that will return the button clicked.
apex visualforce controller-extension standardcontroller salesforce-classic
apex visualforce controller-extension standardcontroller salesforce-classic
edited 6 hours ago
Jayant Das
18.2k21330
18.2k21330
asked 8 hours ago
SallyRothroatSallyRothroat
421317
421317
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
I don't know if there's any standard way to do so, but you can utilize an approach here in your Extension's constructor to identify if the click was from New or Edit.
When you click on New button, that signifies that you are creating a new record and that it won't have an Id
yet, whereas for Edit there will be always one. So checking that in the Extension will help you to identify the flow.
public class MyExtension
private MyObj__c abc;
private String buttonClicked;
public MyExtension(ApexPages.StandardController stdController)
this.abc = (MyObj__c) stdController.getRecord();
buttonClicked = (abc.Id == null ? 'New' : 'Edit');
// do something now
+1 Strictly speaking, the parentheses around the ternary expression is not necessary, since there's no ambiguity in the syntax.
– sfdcfox
7 hours ago
@sfdcfox I agree. I just keep it for a better readability just to not confuse between=
and==
in the same statement.
– Jayant Das
7 hours ago
I'll test it out, thanks !
– SallyRothroat
6 hours ago
I was already getting the record so perfect I'll just check if it's null. What's the abc for?
– SallyRothroat
6 hours ago
@SallyRothroat Ah, I missed that part. It's just a variable of type of the object which is fetched in the constructor, I have updated my answer. If you are already getting your record, then you just need to verify theId
and done.
– Jayant Das
6 hours ago
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%2f257521%2fget-name-of-standard-action-overriden-in-visualforce-contorller%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
I don't know if there's any standard way to do so, but you can utilize an approach here in your Extension's constructor to identify if the click was from New or Edit.
When you click on New button, that signifies that you are creating a new record and that it won't have an Id
yet, whereas for Edit there will be always one. So checking that in the Extension will help you to identify the flow.
public class MyExtension
private MyObj__c abc;
private String buttonClicked;
public MyExtension(ApexPages.StandardController stdController)
this.abc = (MyObj__c) stdController.getRecord();
buttonClicked = (abc.Id == null ? 'New' : 'Edit');
// do something now
+1 Strictly speaking, the parentheses around the ternary expression is not necessary, since there's no ambiguity in the syntax.
– sfdcfox
7 hours ago
@sfdcfox I agree. I just keep it for a better readability just to not confuse between=
and==
in the same statement.
– Jayant Das
7 hours ago
I'll test it out, thanks !
– SallyRothroat
6 hours ago
I was already getting the record so perfect I'll just check if it's null. What's the abc for?
– SallyRothroat
6 hours ago
@SallyRothroat Ah, I missed that part. It's just a variable of type of the object which is fetched in the constructor, I have updated my answer. If you are already getting your record, then you just need to verify theId
and done.
– Jayant Das
6 hours ago
add a comment |
I don't know if there's any standard way to do so, but you can utilize an approach here in your Extension's constructor to identify if the click was from New or Edit.
When you click on New button, that signifies that you are creating a new record and that it won't have an Id
yet, whereas for Edit there will be always one. So checking that in the Extension will help you to identify the flow.
public class MyExtension
private MyObj__c abc;
private String buttonClicked;
public MyExtension(ApexPages.StandardController stdController)
this.abc = (MyObj__c) stdController.getRecord();
buttonClicked = (abc.Id == null ? 'New' : 'Edit');
// do something now
+1 Strictly speaking, the parentheses around the ternary expression is not necessary, since there's no ambiguity in the syntax.
– sfdcfox
7 hours ago
@sfdcfox I agree. I just keep it for a better readability just to not confuse between=
and==
in the same statement.
– Jayant Das
7 hours ago
I'll test it out, thanks !
– SallyRothroat
6 hours ago
I was already getting the record so perfect I'll just check if it's null. What's the abc for?
– SallyRothroat
6 hours ago
@SallyRothroat Ah, I missed that part. It's just a variable of type of the object which is fetched in the constructor, I have updated my answer. If you are already getting your record, then you just need to verify theId
and done.
– Jayant Das
6 hours ago
add a comment |
I don't know if there's any standard way to do so, but you can utilize an approach here in your Extension's constructor to identify if the click was from New or Edit.
When you click on New button, that signifies that you are creating a new record and that it won't have an Id
yet, whereas for Edit there will be always one. So checking that in the Extension will help you to identify the flow.
public class MyExtension
private MyObj__c abc;
private String buttonClicked;
public MyExtension(ApexPages.StandardController stdController)
this.abc = (MyObj__c) stdController.getRecord();
buttonClicked = (abc.Id == null ? 'New' : 'Edit');
// do something now
I don't know if there's any standard way to do so, but you can utilize an approach here in your Extension's constructor to identify if the click was from New or Edit.
When you click on New button, that signifies that you are creating a new record and that it won't have an Id
yet, whereas for Edit there will be always one. So checking that in the Extension will help you to identify the flow.
public class MyExtension
private MyObj__c abc;
private String buttonClicked;
public MyExtension(ApexPages.StandardController stdController)
this.abc = (MyObj__c) stdController.getRecord();
buttonClicked = (abc.Id == null ? 'New' : 'Edit');
// do something now
edited 6 hours ago
answered 7 hours ago
Jayant DasJayant Das
18.2k21330
18.2k21330
+1 Strictly speaking, the parentheses around the ternary expression is not necessary, since there's no ambiguity in the syntax.
– sfdcfox
7 hours ago
@sfdcfox I agree. I just keep it for a better readability just to not confuse between=
and==
in the same statement.
– Jayant Das
7 hours ago
I'll test it out, thanks !
– SallyRothroat
6 hours ago
I was already getting the record so perfect I'll just check if it's null. What's the abc for?
– SallyRothroat
6 hours ago
@SallyRothroat Ah, I missed that part. It's just a variable of type of the object which is fetched in the constructor, I have updated my answer. If you are already getting your record, then you just need to verify theId
and done.
– Jayant Das
6 hours ago
add a comment |
+1 Strictly speaking, the parentheses around the ternary expression is not necessary, since there's no ambiguity in the syntax.
– sfdcfox
7 hours ago
@sfdcfox I agree. I just keep it for a better readability just to not confuse between=
and==
in the same statement.
– Jayant Das
7 hours ago
I'll test it out, thanks !
– SallyRothroat
6 hours ago
I was already getting the record so perfect I'll just check if it's null. What's the abc for?
– SallyRothroat
6 hours ago
@SallyRothroat Ah, I missed that part. It's just a variable of type of the object which is fetched in the constructor, I have updated my answer. If you are already getting your record, then you just need to verify theId
and done.
– Jayant Das
6 hours ago
+1 Strictly speaking, the parentheses around the ternary expression is not necessary, since there's no ambiguity in the syntax.
– sfdcfox
7 hours ago
+1 Strictly speaking, the parentheses around the ternary expression is not necessary, since there's no ambiguity in the syntax.
– sfdcfox
7 hours ago
@sfdcfox I agree. I just keep it for a better readability just to not confuse between
=
and ==
in the same statement.– Jayant Das
7 hours ago
@sfdcfox I agree. I just keep it for a better readability just to not confuse between
=
and ==
in the same statement.– Jayant Das
7 hours ago
I'll test it out, thanks !
– SallyRothroat
6 hours ago
I'll test it out, thanks !
– SallyRothroat
6 hours ago
I was already getting the record so perfect I'll just check if it's null. What's the abc for?
– SallyRothroat
6 hours ago
I was already getting the record so perfect I'll just check if it's null. What's the abc for?
– SallyRothroat
6 hours ago
@SallyRothroat Ah, I missed that part. It's just a variable of type of the object which is fetched in the constructor, I have updated my answer. If you are already getting your record, then you just need to verify the
Id
and done.– Jayant Das
6 hours ago
@SallyRothroat Ah, I missed that part. It's just a variable of type of the object which is fetched in the constructor, I have updated my answer. If you are already getting your record, then you just need to verify the
Id
and done.– Jayant Das
6 hours ago
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.
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%2f257521%2fget-name-of-standard-action-overriden-in-visualforce-contorller%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