• kelly.lu1.3940702104676975E12
  • NEWBIE
  • 20 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 4
    Replies
I want to get the recordtype or other fields in javascript on custom button the example code as next: How to get the recordtypeId  from the for loop?



{!REQUIRESCRIPT("/soap/ajax/25.0/connection.js")}
var url = parent.location.href;
var records = {!GETRECORDIDS($ObjectType.Account)};
var updateRecords = [];

if (records[0] == null) {
    alert("Please select at least one record to update.");
} else {
   for (var a=0; a < records.length; a++) {
     var update_Item = new sforce.SObject("Account");
     update_Item.Id = records[a];
     update_Item.MyCustomField__c = "My Special Value";
     updateRecords.push(update_Item);
   }
   //This line does the actual update
   result = sforce.connection.update(updateRecords);
      
   //Now check if there are any errors
   var hasErrors = false;
   var errorReport = "The following Accounts could not be updated:\n";
   for (var j = 0; j < result.length; j++) {
          if (!result[j].getBoolean("success")) {
            hasErrors = true;
            errorReport += ("AccountId: " + updateRecords[j].Id + ", error: " + result[j].errors.message + "\n");
            if (j == 10 && j < result.length) {
              errorReport += ("Maximum errors to display.  Will show first 10 out of " + "result.length\n");
              break;
            }
          }
        }

   if (hasErrors) {
     alert(errorReport);
   }
   parent.location.href = url;
}
I want to update user's public group when account changed or user profile changed.How can I dynamatic update it through trigger?
Can anyone help me to find out if can display the custom link or Formula field in new case page in custom portal?
I want to get the recordtype or other fields in javascript on custom button the example code as next: How to get the recordtypeId  from the for loop?



{!REQUIRESCRIPT("/soap/ajax/25.0/connection.js")}
var url = parent.location.href;
var records = {!GETRECORDIDS($ObjectType.Account)};
var updateRecords = [];

if (records[0] == null) {
    alert("Please select at least one record to update.");
} else {
   for (var a=0; a < records.length; a++) {
     var update_Item = new sforce.SObject("Account");
     update_Item.Id = records[a];
     update_Item.MyCustomField__c = "My Special Value";
     updateRecords.push(update_Item);
   }
   //This line does the actual update
   result = sforce.connection.update(updateRecords);
      
   //Now check if there are any errors
   var hasErrors = false;
   var errorReport = "The following Accounts could not be updated:\n";
   for (var j = 0; j < result.length; j++) {
          if (!result[j].getBoolean("success")) {
            hasErrors = true;
            errorReport += ("AccountId: " + updateRecords[j].Id + ", error: " + result[j].errors.message + "\n");
            if (j == 10 && j < result.length) {
              errorReport += ("Maximum errors to display.  Will show first 10 out of " + "result.length\n");
              break;
            }
          }
        }

   if (hasErrors) {
     alert(errorReport);
   }
   parent.location.href = url;
}
I want to update user's public group when account changed or user profile changed.How can I dynamatic update it through trigger?
Can anyone help me to find out if can display the custom link or Formula field in new case page in custom portal?