/*Put this code on Page*/
function StartWorkflowJsLink(overrideCtx) {
/*If you have multiple list views on page better hard code this ListID Variable*/
var ListID = overrideCtx.listName;
var ItemGuid = '';
/*Replace Template ID*/
var TemplateID = '{7f51f2f1-1bc9-42d9-86a8-2e0c34fa3323}'; /* Get it from workflow start page URL. It will be changed everytime you republish the workflow.*/
var SourceURL = window.location.href;
var ItemID = overrideCtx.CurrentItem.ID;
var webAbsoluteURL = _spPageContextInfo.webAbsoluteUrl;
var WFPageURL = '/_layouts/15/NintexWorkflow/StartWorkflow.aspx?';
debugger;
var workflowURL = webAbsoluteURL + WFPageURL + 'List=' + ListID + '&ID=' + ItemID + '&TemplateID=' + TemplateID + '&Source=' + SourceURL;
var btnHTML = btnHTML = "<input type=\"button\" onclick=\"GotoWFStartPage('" + workflowURL + "');\" value=\"Start Workflow\"></input>";
return btnHTML;
}
function GotoWFStartPage(workflowURL) {
window.location.href = workflowURL;
}
function registerListRenderer() {
var overrideCtx = {};
overrideCtx.Templates = {};
overrideCtx.Templates.Fields = {
'Edit': {
'View': StartWorkflowJsLink
}
};
SPClientTemplates.TemplateManager.RegisterTemplateOverrides(overrideCtx);
}
ExecuteOrDelayUntilScriptLoaded(registerListRenderer, 'clienttemplates.js');
/*Code Ends*/
function StartWorkflowJsLink(overrideCtx) {
/*If you have multiple list views on page better hard code this ListID Variable*/
var ListID = overrideCtx.listName;
var ItemGuid = '';
/*Replace Template ID*/
var TemplateID = '{7f51f2f1-1bc9-42d9-86a8-2e0c34fa3323}'; /* Get it from workflow start page URL. It will be changed everytime you republish the workflow.*/
var SourceURL = window.location.href;
var ItemID = overrideCtx.CurrentItem.ID;
var webAbsoluteURL = _spPageContextInfo.webAbsoluteUrl;
var WFPageURL = '/_layouts/15/NintexWorkflow/StartWorkflow.aspx?';
debugger;
var workflowURL = webAbsoluteURL + WFPageURL + 'List=' + ListID + '&ID=' + ItemID + '&TemplateID=' + TemplateID + '&Source=' + SourceURL;
var btnHTML = btnHTML = "<input type=\"button\" onclick=\"GotoWFStartPage('" + workflowURL + "');\" value=\"Start Workflow\"></input>";
return btnHTML;
}
function GotoWFStartPage(workflowURL) {
window.location.href = workflowURL;
}
function registerListRenderer() {
var overrideCtx = {};
overrideCtx.Templates = {};
overrideCtx.Templates.Fields = {
'Edit': {
'View': StartWorkflowJsLink
}
};
SPClientTemplates.TemplateManager.RegisterTemplateOverrides(overrideCtx);
}
ExecuteOrDelayUntilScriptLoaded(registerListRenderer, 'clienttemplates.js');
/*Code Ends*/