cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Workflow Hero

Create & Update Text Document with Workflow

Jump to solution

I have a Content Editor Web Part that I'd like to have some HTML code in. I plan on using the web part's Content Link field to link to a text file with my code. However, that HTML will need to be dynamically updated. Specifically, an ID number in the code will need to be updated from a list field. 

Does anyone know of a way, presumably with a Nintex Workflow, to update or create/overwrite a text file in a SharePoint library? I plan to store the text file in SiteAssets.

Also, just so you have the big picture, this process is going to be in a site template, which means it will be used in numerous different sites after they're created from the template. The HTML code is an iFrame that points to a mapping site, and the iFrame URL has a query string parameter. That parameter will be different for each site, but it will be in a dedicated list column, which is where I'd like to pull it from.




SharePoint 2013 On-Prem | Nintex Forms & Workflow Enterprise
0 Kudos
Reply
9 Replies
Workflow Hero

Re: Create & Update Text Document with Workflow

Jump to solution

I think this is still a good question, but I ended up solving my issue with HTML and JavaScript instead of Nintex.




SharePoint 2013 On-Prem | Nintex Forms & Workflow Enterprise
0 Kudos
Reply
Workflow Hero

Re: Create & Update Text Document with Workflow

Jump to solution

In case anyone else has a similar issue in the future, I'll detail my solution here.

I ended up not using a Nintex solution at all. I used HTML and JavaScript and saved it to a txt file in the SiteAssets library at the root of the site collection. I then used the Content Link field in a Content Editor Web Part on the homepage of the site template to link to the txt file. This allowed me to use the same URL in the template for all sites built from it, and set it up so there's only one place to make any future changes that will automatically replicate across all sites.

My code queries the current site looking for a specific list that will always be named Project Statement and then returns the value from the BrightWorkProjectNumber field. 

**Important Note:

The Project Statement list will only ever have one entry.

If there were multiple, this code would only return the last item as it's written right now.

The code then tests to ensure the number exists.

If it does, it builds the iFrame code and includes the number in the URL.

If it doesn't, an error message is displayed on the screen asking for the number to be entered into the list.

Here's the code:

<div id='locationMap'></div>
<script type='text/javascript'>
     var clientContext = new SP.ClientContext(_spPageContextInfo.webServerRelativeUrl);
     var oList = clientContext.get_web().get_lists().getByTitle('Project Statement');
     var camlQuery = new SP.CamlQuery();
     this.collListItem = oList.getItems(camlQuery);
     clientContext.load(collListItem);
     clientContext.executeQueryAsync(
        Function.createDelegate(this, this.onSucceeded),
          Function.createDelegate(this, this.onQueryFailed)
     );
     function onSucceeded(sender, args) {
          var bwProjectNum = '';
          var listItemEnumerator = collListItem.getEnumerator();
          while (listItemEnumerator.moveNext()) {
               var oListItem = listItemEnumerator.get_current();
               bwProjectNum = oListItem.get_item('BrightWorkProjectNumber');
               console.log("Brightwork Project Number: " + bwProjectNum);
          }
          if (bwProjectNum) {
               bwProjectNum = bwProjectNum.match(/\d+$/g);
               console.log("Map Project Number: " + bwProjectNum);
               document.getElementById('locationMap').innerHTML =
                    "<iframe src='<My Map URL>?proj_ID=" + bwProjectNum + "' style='width:100%;height:450px;'></iframe><br>" +
                    "<a href='<My Map URL>?proj_ID=" + bwProjectNum + "' target='_blank'>View Larger Map</a>";
          } else {
               document.getElementById('locationMap').innerHTML =
                    "<div style='color:red;font-weight:bold;'>Please enter a Brightwork Project Number into the Project Statement to display map.</div>";
          }
     }          
     function onQueryFailed(sender, args) {
          document.getElementById('locationMap').innerHTML =
               "<div style='color:red;font-weight:bold;'>An error has occurred.<br>Please review the browser console (F12) for details.</div>";
          console.log('Project Location Map Error: ' + args.get_message() + '\n' + args.get_stackTrace());
     }
</script>
‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

And here's my end result:

or:




SharePoint 2013 On-Prem | Nintex Forms & Workflow Enterprise
Reply
Workflow Hero

What is the Best Website for Engineering Assignment Help?

Jump to solution

Engineering is a subject that most students prefer for graduation. This degree comprises a number of lectures, assignments, and projects. Due to immense academic pressure, Assignment Help is the best way to get some relief. The team at assignment writing service helps you to submit assignments on time. No matter which stream you choose in engineering, you will get quick and quality technical assignments before the submission date. There are ample websites that provide assignment solutions for engineering course.

If you are looking for the best and affordable assignment writing solution, get connected with Online Assignment Help writing services. You will get various types of assignment writers that will meet your needs and requirements. All your engineering queries will be solved under a single platform. They have telephonic and live-chat services available 24*7 to proffer you undelayed help.

[url=https://www.greatassignmenthelp.com/]Assignment Help[/url]
0 Kudos
Reply
Workflow Hero

Book Attractive Nepal Tour Package in Your Budget

Jump to solution

When you have bored to visit so many tourist places of the world, but Nepal is a delightful tourist destination that gives you a wonderful experience beyond your expectations. Nepal is a very popular traveling destination that is offering something special for you. We are a popular tour operator agency in Nepal that offers attractive Nepal Tour Package suiting with your requirements and budget. Our amazing tour packages are fully affordable that do not give burden on your pocket. You can easily book your tour online because our tour agents will provide you all the details in the advance.

 

Tags (1)
0 Kudos
Reply
Workflow Hero

Re: Create & Update Text Document with Workflow

Jump to solution

Go to www.hp.com/support to immediately avail support from certified experts.

Paul Anderson
0 Kudos
Reply
Workflow Hero

Re: Create & Update Text Document with Workflow

Jump to solution

If you face any problem with quicken, directly contact Quicken Customer Support to get help certified experts.

0 Kudos
Reply
Workflow Hero

Re: Create & Update Text Document with Workflow

Jump to solution

Thanks for taking the time to discuss this, I feel strongly about it and love learning more on this topic. If possible, as you gain expertise, would you mind updating your blog with extra information? It is extremely helpful for me.

happy wheels

0 Kudos
Reply
Workflow Hero

Get standard remedy to exterminate its unexpected flaws

Jump to solution

Don’t be fret while Printer Offline Windows 10 message will be screened out your computer screen. You are not single user who is facing this error message due to existence of some failure. It is not the nice thing to consider this frustrating scanning behavior as your luck. Everybody does not hold the same technological intensity and cannot able to detect the major cause of heaps of failure.  Despite seeking the self-solution of problem, you would direct consult with expert team to rectify it as quick as possible. Our technical support is available throughout the day. For knowing more information, you must browse our web portal.

Visit Us:- https://www.hpprintersupportpro.com/my-hp-printer-is-offline

0 Kudos
Reply
Workflow Hero

Re: Get standard remedy to exterminate its unexpected flaws

Jump to solution

Thanks for the information. To get the best tech help for your damaged devices at home or office contact geek squad tech support number for help. To know about geek squad tech support prices contact us.

Robert Smith
0 Kudos
Reply