Method PostSvcOrderCommentUpdate

Summary

PostSvcOrderCommentUpdate

Remarks

This method allows external systems and mobile applications the ability to add or update comments on work orders without requiring direct iSeries access.

Input Parameters

NameTypeLengthDescription
serviceCode System.String 2 [Required] Service Code
issueDate System.String 7 [Required] Issue Date in format CYYMMDD.
workOrderNumber System.String 6 [Required] Work Order Number - numeric
workOrderType System.String 2 [Required] Work Order Type
workOrderCommentPrintLoc System.String 1 [Required] Work Order Comment Print Location - numeric
workOrderCommentSeq1 System.String 5 [Required] Work Order Comment Sequence 1 - numeric
workOrderCommentSeq2 System.String 5 [Required] Work Order Comment Sequence 2 - numeric
workOrderCommentCode System.String 4 [Required] Work Order Comment Code
workOrderAlphaComment System.String 50 [Required] Work Order Alpha Comment
workOrderNumericComment System.String 11 [Required] Work Order Comment Numeric

Example

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

Return Values

NameDescription
ErrorCode Error Code
ErrorMessage Error Message

Sample Responses

Sample Code

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

public void MethodName(parms)
{
   string uri = "http://localhost/FusionServices/v3/Naviline/Utilities/SvcOrderCommentUpdate";
   System.Collections.Specialized.NameValueCollection postParms = 
     new System.Collections.Specialized.NameValueCollection(); 
   // Set paramater values
   postParms.Add("serviceCode",System.Web.HttpUtility.UrlEncode("WA"));
   postParms.Add("issueDate",System.Web.HttpUtility.UrlEncode("1251104"));
   postParms.Add("workOrderNumber",System.Web.HttpUtility.UrlEncode("012436"));
   postParms.Add("workOrderType",System.Web.HttpUtility.UrlEncode("AC"));
   postParms.Add("workOrderCommentPrintLoc",System.Web.HttpUtility.UrlEncode("4"));
   postParms.Add("workOrderCommentSeq1",System.Web.HttpUtility.UrlEncode("00001"));
   postParms.Add("workOrderCommentSeq2",System.Web.HttpUtility.UrlEncode("00001"));
   postParms.Add("workOrderCommentCode",System.Web.HttpUtility.UrlEncode("GATE"));
   postParms.Add("workOrderAlphaComment",System.Web.HttpUtility.UrlEncode("Test comment"));
   postParms.Add("workOrderNumericComment",System.Web.HttpUtility.UrlEncode("00000000000"));

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

       [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;}

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

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

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

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

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

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

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

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

@{
   ViewBag.Title = "PostSvcOrderCommentUpdate";
}

<h2>PostSvcOrderCommentUpdate</h2>
@using (Html.BeginForm()) {
   @Html.AntiForgeryToken()
   @Html.ValidationSummary(true)
   <fieldset>
   <legend>PostSvcOrderCommentUpdate</legend>
       <div class="editor-label">
           @Html.LabelFor(model => model.serviceCode)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.serviceCode)
           @Html.ValidationMessageFor(model => model.serviceCode)
       </div>
       <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.workOrderType)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.workOrderType)
           @Html.ValidationMessageFor(model => model.workOrderType)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.workOrderCommentPrintLoc)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.workOrderCommentPrintLoc)
           @Html.ValidationMessageFor(model => model.workOrderCommentPrintLoc)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.workOrderCommentSeq1)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.workOrderCommentSeq1)
           @Html.ValidationMessageFor(model => model.workOrderCommentSeq1)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.workOrderCommentSeq2)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.workOrderCommentSeq2)
           @Html.ValidationMessageFor(model => model.workOrderCommentSeq2)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.workOrderCommentCode)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.workOrderCommentCode)
           @Html.ValidationMessageFor(model => model.workOrderCommentCode)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.workOrderAlphaComment)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.workOrderAlphaComment)
           @Html.ValidationMessageFor(model => model.workOrderAlphaComment)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.workOrderNumericComment)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.workOrderNumericComment)
           @Html.ValidationMessageFor(model => model.workOrderNumericComment)
       </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/PostSvcOrderCommentUpdate
public ActionResult PostSvcOrderCommentUpdate()
{
   // Create a new instance of the model to pick up any default values.
   PostSvcOrderCommentUpdate model =  new PostSvcOrderCommentUpdate();

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

// 
// POST: /MyController/PostSvcOrderCommentUpdate
[HttpPost]
public ActionResult PostSvcOrderCommentUpdate(FormCollection collection)
{
   string url = "v3/Naviline/Utilities/SvcOrderCommentUpdate";
   // Get the value from each input field
   NameValueCollection inputParms = new NameValueCollection();
   inputParms.Add("serviceCode", collection["serviceCode"]);
   inputParms.Add("issueDate", collection["issueDate"]);
   inputParms.Add("workOrderNumber", collection["workOrderNumber"]);
   inputParms.Add("workOrderType", collection["workOrderType"]);
   inputParms.Add("workOrderCommentPrintLoc", collection["workOrderCommentPrintLoc"]);
   inputParms.Add("workOrderCommentSeq1", collection["workOrderCommentSeq1"]);
   inputParms.Add("workOrderCommentSeq2", collection["workOrderCommentSeq2"]);
   inputParms.Add("workOrderCommentCode", collection["workOrderCommentCode"]);
   inputParms.Add("workOrderAlphaComment", collection["workOrderAlphaComment"]);
   inputParms.Add("workOrderNumericComment", collection["workOrderNumericComment"]);

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