{"id":2158,"date":"2012-06-08T18:43:43","date_gmt":"2012-06-08T18:43:43","guid":{"rendered":"http:\/\/www.greytrix.com\/blogs\/sagecrm\/?p=2158"},"modified":"2012-06-08T18:43:43","modified_gmt":"2012-06-08T18:43:43","slug":"extra-information-from-person-entity-while-mail-merge","status":"publish","type":"post","link":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/2012\/06\/08\/extra-information-from-person-entity-while-mail-merge\/","title":{"rendered":"Extra information from Person entity while Mail merge"},"content":{"rendered":"<p>Merging to word templates feature can be used to merge quote\/order details, search results group results etc to the document. One of the nice feature present in CRM is merging documents from summary screens. A case scenario of how we use it is like when we Create new customer in system, we generate welcome letter for him. An easiest way of doing this can be very easily achieved in three standard steps.\u00a0<\/p>\n<ol>\n<li>Create template of Welcome letter<\/li>\n<li>Go to Person Summary screen<\/li>\n<li>Right click New button and select Document.<\/li>\n<li>Select Welcome letter template and your done.<\/li>\n<\/ol>\n<p>Here you can also use the hash fields on entity tables. As you are using Person entity here putting <strong>#pers_firstname#<\/strong> automatically recognizes person first name and puts it in place holder of the hash field. Now where are these values being pulled from and how does system identify where to put them. Well the answer is <strong>vMailMerge<\/strong> view. You can fire below query on CRM database and see what all columns are coming up.<br \/>\n&#8211;vMailMerge result<br \/>\n<em>Select * from vMailMerge where pers_personid = \u2018&lt;Any person id&gt;\u2019<\/em><br \/>\nWhatever columns are output through above query can be added to template you are creating, can be used as hash fields and will also be automatically handled by standard merging process at the time of actually merging data to document. Now what if you want to add some more information which is not there in current view? Consider below scenario.<br \/>\nPerson has a child entity linked to it named Profile which has a field named description which needs to be displayed in the word template being merged. How will you go about implementing this scenario? Here are the steps.\u00a0<\/p>\n<ol>\n<li>Go to Administration\u00a0|\u00a0\u00a0Customization\u00a0| Person\u00a0| Views\u00a0| vMailMerge.<\/li>\n<li>Change the view query as one mentioned below. See the change in Red color.<\/li>\n<\/ol>\n<p><em>SELECT Pers_PersonId, Comp_CompanyId, RTRIM(ISNULL(Pers_PhoneCountryCode, &#8221;)) + &#8216; &#8216; + <\/em><br \/>\n<em>RTRIM(ISNULL(Pers_PhoneAreaCode, &#8221;)) + &#8216; &#8216; + RTRIM(ISNULL(Pers_PhoneNumber, &#8221;)) AS Pers_PhoneFullNumber, <\/em><br \/>\n<em>RTRIM(ISNULL(Pers_FaxCountryCode, &#8221;)) + &#8216; &#8216; + RTRIM(ISNULL(Pers_FaxAreaCode, &#8221;)) + &#8216; &#8216; + RTRIM(ISNULL(Pers_FaxNumber, &#8221;)) <\/em><br \/>\n<em>AS Pers_FaxFullNumber, RTRIM(ISNULL(Pers_FirstName, &#8221;)) + &#8216; &#8216; + RTRIM(ISNULL(Pers_LastName, &#8221;)) + &#8216;[FAX: +&#8217; + RTRIM(ISNULL(Pers_FaxCountryCode, &#8216;1&#8217;)) + <\/em><br \/>\n<em>&#8216;(&#8216; + RTRIM(ISNULL(Pers_FaxAreaCode, &#8221;)) + &#8216;)&#8217; + RTRIM(ISNULL(Pers_FaxNumber, &#8221;)) + &#8216;]&#8217; AS Pers_EmailFaxNumber, Pers_Salutation, Pers_LastName, <\/em><br \/>\n<em>Pers_FirstName, Pers_MiddleName, Pers_Title, Pers_PhoneCountryCode, Pers_PhoneAreaCode, Pers_PhoneNumber, Pers_FaxCountryCode, Pers_FaxAreaCode, <\/em><br \/>\n<em>Pers_FaxNumber, Pers_EmailAddress, Comp_Name, Addr_Address1, Addr_Address2, Addr_Address3, Addr_Address4, Addr_Address5, Addr_City, Addr_State, <\/em><br \/>\n<em>Addr_Country, Addr_PostCode, Pers_PrimaryUserId, Pers_SecTerr, Pers_CreatedBy, Pers_ChannelId, Comp_PrimaryUserId, Comp_SecTerr, Comp_CreatedBy,<\/em><strong> <\/strong><em>prof_description<\/em><em>,<\/em><em> <\/em><br \/>\n<em>Comp_ChannelId FROM vPersonPE LEFT JOIN Address ON Pers_PrimaryAddressId = Addr_AddressId LEFT JOIN vCompanyPE ON Pers_CompanyId = Comp_CompanyId <\/em><br \/>\n<span style=\"color: #ff0000;\"><em>Left join Profile on pers_personid = prof_personid<\/em><\/span><br \/>\n<em>WHERE Pers_Deleted IS NULL<\/em>\u00a0<\/p>\n<ol>\n<li>Then modify your word template to add field <span style=\"color: #ff0000;\">#prof_description# <\/span>field in content anywhere.<strong><\/strong><\/li>\n<li>Perform merging from Person summary screen.<strong><\/strong><\/li>\n<\/ol>\n<p>After following above steps; the new information we required on template is added properly. However while changing mail merge view we have to make sure that it does not result in multiple rows for single person record. Whatever data is manipulated has to result in single row for every person in Mail merge view.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Merging to word templates feature can be used to merge quote\/order details, search results group results etc to the document. One of the nice feature present in CRM is merging documents from summary screens. A case scenario of how we use it is like when we Create new customer in system, we generate welcome letter\u2026 <span class=\"read-more\"><a href=\"https:\/\/www.greytrix.com\/blogs\/sagecrm\/2012\/06\/08\/extra-information-from-person-entity-while-mail-merge\/\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[228,332],"tags":[],"class_list":["post-2158","post","type-post","status-publish","format-standard","hentry","category-mailmerge","category-sage-crm"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Extra information from Person entity while Mail merge - Sage CRM \u2013 Tips, Tricks and Components<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.greytrix.com\/blogs\/sagecrm\/2012\/06\/08\/extra-information-from-person-entity-while-mail-merge\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Extra information from Person entity while Mail merge - Sage CRM \u2013 Tips, Tricks and Components\" \/>\n<meta property=\"og:description\" content=\"Merging to word templates feature can be used to merge quote\/order details, search results group results etc to the document. One of the nice feature present in CRM is merging documents from summary screens. A case scenario of how we use it is like when we Create new customer in system, we generate welcome letter\u2026 Read More &raquo;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.greytrix.com\/blogs\/sagecrm\/2012\/06\/08\/extra-information-from-person-entity-while-mail-merge\/\" \/>\n<meta property=\"og:site_name\" content=\"Sage CRM \u2013 Tips, Tricks and Components\" \/>\n<meta property=\"article:published_time\" content=\"2012-06-08T18:43:43+00:00\" \/>\n<meta name=\"author\" content=\"greysagecrm\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"greysagecrm\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.greytrix.com\/blogs\/sagecrm\/2012\/06\/08\/extra-information-from-person-entity-while-mail-merge\/\",\"url\":\"https:\/\/www.greytrix.com\/blogs\/sagecrm\/2012\/06\/08\/extra-information-from-person-entity-while-mail-merge\/\",\"name\":\"Extra information from Person entity while Mail merge - Sage CRM \u2013 Tips, Tricks and Components\",\"isPartOf\":{\"@id\":\"https:\/\/www.greytrix.com\/blogs\/sagecrm\/#website\"},\"datePublished\":\"2012-06-08T18:43:43+00:00\",\"author\":{\"@id\":\"https:\/\/www.greytrix.com\/blogs\/sagecrm\/#\/schema\/person\/e7ff1c8f4763b47730d6bc5e74d59c1f\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.greytrix.com\/blogs\/sagecrm\/2012\/06\/08\/extra-information-from-person-entity-while-mail-merge\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.greytrix.com\/blogs\/sagecrm\/2012\/06\/08\/extra-information-from-person-entity-while-mail-merge\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.greytrix.com\/blogs\/sagecrm\/2012\/06\/08\/extra-information-from-person-entity-while-mail-merge\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.greytrix.com\/blogs\/sagecrm\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Extra information from Person entity while Mail merge\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.greytrix.com\/blogs\/sagecrm\/#website\",\"url\":\"https:\/\/www.greytrix.com\/blogs\/sagecrm\/\",\"name\":\"Sage CRM \u2013 Tips, Tricks and Components\",\"description\":\"Explore the possibilities with Sage CRM insights through our comprehensive blogs. As a leading Sage partner, Greytrix helps businesses maximize their Sage CRM potential with its rich expertise and immense knowledge. Here, you will find blogs that feature expert advice, tips &amp; tricks, best practices, and comprehensive guides on customizing and configuring Sage CRM for your business. Stay informed with our regular updates and expert insights!\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.greytrix.com\/blogs\/sagecrm\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.greytrix.com\/blogs\/sagecrm\/#\/schema\/person\/e7ff1c8f4763b47730d6bc5e74d59c1f\",\"name\":\"greysagecrm\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.greytrix.com\/blogs\/sagecrm\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/c3b4325cb326e36467f945b9b9adf2bb85e907fe092d42eb36b39743b492e626?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/c3b4325cb326e36467f945b9b9adf2bb85e907fe092d42eb36b39743b492e626?s=96&d=mm&r=g\",\"caption\":\"greysagecrm\"},\"url\":\"https:\/\/www.greytrix.com\/blogs\/sagecrm\/author\/greysagecrm\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Extra information from Person entity while Mail merge - Sage CRM \u2013 Tips, Tricks and Components","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/2012\/06\/08\/extra-information-from-person-entity-while-mail-merge\/","og_locale":"en_US","og_type":"article","og_title":"Extra information from Person entity while Mail merge - Sage CRM \u2013 Tips, Tricks and Components","og_description":"Merging to word templates feature can be used to merge quote\/order details, search results group results etc to the document. One of the nice feature present in CRM is merging documents from summary screens. A case scenario of how we use it is like when we Create new customer in system, we generate welcome letter\u2026 Read More &raquo;","og_url":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/2012\/06\/08\/extra-information-from-person-entity-while-mail-merge\/","og_site_name":"Sage CRM \u2013 Tips, Tricks and Components","article_published_time":"2012-06-08T18:43:43+00:00","author":"greysagecrm","twitter_card":"summary_large_image","twitter_misc":{"Written by":"greysagecrm","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/2012\/06\/08\/extra-information-from-person-entity-while-mail-merge\/","url":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/2012\/06\/08\/extra-information-from-person-entity-while-mail-merge\/","name":"Extra information from Person entity while Mail merge - Sage CRM \u2013 Tips, Tricks and Components","isPartOf":{"@id":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/#website"},"datePublished":"2012-06-08T18:43:43+00:00","author":{"@id":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/#\/schema\/person\/e7ff1c8f4763b47730d6bc5e74d59c1f"},"breadcrumb":{"@id":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/2012\/06\/08\/extra-information-from-person-entity-while-mail-merge\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.greytrix.com\/blogs\/sagecrm\/2012\/06\/08\/extra-information-from-person-entity-while-mail-merge\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/2012\/06\/08\/extra-information-from-person-entity-while-mail-merge\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/"},{"@type":"ListItem","position":2,"name":"Extra information from Person entity while Mail merge"}]},{"@type":"WebSite","@id":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/#website","url":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/","name":"Sage CRM \u2013 Tips, Tricks and Components","description":"Explore the possibilities with Sage CRM insights through our comprehensive blogs. As a leading Sage partner, Greytrix helps businesses maximize their Sage CRM potential with its rich expertise and immense knowledge. Here, you will find blogs that feature expert advice, tips &amp; tricks, best practices, and comprehensive guides on customizing and configuring Sage CRM for your business. Stay informed with our regular updates and expert insights!","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/#\/schema\/person\/e7ff1c8f4763b47730d6bc5e74d59c1f","name":"greysagecrm","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/c3b4325cb326e36467f945b9b9adf2bb85e907fe092d42eb36b39743b492e626?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/c3b4325cb326e36467f945b9b9adf2bb85e907fe092d42eb36b39743b492e626?s=96&d=mm&r=g","caption":"greysagecrm"},"url":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/author\/greysagecrm\/"}]}},"_links":{"self":[{"href":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/wp-json\/wp\/v2\/posts\/2158","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/wp-json\/wp\/v2\/comments?post=2158"}],"version-history":[{"count":0,"href":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/wp-json\/wp\/v2\/posts\/2158\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/wp-json\/wp\/v2\/media?parent=2158"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/wp-json\/wp\/v2\/categories?post=2158"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/wp-json\/wp\/v2\/tags?post=2158"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}