• BERNARDO
  • NEWBIE
  • 0 Points
  • Member since 2007

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 2
    Replies
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++) {
 
// This is the line that causes the catch ("ERROR [object Error]")
//
   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 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++) {
 
// This is the line that causes the catch ("ERROR [object Error]")
//
   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