How to interfere with Acumatica after publish of customization

Hello everybody,

today I want to tell you about interesting class in Acumatica: CustomizationPlugin. Take a look on how reflector shows it's source code:

namespace Customization
{
  public abstract class CustomizationPlugin
  {
    public virtual void OnPublished()
    {
    }
 
    public virtual void UpdateDatabase()
    {
    }
 
    public void WriteLog(string msg)
    {
      CstPublishLog.WriteLog(msg);
    }
  }
}

As you can see, this class has three methods:

  1. OnPublished
  2. UpdateDatabase
  3. WriteLog

Each of those events allows you to update Acumatica after some events happening. For example after publish, on stage of updating database, and also you can use it for writing logs to publisher window. 

Below goes interesting example:

namespace ChangeEmails
{
    public class ChangeEmails : CustomizationPlugin
    {
        public override void OnPublished()
        {
            // add some code to be executed after publish
        }
    }
}

Having this knowledge you can execute some code after publishing of your customization, and it will be executed only once.

IMPORTANT

In order for customization plugin to work, you should place it not as dll file in your customization, but as code file in your customization. As you can see on the screenshot:

2 Comments

  • Tim Rodman said

    This is great Yuriy. Can you think of a way to combine OnPublished with a silent Google Form submission like is outlined here:
    http://bionicteaching.com/silent-submission-of-google-forms/

    I'd be interested to capture the following in a Google Form every time someone publishes my Customization Project:
    1. Date/Time Stamp
    2. Acumatica Instance URL
    3. Acumatica Tenant Name
    4. Acumatica Server IP Address

    Is this doable?

  • docotor said

    Hi Tim! Nice to meet you one more time! Yes, it's doable. Also want to warn you that it's relatively easy to get rid of that piece of functionality if somebody has elementary understanding of customization and programming in C#. In your place I'd rather recommend posting to google for inside of pages. One more point to keep in mind is that google with time may add Not a robot test, and you can push to google form may fail.

Add a Comment