CRM中的错误?服务预约表单的javascript导致表单保存错误

时间:2013-02-11 19:28:56

标签: dynamics-crm-2011

我把它缩小了......它看起来像服务预约表上的一个错误,但是想在这里询问以防其他人有意义...在一个vanilla CRM中重新创建,添加了一个javascript文件,并附上了javascript函数到服务的onchange。

要重新创建自己,请将此javascript添加到webresource,然后将该webresource附加到serviceappointment表单和服务的onchange。如果您还没有2个服务,请为您的组织添加2项服务。创建一个新的服务约会。选择服务A.然后选择服务B.保存表格。你会看到错误。

支持所有javascript,支持自定义该表单...必须是CRM的错误,对吗?

哦,关键的是,此代码适用于更新汇总11.在汇总12中不起作用。 (正如他们所说,我通常坚信“select isn't broken”,但这确实看起来像一个错误。)

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);
    }
} 
}

编辑:异常/错误详情:

例外(来自追踪):

  

System.FormatException:Microsoft Dynamics CRM遇到错误。管理员或支持的参考号:#1471AD8A:System.FormatException:Guid应包含32个数字,包含4个破折号(xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)。     在System.Guid.GuidResult.SetFailure(ParseFailureKind失败,String failureMessageID,Object failureMessageFormatArgument,String failureArgumentName,Exception innerException)     在System.Guid.TryParseGuidWithNoStyle(String guidString,GuidResult& result)     在System.Guid.TryParseGuid(String g,GuidStyles标志,GuidResult&结果)     在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(实体实体,字符串名称,字符串childAttributeName,Object parentProperty,AttributeMetadata attributeMetadata,Object value,IOrganizationContext context)     在Microsoft.Crm.Application.Platform.AttributeCollection.Insert(String name,Object value,Boolean throwIfKeyExists)     在Microsoft.Crm.Application.Platform.EntityProxy.SetLookupValueData(XmlNode节点)     在Microsoft.Crm.Application.Platform.EntityProxy.SetData(XmlNode entityElement)     在Microsoft.Crm.Application.Platform.ApplicationEntityCollection.Deserialize(String entitiesXml,String entityType,IOrganizationContext context)     在Microsoft.Crm.Application.Platform.EntityProxy.SetData(XmlNode entityElement)     在Microsoft.Crm.Application.Forms.EndUserForm.RetrieveParametersForEventDefault()     在Microsoft.Crm.Application.Forms.EndUserForm.Initialize(实体实体)     在Microsoft.Crm.Application.Forms.CustomizableForm.Execute(实体实体,FormDescriptor fd)     在Microsoft.Crm.Application.Components.PageHandlers.SchedulableActivityBasePageHandler.ConfigureFormHandler()     在Microsoft.Crm.Application.Components.PageHandlers.ServiceAppointmentRecordPageHandler.ConfigureFormHandler()     在Microsoft.Crm.Application.Components.PageHandlers.RecordPageHandler.ConfigureFormWrapper()     在Microsoft.Crm.Application.Components.Utility.GenericEventProcessor.RaiseEvent(String eventName)     在Microsoft.Crm.Application.Controls.PageManager.OnPreRender(EventArgs e)     在System.Web.UI.Control.PreRenderRecursiveInternal()     在System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint,Boolean includeStagesAfterAsyncPoint)

显示给用户的错误根据屏幕截图嵌入到表单中......我之前从未见过这样的错误: Error embedded in form

2 个答案:

答案 0 :(得分:1)

这是一个公认的错误。没有正式的决议时间表。微软正在优先考虑它。他们用UR12破坏了UR11中的现有功能。

答案 1 :(得分:0)

尝试在{}中包装guid。

例如:var targetFieldEntityId = '{610BEA47-7B74-E211-B3EB-78E3B511A6C0}';

这是一个猜测,我基于它,如果你检索一个查找的id,guid被{}包裹。

Xrm.Page.getAttribute("new_person").getValue()[0] 
{
    id : "{EB661CDD-8E59-E211-8BC6-4C3A83DBD74D}",
    type : "2",
    name : "James Wood",
    onclick : "openlui(new Sys.UI.DomEvent(event))",
    displayClass : "ms-crm-Lookup-Item",
    data : null,
    typename : "contact",
    category : 0,
    ambiguousRecordsXml : null,
    selected : null
    ...
} 
相关问题