Salesforce Rest Request,插入数据

时间:2012-02-06 05:26:20

标签: objective-c salesforce

我正在使用salesforce iphonesdk,我想知道是否有人知道如何将数据提交到salesforce对象,比如使用INSERT?使用哪种方法?

3 个答案:

答案 0 :(得分:1)

您需要使用create()调用,将SObjects数组传递给插入 - see the documentation here

您应该阅读参考资料的“入门”部分,尤其是API Call Basics。你的问题表明相当缺乏研究,我建议你确保自己研究一些问题,然后再询问有关stackoverflow的问题,如果你不想让它被关闭的话。如果您已阅读文档并仍然不了解如何做某事,那么您就可以寻求帮助了!

答案 1 :(得分:1)

Swift 版本:

  1. 您的控制器类应符合RestClientDelegate协议
  2. data是要插入的字典(对象)
let data = ["Percentage__c": "1", "Amount__c":"11", "Volume__c":"111", "Promotion_Details__c": "00112233"]
let request = RestClient.shared.requestForCreate(withObjectType: "<your_table_name_>", fields: data)

RestClient.shared.send(request, delegate: self)

另一种方式:

如果您不想遵守RestClientDelegate,只需致电:

RestClient.shared.send(request: request, onFailure: { (err, res) in
            // some closure to handle error
        }) { (any, res) in
            // another closure to handle error
        }

答案 2 :(得分:0)

在Lacey Snr的指导下, 找到了我自己的答案

NSMutableDictionary *dic = [[NSMutableDictionary alloc]init];
[dic setObject:@"Smith" forKey:@"Name_c"];
[dic setObject:@"5" forKey:@"PAX_c"];
SFRestRequest *request = [[SFRestAPI sharedInstance] 
                          requestForCreateWithObjectType:@"Booking_Forms_c" fields:dic];
[[SFRestAPI sharedInstance] send:request delegate:self];