{"id":295,"date":"2013-07-18T16:28:16","date_gmt":"2013-07-18T16:28:16","guid":{"rendered":"https:\/\/www.harepoint.com\/Blog\/?p=295"},"modified":"2022-07-15T13:55:55","modified_gmt":"2022-07-15T13:55:55","slug":"sharepoint-workflow-repeating-content","status":"publish","type":"post","link":"https:\/\/www.harepoint.com\/Blog\/sharepoint-workflow-repeating-content\/","title":{"rendered":"How to create Invoices with a variable number of items in SharePoint workflow"},"content":{"rendered":"\n<p>HarePoint was asked whether it is possible to create an invoice with a variable number of rows in a table. So we have added new workflow action, <b>Add New Row into Word Document<\/b>, to HarePoint Workflow Extensions.<\/p>\n<p>This new action can add a copy of the last row in the <b>Repeating Section Content Control<\/b>. Then this new row can be edited with the <b>Update Word Document<\/b> action. Note that <b>Repeating Section Content Control<\/b> was introduced in Microsoft Word 2013.<\/p>\n<p>This article describes how to create an invoice with a variable number of items. And we will use the <b>Update Word Document<\/b> and the new <b>Add New Row into Word Document<\/b> actions from HarePoint Workflow Extensions for SharePoint:<\/p>\n<table style=\"border: 1px solid black;\">\n\t<tbody>\n\t\t<tr>\n\t\t\t<td rowspan=\"2\" style=\"border: 1px solid black;\"><b>Component name and type<\/b><\/td>\n\t\t\t<td colspan=\"2\" style=\"text-align: center;\"><b>Workflow components used<\/b><\/td>\n\t\t<\/tr>\n\t\t<tr>\n\t\t\t<td style=\"text-align: center; border: 1px solid black;\"><b>SharePoint Workflow<\/b><\/td>\n\t\t\t<td style=\"text-align: center;\"><b>HarePoint Workflow Extensions<\/b><\/td>\n\t\t<\/tr>\n\t\t<tr>\n\t\t\t<td style=\"border: 1px solid black;\">Add New Row into Word Document (Action)<\/td>\n\t\t\t<td><\/td>\n\t\t\t<td style=\"text-align: center; border: 1px solid black;\"><img decoding=\"async\" src=\"\/Pictures\/Workflow\/yes.gif\"><\/td>\n\t\t<\/tr>\n\t\t<tr>\n\t\t\t<td style=\"border: 1px solid black;\">Update Word Document (Action)<\/td>\n\t\t\t<td><\/td>\n\t\t\t<td style=\"text-align: center; border: 1px solid black;\"><img decoding=\"async\" src=\"\/Pictures\/Workflow\/yes.gif\"><\/td>\n\t\t<\/tr>\n\t\t<tr>\n\t\t\t<td style=\"border: 1px solid black;\">Set Workflow Variable (Action)<\/td>\n\t\t\t<td style=\"text-align: center; border: 1px solid black;\"><img decoding=\"async\" src=\"\/Pictures\/Workflow\/yes.gif\"><\/td>\n\t\t\t<td><\/td>\n\t\t<\/tr>\n\t<\/tbody>\n<\/table>\n<p>We will use an <a href=\"\/Products\/HarePointWorkflowExtensions\/Example-Repeating-Content-Workflow.docx\">Invoice created from a Microsoft Word template<\/a>.<\/p>\n<p><img decoding=\"async\" src=\"\/Pictures\/Articles\/Example-Repeating-Content-Workflow-1.png\"><\/p>\n<p>First, remove empty rows and leave only one. Select it and click Repeating Section Content Control in the Developer menu.<\/p>\n<p><img decoding=\"async\" src=\"\/Pictures\/Articles\/Example-Repeating-Content-Workflow-2.png\"><\/p>\n<p>The <i>Plus<\/i> button will appear on the right to add new rows to the table. We do not have to click it because our SharePoint workflow will do all the required actions for us.<\/p>\n<p><img decoding=\"async\" src=\"\/Pictures\/Articles\/Example-Repeating-Content-Workflow-3.png\"><\/p>\n<p>Set up Title and Tag in the Content Control Properties.<\/p>\n<p><img decoding=\"async\" src=\"\/Pictures\/Articles\/Example-Repeating-Content-Workflow-4.png\"><\/p>\n<p>Next add a <b>Plain Text Content Control<\/b> to each cell and give them unique names. They will hold the required data. The table should look like this:<\/p>\n<p><img decoding=\"async\" src=\"\/Pictures\/Articles\/Example-Repeating-Content-Workflow-5.png\"><\/p>\n<p>Let&#8217;s start creating the Workflow that will fill the table.<\/p>\n<p>Use the <b>Update Word Document<\/b> action to set values of each content controls. Note that for the content controls from the repeating section you need to choose \u201clast occurrence (repeating content control)\u201d option in the workflow action. For regular content controls (outside the repeating section), use \u201call occurrences\u201d option. Make sure you have the latest version of <a href=\"\/Products\/HarePointWorkflowExtensions\/Default.aspx\">HarePoint Workflow Extensions<\/a> for these options to be available.<\/p>\n<p><img decoding=\"async\" src=\"\/Pictures\/Articles\/Example-Repeating-Content-Workflow-6.png\"><\/p>\n<p>Save, publish and test the Workflow to update the table in the invoice in the Word Document:<\/p>\n<p><img decoding=\"async\" src=\"\/Pictures\/Articles\/Example-Repeating-Content-Workflow-7.png\"><\/p>\n<p><b>You can also watch the whole process of creating such a workflow in this video:<\/b><\/p>\n<p><iframe loading=\"lazy\" src=\"https:\/\/www.youtube.com\/embed\/69HW-Dmc5FA\" width=\"560\" height=\"315\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/p>\n<hr>\n<p>Learn more about <a href=\"\/Products\/HarePointWorkflowExtensions\/Default.aspx\">HarePoint Workflow Extensions<\/a> and over 350 new actions to automate any business process without programming.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This article describes how to create an invoice with a variable number of items. <b>Add New Row into Word Document<\/b> action will add a copy of the last row in the Repeating Section Content Control. Then this new row will be edited with the <b>Update Word Document<\/b> action.<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[19,25],"_links":{"self":[{"href":"https:\/\/www.harepoint.com\/Blog\/wp-json\/wp\/v2\/posts\/295"}],"collection":[{"href":"https:\/\/www.harepoint.com\/Blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.harepoint.com\/Blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.harepoint.com\/Blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.harepoint.com\/Blog\/wp-json\/wp\/v2\/comments?post=295"}],"version-history":[{"count":37,"href":"https:\/\/www.harepoint.com\/Blog\/wp-json\/wp\/v2\/posts\/295\/revisions"}],"predecessor-version":[{"id":2534,"href":"https:\/\/www.harepoint.com\/Blog\/wp-json\/wp\/v2\/posts\/295\/revisions\/2534"}],"wp:attachment":[{"href":"https:\/\/www.harepoint.com\/Blog\/wp-json\/wp\/v2\/media?parent=295"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.harepoint.com\/Blog\/wp-json\/wp\/v2\/categories?post=295"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.harepoint.com\/Blog\/wp-json\/wp\/v2\/tags?post=295"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}