Method PostCall

Summary

Create a CRM Call with optional comments

Remarks

Create a new CRM call.

It requires the following information:

Input Parameters

NameTypeLengthDescription
EntityCode System.String 4 [Required] 4 letter code for the entity. Used to indicate what system the call is being entered for. Values are defined in iSeries under Contact Management > File Maintenance
contactID numeric 9 [Required] ID of the person who created the call
CallType System.String 4 [Required] 4 letter code indicating the type of call. See Get Request Types
Comments System.String 1000 Text to enter for the call
EmailNotify System.String 1 Contact wants to receive an email if the call is updated. Values: Y/N. Defaults to N
CallFromAreaCode numeric 3 Area code of the phone number the contact is calling from
CallFromPhoneNumber numeric 7 Phone number the contact is calling from. If you include the area code in the phone number, it will set the area code in the CallFromAreaCode field
CustomerNumber numeric 9 Customer ID to link to the call
LocationNumber numeric 9 Location ID to link to the call
ContactName System.String 50 Name of the person who made the call. This will default to the name linked to the contactID. Enter a different name here to overwrite the name on the Contact record
EntryDate numeric 7 Date call was entered. Defaults to current date if not entered. Only enter to override current date. Format: 1yyMMdd
EntryTime numeric 6 Time call was entered. Defaults to current time if not entered. Only enter to override current time. Format: hhmmss

Example

POST http://localhost/FusionServices/v2/Naviline/CRM/Call

Return Values

NameDescription
ErrorCode 0 = Success
CallID ID number of the new call created
EntityCode Entity Code assigned to the call
CustomerID Customer ID assigned to the call. 000000000 means none was assigned.
LocationID Location ID assigned to the call. 000000000 means none was assigned.
CallFromAreaCode Area code of phone number the call was from, if it was entered.
CallFromPhoneNumber Phone number the call was from, if it was entered.
CustomerAreaCode Area code of contact's home phone number.
CustomerPhoneNumber Contact's home phone number.
CallTypeCode Code for the Request Type that was entered.
CallStatus 1=Open, 2=Hold, 3=Closed, 4=Incomplete
ActionCode If the call triggered an action, such as a work order, this returns a code indicating the action taken.
ServiceCode
EntryUserID NaviLine user that entered the call. Defaults to WEB_USER if entered through this API.
EntryDate Date the call was entered. Defaults to current date.
EntryTime Time the call was entered. Defaults to current time.
ForwardedToUserID If the call triggered forwarding, this is the user it forwarded it to.
NotifyCustomer 1=None, 2=Call Back
UserDefinedNumber User defined number to return
UserDefinedCode User defined code to return
AlternateAreaCode Area code of contact's alternate phone number.
AlternatePhoneNumber Contact's alternate phone number.
NotificationDate Date notification was sent to customer. See NotifyCustomer.
ContactName Name from the contact record. Format: LAST, FIRST
FacilityID
FAXAreaCode Area code of contact's fax phone number.
FAXPhoneNumber Contact's fax phone number.
ContactID ID of the contact record that was entered.
EmailUpdate Y/N indicates contact wants to receive email notifications
CRTRequestID
OriginCode Code indicating where call originated from.
WorkGroup Work group the call is assigned to
RelatedCallID
WorkAreaCode Area code of contact's work phone number.
WorkPhoneNumber Contact's work phone number.
WorkPhoneExtension Contact's work phone number extension.
WorkFAXAreaCode Area code of contact's work fax number.
WorkFAXPhoneNumber Contact's work fax number.
NotificationUserID
PGMMDE A=Add
ErrorCode_comment Error code returned from adding the comment to the call. 0=Success
CallID_comment Call ID of the call the call the comment was added to.
COMMENTS Comment that was added to the call.
CommentDate Date comment was added to the call.
CommentUserID NaviLine user that entered the comment. Defaults to WEB_USER if entered through this API.

Sample Responses

Sample Code

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

public void MethodName(parms)
{
   string uri = "http://localhost/FusionServices/v2/Naviline/CRM/Call";
   System.Collections.Specialized.NameValueCollection postParms = 
     new System.Collections.Specialized.NameValueCollection(); 
   // Set paramater values
   postParms.Add("CallType",System.Web.HttpUtility.UrlEncode("RDKL"));
   postParms.Add("ContactID",System.Web.HttpUtility.UrlEncode("21172"));
   postParms.Add("Comments",System.Web.HttpUtility.UrlEncode("Fusion CRM PostCall URL Test 03242017 043526"));
   postParms.Add("EntityCode",System.Web.HttpUtility.UrlEncode("HTE"));
   postParms.Add("EmailNotify",System.Web.HttpUtility.UrlEncode("Y"));

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

       [Required(ErrorMessage = "Required")]
       [RegularExpression("[0-9]{0,9}", ErrorMessage = "Numeric values only. Must be 9 digits or less. ")]
       public string contactID{get; set;}

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

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

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

       [RegularExpression("[0-9]{0,3}", ErrorMessage = "Numeric values only. Must be 3 digits or less. ")]
       public string CallFromAreaCode{get; set;}

       [RegularExpression("[0-9]{0,7}", ErrorMessage = "Numeric values only. Must be 7 digits or less. ")]
       public string CallFromPhoneNumber{get; set;}

       [RegularExpression("[0-9]{0,9}", ErrorMessage = "Numeric values only. Must be 9 digits or less. ")]
       public string CustomerNumber{get; set;}

       [RegularExpression("[0-9]{0,9}", ErrorMessage = "Numeric values only. Must be 9 digits or less. ")]
       public string LocationNumber{get; set;}

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

       [RegularExpression("[0-9]{0,7}", ErrorMessage = "Numeric values only. Must be 7 digits or less. ")]
       public string EntryDate{get; set;}

       [RegularExpression("[0-9]{0,6}", ErrorMessage = "Numeric values only. Must be 6 digits or less. ")]
       public string EntryTime{get; set;}

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

@{
   ViewBag.Title = "PostCall";
}

<h2>PostCall</h2>
@using (Html.BeginForm()) {
   @Html.AntiForgeryToken()
   @Html.ValidationSummary(true)
   <fieldset>
   <legend>PostCall</legend>
       <div class="editor-label">
           @Html.LabelFor(model => model.EntityCode)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.EntityCode)
           @Html.ValidationMessageFor(model => model.EntityCode)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.contactID)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.contactID)
           @Html.ValidationMessageFor(model => model.contactID)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.CallType)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.CallType)
           @Html.ValidationMessageFor(model => model.CallType)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.Comments)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.Comments)
           @Html.ValidationMessageFor(model => model.Comments)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.EmailNotify)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.EmailNotify)
           @Html.ValidationMessageFor(model => model.EmailNotify)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.CallFromAreaCode)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.CallFromAreaCode)
           @Html.ValidationMessageFor(model => model.CallFromAreaCode)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.CallFromPhoneNumber)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.CallFromPhoneNumber)
           @Html.ValidationMessageFor(model => model.CallFromPhoneNumber)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.CustomerNumber)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.CustomerNumber)
           @Html.ValidationMessageFor(model => model.CustomerNumber)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.LocationNumber)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.LocationNumber)
           @Html.ValidationMessageFor(model => model.LocationNumber)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.ContactName)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.ContactName)
           @Html.ValidationMessageFor(model => model.ContactName)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.EntryDate)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.EntryDate)
           @Html.ValidationMessageFor(model => model.EntryDate)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.EntryTime)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.EntryTime)
           @Html.ValidationMessageFor(model => model.EntryTime)
       </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/PostCall
public ActionResult PostCall()
{
   // Create a new instance of the model to pick up any default values.
   PostCall model =  new PostCall();

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

// 
// POST: /MyController/PostCall
[HttpPost]
public ActionResult PostCall(FormCollection collection)
{
   string url = "v2/Naviline/CRM/Call";
   // Get the value from each input field
   NameValueCollection inputParms = new NameValueCollection();
   inputParms.Add("EntityCode", collection["EntityCode"]);
   inputParms.Add("contactID", collection["contactID"]);
   inputParms.Add("CallType", collection["CallType"]);
   inputParms.Add("Comments", collection["Comments"]);
   inputParms.Add("EmailNotify", collection["EmailNotify"]);
   inputParms.Add("CallFromAreaCode", collection["CallFromAreaCode"]);
   inputParms.Add("CallFromPhoneNumber", collection["CallFromPhoneNumber"]);
   inputParms.Add("CustomerNumber", collection["CustomerNumber"]);
   inputParms.Add("LocationNumber", collection["LocationNumber"]);
   inputParms.Add("ContactName", collection["ContactName"]);
   inputParms.Add("EntryDate", collection["EntryDate"]);
   inputParms.Add("EntryTime", collection["EntryTime"]);

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