Method PostSvcOrderUpdate

Summary

Service Order Update - Update Service Order Status and/or Action Taken and Completion Date.

Remarks

Active statuses PC and PR are not available for Update. If Action entered then Completion Date must be entered. All Service Orders with a status II – Incomplete MUST BE maintained within NaviLine. Error codes: 0000 Success, 0001 Invalid Work Order Status, 0002 Changes are not allowed for PC or PR statuses, 0003 Status is complete or canceled no action taken., 0004 Invalid Action Taken, 0005 Comp Date cannot be Blanks when action code entered, 0006 Action Code cannot be Blanks when Comp date entered, 0007 Invalid Completion Date, 0090 Error = No Records Found, 9999 Error = More records recall program.

Requires

Input Parameters

NameTypeLengthDescription
issueDate System.String 7 [Required] Issue date in CYYMMDD Format
workOrderNumber System.String 6 [Required] Work Order Number
workOrderStatus System.String 2 Work Order Status
completionAction System.String 4 Completion Action
completionDate System.String 1 Completion Date in CYYMMDD Format - required if comopletionAction is entered

Example

POST http://localhost/FusionServices/v3/Naviline/Utilities/SvcOrderUpdate

Return Values

NameDescription
ErrorCode 0003
ErrorMessage Status is complete or canceled no action taken.

Sample Responses

Sample Code

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

public void MethodName(parms)
{
   string uri = "http://localhost/FusionServices/v3/Naviline/Utilities/SvcOrderUpdate";
   System.Collections.Specialized.NameValueCollection postParms = 
     new System.Collections.Specialized.NameValueCollection(); 
   // Set paramater values
   postParms.Add("issueDate",System.Web.HttpUtility.UrlEncode("1140521"));
   postParms.Add("workOrderNumber",System.Web.HttpUtility.UrlEncode("1038"));
   postParms.Add("completionAction",System.Web.HttpUtility.UrlEncode("REPR"));
   postParms.Add("completionDate",System.Web.HttpUtility.UrlEncode("1220510"));

   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")
   {
         // 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 PostSvcOrderUpdate
   {
       // Add property for each input param in order to map a field to it
       [Required(ErrorMessage = "Required")]
       [RegularExpression("^(?=.{0,7}$).*", ErrorMessage = "Must be 7 characters or less. ")]
       public string issueDate{get; set;}

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

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

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

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

       public PostSvcOrderUpdate()
       {
           //Set any defaults here
       }
   }
}
@* NOTE: Use Add->View to add the View. *@
@* NOTE: Check the 'Create strongly-typed view checkbox, and select the PostSvcOrderUpdate 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.PostSvcOrderUpdate

@{
   ViewBag.Title = "PostSvcOrderUpdate";
}

<h2>PostSvcOrderUpdate</h2>
@using (Html.BeginForm()) {
   @Html.AntiForgeryToken()
   @Html.ValidationSummary(true)
   <fieldset>
   <legend>PostSvcOrderUpdate</legend>
       <div class="editor-label">
           @Html.LabelFor(model => model.issueDate)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.issueDate)
           @Html.ValidationMessageFor(model => model.issueDate)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.workOrderNumber)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.workOrderNumber)
           @Html.ValidationMessageFor(model => model.workOrderNumber)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.workOrderStatus)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.workOrderStatus)
           @Html.ValidationMessageFor(model => model.workOrderStatus)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.completionAction)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.completionAction)
           @Html.ValidationMessageFor(model => model.completionAction)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.completionDate)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.completionDate)
           @Html.ValidationMessageFor(model => model.completionDate)
       </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/PostSvcOrderUpdate
public ActionResult PostSvcOrderUpdate()
{
   // Create a new instance of the model to pick up any default values.
   PostSvcOrderUpdate model =  new PostSvcOrderUpdate();

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

// 
// POST: /MyController/PostSvcOrderUpdate
[HttpPost]
public ActionResult PostSvcOrderUpdate(FormCollection collection)
{
   string url = "v3/Naviline/Utilities/SvcOrderUpdate";
   // Get the value from each input field
   NameValueCollection inputParms = new NameValueCollection();
   inputParms.Add("issueDate", collection["issueDate"]);
   inputParms.Add("workOrderNumber", collection["workOrderNumber"]);
   inputParms.Add("workOrderStatus", collection["workOrderStatus"]);
   inputParms.Add("completionAction", collection["completionAction"]);
   inputParms.Add("completionDate", collection["completionDate"]);

   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", "PostSvcOrderUpdate");
       return View("Error", info);
   }
}