I am trying to create a button on SharePoint online classic page which will submit to a list. From there a flow will run.
Just a question I have found an example how this can execute. A few questions:
- If I want the list to store the user information i.e who has pressed submit from there user profile, how can this be done the script
- If I want the department to = data science how can this be done in the script?
The code example is here using an example called test list
<script type="text/javascript">
$(document).ready(function () {
$("#btnAdd").click(function () {
var title = $("#txtTitle").val();
AddListItem(title);
});
});
function AddListItem(TitleField) {
$().SPServices({
operation: "UpdateListItems",
async: false,
batchCmd: "New",
listName: "testlist",
valuepairs: [["Title", TitleField]],
completefunc: function (xData, Status) {
alert("Data Saved! and Please check your List");
}
});
}
</script>
I am just learning jquery so thanks!