我必须做什么才能通过复制工作区来复制工作表的工作流程?
为了自动化我的一些工作,我正在深入研究 javascript 和 smartsheet-api,... 我编写了一个脚本,通过使用新的工作空间名称复制整个工作空间来设置工作空间。与不同的人共享工作区,与其他人共享单独的工作表,在新生成的工作表之间生成一些链接,...
其中一些操作并不像我想象的那么容易,...尽管如此,最后它起作用的那天。
但现在我发现,工作表的工作流程没有被复制,...复制的工作表中没有工作流程。
我使用 Node 作为我的 javascript 运行时环境。
//-------------------------------------------------------------------------------------
// prepare copying the workspace
// ------------------------------
var body = { newName: workspaceName }; // store the workspaceName from the function-parameters in the body-object
var params = { include: "all, rules, ruleRecipients", skipRemap: "" }; // set parameters
var options = { workspaceId: sourceWorkspaceID, body: body, queryParameters: params }; // create the options-object with all the settings above
//--------------------------------------------------------------------------------------
try { // Try copying workspace
copiedWorkspace = await ss.workspaces.copyWorkspace(options); // ---------------------
console.log('setupTheWorkspace: Workspace wurde kopiert.');
} catch (e) {
console.log('setupTheWorkspace: Workspace konnte nicht kopiert werden.');
console.log(e);
上面的代码显示了方法,我进行复制。首先,我尝试仅使用“all”作为包含参数,然后将“rules,ruleRecipients”添加到包含参数中,但无济于事。
我必须做什么才能通过复制工作区来复制工作表的工作流程?
To automate some work of mine, i'm diving into javascript and the smartsheet-api, ...
I wrote a script that sets up a workspace by copying the whole workspace with a new workspacename. Sharing the workspace to different people, share individual sheets to other people, generate some links to and from the newly generated sheets, ...
Some of these actions weren't as easy, as I thought, ... Nevertheless, at the end of the day it worked.
But now I found out, that the workflows of the sheets weren't copied, ... there are no workflows in the sheets copied.
I'm using node as my javascript-runtime-environment.
//-------------------------------------------------------------------------------------
// prepare copying the workspace
// ------------------------------
var body = { newName: workspaceName }; // store the workspaceName from the function-parameters in the body-object
var params = { include: "all, rules, ruleRecipients", skipRemap: "" }; // set parameters
var options = { workspaceId: sourceWorkspaceID, body: body, queryParameters: params }; // create the options-object with all the settings above
//--------------------------------------------------------------------------------------
try { // Try copying workspace
copiedWorkspace = await ss.workspaces.copyWorkspace(options); // ---------------------
console.log('setupTheWorkspace: Workspace wurde kopiert.');
} catch (e) {
console.log('setupTheWorkspace: Workspace konnte nicht kopiert werden.');
console.log(e);
The code above shows the way, I do the copying. First I tried it with only "all" as the include-param, then I added "rules, ruleRecipients" to the include-param, but to no avail.
What do I have to do, that the worklows of the sheets are copied by copying the workspace?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
一些评论:
复制工作区的 Smartsheet API 文档 操作将
include
参数的all
值描述为 已弃用。通常建议避免使用标记为“已弃用”的任何内容。include
参数的值不应包含任何空格。我怀疑这是您问题的根源 - 即 Smartsheet 无法识别包含前导空格的值 - 例如'rules'
或'ruleRecipients'
-因此忽略它们。如果我正确理解文档,如果您想不重新映射新创建的工作区中的某些引用,则只需指定
skipRemap
参数即可。指定该参数为空值是没有意义的——如果您不打算为其指定值,我建议您将其删除。以下代码行反映了这些建议:
var params = { include: "rules,ruleRecipients" };
注意:如果您希望将其他内容(工作流程除外)复制到新工作区,请务必向
include
参数添加其他值。该文档包含所有有效值的列表。请确保逗号分隔的值列表中不包含任何空格。下面是一些成功复制工作区的示例代码(并指定
include
参数的所有值)。A few comments:
The Smartsheet API docs for the Copy Workspace operation describe the
all
value of theinclude
parameter as deprecated. It's generally recommended to avoid using anything that's marked as 'deprecated'.The value of the
include
parameter should not contain any spaces. I suspect this is the source of your issue -- i.e., Smartsheet is not recognizing values that contain a leading space -- e.g.,' rules'
or' ruleRecipients'
-- and therefore is ignoring them.If I'm understanding the docs correctly, you only need to specify the
skipRemap
parameter if you want to NOT remap certain references in the newly created workspace. Specifying that parameter with an empty value doesn't make sense -- I'd suggest you remove it if you're not going to specify a value for it.Here's the line from your code that reflects these recommendations:
var params = { include: "rules,ruleRecipients" };
Note: Be sure to add additional values to the
include
parameter if you want other stuff (besides workflows) to be copied to the new workspace. The docs contain a list of all valid values. And be sure to NOT include any spaces in the comma-delimited list of values.Here's some sample code that successfully copies a workspace (and specifies all values of the
include
parameter).