SHARE
TWEET

Untitled

a guest Jun 20th, 2019 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function CloseCaseRecord(itemID) {
  2. var item = {
  3.     __metadata: {
  4.         type: "SP.Data.CaseRecordListItem"
  5.     },
  6.     CaseStatus: "Closed"
  7. }
  8. $.ajax({
  9.     url: _spPageContextInfo.webAbsoluteUrl + "/_api/web/lists/GetByTitle('CaseRecord')/items(" + itemID + ")",
  10.     type: "PATCH",
  11.     data: JSON.stringify(item),
  12.     headers: {
  13.         "Accept": "application/json;odata=verbose",
  14.         "Content-Type": "application/json;odata=verbose",
  15.         "X-RequestDigest": $("#__REQUESTDIGEST").val(),
  16.         "X-HTTP-Method": "PATCH",
  17.         "If-Match": "*"
  18.     },
  19.     success: function(data, status, xhr) {
  20.         alert('Case closed successfully');
  21.         location.reload();
  22.     },
  23.     error: function(data) {
  24.         alert(data.responseJSON.error);
  25.     }
  26. });
  27. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top