You're almost there! Please answer a few more questions for access to the Applications content. Complete registration
Interested in joining? Complete your registration by providing Areas of Interest here. Register

Getting the value of a custom field from a workspace using javascript api

Received Response
15
Views
1
Comments
edited Sep 21, 2016 6:06PM in UI Extensibility 1 comment

Content

Hi All,

I have a browser control on a workspace with a script that runs onLoad. The purpose of this script is to perform some validation on a custom date field (prevent an agent from entering a future date). The issue I'm facing is that I can not get the value of my custom field (which is a custom field on incident). The variable is always showing as undefined. I have included some relevant code snippets below. For now I'm just comparing the current month to the custom field month.

Version

FEB 2016

Code Snippet

             function CheckDate(){
//get the current date
var curDate = new Date();
var curDay = curDate.getDate();
var curMonth = curDate.getMonth()+1;
var curYear = curDate.getFullYear();

//get the custom incident custom field
var recDate = window.external.Incident.GetCustomFieldByName("c$receipt_date");

//if the date custom field is not null
if(recDate){
        //get the day, month and year of the custom field
	var recDay = recDate.getDate();
        var recMonth = recDate.getMonth()+1;
	var recYear = recDate.getFullYear();
						
        //if the recmonth is greater than current month
	if (recMonth > curMonth){
	  

Howdy, Stranger!

Log In

To view full details, sign in.

Register

Don't have an account? Click here to get started!