Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Tom C 87 posts 222 karma points
    Oct 03, 2016 @ 10:52
    Tom C
    0

    Running back office code scripts

    Hi everybody, Let's say I want to run a one-off code script to generate a number of nodes on my site, what is the best way of doing this? A few years it was possible with some back office packages that let you run Razor scripts dynamically but these don;t work on the latest versions, ie 7, and I couldn't find any recent packages that might help along these lines. One approach would be to just run a command line program locally but I don't know how or if it is possible to connect this way to my remote Umbraco instance. Thanks for any help or suggestions.

  • Steve Morgan 1349 posts 4458 karma points c-trib
    Oct 03, 2016 @ 12:39
    Steve Morgan
    0

    The really hacky quick way is to create a new doc type with a template and hack your code into the template (or more correctly call a helper method from it).

    I'd check a flag is false that you set at the end of the script to true before the code executes (perhaps check a doc type property?) to ensure your special script only executes once.

    Interested to hear if anyone has any better solutions?

  • Tom C 87 posts 222 karma points
    Oct 03, 2016 @ 19:49
    Tom C
    0

    Thanks. Yeah I followed that idea in the end. It works fine but surprising there is not enough need for this to merit a better solution!

Please Sign in or register to post replies

Write your reply to:

Draft