Routing New Documents to Appropriate Place in Content Tree

Zac Weiker asked on November 7, 2014 23:35

The basic structure of my content tree is:

Applications App1 Reviews Review1 Review2 App2 Reviews Review3 Review4 App3
Reviews Review5 Review6

We are giving users the ability to create a page without having to go through CMS Desk, as only a select few people will have admin access. Users can click a link to display the new page form for our custom "Review" page type.

In that page type, we have a dropdown list (called Application) populated by SQL to get certain App pages from the content tree: SELECT AppName, AppName FROM AT_AppLandingsPage WHERE DisplayLevel LIKE 'High Level'

We have a Contribution List web part that displays the form for a new "Review" page, with the Path for new pages option set as: /Applications/{%AppAlias%}/Reviews/%

The AppAlias field is supposed to just grab the Alias Name of the page selected in the Application field: SELECT NodeAlias, AppName FROM View_AT_AppLandingsPage_Joined WHERE DisplayLevel LIKE 'High Level' AND AppName = '{%Application%}'

When I try to create a new page, the AppAlias field is set to whatever the default Application is, in this case, App1. If I change Application to App2, AppAlias remains App1 until I save the page and refresh the form, where it then changes to App2. If I create a page using the Contribution List webpart, and change Application from the default (App1) to App2, I notice that the page gets created under App1/Reviews, when I want it to go to App2/Reviews.

Does the Path for new pages option get set before the page is saved for the first time? Any ideas how I can make this work?

Thanks! Zac

Recent Answers


Brenden Kehren answered on November 8, 2014 00:42 (last edited on December 10, 2019 02:30)

Is /Applications/{AppAlias} setup as an alias/querystring param on the /Applications page? If so you could just the querystring macro {%AppAlias%}. Or depending on where your webpart is placed, you could just use {% CurrentDocument.NodeAliasPath |(identity)GlobalAdministrator%} That should pick up your app alias, unless I'm totally missing what you're trying to do.

0 votesVote for this answer Mark as a Correct answer

Zac Weiker answered on November 10, 2014 17:17

Oh, the formatting on my post is awful, so it probably doesn't help that you can't tell what my content tree looks like. I'll try again...

  • Application
    • App 1
      • Reviews
        • Review1
        • Review2
    • App 2
      • Reviews
        • Review3
        • Review4
    • App 3
      • Reviews
        • Review5
        • Review6

We want users to be able to create a page (custom page type we're calling Review) from anywhere on the site (there would basically just be a link to create a new review on any of the numbered review pages, which opens a contribution list form to create a Review page), and based on the fields they select when they create the page, automatically put the page in the correct place in the content tree. The issue with CurrentDocument is that the URL will have nothing to do with the user's location on the site, unless I'm misunderstanding how that works.

All AppAlias is doing is grabbing the Alias Name of whatever page is selected in the Application dropdown list in order for me to construct the URL of the intended destination. For example, I select App 1 from the dropdown, and AppAlias is set to App-1, so /Applications/{%AppAlias%}/Reviews/% becomes /Applications/App-1/Reviews/%, which is where I want the page to be created. If I select App 2 from the dropdown, I want the page to be created under /Applications/App-2/Reviews/%. The problem I'm having is that, no matter which App I select from the dropdown, the page is always created under /Applications/App-1/Reviews/% because App 1 is the default selection for the dropdown.

If this still doesn't make sense, I can try to find a way to rephrase my question.

Thanks!

0 votesVote for this answer Mark as a Correct answer

Sandro Jankovic answered on November 21, 2014 13:13

Hello,

I am not sure if I have a complete understanding of your requirement, but you should be able to use a DocumentEvent handler to move the pages to their correct location based on your custom logic. Is there a reason why this wouldn't work for you or why you would not want to use this approach?

Please let me know if you have any questions or concerns.

Best Regards,

Sandro

0 votesVote for this answer Mark as a Correct answer

Jon White answered on April 2, 2015 17:43

Hi Zac,

I think this is the same question i was about to post.

I want to add a 'new upload' on the homepage of intranet that will bring up chosen page type. Then based on something like the category chosen/department move the new contribution to the right place in the content tree.

It needs to be moved by the system so i can run correct permissions on child documents in the content tree.

Did you find the answer you were looking for? The document event handler is quite complex for my knowledge, I will ask my back-end developer but wondered if you could share anything if you were successful?

Thanks Jon

0 votesVote for this answer Mark as a Correct answer

Charles Matvchuk answered on April 13, 2015 01:37

Did anyone come up for a solution for this ? I have a custom web part that we are using, but as with anything, now they now want it more stock.

Let me know and post solution if you have one.

Thanks

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.