{"id":1144,"date":"2008-02-29T03:45:33","date_gmt":"2008-02-29T09:45:33","guid":{"rendered":"http:\/\/www.mrc-productivity.com\/docs\/?page_id=1144"},"modified":"2023-04-13T13:59:04","modified_gmt":"2023-04-13T18:59:04","slug":"changing-maintenance-modes-via-url-parameters","status":"publish","type":"ht_kb","link":"https:\/\/www.mrc-productivity.com\/docs\/knowledge-base\/changing-maintenance-modes-via-url-parameters","title":{"rendered":"Setting Maintainer Action Mode via URL Parameter"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">Overview<\/h2>\n\n\n\n<p>When you run a Single Row Maintainer the default action mode is set to Add. However, what if you want your maintainer to add or update, based on which link a user clicks? Rather than making three separate applications, you can control the action of the maintenance application based on aURL parameter.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Action Modes<\/h2>\n\n\n\n<p>Use the URL parameter &#8220;action_mode&#8221; and values: &#8216;add&#8217;, &#8216;update&#8217;, &#8216;delete&#8217;, &#8216;copy&#8217;, and &#8216;view&#8217; to control the action mode like so:<\/p>\n\n\n\n<p><code>DICTIONARY.M00010s?action_mode=add<\/code><\/p>\n\n\n\n<p>If using any action mode other than &#8216;Add&#8217; you are required to also pass the dimension key field(s) as parameters to know which record to pull back. <\/p>\n\n\n\n<p><code>DICTIONARY.M00010s?action_mode=update&amp;CNUM=100001<\/code><\/p>\n\n\n\n<p>Fields may be pre-populated in the form by passing the field name and the desired value through the URL, like so:<\/p>\n\n\n\n<p><code>DICTIONARY.M00010s?action_mode=update&amp;CNUM=100001&amp;CSTATE=CO<\/code><\/p>\n\n\n\n<p class=\"wp-block-ht-blocks-messages wp-block-hb-message wp-block-hb-message--withicon is-style-alert\">Parameter names are governed by HTML laws, which require case sensitivity &#8212; &#8220;CNUM&#8221; is different than &#8220;cnum&#8221;.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Add Mode<\/h3>\n\n\n\n<p>By default, Single Row Maintainers are set to Add mode. However, you may still use the action_mode parameter. <\/p>\n\n\n\n<p><code>DICTIONARY.M00010s?action_mode=add<\/code><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"\/docs\/vue-images\/addMode.jpg\" alt=\"\"\/><\/figure>\n\n\n\n<p>Because the maintainer is in add mode, the form has blank inputs (aside from the Customer # dimension key which is set to <strong><a rel=\"noreferrer noopener\" href=\"https:\/\/www.mrc-productivity.com\/docs\/knowledge-base\/auto-sequencing-within-a-maintenance-application\" target=\"_blank\">auto-sequence<\/a><\/strong>) ready for data entry.<\/p>\n\n\n\n<p>Again, input fields can be pre-populated in the form by passing the field name and value as a parameter:<\/p>\n\n\n\n<p><code>DICTIONARY.M00010s?action_mode=add&amp;CSTATE=CO<\/code><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"\/docs\/vue-images\/addModeWithParm.jpg\" alt=\"\"\/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Update Mode<\/h3>\n\n\n\n<p><code>DICTIONARY.M00010s?action_mode=update&amp;CNUM=100001<\/code><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"\/docs\/vue-images\/updateMode.jpg\" alt=\"\"\/><\/figure>\n\n\n\n<p>Notice that this link automatically ran the application, pulled back the record where the key field (CNUM) is equal to &#8220;100001&#8221; and now allows the user to update any field other than the key field. In update mode, the dimension key(s) will always be read-only.<\/p>\n\n\n\n<p class=\"wp-block-ht-blocks-messages wp-block-hb-message wp-block-hb-message--withicon is-style-alert\">If using the action_mode=update parameter, the dimension key parameter is <strong>also required<\/strong> to know which record to update.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Delete Mode<\/h3>\n\n\n\n<p><code>DICTIONARY.M00010s?action_mode=delete&amp;CNUM=100001<\/code><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"\/docs\/vue-images\/deleteMode.jpg\" alt=\"\"\/><\/figure>\n\n\n\n<p>This link also runs the application and automatically pulls back the record based on the key parameter. In delete mode, all fields are set to read-only and the user is prompted to confirm deletion of the record.<\/p>\n\n\n\n<p class=\"wp-block-ht-blocks-messages wp-block-hb-message wp-block-hb-message--withicon is-style-alert\">If using the action_mode=delete parameter, the dimension key parameter is <strong>also required<\/strong> to know which record to delete.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Copy Mode<\/h3>\n\n\n\n<p><code>DICTIONARY.M00010s?action_mode=copy&amp;CNUM=100001<\/code><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"\/docs\/vue-images\/copyMode.jpg\" alt=\"\"\/><\/figure>\n\n\n\n<p>In copy mode, the specified record&#8217;s data is pulled to the form, allowing the user to change all fields including the dimension key and will add the record upon submission.<\/p>\n\n\n\n<p class=\"wp-block-ht-blocks-messages wp-block-hb-message wp-block-hb-message--withicon is-style-alert\">If using the action_mode=copy parameter, the dimension key parameter is <strong>also required<\/strong> to know which record to copy.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">View Mode<\/h3>\n\n\n\n<p><code>DICTIONARY.M00010s?action_mode=view&amp;CNUM=100001<\/code><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"\/docs\/vue-images\/viewMode.jpg\" alt=\"\"\/><\/figure>\n\n\n\n<p>While in view mode, all fields are read-only and the &#8220;Accept&#8221; (submit) button is hidden. <\/p>\n\n\n\n<p class=\"wp-block-ht-blocks-messages wp-block-hb-message wp-block-hb-message--withicon is-style-alert\">If using the action_mode=view parameter, the dimension key parameter is <strong>also required<\/strong> to know which record to view.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">One Step Mode<\/h2>\n\n\n\n<p>All of the above scenarios have dealt with how to call a maintainer and then allow the user to work with the record in question. However, you may have a need to call the maintainer &#8220;in the background&#8221; without displaying the on-screen form to the user. You may even pass the new field values to the maintainer in order to add, update or copy the record.<\/p>\n\n\n\n<p>The URL to update a record might look like this:<\/p>\n\n\n\n<p><code>DICTIONARY.M00010s?action_mode=update&amp;CNUM=12345&amp;CSTATE=NE<\/code><\/p>\n\n\n\n<p>To make it automatically carry out the update, include the following parameter to the end of the URL string:<\/p>\n\n\n\n<p><code>&amp;one_step=1<\/code><\/p>\n\n\n\n<p>The whole string now looks like this:<\/p>\n\n\n\n<p><code>DICTIONARY.M00010s?action_mode=update&amp;CNUM=12345&amp;CSTATE=NE&amp;one_step=1<\/code><\/p>\n\n\n\n<p>This instructs the maintainer to execute the update in one single step, without showing the user any screens.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">On Screen Redirect <\/h3>\n\n\n\n<p>By default, the maintainer will redirect back to itself in add mode after submission regardless of the action mode used. To change this, you can specify a <a rel=\"noreferrer noopener\" href=\"https:\/\/www.mrc-productivity.com\/docs\/knowledge-base\/workflow-designer#redirect-to-another-page\" target=\"_blank\"><strong>redirect via the Workflow Designer<\/strong><\/a>. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Overview When you run a Single Row Maintainer the default action mode is set to Add. However, what if you want your maintainer to add or update, based on which link a user clicks? Rather than making three separate applications, you can control the action of the maintenance application based&#8230;<\/p>\n","protected":false},"author":1,"comment_status":"closed","ping_status":"closed","template":"","format":"standard","meta":{"footnotes":""},"ht-kb-category":[252],"ht-kb-tag":[],"class_list":["post-1144","ht_kb","type-ht_kb","status-publish","format-standard","hentry","ht_kb_category-maintainer"],"_links":{"self":[{"href":"https:\/\/www.mrc-productivity.com\/docs\/wp-json\/wp\/v2\/ht-kb\/1144","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.mrc-productivity.com\/docs\/wp-json\/wp\/v2\/ht-kb"}],"about":[{"href":"https:\/\/www.mrc-productivity.com\/docs\/wp-json\/wp\/v2\/types\/ht_kb"}],"author":[{"embeddable":true,"href":"https:\/\/www.mrc-productivity.com\/docs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mrc-productivity.com\/docs\/wp-json\/wp\/v2\/comments?post=1144"}],"version-history":[{"count":12,"href":"https:\/\/www.mrc-productivity.com\/docs\/wp-json\/wp\/v2\/ht-kb\/1144\/revisions"}],"predecessor-version":[{"id":12544,"href":"https:\/\/www.mrc-productivity.com\/docs\/wp-json\/wp\/v2\/ht-kb\/1144\/revisions\/12544"}],"wp:attachment":[{"href":"https:\/\/www.mrc-productivity.com\/docs\/wp-json\/wp\/v2\/media?parent=1144"}],"wp:term":[{"taxonomy":"ht_kb_category","embeddable":true,"href":"https:\/\/www.mrc-productivity.com\/docs\/wp-json\/wp\/v2\/ht-kb-category?post=1144"},{"taxonomy":"ht_kb_tag","embeddable":true,"href":"https:\/\/www.mrc-productivity.com\/docs\/wp-json\/wp\/v2\/ht-kb-tag?post=1144"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}