{"id":993,"date":"2021-05-25T17:18:48","date_gmt":"2021-05-25T17:18:48","guid":{"rendered":"http:\/\/morecpq.com\/?p=993"},"modified":"2022-10-20T18:25:56","modified_gmt":"2022-10-20T18:25:56","slug":"cpq-consortia-quote-by-location","status":"publish","type":"post","link":"https:\/\/morecpq.com\/index.php\/2021\/05\/25\/cpq-consortia-quote-by-location\/","title":{"rendered":"CPQ &#8211; Consortia! (Quote by Location)"},"content":{"rendered":"\n<p>Have you ever wanted to Quote by location?  Do you have a client who MUST be able to quote by location?  Look no further!  Well, look a LITTLE further.  Like down this article.  This solution involves Account Hierarchy, some Custom Fields, Quote Line Groups, a Fieldset, a Process Builder, a Price Rule, and a QCP!  But have no fear, it is all right HERE!<\/p>\n\n\n\n<p><strong>Set Up Account Hierarchy<br><\/strong>This solution works with the out of the box Account Hierarchy mechanism in Salesforce.  Make sure your accounts are set up accordingly.  Parent Accounts that have child (location) Accounts.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img data-recalc-dims=\"1\" decoding=\"async\" width=\"341\" height=\"226\" src=\"https:\/\/i0.wp.com\/morecpq.com\/wp-content\/uploads\/2021\/05\/image.png?resize=341%2C226\" alt=\"\" class=\"wp-image-1010\" srcset=\"https:\/\/i0.wp.com\/morecpq.com\/wp-content\/uploads\/2021\/05\/image.png?w=341&amp;ssl=1 341w, https:\/\/i0.wp.com\/morecpq.com\/wp-content\/uploads\/2021\/05\/image.png?resize=300%2C199&amp;ssl=1 300w\" sizes=\"(max-width: 341px) 100vw, 341px\" \/><\/figure>\n<\/div>\n\n\n<p><strong>Custom Fields<br><\/strong><em>Quote Line Group<br><\/em>&#8211; Add Location Field.  Lookup(Account)<br>&#8211; Make sure you set up the filter to only show Accounts where Quote Line Group: Account ID = Location: Parent Account ID<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img data-recalc-dims=\"1\" decoding=\"async\" width=\"940\" height=\"552\" src=\"https:\/\/i0.wp.com\/morecpq.com\/wp-content\/uploads\/2021\/05\/image-1-1024x601.png?resize=940%2C552\" alt=\"\" class=\"wp-image-1012\" srcset=\"https:\/\/i0.wp.com\/morecpq.com\/wp-content\/uploads\/2021\/05\/image-1.png?resize=1024%2C601&amp;ssl=1 1024w, https:\/\/i0.wp.com\/morecpq.com\/wp-content\/uploads\/2021\/05\/image-1.png?resize=300%2C176&amp;ssl=1 300w, https:\/\/i0.wp.com\/morecpq.com\/wp-content\/uploads\/2021\/05\/image-1.png?resize=768%2C451&amp;ssl=1 768w, https:\/\/i0.wp.com\/morecpq.com\/wp-content\/uploads\/2021\/05\/image-1.png?w=1062&amp;ssl=1 1062w\" sizes=\"(max-width: 940px) 100vw, 940px\" \/><\/figure>\n<\/div>\n\n\n<p>&#8211; Add Location Name Field.  Formula -&gt; point this to Location__r.Name<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img data-recalc-dims=\"1\" decoding=\"async\" width=\"940\" height=\"378\" src=\"https:\/\/i0.wp.com\/morecpq.com\/wp-content\/uploads\/2021\/05\/image-2-1024x412.png?resize=940%2C378\" alt=\"\" class=\"wp-image-1014\" srcset=\"https:\/\/i0.wp.com\/morecpq.com\/wp-content\/uploads\/2021\/05\/image-2.png?resize=1024%2C412&amp;ssl=1 1024w, https:\/\/i0.wp.com\/morecpq.com\/wp-content\/uploads\/2021\/05\/image-2.png?resize=300%2C121&amp;ssl=1 300w, https:\/\/i0.wp.com\/morecpq.com\/wp-content\/uploads\/2021\/05\/image-2.png?resize=768%2C309&amp;ssl=1 768w, https:\/\/i0.wp.com\/morecpq.com\/wp-content\/uploads\/2021\/05\/image-2.png?w=1068&amp;ssl=1 1068w\" sizes=\"(max-width: 940px) 100vw, 940px\" \/><\/figure>\n<\/div>\n\n\n<p><br><br><em>Quote Line, Opportunity Product, Subscription, Asset, Order Product<br><\/em>&#8211; Add Location Field.  Lookup(Account)  (Same field!  All objects!)<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img data-recalc-dims=\"1\" decoding=\"async\" width=\"940\" height=\"406\" src=\"https:\/\/i0.wp.com\/morecpq.com\/wp-content\/uploads\/2021\/05\/image-3-1024x442.png?resize=940%2C406\" alt=\"\" class=\"wp-image-1016\" srcset=\"https:\/\/i0.wp.com\/morecpq.com\/wp-content\/uploads\/2021\/05\/image-3.png?resize=1024%2C442&amp;ssl=1 1024w, https:\/\/i0.wp.com\/morecpq.com\/wp-content\/uploads\/2021\/05\/image-3.png?resize=300%2C129&amp;ssl=1 300w, https:\/\/i0.wp.com\/morecpq.com\/wp-content\/uploads\/2021\/05\/image-3.png?resize=768%2C331&amp;ssl=1 768w, https:\/\/i0.wp.com\/morecpq.com\/wp-content\/uploads\/2021\/05\/image-3.png?w=1064&amp;ssl=1 1064w\" sizes=\"(max-width: 940px) 100vw, 940px\" \/><\/figure>\n<\/div>\n\n\n<p><strong>Quote Line Groups<br><\/strong>Add the Location field to the Line Editor fieldset on Quote Line Group.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img data-recalc-dims=\"1\" decoding=\"async\" width=\"677\" height=\"364\" src=\"https:\/\/i0.wp.com\/morecpq.com\/wp-content\/uploads\/2021\/05\/image-4.png?resize=677%2C364\" alt=\"\" class=\"wp-image-1018\" srcset=\"https:\/\/i0.wp.com\/morecpq.com\/wp-content\/uploads\/2021\/05\/image-4.png?w=677&amp;ssl=1 677w, https:\/\/i0.wp.com\/morecpq.com\/wp-content\/uploads\/2021\/05\/image-4.png?resize=300%2C161&amp;ssl=1 300w\" sizes=\"(max-width: 677px) 100vw, 677px\" \/><\/figure>\n<\/div>\n\n\n<p><strong>Account<br><\/strong>Create fieldset called &#8220;CPQ_Lookup&#8221; with Account Name and Address fields in it.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img data-recalc-dims=\"1\" decoding=\"async\" width=\"367\" height=\"358\" src=\"https:\/\/i0.wp.com\/morecpq.com\/wp-content\/uploads\/2021\/05\/image-5.png?resize=367%2C358\" alt=\"\" class=\"wp-image-1020\" srcset=\"https:\/\/i0.wp.com\/morecpq.com\/wp-content\/uploads\/2021\/05\/image-5.png?w=367&amp;ssl=1 367w, https:\/\/i0.wp.com\/morecpq.com\/wp-content\/uploads\/2021\/05\/image-5.png?resize=300%2C293&amp;ssl=1 300w\" sizes=\"(max-width: 367px) 100vw, 367px\" \/><\/figure>\n<\/div>\n\n\n<p><strong>Custom Script&nbsp;&#8211; QCP<br><\/strong>Here is the QCP (Javascript) code that copies the Location account&#8217;s Name value to the Quote Line Group&#8217;s Name field.<\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code>export function onAfterCalculate(quote, lines, conn) {\n    quote.groups.forEach(function(group) {\n        if (group.record != null) {\n            group.record&#91;'SBQQ__Account__c'] = quote.record&#91;'SBQQ__Account__c'];\n            if(group.record&#91;'Location_Name__c'] != null &amp;&amp; group.record&#91;'Location_Name__c'] != '') {\n                group.record&#91;'Name'] = group.record&#91;'Location_Name__c'];\n            }\n        }\n    });\n    return Promise.resolve();\n}<\/code><\/pre>\n\n\n\n<p>Create the QCP as a Custom Script record.<br>&#8211; Quote Fields<br>SBQQ__Account__c<br><br>&#8211; Quote Line Group Fields<br>SBQQ__Account__c<br>Name<br>Location_Name__c<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" decoding=\"async\" width=\"940\" height=\"630\" src=\"https:\/\/i0.wp.com\/morecpq.com\/wp-content\/uploads\/2021\/05\/image-7.png?resize=940%2C630\" alt=\"\" class=\"wp-image-1029\" srcset=\"https:\/\/i0.wp.com\/morecpq.com\/wp-content\/uploads\/2021\/05\/image-7.png?w=967&amp;ssl=1 967w, https:\/\/i0.wp.com\/morecpq.com\/wp-content\/uploads\/2021\/05\/image-7.png?resize=300%2C201&amp;ssl=1 300w, https:\/\/i0.wp.com\/morecpq.com\/wp-content\/uploads\/2021\/05\/image-7.png?resize=768%2C515&amp;ssl=1 768w\" sizes=\"(max-width: 940px) 100vw, 940px\" \/><\/figure>\n\n\n\n<p>Configure the Custom Script as the Quote Calculator Plugin in the CPQ Package Settings.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" decoding=\"async\" width=\"940\" height=\"287\" src=\"https:\/\/i0.wp.com\/morecpq.com\/wp-content\/uploads\/2021\/05\/image-8-1024x313.png?resize=940%2C287\" alt=\"\" class=\"wp-image-1030\" srcset=\"https:\/\/i0.wp.com\/morecpq.com\/wp-content\/uploads\/2021\/05\/image-8.png?resize=1024%2C313&amp;ssl=1 1024w, https:\/\/i0.wp.com\/morecpq.com\/wp-content\/uploads\/2021\/05\/image-8.png?resize=300%2C92&amp;ssl=1 300w, https:\/\/i0.wp.com\/morecpq.com\/wp-content\/uploads\/2021\/05\/image-8.png?resize=768%2C235&amp;ssl=1 768w, https:\/\/i0.wp.com\/morecpq.com\/wp-content\/uploads\/2021\/05\/image-8.png?w=1255&amp;ssl=1 1255w\" sizes=\"(max-width: 940px) 100vw, 940px\" \/><\/figure>\n\n\n\n<p><strong>Price Rule<br><\/strong>A Price Rule to copy the Location lookup field value from Quote Line Group to Quote Line.  <br>&#8211; No conditions, after calculate.<br>&#8211; Target Field: Location__c<br>&#8211; Formula: SBQQ__Group__r.Location__c<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" decoding=\"async\" width=\"740\" height=\"396\" src=\"https:\/\/i0.wp.com\/morecpq.com\/wp-content\/uploads\/2021\/05\/image-6.png?resize=740%2C396\" alt=\"\" class=\"wp-image-1022\" srcset=\"https:\/\/i0.wp.com\/morecpq.com\/wp-content\/uploads\/2021\/05\/image-6.png?w=740&amp;ssl=1 740w, https:\/\/i0.wp.com\/morecpq.com\/wp-content\/uploads\/2021\/05\/image-6.png?resize=300%2C161&amp;ssl=1 300w\" sizes=\"(max-width: 740px) 100vw, 740px\" \/><\/figure>\n\n\n\n<p><strong>Process Builder (Optional)<br><\/strong>A Process Builder to automatically set Ordered = True on the Primary Quote when Stage changes to Closed Won.  You don&#8217;t really need this.  It&#8217;s a nice to have automation.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" decoding=\"async\" width=\"940\" height=\"447\" src=\"https:\/\/i0.wp.com\/morecpq.com\/wp-content\/uploads\/2021\/05\/image-9-1024x487.png?resize=940%2C447\" alt=\"\" class=\"wp-image-1032\" srcset=\"https:\/\/i0.wp.com\/morecpq.com\/wp-content\/uploads\/2021\/05\/image-9.png?resize=1024%2C487&amp;ssl=1 1024w, https:\/\/i0.wp.com\/morecpq.com\/wp-content\/uploads\/2021\/05\/image-9.png?resize=300%2C143&amp;ssl=1 300w, https:\/\/i0.wp.com\/morecpq.com\/wp-content\/uploads\/2021\/05\/image-9.png?resize=768%2C365&amp;ssl=1 768w, https:\/\/i0.wp.com\/morecpq.com\/wp-content\/uploads\/2021\/05\/image-9.png?w=1467&amp;ssl=1 1467w\" sizes=\"(max-width: 940px) 100vw, 940px\" \/><\/figure>\n\n\n\n<p><strong>Install Links<br><\/strong>You made it!  Here&#8217;s some install links for your time and dedication to your (your customer&#8217;s) configuration needs.<br><a href=\"https:\/\/test.salesforce.com\/packaging\/installPackage.apexp?p0=04t4x000000lxKy\" target=\"_blank\" rel=\"noreferrer noopener\">Sandbox<\/a> | <a href=\"https:\/\/login.salesforce.com\/packaging\/installPackage.apexp?p0=04t4x000000lxKy\" target=\"_blank\" rel=\"noreferrer noopener\">Production<\/a><\/p>\n\n\n\n<p><strong>After Install<br><\/strong>&#8211; Setup -&gt; Objects -&gt; Order -&gt; Page Layout -&gt; Order Product Related List -&gt; Add Location Field<br>&#8211; Setup -&gt; Objects -&gt; Quote Line Group -&gt; Fieldsets -&gt; Line Editor -&gt; Add the Location field.<br>&#8211; Run the below script in the execute anonymous popup in the developer console.  This installs the Price Rule record and Custom Script record.  <br>(Click <a rel=\"noreferrer noopener\" href=\"https:\/\/login.salesforce.com\/_ui\/common\/apex\/debug\/ApexCSIPage\" target=\"_blank\">here<\/a> to open the developer console in production and <a rel=\"noreferrer noopener\" href=\"https:\/\/test.salesforce.com\/_ui\/common\/apex\/debug\/ApexCSIPage\" target=\"_blank\">here<\/a> to open it in sandbox.)<br>NOTE: Do not forget the step after the script below&#8230; \ud83d\ude03 <\/p>\n\n\n\n<pre class=\"wp-block-code\" style=\"font-size:12px\"><code>MoreCPQPostInstall.QuoteByLocation_PostInstall();<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/morecpq.com\/wp-content\/uploads\/2021\/04\/image-23.png?resize=316%2C376\" alt=\"\" class=\"wp-image-920\" width=\"316\" height=\"376\" srcset=\"https:\/\/i0.wp.com\/morecpq.com\/wp-content\/uploads\/2021\/04\/image-23.png?w=314&amp;ssl=1 314w, https:\/\/i0.wp.com\/morecpq.com\/wp-content\/uploads\/2021\/04\/image-23.png?resize=253%2C300&amp;ssl=1 253w\" sizes=\"(max-width: 316px) 100vw, 316px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" decoding=\"async\" width=\"510\" height=\"151\" src=\"https:\/\/i0.wp.com\/morecpq.com\/wp-content\/uploads\/2021\/05\/image-10.png?resize=510%2C151\" alt=\"\" class=\"wp-image-1053\" srcset=\"https:\/\/i0.wp.com\/morecpq.com\/wp-content\/uploads\/2021\/05\/image-10.png?w=510&amp;ssl=1 510w, https:\/\/i0.wp.com\/morecpq.com\/wp-content\/uploads\/2021\/05\/image-10.png?resize=300%2C89&amp;ssl=1 300w\" sizes=\"(max-width: 510px) 100vw, 510px\" \/><\/figure>\n\n\n\n<p>&#8211; Setup -&gt; Salesforce CPQ -&gt; Configure -&gt; Plugins Tab -&gt; Quote Calculator Plugin Field -&gt; QCP<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Have you ever wanted to Quote by location? Do you have a client who MUST be able to quote by location? Look no further! Well, look a LITTLE further. Like down this article. This solution involves Account Hierarchy, some Custom Fields, Quote Line Groups, a Fieldset, a Process Builder, a Price Rule, and a QCP! &hellip;<br \/><a href=\"https:\/\/morecpq.com\/index.php\/2021\/05\/25\/cpq-consortia-quote-by-location\/\" class=\"more-link pen_button pen_element_default pen_icon_arrow_double\">Continue reading <span class=\"screen-reader-text\">CPQ &#8211; Consortia! (Quote by Location)<\/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":[1],"tags":[],"class_list":["post-993","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"jetpack_featured_media_url":"","jetpack-related-posts":[],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/morecpq.com\/index.php\/wp-json\/wp\/v2\/posts\/993","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=993"}],"version-history":[{"count":50,"href":"https:\/\/morecpq.com\/index.php\/wp-json\/wp\/v2\/posts\/993\/revisions"}],"predecessor-version":[{"id":2137,"href":"https:\/\/morecpq.com\/index.php\/wp-json\/wp\/v2\/posts\/993\/revisions\/2137"}],"wp:attachment":[{"href":"https:\/\/morecpq.com\/index.php\/wp-json\/wp\/v2\/media?parent=993"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/morecpq.com\/index.php\/wp-json\/wp\/v2\/categories?post=993"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/morecpq.com\/index.php\/wp-json\/wp\/v2\/tags?post=993"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}