3

I've got a custom entity in MS Dynamics CRM 4 (old, yes I know, we're planning on migrating to newer soon). I've got the "main application form" showing some of the custom attributes that are on the entity. When a new record is created for this entity there are some attributes that don't get saved (some lookups to related entities, and a decimal field attribute). These attributes are not read-only, there is no client-side scripting, and no workflows to prevent saving the attributes. The user I'm testing with has full "System Administrator" permission with access to all custom entities, so it shouldn't be a permission issue. I've turned on verbose trace logging for CRM, and it appears that the CRM engine is being told to save the attributes:

>InProcessCrmService starts processing request for user:CreateRequest
As user:xxxxxxxx-e990-dd11-870d-005056c00008
Request Xml:
<?xml version="1.0" encoding="utf-16"?>
<CreateRequest xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.microsoft.com/crm/2007/WebServices">
  <OptionalParameters>
    <OptionalParameter xsi:type="CreateDuplicatesOptionalParameter">
      <Value>false</Value>
    </OptionalParameter>
  </OptionalParameters>
  <Target xsi:type="TargetCreateDynamic">
    <Entity Name="new_job">
      <Properties xmlns="http://schemas.microsoft.com/crm/2006/WebServices">
        <Property xsi:type="OwnerProperty" Name="ownerid">
          <Value name="Joe Blow Admin" type="systemuser">xxxxxxxx-aa8f-e111-8548-005056c00008</Value>
        </Property>
        <Property xsi:type="LookupProperty" Name="new_accountid">
          <Value name="A Walk In Client" type="account">xxxxxxx-22cd-dd11-9db5-005056c00008</Value>
        </Property>
        <Property xsi:type="PicklistProperty" Name="new_childcompany">
          <Value name="Road Pavers Inc">4</Value>
        </Property>
        <Property xsi:type="CrmDateTimeProperty" Name="new_startdate">
          <Value>2016-06-12T00:00:00</Value>
        </Property>
        <Property xsi:type="CrmDateTimeProperty" Name="new_enddate">
          <Value>2016-06-15T00:00:00</Value>
        </Property>
        <Property xsi:type="CrmBooleanProperty" Name="new_productionjob">
          <Value>false</Value>
        </Property>
        <Property xsi:type="CrmBooleanProperty" Name="new_billed">
          <Value>false</Value>
        </Property>
        <Property xsi:type="LookupProperty" Name="new_revenuecityid">
          <Value name="Toronto" type="new_citylocation">xxxxxxxx-6eda-e511-aa42-0050569e01ef</Value>
        </Property>
        <Property xsi:type="LookupProperty" Name="new_industrycodeid">
          <Value name="Other" type="new_industrycode">xxxxxxxx-6eda-e511-aa42-0050569e01ef</Value>
        </Property>
        <Property xsi:type="LookupProperty" Name="new_jobconfidencelevelid">
          <Value name="Low" type="new_jobconfidence">xxxxxxxx-1124-e611-aa44-0050569e01ef</Value>
        </Property>
        <Property xsi:type="CrmDecimalProperty" Name="new_estimatedhoursperday">
          <Value>5.3</Value>
        </Property>
        <Property xsi:type="StringProperty" Name="new_description">
          <Value>Testing job creation</Value>
        </Property>
        <Property xsi:type="PicklistProperty" Name="new_avgweight">
          <Value name="Heavy">1</Value>
        </Property>
        <Property xsi:type="LookupProperty" Name="transactioncurrencyid">
          <Value name="Canadian Dollar" type="transactioncurrency">a0599012-25f2-dc11-9dc3-00c09f3657d9</Value>
        </Property>
        <Property xsi:type="StateProperty" Name="statecode">
          <Value>Active</Value>
        </Property>
      </Properties>
    </Entity>
  </Target>
</CreateRequest>

I've also used SQL server profiling to see what actually gets sent to SQL:

exec sp_executesql
N'insert into New_JobBase(
    ExchangeRate,
    OwningBusinessUnit, 
    New_JobId, 
    CreatedOn, 
    StateCode, 
    StatusCode, 
    OwningUser, 
    ModifiedBy, 
    CreatedBy, 
    DeletionStateCode, 
    ModifiedOn, 
    TransactionCurrencyId)
values (
    @ExchangeRate0, 
    @OwningBusinessUnit0, 
    @New_JobId0, 
    @CreatedOn0, 
    @StateCode0, 
    @StatusCode0, 
    @OwningUser0, 
    @ModifiedBy0, 
    @CreatedBy0, 
    @DeletionStateCode0, 
    @ModifiedOn0, 
    @TransactionCurrencyId0);
insert into New_JobExtensionBase(
    new_accountid, 
    New_EndDate, 
    New_JobId, 
    New_Description, 
    New_ChildCompany, 
    New_Billed, 
    New_StartDate, 
    New_avgweight, 
    New_ProductionJob) 
values (
    @new_accountid0, 
    @New_EndDate0, 
    @New_JobId1, 
    @New_Description0, 
    @New_ChildCompany0, 
    @New_Billed0, 
    @New_StartDate0, 
    @New_avgweight0, 
    @New_ProductionJob0)',
N'@ExchangeRate0 decimal(11,10),
    @OwningBusinessUnit0 uniqueidentifier,
    @New_JobId0 uniqueidentifier,
    @CreatedOn0 datetime,
    @StateCode0 int,
    @StatusCode0 int,
    @OwningUser0 uniqueidentifier,
    @ModifiedBy0 uniqueidentifier,
    @CreatedBy0 uniqueidentifier,
    @DeletionStateCode0 int,
    @ModifiedOn0 datetime,
    @TransactionCurrencyId0 uniqueidentifier,
    @new_accountid0 uniqueidentifier,
    @New_EndDate0 datetime,
    @New_JobId1 uniqueidentifier,
    @New_Description0 ntext,
    @New_ChildCompany0 int,
    @New_Billed0 bit,
    @New_StartDate0 datetime,
    @New_avgweight0 int,
    @New_ProductionJob0 bit
',
    @ExchangeRate0=1.0000000000,
    @OwningBusinessUnit0='xxxxxxxx-E990-DD11-870D-005056C00008',
    @New_JobId0='xxxxxxxx-0838-E611-AA44-0050569E01EF',
    @CreatedOn0='Jun 21 2016 11:35:22:000PM',
    @StateCode0=0,
    @StatusCode0=1,
    @OwningUser0='xxxxxxxx-AA8F-E111-8548-005056C00008',
    @ModifiedBy0='xxxxxxxx-AA8F-E111-8548-005056C00008',
    @CreatedBy0='xxxxxxxx-AA8F-E111-8548-005056C00008',
    @DeletionStateCode0=0,
    @ModifiedOn0='Jun 21 2016 11:35:22:000PM',
    @TransactionCurrencyId0='A0599012-25F2-DC11-9DC3-00C09F3657D9',
    @new_accountid0='xxxxxxxx-22CD-DD11-9DB5-005056C00008',
    @New_EndDate0='Jun 15 2016  6:00:00:000AM',
    @New_JobId1='xxxxxxxx-0838-E611-AA44-0050569E01EF',
    @New_Description0=N'Testing job creation',
    @New_ChildCompany0=4,
    @New_Billed0=0,
    @New_StartDate0='Jun 12 2016  6:00:00:000AM',
    @New_avgweight0=1,
    @New_ProductionJob0=0

As you can see above, some attributes, like new_avgweight, new_description, or a lookup like the new_accountid are being created properly. Other attributes, like new_industrycode or new_estimatedhoursperday are not being passed along to SQL.

Once the record has been created, it is possible to open it up, enter the data and it will save correctly. It is only failing to save when it is a new record first being created.

Why does it seem like CRM is saving some atttributes, but not other attributes? I've tried deleting an attribute and adding it back to the entity to see if that would force CRM to re-generate it, but to no avail.

Adam Dunn
  • 1,079
  • 2
  • 14
  • 27
  • Did you ever resolved this? – pabben Nov 30 '16 at 19:33
  • Haven't resolved it yet. Users are simply trained to save first, then enter the attributes later. In most cases this fits naturally, as not all attributes are known when the entity is created, and get entered later in contract negotiations. So not a high priority for me. Sorry. – Adam Dunn Dec 07 '16 at 23:34
  • I had a very similar issue, the problem was in the postCreate, something else was failing. – pabben Dec 14 '16 at 20:21

0 Answers0