Not being able to access Flow variable in Apex class
Clash Royale CLAN TAG#URR8PPP
up vote
3
down vote
favorite
I am trying to create a flow which creates an account record and then navigates to the newly created record detail page
VF Code
<apex:page Controller="AccFlowController" TabStyle="Account">
<br/>
<flow:interview name="CreateAccount" interview="!myflow" finishlocation="!AID" />
Apex Class code
public class AccFlowController
public Flow.Interview.Quick_Account myFlow get; set;
public String getmyID()
if (myFlow==null) return '';
else return myFlow.accountId;
public PageReference getOID()
PageReference p = new PageReference('https://dev-dev ed.my.salesforce.com/'+getmyID());
p.setRedirect(true);
return p;
However, when I try to save the class it is showing
Error: Compile Error: Variable does not exist: accountId
My flow has the following variable present
apex visual-workflow compile-error visual-flows
add a comment |
up vote
3
down vote
favorite
I am trying to create a flow which creates an account record and then navigates to the newly created record detail page
VF Code
<apex:page Controller="AccFlowController" TabStyle="Account">
<br/>
<flow:interview name="CreateAccount" interview="!myflow" finishlocation="!AID" />
Apex Class code
public class AccFlowController
public Flow.Interview.Quick_Account myFlow get; set;
public String getmyID()
if (myFlow==null) return '';
else return myFlow.accountId;
public PageReference getOID()
PageReference p = new PageReference('https://dev-dev ed.my.salesforce.com/'+getmyID());
p.setRedirect(true);
return p;
However, when I try to save the class it is showing
Error: Compile Error: Variable does not exist: accountId
My flow has the following variable present
apex visual-workflow compile-error visual-flows
add a comment |
up vote
3
down vote
favorite
up vote
3
down vote
favorite
I am trying to create a flow which creates an account record and then navigates to the newly created record detail page
VF Code
<apex:page Controller="AccFlowController" TabStyle="Account">
<br/>
<flow:interview name="CreateAccount" interview="!myflow" finishlocation="!AID" />
Apex Class code
public class AccFlowController
public Flow.Interview.Quick_Account myFlow get; set;
public String getmyID()
if (myFlow==null) return '';
else return myFlow.accountId;
public PageReference getOID()
PageReference p = new PageReference('https://dev-dev ed.my.salesforce.com/'+getmyID());
p.setRedirect(true);
return p;
However, when I try to save the class it is showing
Error: Compile Error: Variable does not exist: accountId
My flow has the following variable present
apex visual-workflow compile-error visual-flows
I am trying to create a flow which creates an account record and then navigates to the newly created record detail page
VF Code
<apex:page Controller="AccFlowController" TabStyle="Account">
<br/>
<flow:interview name="CreateAccount" interview="!myflow" finishlocation="!AID" />
Apex Class code
public class AccFlowController
public Flow.Interview.Quick_Account myFlow get; set;
public String getmyID()
if (myFlow==null) return '';
else return myFlow.accountId;
public PageReference getOID()
PageReference p = new PageReference('https://dev-dev ed.my.salesforce.com/'+getmyID());
p.setRedirect(true);
return p;
However, when I try to save the class it is showing
Error: Compile Error: Variable does not exist: accountId
My flow has the following variable present
apex visual-workflow compile-error visual-flows
apex visual-workflow compile-error visual-flows
edited Dec 6 at 20:49
Adrian Larson♦
104k19112235
104k19112235
asked Dec 6 at 19:50
user55791
2261111
2261111
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
5
down vote
accepted
According to the documentation on Getting Flow Variables, you should call myFlow.getVariableValue
:
String accountId = (String)myFlow.getVariableValue('accountId');
I tried it as well. But (String)myFlow.getVariableValue('accountId'); just fetches null even though the record is successfully created. @AdrianLarson
– user55791
Dec 6 at 20:42
That seems like a problem with your flow, not your Apex. This answer resolves what you were doing wrong in the code you posted.
– Adrian Larson♦
Dec 6 at 20:49
1
You were right. There was an issue with my flow. All I needed was a finish screen
– user55791
Dec 6 at 21:07
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',
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%2f241709%2fnot-being-able-to-access-flow-variable-in-apex-class%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
up vote
5
down vote
accepted
According to the documentation on Getting Flow Variables, you should call myFlow.getVariableValue
:
String accountId = (String)myFlow.getVariableValue('accountId');
I tried it as well. But (String)myFlow.getVariableValue('accountId'); just fetches null even though the record is successfully created. @AdrianLarson
– user55791
Dec 6 at 20:42
That seems like a problem with your flow, not your Apex. This answer resolves what you were doing wrong in the code you posted.
– Adrian Larson♦
Dec 6 at 20:49
1
You were right. There was an issue with my flow. All I needed was a finish screen
– user55791
Dec 6 at 21:07
add a comment |
up vote
5
down vote
accepted
According to the documentation on Getting Flow Variables, you should call myFlow.getVariableValue
:
String accountId = (String)myFlow.getVariableValue('accountId');
I tried it as well. But (String)myFlow.getVariableValue('accountId'); just fetches null even though the record is successfully created. @AdrianLarson
– user55791
Dec 6 at 20:42
That seems like a problem with your flow, not your Apex. This answer resolves what you were doing wrong in the code you posted.
– Adrian Larson♦
Dec 6 at 20:49
1
You were right. There was an issue with my flow. All I needed was a finish screen
– user55791
Dec 6 at 21:07
add a comment |
up vote
5
down vote
accepted
up vote
5
down vote
accepted
According to the documentation on Getting Flow Variables, you should call myFlow.getVariableValue
:
String accountId = (String)myFlow.getVariableValue('accountId');
According to the documentation on Getting Flow Variables, you should call myFlow.getVariableValue
:
String accountId = (String)myFlow.getVariableValue('accountId');
answered Dec 6 at 20:32
Adrian Larson♦
104k19112235
104k19112235
I tried it as well. But (String)myFlow.getVariableValue('accountId'); just fetches null even though the record is successfully created. @AdrianLarson
– user55791
Dec 6 at 20:42
That seems like a problem with your flow, not your Apex. This answer resolves what you were doing wrong in the code you posted.
– Adrian Larson♦
Dec 6 at 20:49
1
You were right. There was an issue with my flow. All I needed was a finish screen
– user55791
Dec 6 at 21:07
add a comment |
I tried it as well. But (String)myFlow.getVariableValue('accountId'); just fetches null even though the record is successfully created. @AdrianLarson
– user55791
Dec 6 at 20:42
That seems like a problem with your flow, not your Apex. This answer resolves what you were doing wrong in the code you posted.
– Adrian Larson♦
Dec 6 at 20:49
1
You were right. There was an issue with my flow. All I needed was a finish screen
– user55791
Dec 6 at 21:07
I tried it as well. But (String)myFlow.getVariableValue('accountId'); just fetches null even though the record is successfully created. @AdrianLarson
– user55791
Dec 6 at 20:42
I tried it as well. But (String)myFlow.getVariableValue('accountId'); just fetches null even though the record is successfully created. @AdrianLarson
– user55791
Dec 6 at 20:42
That seems like a problem with your flow, not your Apex. This answer resolves what you were doing wrong in the code you posted.
– Adrian Larson♦
Dec 6 at 20:49
That seems like a problem with your flow, not your Apex. This answer resolves what you were doing wrong in the code you posted.
– Adrian Larson♦
Dec 6 at 20:49
1
1
You were right. There was an issue with my flow. All I needed was a finish screen
– user55791
Dec 6 at 21:07
You were right. There was an issue with my flow. All I needed was a finish screen
– user55791
Dec 6 at 21:07
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%2f241709%2fnot-being-able-to-access-flow-variable-in-apex-class%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