0

I'm using the salesforce iphonesdk, I wonder if anybody knows how to submit data into the salesforce object, like using INSERT ? Which method is to be used?

3 Answers 3

1

You need to use the create() call, passing it an array of SObjects to insert — see the documentation here.

You should probably read the Getting Started section of the reference material, especially the API Call Basics. Your question demonstrates a considerable lack of research, and I'd advise making sure you do research things yourself before asking a question on stackoverflow if you don't want it to be closed out. If you've read the documentation and still don't understand how to do something, then you're in a good position to ask for help!

1

Swift version:

  1. Your controller class should conform to RestClientDelegate protocol
  2. data is the dictionary(object) to be inserted
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)

Another Way:

If you don't want to conform to RestClientDelegate, simply call:

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

With guidance by Lacey Snr, Found my own answer

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];

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.