通过集成自定义API上传附件到单据(参考)
1 业务背景
外部通过接口上传附件到星瀚,并且将附件绑定到指定单据。
适用者:集成中高级开发,熟悉集成自定义API和集成服务流程。
使用帮助手册查看DataFile.uploadAndBind和executeServiceFlow和$action
2 解决方案
2.1 方案总述
通过配置集成自定义API,接受外部传入附件,通过固定脚本样式解析字节数组,然后通过DataFile.uploadAndBind绑定到指定单据。下面会有逐行注释解析和使用注意事项。
2.2 实现步骤
var file = FastJsonParse(FastJsonFormat(REQ));//反序列化解析REQ,保存文件上下文。REQ是自定义API输入 var content = Base64Decode(file.fileData);//通过Base64解码文件内容 var fileName= file.fileName; var map={ "entityName":"isc_demo_basedata_1", "entityPk":2022614386333507584,//绑定单据ID,如果单据在系统中还未生成,通过$action字段保存,如果很复杂则通过executeServiceFlow同步调用服务流程,处理好单据生成后将单据id返回 "field":"attachmentpanelap", "fileName":fileName, "content":content, "appId":"iscb", "formId":"isc_demo_basedata_1" }; var result = DataFile.uploadAndBind(map);
注意:未标注注释行参考帮助手册,附录提供自定义API供参考。PostMan调试参考
({"outputs":[{"output_data_type":"unknown","output_description":"1","output_field":"result","output_is_array":false,"id":"2022611434231310338","seq":1 ,"$id":"2022611434231310338","$pk":"id"}],"in_digest":"","wsinputparam":"","source_tenant":"tenant_bos_baseline_a_test","record_log":true,"not_publish":false,"modifytime":"2024-08-22 16:29:29.414","inputs":[{"input_data_type":"unknown","input_description":"1","input_field":"REQ","input_is_array":false,"default_value":"","id":"2022611434231355392","seq":1 ,"required":false,"$id":"2022611434231355392","$pk":"id"}],"description":"","preset":false,"isv":"kdtest","protect_level":"DEFAULT","number":"upLoadFileDemo","masterid":"2022611434113914880","auth_required":false,"enable":"1","id":"2022611434113914880","$entityname":"isc_apic_script","$pk":"id","group":null,"is_publish":false,"createtime":"2024-08-22 16:06:28.026","out_digest":"","wsoutputparam":"","resources":[],"$isref":false,"omit_empty_params":false,"script":"//","script_tag":"var file = FastJsonParse(FastJsonFormat(REQ));\r\nRES = file.fileData;\r\n\r\nvar content = String.getBytes2(String(Base64Decode(file.fileData)), 'utf-8');\r\nvar fileName= file.fileName; \r\nvar map={\r\n \"entityName\":\"isc_demo_basedata_1\",\r\n \"entityPk\":2022614386333507584,\r\n \"field\":\"attachmentpanelap\",\r\n \"fileName\":file.fileName,\r\n \"content\":content,\r\n \"appId\":\"iscb\",\r\n \"formId\":\"isc_demo_basedata_1\"\r\n};\r\nvar result = DataFile.uploadAndBind(map);","group_id":"0","name":{"zh_TW":"upLoadFileDemo","zh_CN":"upLoadFileDemo"},"namespace":"","disable_trace":false,"openapi_version":"2","$id":"2022611434113914880","status":"C","source_trace":"tenant_bos_baseline_a_test;"})
3 相关文档
脚本帮助手册:https://developer.kingdee.com/article/224487940015890432?productLineId=29&isKnowledge=2&lang=zh-CN
通过集成自定义API上传附件到单据(参考)
1 业务背景外部通过接口上传附件到星瀚,并且将附件绑定到指定单据。适用者:集成中高级开发,熟悉集成自定义API和集成服务流程。使用帮助...
点击下载文档
上一篇:苍穹事件触发不生效问题分析下一篇:连接配置(smtp)
本文2024-09-23 00:48:01发表“云苍穹知识”栏目。
本文链接:https://wenku.my7c.com/article/kingdee-cangqiong-141818.html
您需要登录后才可以发表评论, 登录登录 或者 注册
最新文档
热门文章