How to read Salesforce lightning components attributes from APEX
Clash Royale CLAN TAG#URR8PPP
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty margin-bottom:0;
up vote
2
down vote
favorite
This use case is tricky.
We need to have a way to read Salesforce lightning component attributes from the APEX code.
We don't want to pass the attributes from the Salesforce lightning javascript but wanna try to read the component attributes from the backend code.
Is it possible?
lightning-components
add a comment |Â
up vote
2
down vote
favorite
This use case is tricky.
We need to have a way to read Salesforce lightning component attributes from the APEX code.
We don't want to pass the attributes from the Salesforce lightning javascript but wanna try to read the component attributes from the backend code.
Is it possible?
lightning-components
1
Its actually very interesting question but my guess it is not possible to do something like that. LEX is like normal js framework and it is using standard client (web) server (backend apex) architecture. But maybe I am wrong and someone smarter would provide some more info about this topic
â user1974566
Sep 16 at 20:14
1
I agree with Charles. This seems like an X-Y problem. You might want to take a step back and explain what you're trying to do.
â sfdcfox
Sep 16 at 20:37
@sfdcfox Lightning components are stored as a JSON object... perhaps it's possible to query for them. But of course, as Charles says, we are probably trying to solve the wrong problem.
â Caspar Harmer
Sep 16 at 22:14
Of course, they would be in raw, unevaluated form... so many attributes would be invalid.
â Caspar Harmer
Sep 16 at 22:15
add a comment |Â
up vote
2
down vote
favorite
up vote
2
down vote
favorite
This use case is tricky.
We need to have a way to read Salesforce lightning component attributes from the APEX code.
We don't want to pass the attributes from the Salesforce lightning javascript but wanna try to read the component attributes from the backend code.
Is it possible?
lightning-components
This use case is tricky.
We need to have a way to read Salesforce lightning component attributes from the APEX code.
We don't want to pass the attributes from the Salesforce lightning javascript but wanna try to read the component attributes from the backend code.
Is it possible?
lightning-components
lightning-components
asked Sep 16 at 20:01
newBike
1787
1787
1
Its actually very interesting question but my guess it is not possible to do something like that. LEX is like normal js framework and it is using standard client (web) server (backend apex) architecture. But maybe I am wrong and someone smarter would provide some more info about this topic
â user1974566
Sep 16 at 20:14
1
I agree with Charles. This seems like an X-Y problem. You might want to take a step back and explain what you're trying to do.
â sfdcfox
Sep 16 at 20:37
@sfdcfox Lightning components are stored as a JSON object... perhaps it's possible to query for them. But of course, as Charles says, we are probably trying to solve the wrong problem.
â Caspar Harmer
Sep 16 at 22:14
Of course, they would be in raw, unevaluated form... so many attributes would be invalid.
â Caspar Harmer
Sep 16 at 22:15
add a comment |Â
1
Its actually very interesting question but my guess it is not possible to do something like that. LEX is like normal js framework and it is using standard client (web) server (backend apex) architecture. But maybe I am wrong and someone smarter would provide some more info about this topic
â user1974566
Sep 16 at 20:14
1
I agree with Charles. This seems like an X-Y problem. You might want to take a step back and explain what you're trying to do.
â sfdcfox
Sep 16 at 20:37
@sfdcfox Lightning components are stored as a JSON object... perhaps it's possible to query for them. But of course, as Charles says, we are probably trying to solve the wrong problem.
â Caspar Harmer
Sep 16 at 22:14
Of course, they would be in raw, unevaluated form... so many attributes would be invalid.
â Caspar Harmer
Sep 16 at 22:15
1
1
Its actually very interesting question but my guess it is not possible to do something like that. LEX is like normal js framework and it is using standard client (web) server (backend apex) architecture. But maybe I am wrong and someone smarter would provide some more info about this topic
â user1974566
Sep 16 at 20:14
Its actually very interesting question but my guess it is not possible to do something like that. LEX is like normal js framework and it is using standard client (web) server (backend apex) architecture. But maybe I am wrong and someone smarter would provide some more info about this topic
â user1974566
Sep 16 at 20:14
1
1
I agree with Charles. This seems like an X-Y problem. You might want to take a step back and explain what you're trying to do.
â sfdcfox
Sep 16 at 20:37
I agree with Charles. This seems like an X-Y problem. You might want to take a step back and explain what you're trying to do.
â sfdcfox
Sep 16 at 20:37
@sfdcfox Lightning components are stored as a JSON object... perhaps it's possible to query for them. But of course, as Charles says, we are probably trying to solve the wrong problem.
â Caspar Harmer
Sep 16 at 22:14
@sfdcfox Lightning components are stored as a JSON object... perhaps it's possible to query for them. But of course, as Charles says, we are probably trying to solve the wrong problem.
â Caspar Harmer
Sep 16 at 22:14
Of course, they would be in raw, unevaluated form... so many attributes would be invalid.
â Caspar Harmer
Sep 16 at 22:15
Of course, they would be in raw, unevaluated form... so many attributes would be invalid.
â Caspar Harmer
Sep 16 at 22:15
add a comment |Â
3 Answers
3
active
oldest
votes
up vote
6
down vote
No. Those parameters are known only on the front end and never passed to the back at all. The whole idea of making calls to static functions in an Apex controller from Lightning is that behaviour should flow directly from the parameters passed in.
This seems like an X/Y problem. The question you are asking is confusing. What is the real problem you are trying to solve that makes you so reluctant to pass Lightning component parameters to Apex?
add a comment |Â
up vote
0
down vote
It is impossible in normal flow also because Lightning side, once spinned up on a page load, determines then when and how to call Apex code using Ajax calls or navigating to another page. Between calls, Apex has no chance to know what happening on Lightning side. This is how classic client-server and unidirectional SPA applications work.
To implement something you talking about, you have to have a hypothetical constantly running background process on Apex, that will connect via always-live bidirectional channel like websocket to another hypothetical JavaScript daemon running on Lightning front-end session (btw each user in each browser will have a different session so different instance of a daemon), and this daemon will be somehow invisible to the Lightning components (your intention was to hide such an activity from the components itself - right?) and querying their attributes the same time.
Well, you can implement e.g a Chrome browser extension with a spying content script. This content script will hack into Lightning components structure in real time, and send its contents to some your server side when queried. But this is tricky, and again, server-initiated query needs technologies like websocket or long polling.
You can try to make the same hacks from a special lightning component or from a loaded static JS library instead of Chrome extension, but I suspect you might encounter security limitations from LockerService.
add a comment |Â
up vote
0
down vote
What would be the use case of this (personally I can not think of any)? Possibly would help a bit more to find the correct solution to your problem. Seems like a case of over-engineering ;)
New contributor
add a comment |Â
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
6
down vote
No. Those parameters are known only on the front end and never passed to the back at all. The whole idea of making calls to static functions in an Apex controller from Lightning is that behaviour should flow directly from the parameters passed in.
This seems like an X/Y problem. The question you are asking is confusing. What is the real problem you are trying to solve that makes you so reluctant to pass Lightning component parameters to Apex?
add a comment |Â
up vote
6
down vote
No. Those parameters are known only on the front end and never passed to the back at all. The whole idea of making calls to static functions in an Apex controller from Lightning is that behaviour should flow directly from the parameters passed in.
This seems like an X/Y problem. The question you are asking is confusing. What is the real problem you are trying to solve that makes you so reluctant to pass Lightning component parameters to Apex?
add a comment |Â
up vote
6
down vote
up vote
6
down vote
No. Those parameters are known only on the front end and never passed to the back at all. The whole idea of making calls to static functions in an Apex controller from Lightning is that behaviour should flow directly from the parameters passed in.
This seems like an X/Y problem. The question you are asking is confusing. What is the real problem you are trying to solve that makes you so reluctant to pass Lightning component parameters to Apex?
No. Those parameters are known only on the front end and never passed to the back at all. The whole idea of making calls to static functions in an Apex controller from Lightning is that behaviour should flow directly from the parameters passed in.
This seems like an X/Y problem. The question you are asking is confusing. What is the real problem you are trying to solve that makes you so reluctant to pass Lightning component parameters to Apex?
answered Sep 16 at 20:16
Charles T
5,4901618
5,4901618
add a comment |Â
add a comment |Â
up vote
0
down vote
It is impossible in normal flow also because Lightning side, once spinned up on a page load, determines then when and how to call Apex code using Ajax calls or navigating to another page. Between calls, Apex has no chance to know what happening on Lightning side. This is how classic client-server and unidirectional SPA applications work.
To implement something you talking about, you have to have a hypothetical constantly running background process on Apex, that will connect via always-live bidirectional channel like websocket to another hypothetical JavaScript daemon running on Lightning front-end session (btw each user in each browser will have a different session so different instance of a daemon), and this daemon will be somehow invisible to the Lightning components (your intention was to hide such an activity from the components itself - right?) and querying their attributes the same time.
Well, you can implement e.g a Chrome browser extension with a spying content script. This content script will hack into Lightning components structure in real time, and send its contents to some your server side when queried. But this is tricky, and again, server-initiated query needs technologies like websocket or long polling.
You can try to make the same hacks from a special lightning component or from a loaded static JS library instead of Chrome extension, but I suspect you might encounter security limitations from LockerService.
add a comment |Â
up vote
0
down vote
It is impossible in normal flow also because Lightning side, once spinned up on a page load, determines then when and how to call Apex code using Ajax calls or navigating to another page. Between calls, Apex has no chance to know what happening on Lightning side. This is how classic client-server and unidirectional SPA applications work.
To implement something you talking about, you have to have a hypothetical constantly running background process on Apex, that will connect via always-live bidirectional channel like websocket to another hypothetical JavaScript daemon running on Lightning front-end session (btw each user in each browser will have a different session so different instance of a daemon), and this daemon will be somehow invisible to the Lightning components (your intention was to hide such an activity from the components itself - right?) and querying their attributes the same time.
Well, you can implement e.g a Chrome browser extension with a spying content script. This content script will hack into Lightning components structure in real time, and send its contents to some your server side when queried. But this is tricky, and again, server-initiated query needs technologies like websocket or long polling.
You can try to make the same hacks from a special lightning component or from a loaded static JS library instead of Chrome extension, but I suspect you might encounter security limitations from LockerService.
add a comment |Â
up vote
0
down vote
up vote
0
down vote
It is impossible in normal flow also because Lightning side, once spinned up on a page load, determines then when and how to call Apex code using Ajax calls or navigating to another page. Between calls, Apex has no chance to know what happening on Lightning side. This is how classic client-server and unidirectional SPA applications work.
To implement something you talking about, you have to have a hypothetical constantly running background process on Apex, that will connect via always-live bidirectional channel like websocket to another hypothetical JavaScript daemon running on Lightning front-end session (btw each user in each browser will have a different session so different instance of a daemon), and this daemon will be somehow invisible to the Lightning components (your intention was to hide such an activity from the components itself - right?) and querying their attributes the same time.
Well, you can implement e.g a Chrome browser extension with a spying content script. This content script will hack into Lightning components structure in real time, and send its contents to some your server side when queried. But this is tricky, and again, server-initiated query needs technologies like websocket or long polling.
You can try to make the same hacks from a special lightning component or from a loaded static JS library instead of Chrome extension, but I suspect you might encounter security limitations from LockerService.
It is impossible in normal flow also because Lightning side, once spinned up on a page load, determines then when and how to call Apex code using Ajax calls or navigating to another page. Between calls, Apex has no chance to know what happening on Lightning side. This is how classic client-server and unidirectional SPA applications work.
To implement something you talking about, you have to have a hypothetical constantly running background process on Apex, that will connect via always-live bidirectional channel like websocket to another hypothetical JavaScript daemon running on Lightning front-end session (btw each user in each browser will have a different session so different instance of a daemon), and this daemon will be somehow invisible to the Lightning components (your intention was to hide such an activity from the components itself - right?) and querying their attributes the same time.
Well, you can implement e.g a Chrome browser extension with a spying content script. This content script will hack into Lightning components structure in real time, and send its contents to some your server side when queried. But this is tricky, and again, server-initiated query needs technologies like websocket or long polling.
You can try to make the same hacks from a special lightning component or from a loaded static JS library instead of Chrome extension, but I suspect you might encounter security limitations from LockerService.
edited Sep 25 at 3:59
answered Sep 24 at 21:23
Denis Volokhovskiy
112
112
add a comment |Â
add a comment |Â
up vote
0
down vote
What would be the use case of this (personally I can not think of any)? Possibly would help a bit more to find the correct solution to your problem. Seems like a case of over-engineering ;)
New contributor
add a comment |Â
up vote
0
down vote
What would be the use case of this (personally I can not think of any)? Possibly would help a bit more to find the correct solution to your problem. Seems like a case of over-engineering ;)
New contributor
add a comment |Â
up vote
0
down vote
up vote
0
down vote
What would be the use case of this (personally I can not think of any)? Possibly would help a bit more to find the correct solution to your problem. Seems like a case of over-engineering ;)
New contributor
What would be the use case of this (personally I can not think of any)? Possibly would help a bit more to find the correct solution to your problem. Seems like a case of over-engineering ;)
New contributor
New contributor
answered Sep 25 at 7:33
James Dinnes
11
11
New contributor
New contributor
add a comment |Â
add a comment |Â
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
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f232681%2fhow-to-read-salesforce-lightning-components-attributes-from-apex%23new-answer', 'question_page');
);
Post as a guest
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
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
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
1
Its actually very interesting question but my guess it is not possible to do something like that. LEX is like normal js framework and it is using standard client (web) server (backend apex) architecture. But maybe I am wrong and someone smarter would provide some more info about this topic
â user1974566
Sep 16 at 20:14
1
I agree with Charles. This seems like an X-Y problem. You might want to take a step back and explain what you're trying to do.
â sfdcfox
Sep 16 at 20:37
@sfdcfox Lightning components are stored as a JSON object... perhaps it's possible to query for them. But of course, as Charles says, we are probably trying to solve the wrong problem.
â Caspar Harmer
Sep 16 at 22:14
Of course, they would be in raw, unevaluated form... so many attributes would be invalid.
â Caspar Harmer
Sep 16 at 22:15