wpsjs-多维表 获取上传文件的外网链接脚本-自动化流程
分享一个多维表单行执行代码,代码自己拿去改造一下即可
wpsjs-多维表 获取上传文件的外网链接脚本-自动化流程
| 💡 | //let id = Context.argv.id //let shtid= Context.argv.sheetId let shtid=Application.Selection.GetActiveView().sheetId
function fetchAllRecords() { const view = Application.Selection.GetActiveView() let all = [] let offset = null; while (all.length === 0 || offset) { let records = Application.Record.GetRecords({ SheetId: view.sheetId, ViewId: view.viewId, Offset: offset, }) offset = records.offset all = all.concat(records.records) } console.log(all) return all } var arr=fetchAllRecords() arr.forEach(ar=>{ console.log(ar) //console.log(ar.fields.hasOwnProperty("图片和附件")) if(ar.fields.hasOwnProperty("图片和附件")){
console.log(ar.fields.图片和附件[0].fileName) console.log(ar.id) //获取文件的外网链接 var resultURL = Application.Record.GetAttachmentURL({ UploadId: ar.fields.图片和附件[0].uploadId, Source: "upload_ks3" })
//更新行记录 var re = Application.Record.UpdateRecords({ SheetId: shtid, Records: [{ id: ar.id, fields: { 文件名: ar.fields.图片和附件[0].fileName, 文件外网链接:resultURL } }], }) } }) |
Lv.1 新人创作者