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();


    function AddListItem(TitleField) {
            operation: "UpdateListItems",
            async: false,
            batchCmd: "New",
            listName: "testlist",
            valuepairs: [["Title", TitleField]],
            completefunc: function (xData, Status) {
                alert("Data Saved! and Please check your List");

I am just learning jquery so thanks!

1 Answer 1


You can achieve both these requirements:

  1. Whenever user clicks the submit button and create new item in list, SharePoint saves the name of user in Created By field against that item in list.

  2. If you want to track the name of users in separate list then you can create one new list and add new item in this list with user information after completion first item creation(in completefunc of the code you mentioned).

  3. To save the department in list, create one more field as department in your list and add one more value pair as department:'data science' in your valuepairs in your code.


  1. CRUD Operation on List in SharePoint using JQuery and Spservices.

  2. Programmatically Save the items into SharePoint List using Spservices.


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.