Referring to 21:00 - 24:00: The checkbox isn't actually needed since we have an email input. We can base the decision to fire the apex action on the email input not being empty when the "email invoice" button is clicked.
True, you can now also use the "was_visited" and select the screen in your decision, in this scenario. Thank you for this video! Edit2: you can set required="True" in the email field properties :D
Hi Chris , Thank you for your video it's very useful. I need it on the Oppertunity record and want to use a quote template instead of a Visualforce page. How can we achieve this?
An unhandled fault has occurred in this flow An unhandled fault has occurred while processing the flow. Please contact your system administrator for more information. Could you please assist on this
Hey Chris, thank you so much for taking the time to make these videos. I'm a SQL developer now working with Salesforce, so your videos are helping me get a better understanding of programming in Apex. I used this solution for the basis for sending a PDF attachment via email from a flow. It works in my sandbox, but when I go to deploy it in production, it says I only have 74% code coverage. I'm unsure how I would test these particular classes. Are you able to provide any assistance?
Hey E N, glad you found them useful! I'll post a test class for this in the next day or two on Github and will update this thread with the link but for now somethings you could do to test (and get the required code coverage) are: - Create instance of invoicePDFController - Call generatePDF method and then do some assertions such as what is shown in the second half of this stack exchange selected answer: salesforce.stackexchange.com/questions/374496/how-to-write-a-test-class-for-this-below-code-can-anyone-help-me Let me know if you have any other questions.
@E N Here you go: gist.github.com/chrismarquezdev/c22a3faaaa4fc6acfb6bb5bc6fe73dad I put some comments in the test class to try to explain what I did. I did make a small change to the InvoicePDFController itself on line 40. Turns out doing a getContent call is not allowed during testing so I added check for that. Let me know if you have any questions.
I think I lost the exact files but I do have a Github Gist based on a more recent video that I made: gist.github.com/Christriane/17ab590a6ea486140107687fca79b19f
Hi Chris, nice Video! So is ist possible to enter text into the screen element which is then displayed in the pdf that is created? Greetings from Germany
Thanks! Yes it is possible. I'll upload a video on Tuesday but you could do the following: - Create variables that have the getter/setter and reference them in your VF Page - Create screen elements in the flow and use the "Set Args" assignment to add that to the collection variable. - Extract the variables in the InvocableMethod the same way that the accountId and email are. - Pass the variables as params into the VF pageReference the same way that the accountId is. - Assign the params to the variables you created in step 1 in the constructor just like the accountId. Something to note is that there is probably a character limit that you can pass in via the params. It may also be possible using a class that has variables with the InvocableVariable annotation. I'm not as familiar with this so I'll look into it and will make a video if I figure it out.
@@ChrisMarquez hi Chris, i watched it already. Keep up the great work. From now on I'm a proud subscriber. If you ever think about a interesting topic it would be creating .Xlsx with visualforce. Doing xls seems quite easy while xlsx is quite hard to achive
How are you able to get around the need to have the Visualforce page needing to be part of the org's remote site settings? I am receiving this error: FATAL_ERROR System.VisualforceException: core.apexpages.exceptions.ApexPagesGenericException: The page can't be loaded because the remote site apex/[GeneratePDFPageName] isn't listed in your organization's Remote Sites Settings. This is getting hit when attempting to call the pagereference.getContent() method in the controller.
Good video! Mate you are making my life at work easier two days in a row with these videos xD
Glad to hear it!
Referring to 21:00 - 24:00:
The checkbox isn't actually needed since we have an email input. We can base the decision to fire the apex action on the email input not being empty when the "email invoice" button is clicked.
True, you can now also use the "was_visited" and select the screen in your decision, in this scenario. Thank you for this video!
Edit2: you can set required="True" in the email field properties :D
Excellent video. Thanks for sharing your knowledge
No problem. Let me know if there are any topics you want me to cover.
Thank you chris
Great solution thnx !! if only we have access to the test class we would be very grateful
I'm just seeing this comment, sorry about that. Here's a test class: gist.github.com/Christriane/c22a3faaaa4fc6acfb6bb5bc6fe73dad
Hi Chris , Thank you for your video it's very useful. I need it on the Oppertunity record and want to use a quote template instead of a Visualforce page. How can we achieve this?
No prob! I'll look into this and will get back to you.
Error: Generate PDF Flow
An unhandled fault has occurred in this flow
An unhandled fault has occurred while processing the flow. Please contact your system administrator for more information. Could you please assist on this
Hey Chris, thank you so much for taking the time to make these videos. I'm a SQL developer now working with Salesforce, so your videos are helping me get a better understanding of programming in Apex. I used this solution for the basis for sending a PDF attachment via email from a flow. It works in my sandbox, but when I go to deploy it in production, it says I only have 74% code coverage. I'm unsure how I would test these particular classes. Are you able to provide any assistance?
Hey E N, glad you found them useful!
I'll post a test class for this in the next day or two on Github and will update this thread with the link but for now somethings you could do to test (and get the required code coverage) are:
- Create instance of invoicePDFController
- Call generatePDF method and then do some assertions such as what is shown in the second half of this stack exchange selected answer: salesforce.stackexchange.com/questions/374496/how-to-write-a-test-class-for-this-below-code-can-anyone-help-me
Let me know if you have any other questions.
@@ChrisMarquez Thanks Chris, I appreciate your help. I'll keep an eye out for your update and will look into your other suggestions in the meantime.
@@ChrisMarquez After having at your suggestion, what I'm struggling with is passing the parameters to generatePDF as it's a list.
@E N Here you go: gist.github.com/chrismarquezdev/c22a3faaaa4fc6acfb6bb5bc6fe73dad
I put some comments in the test class to try to explain what I did. I did make a small change to the InvoicePDFController itself on line 40. Turns out doing a getContent call is not allowed during testing so I added check for that.
Let me know if you have any questions.
@@ChrisMarquez I am not able to get your code on this link. it shows 404 error. You have made an Excellent video.
Excellent... Could you please provide the code?
I think I lost the exact files but I do have a Github Gist based on a more recent video that I made: gist.github.com/Christriane/17ab590a6ea486140107687fca79b19f
Hi Chris, nice Video! So is ist possible to enter text into the screen element which is then displayed in the pdf that is created?
Greetings from Germany
Thanks! Yes it is possible. I'll upload a video on Tuesday but you could do the following:
- Create variables that have the getter/setter and reference them in your VF Page
- Create screen elements in the flow and use the "Set Args" assignment to add that to the collection variable.
- Extract the variables in the InvocableMethod the same way that the accountId and email are.
- Pass the variables as params into the VF pageReference the same way that the accountId is.
- Assign the params to the variables you created in step 1 in the constructor just like the accountId.
Something to note is that there is probably a character limit that you can pass in via the params.
It may also be possible using a class that has variables with the InvocableVariable annotation. I'm not as familiar with this so I'll look into it and will make a video if I figure it out.
Here you go: ruclips.net/video/1Y61KsNjtO8/видео.html
@@ChrisMarquez hi Chris, i watched it already. Keep up the great work. From now on I'm a proud subscriber. If you ever think about a interesting topic it would be creating .Xlsx with visualforce. Doing xls seems quite easy while xlsx is quite hard to achive
Thank you, I appreciate that. I'll look into.
Can we generate invoice pdf without email?
Yes, refer to this video for an example: ruclips.net/video/YLeaqe82eJE/видео.html
How are you able to get around the need to have the Visualforce page needing to be part of the org's remote site settings?
I am receiving this error:
FATAL_ERROR System.VisualforceException: core.apexpages.exceptions.ApexPagesGenericException: The page can't be loaded because the remote site apex/[GeneratePDFPageName] isn't listed in your organization's Remote Sites Settings.
This is getting hit when attempting to call the pagereference.getContent() method in the controller.