You need to sign in to do that
Don't have an account?
BERNARDO
inscrip.Class__c=claseValue[1];
inscrip.Contact__c=recordIds[i];
inscrip.Status__c= "Inscrito";
result = sforce.connection.create([inscrip]);
}
} else {
alert("No records selected"); //runs ok if no records were selected
}
} catch (e) {
alert("ERROR "+e);
}
(Newbie) Problems populating custom object
Hi all.
I'm new to salesforce development, and I am trying to implement a custom button into Contact search layout and populate a custom object (including Contact Id). The part of the code where error appears is:
try {
var recordIds = {!GETRECORDIDS($ObjectType.Contact)};
if (recordIds.length > 0) {
for (var i=0; i<recordIds.length ; i++) {
var recordIds = {!GETRECORDIDS($ObjectType.Contact)};
if (recordIds.length > 0) {
for (var i=0; i<recordIds.length ; i++) {
// This is the line that causes the catch ("ERROR [object Error]")
//
inscrip = new sforce.SObject("SFDC_Enrollment__c");
inscrip = new sforce.SObject("SFDC_Enrollment__c");
//
//
inscrip.Class__c=claseValue[1];
inscrip.Contact__c=recordIds[i];
inscrip.Status__c= "Inscrito";
result = sforce.connection.create([inscrip]);
}
} else {
alert("No records selected"); //runs ok if no records were selected
}
} catch (e) {
alert("ERROR "+e);
}
I'm not sure if it is because I'm trying to create a custom object (BTW, the script is larget and it goes fine up to these lines). I will appreciate any thoughts or ideas.
Thanks in advance.
Bernardo
Hi Sean, and thanks for the quick reply.
The error message is simply "[object Error]".
The custom object's API name is "SFDC_Enrollment__c" and it is properly spelled .
Unfortunately I couldn't find other answers in this board related to this issue (in fact I didn't find other discussion related to problems with custom object creation). A question: can a custom object NOT be "createable"? Where should I make sure SFDC_Enrollment__c is createable?
BTW, I probably erased the "var" word when I wrote the "//"'s. The line is:
var inscrip = new sforce.SObject("SFDC_Enrollment__c");
Thanks again!
Bernardo