web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

ASSET Service - AIF - I need to Return Asset Department

(0) ShareShare
ReportReport
Posted on by 1,880

Dears,

I am using AX 2012 AIF to return Asset details , i can return all details except Department .

Can any one tell me how to return Department  .

if you checked AxdFixedAsset Query , you can find there is relation between AssetTable and OMOperatingUnitView

 

4380.Ass.jpg

 

This My code in C# to get Asset details

public HttpResponseMessage get()

{

try
{
AssetFixedAssetServiceClient _client = new AssetReference.AssetFixedAssetServiceClient();
AssetReference.CallContext _callContext = new AssetReference.CallContext();
_callContext.Company = "XX";
AssetReference.QueryCriteria qc = new AssetReference.QueryCriteria();
qc.CriteriaElement = new AssetReference.CriteriaElement[1];
qc.CriteriaElement[0] = new AssetReference.CriteriaElement();
qc.CriteriaElement[0].DataSourceName = "AssetTable";
qc.CriteriaElement[0].FieldName = "AssetID";
qc.CriteriaElement[0].Operator = AssetReference.Operator.Equal;
qc.CriteriaElement[0].Value1 = "XXXX";
AxdFixedAsset _asset = _client.find(_callContext, qc);
IEnumerator enumerator;
enumerator = _asset.AssetTable.GetEnumerator();
int result = 0;

//Class conatain Asset ID & Name
Models.AssetList FAS = new Models.AssetList();
List<Models.AssetList> list = new List<Models.AssetList>();
while (enumerator.MoveNext())
{
result++;

AxdEntity_AssetTable _asetEnt = (AxdEntity_AssetTable)enumerator.Current;
FAS = new Models.AssetList();
FAS.AsId1 = _asetEnt.AssetId;

//I need to Return Department
FAS.ASName1 = "I need to Return Department "


list.Add(FAS);
}
return Request.CreateResponse(HttpStatusCode.Created, list);

}
catch (Exception ex)
{
return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex.Message);
}

}

*This post is locked for comments

I have the same question (0)
  • Ajit Profile Picture
    8,788 on at

    I think you are giving the data source name (AssetTable) of the query as a criteria in your code. Do you need to do the same thing for data source OMDepartment?

  • Mostafa Abu Taleb Profile Picture
    1,880 on at

    Dear Ajit,

    Thanks for reply , but i don't think that. because there is relational between Assettable and  OMDepartment as you can see in AxdFixedAsset

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
CP04-islander Profile Picture

CP04-islander 39

#2
Michel ROY Profile Picture

Michel ROY 14

#3
imran ul haq Profile Picture

imran ul haq 8

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans