Creating record with guid string as name

Jun 2, 2013 at 11:25 AM
Hi,

While using the create method, I have encountered the following error when assigning a guid (e.g 98514d7c-af3b-414e-b038-62644c24b618) to the record name attribute.

Please advise.

The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter http://schemas.microsoft.com/xrm/2011/Contracts/Services:request. The InnerException message was 'There was an error deserializing the object of type Microsoft.Xrm.Sdk.OrganizationRequest. The value '98514d7c-af3b-414e-b038-62644c24b618.pdf' cannot be parsed as the type 'Guid'.'. Please see InnerException for more details.
Feb 19, 2014 at 12:46 PM
I worked around the problem by changing the isGuid function which recognized any string containing GUID value and assigned GUID type to it.

The change I made is limiting the regular expression to string which represents an exact GUID value.
            _string.isGuid = function isGuid(value)
            {
                return /^[a-z0-9]{8}(?:-[a-z0-9]{4}){3}-[a-z0-9]{12}$/i.test(value);
            };