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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested Answer

PartyId must be filled in - VendTableService (AIF)

(0) ShareShare
ReportReport
Posted on by 760

 I want to create vendor from C# application using AIF VendorService given by MS Dynamics AX 2012. R3 

When I run the app, on create() method, I get an exception and AX gives error. "PartyId must be filled in". 

I am using the following code:

The C# Code

VendTableServiceClient vendSvcClient = new VendTableServiceClient();

CallContext callContext = new CallContext();

AxdVendTable axdVendor = new AxdVendTable();
AxdEntity_VendTable[] vendorList = new AxdEntity_VendTable[1];
EntityKey[] entityKey;

AxdEntity_VendTable vendTable = new AxdEntity_VendTable();

vendTable.Name = "1234";
vendTable.VendGroup = "ABCD";
vendTable.Currency = "PKR";
vendTable.PaymTermId = "ADP";
vendTable.PaymMode = "CHQ";

AxdEntity_DirPartyTable_DirOrganization org = new AxdEntity_DirPartyTable_DirOrganization()
{
KnownAs = "vabu1",
NameAlias = "vabu1",
Name = "Vendor Abubaker",
OrganizationName = new AxdEntity_OrganizationName[1],
PartyNumber = dirPatyTable.PartyNumber,
//PrimaryAddressLocation = "0",
PhoneticName = "VAbubaker"
};


AxdEntity_OrganizationName orgName = new AxdEntity_OrganizationName()
{
Name = "Vendor Abubaker123"
};
org.OrganizationName[0] = orgName;


AxdEntity_DirPartyPostalAddressView[] postalAddView = new AxdEntity_DirPartyPostalAddressView[1];
postalAddView[0] = new AxdEntity_DirPartyPostalAddressView()
{
BuildingCompliment = "Builing",
City = "KARACHI",
CountryRegionId = "PK",
IsPrimary = (AxdExtType_LogisticsIsPrimaryAddress)AxdEnum_NoYes.Yes,
LocationName = "Primary",
Roles = "Business",
State = "ALL",
ZipCode = "",
Street = "RRR"
};

vendTable.DirPartyTable = new AxdEntity_DirPartyTable_DirPartyTable[1] { org };

vendorList[0] = vendTable;
axdVendor.VendTable = vendorList;

axdVendor.DocPurpose = AxdEnum_XMLDocPurpose.Original;
axdVendor.DocPurposeSpecified = true;

entityKey = vendSvcClient.create(callContext, axdVendor);

Questions

Is there anything I have missed? When I don't add dirpartytable, it creates vendor but with empty Address and all (ofcourse). What could be the reason of this error? 

I have the same question (0)
  • Suggested answer
    Gunjan Bhattachayya Profile Picture
    35,423 on at

    Hi.

    Could you  try this code and see if that works?

    AxdEntity_VendTable vendTable = new AxdEntity_VendTable();
    
    vendTable.Name = "1234";
    vendTable.VendGroup = "ABCD";
    vendTable.Currency = "PKR";
    vendTable.PaymTermId = "ADP";
    vendTable.PaymMode = "CHQ";
    
    AxdEntity_DirPartyTable_DirOrganization org = new AxdEntity_DirPartyTable_DirOrganization()
    {
    KnownAs = "vabu1",
    NameAlias = "vabu1",
    Name = "Vendor Abubaker",
    OrganizationName = new AxdEntity_OrganizationName[1],
    PartyNumber = dirPatyTable.PartyNumber,
    //PrimaryAddressLocation = "0",
    PhoneticName = "VAbubaker"
    };
    
    
    AxdEntity_OrganizationName orgName = new AxdEntity_OrganizationName()
    {
    Name = "Vendor Abubaker123"
    };
    org.OrganizationName[0] = orgName;
    
    
    AxdEntity_DirPartyPostalAddressView[] postalAddView = new AxdEntity_DirPartyPostalAddressView[1];
    postalAddView[0] = new AxdEntity_DirPartyPostalAddressView()
    {
    BuildingCompliment = "Builing",
    City = "KARACHI",
    CountryRegionId = "PK",
    IsPrimary = (AxdExtType_LogisticsIsPrimaryAddress)AxdEnum_NoYes.Yes,
    LocationName = "Primary",
    Roles = "Business",
    State = "ALL",
    ZipCode = "",
    Street = "RRR"
    };
    
    vendTable.DirPartyTable = new AxdEntity_DirPartyTable_DirPartyTable[1] { org };
    vendTable.DirParty[0].DirPartyPostalAddressView = new AxdEntity_DirPartyPostalAddressView[1] { postalAddView};
    
    vendTable.VendTable = new AxdEntity_VendTable[1] { vendTable };
    
    vendorList[0] = vendTable;
    axdVendor.VendTable = vendorList;
    
    axdVendor.DocPurpose = AxdEnum_XMLDocPurpose.Original;
    axdVendor.DocPurposeSpecified = true;
    
    entityKey = vendSvcClient.create(callContext, axdVendor);

  • Abubaker Siddiq Profile Picture
    760 on at

    Thank you for your response.

    vendTable.DirParty[0].DirPartyPostalAddressView = new AxdEntity_DirPartyPostalAddressView[1] { postalAddView};

    This line of code seems wrong because DirParty is not available in vendTable, so the assignment cannot be done. I checked it and there is nothing in VendTable as DirParty.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 611 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 529 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 285 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans