批量上传文件到特定联系人 Salesforce [英] Mass Upload Files To Specific Contacts Salesforce

查看:45
本文介绍了批量上传文件到特定联系人 Salesforce的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要向 Salesforce 中的特定用户上传大约 2000 个文档.我有一个 csv 文件,其中包含 Salesforce 分配的 ContactID,以及我桌面上文件的直接路径.每个联系人的特定文件 url 已包含在 csv 中.如何将它们全部上传,尤其是上传到正确的联系人?

解决方案

您在评论/聊天中表示您希望将其作为文件".

文件"对象比附件复杂一点,您需要分 2-3 个步骤来完成.您看到的文件(您可能会在文档中将其称为 Chatter Files 或 Salesforce Content)实际上是几个表.有

  • 这是我的第 1 部分加载文件

    Title PathOnClient VersionData"Lightning Components CheatSheet" "C:\stacktest\SF_LightningComponents_cheatsheet_web.pdf" "C:\stacktest\SF_LightningComponents_cheatsheet_web.pdf""流程自动化备忘单" "C:\stacktest\SF_Process_Automation_cheatsheet_web.pdf" "C:\stacktest\SF_Process_Automation_cheatsheet_web.pdf""管理员备忘单" "C:\stacktest\SF_S1-Admin_cheatsheet_web.pdf" "C:\stacktest\SF_S1-Admin_cheatsheet_web.pdf""S1 CheatSheet" "C:\stacktest\SF_S1-Developer_cheatsheet_web.pdf" "C:\stacktest\SF_S1-Developer_cheatsheet_web.pdf"

    Fire Data Loader,选择插入,选择显示所有 Salesforce 对象.查找内容版本.加载应该很简单(如果您遇到内存问题,请将批处理大小设置为较低的值,如果确实需要,甚至可以一次设置 1 条记录).

    你会得到一个成功文件",它没用.我们不需要生成的内容版本的 ID,我们需要它们的父级...在数据加载器中触发导出",再次选择所有对象,选择 ContentDocument.使用类似这样的查询:

    选择 ID、标题、文件类型、文件扩展名从内容文档WHERE CreatedDate = TODAY AND CreatedBy.FirstName = 'Ethan'

    您应该会看到如下内容:

    "ID","TITLE","FILETYPE","FILEEXTENSION""0690g0000048G2MAAU","Lightning Components CheatSheet","PDF","pdf""0690g0000048G2NAAU","过程自动化备忘单","PDF","pdf""0690g0000048G2OAAU","管理员备忘单","PDF","pdf""0690g0000048G2PAAU","S1 备忘单","PDF","pdf"

    使用 Excel 和 VLOOKUP 的魔法或其他类似的东西将它们按标题链接回联系人.您写道,您已经有一个包含联系人 ID 和标题的文件,因此有希望...创建一个这样的文件:

    ContentDocumentId LinkedEntityId ShareType 可见性0690g0000048G2MAAU 0037000000TWREI V 内部用户0690g0000048G2NAAU 0030g000027rQ3z V 内部用户0690g0000048G2OAAU 0030g000027rQ3a V 内部用户0690g0000048G2PAAU 0030g000027rPz4 V 内部用户

    第一列是文件 ID,然后是联系人 ID,然后是一些关于 & 的黑魔法.如果需要,请在

    I need to upload some 2000 documents to specific users in salesforce. I have a csv file that has the Salesforce-assigned ContactID, as well as a direct path to the files on my desktop. Each contact's specific file url has been included in the csv. How can I upload them all at one and, especially, to the correct contact?

    解决方案

    You indicated in the comments / chat that you want it as "Files".

    The "Files" object is bit more complex than Attachments, you'll need to do it in 2-3 steps. What you see as a File (you might see it referred to in documentation as Chatter Files or Salesforce Content) is actually several tables. There's

    • ContentDocument which can be kind of a file header (title, description, language, tags, linkage to many other areas in SF - because it can be standalone, it can be uploaded to certain SF Content Library, it can be linked to Accounts, Contacts, $_GOD knows what else)
    • ContentVersion which is well, actual payload. Only most recent version is displayed out of the box but if you really want you can go back in time
    • and more

    The crap part is that you can't insert ContentDocument directly (there's no create() call in the list of operations) .


    Theory

    So you'll need:

    1. Insert ContentVersion (v1 will automatically create for you parent ContentDocuments... it does sound bit ass-backwards but it works). After this is done you'll have a bunch of standalone documents loaded but not linked to any Contacts
    2. Learn the Ids of their parent ContentDocuments
    3. Insert ContentDocumentLink records that will connect Contacts and their PDFs


    Practice

    This is my C:\stacktest folder. It contains some SF cheat sheet PDFs.

    Here's my file for part 1 of the load

    Title   PathOnClient    VersionData
    "Lightning Components CheatSheet"   "C:\stacktest\SF_LightningComponents_cheatsheet_web.pdf"    "C:\stacktest\SF_LightningComponents_cheatsheet_web.pdf"
    "Process Automation CheatSheet" "C:\stacktest\SF_Process_Automation_cheatsheet_web.pdf" "C:\stacktest\SF_Process_Automation_cheatsheet_web.pdf"
    "Admin CheatSheet"  "C:\stacktest\SF_S1-Admin_cheatsheet_web.pdf"   "C:\stacktest\SF_S1-Admin_cheatsheet_web.pdf"
    "S1 CheatSheet" "C:\stacktest\SF_S1-Developer_cheatsheet_web.pdf"   "C:\stacktest\SF_S1-Developer_cheatsheet_web.pdf"
    

    Fire Data Loader, select Insert, select showing all Salesforce objects. Find ContentVersion. Load should be straightforward (if you're hitting memory issues set batch size to something low, even 1 record at a time if really needed).

    You'll get back a "success file", it's useless. We don't need the Ids of generated content versions, we need their parents... Fire "Export" in Data Loader, pick all objects again, pick ContentDocument. Use query similar to this:

    Select Id, Title, FileType, FileExtension
    FROM ContentDocument
    WHERE CreatedDate = TODAY AND CreatedBy.FirstName = 'Ethan'
    

    You should see something like this:

    "ID","TITLE","FILETYPE","FILEEXTENSION"
    "0690g0000048G2MAAU","Lightning Components CheatSheet","PDF","pdf"
    "0690g0000048G2NAAU","Process Automation CheatSheet","PDF","pdf"
    "0690g0000048G2OAAU","Admin CheatSheet","PDF","pdf"
    "0690g0000048G2PAAU","S1 CheatSheet","PDF","pdf"
    

    Use Excel and magic of VLOOKUP or other things like that to link them back by title to Contacts. You wrote you already have a file with Contact Ids and titles so there's hope... Create a file like that:

    ContentDocumentId   LinkedEntityId  ShareType   Visibility 
    0690g0000048G2MAAU  0037000000TWREI V   InternalUsers
    0690g0000048G2NAAU  0030g000027rQ3z V   InternalUsers
    0690g0000048G2OAAU  0030g000027rQ3a V   InternalUsers
    0690g0000048G2PAAU  0030g000027rPz4 V   InternalUsers
    

    1st column is the file Id, then contact Id, then some black magic you can read about & change if needed in ContentDocumentLink docs.

    Load it as insert to (again, show all objects) ContentDocumentLink.

    Woohoo! Beer time.

    这篇关于批量上传文件到特定联系人 Salesforce的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆