Method PostSearchReqs

Summary

Search Requisitions

Remarks

Will return a list of requisitions that meet the below search criteria. You can search by Vendor number, PO number, creation date range or change date range.

Requires

Input Parameters

NameTypeLengthDescription
poNumber System.String 6 PO number to search by.
vendorNumber System.String 7 Vendor number to search by.
reqDateFrom mmddyy 6 Search from Date Issued in MMDDYY format.
reqDateTo mmddyy 6 Search to Date Issued in MMDDYY format.
chgDateFrom mmddyy 6 Search from Date Changed in MMDDYY format.
chgDateTo mmddyy 6 Search to Date Changed in MMDDYY format.

Example

POST http://localhost/FusionServices/v3/Naviline/ProductInventory/SearchReqs

Return Values

NameDescription
ReqNumber Requisition Number
POVendorNumber PO Vendor Number
POVendorName PO Vendor Name
Requisitioner Requisitioner
ReqDateCentury Requisition Date Century
ReqDateYear Requisition Date Year
ReqDateMonth Requisition Date Month
ReqDateDay Requisition Date Day
ReqTypeCP Requisition Type CP
DeliveryByCentury Delivery By Century
DeliveryByYear Delivery By Year
DeliveryByMonth Delivery By Month
DeliveryByDay Delivery By Day
ReqShipTo Ship To
BuyerCode Buyer Code
ReqStatus Requisition Status
ReqStatusUserID Status User ID
ReqStatusCentury Status Century
ReqStatusYear Status Year
ReqStatusMonth Status Month
ReqStatusDay Status Day
ReqStatusTime Status Time
ApprovedBy Approved By
UserID User ID
ReqContractNo Contract Number
ReqApprStatus Approval Status
ReqFiscalYrCode Fiscal Year Code
EmailSent Email Sent?
ErrorCode 0000=Success
ErrorDescription Error message describing any error that occurred

Sample Responses

Sample Code

using System.Net;
using Newtonsoft.Json.Linq;

public void MethodName(parms)
{
   string uri = "http://localhost/FusionServices/v3/Naviline/ProductInventory/SearchReqs";
   System.Collections.Specialized.NameValueCollection postParms = 
     new System.Collections.Specialized.NameValueCollection(); 
   // Set paramater values
   postParms.Add("poNumber",System.Web.HttpUtility.UrlEncode("017533"));
   postParms.Add("reqDateFrom",System.Web.HttpUtility.UrlEncode("102015"));
   postParms.Add("reqDateTo",System.Web.HttpUtility.UrlEncode("112015"));
   postParms.Add("editDateFrom",System.Web.HttpUtility.UrlEncode("020101"));
   postParms.Add("editDateTo",System.Web.HttpUtility.UrlEncode("020501"));

   WebClient req = new WebClient();
   wc.Headers.Add("Content-Type", "application/x-www-form-urlencoded");
   wc.Headers.Set("X-APPID", "YOURID");
   wc.Headers.Set("X-APPKEY", "YOURKEY");

   byte[] responseBytes = wc.UploadValues(new Uri(uri), "POST", postParms);
   string stringResult = Encoding.UTF8.GetString(responseBytes); 
   JObject response = JObject.Parse(stringResult);
   string error = response["OutputParms"]["ErrorCode"].ToString();
   if (error == "0000")
   {
        JArray jRows = (JArray)response["Rows"];
        foreach (JObject row in jRows)
        {
             string ReqNumber = row["ReqNumber"].ToString();
             string POVendorNumber = row["POVendorNumber"].ToString();
             string POVendorName = row["POVendorName"].ToString();
             string Requisitioner = row["Requisitioner"].ToString();
             string ReqDateCentury = row["ReqDateCentury"].ToString();
             string ReqDateYear = row["ReqDateYear"].ToString();
             string ReqDateMonth = row["ReqDateMonth"].ToString();
             string ReqDateDay = row["ReqDateDay"].ToString();
             string ReqTypeCP = row["ReqTypeCP"].ToString();
             string DeliveryByCentury = row["DeliveryByCentury"].ToString();
             string DeliveryByYear = row["DeliveryByYear"].ToString();
             string DeliveryByMonth = row["DeliveryByMonth"].ToString();
             string DeliveryByDay = row["DeliveryByDay"].ToString();
             string ReqShipTo = row["ReqShipTo"].ToString();
             string BuyerCode = row["BuyerCode"].ToString();
             string ReqStatus = row["ReqStatus"].ToString();
             string ReqStatusUserID = row["ReqStatusUserID"].ToString();
             string ReqStatusCentury = row["ReqStatusCentury"].ToString();
             string ReqStatusYear = row["ReqStatusYear"].ToString();
             string ReqStatusMonth = row["ReqStatusMonth"].ToString();
             string ReqStatusDay = row["ReqStatusDay"].ToString();
             string ReqStatusTime = row["ReqStatusTime"].ToString();
             string ApprovedBy = row["ApprovedBy"].ToString();
             string UserID = row["UserID"].ToString();
             string ReqContractNo = row["ReqContractNo"].ToString();
             string ReqApprStatus = row["ReqApprStatus"].ToString();
             string ReqFiscalYrCode = row["ReqFiscalYrCode"].ToString();
             string EmailSent = row["EmailSent"].ToString();
             // TODO - YOUR CODE HERE
        }
   }
}

C# Razor MVC Sample Code

using System;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;
using System.Collections.Specialized;
using FusionServiceHelper.Models;

// NOTE: Use the namespace generated when you add the class, so that it is correct.
namespace FusionRazor.Models
{
   public class PostSearchReqs
   {
       // Add property for each input param in order to map a field to it
       [RegularExpression("^(?=.{0,6}$).*", ErrorMessage = "Must be 6 characters or less. ")]
       public string poNumber{get; set;}

       [RegularExpression("^(?=.{0,7}$).*", ErrorMessage = "Must be 7 characters or less. ")]
       public string vendorNumber{get; set;}

       [RegularExpression("^(?=.{0,6}$).*", ErrorMessage = "Must be 6 characters or less. ")]
       public string reqDateFrom{get; set;}

       [RegularExpression("^(?=.{0,6}$).*", ErrorMessage = "Must be 6 characters or less. ")]
       public string reqDateTo{get; set;}

       [RegularExpression("^(?=.{0,6}$).*", ErrorMessage = "Must be 6 characters or less. ")]
       public string chgDateFrom{get; set;}

       [RegularExpression("^(?=.{0,6}$).*", ErrorMessage = "Must be 6 characters or less. ")]
       public string chgDateTo{get; set;}

       public PostSearchReqs()
       {
           //Set any defaults here
       }
   }
}
@* NOTE: Use Add->View to add the View. *@
@* NOTE: Check the 'Create strongly-typed view checkbox, and select the PostSearchReqs class. *@
@* NOTE: Select Edit as the Scaffold template. *@
@* NOTE: Use the @model line that is generated at the top.  Replace the rest with the lines below.
@model FusionRazor.Models.PostSearchReqs

@{
   ViewBag.Title = "PostSearchReqs";
}

<h2>PostSearchReqs</h2>
@using (Html.BeginForm()) {
   @Html.AntiForgeryToken()
   @Html.ValidationSummary(true)
   <fieldset>
   <legend>PostSearchReqs</legend>
       <div class="editor-label">
           @Html.LabelFor(model => model.poNumber)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.poNumber)
           @Html.ValidationMessageFor(model => model.poNumber)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.vendorNumber)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.vendorNumber)
           @Html.ValidationMessageFor(model => model.vendorNumber)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.reqDateFrom)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.reqDateFrom)
           @Html.ValidationMessageFor(model => model.reqDateFrom)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.reqDateTo)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.reqDateTo)
           @Html.ValidationMessageFor(model => model.reqDateTo)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.chgDateFrom)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.chgDateFrom)
           @Html.ValidationMessageFor(model => model.chgDateFrom)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.chgDateTo)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.chgDateTo)
           @Html.ValidationMessageFor(model => model.chgDateTo)
       </div>
       <p>
       <input type="submit" value="Submit"/>
       </p>
   </fieldset>

}

@section Scripts {
   @Scripts.Render("~/bundles/jqueryval")
}
using System;
using System.Collections.Specialized;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using FusionServiceHelper.Models;

// NOTE: Replace 'MyController' with the name of your controller.

// 
// GET: /MyController/PostSearchReqs
public ActionResult PostSearchReqs()
{
   // Create a new instance of the model to pick up any default values.
   PostSearchReqs model =  new PostSearchReqs();

   // pass model to set to default values
   // NOTE: Change 'MyFolderPath' to the path to the .cshtml file.
   return View("~/Views/MyFolderPath/PostSearchReqs.cshtml", model);
}

// 
// POST: /MyController/PostSearchReqs
[HttpPost]
public ActionResult PostSearchReqs(FormCollection collection)
{
   string url = "v3/Naviline/ProductInventory/SearchReqs";
   // Get the value from each input field
   NameValueCollection inputParms = new NameValueCollection();
   inputParms.Add("poNumber", collection["poNumber"]);
   inputParms.Add("vendorNumber", collection["vendorNumber"]);
   inputParms.Add("reqDateFrom", collection["reqDateFrom"]);
   inputParms.Add("reqDateTo", collection["reqDateTo"]);
   inputParms.Add("chgDateFrom", collection["chgDateFrom"]);
   inputParms.Add("chgDateTo", collection["chgDateTo"]);

   try
   {
       // Send the request
       FusionServiceRequest request = new FusionServiceRequest();
       FusionServiceResult result = request.Post(url, inputParms);

       return View("Result", result);
   }
   catch(Exception e)
   {
       HandleErrorInfo info = new HandleErrorInfo(e, "MyController", "PostSearchReqs");
       return View("Error", info);
   }
}