Frequently we have to execute plugins as Service Accounts so they have the right privileges to execute the business logic we want. Although you can set a user in the “Run In User Context” field of the plugin step, sometimes our organizations doesn’t actually have service accounts to be used there.
To programatically run a plugin as SYSTEM, you have to change the user sent as parameter when creating your IOrganizationService object. Instead of sending: Context.InitiatingUserID, you should set null.
IOrganizationService Service = Factory.CreateOrganizationService(null); // To execute plugin as SYSTEM IOrganizationService Service = Factory.CreateOrganizationService(Context.InitiatingUserId); // To execute plugin as the user set in "Run In User Context"
Hope it helps!