{"id":1591,"date":"2015-09-15T05:56:14","date_gmt":"2015-09-15T05:56:14","guid":{"rendered":"https:\/\/mahenderpal.wordpress.com\/?p=1591"},"modified":"2015-11-30T10:35:55","modified_gmt":"2015-11-30T10:35:55","slug":"get-comment-from-user-before-de-activating-entity-record","status":"publish","type":"post","link":"https:\/\/himbap.com\/blog\/?p=1591","title":{"rendered":"Get Comment from user before de-activating entity record"},"content":{"rendered":"<p><strong>Requirement<\/strong>\u00a0: While deactivating account record, we\u00a0need to get deactivation\u00a0comments from user before deactivating account.<\/p>\n<p><strong style=\"font-style: inherit;\">Solution<\/strong>: We can implement this requirement using different ways, in this post we are going to provide out of the box solution for this requirement. We can achieve this using dialog, if you are new to dialogs I suggest you to refer\u00a0<a style=\"font-style: inherit; font-weight: inherit;\" href=\"https:\/\/msdn.microsoft.com\/en-us\/library\/gg509010.aspx\">https:\/\/msdn.microsoft.com\/en-us\/library\/gg509010.aspx<\/a>\u00a0first, where you can learn about dialogs and their component.<\/p>\n<p>Idea here is hide the out of the box deactivate button for account entity and then design a dialog with prompt and response, we can ask user to enter comments and then we can update account entity description field (or you can setup your own custom field) with the comments, after that we can deactivate account record. Using following steps to design our dialog:<\/p>\n<ul>\n<li>Navigate to Settings -&gt; Processes and select New button through process command bar<\/li>\n<li>Enter process name for example \u201c<strong>Deactivate Account<\/strong>\u201d<\/li>\n<li>Select category as \u201c<strong>Dialog<\/strong>\u201d and select <strong>Account<\/strong> under entity drop down<\/li>\n<li>Click on <strong>Add Step<\/strong> and select <strong>Page<\/strong> from drop down to add a page in dialog<\/li>\n<\/ul>\n<p><a href=\"https:\/\/mahenderpal.files.wordpress.com\/2015\/09\/dialog1.png\"><img decoding=\"async\" loading=\"lazy\" class=\"size-medium wp-image-1597 aligncenter\" src=\"https:\/\/mahenderpal.files.wordpress.com\/2015\/09\/dialog1.png?w=300\" alt=\"dialog1\" width=\"300\" height=\"126\" \/><\/a><\/p>\n<ul>\n<li>Select line under page and again click on <strong>Add Step<\/strong> and add a <strong>Prompt and Response<\/strong>.<\/li>\n<li>Click on <strong>Set Properties<\/strong> button and set properties like below :<\/li>\n<\/ul>\n<p style=\"text-align: center;\"><a href=\"https:\/\/mahenderpal.files.wordpress.com\/2015\/09\/dialog2.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-1596\" src=\"https:\/\/mahenderpal.files.wordpress.com\/2015\/09\/dialog2.png?w=300\" alt=\"dialog2\" width=\"300\" height=\"232\" \/><\/a><\/p>\n<ul>\n<li>Click on <strong>Save and Close<\/strong> and select <strong>Page<\/strong> area and then add <strong>Update<\/strong> from <strong>Add Step<\/strong> dropdown, now we will update account record.<\/li>\n<li>Click on <strong>Set Properties<\/strong>, Select description field in account form and select <strong>Look For<\/strong> like below and first click on <strong>Add<\/strong> and then on <strong>Ok<\/strong>, so that comment will store in description field.<\/li>\n<\/ul>\n<p style=\"text-align: center;\"><a href=\"https:\/\/mahenderpal.files.wordpress.com\/2015\/09\/dialog3.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-1595\" src=\"https:\/\/mahenderpal.files.wordpress.com\/2015\/09\/dialog3.png?w=300\" alt=\"dialog3\" width=\"300\" height=\"166\" \/><\/a><\/p>\n<ul>\n<li>Now finally add <strong>Change Status<\/strong> step from <strong>Add Step<\/strong> dropdown and set status to <strong>Inactive<\/strong><\/li>\n<li>Our dialog steps should look like below:<\/li>\n<\/ul>\n<p style=\"text-align: center;\"><a href=\"https:\/\/mahenderpal.files.wordpress.com\/2015\/09\/dialog4.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-1594\" src=\"https:\/\/mahenderpal.files.wordpress.com\/2015\/09\/dialog4.png?w=300\" alt=\"dialog4\" width=\"300\" height=\"134\" \/><\/a><\/p>\n<ul>\n<li>Activate our dialog using <strong>Activate<\/strong> button on dialog command bar<\/li>\n<\/ul>\n<p><strong>Testing Dialog:<\/strong><\/p>\n<p>To test our dialog, now simply navigate to <strong>Sales-&gt;Accounts<\/strong> and select and account and click on Start Dialog button under more commands (\u2026), it will display our dialog name, select our dialog and click on Add, it will ask for comment like below:<\/p>\n<p style=\"text-align: center;\"><a href=\"https:\/\/mahenderpal.files.wordpress.com\/2015\/09\/dialog6.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-1592\" src=\"https:\/\/mahenderpal.files.wordpress.com\/2015\/09\/dialog6.png?w=300\" alt=\"dialog6\" width=\"300\" height=\"117\" \/><\/a><\/p>\n<p>Click on <strong>Next<\/strong> button after entering comments and finish it, it will store out comment in account record and will activate account, and you check your account record under Inactive view.<\/p>\n<p>We can simply hide our of the box deactivate button using RibbonWorkbench tool, you can refer <a href=\"https:\/\/mahenderpal.wordpress.com\/2015\/04\/07\/overriding-out-of-box-command-button-behavior-step-by-step\/\">our post<\/a>, for how to hide system buttons.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Requirement\u00a0: While deactivating account record, we\u00a0need to get deactivation\u00a0comments from user before deactivating account. Solution: We can implement this requirement using different ways, in this post we are going to provide out of the box solution for this requirement. We can achieve this using dialog, if you are new to dialogs I suggest you to refer\u00a0https:\/\/msdn.microsoft.com\/en-us\/library\/gg509010.aspx\u00a0first, where you can learn&#8230; <a href=\"https:\/\/himbap.com\/blog\/?p=1591\">Read more &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[5,6,8,9],"tags":[201,207],"_links":{"self":[{"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1591"}],"collection":[{"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1591"}],"version-history":[{"count":2,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1591\/revisions"}],"predecessor-version":[{"id":1898,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1591\/revisions\/1898"}],"wp:attachment":[{"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1591"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1591"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1591"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}