{"id":116,"date":"2019-02-19T13:49:16","date_gmt":"2019-02-19T13:49:16","guid":{"rendered":"http:\/\/morepalmer.org\/?p=116"},"modified":"2019-12-27T20:40:11","modified_gmt":"2019-12-27T20:40:11","slug":"cpq-self-service","status":"publish","type":"post","link":"https:\/\/morecpq.com\/index.php\/2019\/02\/19\/cpq-self-service\/","title":{"rendered":"CPQ Self Service"},"content":{"rendered":"\n<p>It looks like there is a need for some guidance here.&nbsp; Sorry I have been dormant for the last while.&nbsp; Busy busy with CPQ configurations and a growing company!&nbsp; \ud83d\ude00&nbsp;<br><br>As far as CPQ Self Service goes: This is not out of the box and when <a href=\"https:\/\/help.salesforce.com\/articleView?id=cpq_lightning_comm_parent.htm&amp;type=5\">this link<\/a> references Self Service with a Customer Community, it means that you can display your CPQ interface in a Customer Community.&nbsp; That is it.&nbsp; There&#8217;s no other special &#8220;Customer Only&#8221; interface that is nice and looks like a shopping cart you&#8217;d see on a website somewhere.<br><br>CPQ Self Service is a highly customized (Visual Force and APEX Code and javascript and CSS) way to give your customers an *almost* cart.&nbsp; I used the Line Editor and Configurator but that&#8217;s it.&nbsp; All other navigation is Visual Force.&nbsp; So here&#8217;s a high level step by step:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>Create Visual Force Page for entering in their contact information.&nbsp; We did it on the Lead and put a Lead reference on the SBQQ_Quote.<\/li><li>On Save (in APEX controller for VF Page), Create Lead, Create Quote, attach Quote to Lead, forward user to Line Editor for that Quote.<\/li><li>Remove all Custom Actions from the Line Editor.<\/li><li>Create Visual Force Page to navigate to&nbsp;after they&#8217;ve saved their Quote.<\/li><li>Create&nbsp;a&nbsp;Custom Action as a Save button that saves the Quote, generates the Outgoing Document, and then forwards the user to the above VF Page (all of this is APEX).<\/li><li>Make sure your VF Page has a link to the Outgoing Document generated above so the user can download it.<\/li><li>We also did things like:<ol><li>On Lead creation, assign it to a &#8220;Web Quotes&#8221; Queue so reps can follow up.<\/li><li>On Lead conversion, assign the created Opportunity to the Quote (attached to the Lead), make the Quote Primary, etc.<\/li><\/ol><\/li><\/ol>\n\n\n\n<p><strong>JIT User Creation<br><\/strong>Your self service solution may include the creation of users with JIT.  Here is some code to auto assign a CPQ license to the new user in a trigger on User.  Please note that proper updated APEX code standards should be adhered to.<\/p>\n\n\n\n<p><strong>User Trigger<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Trigger UserTriggers on User (after insert) {\n    \/\/ do the user trigger things.\n    UserTriggerHelper.doTriggers();\n}\n<\/code><\/pre>\n\n\n\n<p><strong>User Trigger Helper<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>public class UserTriggerHelper {\n    public static void doTriggers() {\n        If (trigger.isAfter) {\n            If (trigger.isInsert) {\n                UserTriggerHelper.grantCPQLicenseToCommunityUsers(trigger.new);\n            }\n        }\n    }\n    \n    \/\/ grant cpq license to community users.\n    private static void grantCPQLicenseToCommunityUsers(List&lt;User> users) {\n        \/\/ create list of user package licenses to insert.\n        List&lt;UserPackageLicense> uplsToInsert = new List&lt;UserPackageLicense>();\n\n        \/\/ query the package license for cpq.\n        PackageLicense pl = &#91;SELECT Id FROM PackageLicense WHERE NamespacePrefix = 'SBQQ'];\n\n        \/\/ query the community user profile.\n        Profile p = &#91;select id from Profile where Name = 'MyCommunityProfile'];\n\n        \/\/ loop through the users.\n        for (User u : users) {\n            \/\/ if this user's profile id equals the community user profile id,\n            if (u.ProfileId == p.id) {\n                \/\/ add a new user package license set to this user and the cpq package license \n                \/\/ to the user package licenses to insert list.\n                uplsToInsert.add(new UserPackageLicense(UserId = u.id, PackageLicenseId = pl.id));\n            }\n        }\n        \n        \/\/ if we have user package licenses to insert,\n        if (uplsToInsert.size() > 0) {\n            \/\/ insert the user package licenses.\n            insert uplsToInsert;\n        }\n    }\n}<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>It looks like there is a need for some guidance here.&nbsp; Sorry I have been dormant for the last while.&nbsp; Busy busy with CPQ configurations and a growing company!&nbsp; \ud83d\ude00&nbsp; As far as CPQ Self Service goes: This is not out of the box and when this link references Self Service with a Customer Community, &hellip;<br \/><a href=\"https:\/\/morecpq.com\/index.php\/2019\/02\/19\/cpq-self-service\/\" class=\"more-link pen_button pen_element_default pen_icon_arrow_double\">Continue reading <span class=\"screen-reader-text\">CPQ Self Service<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4,36],"tags":[40,6,38,39,37],"class_list":["post-116","post","type-post","status-publish","format-standard","hentry","category-cpq","category-community","tag-apex","tag-cpq","tag-self-service","tag-visualforce","tag-community"],"jetpack_featured_media_url":"","jetpack-related-posts":[],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/morecpq.com\/index.php\/wp-json\/wp\/v2\/posts\/116","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/morecpq.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/morecpq.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/morecpq.com\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/morecpq.com\/index.php\/wp-json\/wp\/v2\/comments?post=116"}],"version-history":[{"count":9,"href":"https:\/\/morecpq.com\/index.php\/wp-json\/wp\/v2\/posts\/116\/revisions"}],"predecessor-version":[{"id":493,"href":"https:\/\/morecpq.com\/index.php\/wp-json\/wp\/v2\/posts\/116\/revisions\/493"}],"wp:attachment":[{"href":"https:\/\/morecpq.com\/index.php\/wp-json\/wp\/v2\/media?parent=116"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/morecpq.com\/index.php\/wp-json\/wp\/v2\/categories?post=116"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/morecpq.com\/index.php\/wp-json\/wp\/v2\/tags?post=116"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}