What I have is a list of documents that have different fields. I have a button called Submit - when this is clicked it changes the value of my dropdown from "Not in progress" to "Submit".

My flow triggers and its all working fine - except they need to refresh the page to see this working.

When I added in a simple jquery location refresh it just keeps refreshing the page non stop.

I've removed the refresh out of the code, how can I achieve this without breaking the page again :)

<script type="text/javascript"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
var targetListItem;
$(document).ready(function () {
    SP.SOD.executeFunc('sp.js', 'SP.ClientContext', execOperation);

function execOperation() {
    try {
        var  clientContext = new SP.ClientContext.get_current();      
        var myWeb = clientContext.get_web();
        var selectedItems  = SP.ListOperation.Selection.getSelectedItems(clientContext);
        var myList = myWeb.get_lists().getByTitle('Quality');
        var itemArray = [];
        for (var i = 0; i < selectedItems.length; i++) {            
             myListItem = myList.getItemById(selectedItems[i].id);

            itemArray[i] = myListItem;
             clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed));

            function onQuerySucceeded() {


function onQueryFailed(sender, args) {

alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
    catch (err) {


<input id="submitDocButton" type="button" value="Submit" onclick="execOperation();"></input>

1 Answer 1


It happens due to reload function so please replace



window.location = window.location.href;

And it will work fine.

More details please refer this stackoverflow link

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.