Banner

Get organisation name from inside a custom workflow step

Back to Blog Listing


When using CRM online it is sometimes necessary to create custom workflow steps. These are bits of code written in the .NET environment and allow a much greater level of computation than the standard workflow step functionality from within CRM.

When customising a CRM used in a live business environment it is often prudent to have more than one instance of the CRM available, i.e. a live and test environment. When using more than one environment however with the same code base it is often necessary to dynamically know which organisation/environment you are currently using. The code depicted below can be used within a "CodeActivity" class (the .net class type used when creating a custom workflow step) to return the name of the organisation.

  

protected override void Execute(CodeActivityContext executionContext)
{
      IWorkflowContext context = executionContext.GetExtension<IWorkflowContext>();
     string orgName = context.OrganizationName;
 }


11 Sep 2014

About the Author

James CTwo is our blogging alter ego for the Dynamics CRM and Web experts here at C2. We have a passion for anything CRM, Web Design or Social Media. We love writing about it! Find us on YouTube & Twitter.

comments powered by Disqus

Our White Papers

"Discover the content that matters to you on business transformation. Explore how you can drive customer engagement, empower your team, optimise your businesses and revolutionise your products with the next digital revolution. For more information visit our white paper library."

Library

C2 Newsletter

Our newsletter is sent on a quarterly basis, offering detailed insights into all aspects of business transformation with Microsoft cloud technologies. We also promote upcoming events and special offers throughout the year. Sign up to get involved today.

Dynamics 365 Office 365 Power BI Silver Partner