1

I'm fairly new to developing and I have a custom form that I made using SharePoint designer 2010 - I need to start my workflow on the click of the button, but I'm not using a site based workflow, so my code for the start button doesn't work. My alternative is to have onclick set fields value (I have a hidden text field called start workflow) to yes.

For now this is what I have

<input name="StartWorkflow" type="button" value="Start Workflow" onclick=””/> 

This is what I've found - but I don't believe its correct to go in my onclick event.

I’m finding information relative to things outside of SharePoint so it’s confusing to put two and two together – I did find this information

var siteUrl = '/sites/MySiteCollection';

function updateListItem() {

    var clientContext = new SP.ClientContext(siteUrl);
    var oList = clientContext.get_web().get_lists().getByTitle('Announcements');

    this.oListItem = oList.getItemById(3);

    oListItem.set_item('Title', 'My Updated Title');

    oListItem.update();

    clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed));
}

function onQuerySucceeded() {

    alert('Item updated!');
}

function onQueryFailed(sender, args) {

    alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
}

Also does anyone know how to create a onclick= redirect to.."www..etc"

0

You can get the ID of the list item from the query string which you can pass in your code.

You can then pass your hidden field in set_item. Though just modifying any field will cause the workflow to run if you've set the workflow to run on modification.

Also, a simple window.location can help you redirect to another Url.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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