Note that there are some explanatory texts on larger screens.

plurals
  1. POBug in CRM? Service Appointment form's javascript causing form save error
    primarykey
    data
    text
    <p>Ive narrowed this down... it looks like a bug on the service appointment form but wanted to ask here in case it makes sense to anyone else... recreated in a vanilla CRM, added one javascript file, and attached the javascript function to the onchange of the service.</p> <p>To recreate yourself, add this javascript to a webresource, then attach that webresource to the serviceappointment form and the onchange of the service. add 2 services to your org if you dont have 2 already. create a new service appointment. choose service A. then choose Service B. save the form. you will see the error.</p> <p>All the javascript is supported, customizing that form is supported... must be a bug with CRM, right?</p> <p>Oh, critically, this code works in update rollup 11. Does not work in rollup 12. (I'm usually a strong believer that "<a href="http://www.codinghorror.com/blog/2008/03/the-first-rule-of-programming-its-always-your-fault.html" rel="nofollow noreferrer">select isn't broken</a>", as they say, but this really does look like a bug.)</p> <pre><code>function OnChange_Service() { var serviceId; serviceId = Xrm.Page.getAttribute("serviceid").getValue(); var targetFieldName = 'customers'; var targetFieldEntityType = 'Account'; var targetFieldEntityId = '610BEA47-7B74-E211-B3EB-78E3B511A6C0'; // use a known accountId Xrm.Page.getAttribute(targetFieldName).setValue(null); if (serviceId != null) { var arrValue; arrValue = new Array(); var targetField = Xrm.Page.getAttribute(targetFieldName); if (targetField != null) { arrValue[0] = new Object(); arrValue[0].entityType = targetFieldEntityType; arrValue[0].id = targetFieldEntityId; arrValue[0].name = "not its real name, but who cares"; targetField.setValue(arrValue); } } } </code></pre> <p>EDIT: exception/error details:</p> <p>Exception is (from the trace):</p> <blockquote> <p>System.FormatException: Microsoft Dynamics CRM has experienced an error. Reference number for administrators or support: #1471AD8A: System.FormatException: Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx). at System.Guid.GuidResult.SetFailure(ParseFailureKind failure, String failureMessageID, Object failureMessageFormatArgument, String failureArgumentName, Exception innerException) at System.Guid.TryParseGuidWithNoStyle(String guidString, GuidResult&amp; result) at System.Guid.TryParseGuid(String g, GuidStyles flags, GuidResult&amp; result) at System.Guid..ctor(String g) at Microsoft.Crm.Application.Platform.AttributeCollection.CreateEnityReferenceFromLookupPropertyValue(String name, Object value, IOrganizationContext context) at Microsoft.Crm.Application.Platform.AttributeCollection.SetEntityProperty(Entity entity, String name, String childAttributeName, Object parentProperty, AttributeMetadata attributeMetadata, Object value, IOrganizationContext context) at Microsoft.Crm.Application.Platform.AttributeCollection.Insert(String name, Object value, Boolean throwIfKeyExists) at Microsoft.Crm.Application.Platform.EntityProxy.SetLookupValueData(XmlNode node) at Microsoft.Crm.Application.Platform.EntityProxy.SetData(XmlNode entityElement) at Microsoft.Crm.Application.Platform.ApplicationEntityCollection.Deserialize(String entitiesXml, String entityType, IOrganizationContext context) at Microsoft.Crm.Application.Platform.EntityProxy.SetData(XmlNode entityElement) at Microsoft.Crm.Application.Forms.EndUserForm.RetrieveParametersForEventDefault() at Microsoft.Crm.Application.Forms.EndUserForm.Initialize(Entity entity) at Microsoft.Crm.Application.Forms.CustomizableForm.Execute(Entity entity, FormDescriptor fd) at Microsoft.Crm.Application.Components.PageHandlers.SchedulableActivityBasePageHandler.ConfigureFormHandler() at Microsoft.Crm.Application.Components.PageHandlers.ServiceAppointmentRecordPageHandler.ConfigureFormHandler() at Microsoft.Crm.Application.Components.PageHandlers.RecordPageHandler.ConfigureFormWrapper() at Microsoft.Crm.Application.Components.Utility.GenericEventProcessor.RaiseEvent(String eventName) at Microsoft.Crm.Application.Controls.PageManager.OnPreRender(EventArgs e) at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)</p> </blockquote> <p>The error as displayed to the users is embedded in the form itself as per the screenshot... I have never seen it like that before: <img src="https://i.stack.imgur.com/iHQuV.png" alt="Error embedded in form"></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload