copy_folder doesn't copy automation rules via rest api

Lilian T
Lilian T ✭✭
edited 02/02/21 in API & Developers

currently I run a copy_folder by API then found that the automation rules of the sheet under the folder is not copied.

I tried to create that automation rule by rest api, after copying the folder, but found that create_automation_rule is not available.


Is there a good way to do this fully via rest?

Tags:

Answers

  • Genevieve P.
    Genevieve P. Employee Admin

    Hi @Lilian T

    Based on the documentation for copy_folder here, it looks like you would just need to include rules as one of your parameters (rules includes both notification and workflow rules).

    There's an example of how to include a parameter in C# (the example is for DATA) to the right of the documentation.

    If you're using Python, there's an example on GitHub, here (search for "rules" and you'll see it under "copy_folder").

    Let me know if you still need help after reviewing the examples above. If so, it would be helpful to see a copy of your request, but please remove any sensitive data.

    Cheers!

    Genevieve

  • Hi @Genevieve P. Thanks a lot for getting back a while ago. This task was put aside because of my work load. I tested again lately with Python and it did NOT work.


    Below you can find my code, which is quite straight forward:

    response = smart_service.Folders.copy_folder(
        copy_from,
        smartsheet.models.ContainerDestination({
            'destination_id': copy_to,
            'destination_type': 'folder',
            'new_name': new_name
        }),
        include='rules,all')
    

    I used "all" here because only "all" works while I want to copy all the sub folders beneath.

    Please check the API implementation on your side and see if "rules" only works under certain conditions.

    Thanks a lot.

  • lkrobot
    lkrobot ✭✭✭

    Hi,

    the following code works fine for me:

    we need everything from our template folder (many, many complex Smartsheet objects),

    so, we included all available options in include ...

    and it works perfect (including automation workflows) ... except that it does not do automatically cross sheet references, so, you have to use other api calls to get them correct ... here is example:

    rgrds,

    ljk