-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Data table not working if Id field on record is not set #7
Comments
Eric, the "funny" thing is that when I assign the ProductRequestLineItem.Id to a valid Id (which does NOT exist as a record anymore), it seems to work fine. Appreciate your thoughts on this. |
Eric, update: I added a method to generate a "fake" id for an SObject which you can call from flow using the method of Financial Force library which can be found here: https://github.com/apex-enterprise-patterns/fflib-apex-mocks/blob/master/sfdx-source/apex-mocks/main/classes/fflib_IDGenerator.cls. I adopted the method to be called from a Flow, and return a record Id, and then the data table works fine. If you're interested in the code, let me know. |
That's a great workaround. I'd love to see your solution.
Eric
…On Fri, Jul 17, 2020 at 9:19 AM Patrick Brinksma ***@***.***> wrote:
Eric, update:
I added a method to generate a "fake" id for an SObject which you can call
from flow using the method of Financial Force library which can be found
here:
https://github.com/apex-enterprise-patterns/fflib-apex-mocks/blob/master/sfdx-source/apex-mocks/main/classes/fflib_IDGenerator.cls
.
I adopted the method to be called from a Flow, and return a record Id, and
then the data table works fine. If you're interested in the code, let me
know.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#7 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AF4UHX5HJRZNZHW6W4QOUZDR4BFWDANCNFSM4O4SHD3A>
.
|
Eric, I create a fork, and put the additions in a separate branch. So I added a method "generateSObjectId" here https://github.com/patrickbrinksma/DatatableV2/blob/VirtualSalesforceId/force-app/main/default/classes/SObjectController2.cls which you can call from a Flow, and also added a test method here: https://github.com/patrickbrinksma/DatatableV2/blob/VirtualSalesforceId/force-app/main/default/classes/SObjectController2Test.cls Let me know if you can access these. In the flow, for each new record you want to "preview", you call this method with a counter and the API Name of the SObject. |
Well done. I'll add this to the roadmap for a future release.
Eric
…On Mon, Jul 20, 2020 at 7:48 AM Patrick Brinksma ***@***.***> wrote:
Eric,
I create a fork, and put the additions in a separate branch. So I added a
method "generateSObjectId" here
https://github.com/patrickbrinksma/DatatableV2/blob/VirtualSalesforceId/force-app/main/default/classes/SObjectController2.cls
which you can call from a Flow, and also added a test method here:
https://github.com/patrickbrinksma/DatatableV2/blob/VirtualSalesforceId/force-app/main/default/classes/SObjectController2Test.cls
Let me know if you can access these.
In the flow, for each new record you want to "preview", you call this
method with a counter and the API Name of the SObject.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#7 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AF4UHX67SQAVJD7X3IDVX43R4QVKDANCNFSM4O4SHD3A>
.
|
Hi Eric, wanted to make you aware of an update. We had a required to show a list of uncommitted records, and so I refactored the method to allow for the creation of a collection of "virtual" object ids. So you would determine in the flow how many record ids you need, call the Apex Action once, and get a collection of Object Ids back. Code is available in the fork. |
Thanks for the update.
…On Thu, Jul 30, 2020 at 9:07 AM Patrick Brinksma ***@***.***> wrote:
Hi Eric, wanted to make you aware of an update. We had a required to show
a list of uncommitted records, and so I refactored the method to allow for
the creation of a collection of "virtual" object ids.
So you would determine in the flow how many record ids you need, call the
Apex Action once, and get a collection of Object Ids back.
Code is available in the fork.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#7 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AF4UHXYFEHXFODLUDMMCWC3R6FWB7ANCNFSM4O4SHD3A>
.
|
Hi Eric, I stumbled upon the same problem while writing a mass upserter for a custom object (which mixes existing and new records in a record collection). Do you remember the last commit or version, where this worked? |
Clifford - the only version I know of that supports this would be the
changed version that Patrick created.
…On Wed, Aug 19, 2020 at 10:34 AM Clifford ***@***.***> wrote:
Hi Eric, I stumbled upon the same problem while writing a mass upserter
for a custom object (which mixes existing and new records in a record
collection). Do you remember the last commit or version, where this worked?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#7 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AF4UHXYHPMN7UZAYPX4MHT3SBPPH5ANCNFSM4O4SHD3A>
.
|
Clifford, happy to share the code, just let me know. |
Thanks patrick, I saw your code in commit 7f09fb5 but think it won't work well with my Mass Upserter usecase. I will probably go the long way and use a custom apex object |
Clifford, in a later commit, 5d1ec01, I adjusted to code to be able to return a collection of Ids, not sure if that helps in your use case. |
Patrick, Correct me if I am wrong, but it sounds like you are setting Id to the value from your generator in the collection elsewhere in the flow before the collection is displayed in the data table, correct? If the purpose of the data table is to display data to be inserted, then wouldn't you also have to strip the Id out of the collection before doing the actual insert step? Erik, I love the data table component. In some of my use cases, I am weighing whether to pursue modifying my flow to manage handling Ids for records to be inserted or waiting for your update which I am guessing will just assign the ids temporarily before passing the records back to the output collection? If that is the intent, do you know when that future release might happen? Thanks |
I don't have a timeframe yet for adding this feature.
…On Fri, Oct 2, 2020 at 9:26 AM mikbranchaud ***@***.***> wrote:
Patrick,
Correct me if I am wrong, but it sounds like you are setting Id to the
value from your generator in the collection elsewhere in the flow before
the collection is displayed in the data table, correct? If the purpose of
the data table is to display data to be inserted, then wouldn't you also
have to strip the Id out of the collection before doing the actual insert
step?
Erik,
I love the data table component. In some of my use cases, I am weighing
whether to pursue modifying my flow to manage handling Ids for records to
be inserted or waiting for your update which I am guessing will just assign
the ids temporarily before passing the records back to the output
collection? If that is the intent, do you know when that future release
might happen?
Thanks
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#7 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AF4UHX7TWD7CM2JNHSCJRALSIXII3ANCNFSM4O4SHD3A>
.
|
@mikbranchaud that is correct. First retrieve the collections of Ids, create the collection of records to be inserted, and assign each an Id. If you want to insert the records, I think you'd have to blank the Id value. I haven't tested it in much detail to be honest as it was a proof of concept I did it for. |
I am also attempting to display a records collection prior to creation, and while I am very grateful for this workaround, wouldn't it be simpler to simply remove the restriction preventing the display of records without an id? Or is that hardcoded/required somewhere deep in the component itself and creating mock ids is the only way to make it work? It just seems like an awfully complex way to get around what could be a simple restriction. |
Hi Eric, we just starting using the component - so many thanks for making it available - but we hit a (known) issue.
Use case:
This doesn't work, error: SObject cannot be read
When I query existing records from ProductRequestLineItem, it does work.
Is this the known limitation?
Appreciate your reply.
The text was updated successfully, but these errors were encountered: