Workflows atomicity, Inline scripts and style sheets - This week in Orchard (07/02/2021)

Gábor Domonkos's avatar
Admin UI, SQL Server, This week in Orchard, Workflows

Workflows atomicity, support inline scripts and style sheets, admin UI sticky buttons, filter and search feature for List Part too. Do we need to tell more about the content of our current post? Let's jump into the recent news of Orchard Core!

Orchard Core updates

Support Inline location for styles and scripts

You can specify several options when working with commonly used resources like JavaScript libraries and CSS files like using a configured CDN or appending a version hash to all local scripts and style sheets. You can also specify a location the script should load, for example, you can say that I would like to render my style sheet in the HEAD of my page. If the location is not specified or specified as Inline, the script will be inserted wherever it is placed (inline).

Let's say we have a site set up using the Agency recipe. Then let's navigate to Design -> Templates on the admin UI and find the predefined Content__LandingPage template. Here we can try out the new Inline mode using Liquid helpers! Try to inject the jQuery named script inline before we render the Portfolio content items. To do that we just need to add the following line: {% script name:"jQuery", at:"Inline" %}. And as you can see in the code, there is the script HTML tag right after the jQuery script text.

Injecting a script inline

Filter/search feature for List Part too

If you navigate to the content items list of your site (Content -> Content Items) you can use a nice search feature that you can use to filter your content items by the display text values. You can also use the quick filters to see only the draft/published items or the ones that owned by you. But you can't use this filter for the List Part lists. Until now! If you have a site with a Blog recipe, head to the Blog option on the admin UI and check out the new UI. You will see the exact same filter and search here as we have seen on the content items list.

Filter list for List Parts

New IUserClaimsProvider interface

This is about the extensibility of the ClaimsProviders. You used to have to inherit from the DefaultUserClaimsPrincipalFactory to provide all the claims but now you have a new IUserClaimsProvider interface that you can implement. There are some default ones like the EmailClaimsProvider.

Implementing the new IUserClaimsProvider interface

Workaround for DateTimeOffset in indexes

The OpenIdAuthorizationIndex hasn't been sent to Dapper by YesSql correctly. Here the DateTimeOffset? hasn't been handled correctly and the workaround is to use DateTime?. So, for now, the local fix is to use DateTime? instead of DateTimeOffset? in the index provider and DateTime instead of DateTimeOffset in the migrations.

Using nullable DateTime instead of nullable DateTimeOffset in indexes and migrations


Sticky action buttons on the admin UI

The problem is that you have to do a lot of scrolling to find the action buttons to save, publish or preview your content item. There could be several options to solve this issue but now to experiment how easy to use the implemented solution, this one only affects the Templates page right now. The idea that has been implemented is to have sticky action buttons on the top of the page instead of showing them at the bottom of the screen. If you set up your site using the Agency recipe and open the predefined template (Design -> Templates) and scroll down a little bit you will see the same screen as we show here.

Sticky action buttons on the admin UI

If you would like to see the sticky buttons in action too, head to YouTube and check out this recording. And as always, if you have any feedback or suggestion on how to solve the issue of needing to scroll down a lot to reach the action buttons, don't hesitate to share your ideas on GitHub!

Workflows atomicity

In this demo, you could see a workflow that has a starting activity that is about to handle an incoming HTTP GET request. This workflow will call an endpoint using an HTTP GET request 30 times using a For Loop activity. After that 30 actions finished, the workflow will publish a new content item and display a simple success notification. You could ask that what is the goal to call a given endpoint 30 times and you are right. But for this time the goal of this workflow is to demonstrate that we have a long-running workflow and this process can perfectly demonstrate that.

Make sure you can only have one instance of this workflow type at the same time by putting a tick in the Single instance checkbox. Because it's a single instance if you call this workflow again without the first one has been successfully finished, the execution will wait for the first one to be finished. So, the system will only start to execute the second call after the first execution was finished with or without an error.

In this demo, you can see what will happen if you do 10 concurrent requests to start this workflow. You will see 10 workflow instances instead of 1. But why? It's a singleton, you should see only one instance, right?

The new properties of the workflows

Let's navigate to the properties of the given workflow where you will see two new options: Lock timeout and Lock expiration and give them a value in ms like 10000. Now let's try to call this workflow again using 10 concurrent requests. What will happen that now if you check out the instances of the given workflow, you will find only one item there. Check out the recording to see what are these new options exactly and how to use them correctly!

News from the community

Work with us!

You've completed the Dojo Course, congratulations! You’re now officially an Orchard Core developer. Would you like to work on a variety of challenging Orchard Core projects with the biggest Orchard team in the world? Work with us! Just send us an e-mail to crew at Please include what you’re most interested in professionally and attach around 100 lines of any kind of code that you’re especially proud of or just link to the favorite open-source project of your own on GitHub or else.

Orchard Dojo Newsletter

Lombiq's Orchard Dojo Newsletter has 191 subscribers! We have started this newsletter to inform the community around Orchard with the latest news about the platform. By subscribing to this newsletter, you will get an e-mail whenever a new post published to Orchard Dojo, including This week in Orchard of course.

Do you know of other Orchard enthusiasts who you think would like to read our weekly articles? Tell them to subscribe here!

If you are interested in more news around Orchard and the details of the topics above, don't forget to check out the recording of this week's Orchard meeting!

No Comments

Add a Comment