Hi Alex,
I need your help in finding out how to update fields in custom JS.
I have a form with two buttons, "Save as draft" and "Submit", I have added them as HTML buttons on form and have hidden the defaut save and cancel button.
I have a multichoice field called Status in my custom list. This value gets updated on click of buttons on my form.
When Save as draft button is clicked, I should have my Multi choice field " Status" to be set as "Pending Submission"
This is my button html and custom JS
I also need to call a JBPM workflow API passing crendiatls after button click.
function SaveAsDraftButtonClicked()
{
$("input[id$='SaveItem']:first").trigger("click");
//how do i update the field?
alert('hi');
send();
}
function send()
{
alert('Inside Send function')
var urlvariable;
urlvariable = "http://xxxxxxxx:8080/v1/ViolationDraftCreationProcess";
var ItemJSON;
URL = urlvariable;
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = callbackFunction(xmlhttp);
xmlhttp.open("POST", URL, false);
xmlhttp.setRequestHeader("Content-Type", "application/json");
xmlhttp.setRequestHeader('Authorization', 'Basic ' + window.btoa('xyx:xyz')); //in prod, you should encrypt user name and password and provide encrypted keys here instead
xmlhttp.onreadystatechange = callbackFunction(xmlhttp);
xmlhttp.send();
alert( "Response Text : " + xmlhttp.responseText);
// document.getElementById("div").innerHTML = xmlhttp.statusText + ":" + xmlhttp.status + " ";
}
function callbackFunction(xmlhttp)
{
alert(xmlhttp.responseXML);
}