Quantcast
Channel: Microsoft Dynamics GP Forum - Recent Threads
Viewing all articles
Browse latest Browse all 32807

GP Web Service Extension Assembly Update of GP Customer Information

$
0
0

I have implemented a GP Web service extension assembly registered to update the Email address in the GP 2010 SY01200 table, when the email address is altered in CRM 2011.

Before I go any further, the environment that I am working on is as follows:

1. CRM 2011

2. GP 2010

3. My worked is based on the following MSDN articles regarding extending the GP Web service using custom assemblies:  msdn.microsoft.com/.../cc508802.aspx

Step 1: I registered my assemblies code for the [Customer] object under the [Updating] event in the [BusinessObjectsFile.config]. Please refer to figure 1 below for some sample code:

Step 2: I Created an extension assembly that updates the SY01200 table. To make sure that this code included in the assembly works; I tested the sql statements in a seperate application linking to my GP database. It did update the SY01200 table. However when my custom assembly executes, the code fails. Please refer to figure 2 as shown at the bottom of this question.

PROBLEM:

* When my custom assembly`s code runs, I get an exception (as viewed from the GP Web/serv exception console) which is as follows:

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

Exception Type:                      Object Type:                                                       Operation:

Validation                                Microsoft.Dynamics.GP.Customer                 Create

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

Further details are as follows:

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

A validation exception has occurred.
Validation Errors:
- CustomerKey already exists and the UpdateIfExists flag is set to not allow updates.

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

Figure 1 --> The event registration code added to the [BusinessObjectsFile.config]

<DictionaryEntry>

     <Key xsi:type="xsd:string">Microsoft.Dynamics.GP.Customer</Key>

     <Value xsi:type="BusinessObjectConfiguration">

       <Event>

         <EventName>Updating</EventName>

         <EventHandlerType>

           <Type>Microsoft.Dynamics.Common.BusinessObjectUpdateEventHandler</Type>

           <Assembly>Microsoft.Dynamics.Common</Assembly>

         </EventHandlerType>

         <EventHandler>

           <SoftwareVendor>DEVCOMPANY01</SoftwareVendor>

           <Type>EmailAddressExtension.EmailAddressProviderExt</Type>

           <StaticMethod>UpdateCustomerEmail</StaticMethod>

           <Assembly>EmailAddressExtension</Assembly>

           <Execute>true</Execute>

         </EventHandler>

       </Event>

     </Value>

</DictionaryEntry>

Figure 2 --> The ado.net sql update statement. I tested this code in a seperate application and it then successfully updates the SY01200 table.

I have tested this code in a separate console application to test is it does update the GP database, which it does without complaining about duplicate customerkey.

// The SQL statement to update SY01200 table for the Customer (Master_Type = 'CUS')

string updateStatement = "UPDATE SY01200 SET INET1='" + email + "' WHERE Master_Type = 'CUS' AND Master_ID = '" + customer.Key.Id.Trim() + "'" +

                   "AND ADRSCODE = '" + adrscode + "'";

I would appreciate it if anybody could shed some light regarding this issue,.

Thanks


Viewing all articles
Browse latest Browse all 32807

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>