function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
MaxxumMaxxum 

AJAX Toolkit - strange behavior

Hi all,

I have been playing around with the AJX toolkit for few days now and have been very pleased with it. I think it is a great toolkit.

Today I am facing a strange problem in the code that was working fine thus far.
I have a non-mandatory date field in my custom object. In my code I an querying data from this custom object and the date field is retrieved as part of the query. Today all of a sudden I am getting an exception:
"Invalid Type: You passed a null but the field requires a date".

Now when I remove this field from the query, everything works fine.
Also note that the query (with the date field) was working fine so far.

Is anything changing?

Regards,
-Rajan
DevAngelDevAngel

Hi Maxxum,

A little aggressive on the type enforcement.  I'll fix this in time to get in the next update.  I'll also post the fix here.

MaxxumMaxxum
Thanks DevAngel. Will be waiting for the fix.
-RD
DevAngelDevAngel

Ok, here is the fix.  You will need to host the entire set of JS files yourself.

This function needs to be replaced in the domfunc.js file:

_parseVal = function(value, name, desc) {
	var fldDef = desc.fieldMap[name.toLowerCase()];
	if (value == null || value.length == 0) {
		if (fldDef.type == "date" || fldDef.type == "datetime") {
			return null;
		} else {
			return value;
		}
	}
	var fldType = fldDef.type;
	if (fldType == "string" || fldType == "picklist" || 
		fldType == "multipicklist" || fldType == "combobox" || 
		fldType == "reference" || fldType == "textarea" || 
		fldType == "phone" || fldType == "id" || fldType == "url" || fldType == "email") {
		return value;
	} else if (fldType == "boolean") {
		if (value.toLowerCase() == "false") {
			return false;
		} else {
			return true;
		}
	} else if (fldType == "currency" || fldType == "double" || fldType == "percent") {
		return parseFloat(value);
	} else if (fldType == "date" || fldType == "datetime") {
		return fromIsoDateTime(value);
	} else {
		return value;
	}
};

 

DevAngelDevAngel
A fix has just been release.  Can you re-test your code Maxxum?