+ Start a Discussion

Add new Object with Master-Object with iOS-SDK

Hi Guys,

I'm pretty new to salesforce and haven't worked with it before. I'm currently writing an iPhone Application using the salesforce iOS SDK.


In Salesforce we have an Object "Zeiterfassung__c" with a Master-Object "Kontierungsmonat__c". 

Now I'm trying to create a new Object by using  requestForCreateWithObjectType. Unfortuantly it fails because i don't have the right ObjectID for Master-Object i want to set up the relation to.


Is there any chance to receive the Object ID from the Master-Object? I can query a list of all Objects from type "Kontierungsmonat__c". But "Kontierungsmonat__c" doesn't have a ID field :(


Let me know if you have any questions.


Thanks for your help!







just the clear things:


       NSMutableDictionary *fields = [[NSMutableDictionary alloc] init ];
        [fields setObject:kontmonat forKey:@"Kontierungsmonat__c"];
        [fields setObject:date forKey:@"Tag__c"];
        [fields setObject:self.kStd forKey:@"Von_Stunde__c"];
        [fields setObject:self.kMin forKey:@"Von_Minute__c"];
        [fields setObject:self.gStd forKey:@"Bis_Stunde__c"];
        [fields setObject:self.gMin forKey:@"Bis_Minute__c"];
        [fields setObject:sumPauseStr forKey:@"Pause__c"];
        [fields setObject:beschr forKey:@"Taetigkeitsbeschreibung__c"];
        NSNumber *sendBool = [NSNumber numberWithBool:segment];
        [fields setObject:sendBool forKey:@"Remote__c"];  

        SFRestRequest *request = [[SFRestAPI sharedInstance] requestForCreateWithObjectType:objId fields:fields];
        [[SFRestAPI sharedInstance] send:request delegate:self];   


thats the Request which fails with:  

(com.salesforce.RestAPI.ErrorDomain error 999.)" UserInfo=0x6e33eb0 {message=Kontierungsmonat: unzulässiger Typ des ID-Werts: 201201-442, errorCode=MALFORMED_ID, fields=(




Currently I'm using a field which has the primary key in it. But is guess i need the Object-ID right? Is there a way to get it via the REST Api? 






Hi Daniel,


Probably the best way to debug this would be to start with the RestExplorer and plug in the request you're trying to make.  What I do is typically find the IDs I'm interested in (either via the website or by dumping them out with eg NSLog), and then plug those values into RestExplorer to verify my requests. 


You can copy/paste complex values from your Mac into the RestExplorer running on a simulator.  


Hope this helps...