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? 

  • Abubaker Siddiq Profile Picture
    760 on at
    RE: PartyId must be filled in - VendTableService (AIF)

    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.

  • Suggested answer
    Gunjan Bhattachayya Profile Picture
    35,421 on at
    RE: PartyId must be filled in - VendTableService (AIF)

    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);

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,886 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,768 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Product updates

Dynamics 365 release plans