How to Revert Sitecore Item Bucket Programatically? - sitecore

When I reverted an item bucket manually by logging into sitecore, it is working as expected. But, when it is through below code, an unexpected phrase 'There are hidden items in this containder' is there and when viewed by enabling buckets checkbox, there are no child items present.
Sitecore.Buckets.Managers.BucketManager.Unbucket(item);

Following disassembled code what Unbucket button does, there is not only Unbucket(item) call:
BucketManager.UnBucketItem(contextItem);
foreach (Item current in from item in contextItem.GetChildren(ChildListOptions.SkipSorting)
where item.TemplateID.ToString() == Constants.BucketFolder
select item)
{
ItemManager.DeleteItem(current);
}
It firstly unbucket item and then go through bucket folders that left and remove them.

Related

Interactive Grid shows no results when filtered or sorted

I am using Oracle Apex v21.1. I have an Interactive Grid on a Modal Dialog Page which gives me the logs of the modifications made on a certain item.
Here's the scenario :
Select the item on the list Step 1
The details page of the item opens
Click on the "Logs" button Step 2 & 3
The "Logs" button open another Modal Dialog Page which displays an interactive grid Step 4
The "Logs" button set the value of the primary key to the interactive grid, so the list is filtered to show the information of this particular item. Step 5
Everything works fine, but when I try to apply a filter, sort or search, the interactive grid refresh, shows no data, and a blank column appears. If I close the list but reopen it again, the results are appearing, based on the filter, sort or search.
What could be the reason behind this problem ?
Here's the code of my Interactive Grid
SELECT * FROM inv_tb_item_logs
WHERE pk_article = :P24_PK_ARTICLE; --pk_article is my primary key
You can see more details on the screenshots
Thank you in advance,
Thomas
Based on Koen Lostrie's answers, here's how to fix it :
Create an Hidden Item to retrieve the ID of the Item later on the Logs List page Step 1
In the Behaviour of the Logs button, set the value of the hidden item to the value of the ID of the Item Step 2
Change the WHERE clause to WHERE id_item = :P25_PK_ARTICLE
In the Page Item to Submit attribute, select P25_PK_ARTICLE
I had to create this specific hidden item because i couldn't select the P24_PK_ARTICLE item to submit since it was on another page.
I hope this could help other people, thanks again for your answer Koen !

Oracle APEX - Transferring page item value from one page to another

Not sure what am I doing wrong and need help to diagnose the issue.
I have an apex page with an IG on it with radiobutton selection column, allowing the user to select only one row at a time.
On row select I use javascript to grab the ID of the selected row and then use Execute PL/SQL
NULL;
in order to store the value into the session state of P2_ID.
I also have a button on the page that has another page as a target - page 3, and I need to get my P2_ID value to that page.
So I set the page item of a target page - P3_ID ro &P2_ID. in a Link Builder - target pop up window. Along with that I pass another page item P2_TEST, which has a static value.
Now when I get to page 3, I do not see P3_ID in the session state while I do see P3_TEST and it does have a value, but P3_ID is not even listed... What am I doing wrong here?
How about this: instead of executing NULL; when pushing the button, SUBMIT (submit will certainly store values into session state). Create a branch which takes you to page 3; among branch properties, you'll find an option to set P3_ID to P2_ID

Oracle APEX, create & save (insert) from Interactive Report page to DML Form

Need a help in understand underline logic here. I have created a simple APEX application. First page shows the table details and via a "Create" button "Interactive Search" region, directs to a form page. Now form page consists of "Save" and "Insert" buttons in correct regions. So whole app works. When I press "Create" from 1st page to 2nd, "Save" button is invisible and when I click the edit icon on the table of 1st page, "Create" button is invisible in 2nd. App works accordingly, but could not figure out what setting enable this set-up even though I was able to make it work.
1st Page : Interactive Report Page. 2nd Page : DML Form. Built the app from blank pages.
Could any of you explain how it works?
When you click the Create button on the Interactive Report page, it takes you to the Form page in insert mode, i.e. it allows you to enter a new row into the table. Therefore, the Form page has the Create (and the Cancel) button.
On the other hand, when you click the Edit button on the Interactive Report, it takes you to the same Form page, but this time in edit mode which enables you to modify values (and save those changes with the Apply Changes / Save button), delete that row using the Delete button, or - as previously Cancel current operation.
If you look at Form page's buttons' properties, you'll see that they have Server-side Conditions set which are then used to render (or not) a certain button. For example, if the Form page number is 13 and the primary key column is set to the ID column, then these conditions look like this:
Create: P13_ID IS NULL (i.e. the primary key column value doesn't exist yet, which means that this is a brand new row)
Apply Chanages / Save: P13_ID IS NOT NULL (i.e. the primary key column value exists, which means that row you see was fetched from the database)
Delete: P13_ID IS NOT NULL (the same condition as for the Apply Chanages / Save button)
Cancel: it is always displayed.

How to check a checkbox in a default column list in sharepoint 2013 with powershell?

I have to write a script in powershell, and I'm new to it, to check specific checkbox when a sharepoint site is created. In a list, in sharepoint, we can go to list, change the display, and we can check the columns we want to display in the list.
I have this
$spWeb = Get-SPWeb "http://mysite"
$spList = $spWeb.Lists["MyList"]
$spList.Fields |ft title, internalname, id, type, hidden -AutoSize
I found the ones I want to check (example)
Title InternalName
----- ------------
Created By Author
Modified By Editor
I looked at the properties with
$spList.Fields.GetField("Author")
but I didn't found the property to set the value to true. I also set the checkbox to true in sharepoint, executed the command again and do a compare to see if a property changed, but nothing changed.
I also tried to do :
Update($true)
on the field, on the list.
I want to check those checkbox with a powershell command, I have many lists where I have to do this, and I have to execute that script on many sites.
Thank you for your help
If you need more information, let me know. I didn't found what I was looking for, I tried many things, but nothing worked.
(I couldn't post images..)
After somme research, I found that I have to modify my View. I had some custom columns, so I had some code after that.
$spViews = $spList.Views["All Items"]
After, I did a try/catch statement with this
$spViews.ViewFields.Add($spList.Fields.getField("Author"))
$spViews.Update()
And it worked!
I went on my lists, and all my list were updated with "Created by" "Created" "Modified by" and "Modified". They were displayed in my view list.

Sitecore: Get child items of parent item when the items are in publish restricted period

I am trying to get the children items of a Item.,of which some of the child items applied publish restrictions and there end date had expired.
I want to collect all the child items, whether it's end expired or not.
when i debugged my code i got only those items which have end date in time.
I have used following code
var childItems=item.GetChildren();
the child items collection is collecting only those child items which have there end date in time.
is there any method to collect all the items??
I have asked in sitecore forum, they asked to get child items from master database, but that approach also not working. i have tried following code also.
Sitecore.Data.Database master = Sitecore.Configuration.Factory.GetDatabase("master");
Item parentNode= master.GetItem("ItemNAme");
var childItems=parentNode.GetChildren();
The childitems is only collecting those child items whose end date is not expired
Please suggest me some solution for this
Thanks in advance
-Vaibhav
What you said about going to the master database is correct, as the master contains all versions of all pieces of content, not just publicly published content. I would wrap your code in a SecurityDisabler() in case that is somehow interfering with getting the right items.
using(new SecurityDisabler()) {
Sitecore.Data.Database master = Sitecore.Configuration.Factory.GetDatabase("master");
Item parentNode= master.GetItem("ItemNAme");
var childItems=parentNode.GetChildren();
}
The reason you find this problem is not related to security.
When IsPreview is true (cookie based) and Filtering on the site config is allowed you will not get Items with publishing restrictions. This functionality is from the implementation of the PageEditor Preview where you need to browse the master database as if published items where not visible.
See the answers on Sitecore Publishable flag makes it impossible to GetItem() from Master database