2

I am wondering if there are any indicators I can use within the following Event System code to know whether the Publish Transaction was triggered by XPM vs. a user?

The only things I've found (which are not conclusive at all) is Component being published to Staging

private void SetInWorkflowPublishFlag(IdentifiableObject subject, PublishEventArgs args, EventPhases phase)
{
   //TODO: Review if can determine if initiated by XPM vs. Person
   if (args.Targets.Count() == 1 && args.Targets.First().Title.ToLower().Contains("staging"))
   {
      if(subject is Component)
         args.PublishInstruction.ResolveInstruction.IncludeWorkflow = true;
   }
}
3
  • There might be something in the ContextData dictionary. I know you'll find stuff in there like if it's an action caused by Content Porter or Translation Manager. Do not know if we had Experience Manager/CME identified already in 2013 though. – Nuno Linhares Sep 28 '16 at 10:37
  • I tried the ContextData, it was empty – Chris Morgan Sep 29 '16 at 11:16
  • 1
    Sorry. Might have been added in 8.1 only then. – Nuno Linhares Sep 29 '16 at 11:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.