{"id":2924,"date":"2012-06-11T01:44:33","date_gmt":"2012-06-10T20:14:33","guid":{"rendered":"http:\/\/JitendraZaa.com\/blog\/?p=2924"},"modified":"2012-06-11T01:44:33","modified_gmt":"2012-06-10T20:14:33","slug":"apex-based-ddp-generation-using-looplus","status":"publish","type":"post","link":"https:\/\/www.jitendrazaa.com\/blog\/salesforce\/apex-based-ddp-generation-using-looplus\/","title":{"rendered":"APEX based DDP generation using LOOPlus"},"content":{"rendered":"<p style=\"text-align: justify;\">To automate the document generation in salesforce, we have two well known AppEchange products named &#8220;<a title=\"Conga Composer\" href=\"https:\/\/www.appextremes.com\/\" rel=\"nofollow\">Conga Composer<\/a>&#8221; and &#8220;<a title=\"LOOPlus product for Salesforce\" href=\"http:\/\/support.drawloop.com\/salesforce\/looplus\/ddp-wizard\/\" rel=\"nofollow\">LOOPlus from DrawLoop<\/a>&#8220;. Both products are well used in industry and both have advantages and disadvantages over the need and situation.<\/p>\n<p style=\"text-align: justify;\">This article depicts automating the document generation using Apex in LOOPlus. As i have been through this situation and didn&#8217;t find any resource on web to automate the document generation using Apex, so i thought to put this article.<\/p>\n<p><span style=\"text-decoration: underline;\"><strong>Advantage of LOOPlus over Conga Composer:<\/strong><\/span><\/p>\n<ul>\n<li style=\"text-align: justify;\">The one advantage which i know is that using LOOPlus you can combine all the attachments into single one which is not possible in Conga Composer.<\/li>\n<\/ul>\n<p>Navigate to <a title=\"Install Drawloop from AppExchange\" href=\"http:\/\/appexchange.salesforce.com\/listingDetail?listingId=a0N300000016Zn3EAE\" rel=\"nofollow\">this URL to install the trial version<\/a> of Drawloop (LOOPlus) from AppExchange.<\/p>\n<p style=\"text-align: justify;\">To use the Drawloop API we need to use the &#8220;<strong>Business<\/strong>&#8221; version of LOOPlus. To activate this, navigate to &#8220;LOOP&#8221; app and then &#8220;DDP Admin&#8221;. Click on button &#8220;<strong>Modify Subscription services<\/strong>&#8220;. New Page will open, select &#8220;Business&#8221; in LOOPlus level as shown in below image.<\/p>\n<figure id=\"attachment_2962\" aria-describedby=\"caption-attachment-2962\" style=\"width: 630px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/jitendrazaa.com\/blog\/wp-content\/uploads\/2012\/06\/Enabling-Business-Version-of-DrawLoop.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\" wp-image-2962 \" title=\"Enabling Business Version of DrawLoop\" src=\"https:\/\/i0.wp.com\/jitendrazaa.com\/blog\/wp-content\/uploads\/2012\/06\/Enabling-Business-Version-of-DrawLoop.png?resize=630%2C640&#038;ssl=1\" alt=\"Enabling Business Version of DrawLoop\" width=\"630\" height=\"640\" \/><\/a><figcaption id=\"caption-attachment-2962\" class=\"wp-caption-text\">Enabling Business Version of DrawLoop<\/figcaption><\/figure>\n<p><!--more-->After this step, email &#8220;<em><span style=\"text-decoration: underline;\">loopsupport@drawloop.com<\/span><\/em>&#8221; to enable Outbound Messaging for your organization, only after that you can use the Apex for LOOPlus.<\/p>\n<p>For this article,<a title=\"Drawloop Help and Tutorial\" href=\"http:\/\/support.drawloop.com\/salesforce\/looplus\/ddp-wizard\/\" rel=\"nofollow\"> i hope that you already know how to generate the DDP using DDP wizard<\/a>.<\/p>\n<p>Consider below DDP is generated for this article:<\/p>\n<figure id=\"attachment_2963\" aria-describedby=\"caption-attachment-2963\" style=\"width: 604px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/jitendrazaa.com\/blog\/wp-content\/uploads\/2012\/06\/DDP-Using-LOOPlus-of-Drawloop.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\" wp-image-2963 \" title=\"DDP Using LOOPlus of Drawloop\" src=\"https:\/\/i0.wp.com\/jitendrazaa.com\/blog\/wp-content\/uploads\/2012\/06\/DDP-Using-LOOPlus-of-Drawloop.png?resize=604%2C476&#038;ssl=1\" alt=\"DDP Using LOOPlus of Drawloop\" width=\"604\" height=\"476\" \/><\/a><figcaption id=\"caption-attachment-2963\" class=\"wp-caption-text\">DDP Using LOOPlus of Drawloop<\/figcaption><\/figure>\n<p>We need below two ID for using Apex:<\/p>\n<ol>\n<li>ID of the DDP as shown in above image<\/li>\n<li>ID of the Delivery Option (We can have more than one ID but we need only one ID of Attachment type of delivery option)<\/li>\n<\/ol>\n<p style=\"text-align: justify;\">I am going to add one button in List View of &#8220;Opportunity&#8221; and when i will select the opportunities, and click on that button Visualforce Page will invoke resulting in execution of DDP from Apex.<\/p>\n<p><span style=\"text-decoration: underline;\"><strong>Visualforce code:<\/strong><\/span><\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\n&lt;apex:page standardController=&quot;Opportunity&quot; recordSetVar=&quot;opportunities&quot; extensions=&quot;MassLoop&quot; action=&quot;{!massMerge}&quot; &gt;&lt;\/apex:page&gt;\n<\/pre>\n<p><span style=\"text-decoration: underline;\"><strong>Apex code (Extension class):<\/strong><\/span><\/p>\n<pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\npublic class MassLoop{\n    private final List&lt;Opportunity&gt; opps;\n    public MassLoop(ApexPages.StandardSetController controller) {\n             this.opps =  (List&lt;Opportunity&gt;) controller.getSelected();\n    }\n    public PageReference massMerge(){\n        try{\n            for(Opportunity opp : opps){\n                List&lt;Attachment&gt; nas= &#x5B;select id,name from Attachment where parentid=:opp.id];\n                String attachIds='';\n                for(Attachment na :nas){\n                        attachIds = attachIds+na.id+'|';\n                }\n                Map&lt;string, string&gt; variables;\n                if(attachIds.length()&gt;1){\n                    attachIds = attachIds.substring(0,attachIds.length()-1);\n\/\/Below ID is of the &quot;Delivery Option&quot; of DDP\n                    variables = new Map&lt;string, string&gt; { 'deploy' =&gt; 'a059000000169y6','attachIds'=&gt;attachIds };\n                }\n                else{\n                    variables = new Map&lt;string, string&gt; { 'deploy' =&gt; 'a059000000169y6' };\n                }\n\/\/Below ID is of main &quot;DDP&quot;\n                Loop.loopMessage.send(opp.id,'a069000000EQduC',variables, 'ap1');\n            }\n           }\n           catch(Exception e){\n               system.debug('--------e-----:'+e);\n           }\n           PageReference page = new PageReference('\/006\/o');\n           page.setRedirect(true);\n           return page;\n    }\n}\n<\/pre>\n<p style=\"text-align: justify;\"><strong>Note :<\/strong> Only 10 records can be selected at a time because it calls the webservice of loop to generate the document and as per Salesforce limit we can have only 10 callout per transaction.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Example of generating dynamic document packages (DDP) using Apex and LOOPlus in Salesforce<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"advanced_seo_description":"","jetpack_seo_html_title":"","jetpack_seo_noindex":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"jz_research_post":"","_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_post_was_ever_published":false},"categories":[20,9],"tags":[337,40,331],"class_list":["post-2924","post","type-post","status-publish","format-standard","hentry","category-apex","category-salesforce","tag-apex","tag-appexchange","tag-salesforce"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":4698,"url":"https:\/\/www.jitendrazaa.com\/blog\/salesforce\/my-favorite-appexchange-products\/","url_meta":{"origin":2924,"position":0},"title":"Top Salesforce tools , AppExchange and Heroku applications","author":"Jitendra","date":"July 1, 2015","format":false,"excerpt":"List of all my favorite Appexchange products, Heroku applications , Git repository , Free Source codes and some important Blog posts in Salesforce","rel":"","context":"In &quot;Salesforce&quot;","block_context":{"text":"Salesforce","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/salesforce\/"},"img":{"alt_text":"Top Salesforce Tools","src":"https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2015\/07\/Top-Salesforce-Tools.png?fit=1200%2C675&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2015\/07\/Top-Salesforce-Tools.png?fit=1200%2C675&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2015\/07\/Top-Salesforce-Tools.png?fit=1200%2C675&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2015\/07\/Top-Salesforce-Tools.png?fit=1200%2C675&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2015\/07\/Top-Salesforce-Tools.png?fit=1200%2C675&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":6274,"url":"https:\/\/www.jitendrazaa.com\/blog\/salesforce\/enterprise-territory-management-auto-account-assignment-using-apex\/","url_meta":{"origin":2924,"position":1},"title":"Enterprise Territory Management &#8211; Auto Account Assignment using Apex","author":"Jitendra","date":"September 22, 2017","format":false,"excerpt":"Use Apex code to auto assign Accounts on basis of Enterprise Territory Assignment rules","rel":"","context":"In &quot;Salesforce&quot;","block_context":{"text":"Salesforce","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/salesforce\/"},"img":{"alt_text":"Enterprise Territory - Auto Account Assignment using Apex","src":"https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2017\/09\/Enterprise-Territory-Auto-Account-Assignment-using-Apex.jpg?fit=900%2C600&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2017\/09\/Enterprise-Territory-Auto-Account-Assignment-using-Apex.jpg?fit=900%2C600&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2017\/09\/Enterprise-Territory-Auto-Account-Assignment-using-Apex.jpg?fit=900%2C600&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2017\/09\/Enterprise-Territory-Auto-Account-Assignment-using-Apex.jpg?fit=900%2C600&ssl=1&resize=700%2C400 2x"},"classes":[]},{"id":2998,"url":"https:\/\/www.jitendrazaa.com\/blog\/salesforce\/apex-based-sharing-in-salesforce\/","url_meta":{"origin":2924,"position":2},"title":"Apex based record sharing in Salesforce","author":"Jitendra","date":"July 27, 2012","format":false,"excerpt":"Working with Apex based sharing in Salesforce","rel":"","context":"In &quot;Apex&quot;","block_context":{"text":"Apex","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/salesforce\/apex\/"},"img":{"alt_text":"Salesforce Apex Sharing Reason","src":"https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2012\/07\/Salesforce-Apex-Sharing-Reason.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2012\/07\/Salesforce-Apex-Sharing-Reason.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2012\/07\/Salesforce-Apex-Sharing-Reason.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2012\/07\/Salesforce-Apex-Sharing-Reason.png?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2012\/07\/Salesforce-Apex-Sharing-Reason.png?resize=1050%2C600&ssl=1 3x"},"classes":[]},{"id":6877,"url":"https:\/\/www.jitendrazaa.com\/blog\/salesforce\/get-picklist-values-in-apex\/","url_meta":{"origin":2924,"position":3},"title":"Get Picklist Values in Apex","author":"Jitendra","date":"August 22, 2017","format":false,"excerpt":"Code snippet of reading Picklist values in Salesforce Apex","rel":"","context":"In &quot;Salesforce&quot;","block_context":{"text":"Salesforce","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/salesforce\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":2501,"url":"https:\/\/www.jitendrazaa.com\/blog\/salesforce\/very-useful-tips-and-tricks-of-the-apex-salesforce-interview-questions-part-4\/","url_meta":{"origin":2924,"position":4},"title":"Latest Salesforce Interview Questions &#8211; Part 4 &#8211; Related to Dynamic Apex","author":"Jitendra","date":"November 27, 2011","format":false,"excerpt":"Most Frequently Asked interview questions of Apex, Dynamic Apex, SOSL, Visualforce, SOQL in Salesforce.com SFDC","rel":"","context":"In &quot;Salesforce&quot;","block_context":{"text":"Salesforce","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/salesforce\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":7770,"url":"https:\/\/www.jitendrazaa.com\/blog\/salesforce\/salesforce-integration-with-chatgpt\/","url_meta":{"origin":2924,"position":5},"title":"Salesforce Integration with ChatGPT","author":"Jitendra","date":"April 22, 2023","format":false,"excerpt":"Enhancing Conversational AI Capabilities and Ensuring Security","rel":"","context":"In &quot;Salesforce&quot;","block_context":{"text":"Salesforce","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/salesforce\/"},"img":{"alt_text":"Salesforce integration with chatGPT","src":"https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2023\/04\/Salesforce-integration-with-chatGPT.png?fit=1200%2C675&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2023\/04\/Salesforce-integration-with-chatGPT.png?fit=1200%2C675&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2023\/04\/Salesforce-integration-with-chatGPT.png?fit=1200%2C675&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2023\/04\/Salesforce-integration-with-chatGPT.png?fit=1200%2C675&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2023\/04\/Salesforce-integration-with-chatGPT.png?fit=1200%2C675&ssl=1&resize=1050%2C600 3x"},"classes":[]}],"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/posts\/2924","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/comments?post=2924"}],"version-history":[{"count":0,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/posts\/2924\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/media?parent=2924"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/categories?post=2924"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/tags?post=2924"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}