Function insertRows

  • Insert rows.

    Examples

    // This snippet inserts data from the ReagentReqForm into a list.
    // Upon success, it moves the user to the confirmation page and
    // passes the current user's ID to that page.
    LABKEY.Query.insertRows({
    containerPath: '/home/Study/demo/guestaccess',
    schemaName: 'lists',
    queryName: 'Reagent Requests',
    rows: [{
    "Name": ReagentReqForm.DisplayName.value,
    "Email": ReagentReqForm.Email.value,
    "UserID": ReagentReqForm.UserID.value,
    "Reagent": ReagentReqForm.Reagent.value,
    "Quantity": parseInt(ReagentReqForm.Quantity.value),
    "Date": new Date(),
    "Comments": ReagentReqForm.Comments.value,
    "Fulfilled": 'false'
    }],
    success: function(data) {
    window.location =
    '/home/Study/demo/wiki-page.view?name=confirmation&userid='
    + LABKEY.Security.currentUser.id;
    },
    });

    Parameters

    Returns XMLHttpRequest

    In client-side scripts, this method will return a transaction id for the async request that can be used to cancel the request. In server-side scripts, this method will return the JSON response object (first parameter of the success or failure callbacks).

Generated using TypeDoc