{"id":1380,"date":"2021-08-24T14:55:22","date_gmt":"2021-08-24T20:55:22","guid":{"rendered":"http:\/\/www.idubbs.com\/blog\/?p=1380"},"modified":"2021-08-24T14:57:41","modified_gmt":"2021-08-24T20:57:41","slug":"modern-sharepoint-page-approval-with-power-automate-message-optional","status":"publish","type":"post","link":"https:\/\/www.idubbs.com\/blog\/2021\/modern-sharepoint-page-approval-with-power-automate-message-optional\/","title":{"rendered":"Modern SharePoint Page Approval with Power Automate: Message Optional"},"content":{"rendered":"<h2>Overview<\/h2>\n<p>The current iteration of page approvals in SharePoint Online using Modern pages and news is handled by Power Automate \u2013 and the integration is pretty slick. Kudos to the Microsoft teams responsible for it (SharePoint + Power Automate).<\/p>\n<p><a href=\"http:\/\/www.idubbs.com\/blog\/wp-content\/uploads\/2021\/08\/Approval-Flow.png\"><img loading=\"lazy\" decoding=\"async\" width=\"420\" height=\"170\" title=\"Approval Flow\" style=\"display: inline; background-image: none;\" alt=\"Approval Flow\" src=\"http:\/\/www.idubbs.com\/blog\/wp-content\/uploads\/2021\/08\/Approval-Flow_thumb.png\" border=\"0\"><\/a><\/p>\n<p>Once an approval flow has been configured and a user submits a page, the user is prompted by the following panel:<\/p>\n<p><a href=\"http:\/\/www.idubbs.com\/blog\/wp-content\/uploads\/2021\/08\/Approval-Panel.png\"><img loading=\"lazy\" decoding=\"async\" width=\"256\" height=\"448\" title=\"Approval Panel\" style=\"display: inline; background-image: none;\" alt=\"Approval Panel\" src=\"http:\/\/www.idubbs.com\/blog\/wp-content\/uploads\/2021\/08\/Approval-Panel_thumb.png\" border=\"0\"><\/a><\/p>\n<p>Note here that the Message field is required. In many cases, this is fine. There are some circumstances however where site owners may want to make the Message field optional.<\/p>\n<h2>The Quick Steps<\/h2>\n<p>Without getting into all the nitty gritty, here\u2019s how it\u2019s done (at least one approach):<\/p>\n<ol>\n<li>Go into Power Automate and open the approval flow<\/li>\n<li>On the first step of the flow, expand the \u201cFor a selected item\u201d step<\/li>\n<li>For the \u201cMessage\u201d property, select the menu (three dots) button and select \u201cMake the field optional\u201d)<br \/>\n<a href=\"http:\/\/www.idubbs.com\/blog\/wp-content\/uploads\/2021\/08\/Flow-Field-Optional.png\"><img loading=\"lazy\" decoding=\"async\" width=\"462\" height=\"212\" title=\"Flow Field Optional\" style=\"display: inline; background-image: none;\" alt=\"Flow Field Optional\" src=\"http:\/\/www.idubbs.com\/blog\/wp-content\/uploads\/2021\/08\/Flow-Field-Optional_thumb.png\" border=\"0\"><\/a><\/li>\n<li>Expand the scope (mine is called \u201cScope 2\u201d), and the \u201cStart and approval\u201d step<br \/>\n<a href=\"http:\/\/www.idubbs.com\/blog\/wp-content\/uploads\/2021\/08\/Approval-Details.png\"><img loading=\"lazy\" decoding=\"async\" width=\"460\" height=\"488\" title=\"Approval Details\" style=\"display: inline; background-image: none;\" alt=\"Approval Details\" src=\"http:\/\/www.idubbs.com\/blog\/wp-content\/uploads\/2021\/08\/Approval-Details_thumb.png\" border=\"0\"><\/a><\/li>\n<li>Click on the \u201cDetails\u201d expression (circled above) \u2013 which opens the panel for updates<br \/>\n<a href=\"http:\/\/www.idubbs.com\/blog\/wp-content\/uploads\/2021\/08\/Approval-Expression.png\"><img loading=\"lazy\" decoding=\"async\" width=\"665\" height=\"183\" title=\"Approval Expression\" style=\"display: inline; background-image: none;\" alt=\"Approval Expression\" src=\"http:\/\/www.idubbs.com\/blog\/wp-content\/uploads\/2021\/08\/Approval-Expression_thumb.png\" border=\"0\"><\/a><\/li>\n<li>Update the expression to include a question mark (\u201c?\u201d) after \u201ctriggerBody()\u201d and before \u201c[\u2018text\u2019]\u201d.<br \/>\n<a href=\"http:\/\/www.idubbs.com\/blog\/wp-content\/uploads\/2021\/08\/Expression-Text.png\"><img loading=\"lazy\" decoding=\"async\" width=\"262\" height=\"104\" title=\"Expression Text\" style=\"display: inline; background-image: none;\" alt=\"Expression Text\" src=\"http:\/\/www.idubbs.com\/blog\/wp-content\/uploads\/2021\/08\/Expression-Text_thumb.png\" border=\"0\"><\/a><\/li>\n<li>Click \u201cUpdate\u201d (see above)<\/li>\n<li>Save the flow, and test<\/li>\n<\/ol>\n<p>When an approval is submitted, the Message field in the panel should now show as \u201cnot required\u201d \u2013 no asterisk should be visible. The panel should allow users to leave the field blank and \u201cSubmit\u201d the page for approval without error.<\/p>\n<p><a><img loading=\"lazy\" decoding=\"async\" width=\"162\" height=\"84\" title=\"Not Required\" style=\"display: inline; background-image: none;\" alt=\"Not Required\" src=\"http:\/\/www.idubbs.com\/blog\/wp-content\/uploads\/2021\/08\/Not-Required.png\" border=\"0\"><\/a><\/p>\n<h2>The Details<\/h2>\n<p>One example I\u2019ve seen where this is applicable is a site where there is a content management team that does a significant amount of the page creation, but also has folks outside the normal content team that submit content from time to time. Approval is needed. When the main content team is creating pages \u2013 they want to get through it and keep moving. The Message field turns into a \u201cjunk\u201d field, they keyboard smash or put some useless text in the field in order to submit the page. This is irritating for users and inserts bad\/silly data into the system. Rather than remove the field outright, we\u2019d still like to have it available when needed \u2013 by folks outside the team, for example.&nbsp;&nbsp;<\/p>\n<p>Let\u2019s review how this works. Open up the flow. Then expand the \u201cFor a selected item\u201d step (Step 3 above).<\/p>\n<p>Changing the Message field to \u201cMake the field optional\u201d seems pretty straight-forward. It will even work for some flows. But by itself this change will not work for all scenarios. The flow will fail when the Message field is left blank because later in the flow a step attempts to use the text IN the field. When that text is blank, the flow fails.&nbsp;<\/p>\n<p>If you run\/test the flow with no Message text, you can open the failed instance of the flow to see where the error occurred. The scope will show an indication that something is wrong. When you expand the scope you can see the error on the \u201cStart an approval\u201d step. This flow fail is also followed up by a \u201cSomething went wrong\u2026\u201d&nbsp; email from Microsoft Flow.<\/p>\n<p><a href=\"http:\/\/www.idubbs.com\/blog\/wp-content\/uploads\/2021\/08\/Broken-Flow.png\"><img loading=\"lazy\" decoding=\"async\" width=\"507\" height=\"457\" title=\"Broken Flow\" style=\"display: inline; background-image: none;\" alt=\"Broken Flow\" src=\"http:\/\/www.idubbs.com\/blog\/wp-content\/uploads\/2021\/08\/Broken-Flow_thumb.png\" border=\"0\"><\/a><\/p>\n<p>Looking at the error message, there\u2019s something wrong with \u2018text\u2019, which looks like it\u2019s pointing back to the Message field we changed.<\/p>\n<p>If we test run the flow again, and put text in the message, the flow works fine.<\/p>\n<p>Looking at steps 4-6 above, you can see where the additional change needs to be made \u2013 adding a question mark to the expression. This syntax (the \u201c?\u201d) allows the expression to evaluate the Message field \u2013 [\u2018text\u2019] \u2013 as Null when it is empty. Before we added the question mark the expression didn\u2019t know what to do with a blank Message field and failed the flow.&nbsp;<\/p>\n<p>Note: I haven\u2019t been able to find official documentation anywhere on what the \u201c?\u201d syntax is within expressions, how to use it, when to use it, etc. Maybe my search skills are falling off. If you find something from Microsoft, let me know and I\u2019ll update this post and references for it. Until then I\u2019ll include what I did find below.<\/p>\n<h2>References<\/h2>\n<p>Paul Stork has the most information I\u2019ve seen on the use of the question mark (?)&nbsp; thus far as seen in this community post:<br \/>\n<a href=\"https:\/\/powerusers.microsoft.com\/t5\/General-Power-Automate\/Use-of-Question-Mark-in-expressions\/td-p\/382181\">Solved: Use of Question Mark(?) in expressions &#8211; Power Platform Community (microsoft.com)<\/a>&nbsp;<\/p>\n<p>Another blog that references the question mark with regards to a Power Automate expression<br \/>\n<a href=\"https:\/\/www.itaintboring.com\/dynamics-crm\/power-automate-how-do-we-check-if-a-property-exists-in-the-object\/\">Power Automate \u2013 how do we check if a property exists in the object? | It Ain&#8217;t Boring (itaintboring.com)<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Overview The current iteration of page approvals in SharePoint Online using Modern pages and news is handled by Power Automate \u2013 and the integration is pretty slick. Kudos to the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1366,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[191,21],"tags":[189],"class_list":["post-1380","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-power-automate","category-sharepoint-online","tag-approvals"],"jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/pgWQ1-mg","jetpack_featured_media_url":"https:\/\/www.idubbs.com\/blog\/wp-content\/uploads\/2021\/08\/Approval-Flow_thumb.png","_links":{"self":[{"href":"https:\/\/www.idubbs.com\/blog\/wp-json\/wp\/v2\/posts\/1380","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.idubbs.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.idubbs.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.idubbs.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.idubbs.com\/blog\/wp-json\/wp\/v2\/comments?post=1380"}],"version-history":[{"count":2,"href":"https:\/\/www.idubbs.com\/blog\/wp-json\/wp\/v2\/posts\/1380\/revisions"}],"predecessor-version":[{"id":1382,"href":"https:\/\/www.idubbs.com\/blog\/wp-json\/wp\/v2\/posts\/1380\/revisions\/1382"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.idubbs.com\/blog\/wp-json\/wp\/v2\/media\/1366"}],"wp:attachment":[{"href":"https:\/\/www.idubbs.com\/blog\/wp-json\/wp\/v2\/media?parent=1380"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.idubbs.com\/blog\/wp-json\/wp\/v2\/categories?post=1380"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.idubbs.com\/blog\/wp-json\/wp\/v2\/tags?post=1380"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}