-
Notifications
You must be signed in to change notification settings - Fork 1
Implemented bulkified Queueable Apex version for after update #2
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
base: main
Are you sure you want to change the base?
Conversation
| cont.DummyJSON_Id__c = String.valueOf(Math.round(Math.random() * 100)); | ||
| } | ||
| if (Integer.valueOf(cont.DummyJSON_Id__c) <= 100 && !System.isFuture()) { | ||
| if (Integer.valueOf(cont.DummyJSON_Id__c) <= 100 && !System.isFuture() && !System.isQueueable()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
| update cont; | ||
|
|
||
| public static List<Id> postCreateDummyJSONUser(Set<Id> contactIds) { | ||
| Map<Id, String> jsonById = generateDummyJsonUserPayload(contactIds); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I probably wouldn't do it this way because you are iterating the contacts additional times.
I would call this inside of the contact for a loop.
Query the contacts before you enter the loop
| for (Contact cont : contacts) { | ||
| cont.DummyJSON_Last_Updated__c = Datetime.now(); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would move this inside the postCreatedummyJSON.
It's okay to update them after the code has finished but this logic seems like a part of the post.
|
This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation. |
1 similar comment
|
This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation. |
Alternative version of HW10.
I tried to bulkify afterUpdate part of the project implementing Queueable Apex. This led to changing the tests.