0
votes

I am trying use Sitecore Query Language through Sitecore Rocks Query Analyzer to update a bunch of items to a new Workflow, while maintaining the current state. I current have this:

update set @#__Workflow state# = "--GUID of the workflow state--" from //*[@@id='--GUID of the parent Item--']/*

This works. What I want to do, is include a where statement so that I can keep the draft/awaiting-approval/approved states while still switching Workflows.

update set @#__Workflow state# = "--GUID of the DRAFT workflow state--" from //*[@@id='--GUID of the parent Item--']/* where @#__Workflow state# = "--GUID of the original DRAFT workflow state--";
update set @#__Workflow state# = "--GUID of the APPROVED workflow state--" from //*[@@id='--GUID of the parent Item--']/* where @#__Workflow state# = "--GUID of the original APPROVED workflow state--";

This however doesn't work. Do I just have a syntax problem with my where clause, or can where not be used in conjunction with update in Sitecore Query Language.

1

1 Answers

1
votes

The "Where-clause" does not work in the Query Langauge.

You should use use the /*[@fieldName = "value"] to select the items, like this:

update set @#__Workflow state# = "--GUID of the DRAFT workflow state--" from //*[@@id='--GUID of the parent Item--']/*[@#__Workflow state# = "--GUID of the original DRAFT workflow state--"];

update set @#__Workflow state# = "--GUID of the APPROVED workflow state--" from //*[@@id='--GUID of the parent Item--']/*[@#__Workflow state# = "--GUID of the original APPROVED workflow state--"];