public newRequest SubmitRequest(string userID, string[] itemIds) { try { if (userID.Equals("") || itemIds.Length < 1) { return(new newRequest()); } var client = createClient(); string url = startURL + @"sc_request"; string body = "{'requested_for':'" + userID + "'}"; var result = (newRequest)uploadServiceNow(url, typeof(newRequest), body); string requestID = result.result.sys_id; string itemUrl = startURL + @"sc_req_item"; foreach (string id in itemIds) { if (id.Equals("") || id.Equals("hold")) { continue; } string itemBody = "{'quantity':'1','request':'" + requestID + "','cat_item':'" + id + "'}"; uploadServiceNow(url, typeof(RequestedItem), body); } writeLog("Created Request: " + result.result.number); return(result); } catch { newRequest u = new newRequest(); u.noResultData = true; return(u); } }
public newRequest SubmitRequest(string userID, string[] itemIds) { try { if (userID.Equals("") || itemIds.Length < 1) return new newRequest(); var client = createClient(); string url = startURL + @"sc_request"; string body = "{'requested_for':'" + userID + "'}"; var result = (newRequest)uploadServiceNow(url, typeof(newRequest), body); string requestID = result.result.sys_id; string itemUrl = startURL + @"sc_req_item"; foreach (string id in itemIds) { if (id.Equals("") || id.Equals("hold")) continue; string itemBody = "{'quantity':'1','request':'" + requestID + "','cat_item':'" + id + "'}"; uploadServiceNow(url, typeof(RequestedItem), body); } writeLog("Created Request: " + result.result.number); return result; } catch { newRequest u = new newRequest(); u.noResultData = true; return u; } }