FK_ModelElementData_HasModelId_LayerId error

After applying the feature pack to an AX 2012 environment, during the full AOT compilation, I got the error as below:

Object Server 01:  The database reported (session 3 (Admin)): [Microsoft][SQL Server Native Client 10.0][SQL Server]The UPDATE statement conflicted with the
FOREIGN KEY constraint “FK_ModelElementData_HasModelId_LayerId”. The conflict occurred in database
“MicrosoftDynamicsAX”, table “dbo.Model”.. The SQL statement was: “{ CALL [dbo].[XU_Update](?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) }”

Actually the error is due to the fact that the syp layer of class HcmWorkerImport_DirPartyContactInfoView can’t be saved.

Microsoft released a hotfix to fix this issue, however, you need to redo the upgrade with a restored backup and than install the kernel hotfix and slipstream the hotfix in your AX 2012 Feature Pack installation files. Apparently this is not working for a production environment installation: sometimes we can’t afford to change the Modelstore in production environment.

http://blogs.msdn.com/b/axsupport/archive/2012/07/19/error-when-upgrading-to-ax-2012-feature-pack-the-update-statement-conflicted-with-the-foreign-key-constraint-quot-fk-modelelementdata-hasmodelid-layerid-quot.aspx

After doing some investigation, I manage to manually fix these issues:

1. Use SQL Server Profiler to profile the compiling statement issued by AOS

image

2. Based on the query we got from step 1, find out which AOT element is causing the problem

image

3. Look up the correct element ID and handles in Meta database.

image

image

Now you can see the different Parent AXId of method “ExistLocationName”: ‘1023865’ and ‘1025020’

4. From AOT to open the system view “SysModelElement”.

image

5. The solution to this is to change the wrong parentID from ‘1025020’ to ‘1023865’ :

Run the following query on SQL Server to update the Table MODELELEMENT:

image

Posted in 未分类 | Leave a comment

Hello world!

Welcome to WordPress.com. This is your first post. Edit or delete it and start blogging!

Posted in 未分类 | Leave a comment

Use ScriptManager to close the EP page window

Using RegisterStartupScript we can write a JavaScript function in code behind and call it from code-behind. For example,  to close a page window, we can use the following code in .cs file:

protected void Button1_Click(object sender, EventArgs e)
{

    …

     string closeWindowScript= "window.close()";
     ScriptManager.RegisterStartupScript(this, typeof(string), "CLOSE_WINDOW", closeWindowScript, true);

}

Hope it helps.

Posted in 未分类 | Leave a comment

Use CSS style to customize Enterprise Portal 2009 page

Sometimes we are asked to customize the layout of a page. The changes are often small and don’t necessarily require a change to the site master page or css file. For example, the client requests to hide the ‘Site Action’ menu on a Dynamics AX 2009 EP page to disable the user to change the page layout.

Now I use the purchase requisition lists as an example:

image

On the page, right click and select View Source

image

In the source file, the CSS class used in Site Action menu is .ms-siteaction

image

Open Visual Studio 2008 and edit the user control PurchReqTableList. In the PurchReqTableList.ascx file, add the following code

<style type="text/css">
    .ms-siteaction { display:none ;}
</style>

image

Save the change and update the portal.

Now you can see the ‘Site Action’ menu is gone.

image

Similarly, if we want to hide the breadcrumbs, we can use the same way as well.

image

Put the following code in the .ascx file:

<style type="text/css">
    .ms-siteaction { display:none ;}  .ms-sitemapdirectional { display: none; } .ms-titlearea { display: none; }
</style>

Save the changes and update the portal, you will find both the breadcrumbs and site action menu are gone.

image

Posted in 未分类 | 1 Comment

Debugging AX2009 Enterprise Portal and Batch jobs running on Windows 2008

The hotfix KB962952 has been released. You can contact technical support for Microsoft Dynamics and create a new support request to get the hotfix.

Posted in 未分类 | Leave a comment

CDO.Message error

When we use the Dynamics AX to send email, sometimes we will run into an CDO.Message issue with error message Method ‘send’ in COM object of class ‘CDO.Message’ returned error code 0x80040211 (<unknown>) which means: <unknown>.

The error codes listed below are really useful when troubleshooting the issue:

Value Remarks
0x80040201 Exception %1 was generated at address %2.
0x80040202

No data source has been opened for the object.

0x80040203

The object does not support this type of data source.

0x80040204

The object does not support the requested property name or namespace.

0x80040205

The object does not support the requested property.

0x80040206

The object is not active. It may have been deleted or it may not have been opened.

0x80040207

The object does not support storing persistent state information for objects.

0x80040208

The requested property or feature, while supported, is not available at this time or in this context.

0x80040209

No default drop directory has been configured for this server.

0x8004020A

The SMTP server name is required, and was not found in the configuration source.

0x8004020B

The NNTP server name is required, and was not found in the configuration source.

0x8004020C

At least one recipient is required, but none were found.

0x8004020D

At least one of the From or Sender fields is required, and neither was found.

0x8004020E

The server rejected the sender address. The server response was: %1

0x8004020F

The server rejected one or more recipient addresses. The server response was: %1

0x80040210

The message could not be posted to the NNTP server. The transport error code was %2. The server response was %1

0x80040211

The message could not be sent to the SMTP server. The transport error code was %2. The server response was %1

0x80040212

The transport lost its connection to the server.

0x80040213

The transport failed to connect to the server.

0x80040214

The Subject, From, and Newsgroup fields are all required, and one or more was not found.

0x80040215

The server rejected the logon attempt due to authentication failure. The server response was: %1

0x80040216

The content type was not valid in this context. For example, the root of an MHTML message must be an HTML document.

0x80040217

The transport was unable to log on to the server.

0x80040218

The requested resource could not be found. The server response was: %1.

0x80040219

Access to the requested resource is denied. The server response was: %1.

0x8004021A

The HTTP request failed.  The server response was: %1.

0x8004021B

This is a multipart body part. It has no content other than the body parts contained within it.

0x8004021C

Multipart body parts must be encoded as 7bit, 8bit, or binary.

0x8004021E

The requested property was not found.

0x80040220

The "SendUsing" configuration value is invalid.

0x80040221

The "PostUsing" configuration value is invalid.

0x80040222

The pickup directory path is required and was not specified.

0x80040223

One or more messages could not be deleted.

0x80040227

The property is read-only.

0x80040228

The property cannot be deleted.

0x80040229

Data  written to the object are inconsistent or invalid.

x8004022A

The requested property is not in the mail header namespace.

0x8004022B

The requested character set is not installed on the computer.

0x8004022C

The ADO stream has not been opened.

0x8004022D

The content properties are missing.

0x8004022E

Content properties XML must be encoded using UTF-8.

0x8004022F

Failed to parse content properties XML.

0x80040230

Failed to convert a property from XML to a requested type.

0x80040231

No directories were specified for resolution.

0x80040232

Failed to resolve against one or more of the specified directories.

0x80040233

Could not find the Sender’s mailbox.

0x80040234

Binding to self is not allowed.

0x80044000

The first argument is invalid.

0x80044001

The second argument is invalid.

0x80044002

The third argument is invalid.

0x80044003

The fourth argument is invalid.

0x80044004

The fifth argument is invalid.

0x800CCE05

The requested body part was not found in this message.

0x800CCE1D

The content encoding type is invalid.

Posted in 未分类 | 5 Comments

Send workflow notification as email

In AX2009, we can email the workflow notifications. The following steps will show you how to set this up:

1. Create an email template for workflow.

Go to Basic –> Setup –> Email Templates. Create a new email template for workflow notification.

image

2. Set workflow to use the template that is created from step 1.

Go to Basic –> Setup –> Settings for workflow. Select the email template on the General tab.

image

3. Enable “Send notifications as e-mail message” for the user.

Tools –> Options.

image

Posted in 未分类 | 1 Comment