How to add an attachment functionality in a service portal widget form?

Krishna Priya
Tera Contributor

Hi All,

I have this widget form. I want to add an attachment functionality where users can add attachment in service portal that attachment should save in ticket as well.

Do you have an idea how to do it?

Please advise.

 

Thanks!

1 ACCEPTED SOLUTION

hammad ul aziz2
Mega Guru

Hi Krishna,

try the below-mentioned code and let me know if that works.

HTML

<!-- tab: quick setup -->
<div class="panel panel-default">
  <div class="panel-heading">
    <h4 class="panel-title">Create Incident</h4>
    <div>Create an Incident record to report and request assistance with an issue you are having</div>
  </div>
  <div class="panel-body">

    <label class="col-sm-2 control-label">Coworker</label>
    <div class="col-sm-10">
      <sn-record-picker field="user"
                        table="'sys_user'"
                        display-field="'name'"
                        value-field="'sys_id'"
                        sn-disabled="'true'"
                        search-fields="'user_name,name'">
      </sn-record-picker>
    </div>
  </div>

  <div class="panel-body">
    <label for="" class="col-sm-2 control-label">Phone</label>
    <div class="col-sm-10">
      <input type="text" class="form-control" ng-model="data.user.phone" name="phone">
    </div>
  </div>

  <div class="panel-body">
    <label for="" class="col-sm-2 control-label">Email</label>
    <div class="col-sm-10">
      <input type="text" class="form-control" ng-model="data.user.email" name="email">
    </div>
  </div>

  <div class="panel-body">
    <label class="col-sm-2 control-label">Location</label>
    <div class="col-sm-10">
      <sn-record-picker
                        field="location"
                        table="'cmn_location'"
                        display-field="'name'"
                        value-field="'sys_id'"
                        sn-disabled="'true'"
                        search-fields="'name'">
      </sn-record-picker>
    </div>
  </div>




  <div class="panel-body">
    <label for="" class="col-sm-2 control-label">Area</label>
    <div class="col-sm-10">
      <select class="form-control select2" style="width: 100%;" name="area" ng-model="data.area" ng-disabled="data.disabled" ng-change="checkArea()">
        <option selected="selected" disabled="disabled">-Select-</option>
        <option value="AcceptanceNow">Agreement Requests for ANOW Customers</option>
        <option value="Accounts Payable">Accounts Payable</option>
        <option value="Asset Protection">Asset Protection</option>
        <option value="Benefits">Benefits</option>
        <option value="Customer Account Issues">Customer Account Issues (ePay, Agreement Info, EPO, Benefits Plus, LDW)</option>
        <option value="Enterprise Data Services">Enterprise Data Services</option>
        <option value="Expense Management">Expense Management</option>
        <option value="Fixed Assets">Fixed Assets</option>
        <option value="General Ledger">General Ledger</option>
        <option value="HRIS">HRIS</option>
        <option value="Inventory Payables (ANOW)">Inventory Payables (ANOW)</option>
        <option value="Inventory Payables (RTO)">Inventory Payables (RTO)</option>
        <option value="Lease Accounting">Lease Accounting</option>
        <option value="Lease Admin">Lease Admin</option>
        <option value="Payroll">Payroll</option>
        <option value="Property Management">Property Management</option>
        <option value="Staffing">Staffing</option>
        <option value="Store Operations">Store Operations</option>
        <option value="Solution Center Credit Reporting">Solution Center Credit Reporting</option>
        <option value="Tax Accounting">Tax Accounting</option>
        <option value="Technical Support">Technical Support (SIMS, High Touch, iPads, AirWatch, Computer or Printer Issue)</option>
        <option value="Treasury Management">Treasury Management</option>
      </select>
    </div>
  </div>


  <div class="panel-body">
    <label class="col-sm-2 control-label">CoworkerConcern</label>
    <div class="col-sm-10">
      <sn-choice-list
                      field="c.myCoworkerConcern"
                      sn-model="c.myCoworkerConcern"
                      sn-options="c.myCoworkerConcernlistoption"
                      sn-value-field="myChoiceValue"
                      sn-text-field="myChoiceDisplay"
                      sn-items="c.myCoworkerConcernoptions"
                      sn-on-change="c.valueSelected(selectedValue)">
      </sn-choice-list>
    </div>
  </div>

  <!-- <select id="coworker_concern" name="coworker_concern" ng-model="c.data.CoworkerConcern">
<option disabled hidden style='display: none' value=''></option>
<!--<option value="{{group.value}}" ng-repeat="group in data.groups" ng-selected="{{group.value == "12acb2770ffe8a00fdbdb0c362050e27}}">{{group.name}}</option>-->
  <!--</select>-->

  <div class="panel-body">
    <label for="" class="col-sm-2 control-label">Description</label>
    <div class="col-sm-10">
      <textarea class="form-control" name="description" ng-model="data.description" rows="3">

      </textarea>
    </div>
  </div>
  <div class="panel-body">
   <div class="att-group">
            Attachment: <input type="file" id="fileToUpload" multiple onchange="angular.element(this).scope().setFiles(this)"/>
            <br/>  <div ng-show="files.length">
              <div ng-repeat="file in files.slice(0)">
                  <span>{{file.webkitRelativePath || file.name}}</span>
                  (<span ng-switch="file.size > 1024*1024">
                      <span ng-switch-when="true">{{file.size / 1024 / 1024 | number:2}} MB</span>
                      <span ng-switch-default>{{file.size / 1024 | number:2}} kB</span>
                  </span>)<span class="glyphicon glyphicon-remove-circle" id="removeicon" ng-click="removeFiles(file)"></span>
               		 <div ng-if="data.upLoadAtt" ng-init="uploadFiles()">
								</div>
              </div>
          </div>
      </div>
  </div>
  <div class="panel-footer">
    <div align="right">

      <a ng-disabled="status"
         name="submit"
         ng-click="update()"
         class="btn btn-primary">
        <span ng-show="status">{{status}}</span>
        <span ng-show="!status">${Submit}</span>
      </a>

    </div>
  </div>

</div>

CLIENT SCRIPT

function($scope, $http,$rootScope, $timeout, spUtil, $location, $window) 
{
	/* widget controller */
	var c = this;
	// c.data.area="Asset Protection";
	// alert ("Area Vakue : "+c.data.area);
	$scope.user = {
		displayValue: c.data.useraname,
		value: c.data.usersys_id,
		name: 'user'
	};

	$scope.location = {
		displayValue: c.data.loc.name,
		value: c.data.loc.sys_id,
		name: 'location'
	};

	$scope.$on("field.change", function(evt, parms) {

		if (parms.field.name == 'location')
			c.data.setLocation = parms.newValue;

		c.server.update().then(function(response) {
			spUtil.update($scope);
		})
	});
	// CODE FOR fileupload  
	$scope.files = [];
	$scope.setFiles = function(element) {
		$scope.$apply(function() {

			//	console.log('files:', element.files);
			// Turn the FileList object into an Array
			for (var i = 0; i < element.files.length; i++) {
				$scope.files.push(element.files[i]);
				//	console.log('a');
			}

			$scope.files.forEach(myFunction);

			function myFunction(item, index) {
				// console.log(item+''+index);
			}
		});
	};

	$scope.removeFiles = function(fname) {
		var index = $scope.files.indexOf(fname);
		if(index>-1)
			$scope.files.splice(index,1);
	};  

	$scope.uploadFiles = function() { 
		$scope.fd = new FormData();
		//	console.log('1231231313132123'+$scope.files.length);
		$scope.files.forEach(function(file){
			$scope.fd.set('files', file);
			var request = {
				method: 'POST',
				url: 'https://'+c.data.instanceName+'.service-now.com/api/now/attachment/file?table_name='+c.data.table+'&table_sys_id='+c.data.rec_sysid+'&file_name='+file.name,
				data: $scope.fd.get('files'),
				headers: {
					'Content-Type': file.type,
					'Accept':'application/json'         
				}
			};
			//console.log('HTTP request:',request);

			// SEND THE FILES.
			$http(request)
				.success(function (d) {
				// On success code here
			})
				.error(function (err) {
				// On error code here
			});

		});
		c.data.upLoadAtt = false;
	}
	$scope.checkArea = function() {
		//alert("ON CHange "); // (title =='Customer Account Issues' || title =='AcceptanceNow' ||
		//alert ("Area Vakue : ON change "+c.data.area);
		if (c.data.area == "Accounts Payable")
			// c.data.description= "Expense check date/amount = " + "\n" + "Brief desciption of issue =" ;
			c.myCoworkerConcernoptions = [{
				myChoiceDisplay: "Storage Question",
				myChoiceValue: 'Storage Question'
			},
																		{
																			myChoiceDisplay: "P & L Inquiry",
																			myChoiceValue: 'P & L Inquiry'
																		},
																		{
																			myChoiceDisplay: "Email inquiry",
																			myChoiceValue: 'Email inquiry'
																		},
																		{
																			myChoiceDisplay: "Expense Check Status",
																			myChoiceValue: 'Expense Check Status'
																		},
																		{
																			myChoiceDisplay: "Did not receive/Stop Pay",
																			myChoiceValue: 'Did not receive/Stop Pay'
																		},
																		{
																			myChoiceDisplay: "Customer Refund Check Status",
																			myChoiceValue: 'Customer Refund Check Status'
																		},
																		{
																			myChoiceDisplay: "Check invoice status",
																			myChoiceValue: 'Check invoice status'
																		},
																		{
																			myChoiceDisplay: "W9 Form",
																			myChoiceValue: 'W9 Form'
																		},
																		{
																			myChoiceDisplay: "EFM Form",
																			myChoiceValue: 'EFM Form'
																		}
																	 ];
		c.myCoworkerConcernlistoption = {
			hideSearch: true
		};
		c.myCoworkerConcern = "Storage Question"; 
		//{
		if (c.data.area == "Solution Center Credit Reporting")
			c.myCoworkerConcernoptions = [{
				myChoiceDisplay: "Bullseye Request",
				myChoiceValue: 'Bullseye Request'
			},
																		{
																			myChoiceDisplay: "Disputes Payment History / Charge-Off / Write-Off",
																			myChoiceValue: 'Disputes Payment History / Charge-Off / Write-Off'
																		},
																		{
																			myChoiceDisplay: "General Credit Reporting Questions",
																			myChoiceValue: 'General Credit Reporting Questions'
																		},
																		{
																			myChoiceDisplay: "Payment Not Reflecting on Credit Yet",
																			myChoiceValue: 'Payment Not Reflecting on Credit Yet'
																		},
																		{
																			myChoiceDisplay: "Received Calls from Collection Agency",
																			myChoiceValue: 'Received Calls from Collection Agency'
																		},
																		{
																			myChoiceDisplay: "Requesting Removal From Credit / Contract Cancelled Before Delivery",
																			myChoiceValue: 'Requesting Removal From Credit / Contract Cancelled Before Delivery'
																		},
																		{
																			myChoiceDisplay: "Settle an Account / Repair Credit",
																			myChoiceValue: 'Settle an Account / Repair Credit'
																		}
																	 ];
		c.myCoworkerConcernlistoption = {
			hideSearch: true
		};
		c.myCoworkerConcern = "Bullseye Request"; 
		//{
		if (c.data.area == "AcceptanceNow")
			c.myCoworkerConcernoptions = [{
				myChoiceDisplay: "Store Requesting Copies of Agreement",
				myChoiceValue: 'Store Requesting Copies of Agreement'
			}];
		c.myCoworkerConcernlistoption = {
			hideSearch: true
		};
		c.myCoworkerConcern = "Store Requesting Copies of Agreement"; 
		//{
		if (c.data.area == "Customer Account Issues")
			c.myCoworkerConcernoptions = [{
				myChoiceDisplay: "Other",
				myChoiceValue: 'Other'
			}];
		c.myCoworkerConcernlistoption = {
			hideSearch: true
		};
		c.myCoworkerConcern = "Other"; 
		//{

		if (c.data.area == "Asset Protection")
			c.myCoworkerConcernoptions = [{
				myChoiceDisplay: "Pin Enrollment",
				myChoiceValue: 'Pin Enrollment'
			},
																		{
																			myChoiceDisplay: "Safe Service",
																			myChoiceValue: 'Safe Service'
																		},
																		{
																			myChoiceDisplay: "Alarm System Service",
																			myChoiceValue: 'Alarm System Service'
																		},
																		{
																			myChoiceDisplay: "Camera",
																			myChoiceValue: 'Camera'
																		},
																		{
																			myChoiceDisplay: "Remote Access",
																			myChoiceValue: 'Remote Access'
																		}
																	 ];
		c.myCoworkerConcernlistoption = {
			hideSearch: true
		};
		c.myCoworkerConcern = "Pin Enrollment"; 
		//{
		if (c.data.area == "Benefits")
			c.myCoworkerConcernoptions = [{
				myChoiceDisplay: "Did not Receive Bonus",
				myChoiceValue: 'Did not Receive Bonus'
			},
																		{
																			myChoiceDisplay: "General Bonus Inquiry",
																			myChoiceValue: 'General Bonus Inquiry'
																		},
																		{
																			myChoiceDisplay: "Unemployment Inquiry",
																			myChoiceValue: 'Unemployment Inquiry'
																		},
																		{
																			myChoiceDisplay: "Verification of Employment (VOE)",
																			myChoiceValue: 'Verification of Employment (VOE)'
																		},
																		{
																			myChoiceDisplay: "Service Awards",
																			myChoiceValue: 'Service Awards'
																		},
																		{
																			myChoiceDisplay: "Submit a Death Claim",
																			myChoiceValue: 'Submit a Death Claim'
																		}
																	 ];
		c.myCoworkerConcernlistoption = {
			hideSearch: true
		};
		c.myCoworkerConcern = "Did not Receive Bonus";

		//{
		if (c.data.area == "Expense Management")
			c.myCoworkerConcernoptions = [{
				myChoiceDisplay: "InnerWorkings/Coupa issue",
				myChoiceValue: 'InnerWorkings/Coupa issue'
			},
																		{
																			myChoiceDisplay: "General inquiry",
																			myChoiceValue: 'General inquiry'
																		},
																		{
																			myChoiceDisplay: "Concur mobile app",
																			myChoiceValue: 'Concur mobile app'
																		},
																		{
																			myChoiceDisplay: "General inquiry",
																			myChoiceValue: 'General inquiry'
																		}
																	 ];
		c.myCoworkerConcernlistoption = {
			hideSearch: true
		};
		c.myCoworkerConcern = "InnerWorkings/Coupa issue"; 
		//{
		if (c.data.area == "Fixed Assets")
			c.myCoworkerConcernoptions = [{
				myChoiceDisplay: "Issues with telecom/2-way radios",
				myChoiceValue: 'Issues with telecom/2-way radios'
			},
																		{
																			myChoiceDisplay: "New equipment request",
																			myChoiceValue: 'New equipment request'
																		},
																		{
																			myChoiceDisplay: "Wrong serial number",
																			myChoiceValue: 'Wrong serial number'
																		},
																		{
																			myChoiceDisplay: "Audit issues",
																			myChoiceValue: 'Audit issues'
																		},
																		{
																			myChoiceDisplay: "Missing assets (not on list)",
																			myChoiceValue: 'Missing assets (not on list)'
																		},
																		{
																			myChoiceDisplay: "Invoice status inquiry",
																			myChoiceValue: 'Invoice status inquiry'
																		}
																	 ];
		c.myCoworkerConcernlistoption = {
			hideSearch: true
		};
		c.myCoworkerConcern = "Issues with telecom/2-way radios";

		//{
		if (c.data.area == "General Ledger")
			c.myCoworkerConcernoptions = [{
				myChoiceDisplay: "Benefits Plus Charge Offer",
				myChoiceValue: 'Benefits Plus Charge Offer'
			},
																		{
																			myChoiceDisplay: "General GL Inquiry",
																			myChoiceValue: 'General GL Inquiry'
																		},
																		{
																			myChoiceDisplay: "General P&L Inquiry",
																			myChoiceValue: 'General P&L Inquiry'
																		},
																		{
																			myChoiceDisplay: "Mistake with Charge on GL or P&L",
																			myChoiceValue: 'Mistake with Charge on GL or P&L'
																		},
																		{
																			myChoiceDisplay: "PLQA Resolution System Questions",
																			myChoiceValue: 'PLQA Resolution System Questions'
																		}
																	 ];
		c.myCoworkerConcernlistoption = {
			hideSearch: true
		};
		c.myCoworkerConcern = "Benefits Plus Charge Offer";

		//{
		if (c.data.area == "HRIS")
			c.myCoworkerConcernoptions = [{
				myChoiceDisplay: "Did not Receive Referral Pay",
				myChoiceValue: 'Did not Receive Referral Pay'
			},
																		{
																			myChoiceDisplay: "Coworker Referral Denied",
																			myChoiceValue: 'Coworker Referral Denied'
																		},
																		{
																			myChoiceDisplay: "General Inquiry",
																			myChoiceValue: 'General Inquiry'
																		},
																		{
																			myChoiceDisplay: "Need Employee ID#",
																			myChoiceValue: 'Need Employee ID#'
																		},
																		{
																			myChoiceDisplay: "Onboarding technical support",
																			myChoiceValue: 'Onboarding technical support'
																		},
																		{
																			myChoiceDisplay: "Request Term Letter",
																			myChoiceValue: 'Request Term Letter'
																		}
																	 ];
		c.myCoworkerConcernlistoption = {
			hideSearch: true
		};
		c.myCoworkerConcern = "Did not Receive Referral Pay"; 
		//{
		if (c.data.area == "Inventory Payables (ANOW)")
			c.myCoworkerConcernoptions = [{
				myChoiceDisplay: "ACH/Banking Update",
				myChoiceValue: 'ACH/Banking Update'
			},
																		{
																			myChoiceDisplay: "Charge-Off",
																			myChoiceValue: 'Charge-Off'
																		},
																		{
																			myChoiceDisplay: "Online Invoice Submission System",
																			myChoiceValue: 'Online Invoice Submission System'
																		},
																		{
																			myChoiceDisplay: "Payment Status",
																			myChoiceValue: 'Payment Status'
																		},
																		{
																			myChoiceDisplay: "Refund Check",
																			myChoiceValue: 'Refund Check'
																		},
																		{
																			myChoiceDisplay: "Vendor Set-Up",
																			myChoiceValue: 'Vendor Set-Up'
																		},
																		{
																			myChoiceDisplay: "Inventory Transfer Confirmation",
																			myChoiceValue: 'Inventory Transfer Confirmation'
																		},
																		{
																			myChoiceDisplay: "Price/Serial Number Changes",
																			myChoiceValue: 'Price/Serial Number Changes'
																		}
																	 ];
		c.myCoworkerConcernlistoption = {
			hideSearch: true
		};
		c.myCoworkerConcern = "ACH/Banking Update";

		//{
		if (c.data.area == "Inventory Payables (RTO)")
			c.myCoworkerConcernoptions = [{
				myChoiceDisplay: "GL Expense/Credits",
				myChoiceValue: 'GL Expense/Credits'
			},
																		{
																			myChoiceDisplay: "Move Expenses",
																			myChoiceValue: 'Move Expenses'
																		},
																		{
																			myChoiceDisplay: "Extra Item Found",
																			myChoiceValue: 'Extra Item Found'
																		},
																		{
																			myChoiceDisplay: "Inventory Error",
																			myChoiceValue: 'Inventory Error'
																		},
																		{
																			myChoiceDisplay: "Partial PO Received",
																			myChoiceValue: 'Partial PO Received'
																		},
																		{
																			myChoiceDisplay: "Price/Serial Number Changes",
																			myChoiceValue: 'Price/Serial Number Changes'
																		},
																		{
																			myChoiceDisplay: "Vendor Shipping Error",
																			myChoiceValue: 'Vendor Shipping Error'
																		},
																		{
																			myChoiceDisplay: "Wrong Item Received",
																			myChoiceValue: 'Wrong Item Received'
																		},
																		{
																			myChoiceDisplay: "Closed PO Needs to be Opened",
																			myChoiceValue: 'Closed PO Needs to be Opened'
																		},
																		{
																			myChoiceDisplay: "Open PO Needs to be Closed",
																			myChoiceValue: 'Open PO Needs to be Closed'
																		},
																		{
																			myChoiceDisplay: "Wrong Store",
																			myChoiceValue: 'Wrong Store'
																		},
																		{
																			myChoiceDisplay: "General Inquiry",
																			myChoiceValue: 'General Inquiry'
																		},
																		{
																			myChoiceDisplay: "Vendor Information",
																			myChoiceValue: 'Vendor Information'
																		}
																	 ];
		c.myCoworkerConcernlistoption = {
			hideSearch: true
		};
		c.myCoworkerConcern = "GL Expense/Credits";

		//{
		if (c.data.area == "Lease Accounting")
			c.myCoworkerConcernoptions = [{
				myChoiceDisplay: "Rent Payment Inquiry",
				myChoiceValue: 'Rent Payment Inquiry'
			},
																		{
																			myChoiceDisplay: "CAM (Common Area Maintenance)",
																			myChoiceValue: 'CAM (Common Area Maintenance)'
																		},
																		{
																			myChoiceDisplay: "Tax Inquiry",
																			myChoiceValue: 'Tax Inquiry'
																		},
																		{
																			myChoiceDisplay: "Insurance Inquiry",
																			myChoiceValue: 'Insurance Inquiry'
																		},
																		{
																			myChoiceDisplay: "Accounting Inquiry",
																			myChoiceValue: 'Accounting Inquiry'
																		}
																	 ];
		c.myCoworkerConcernlistoption = {
			hideSearch: true
		};
		c.myCoworkerConcern = "Rent Payment Inquiry";

		//{
		if (c.data.area == "Lease Admin")
			c.myCoworkerConcernoptions = [{
				myChoiceDisplay: "Certificate of Insurance",
				myChoiceValue: 'Certificate of Insurance'
			},
																		{
																			myChoiceDisplay: "Change of Ownership",
																			myChoiceValue: 'Change of Ownership'
																		},
																		{
																			myChoiceDisplay: "Property for Lease/Rent",
																			myChoiceValue: 'Property for Lease/Rent'
																		}
																	 ];
		c.myCoworkerConcernlistoption = {
			hideSearch: true
		};
		c.myCoworkerConcern = "Certificate of Insurance";

		//{
		if (c.data.area == "Staffing")
			c.myCoworkerConcernoptions = [{
				myChoiceDisplay: "Background/Drug Test Status",
				myChoiceValue: 'Background/Drug Test Status'
			},
																		{
																			myChoiceDisplay: "DOT verification Fax Confirmation",
																			myChoiceValue: 'DOT verification Fax Confirmation'
																		},
																		{
																			myChoiceDisplay: "Request to Open a Requisition",
																			myChoiceValue: 'Request to Open a Requisition'
																		},
																		{
																			myChoiceDisplay: "Onboarding Issues",
																			myChoiceValue: 'Onboarding Issues'
																		}
																	 ];
		c.myCoworkerConcernlistoption = {
			hideSearch: true
		};
		c.myCoworkerConcern = "Background/Drug Test Status";

		//{
		if (c.data.area == "Store Operations")
			c.myCoworkerConcernoptions = [{
				myChoiceDisplay: "ALE Inquiries",
				myChoiceValue: 'ALE Inquiries'
			},
																		{
																			myChoiceDisplay: "Fire Extinguisher General Inquiry",
																			myChoiceValue: 'Fire Extinguisher General Inquiry'
																		},
																		{
																			myChoiceDisplay: "Iron Mountain Cancel a pick up",
																			myChoiceValue: 'Iron Mountain Cancel a pick up'
																		},
																		{
																			myChoiceDisplay: "Iron Mountain General inquiry",
																			myChoiceValue: 'Iron Mountain General inquiry'
																		},
																		{
																			myChoiceDisplay: "Iron Mountain Missed pick up",
																			myChoiceValue: 'Iron Mountain Missed pick up'
																		},
																		{
																			myChoiceDisplay: "Iron Mountain Request additional bins/boxes",
																			myChoiceValue: 'Iron Mountain Request additional bins/boxes'
																		},
																		{
																			myChoiceDisplay: "Iron Mountain Request to unlock bin",
																			myChoiceValue: 'Iron Mountain Request to unlock bin'
																		},
																		{
																			myChoiceDisplay: "Iron Mountain General inquiry",
																			myChoiceValue: 'Iron Mountain General inquiry'
																		},
																		{
																			myChoiceDisplay: "Iron Mountain Schedule additional pick up",
																			myChoiceValue: 'Iron Mountain Schedule additional pick up'
																		},
																		{
																			myChoiceDisplay: "Iron Mountain Complaint",
																			myChoiceValue: 'Iron Mountain Complaint'
																		},
																		{
																			myChoiceDisplay: "Terminix General inquiry",
																			myChoiceValue: 'Terminix General inquiry'
																		},
																		{
																			myChoiceDisplay: "Terminix Issue not resolved",
																			myChoiceValue: 'Terminix Issue not resolved'
																		},
																		{
																			myChoiceDisplay: "Terminix Missed service call",
																			myChoiceValue: 'Terminix Missed service call'
																		},
																		{
																			myChoiceDisplay: "Terminix Schedule service call",
																			myChoiceValue: 'Terminix Schedule service call'
																		},
																		{
																			myChoiceDisplay: "Terminix Violation/Complaint",
																			myChoiceValue: 'Terminix Violation/Complaint'
																		},
																		{
																			myChoiceDisplay: "Republic Services General inquiry",
																			myChoiceValue: 'Republic Services General inquiry'
																		},
																		{
																			myChoiceDisplay: "Republic Services Issue not resolved",
																			myChoiceValue: 'Republic Services Issue not resolved'
																		},
																		{
																			myChoiceDisplay: "Republic Services Missed service call",
																			myChoiceValue: 'Republic Services Missed service call'
																		},
																		{
																			myChoiceDisplay: "Republic Services Schedule service call",
																			myChoiceValue: 'Republic Services Schedule service call'
																		},
																		{
																			myChoiceDisplay: "Republic Services Violation/Complaint",
																			myChoiceValue: 'Republic Services Violation/Complaint'
																		},
																		{
																			myChoiceDisplay: "Republic Services Order a new container",
																			myChoiceValue: 'Republic Services Order a new container'
																		}
																	 ];
		c.myCoworkerConcernlistoption = {
			hideSearch: true
		};
		c.myCoworkerConcern = "ALE Inquiries";


		//{
		if (c.data.area == "Payroll")
			c.myCoworkerConcernoptions = [{
				myChoiceDisplay: "Pay Rate Inquiry",
				myChoiceValue: 'Pay Rate Inquiry'
			},
																		{
																			myChoiceDisplay: "Retro Pay Status",
																			myChoiceValue: 'Retro Pay Status'
																		},
																		{
																			myChoiceDisplay: "Garnishment Deduction",
																			myChoiceValue: 'Garnishment Deduction'
																		},
																		{
																			myChoiceDisplay: "Add/Close Direct Deposit",
																			myChoiceValue: 'Add/Close Direct Deposit'
																		},
																		{
																			myChoiceDisplay: "Confirm Paycheck was Processed",
																			myChoiceValue: 'Confirm Paycheck was Processed'
																		},
																		{
																			myChoiceDisplay: "Did not Receive Holiday Pay",
																			myChoiceValue: 'Did not Receive Holiday Pay'
																		},
																		{
																			myChoiceDisplay: "Did not Receive Paper Check",
																			myChoiceValue: 'Did not Receive Paper Check'
																		},
																		{
																			myChoiceDisplay: "Direct Deposit Status",
																			myChoiceValue: 'Direct Deposit Status'
																		},
																		{
																			myChoiceDisplay: "Paycheck Incorrect (Hours Missing)",
																			myChoiceValue: 'Paycheck Incorrect (Hours Missing)'
																		},
																		{
																			myChoiceDisplay: "Paystub Incorrect",
																			myChoiceValue: 'Paystub Incorrect'
																		},
																		{
																			myChoiceDisplay: "Paystub Request",
																			myChoiceValue: 'Paystub Request'
																		},
																		{
																			myChoiceDisplay: "Stop Pay Request",
																			myChoiceValue: 'Stop Pay Request'
																		},
																		{
																			myChoiceDisplay: "Promotion/Termination/Leave/Transfer Inquiry",
																			myChoiceValue: 'Promotion/Termination/Leave/Transfer Inquiry'
																		},
																		{
																			myChoiceDisplay: "Tax Exempt- Federal",
																			myChoiceValue: 'Tax Exempt- Federal'
																		},
																		{
																			myChoiceDisplay: "Tax Exempt- State",
																			myChoiceValue: 'Tax Exempt- State'
																		},
																		{
																			myChoiceDisplay: "W2 Request",
																			myChoiceValue: 'W2 Request'
																		},
																		{
																			myChoiceDisplay: "Cannot Approve Timecard",
																			myChoiceValue: 'Cannot Approve Timecard'
																		},
																		{
																			myChoiceDisplay: "Cannot Create a Schedule",
																			myChoiceValue: 'Cannot Create a Schedule'
																		},
																		{
																			myChoiceDisplay: "Cannot Edit Time",
																			myChoiceValue: 'Cannot Edit Time'
																		},
																		{
																			myChoiceDisplay: "PTO Balance Incorrect",
																			myChoiceValue: 'PTO Balance Incorrect'
																		},
																		{
																			myChoiceDisplay: "Vacation Balance Incorrect",
																			myChoiceValue: 'Vacation Balance Incorrect'
																		},
																		{
																			myChoiceDisplay: "Vacation Payout Inquiry",
																			myChoiceValue: 'Vacation Payout Inquiry'
																		}
																	 ];
		c.myCoworkerConcernlistoption = {
			hideSearch: true
		};
		c.myCoworkerConcern = "Pay Rate Inquiry"; 
		//{
		if (c.data.area == "Property Management")
			c.myCoworkerConcernoptions = [{
				myChoiceDisplay: "Common Area Maintenance",
				myChoiceValue: 'Common Area Maintenance'
			},
																		{
																			myChoiceDisplay: "Exterior/Parking Lot",
																			myChoiceValue: 'Exterior/Parking Lot'
																		},
																		{
																			myChoiceDisplay: "Hazmat/Mildew",
																			myChoiceValue: 'Hazmat/Mildew'
																		},
																		{
																			myChoiceDisplay: "HVAC (Heating, Ventilating & Air Conditioning)",
																			myChoiceValue: 'HVAC (Heating, Ventilating & Air Conditioning)'
																		},
																		{
																			myChoiceDisplay: "Interior",
																			myChoiceValue: 'Interior'
																		},
																		{
																			myChoiceDisplay: "Other",
																			myChoiceValue: 'Other'
																		},
																		{
																			myChoiceDisplay: "Roof Leaks",
																			myChoiceValue: 'Roof Leaks'
																		},
																		{
																			myChoiceDisplay: "Signage",
																			myChoiceValue: 'Signage'
																		},
																		{
																			myChoiceDisplay: "Snow Removal Request",
																			myChoiceValue: 'Snow Removal Request'
																		},
																		{
																			myChoiceDisplay: "Utilities",
																			myChoiceValue: 'Utilities'
																		}
																	 ];
		c.myCoworkerConcernlistoption = {
			hideSearch: true
		};
		c.myCoworkerConcern = "Common Area Maintenance";


		//{
		if (c.data.area == "Tax Accounting")
			c.myCoworkerConcernoptions = [{
				myChoiceDisplay: "License Application",
				myChoiceValue: 'License Application'
			},
																		{
																			myChoiceDisplay: "Personal Property Tax",
																			myChoiceValue: 'Personal Property Tax'
																		},
																		{
																			myChoiceDisplay: "Sales Tax Return Filed",
																			myChoiceValue: 'Sales Tax Return Filed'
																		},
																		{
																			myChoiceDisplay: "Business Licenses",
																			myChoiceValue: 'Business Licenses'
																		},
																		{
																			myChoiceDisplay: "Exempt Customers",
																			myChoiceValue: 'Exempt Customers'
																		},
																		{
																			myChoiceDisplay: "Information Needs",
																			myChoiceValue: 'Information Needs'
																		},
																		{
																			myChoiceDisplay: "Permits",
																			myChoiceValue: 'Permits'
																		},
																		{
																			myChoiceDisplay: "Tax Payments",
																			myChoiceValue: 'Tax Payments'
																		},
																		{
																			myChoiceDisplay: "Violations",
																			myChoiceValue: 'Violations'
																		}
																	 ];
		c.myCoworkerConcernlistoption = {
			hideSearch: true
		};
		c.myCoworkerConcern = "License Application";



		//{
		if (c.data.area == "Treasury Management")
			c.myCoworkerConcernoptions = [{
				myChoiceDisplay: "Bank Inquiry",
				myChoiceValue: 'Bank Inquiry'
			},
																		{
																			myChoiceDisplay: "Cash Drawer Over/Short",
																			myChoiceValue: 'Cash Drawer Over/Short'
																		},
																		{
																			myChoiceDisplay: "Chargeback Inquiry",
																			myChoiceValue: 'Chargeback Inquiry'
																		},
																		{
																			myChoiceDisplay: "Credit Card Double-Charged/Refund",
																			myChoiceValue: 'Credit Card Double-Charged/Refund'
																		},
																		{
																			myChoiceDisplay: "Credit Card Inquiry",
																			myChoiceValue: 'Credit Card Inquiry'
																		},
																		{
																			myChoiceDisplay: "NSF Check Inquiry",
																			myChoiceValue: 'NSF Check Inquiry'
																		},
																		{
																			myChoiceDisplay: "P&L Reporting",
																			myChoiceValue: 'P&L Reporting'
																		},
																		{
																			myChoiceDisplay: "Deposit Variance",
																			myChoiceValue: 'Deposit Variance'
																		},
																		{
																			myChoiceDisplay: "Late Deposit",
																			myChoiceValue: 'Late Deposit'
																		},
																		{
																			myChoiceDisplay: "Unauthorized Charges",
																			myChoiceValue: 'Unauthorized Charges'
																		}
																	 ];
		c.myCoworkerConcernlistoption = {
			hideSearch: true
		};
		c.myCoworkerConcern = "Bank Inquiry";

		//Technical incident

		//{
		if (c.data.area == "Technical Support")
			c.myCoworkerConcernoptions = [{
				myChoiceDisplay: "Other",
				myChoiceValue: 'Other'
			}];
		c.myCoworkerConcernlistoption = {
			hideSearch: true
		};
		c.myCoworkerConcern = "Other";



		if (c.data.area == "Enterprise Data Services")
			c.myCoworkerConcernoptions = [{
				myChoiceDisplay: "Other",
				myChoiceValue: 'Other'
			}];
		c.myCoworkerConcernlistoption = {
			hideSearch: true
		};
		// c.myCoworkerConcern = "Other";



		if (c.data.area == "MyCOE")
			c.myCoworkerConcernoptions = [{
				myChoiceDisplay: "MyCOE – Learning",
				myChoiceValue: 'MyCOE – Learning'
			}];
		c.myCoworkerConcernlistoption = {
			hideSearch: true
		};
		c.myCoworkerConcern = "";
		c.valueSelected = function(selectedValue) {
			c.data.actionvalue = selectedValue;
			//alert(selectedValue);
			//alert("c.data.actionvalue " + c.data.actionvalue);
			//alert("c.data.myCoworkerConcern " + c.data.myCoworkerConcern);
		}



		if (c.data.area == "Asset Protection" || c.data.area == "Solution Center Credit Reporting" || c.data.area == "Benefits" || c.data.area == "Expense Management" || c.data.area == "Fixed Assets" || c.data.area == "General Ledger" || c.data.area == "Inventory Payables (ANOW)" || c.data.area == "Inventory Payables (RTO)" || c.data.area == "Lease Accounting" || c.data.area == "Lease Admin" || c.data.area == "Tax Accounting" || c.data.area == "AcceptanceNow" || c.data.area == "Customer Account Issues" | c.data.area == "Enterprise Data Services" || c.data.area == "MyCOE" || c.data.area == "Technical Support")
			c.data.description = "Brief description of issue"; 

		if (c.data.area == "Property Management")
			c.data.description = "Impacted store#, Call back phone#, Issue Type (HVAC, roof, etc)"; 
		if (c.data.area == "Payroll") c.data.description = "Effected coworker's name " + "\n" + "Employee ID#"+ "\n" + " Brief description of issue";
		// alert("c.data.actionvalue" + c.data.actionvalue);
		// alert("c.data.area " + c.data.area); //alert("input.actionvalue" + c.data.actionvalue);

		//alert("input.actionvalue1" + c.data.actionvalue);
		if (c.data.area == "Accounts Payable" )
			c.data.description = "Brief desciption of issue" + "\n\n" + "Please provide detail for specific CoWorkerConcern as below - " + "\n" + "Expense Check Status :" + "\n" + "Expense check date/amount =" + "\n" + "Brief desciption of issue :" + "\n\n" + "Customer Refund Check Status:" + "\n" + "Customer's name =" + "\n" + "Refund amount = " + "\n" + "Date submitted =" + "\n" + "Brief desciption of issue: " + "\n\n" + "Check invoice status:" + "\n" + "Vendor Name/Number = " + "\n" + "Invoice# = " + "\n" + "PO# = " + "\n" + "Invoice amount = " + "\n" + "Brief desciption of issue:" ;

		if (c.data.area == "Staffing" )
			c.data.description = "Please provide detail for specific CoWorkerConcern as below - " + "\n\n" + "Background/Drug Test Status:" + "\n" + "Name of candidate = " + "\n\n" + "DOT verification Fax Confirmation:" + "\n" + "Name of previous coworker =" + "\n\n" + "Request to Open a Requisition:" + "\n" + "Position of Req = " + "\n" + "Date to be opened = " + "\n\n" + "Onboarding Issues: " + "\n"+ "Brief desciption of issue:" ;

		if (c.data.area == "HRIS" )
			c.data.description = "Brief desciption of issue" + "\n" + "Please provide detail for specific CoWorkerConcern as below - " + "\n\n" + "Onboarding technical support:" + "\n" + "New hire's name =" + "\n" + "Brief desciption of issue :" + "\n\n" + "Did not Receive Referral Pay:" + "\n" + "Referred coworker's name/EID =" + "\n" + "Date of hire = " + "\n" + "Brief desciption of issue: " + "\n\n" + "Coworker Referral Denied:" + "\n" + "Referred coworker's name/EID =  " + "\n" + "Date of hire = " + "\n" + "Brief desciption of issue:" ;
		if (c.data.area == "Treasury Management" )
			c.data.description = "Bank Inquiry:" + "\n" + "Brief description of issue" + "\n\n" + "Cash Drawer Over/Short:" + "\n" + "Date = " + "\n" + "Amount over/short = " + "\n" + "Brief description of issue:" + "\n\n" + "Chargeback Inquiry:" + "\n" + "Date = " + "\n" + "Chargeback amount = " + "\n" + "Brief description of issue" + "\n\n" + "Credit Card Double-Charged/Refund:" + "\n" + "Customer Name =" + "\n" + "Last four of CC = " + "\n" + "Amount = " + "\n" + "Date = " + "\n" + "Brief description of issue: " + "\n\n" + "Credit Card Inquiry:" + "\n" + "Customer Name =" + "\n" + "Last four of CC = " + "\n" + "Amount = " + "\n" + "Date = " + "\n" + "Brief description of issue" + "\n\n" + "NSF Check Inquiry:" + "\n" + "Customer Name = " + "\n" + "Amount = " + "\n" + "Date =" + "\n" + "Brief description of issue:" + "\n\n" + "P&L Reporting:" + "\n"+ "Brief description of issue" + "\n\n" + "Deposit Variance:" + "\n" + "Date =" + "\n" + "Amount of variance =" + "\n" + "Brief description of issue:" + "\n\n" + "Late Deposit:" + "\n" + "Brief description of issue:" + "\n\n" + "Unauthorized Charges:" + "\n" + "Customer Name =" + "\n" + "Last four of CC =" + "\n" + "Amount = " + "\n" + "Date = " + "\n" + "Brief description of issue:";
		if (c.data.area == "Store Operations" )
			c.data.description = "ALE Inquiries:" + "\n" + "Agreement#=" + "\n" + "Brief description of issue:" + "\n\n" + "Fire Extinguisher General Inquiry:" + "\n" +"Brief description of issue:" + "\n\n" + "Iron Mountain Cancel a pick up:" +"\n" + "Date of pickup=" + "\n\n"+ "Iron Mountain General inquiry:" + "\n"+"Brief description of issue: "+ "\n\n" + "Iron Mountain Missed pick up:" + "\n" + "Date of missed pickup=" + "\n" + "Number of bins/boxes=" + "\n\n" + "Iron Mountain Request additional bins/boxes:" + "\n" + "Specify bins/boxes= " + "\n" + "Number requested=" + "\n\n" + "Iron Mountain Request to unlock bin:" + "\n" + "Brief description of issue:" + "\n\n" + "Iron Mountain General inquiry:" + "\n" + "Brief description of issue:" + "\n\n" + "Iron Mountain Schedule additional pick up:" + "\n" + "Date of next pickup= " + "\n" + "Number of bins/boxes=" + "\n\n" + "Iron Mountain Complaint:" + "\n" + "Brief description of issue:" + "\n\n" + "Terminix General inquiry:" + "\n" + "Brief description of issue:" +"\n\n" + "Terminix Issue not resolved:" + "\n" + "Brief description of issue:" + "\n\n" + "Terminix Missed service call:" + "\n" + "Date of missed service call=" + "\n\n" + "Terminix Schedule service call:" + "\n" + "Brief description of issue:" + "\n\n" + "Terminix Violation/Complaint:" + "\n" + "Brief description of issue:" + "\n\n" +"Republic Services General inquiry:" + "\n" +"Brief description of issue:" + "\n\n" + "Republic Services Issue not resolved:" + "\n" + "Brief description of issue:" + "\n\n" + "Republic Services Missed service call:" + "\n" + "Date of missed service call=" + "\n" + "Brief description of pickup type (trash/recycling)=" + "\n\n" + "Republic Services Schedule service call:" + "\n"+"Brief description of pickup type (trash/recycling)=" + "\n\n" + "Republic Services Violation/Complaint:" + "\n" + "Brief description of issue: " + "\n\n" + "Republic Services Order a new container:" + "\n" + "Brief description of pickup type (trash/recycling, size)=" + "\n\n" + "Republic Services Issue not resolved:" + "\n" +"Brief description of issue:";


		$scope.update = function() {
			if (c.data.area == null || c.data.area === "") { spUtil.addErrorMessage($scope.data.mustSpecifyArea);
																											return;
																										 }
			//if(c.data.myCoworkerConcern == null || c.data.myCoworkerConcern === "" || c.data.myCoworkerConcern == "undefined"&&)
			//if(c.data.actionvalue == null || c.data.actionvalue === "")
			if (c.data.actionvalue === "") {
				spUtil.addErrorMessage($scope.data.mustSpecifyCoworkerConcern);
				return;
			}

			/*
	//spUtil.setValue('Description',"Test 1");
	//return;
	}*/
			else if (c.data.description == null || c.data.description === "") {
				spUtil.addErrorMessage($scope.data.mustSpecifyQuestionMsg);
				return;
			}
			if (c.data.user.phone == null || c.data.user.phone === "") {
				// alert(c.data.area + c.data.user.phone)
				spUtil.addErrorMessage($scope.data.mustSpecifyNumber);
				return;
			}
			c.data.action = "submit";

			c.server.update().then(function() {
				c.data.action = "";
				$scope.status = $scope.data.postingMsg;
				spUtil.addTrivialMessage($scope.data.ticketCreation);
			})


		}


	}
}

SERVER SCRIPT

(function() {
	/* populate the 'data' object */
	/* e.g., data.table = $sp.getValue('table'); */
	//gs.addInfoMessage($sp.getParameter("from"));
	data.disabled = false;
	if($sp.getParameter("from") == "SB"){
		data.area = "Technical Support";
		data.disabled = true;
	}
	data.mustSpecifyArea = gs.getMessage("Please select the area below");
	data.mustSpecifyCoworkerConcern= gs.getMessage("Please select the CoworkerConcern below");
	data.mustSpecifyQuestionMsg = gs.getMessage("Please describe your issue below");
	data.mustSpecifyNumber = gs.getMessage("Please enter the Phone");
	data.postingMsg = gs.getMessage("Submitted");
	data.ticketCreation = gs.getMessage("Ticket Created");

	data.usersys_id = gs.getUserID();
	data.useraname = gs.getUser().getDisplayName();
	data.instanceName=gs.getProperty('instance_name');

	var userGR = GlideRecord('sys_user');
	userGR.get(data.usersys_id);
	data.user = {};
	$sp.getRecordDisplayValues(data.user, userGR, 'sys_id,phone,email');

	var locSysId = "";
	//var coworkerConcern= data.valueSelected;
	if (input.setLocation)
		locSysId = input.setLocation;
	else
		locSysId = gs.getUser().getRecord().getValue('location');

	var locGR = GlideRecord('cmn_location');
	locGR.get(locSysId);
	data.loc = {};
	$sp.getRecordDisplayValues(data.loc, locGR, 'sys_id,name,street,city,state,zip,country');

	var action = input.action;
	if (input && action == 'submit'){
		// gs.addInfoMessage(input.number + "---")
		var rec = null;
		//var concern = data.selectedValue;

		if(input.area =='Technical Support' || input.area =='Enterprise Data Services' || input.area =='MyCOE'){
			rec = new GlideRecord("u_incident_technical");
		} else if(input.area =='Customer Account Issues'|| input.area =='AcceptanceNow'|| input.area =='Solution Center Credit Reporting'){
			rec = new GlideRecord("u_incident_external");
		} else {
			rec = new GlideRecord("u_incident_coworker");
		}

		if(input.area =='Solution Center Credit Reporting'){

			rec.u_requestor_type = "Coworker";
			rec.assignment_group = getGroup("Solution Center Credit Reporting");
			rec.category = "Customer Service";
			rec.subcategory = "Credit Report Concerns";
			rec.u_action = input.actionvalue;
			rec.impact = "2 - Medium";
			rec.urgency = "2 - Medium";
			rec.u_language = "English";
			rec.u_call_back_number = data.user.phone;


			var recUser = new GlideRecord("sys_user");
			recUser.addQuery("sys_id", data.usersys_id);
			recUser.query();
			if(recUser.next()){
				rec.u_first_name = recUser.first_name;
				rec.u_last_name = recUser.last_name;
			}

		}else if(input.area =='AcceptanceNow'){

			rec.u_requestor_type = "Coworker";
			//rec.assignment_group = getGroup("RSC VAN Specialist");
			rec.assignment_group = getGroup("Solution Center Customer Superuser");
			rec.category = "Applications & Online Orders";
			rec.subcategory = "Agreement Copies";
			rec.u_action = input.actionvalue;
			rec.impact = "2 - Medium";
			rec.urgency = "2 - Medium";
			rec.u_language = "English";
			rec.u_call_back_number = data.user.phone;


			var recUser = new GlideRecord("sys_user");
			recUser.addQuery("sys_id", data.usersys_id);
			recUser.query();
			if(recUser.next()){
				rec.u_first_name = recUser.first_name;
				rec.u_last_name = recUser.last_name;
			}

		} else if(input.area =='Accounts Payable'){

			rec.u_requestor_type = "Coworker";
			rec.assignment_group = getGroup("Accounts Payables");
			rec.category = "Accounts Payable";
			rec.subcategory = "Inquiry Accounts Payable";
			rec.u_action = input.actionvalue;
			rec.impact = "3 - Low";
			rec.urgency = "3 - Low";
			rec.u_call_back_number = data.user.phone;

		} else if(input.area =='Asset Protection'){

			rec.u_requestor_type = "Coworker";
			rec.assignment_group = getGroup("Asset Protection");
			rec.category = "Asset Protection";
			rec.subcategory = "Inquiry Asset Protection";
			rec.u_action = input.actionvalue;
			rec.impact = "3 - Low";
			rec.urgency = "3 - Low";
			rec.u_call_back_number = data.user.phone;

		}
		else if(input.area =='Benefits'){

			rec.u_requestor_type = "Coworker";
			rec.assignment_group = getGroup("Benefits");
			rec.category = "Benefits";
			rec.subcategory = "Inquiry Benefits";
			rec.u_action = input.actionvalue;
			rec.impact = "3 - Low";
			rec.urgency = "3 - Low";
			rec.u_call_back_number = data.user.phone;

		}
		else if(input.area =='Expense Management'){

			rec.u_requestor_type = "Coworker";
			rec.assignment_group = getGroup("Expense Management – eProcurement");
			rec.category = "Expense Management";
			rec.subcategory = "Inquiry Expense Management";
			rec.u_action = input.actionvalue;
			rec.impact = "3 - Low";
			rec.urgency = "3 - Low";
			rec.u_call_back_number = data.user.phone;

		}else if(input.area =='Fixed Assets'){

			rec.u_requestor_type = "Coworker";
			rec.assignment_group = getGroup("Fixed Assets");
			rec.category = "Fixed Assets";
			rec.subcategory = "Inquiry Fixed Assets";
			rec.u_action = input.actionvalue;
			rec.impact = "3 - Low";
			rec.urgency = "3 - Low";
			rec.u_call_back_number = data.user.phone;

		}else if(input.area =='General Ledger'){

			rec.u_requestor_type = "Coworker";
			rec.assignment_group = getGroup("General Ledger");
			rec.category = "General Ledger";
			rec.subcategory = "Inquiry General Ledger";
			rec.u_action = input.actionvalue;
			rec.impact = "3 - Low";
			rec.urgency = "3 - Low";
			rec.u_call_back_number = data.user.phone;

		}else if(input.area =='HRIS'){

			rec.u_requestor_type = "Coworker";
			rec.assignment_group = getGroup("HRIS");
			rec.category = "HRIS";
			rec.subcategory = "Inquiry HRIS";
			rec.u_action = input.actionvalue;
			rec.impact = "3 - Low";
			rec.urgency = "3 - Low";
			rec.u_call_back_number = data.user.phone;

		}else if(input.area =='Inventory Payables (ANOW)'){

			rec.u_requestor_type = "Coworker";
			rec.assignment_group = getGroup("Inventory Payables - ANOW");
			rec.category = "Inventory Payables (ANOW)";
			rec.subcategory = "Inquiry Inventory Payables (ANOW)";
			rec.u_action = input.actionvalue;
			rec.impact = "3 - Low";
			rec.urgency = "3 - Low";
			rec.u_call_back_number = data.user.phone;

		}else if(input.area =='Inventory Payables (RTO)'){

			rec.u_requestor_type = "Coworker";
			rec.assignment_group = getGroup("Inventory Payables - RTO");
			rec.category = "Inventory Payables (RTO)";
			rec.subcategory = "Inquiry Inventory Payables (RTO)";
			rec.u_action = input.actionvalue;
			rec.impact = "3 - Low";
			rec.urgency = "3 - Low";
			rec.u_call_back_number = data.user.phone;

		}else if(input.area =='Lease Accounting'){

			rec.u_requestor_type = "Coworker";
			rec.assignment_group = getGroup("Lease Accounting ");
			rec.category = "Lease Accounting";
			rec.subcategory = "Inquiry Lease Accounting";
			rec.u_action = input.actionvalue;
			rec.impact = "3 - Low";
			rec.urgency = "3 - Low";
			rec.u_call_back_number = data.user.phone;

		}else if(input.area =='Lease Admin'){

			rec.u_requestor_type = "Coworker";
			rec.assignment_group = getGroup("Lease Administration");
			rec.category = "Lease Administration";
			rec.subcategory = "Inquiry";
			rec.u_action = input.actionvalue;
			rec.impact = "3 - Low";
			rec.urgency = "3 - Low";
			rec.u_call_back_number = data.user.phone;

		}else if(input.area =='Payroll'){

			rec.u_requestor_type = "Coworker";
			rec.assignment_group = getGroup("Solution Center Sutherland Non-Technical");
			rec.category = "Payroll";
			rec.subcategory = "Inquiry Payroll";
			rec.u_action = input.actionvalue;
			rec.impact = "3 - Low";
			rec.urgency = "3 - Low";
			rec.u_call_back_number = data.user.phone;

		}else if(input.area =='Property Management'){

			rec.u_requestor_type = "Coworker";
			rec.assignment_group = getGroup("Property Management");
			rec.category = "Property Management";
			rec.subcategory = "Inquiry Property Management";
			rec.u_action = input.actionvalue;
			rec.impact = "3 - Low";
			rec.urgency = "3 - Low";
			rec.u_call_back_number = data.user.phone;

		}else if(input.area =='Staffing'){

			rec.u_requestor_type = "Coworker";
			rec.assignment_group = getGroup("Staffing ");
			rec.category = "Staffing";
			rec.subcategory = "Inquiry Staffing";
			rec.u_action =input.actionvalue;
			rec.impact = "3 - Low";
			rec.urgency = "3 - Low";
			rec.u_call_back_number = data.user.phone;

		}else if(input.area =='Store Operations'){

			rec.u_requestor_type = "Coworker";
			rec.assignment_group = getGroup("Store Operations");
			rec.category = "Store Operations";
			rec.subcategory = "Inquiry Store Operations";
			rec.u_action = input.actionvalue;
			rec.impact = "3 - Low";
			rec.urgency = "3 - Low";
			rec.u_call_back_number = data.user.phone;

		}else if(input.area =='Tax Accounting'){

			rec.u_requestor_type = "Coworker";
			rec.assignment_group = getGroup("Tax");
			rec.category = "Tax Accounting";
			rec.subcategory = "Inquiry Tax Accounting";
			rec.u_action = input.actionvalue;
			rec.impact = "3 - Low";
			rec.urgency = "3 - Low";
			rec.u_call_back_number = data.user.phone;

		}else if(input.area =='Treasury Management'){

			rec.u_requestor_type = "Coworker";
			rec.assignment_group = getGroup("Treasury Management");
			rec.category = "Treasury Management";
			rec.subcategory = "Inquiry Treasury Management";
			rec.u_action = input.actionvalue;
			rec.impact = "3 - Low";
			rec.urgency = "3 - Low";
			rec.u_call_back_number = data.user.phone;

		}

		else if(input.area =='Customer Account Issues'){

			rec.u_requestor_type = "Coworker";
			rec.assignment_group = getGroup("Solution Center Customer Superuser");
			rec.category = "Customer Service";
			rec.subcategory = 2;
			rec.u_action = input.actionvalue;
			rec.impact = "3 - Low";
			rec.urgency = "3 - Low";
			rec.u_language = "English";
			rec.u_call_back_number = data.user.phone;

			var recUser = new GlideRecord("sys_user");
			recUser.addQuery("sys_id", data.usersys_id);
			recUser.query();
			if(recUser.next()){
				rec.u_first_name = recUser.first_name;
				rec.u_last_name = recUser.last_name;
			}


		} /*else if(input.area =='Expense Reimbursement'){

rec.u_requestor_type = "Coworker";
rec.assignment_group = getGroup("Solution Center Sutherland Non-Technical");
rec.category = "Accounts Payable";
rec.subcategory = "Expenses & Checks";
rec.u_action = "Expense Check Status";
rec.impact = "2 - Medium";
rec.urgency = "2 - Medium";
rec.u_call_back_number = data.user.phone;

} else if(input.area =='Fleet'){

rec.u_requestor_type = "Coworker";
rec.assignment_group = getGroup("Solution Center Sutherland Non-Technical");
rec.category = "Fleet";
rec.subcategory = "(ESBU Sort) Fleet";
rec.u_action = "(ESBU Sort) Smart Phone";
rec.impact = "2 - Medium";
rec.urgency = "2 - Medium";
rec.u_call_back_number = data.user.phone;

} */else if(input.area =='MyCOE'){

	rec.u_requestor_type = "Coworker";
	rec.assignment_group = getGroup("IT Service Desk");
	rec.category = "Incident";
	rec.subcategory = "Software";
	rec.u_action = input.actionvalue;
	rec.impact = "3 - Low";
	rec.urgency = "3 - Low";
	rec.u_call_back_number = data.user.phone;

} /*else if(input.area =='Smartphone/Mobile Issues'){

rec.u_requestor_type = "Coworker";
rec.assignment_group = getGroup("Solution Center Customer Superuser");
rec.category = "Smart Phone";
rec.subcategory = "(ESBU Sort) Smart Phone";
rec.u_action = "(ESBU Sort) Smart Phone";
rec.impact = "2 - Medium";
rec.urgency = "2 - Medium";
rec.u_call_back_number = data.user.phone;

} else if(input.area =='Staffing'){

rec.u_requestor_type = "Coworker";
rec.assignment_group = getGroup("Solution Center Sutherland Non-Technical");
rec.category = "Staffing";
rec.subcategory = "(ESBU Sort) Staffing";
rec.u_action = "(ESBU Sort) Staffing";
rec.impact = "2 - Medium";
rec.urgency = "2 - Medium";
rec.u_call_back_number = data.user.phone;

} else if(input.area =='Store Operations'){

rec.u_requestor_type = "Coworker";
rec.assignment_group = getGroup("Solution Center Sutherland Non-Technical");
rec.category = "Internal Support";
rec.subcategory = "(ESBU Sort) Operations Solutions";
rec.u_action = "(ESBU Sort) Operations Solutions";
rec.impact = "2 - Medium";
rec.urgency = "2 - Medium";
rec.u_call_back_number = data.user.phone;

} */else if(input.area =='Technical Support'){

	rec.u_requestor_type = "Coworker";
	rec.assignment_group = getGroup("IT Service Desk");
	rec.category = "Inquiry";
	rec.subcategory = "Other";
	rec.u_action = input.actionvalue;
	rec.impact = "3 - Low";
	rec.urgency = "3 - Low";
	rec.u_call_back_number = data.user.phone;

} else if(input.area =='Enterprise Data Services'){

	rec.u_requestor_type = "Coworker";
	rec.assignment_group = getGroup("Enterprise Data Services");
	rec.category = "Incident";
	rec.subcategory = "Process";
	rec.u_action = input.actionvalue;
	rec.impact = "3 - Low";
	rec.urgency = "3 - Low";
	rec.u_call_back_number = data.user.phone;
}

		rec.location = data.loc.sys_id;
		rec.caller_id = data.usersys_id;
		rec.contact_type = "Self Service";
		rec.short_description = input.area;
		// rec.u_action = input.myCoworkerConcern;
		rec.description = input.description;
		rec.user_input = input.description;
		rec.u_call_back_number = input.user.phone;
		
		var sys_id = rec.insert();
		//var sys_id = rec.insert();
		if (!gs.nil(sys_id)) {
			data.sys_id = sys_id;
			data.upLoadAtt = true;
      data.table =rec.getRecordClassName();
      data.rec_sysid=rec.sys_id.toString();
		}

		data.ticketCreation = gs.getMessage(issueMessage(rec.number,rec.short_description, rec.sys_id));
	}

	/* if (input && input.update_incident) {

var actioncoworker = new GlideRecord('u_incident_coworker');
actioncoworker.addQuery("u_action", actioncoworker);
actioncoworker.query();
if(actioncoworker.next()){
actioncoworker.u_action = input.CoworkerConcern;
actioncoworker.update();
}

}*/

	function getGroup(groupName){
		var assignGroup= new GlideRecord("sys_user_group");
		assignGroup.addQuery("name", groupName);
		assignGroup.query();
		if(assignGroup.next()){
			return assignGroup.sys_id.toString();
		}

		return null;
	}

	function issueMessage(n, title, sys_id) {
		var table = null;
		if(title =='Technical Support' || title =='Enterprise Data Services' || input.area =='MyCOE' ){
			table = "u_incident_technical";
		} else if(title =='Customer Account Issues' || title =='AcceptanceNow' || input.area =='Solution Center Credit Reporting'){
			table = "u_incident_external";
		} else {
			table = "u_incident_coworker";
		}
		var page = table == 'sc_request' ? 'sc_request' : 'ticket';
		var t = "${Created} " + n + " - ";
		t += "${track using 'Requests' in the header or}";
		t += ' <a href="?id=' + page + '&table=' + table + '&sys_id=' + sys_id + '">' + "${click here to view}" + '</a>';
		return t;
	}

})();

 

mark this correct and helpful if this is working as expected.

thanks

Hammad

View solution in original post

19 REPLIES 19

hammad ul aziz2
Mega Guru

Use the attachment widget to attach items to tickets. You can use this base system widget as-is in your Service Portal or clone it to suit your own business needs.

https://docs.servicenow.com/bundle/orlando-servicenow-platform/page/build/service-portal/concept/tic...

How to add "Ticket Attachments" widget to my actual widget? Can you please help with process?

yes, I can it's a little bit complex process to develop.

can you please share your entire widget code here including HTML, server-side, client controller, CSS?

Please find below script. Let me know for any questions.

 

Body HTML template:

<!-- tab: quick setup -->
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">Create Incident</h4>
<div>Create an Incident record to report and request assistance with an issue you are having</div>
</div>

<div class="panel-body">

<label class="col-sm-2 control-label">Coworker</label>
<div class="col-sm-10">
<sn-record-picker field="user"
table="'sys_user'"
display-field="'name'"
value-field="'sys_id'"
sn-disabled="'true'"
search-fields="'user_name,name'">
</sn-record-picker>
</div>
</div>

<div class="panel-body">
<label for="" class="col-sm-2 control-label">Phone</label>
<div class="col-sm-10">
<input type="text" class="form-control" ng-model="data.user.phone" name="phone">
</div>
</div>

<div class="panel-body">
<label for="" class="col-sm-2 control-label">Email</label>
<div class="col-sm-10">
<input type="text" class="form-control" ng-model="data.user.email" name="email">
</div>
</div>

<div class="panel-body">
<label class="col-sm-2 control-label">Location</label>
<div class="col-sm-10">
<sn-record-picker
field="location"
table="'cmn_location'"
display-field="'name'"
value-field="'sys_id'"
sn-disabled="'true'"
search-fields="'name'">
</sn-record-picker>
</div>
</div>




<div class="panel-body">
<label for="" class="col-sm-2 control-label">Area</label>
<div class="col-sm-10">
<select class="form-control select2" style="width: 100%;" name="area" ng-model="data.area" ng-disabled="data.disabled" ng-change="checkArea()">
<option selected="selected" disabled="disabled">-Select-</option>
<option value="AcceptanceNow">Agreement Requests for ANOW Customers</option>
<option value="Accounts Payable">Accounts Payable</option>
<option value="Asset Protection">Asset Protection</option>
<option value="Benefits">Benefits</option>
<option value="Customer Account Issues">Customer Account Issues (ePay, Agreement Info, EPO, Benefits Plus, LDW)</option>
<option value="Enterprise Data Services">Enterprise Data Services</option>
<option value="Expense Management">Expense Management</option>
<option value="Fixed Assets">Fixed Assets</option>
<option value="General Ledger">General Ledger</option>
<option value="HRIS">HRIS</option>
<option value="Inventory Payables (ANOW)">Inventory Payables (ANOW)</option>
<option value="Inventory Payables (RTO)">Inventory Payables (RTO)</option>
<option value="Lease Accounting">Lease Accounting</option>
<option value="Lease Admin">Lease Admin</option>
<option value="Payroll">Payroll</option>
<option value="Property Management">Property Management</option>
<option value="Staffing">Staffing</option>
<option value="Store Operations">Store Operations</option>
<option value="Solution Center Credit Reporting">Solution Center Credit Reporting</option>
<option value="Tax Accounting">Tax Accounting</option>
<option value="Technical Support">Technical Support (SIMS, High Touch, iPads, AirWatch, Computer or Printer Issue)</option>
<option value="Treasury Management">Treasury Management</option>
</select>
</div>
</div>


<div class="panel-body">
<label class="col-sm-2 control-label">CoworkerConcern</label>
<div class="col-sm-10">
<sn-choice-list
field="c.myCoworkerConcern"
sn-model="c.myCoworkerConcern"
sn-options="c.myCoworkerConcernlistoption"
sn-value-field="myChoiceValue"
sn-text-field="myChoiceDisplay"
sn-items="c.myCoworkerConcernoptions"
sn-on-change="c.valueSelected(selectedValue)">
</sn-choice-list>
</div>
</div>

<!-- <select id="coworker_concern" name="coworker_concern" ng-model="c.data.CoworkerConcern">
<option disabled hidden style='display: none' value=''></option>
<!--<option value="{{group.value}}" ng-repeat="group in data.groups" ng-selected="{{group.value == "12acb2770ffe8a00fdbdb0c362050e27}}">{{group.name}}</option>-->
<!--</select>-->

<div class="panel-body">
<label for="" class="col-sm-2 control-label">Description</label>
<div class="col-sm-10">
<textarea class="form-control" name="description" ng-model="data.description" rows="3">

</textarea>
</div>
</div>

<div class="panel-footer">
<div align="right">

<a ng-disabled="status"
name="submit"
ng-click="update()"
class="btn btn-primary">
<span ng-show="status">{{status}}</span>
<span ng-show="!status">${Submit}</span>
</a>

</div>
</div>

</div>

 

 

Server script

(function() {
/* populate the 'data' object */
/* e.g., data.table = $sp.getValue('table'); */
//gs.addInfoMessage($sp.getParameter("from"));
data.disabled = false;
if($sp.getParameter("from") == "SB"){
data.area = "Technical Support";
data.disabled = true;
}
data.mustSpecifyArea = gs.getMessage("Please select the area below");
data.mustSpecifyCoworkerConcern= gs.getMessage("Please select the CoworkerConcern below");
data.mustSpecifyQuestionMsg = gs.getMessage("Please describe your issue below");
data.mustSpecifyNumber = gs.getMessage("Please enter the Phone");
data.postingMsg = gs.getMessage("Submitted");
data.ticketCreation = gs.getMessage("Ticket Created");

data.usersys_id = gs.getUserID();
data.useraname = gs.getUser().getDisplayName();

var userGR = GlideRecord('sys_user');
userGR.get(data.usersys_id);
data.user = {};
$sp.getRecordDisplayValues(data.user, userGR, 'sys_id,phone,email');

var locSysId = "";
//var coworkerConcern= data.valueSelected;
if (input.setLocation)
locSysId = input.setLocation;
else
locSysId = gs.getUser().getRecord().getValue('location');

var locGR = GlideRecord('cmn_location');
locGR.get(locSysId);
data.loc = {};
$sp.getRecordDisplayValues(data.loc, locGR, 'sys_id,name,street,city,state,zip,country');

var action = input.action;
if (input && action == 'submit'){
// gs.addInfoMessage(input.number + "---")
var rec = null;
//var concern = data.selectedValue;

if(input.area =='Technical Support' || input.area =='Enterprise Data Services' || input.area =='MyCOE'){
rec = new GlideRecord("u_incident_technical");
} else if(input.area =='Customer Account Issues'|| input.area =='AcceptanceNow'|| input.area =='Solution Center Credit Reporting'){
rec = new GlideRecord("u_incident_external");
} else {
rec = new GlideRecord("u_incident_coworker");
}

if(input.area =='Solution Center Credit Reporting'){

rec.u_requestor_type = "Coworker";
rec.assignment_group = getGroup("Solution Center Credit Reporting");
rec.category = "Customer Service";
rec.subcategory = "Credit Report Concerns";
rec.u_action = input.actionvalue;
rec.impact = "2 - Medium";
rec.urgency = "2 - Medium";
rec.u_language = "English";
rec.u_call_back_number = data.user.phone;


var recUser = new GlideRecord("sys_user");
recUser.addQuery("sys_id", data.usersys_id);
recUser.query();
if(recUser.next()){
rec.u_first_name = recUser.first_name;
rec.u_last_name = recUser.last_name;
}

}else if(input.area =='AcceptanceNow'){

rec.u_requestor_type = "Coworker";
//rec.assignment_group = getGroup("RSC VAN Specialist");
rec.assignment_group = getGroup("Solution Center Customer Superuser");
rec.category = "Applications & Online Orders";
rec.subcategory = "Agreement Copies";
rec.u_action = input.actionvalue;
rec.impact = "2 - Medium";
rec.urgency = "2 - Medium";
rec.u_language = "English";
rec.u_call_back_number = data.user.phone;


var recUser = new GlideRecord("sys_user");
recUser.addQuery("sys_id", data.usersys_id);
recUser.query();
if(recUser.next()){
rec.u_first_name = recUser.first_name;
rec.u_last_name = recUser.last_name;
}

} else if(input.area =='Accounts Payable'){

rec.u_requestor_type = "Coworker";
rec.assignment_group = getGroup("Accounts Payables");
rec.category = "Accounts Payable";
rec.subcategory = "Inquiry Accounts Payable";
rec.u_action = input.actionvalue;
rec.impact = "3 - Low";
rec.urgency = "3 - Low";
rec.u_call_back_number = data.user.phone;

} else if(input.area =='Asset Protection'){

rec.u_requestor_type = "Coworker";
rec.assignment_group = getGroup("Asset Protection");
rec.category = "Asset Protection";
rec.subcategory = "Inquiry Asset Protection";
rec.u_action = input.actionvalue;
rec.impact = "3 - Low";
rec.urgency = "3 - Low";
rec.u_call_back_number = data.user.phone;

}
else if(input.area =='Benefits'){

rec.u_requestor_type = "Coworker";
rec.assignment_group = getGroup("Benefits");
rec.category = "Benefits";
rec.subcategory = "Inquiry Benefits";
rec.u_action = input.actionvalue;
rec.impact = "3 - Low";
rec.urgency = "3 - Low";
rec.u_call_back_number = data.user.phone;

}
else if(input.area =='Expense Management'){

rec.u_requestor_type = "Coworker";
rec.assignment_group = getGroup("Expense Management – eProcurement");
rec.category = "Expense Management";
rec.subcategory = "Inquiry Expense Management";
rec.u_action = input.actionvalue;
rec.impact = "3 - Low";
rec.urgency = "3 - Low";
rec.u_call_back_number = data.user.phone;

}else if(input.area =='Fixed Assets'){

rec.u_requestor_type = "Coworker";
rec.assignment_group = getGroup("Fixed Assets");
rec.category = "Fixed Assets";
rec.subcategory = "Inquiry Fixed Assets";
rec.u_action = input.actionvalue;
rec.impact = "3 - Low";
rec.urgency = "3 - Low";
rec.u_call_back_number = data.user.phone;

}else if(input.area =='General Ledger'){

rec.u_requestor_type = "Coworker";
rec.assignment_group = getGroup("General Ledger");
rec.category = "General Ledger";
rec.subcategory = "Inquiry General Ledger";
rec.u_action = input.actionvalue;
rec.impact = "3 - Low";
rec.urgency = "3 - Low";
rec.u_call_back_number = data.user.phone;

}else if(input.area =='HRIS'){

rec.u_requestor_type = "Coworker";
rec.assignment_group = getGroup("HRIS");
rec.category = "HRIS";
rec.subcategory = "Inquiry HRIS";
rec.u_action = input.actionvalue;
rec.impact = "3 - Low";
rec.urgency = "3 - Low";
rec.u_call_back_number = data.user.phone;

}else if(input.area =='Inventory Payables (ANOW)'){

rec.u_requestor_type = "Coworker";
rec.assignment_group = getGroup("Inventory Payables - ANOW");
rec.category = "Inventory Payables (ANOW)";
rec.subcategory = "Inquiry Inventory Payables (ANOW)";
rec.u_action = input.actionvalue;
rec.impact = "3 - Low";
rec.urgency = "3 - Low";
rec.u_call_back_number = data.user.phone;

}else if(input.area =='Inventory Payables (RTO)'){

rec.u_requestor_type = "Coworker";
rec.assignment_group = getGroup("Inventory Payables - RTO");
rec.category = "Inventory Payables (RTO)";
rec.subcategory = "Inquiry Inventory Payables (RTO)";
rec.u_action = input.actionvalue;
rec.impact = "3 - Low";
rec.urgency = "3 - Low";
rec.u_call_back_number = data.user.phone;

}else if(input.area =='Lease Accounting'){

rec.u_requestor_type = "Coworker";
rec.assignment_group = getGroup("Lease Accounting ");
rec.category = "Lease Accounting";
rec.subcategory = "Inquiry Lease Accounting";
rec.u_action = input.actionvalue;
rec.impact = "3 - Low";
rec.urgency = "3 - Low";
rec.u_call_back_number = data.user.phone;

}else if(input.area =='Lease Admin'){

rec.u_requestor_type = "Coworker";
rec.assignment_group = getGroup("Lease Administration");
rec.category = "Lease Administration";
rec.subcategory = "Inquiry";
rec.u_action = input.actionvalue;
rec.impact = "3 - Low";
rec.urgency = "3 - Low";
rec.u_call_back_number = data.user.phone;

}else if(input.area =='Payroll'){

rec.u_requestor_type = "Coworker";
rec.assignment_group = getGroup("Solution Center Sutherland Non-Technical");
rec.category = "Payroll";
rec.subcategory = "Inquiry Payroll";
rec.u_action = input.actionvalue;
rec.impact = "3 - Low";
rec.urgency = "3 - Low";
rec.u_call_back_number = data.user.phone;

}else if(input.area =='Property Management'){

rec.u_requestor_type = "Coworker";
rec.assignment_group = getGroup("Property Management");
rec.category = "Property Management";
rec.subcategory = "Inquiry Property Management";
rec.u_action = input.actionvalue;
rec.impact = "3 - Low";
rec.urgency = "3 - Low";
rec.u_call_back_number = data.user.phone;

}else if(input.area =='Staffing'){

rec.u_requestor_type = "Coworker";
rec.assignment_group = getGroup("Staffing ");
rec.category = "Staffing";
rec.subcategory = "Inquiry Staffing";
rec.u_action =input.actionvalue;
rec.impact = "3 - Low";
rec.urgency = "3 - Low";
rec.u_call_back_number = data.user.phone;

}else if(input.area =='Store Operations'){

rec.u_requestor_type = "Coworker";
rec.assignment_group = getGroup("Store Operations");
rec.category = "Store Operations";
rec.subcategory = "Inquiry Store Operations";
rec.u_action = input.actionvalue;
rec.impact = "3 - Low";
rec.urgency = "3 - Low";
rec.u_call_back_number = data.user.phone;

}else if(input.area =='Tax Accounting'){

rec.u_requestor_type = "Coworker";
rec.assignment_group = getGroup("Tax");
rec.category = "Tax Accounting";
rec.subcategory = "Inquiry Tax Accounting";
rec.u_action = input.actionvalue;
rec.impact = "3 - Low";
rec.urgency = "3 - Low";
rec.u_call_back_number = data.user.phone;

}else if(input.area =='Treasury Management'){

rec.u_requestor_type = "Coworker";
rec.assignment_group = getGroup("Treasury Management");
rec.category = "Treasury Management";
rec.subcategory = "Inquiry Treasury Management";
rec.u_action = input.actionvalue;
rec.impact = "3 - Low";
rec.urgency = "3 - Low";
rec.u_call_back_number = data.user.phone;

}

else if(input.area =='Customer Account Issues'){

rec.u_requestor_type = "Coworker";
rec.assignment_group = getGroup("Solution Center Customer Superuser");
rec.category = "Customer Service";
rec.subcategory = 2;
rec.u_action = input.actionvalue;
rec.impact = "3 - Low";
rec.urgency = "3 - Low";
rec.u_language = "English";
rec.u_call_back_number = data.user.phone;

var recUser = new GlideRecord("sys_user");
recUser.addQuery("sys_id", data.usersys_id);
recUser.query();
if(recUser.next()){
rec.u_first_name = recUser.first_name;
rec.u_last_name = recUser.last_name;
}


} /*else if(input.area =='Expense Reimbursement'){

rec.u_requestor_type = "Coworker";
rec.assignment_group = getGroup("Solution Center Sutherland Non-Technical");
rec.category = "Accounts Payable";
rec.subcategory = "Expenses & Checks";
rec.u_action = "Expense Check Status";
rec.impact = "2 - Medium";
rec.urgency = "2 - Medium";
rec.u_call_back_number = data.user.phone;

} else if(input.area =='Fleet'){

rec.u_requestor_type = "Coworker";
rec.assignment_group = getGroup("Solution Center Sutherland Non-Technical");
rec.category = "Fleet";
rec.subcategory = "(ESBU Sort) Fleet";
rec.u_action = "(ESBU Sort) Smart Phone";
rec.impact = "2 - Medium";
rec.urgency = "2 - Medium";
rec.u_call_back_number = data.user.phone;

} */else if(input.area =='MyCOE'){

rec.u_requestor_type = "Coworker";
rec.assignment_group = getGroup("IT Service Desk");
rec.category = "Incident";
rec.subcategory = "Software";
rec.u_action = input.actionvalue;
rec.impact = "3 - Low";
rec.urgency = "3 - Low";
rec.u_call_back_number = data.user.phone;

} /*else if(input.area =='Smartphone/Mobile Issues'){

rec.u_requestor_type = "Coworker";
rec.assignment_group = getGroup("Solution Center Customer Superuser");
rec.category = "Smart Phone";
rec.subcategory = "(ESBU Sort) Smart Phone";
rec.u_action = "(ESBU Sort) Smart Phone";
rec.impact = "2 - Medium";
rec.urgency = "2 - Medium";
rec.u_call_back_number = data.user.phone;

} else if(input.area =='Staffing'){

rec.u_requestor_type = "Coworker";
rec.assignment_group = getGroup("Solution Center Sutherland Non-Technical");
rec.category = "Staffing";
rec.subcategory = "(ESBU Sort) Staffing";
rec.u_action = "(ESBU Sort) Staffing";
rec.impact = "2 - Medium";
rec.urgency = "2 - Medium";
rec.u_call_back_number = data.user.phone;

} else if(input.area =='Store Operations'){

rec.u_requestor_type = "Coworker";
rec.assignment_group = getGroup("Solution Center Sutherland Non-Technical");
rec.category = "Internal Support";
rec.subcategory = "(ESBU Sort) Operations Solutions";
rec.u_action = "(ESBU Sort) Operations Solutions";
rec.impact = "2 - Medium";
rec.urgency = "2 - Medium";
rec.u_call_back_number = data.user.phone;

} */else if(input.area =='Technical Support'){

rec.u_requestor_type = "Coworker";
rec.assignment_group = getGroup("IT Service Desk");
rec.category = "Inquiry";
rec.subcategory = "Other";
rec.u_action = input.actionvalue;
rec.impact = "3 - Low";
rec.urgency = "3 - Low";
rec.u_call_back_number = data.user.phone;

} else if(input.area =='Enterprise Data Services'){

rec.u_requestor_type = "Coworker";
rec.assignment_group = getGroup("Enterprise Data Services");
rec.category = "Incident";
rec.subcategory = "Process";
rec.u_action = input.actionvalue;
rec.impact = "3 - Low";
rec.urgency = "3 - Low";
rec.u_call_back_number = data.user.phone;
}

rec.location = data.loc.sys_id;
rec.caller_id = data.usersys_id;
rec.contact_type = "Self Service";
rec.short_description = input.area;
// rec.u_action = input.myCoworkerConcern;
rec.description = input.description;
rec.user_input = input.description;
rec.u_call_back_number = input.user.phone;
rec.insert();

data.ticketCreation = gs.getMessage(issueMessage(rec.number,rec.short_description, rec.sys_id));
}

/* if (input && input.update_incident) {

var actioncoworker = new GlideRecord('u_incident_coworker');
actioncoworker.addQuery("u_action", actioncoworker);
actioncoworker.query();
if(actioncoworker.next()){
actioncoworker.u_action = input.CoworkerConcern;
actioncoworker.update();
}

}*/

function getGroup(groupName){
var assignGroup= new GlideRecord("sys_user_group");
assignGroup.addQuery("name", groupName);
assignGroup.query();
if(assignGroup.next()){
return assignGroup.sys_id.toString();
}

return null;
}

function issueMessage(n, title, sys_id) {
var table = null;
if(title =='Technical Support' || title =='Enterprise Data Services' || input.area =='MyCOE' ){
table = "u_incident_technical";
} else if(title =='Customer Account Issues' || title =='AcceptanceNow' || input.area =='Solution Center Credit Reporting'){
table = "u_incident_external";
} else {
table = "u_incident_coworker";
}
var page = table == 'sc_request' ? 'sc_request' : 'ticket';
var t = "${Created} " + n + " - ";
t += "${track using 'Requests' in the header or}";
t += ' <a href="?id=' + page + '&table=' + table + '&sys_id=' + sys_id + '">' + "${click here to view}" + '</a>';
return t;
}

})();

 

Client controller:

function($scope, $rootScope, $timeout, spUtil, $location, $window) {
/* widget controller */
var c = this;
// c.data.area="Asset Protection";
// alert ("Area Vakue : "+c.data.area);
$scope.user = {
displayValue: c.data.useraname,
value: c.data.usersys_id,
name: 'user'
};

$scope.location = {
displayValue: c.data.loc.name,
value: c.data.loc.sys_id,
name: 'location'
};

$scope.$on("field.change", function(evt, parms) {

if (parms.field.name == 'location')
c.data.setLocation = parms.newValue;

c.server.update().then(function(response) {
spUtil.update($scope);
})
});

$scope.checkArea = function() {
//alert("ON CHange "); // (title =='Customer Account Issues' || title =='AcceptanceNow' ||
//alert ("Area Vakue : ON change "+c.data.area);
if (c.data.area == "Accounts Payable")
// c.data.description= "Expense check date/amount = " + "\n" + "Brief desciption of issue =" ;
c.myCoworkerConcernoptions = [{
myChoiceDisplay: "Storage Question",
myChoiceValue: 'Storage Question'
},
{
myChoiceDisplay: "P & L Inquiry",
myChoiceValue: 'P & L Inquiry'
},
{
myChoiceDisplay: "Email inquiry",
myChoiceValue: 'Email inquiry'
},
{
myChoiceDisplay: "Expense Check Status",
myChoiceValue: 'Expense Check Status'
},
{
myChoiceDisplay: "Did not receive/Stop Pay",
myChoiceValue: 'Did not receive/Stop Pay'
},
{
myChoiceDisplay: "Customer Refund Check Status",
myChoiceValue: 'Customer Refund Check Status'
},
{
myChoiceDisplay: "Check invoice status",
myChoiceValue: 'Check invoice status'
},
{
myChoiceDisplay: "W9 Form",
myChoiceValue: 'W9 Form'
},
{
myChoiceDisplay: "EFM Form",
myChoiceValue: 'EFM Form'
}
];
c.myCoworkerConcernlistoption = {
hideSearch: true
};
c.myCoworkerConcern = "Storage Question"; {
if (c.data.area == "Solution Center Credit Reporting")
c.myCoworkerConcernoptions = [{
myChoiceDisplay: "Bullseye Request",
myChoiceValue: 'Bullseye Request'
},
{
myChoiceDisplay: "Disputes Payment History / Charge-Off / Write-Off",
myChoiceValue: 'Disputes Payment History / Charge-Off / Write-Off'
},
{
myChoiceDisplay: "General Credit Reporting Questions",
myChoiceValue: 'General Credit Reporting Questions'
},
{
myChoiceDisplay: "Payment Not Reflecting on Credit Yet",
myChoiceValue: 'Payment Not Reflecting on Credit Yet'
},
{
myChoiceDisplay: "Received Calls from Collection Agency",
myChoiceValue: 'Received Calls from Collection Agency'
},
{
myChoiceDisplay: "Requesting Removal From Credit / Contract Cancelled Before Delivery",
myChoiceValue: 'Requesting Removal From Credit / Contract Cancelled Before Delivery'
},
{
myChoiceDisplay: "Settle an Account / Repair Credit",
myChoiceValue: 'Settle an Account / Repair Credit'
}
];
c.myCoworkerConcernlistoption = {
hideSearch: true
};
c.myCoworkerConcern = "Bullseye Request"; {
if (c.data.area == "AcceptanceNow")
c.myCoworkerConcernoptions = [{
myChoiceDisplay: "Store Requesting Copies of Agreement",
myChoiceValue: 'Store Requesting Copies of Agreement'
}];
c.myCoworkerConcernlistoption = {
hideSearch: true
};
c.myCoworkerConcern = "Store Requesting Copies of Agreement"; {
if (c.data.area == "Customer Account Issues")
c.myCoworkerConcernoptions = [{
myChoiceDisplay: "Other",
myChoiceValue: 'Other'
}];
c.myCoworkerConcernlistoption = {
hideSearch: true
};
c.myCoworkerConcern = "Other"; {

if (c.data.area == "Asset Protection")
c.myCoworkerConcernoptions = [{
myChoiceDisplay: "Pin Enrollment",
myChoiceValue: 'Pin Enrollment'
},
{
myChoiceDisplay: "Safe Service",
myChoiceValue: 'Safe Service'
},
{
myChoiceDisplay: "Alarm System Service",
myChoiceValue: 'Alarm System Service'
},
{
myChoiceDisplay: "Camera",
myChoiceValue: 'Camera'
},
{
myChoiceDisplay: "Remote Access",
myChoiceValue: 'Remote Access'
}
];
c.myCoworkerConcernlistoption = {
hideSearch: true
};
c.myCoworkerConcern = "Pin Enrollment"; {
if (c.data.area == "Benefits")
c.myCoworkerConcernoptions = [{
myChoiceDisplay: "Did not Receive Bonus",
myChoiceValue: 'Did not Receive Bonus'
},
{
myChoiceDisplay: "General Bonus Inquiry",
myChoiceValue: 'General Bonus Inquiry'
},
{
myChoiceDisplay: "Unemployment Inquiry",
myChoiceValue: 'Unemployment Inquiry'
},
{
myChoiceDisplay: "Verification of Employment (VOE)",
myChoiceValue: 'Verification of Employment (VOE)'
},
{
myChoiceDisplay: "Service Awards",
myChoiceValue: 'Service Awards'
},
{
myChoiceDisplay: "Submit a Death Claim",
myChoiceValue: 'Submit a Death Claim'
}
];
c.myCoworkerConcernlistoption = {
hideSearch: true
};
c.myCoworkerConcern = "Did not Receive Bonus";

{
if (c.data.area == "Expense Management")
c.myCoworkerConcernoptions = [{
myChoiceDisplay: "InnerWorkings/Coupa issue",
myChoiceValue: 'InnerWorkings/Coupa issue'
},
{
myChoiceDisplay: "General inquiry",
myChoiceValue: 'General inquiry'
},
{
myChoiceDisplay: "Concur mobile app",
myChoiceValue: 'Concur mobile app'
},
{
myChoiceDisplay: "General inquiry",
myChoiceValue: 'General inquiry'
}
];
c.myCoworkerConcernlistoption = {
hideSearch: true
};
c.myCoworkerConcern = "InnerWorkings/Coupa issue"; {
if (c.data.area == "Fixed Assets")
c.myCoworkerConcernoptions = [{
myChoiceDisplay: "Issues with telecom/2-way radios",
myChoiceValue: 'Issues with telecom/2-way radios'
},
{
myChoiceDisplay: "New equipment request",
myChoiceValue: 'New equipment request'
},
{
myChoiceDisplay: "Wrong serial number",
myChoiceValue: 'Wrong serial number'
},
{
myChoiceDisplay: "Audit issues",
myChoiceValue: 'Audit issues'
},
{
myChoiceDisplay: "Missing assets (not on list)",
myChoiceValue: 'Missing assets (not on list)'
},
{
myChoiceDisplay: "Invoice status inquiry",
myChoiceValue: 'Invoice status inquiry'
}
];
c.myCoworkerConcernlistoption = {
hideSearch: true
};
c.myCoworkerConcern = "Issues with telecom/2-way radios";

{
if (c.data.area == "General Ledger")
c.myCoworkerConcernoptions = [{
myChoiceDisplay: "Benefits Plus Charge Offer",
myChoiceValue: 'Benefits Plus Charge Offer'
},
{
myChoiceDisplay: "General GL Inquiry",
myChoiceValue: 'General GL Inquiry'
},
{
myChoiceDisplay: "General P&L Inquiry",
myChoiceValue: 'General P&L Inquiry'
},
{
myChoiceDisplay: "Mistake with Charge on GL or P&L",
myChoiceValue: 'Mistake with Charge on GL or P&L'
},
{
myChoiceDisplay: "PLQA Resolution System Questions",
myChoiceValue: 'PLQA Resolution System Questions'
}
];
c.myCoworkerConcernlistoption = {
hideSearch: true
};
c.myCoworkerConcern = "Benefits Plus Charge Offer";

{
if (c.data.area == "HRIS")
c.myCoworkerConcernoptions = [{
myChoiceDisplay: "Did not Receive Referral Pay",
myChoiceValue: 'Did not Receive Referral Pay'
},
{
myChoiceDisplay: "Coworker Referral Denied",
myChoiceValue: 'Coworker Referral Denied'
},
{
myChoiceDisplay: "General Inquiry",
myChoiceValue: 'General Inquiry'
},
{
myChoiceDisplay: "Need Employee ID#",
myChoiceValue: 'Need Employee ID#'
},
{
myChoiceDisplay: "Onboarding technical support",
myChoiceValue: 'Onboarding technical support'
},
{
myChoiceDisplay: "Request Term Letter",
myChoiceValue: 'Request Term Letter'
}
];
c.myCoworkerConcernlistoption = {
hideSearch: true
};
c.myCoworkerConcern = "Did not Receive Referral Pay"; {
if (c.data.area == "Inventory Payables (ANOW)")
c.myCoworkerConcernoptions = [{
myChoiceDisplay: "ACH/Banking Update",
myChoiceValue: 'ACH/Banking Update'
},
{
myChoiceDisplay: "Charge-Off",
myChoiceValue: 'Charge-Off'
},
{
myChoiceDisplay: "Online Invoice Submission System",
myChoiceValue: 'Online Invoice Submission System'
},
{
myChoiceDisplay: "Payment Status",
myChoiceValue: 'Payment Status'
},
{
myChoiceDisplay: "Refund Check",
myChoiceValue: 'Refund Check'
},
{
myChoiceDisplay: "Vendor Set-Up",
myChoiceValue: 'Vendor Set-Up'
},
{
myChoiceDisplay: "Inventory Transfer Confirmation",
myChoiceValue: 'Inventory Transfer Confirmation'
},
{
myChoiceDisplay: "Price/Serial Number Changes",
myChoiceValue: 'Price/Serial Number Changes'
}
];
c.myCoworkerConcernlistoption = {
hideSearch: true
};
c.myCoworkerConcern = "ACH/Banking Update";

{
if (c.data.area == "Inventory Payables (RTO)")
c.myCoworkerConcernoptions = [{
myChoiceDisplay: "GL Expense/Credits",
myChoiceValue: 'GL Expense/Credits'
},
{
myChoiceDisplay: "Move Expenses",
myChoiceValue: 'Move Expenses'
},
{
myChoiceDisplay: "Extra Item Found",
myChoiceValue: 'Extra Item Found'
},
{
myChoiceDisplay: "Inventory Error",
myChoiceValue: 'Inventory Error'
},
{
myChoiceDisplay: "Partial PO Received",
myChoiceValue: 'Partial PO Received'
},
{
myChoiceDisplay: "Price/Serial Number Changes",
myChoiceValue: 'Price/Serial Number Changes'
},
{
myChoiceDisplay: "Vendor Shipping Error",
myChoiceValue: 'Vendor Shipping Error'
},
{
myChoiceDisplay: "Wrong Item Received",
myChoiceValue: 'Wrong Item Received'
},
{
myChoiceDisplay: "Closed PO Needs to be Opened",
myChoiceValue: 'Closed PO Needs to be Opened'
},
{
myChoiceDisplay: "Open PO Needs to be Closed",
myChoiceValue: 'Open PO Needs to be Closed'
},
{
myChoiceDisplay: "Wrong Store",
myChoiceValue: 'Wrong Store'
},
{
myChoiceDisplay: "General Inquiry",
myChoiceValue: 'General Inquiry'
},
{
myChoiceDisplay: "Vendor Information",
myChoiceValue: 'Vendor Information'
}
];
c.myCoworkerConcernlistoption = {
hideSearch: true
};
c.myCoworkerConcern = "GL Expense/Credits";

{
if (c.data.area == "Lease Accounting")
c.myCoworkerConcernoptions = [{
myChoiceDisplay: "Rent Payment Inquiry",
myChoiceValue: 'Rent Payment Inquiry'
},
{
myChoiceDisplay: "CAM (Common Area Maintenance)",
myChoiceValue: 'CAM (Common Area Maintenance)'
},
{
myChoiceDisplay: "Tax Inquiry",
myChoiceValue: 'Tax Inquiry'
},
{
myChoiceDisplay: "Insurance Inquiry",
myChoiceValue: 'Insurance Inquiry'
},
{
myChoiceDisplay: "Accounting Inquiry",
myChoiceValue: 'Accounting Inquiry'
}
];
c.myCoworkerConcernlistoption = {
hideSearch: true
};
c.myCoworkerConcern = "Rent Payment Inquiry";

{
if (c.data.area == "Lease Admin")
c.myCoworkerConcernoptions = [{
myChoiceDisplay: "Certificate of Insurance",
myChoiceValue: 'Certificate of Insurance'
},
{
myChoiceDisplay: "Change of Ownership",
myChoiceValue: 'Change of Ownership'
},
{
myChoiceDisplay: "Property for Lease/Rent",
myChoiceValue: 'Property for Lease/Rent'
},
];
c.myCoworkerConcernlistoption = {
hideSearch: true
};
c.myCoworkerConcern = "Certificate of Insurance";

{
if (c.data.area == "Staffing")
c.myCoworkerConcernoptions = [{
myChoiceDisplay: "Background/Drug Test Status",
myChoiceValue: 'Background/Drug Test Status'
},
{
myChoiceDisplay: "DOT verification Fax Confirmation",
myChoiceValue: 'DOT verification Fax Confirmation'
},
{
myChoiceDisplay: "Request to Open a Requisition",
myChoiceValue: 'Request to Open a Requisition'
},
{
myChoiceDisplay: "Onboarding Issues",
myChoiceValue: 'Onboarding Issues'
}
];
c.myCoworkerConcernlistoption = {
hideSearch: true
};
c.myCoworkerConcern = "Background/Drug Test Status";

{
if (c.data.area == "Store Operations")
c.myCoworkerConcernoptions = [{
myChoiceDisplay: "ALE Inquiries",
myChoiceValue: 'ALE Inquiries'
},
{
myChoiceDisplay: "Fire Extinguisher General Inquiry",
myChoiceValue: 'Fire Extinguisher General Inquiry'
},
{
myChoiceDisplay: "Iron Mountain Cancel a pick up",
myChoiceValue: 'Iron Mountain Cancel a pick up'
},
{
myChoiceDisplay: "Iron Mountain General inquiry",
myChoiceValue: 'Iron Mountain General inquiry'
},
{
myChoiceDisplay: "Iron Mountain Missed pick up",
myChoiceValue: 'Iron Mountain Missed pick up'
},
{
myChoiceDisplay: "Iron Mountain Request additional bins/boxes",
myChoiceValue: 'Iron Mountain Request additional bins/boxes'
},
{
myChoiceDisplay: "Iron Mountain Request to unlock bin",
myChoiceValue: 'Iron Mountain Request to unlock bin'
},
{
myChoiceDisplay: "Iron Mountain General inquiry",
myChoiceValue: 'Iron Mountain General inquiry'
},
{
myChoiceDisplay: "Iron Mountain Schedule additional pick up",
myChoiceValue: 'Iron Mountain Schedule additional pick up'
},
{
myChoiceDisplay: "Iron Mountain Complaint",
myChoiceValue: 'Iron Mountain Complaint'
},
{
myChoiceDisplay: "Terminix General inquiry",
myChoiceValue: 'Terminix General inquiry'
},
{
myChoiceDisplay: "Terminix Issue not resolved",
myChoiceValue: 'Terminix Issue not resolved'
},
{
myChoiceDisplay: "Terminix Missed service call",
myChoiceValue: 'Terminix Missed service call'
},
{
myChoiceDisplay: "Terminix Schedule service call",
myChoiceValue: 'Terminix Schedule service call'
},
{
myChoiceDisplay: "Terminix Violation/Complaint",
myChoiceValue: 'Terminix Violation/Complaint'
},
{
myChoiceDisplay: "Republic Services General inquiry",
myChoiceValue: 'Republic Services General inquiry'
},
{
myChoiceDisplay: "Republic Services Issue not resolved",
myChoiceValue: 'Republic Services Issue not resolved'
},
{
myChoiceDisplay: "Republic Services Missed service call",
myChoiceValue: 'Republic Services Missed service call'
},
{
myChoiceDisplay: "Republic Services Schedule service call",
myChoiceValue: 'Republic Services Schedule service call'
},
{
myChoiceDisplay: "Republic Services Violation/Complaint",
myChoiceValue: 'Republic Services Violation/Complaint'
},
{
myChoiceDisplay: "Republic Services Order a new container",
myChoiceValue: 'Republic Services Order a new container'
}
];
c.myCoworkerConcernlistoption = {
hideSearch: true
};
c.myCoworkerConcern = "ALE Inquiries";


{
if (c.data.area == "Payroll")
c.myCoworkerConcernoptions = [{
myChoiceDisplay: "Pay Rate Inquiry",
myChoiceValue: 'Pay Rate Inquiry'
},
{
myChoiceDisplay: "Retro Pay Status",
myChoiceValue: 'Retro Pay Status'
},
{
myChoiceDisplay: "Garnishment Deduction",
myChoiceValue: 'Garnishment Deduction'
},
{
myChoiceDisplay: "Add/Close Direct Deposit",
myChoiceValue: 'Add/Close Direct Deposit'
},
{
myChoiceDisplay: "Confirm Paycheck was Processed",
myChoiceValue: 'Confirm Paycheck was Processed'
},
{
myChoiceDisplay: "Did not Receive Holiday Pay",
myChoiceValue: 'Did not Receive Holiday Pay'
},
{
myChoiceDisplay: "Did not Receive Paper Check",
myChoiceValue: 'Did not Receive Paper Check'
},
{
myChoiceDisplay: "Direct Deposit Status",
myChoiceValue: 'Direct Deposit Status'
},
{
myChoiceDisplay: "Paycheck Incorrect (Hours Missing)",
myChoiceValue: 'Paycheck Incorrect (Hours Missing)'
},
{
myChoiceDisplay: "Paystub Incorrect",
myChoiceValue: 'Paystub Incorrect'
},
{
myChoiceDisplay: "Paystub Request",
myChoiceValue: 'Paystub Request'
},
{
myChoiceDisplay: "Stop Pay Request",
myChoiceValue: 'Stop Pay Request'
},
{
myChoiceDisplay: "Promotion/Termination/Leave/Transfer Inquiry",
myChoiceValue: 'Promotion/Termination/Leave/Transfer Inquiry'
},
{
myChoiceDisplay: "Tax Exempt- Federal",
myChoiceValue: 'Tax Exempt- Federal'
},
{
myChoiceDisplay: "Tax Exempt- State",
myChoiceValue: 'Tax Exempt- State'
},
{
myChoiceDisplay: "W2 Request",
myChoiceValue: 'W2 Request'
},
{
myChoiceDisplay: "Cannot Approve Timecard",
myChoiceValue: 'Cannot Approve Timecard'
},
{
myChoiceDisplay: "Cannot Create a Schedule",
myChoiceValue: 'Cannot Create a Schedule'
},
{
myChoiceDisplay: "Cannot Edit Time",
myChoiceValue: 'Cannot Edit Time'
},
{
myChoiceDisplay: "PTO Balance Incorrect",
myChoiceValue: 'PTO Balance Incorrect'
},
{
myChoiceDisplay: "Vacation Balance Incorrect",
myChoiceValue: 'Vacation Balance Incorrect'
},
{
myChoiceDisplay: "Vacation Payout Inquiry",
myChoiceValue: 'Vacation Payout Inquiry'
}
];
c.myCoworkerConcernlistoption = {
hideSearch: true
};
c.myCoworkerConcern = "Pay Rate Inquiry"; {
if (c.data.area == "Property Management")
c.myCoworkerConcernoptions = [{
myChoiceDisplay: "Common Area Maintenance",
myChoiceValue: 'Common Area Maintenance'
},
{
myChoiceDisplay: "Exterior/Parking Lot",
myChoiceValue: 'Exterior/Parking Lot'
},
{
myChoiceDisplay: "Hazmat/Mildew",
myChoiceValue: 'Hazmat/Mildew'
},
{
myChoiceDisplay: "HVAC (Heating, Ventilating & Air Conditioning)",
myChoiceValue: 'HVAC (Heating, Ventilating & Air Conditioning)'
},
{
myChoiceDisplay: "Interior",
myChoiceValue: 'Interior'
},
{
myChoiceDisplay: "Other",
myChoiceValue: 'Other'
},
{
myChoiceDisplay: "Roof Leaks",
myChoiceValue: 'Roof Leaks'
},
{
myChoiceDisplay: "Signage",
myChoiceValue: 'Signage'
},
{
myChoiceDisplay: "Snow Removal Request",
myChoiceValue: 'Snow Removal Request'
},
{
myChoiceDisplay: "Utilities",
myChoiceValue: 'Utilities'
}
];
c.myCoworkerConcernlistoption = {
hideSearch: true
};
c.myCoworkerConcern = "Common Area Maintenance";


{
if (c.data.area == "Tax Accounting")
c.myCoworkerConcernoptions = [{
myChoiceDisplay: "License Application",
myChoiceValue: 'License Application'
},
{
myChoiceDisplay: "Personal Property Tax",
myChoiceValue: 'Personal Property Tax'
},
{
myChoiceDisplay: "Sales Tax Return Filed",
myChoiceValue: 'Sales Tax Return Filed'
},
{
myChoiceDisplay: "Business Licenses",
myChoiceValue: 'Business Licenses'
},
{
myChoiceDisplay: "Exempt Customers",
myChoiceValue: 'Exempt Customers'
},
{
myChoiceDisplay: "Information Needs",
myChoiceValue: 'Information Needs'
},
{
myChoiceDisplay: "Permits",
myChoiceValue: 'Permits'
},
{
myChoiceDisplay: "Tax Payments",
myChoiceValue: 'Tax Payments'
},
{
myChoiceDisplay: "Violations",
myChoiceValue: 'Violations'
}
];
c.myCoworkerConcernlistoption = {
hideSearch: true
};
c.myCoworkerConcern = "License Application";

 

{
if (c.data.area == "Treasury Management")
c.myCoworkerConcernoptions = [{
myChoiceDisplay: "Bank Inquiry",
myChoiceValue: 'Bank Inquiry'
},
{
myChoiceDisplay: "Cash Drawer Over/Short",
myChoiceValue: 'Cash Drawer Over/Short'
},
{
myChoiceDisplay: "Chargeback Inquiry",
myChoiceValue: 'Chargeback Inquiry'
},
{
myChoiceDisplay: "Credit Card Double-Charged/Refund",
myChoiceValue: 'Credit Card Double-Charged/Refund'
},
{
myChoiceDisplay: "Credit Card Inquiry",
myChoiceValue: 'Credit Card Inquiry'
},
{
myChoiceDisplay: "NSF Check Inquiry",
myChoiceValue: 'NSF Check Inquiry'
},
{
myChoiceDisplay: "P&L Reporting",
myChoiceValue: 'P&L Reporting'
},
{
myChoiceDisplay: "Deposit Variance",
myChoiceValue: 'Deposit Variance'
},
{
myChoiceDisplay: "Late Deposit",
myChoiceValue: 'Late Deposit'
},
{
myChoiceDisplay: "Unauthorized Charges",
myChoiceValue: 'Unauthorized Charges'
}
];
c.myCoworkerConcernlistoption = {
hideSearch: true
};
c.myCoworkerConcern = "Bank Inquiry";

//Technical incident

{
if (c.data.area == "Technical Support")
c.myCoworkerConcernoptions = [{
myChoiceDisplay: "Other",
myChoiceValue: 'Other'
}];
c.myCoworkerConcernlistoption = {
hideSearch: true
};
c.myCoworkerConcern = "Other";


{
if (c.data.area == "Enterprise Data Services")
c.myCoworkerConcernoptions = [{
myChoiceDisplay: "Other",
myChoiceValue: 'Other'
}];
c.myCoworkerConcernlistoption = {
hideSearch: true
};
// c.myCoworkerConcern = "Other";


{
if (c.data.area == "MyCOE")
c.myCoworkerConcernoptions = [{
myChoiceDisplay: "MyCOE – Learning",
myChoiceValue: 'MyCOE – Learning'
}];
c.myCoworkerConcernlistoption = {
hideSearch: true
};
c.myCoworkerConcern = "";
c.valueSelected = function(selectedValue) {
c.data.actionvalue = selectedValue;
//alert(selectedValue);
//alert("c.data.actionvalue " + c.data.actionvalue);
//alert("c.data.myCoworkerConcern " + c.data.myCoworkerConcern);
}

{

if (c.data.area == "Asset Protection" || c.data.area == "Solution Center Credit Reporting" || c.data.area == "Benefits" || c.data.area == "Expense Management" || c.data.area == "Fixed Assets" || c.data.area == "General Ledger" || c.data.area == "Inventory Payables (ANOW)" || c.data.area == "Inventory Payables (RTO)" || c.data.area == "Lease Accounting" || c.data.area == "Lease Admin" || c.data.area == "Tax Accounting" || c.data.area == "AcceptanceNow" || c.data.area == "Customer Account Issues" | c.data.area == "Enterprise Data Services" || c.data.area == "MyCOE" || c.data.area == "Technical Support")
c.data.description = "Brief description of issue"; {
if (c.data.area == "Property Management")
c.data.description = "Impacted store#, Call back phone#, Issue Type (HVAC, roof, etc)"; {
if (c.data.area == "Payroll") c.data.description = "Effected coworker's name " + "\n" + "Employee ID#"+ "\n" + " Brief description of issue";
// alert("c.data.actionvalue" + c.data.actionvalue);
// alert("c.data.area " + c.data.area); //alert("input.actionvalue" + c.data.actionvalue);
{
//alert("input.actionvalue1" + c.data.actionvalue);
if (c.data.area == "Accounts Payable" )
c.data.description = "Brief desciption of issue" + "\n\n" + "Please provide detail for specific CoWorkerConcern as below - " + "\n" + "Expense Check Status :" + "\n" + "Expense check date/amount =" + "\n" + "Brief desciption of issue :" + "\n\n" + "Customer Refund Check Status:" + "\n" + "Customer's name =" + "\n" + "Refund amount = " + "\n" + "Date submitted =" + "\n" + "Brief desciption of issue: " + "\n\n" + "Check invoice status:" + "\n" + "Vendor Name/Number = " + "\n" + "Invoice# = " + "\n" + "PO# = " + "\n" + "Invoice amount = " + "\n" + "Brief desciption of issue:" ;
{
if (c.data.area == "Staffing" )
c.data.description = "Please provide detail for specific CoWorkerConcern as below - " + "\n\n" + "Background/Drug Test Status:" + "\n" + "Name of candidate = " + "\n\n" + "DOT verification Fax Confirmation:" + "\n" + "Name of previous coworker =" + "\n\n" + "Request to Open a Requisition:" + "\n" + "Position of Req = " + "\n" + "Date to be opened = " + "\n\n" + "Onboarding Issues: " + "\n"+ "Brief desciption of issue:" ;
{
if (c.data.area == "HRIS" )
c.data.description = "Brief desciption of issue" + "\n" + "Please provide detail for specific CoWorkerConcern as below - " + "\n\n" + "Onboarding technical support:" + "\n" + "New hire's name =" + "\n" + "Brief desciption of issue :" + "\n\n" + "Did not Receive Referral Pay:" + "\n" + "Referred coworker's name/EID =" + "\n" + "Date of hire = " + "\n" + "Brief desciption of issue: " + "\n\n" + "Coworker Referral Denied:" + "\n" + "Referred coworker's name/EID =  " + "\n" + "Date of hire = " + "\n" + "Brief desciption of issue:" ;
{if (c.data.area == "Treasury Management" )
c.data.description = "Bank Inquiry:" + "\n" + "Brief description of issue" + "\n\n" + "Cash Drawer Over/Short:" + "\n" + "Date = " + "\n" + "Amount over/short = " + "\n" + "Brief description of issue:" + "\n\n" + "Chargeback Inquiry:" + "\n" + "Date = " + "\n" + "Chargeback amount = " + "\n" + "Brief description of issue" + "\n\n" + "Credit Card Double-Charged/Refund:" + "\n" + "Customer Name =" + "\n" + "Last four of CC = " + "\n" + "Amount = " + "\n" + "Date = " + "\n" + "Brief description of issue: " + "\n\n" + "Credit Card Inquiry:" + "\n" + "Customer Name =" + "\n" + "Last four of CC = " + "\n" + "Amount = " + "\n" + "Date = " + "\n" + "Brief description of issue" + "\n\n" + "NSF Check Inquiry:" + "\n" + "Customer Name = " + "\n" + "Amount = " + "\n" + "Date =" + "\n" + "Brief description of issue:" + "\n\n" + "P&L Reporting:" + "\n"+ "Brief description of issue" + "\n\n" + "Deposit Variance:" + "\n" + "Date =" + "\n" + "Amount of variance =" + "\n" + "Brief description of issue:" + "\n\n" + "Late Deposit:" + "\n" + "Brief description of issue:" + "\n\n" + "Unauthorized Charges:" + "\n" + "Customer Name =" + "\n" + "Last four of CC =" + "\n" + "Amount = " + "\n" + "Date = " + "\n" + "Brief description of issue:";
{if (c.data.area == "Store Operations" )
c.data.description = "ALE Inquiries:" + "\n" + "Agreement#=" + "\n" + "Brief description of issue:" + "\n\n" + "Fire Extinguisher General Inquiry:" + "\n" +"Brief description of issue:" + "\n\n" + "Iron Mountain Cancel a pick up:" +"\n" + "Date of pickup=" + "\n\n"+ "Iron Mountain General inquiry:" + "\n"+"Brief description of issue: "+ "\n\n" + "Iron Mountain Missed pick up:" + "\n" + "Date of missed pickup=" + "\n" + "Number of bins/boxes=" + "\n\n" + "Iron Mountain Request additional bins/boxes:" + "\n" + "Specify bins/boxes= " + "\n" + "Number requested=" + "\n\n" + "Iron Mountain Request to unlock bin:" + "\n" + "Brief description of issue:" + "\n\n" + "Iron Mountain General inquiry:" + "\n" + "Brief description of issue:" + "\n\n" + "Iron Mountain Schedule additional pick up:" + "\n" + "Date of next pickup= " + "\n" + "Number of bins/boxes=" + "\n\n" + "Iron Mountain Complaint:" + "\n" + "Brief description of issue:" + "\n\n" + "Terminix General inquiry:" + "\n" + "Brief description of issue:" +"\n\n" + "Terminix Issue not resolved:" + "\n" + "Brief description of issue:" + "\n\n" + "Terminix Missed service call:" + "\n" + "Date of missed service call=" + "\n\n" + "Terminix Schedule service call:" + "\n" + "Brief description of issue:" + "\n\n" + "Terminix Violation/Complaint:" + "\n" + "Brief description of issue:" + "\n\n" +"Republic Services General inquiry:" + "\n" +"Brief description of issue:" + "\n\n" + "Republic Services Issue not resolved:" + "\n" + "Brief description of issue:" + "\n\n" + "Republic Services Missed service call:" + "\n" + "Date of missed service call=" + "\n" + "Brief description of pickup type (trash/recycling)=" + "\n\n" + "Republic Services Schedule service call:" + "\n"+"Brief description of pickup type (trash/recycling)=" + "\n\n" + "Republic Services Violation/Complaint:" + "\n" + "Brief description of issue: " + "\n\n" + "Republic Services Order a new container:" + "\n" + "Brief description of pickup type (trash/recycling, size)=" + "\n\n" + "Republic Services Issue not resolved:" + "\n" +"Brief description of issue:";}
}
}

}
}

}
}

}
}
}

$scope.update = function() {
if (c.data.area == null || c.data.area === "") { spUtil.addErrorMessage($scope.data.mustSpecifyArea);
return;
}
//if(c.data.myCoworkerConcern == null || c.data.myCoworkerConcern === "" || c.data.myCoworkerConcern == "undefined"&&)
//if(c.data.actionvalue == null || c.data.actionvalue === "")
if (c.data.actionvalue === "") {
spUtil.addErrorMessage($scope.data.mustSpecifyCoworkerConcern);
return;
}

/*
//spUtil.setValue('Description',"Test 1");
//return;
}*/
else if (c.data.description == null || c.data.description === "") {
spUtil.addErrorMessage($scope.data.mustSpecifyQuestionMsg);
return;
}
if (c.data.user.phone == null || c.data.user.phone === "") {
// alert(c.data.area + c.data.user.phone)
spUtil.addErrorMessage($scope.data.mustSpecifyNumber);
return;
}
c.data.action = "submit";

c.server.update().then(function() {
c.data.action = "";
$scope.status = $scope.data.postingMsg;
spUtil.addTrivialMessage($scope.data.ticketCreation);
})


}

}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}