function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Rohit TripathiRohit Tripathi 

Upserting data in SOUP - Mobile SDK Hybrid

Hi All,

I am doing Hybrid Mobile App Development using Xcode and I am trying to populate data in Sample SOUP. Code in my index.html file is as :

Register Soup :

function registerSoup(){
                        var soupName = "SOUP_1";
                        var indexSpecs = [
                                          {path:"Id",type:"string"},
                                          {path:"Name",type:"string"},
                                          ];
                                          sfSmartstore().registerSoup(soupName, indexSpecs, successCallback, errorCallback);
                    }

Populating Soup :

function createRecords(){
                    var dummyRecords = [{
                    "Name": "My Dummy Record",
                    "Id": "123456789012345678",
                    "Something": "Nothing"
                    },{
                    "Name": "Another Record",
                    "Id": "876543210987654321",
                    "Something": "Something Else"
                    }];
                    smartstore.upsertSoupEntriesWithExternalId("SOUP_1",dummyRecords, "Id", function(){
                                   alert("Upsert Success");},
                                   function(error){
                                        alert("onErrorUpsert using force.query : " + error);
                                         });
                        
            }

After running this code in simulator, it is either not showing any output or alerting "onErrorUpsert using force.query : null". It is not upserting data in SOUP. 
I am not sure what is wrong. Can you please help.