使用Tooling API在Salesforce中创建自定义字段

时间:2018-05-31 06:44:31

标签: api salesforce

我正在尝试使用Salesforce中的Tooling API创建自定义字段。首先检查Tooling API,我尝试使用workbench,但它显示以下错误:

JSON解析器错误: 消息:无法从VALUE_STRING值文本反序列化complexvalue的实例,或者请求可能缺少[line:5,column:25]中的必填字段 errorCode:JSON_PARSER_ERROR

以下是我正在使用的JSON正文:

{
    "DeveloperName" : "CusField",
    "Metadata":
        {
            "type" : "text",
            "description" : "test",
            "inlineHelpText" : "testhelp",
            "label" : "cus Field",
            "required" : false,
            "precision" : null,
            "length" : 255,
            "unique" : false,
            "externalId" : false,
            "trackHistory" : false
        },
    "TableEnumOrId" : "Account",
    "ManageableState" : "installed"

}

请告诉我身体有什么问题? 在此先感谢。

1 个答案:

答案 0 :(得分:0)

身体有些毛病。

  • 删除ManageableState
  • 不包括DeveloperName和TableEnumOrId,而是使用FullName,如下所示
  • 大写字段类型func showCredentials() { let credential = FacebookAuthProvider.credential(withAccessToken: FBSDKAccessToken.current().tokenString) Auth.auth().signInAndRetrieveData(with: credential) { (AuthDataResult, error) in if error != nil { print("Something went wrong with our Facebook User: ", error) return } FBSDKGraphRequest(graphPath: "/me", parameters: ["fields": "id, name, email"]).start { (connection, graphResult, error) in if error != nil { print("Failed to Start Graph Request:", error) return } print(graphResult) let facebookDetail = graphResult as! NSDictionary let userID = facebookDetail["id"] let fullName = facebookDetail["name"] let email = facebookDetail["email"] let providerName = "Facebook" let userValues = (["Email": email, "Full Name": fullName, "UID": userID, "Provider":providerName]) let databaseRef = Database.database().reference() let key = databaseRef.child("node").childByAutoId().key ?? "" let childUpdates = ["/Users/\(userID))/": userValues] databaseRef.updateChildValues(childUpdates) print(userID!) print(fullName!) let firebaseID = Auth.auth().currentUser?.uid print(firebaseID!) DispatchQueue.main.async { print("Successfuly logged in with our Facebook User: ", AuthDataResult) self.performSegue(withIdentifier: "FacebookSegue", sender: self) } } } }

这是一个工作岗位:

Text