Export (0) Print
Expand All
Expand Minimize

Fixed Asset Document

Dynamics AX 2009

This topic describes the fixed asset service and document and the associated business logic in Microsoft Dynamics AX. The business rules and logic of the inbound and outbound fixed asset documents must be considered when customizing the document or integrating fixed assets from Application Integration Framework (AIF) with third-party applications.

Enables external systems to create, retrieve, and update fixed assets. The fixed asset document facilitates integration between Microsoft Dynamics AX and a third-party application, such as a warehouse-management system. The fixed asset service delivers a list of assets from Microsoft Dynamics AX, and also enables you to create new fixed asset records or update existing fixed assets using AIF. When an XML fixed asset document is received in AIF, the AxdFixedAsset class validates the deserialized XML asset data with the required Microsoft Dynamics AX business logic and creates a new fixed asset or updates an existing fixed asset, based on the document data.

Example

An employee with a hand-held device is in a warehouse and scans a bar code to find the fixed asset in Microsoft Dynamics AX. When the employee finds an asset in the warehouse that is not in Microsoft Dynamics AX, the employee creates a new fixed asset with the hand-held device. To create the new fixed asset, the employee searches all available fixed asset groups and then selects an asset group, which provides many default field values for creating a new fixed asset. After the employee saves the new fixed asset on the hand-held device, an accountant will receive an e-mail message about the new fixed asset, log on to Microsoft Dynamics AX, open the new fixed asset, update field values, and perform other tasks that might be necessary, such as entering an acquisition transaction for the new fixed asset.

In other cases, the employee in the warehouse searches for a fixed asset by bar code, and then reviews that the field values for the asset are correct. Changes can then be made and submitted as an update. An accountant can then log on to Microsoft Dynamics AX and open the fixed asset to see the updated field values.

The fixed asset document is both inbound and outbound.

  • Inbound (received by Microsoft Dynamics AX)

  • Outbound (sent by Microsoft Dynamics AX)

The following service operations are exposed by the document service:

  • create

  • find

  • findKeys

  • read

  • update

The read action accepts an AssetId, while the findKeys and find actions accept a query. The create and update actions are described in the Required Fields section that follows.

The following objects are associated with the fixed asset service.

Object

Description

Service class

AssetFixedAssetService Class

External service name

FixedAssetService

Axd <Document> class

AxdFixedAsset Class

Ax <Table> classes

AxAssetTable Class

Query

AxdFixedAsset

Outbound

An outbound fixed asset document is dispatched from Microsoft Dynamics AX to AIF, and then to your application.

Inbound

When creating fixed assets, an inbound fixed asset document is received, validated, and inserted in the AssetTable table. When the fixed asset is created, you can optionally use a number sequence to assign an AssetId. If invalid data or a duplicate record is received, an error message is returned to the user and an exception is written to the AIF exception log.

When updating fixed assets, an inbound fixed asset document is received, validated, and overwrites data in the AssetTable table. When the fixed asset is updated, you can update any existing field that could be updated in Microsoft Dynamics AX. If invalid data is received, an error message is returned and an exception is written to the AIF exception log.

Restrictions

None

The following forms and tables are the source or destination for this document depending on whether the document is transferred in an inbound or outbound exchange.

NoteNote

All of the document fields are from the AssetTable table and form—no other table or form is used.


Document field

Form

Table

AssetId

AssetTable

AssetTable

AssetGroup

AssetTable

AssetTable

Table Relationships

The outbound fixed asset document is created by the AxdFixedAsset document class by using the AxAssetTable class. The inbound fixed asset document is written by the AxdFixedAsset class to the AssetTable table by using the AxAssetTable class.

The following Ax<Table> and Axd<Document> classes are used to view, create, or update the fixed asset.

Note Field Handling

N/A

Required Fields

The following fields must contain values for the inbound fixed asset document to create fixed assets with AIF:

  • AssetGroup

  • AssetId – Mandatory only if number sequences are not used to assign it.

Excluded Fields

N/A

Field Defaults

When you create a new fixed asset, you can intentionally use a null value in the following inbound document fields to insert a default value:

  • AssetId – If a number sequence will set the ID, enter a null value. Use the Fixed asset groups form or the General ledger parameters form to set up automatic number sequences.

  • Barcode – If a number sequence will set the bar code, or if the same value as the AssetId will be used for the bar code, enter a null value. Use the Fixed asset groups form or the General ledger parameters form to set up automatic number sequences.

  • AssetMajorType – If the AssetGroup table should supply the major type, enter a null value.

  • Location – If the AssetGroup table should supply the asset location, enter a null value.

  • Condition – If the AssetGroup table should supply the asset condition, enter a null value.

Also, when you create a new fixed asset, if you define field properties to contain no value, the following fields can use a default value:

  • NameAlias – If the Name field value that you pass in should supply the default value (with spaces removed), enter no value.

  • AssetType – If the AssetGroup table should supply the asset type, enter no value.

  • AssetPropertyType – If the AssetGroup table should supply the property type, enter no value.

When you update a fixed asset, you can update any field that you can normally update in Microsoft Dynamics AX. You cannot update the following fields:

  • AssetId – The asset number.

  • AssetGroup – The fixed asset group that the fixed asset belongs to.

  • Barcode – If the AssetId is used to set the bar code, you cannot update this field.

When you update, the values that you submit overwrite existing field values. Also, if you do not include a field for submittal, the omitted field will have its field value set to the default field value, which is often blank. If you omit a field in your document, be sure that you intend to overwrite any existing value and reset it to the default value

Constraints

AxdFixedAsset implements a Vendor constraint.

Entity Key

The security key is found on the Permissions form under General ledger > Services > AssetFixedAssetService. The key name is AssetFixedAssetService.

The LedgerTables security key must be set to 'View' to receive the fixed asset document. To create a document, set the security key to 'Create.' To update a document, set the security key to 'Edit.'

The Asset configuration key must be enabled to electronically receive the fixed asset document.

Record level security (RLS) is enabled for the Fixed Asset document by default.

The AxdFixedAsset class contains no deviations from the business logic in Microsoft Dynamics AX.

  • To return all records in the AssetTable table, pass the following query to the find or findKeys action: RecId != 0

  • When using multiple fields in a query for the find and findKeys actions, such as with the find action, statements with the same field are grouped using an OR, and then linked using an AND. Records that satisfy the statement are then returned, such as in the following.

    AssetId.value = 1; Name.Value = "one"; AssetId.value = 2; AssetId.value = 3; Name.Value = "two";
    

    The preceding fields will translate to the following.

    [AssetId.value = 1 OR AssetId.value = 2 OR AssetId.value = 3] AND [Name.Value = "one" OR Name.Value = "two"]
    

Example of Fixed Asset Service Operations

using System;
using System.Collections.Generic;
using System.Text;

namespace AssetFixedAssetTest
{
    class Test
    {
        static void Main()
        {
            AssetFixedAssetServiceClient client = new AssetFixedAssetServiceClient();
            QueryCriteria queryCriteria = new QueryCriteria();
            AxdFixedAsset axdFA = new AxdFixedAsset();
            EntityKey[] entityKeyList = new EntityKey[1];

            //Set up query criteria for find.
            queryCriteria.CriteriaElement = new CriteriaElement[1];
            queryCriteria.CriteriaElement[0] = new CriteriaElement();
            queryCriteria.CriteriaElement[0].DataSourceName = "AssetTable";
            queryCriteria.CriteriaElement[0].FieldName = "AssetId";
            queryCriteria.CriteriaElement[0].Operator = Operator.Equal;
            queryCriteria.CriteriaElement[0].Value1 = "CNC-01";

            // Use the 'client' variable to call operations on the service.            
            axdFA = client.find(queryCriteria);
            
            axdFA.AssetTable[0].Name = "Copy of CNC-01";
            axdFA.AssetTable[0].AssetId = null;

            //Create a new asset.
            client.create(axdFA);
            
            //Set up entity key.
            entityKeyList[0] = new EntityKey();
            entityKeyList[0].KeyData = new KeyField[1];
            entityKeyList[0].KeyData[0] = new KeyField();
            entityKeyList[0].KeyData[0].Field = "AssetId";
            entityKeyList[0].KeyData[0].Value = "CNC-01";            

            //Update the Name field.            
            axdFA = client.find(queryCriteria);
            axdFA.AssetTable[0].Name = "Updated Name";
            client.update(entityKeyList, axdFA);                       

            // Always close the client.       
            client.Close();
            
        }
    }
}

Community Additions

ADD
Show:
© 2014 Microsoft