SiteCore Workflow - Reject to a specific state - sitecore

Taking the example of the Sample Workflow in SiteCore, in the Approving state state, can I add a new Reject option for the approver to reject the item and move it to the reviewing state?
I believe that the default reject action in any state will always move the item back to the first/draft state but we are implementing a workflow with multiple states in it and the approver would like to have the option to reject to the various teams which each have a state in the workflow. So, is it possible to have multiple reject options as well - for example, can the approver reject to draft or to reviewing based on the error detect?

Select the 'Reject' item underneath your approving workflow step, then set the 'Next State' field to point to the correct workflow state.

In order to have the choice to reject to multiple different states, you will need to add multiple reject buttons. Simply duplicate the Reject "Command" item, point each items "Next State" field to a diff state, and then rename the "Command" items accordingly so the user knows what they mean. E.G. "Reject to Draft" and "Reject to Reviewing".

Related

Can we restrict publish subitems count in sitecore if items more than 20

Want to restrict to publish items ,if items count is more than 20.
You could do this with an item validator, so that "the 21st" item and onward would fail validation so that it cannot transition to the final workflow step.
Another, more intrusive, alternative could potentially be having a item:saved processor that could set __Never publish to 1 to the surplus items, so they can't be published.
As a general recommendation, I'd say you should avoid changing the publishing pipeline. Try having all the items in a "good/valid" state instead, like the solutions above, where you don't change the behavior of Sitecore - rather just keep the content in a state that's in line with the application requirements.

Updating values, one control to another

History, I am an experienced PL/SQL dev learning to use Apex and struggling with some of the concepts. Before working with PL/SQL I worked with various platforms including Delphi and VB.
Problem, how to pick up the value set in component from another component. The object of the exercise is to make the report in an interactive grid change dependant on a value selected in a drop down, the value in the drop down being in the where clause as a bind var. My original setup for this did not work. After various experiments with this I produced this test case where the object is for the label to display the value selected in the drop down:-
Page view
P300_SELECT (left) is a simple drop down, unmodified with the default values. P300_SELECTED_VALUE is a label set to display the value in P300_SELECT:-
Component setup
This does not work! And it continues not to work when I change the source setup of the label to be STATIC VALUE and set the value to &P300_SELECT.
I have also tried adding a CHANGE dynamic action on the drop down to call refresh on the label, it still does not work! In desperation to confirm that the value was indeed changing for the drop down I added a second true action to the change event executing the following javascript:
apex.message.alert($v("P300_SELECT"));
Sure enough, this works showing that the event is firing and that the value is correct:-
Label no change, but alert message works...
SO WHAT IS HAPPENING?
Why does the label not update even with a refresh called on it?
What do I have to do to make this work?
Thanks in advance for your help!
Bob
To do this
1 - Create one dynamic action to start when you change the value of P300_SELECT.
2 - Now there is a lot of ways to do this step, but I will sugest to do in this way. Create one true action in this dynamic action, this true action is "Execute PL/SQL code". The code is:
BEGIN
:P300_SELECTED_VALUE := :P300_SELECT;
END
In this true action put the item P300_SELECT in the field "Items to submit". And the item P300_SELECTED_VALUE in "Items to Return".
3 - Now create one more true action in this same dynamic action. This true action is "Refresh" and select the region of your report/IG.
***If the item P300_SELECTED_VALUE is just to test, so discard the first true action above and fill the field next of your select statement "Page items to submit" with the item P300_SELECT.
Why what you have try don't work?
1 - The source section is used to set the value when the page is loaded, this setup not affect changes after the page is loaded.
2 - The report is not refreshed because the item is not in the session after you change it.
Ex. https://apex.oracle.com/pls/apex/f?p=145797:15
Use this workspace to check something:
workspace: STACKQUESTIONS
user: test
password: test
app: 145797
page: 15
login on: https://apex.oracle.com/pls/apex/f?p=4550

My test script is not finding items in dynamic web list control - list in code not updated with current info

I am having a problem in QTP with selection of a web list box and I have exhausted what I know to do to resolve it. I am hoping someone can help.
There are 5 controls in a container, 2 webedit controls and 3 weblist controls. Together, they allow entry of accounts associated with a customer, and there can be 16 accounts for any customer. There are only ever five controls active at any time, whether editing or entering information for an account. When the information for an account is entered and accepted, it changes to a read-only table row and a new set of controls appears below it for entry of the next account.
The information entered in these controls is the account number, type, description, designation, and status. The status value is contingent on the designation, and the items in the list change dynamically depending on what the user specifies for the designation. The status list is not enabled until the designation is specified.
After some experimenting with timing, I was able to get past an issue where the status list for the first account was seen by QTP as disabled even though it was clearly enabled. I was then able to advance to entry of the second account.
I change the designation on the second account and try to select an appropriate item (specified in a data table) in the status list. My specification from the data table is never found. I figured it was a problem with verbiage differences and also that I should probably anticipate that and address it now, so I wrote a function to accept three parameters, the list and up to two search items. My function searches the listbox passed to it and looks for a match (full or partial) on the search items it receives. Here is where I encountered a significant problem.
The list of the control my function received was from the previous iteration of the test, corresponding to the designation of that account. This is why my function was not finding the selection item. The list on the screen shows the appropriate items, which suggests that I am looking at the wrong object. I also get the ‘object is disabled’ message when I put my data table value directly into the list with the select statement.
The active controls are displayed below the readonly presentation of the previously entered accounts. I am very new to QTP, but I also read documentation. My only theory at this point is that ATP is not passing the right list to my function… that perhaps that how it was learned included the position, which will change each time. However, the spy identifies the screen control as the same item I processed for the preceding account, which makes my theory suspect. In addition, the other four controls, which are not dynamically changing, do not present the same problem. I can put the information in them consistently.
I apologize for the length of this question, but I wanted to be as thorough and clear as possible. Can anyone help me get past this obstacle.
There are many possiblities why it is exposing this behaviour, so let's start with something simple:
Did you try a myWebList.Refresh call before you do something with the listbox? Refresh re-identifies the object.
Have you put a break point (red dot) inside the custom function. Just see what is happening there. With the debug viewer you can enter a realtime command in the scope of that function like msgbox myWebList.exist(0) or myWebList.Highlight
Can you see how the disabled property is propagated to the webpage? If you can 'Object Spy' it as TO property, you can add it in the GUI Map description.
A more sophisticated aproach is to create a Description with the weblist properties. If you can read the disabled property as an RO property from the 'Object Spy', you can use it as an identifier like "attribute/customDisabledProperty:=false".
If you cannot correctly read the disabled property, you can create a description object and do a count on the amount of items that match that description on that page with numberOfLists = Browser("my browser").Page("my page").ChildObjects(myDescription).Count and get the last list with Set lastList = Browser("my browser").Page("my page").ChildObjects(myDescription)(numberOfLists-1)
Keep us informed. Depending on how this works out, we can work into a direction for a solution.
I figured this out early this morning. There are 4 different list boxes used, each made visible or enabled dependent on the selection of the previous list. This is why the spy found the one listed when I was using it and also why the items in the list were not appropriate to what I had selected and also why it appeared disabled to QTP but enabled to me.
I was selecting the same designation when trying to spy it. It was intuitive that the controls were all the same. I am also a windows programmer and I would have populated the same list each time with the appropriate list items, and I presumed that was what the web developer was doing. It was not and it took some time to figure that out. Now that I figured it out, everything is working fine, and I came back to report that. This was a significant, time-intensive lesson.
Thank you very much for your input. It is still useful because I am very new to QTP and every thing I learn is of value.

How to handle expired items?

My site allows users to post things on the site with an expiry date. Once the item has expired, it will no longer be displayed in the listings. Posts can also be closed, canceled, or completed. I think it would be be nicest just to be able to check for one attribute or status ("is active") rather than having to check for [is not expired, is not completed, is not closed, is not canceled]. Handling the rest of those is easy because I can just have one "status" field which is essentially an enum, but AFAIK, it's impossible to set the status to "expired" as soon as that time occurs. How do people typically handle this?
Edit: I'm not asking how to write a query to find expired items; I'm asking how I can find the "active" (unexpired items that meet a few other boolean conditions) without having to use a big nasty query every time I want to find them.
I think that can be managed with cronjob and django custom management command, is just an idea.
Make the item have birth and death (type:date) columns and a status column (completed, removed, to be expired...).
Update/fill the death column when you want to logically end the lifecycle of an item (for whatever reason: expiry, completed, ...). Update the status column accordingly.
Querying for active items (in pseudo-SQL):
select * from mytable where birth <= todays_date <= death or death is null
It sounds like the expiration date/time is the field that you need to actually store and make decisions based off of. IsActive sounds like something you would calculate on the fly based on the expiration date and possibly other fields (even though its a pain)
IsActive as a field would probably work better if it wasn't a product of some other information like the expiration date, but was valid on its own, such as if a user manually set the status to "active" or "not active".

Sitecore values -- Template > Standard Values > Branch > Item

OK, here's the process I took...
create a new template "Mail Message"
create a "__Standard Values" item for the template
edit the "Subject" field in the standard values item: "Monthly email newsletter"
create a branch for the template
do NOT set the Subject field in the branch item
create an item from the branch
I would expect the subject would be the one from the standard values item, however it seems the branch field value is blank, and in turn the created item also has a blank subject field.
Should the Branch field value be that of the standard value. Or does the very act of creating a branch item eliminate any standard values you set.
Does the field versioing have any effect (e.g. Shared, Unversioned)?
I haven't been a big user of Branches, so I am surprised at the behaviour, but if it is normal, all good. Just want to confirm.
Alternatively, if the template or standard values were locked when the branch or item was created, the standard values might not have carried through.
Either way, you need to reset the value of the sitecore item. On the item, click the 'Reset' button, which is under the Versions tab and check the checkbox next to 'Subject'. Now, the field will show as 'Subject [standard value]'.
Hope that helps!
Creating the branch for the item template should copy the standard values and allow you to update the default values from the template.
So for example if you had "Monthly email newsletter" in the "Subject" field of the template it would be the same in the branch and all items created from that item.
Changing that field in the Standard Values should then update it in the branches and items.
If you have changed the field on the item however the link would be broken and you would no longer manage it from the standard values with out resetting the values.
Not sure on the shared/unversioned factor but dont think it effects the standard values.
When you change the value in branch template, you've broken the link already. So after that if you change the standard value, the value in branch template will not effect