Skip to main content

Notifications

Microsoft Dynamics GP (Archived)

GP Extension Methods

Posted on by 580

I have created a small GP extension library to monitor the “Created” business object events. I have followed MSDN "HOW TO’s" exactly, but I still cannot get any feedback from the library I had setup (i placed log entries for when hit)… Below is my code and the BusinessObject Config file entry. I have restarted the server after placing the files in the appropriate directory and had also entered some information into GP, but nothing logs??? Any explanations?

namespace RasGPService

{

 public static class GPExtentions

 {

   //private static Connection connection;

   /// <summary>

   /// Event fired on GP Record Created, specified in BusinessObjectFile.config

   /// </summary>

   /// <param name="sender"></param>

   /// <param name="e"></param>

   public static void OnRecordCreated(object sender, BusinessObjectEventArgs e)

   {

     try

     {      

       Customer customer;

       Extension CustomerEmailExtension = new Extension();

       //get current cust connection

       //connection = Connection.GetInstance();

       if (e.BusinessObject.GetType() == typeof(Customer))

       {

         customer = (Customer)e.BusinessObject;

         // Look at the Extension list passed along

         foreach (Extension ext in customer.Extensions)

         {

           Logger.LogExtention(ext);

         }

       }

       else

       {

         Logger.LogExtentionType(e.GetType().ToString());

       }

     }

     catch (Exception ex)

     {

       Logger.LogException(ex.Message);

     }

   }

 }

}

BusinessObjectsFile.config entry:

<DictionaryEntry>

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

    <Value xsi:type="BusinessObjectConfiguration">

        <Event>

            <EventName>Created</EventName>

            <EventHandlerType>

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

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

            </EventHandlerType>

            <EventHandler>

                <SoftwareVendor>MicrosoftDocumentation</SoftwareVendor>

                <Type>RasGPService.GPExtentions</Type>

                <StaticMethod>OnRecordCreated</StaticMethod>

                <Assembly>RasGPExtentionMethods</Assembly>

                <Execute>true</Execute>

            </EventHandler>

        </Event>

    </Value>

</DictionaryEntry>

*This post is locked for comments

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans