Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics GP (Archived)

Create Item on GP

(0) ShareShare
ReportReport
Posted on by

Hello Experts ,

I am Writing a plugin to integrate between CRM and GP.The plugin fires when creating a product on CRM>> It should create a new product on GP with the same CRM (Part Number, Description ,Price List , ModelNumber ,... and other criteria given by CRM form).

I write down the plugin and it fires when create a new CRM product and create new GP Product 

But I have 2 issue with the New GP Created Item 

1- The Chart of accounts with associated with this product is Empty as it shown below 

GPProduct.PNG

2- Although I am adding a Price list to the product but it does not appear that added correctly 

eConnectType eConnect = new eConnectType();
taUpdateCreateItemRcd New_GPProduct = new taUpdateCreateItemRcd();

// Create an XML serializer object
XmlSerializer serializer = new XmlSerializer(eConnect.GetType());

// Populate elements of the taUpdateCreateItemRcd XML node object
New_GPProduct.ITEMNMBR = ProductNumber;
New_GPProduct.ITEMDESC = ItemDescription;
New_GPProduct.ITMTRKOP = (Serial_NonSerial == "Serial") ? Convert.ToInt16(2) : Convert.ToInt16(1);
New_GPProduct.TAXOPTNS = (Serial_NonSerial == "Taxable") ? Convert.ToInt16(1) : Convert.ToInt16(2);
New_GPProduct.USCATVLS_3 = ModelNumber;
New_GPProduct.Purchase_Item_Tax_Schedu = "VAT.P 14%";
New_GPProduct.ITMTSHID = "VAT.S 14%";
New_GPProduct.UOMSCHDL = "EACH";
New_GPProduct.ITMCLSCD = GP_ClassName;
New_GPProduct.USCATVLS_1 = GP_BC;
New_GPProduct.USCATVLS_2 = GP_PT;
New_GPProduct.CURRCOSTSpecified = true;
New_GPProduct.ALWBKORD = 1;
New_GPProduct.LOCNCODE = "MAIN";
New_GPProduct.UpdateIfExists = 1;

taIVCreateItemPriceListHeader ItemPrice1 = new taIVCreateItemPriceListHeader();
ItemPrice1.CURNCYID = "Z-US$";
ItemPrice1.ITEMNMBR = ProductNumber;
ItemPrice1.PRCLEVEL = "STANDARD";
ItemPrice1.UOFM = "EACH";

IVItemMasterType ivMasterType = new IVItemMasterType();
ivMasterType.taUpdateCreateItemRcd = New_GPProduct;

IVItemMasterType[] ivMasterTypeArray = { ivMasterType };
eConnect.IVItemMasterType = ivMasterTypeArray;

// Serialize the master vendor type in memory.
MemoryStream memoryStream = new MemoryStream();
XmlSerializer xmlSerializer = new XmlSerializer(eConnect.GetType());

//Serialize the eConnectType.
xmlSerializer.Serialize(memoryStream, eConnect);

//Reset the position of the memory stream to the start.
memoryStream.Position = 0;

// Create an XmlDocument from the serialized eConnectType in memory.
XmlDocument xmlDocument = new XmlDocument();
xmlDocument.Load(memoryStream);
memoryStream.Close();

// Call eConnect to process the XmlDocument.
eConnectMethods eConnectMethod = new eConnectMethods();

eConnectMethod.CreateEntity("String for my connectionSring", xmlDocument.OuterXml);

///////////////// Generated XML File ///////////////// 

<?xml version="1.0" encoding="UTF-8"?>

-<eConnect xmlns:xsi="www.w3.org/.../XMLSchema-instance" xmlns:xsd="www.w3.org/.../XMLSchema">

-<IVItemMasterType>

<eConnectProcessInfo xsi:nil="true"/>

<taRequesterTrxDisabler_Items xsi:nil="true"/>


-<taUpdateCreateItemRcd>

<ITEMNMBR>Marian3</ITEMNMBR>

<ITEMDESC>serializer.Serialize</ITEMDESC>

<ITMCLSCD>COMPATABLE </ITMCLSCD>

<ITMTSHID>VAT.S 14%</ITMTSHID>

<UOMSCHDL>EACH</UOMSCHDL>

<Purchase_Item_Tax_Schedu>VAT.P 14%</Purchase_Item_Tax_Schedu>

<CURRCOST>0</CURRCOST>

<USCATVLS_1>Katun </USCATVLS_1>

<USCATVLS_2>Toner </USCATVLS_2>

<USCATVLS_3>serializer.Serialize</USCATVLS_3>

<LOCNCODE>MAIN</LOCNCODE>

</taUpdateCreateItemRcd>

<taUpdateCreateItemCurrencyRcd_Items xsi:nil="true"/>

<taIVCreateItemPriceListLine_Items xsi:nil="true"/>

<taIVCreateItemPriceListHeader xsi:nil="true"/>

<taItemSite_Items xsi:nil="true"/>

<taCreateItemVendors_Items xsi:nil="true"/>

<taCreateKitItemRcd_Items xsi:nil="true"/>

<taCreateInternetAddresses_Items xsi:nil="true"/>

</IVItemMasterType>

</eConnect>

*This post is locked for comments

  • RE: Create Item on GP

    Hi Richard,

    The setup is done as you mentioned above .

    When I am creating the product manually >> it adds the GL Accounts automatically ,same as the ItemClass Gl accounts

    But when I added it by my code it doesnot do the same .I think I am missing something im my code and sothat the created item doesnot have the GL accounts !!

    dou you have a code sample or a link for a tutorial that I can follow , enable me to add GL accounts to an item ?

    I am really appreciate your help ,Thanks for that

  • Richard Wheeler Profile Picture
    Richard Wheeler 75,788 Moderator on at
    RE: Create Item on GP

    Is it, by chance, defaulting to what you have setup under Tools->Setup->Posting->Posting Accounts for Inventory?

  • Richard Wheeler Profile Picture
    Richard Wheeler 75,788 Moderator on at
    RE: Create Item on GP

    Yes, eConnect will behave as if you were typing in the item manually. So if you have assigned GL accounts to an item class and then pass the item class down to eConnect, the item will be inserted with the corresponding GL accounts.

  • Richard Wheeler Profile Picture
    Richard Wheeler 75,788 Moderator on at
    RE: Create Item on GP

    I will not be back until later today. I could send over some code later. I always start by sending over the least number of parameters and test. Nothing jumps out at me when I look at your example. You are sending over more parameters than I do.

  • RE: Create Item on GP

    Hello Richard ,

    That already happened for the created Items

    when I am creating the item(through plugin) ,it is associated with a specific class

    but the item doesnt have the same GL account same as the class !!

    I cannot find out the problem in my code

  • RE: Create Item on GP

    Hi Ramanan,

    Thanks for your answer it really helps me .

    I will be greatful if you told me about the .NET classes that I should use it to map "Account of charts" from the ItemClassID in the eConnect Schema

    if you have a code sample or a link for a tutorial that can I follow it

    Thanks in Advance ^_^

  • Verified answer
    Ramanan Profile Picture
    Ramanan 242 on at
    RE: Create Item on GP

    Hi,

    In GP Create Item Class in Inventory Setup and give chart of accounts there and then map the ItemClassID in the eConnect Schema, it will default the chart of accounts in the new item created.

    Regards,

    Ramanan

  • RE: Create Item on GP

    UPDATES

    -------------

    I solved the second issue

    I am currently asking for a solution for the first issue ( Chart of accounts )

    Thanks in advance ^_^

  • RE: Create Item on GP

    UPDATES

    -------------

    I solved the second issue

    I am currently asking for a solution for the first issue ( Chart of accounts )

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,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,432 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans