Community: Smartsheet API and automation rules

Mr. Dorsett in PythonRow copy, move automation rule broken when copying sheet using smartsheet APIIn response to this, we propose copying to the Sheet Summary, saving the sheet name in the destination, and using it to manually edit the workflow, and copying the sheet including the workflow that does not use the API. and answered.

Summary of user questions


Summary of user questions

Dorsett uses the smartsheet API in Python to copy a specific sheet and save it to a new destination.This process works fine, but it breaks on the new sheet where the automation rules are copied. The error message "Workflow is invalid" is displayed.

Summary of my answer

After testing with the Python SDK, we have confirmed that workflows for copied sheets are not copied correctly.As a solution, I am suggesting that you have to manually edit the workflow and how to create a field in the Sheet Summary for the destination sheet name of the workflow.

Question and answer details

Question

Dorset ✭ ✭ Dorset
05/06/23
Hello,

I'm having a hard time using the smartsheet API in Python.

I'm trying to use smartsheet_client.Sheets.copy_sheet(...) to copy a specific sheet by ID and copy it to a new destination folder.This works fine and I am able to create the sheet with the new location and new name.

The problem is that this sheet has some automation rules to "archive" the sheet, saving some rows to another sheet and keeping track of it.

Every time I copy a sheet in Python, the automation rules break and the new sheet says 'workflow is invalid'.

Reply
jmyzk_cloudsmart_en ✭✭✭✭
05/08/23
Hello.

You're right.

I tested using the Python SDK and foundCopied Sheet workflow does not copy target sheet name for copy or move actions,<unknown sheet>was displayed.

To change the destination sheet name, you must manually edit the workflow.

To make editing easier, you can create a field for the workflow copy destination sheet name in the Sheet Summary.

API sheet copy does not copy the destination sheet name.png

😀

Dorset
05/09/23
Thank you for your reply!

Yes you found my problem.https://community.smartsheet.com/discussion/68744/automation-based-on-sheet-summary, it says there is no way to use sheet summary data within an automation.If I click , I can't use any logic, I can only select a sheet.

I thought one solution would be to unset the automation rule, change the content of the box using update_automation_rule(…) and perhaps the 'action' field, and give the destination sheet id again.I don't know the exact syntax.

The next issue is that this is a newly copied and created sheet, so I can't hard code the id for the automation rule. When I try to get the id and use list_automation_rules(...) I only get one of the rules (the last one).I also tried creating new unbroken rules and activating and deactivating them, no difference.

actualautomationrules.png

listautomationrulesoutput.png

jmyzk_cloudsmart_en ✭✭✭✭
05/09/23
Hello.

Unfortunately,The Smartsheet API does not support creating or updating workflow automation rules other than approvals, notifications, and update requests.

https://smartsheet.redoc.ly/tag/automationRulesDescription

Automation is a collective term for approvals, notifications, and update requests. You can delete, update, and retrieve various automation settings through the API.You cannot create new automation rules programmatically.

It's a real shame that there is no API support for all workflow rules.For your reference,Smarthseet API does not support 'form'.

My suggested use of the Sheet Summary field is for manual editing of workflow rules, not for API usage.

When manually copying a sheet, the copied sheet has a valid workflow that includes copy and move row actions.Consider the tradeoffs between manually copying sheets and manually editing workflows.

Dorset
05/09/23
@jmyzk_cloudsmart_jp ,

Admittedly not the best news for my project, but nevertheless I am very grateful for your knowledge on this topic.

Summary

Copying a sheet using the Smartsheet API can cause issues with the row copy, move automation rules.As a solution to this problem, we replied that we would copy it to the Sheet Summary, save the sheet name in the destination, and use it to manually edit the workflow, and copy the sheet that includes the workflow that does not use the API. .This is a problem due to API limitations, and other users considering using the API should understand this limitation and consider workarounds.

Leave a comment