Documentation Center

Best Practices

This topic contains best practices that are advised when creating new plugins.

  • Explicitly specify all the metadata fields that are required by the plugin in the working set. It can be that the field is available for the plugin because it is being updated, it is a system field or another plugin requested it using the working set. However, it's safe not to rely on the other components and explicitly request fields required by the plugin by specifying them in the working set.
  • Limit the number of fields in the working set. Every field that is specified in the working set has to be retrieved from the database and stored in the database in the end, which might affect the performance. Don't specify the field that you don't need.
  • Verify the parameter values in Initialize. If plugin cannot be executed because some parameters were not provided or have wrong values, it is better that the main operation fails as soon as possible.
  • Prefer getting and setting field values using IshValueType.element. The element name does not change and guaranteed to be unique.
  • Do not pass data between plugins using class private fields or static fields. Every plugin runs as a new instance. The only supported way to pass the data between plugins is the metadata field of the object.
  • Use string and multistring field type when getting or setting the value of LOVValue and CardReference fields.
  • Avoid unnecessary content conversion (from XmlDocument to Stream and back). When adding plugins into the plugin xml configuration file, try grouping plugins that require the same content type together. This way plugin engine will be able to simply pass the content to the next plugin without conversion.