• IX Salesforce Admin
  • NEWBIE
  • 10 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 5
    Replies
Hello,
On accounts we have a field called Category, that field is a Picklist. I would like to create a tirgger to update child accounts Category field with the value from parent account Category field.
This is what I have so far:
 
trigger updateCategoryFromParent on Account (after insert, after update) {

    List<Account> accList = new List<Account>();

    for (Account ac : Trigger.new) {
        if(ac.ParentId != null){
            Account ap = new Account();
            account au = new Account(Id = ac.Id);
            ap.Id = ac.ParentId;
            au.Category__c = ap.Category__c;
            accList.add(au);
        }
    }
    update accList;
}

 
Hello,

we are trying to send an email using a custom button. The email is intended for a specific email address. This is the code we are using:
 
{!REQUIRESCRIPT("/soap/ajax/30.0/connection.js")}

var message = new sforce.SingleEmailMessage(); 

message.setToAddresses = 'test@test.com';
message.plainTextBody = 'It would be so awesome if this worked.';
message.setCcAddresses = 'test2@test.com';
message.setBccAddresses = 'test3@test.com';
message.setSubject = 'Data upload report';

var result = sforce.connection.sendEmail([message]); 
alert(result);

unfortunately this is the error message we are getting.

error

what are we doing wrong?


Thank you.
Hello,

I am writing code for a button to update one field in all Opportunities in our system. The way I do is this:
 
var allIDs = sforce.connection.query("SELECT Id FROM Opportunity");
....
for (i = 0; i<parseInt(allIDs.size); i++){ var opportunityID = allIDs.records[i].Id; ...


the problem is that when I get allIDs.size, the size is 2593, however, as soon as the counter hits 2000 I get an error saying that it cant read ID from unidentified, also when I took the allIDs object and analyzed it in notepad++ I saw that it actually contains only 2000 records, but it shows size of 2593.
Later on I found out that there is a 2000 record limit on these queries. What are my alternatives?

Thank you!
Hello everyone,

I am having issues getting value of the date field from the Opportunity object. I need to get Start date and End date, store them in a variable to send them as a part of an XMLH request. I have tried few things:
var startDate  = [SELECT Start_Date__c FROM Opportunity where Id = 'XYZ']; 
var startDate = {!Opportunity.Start_Date__c}; - this is a weird one I get a long number, but it's not the milliseconds, and it starts with 0.00049578....

var c = new sforce.SObject("Opportunity");
var startDate = c.Start_Date__c;

nothing works. I have a feeling I am very close, but can't quite get there. Any help apprechiated. 
 
Hello,
On accounts we have a field called Category, that field is a Picklist. I would like to create a tirgger to update child accounts Category field with the value from parent account Category field.
This is what I have so far:
 
trigger updateCategoryFromParent on Account (after insert, after update) {

    List<Account> accList = new List<Account>();

    for (Account ac : Trigger.new) {
        if(ac.ParentId != null){
            Account ap = new Account();
            account au = new Account(Id = ac.Id);
            ap.Id = ac.ParentId;
            au.Category__c = ap.Category__c;
            accList.add(au);
        }
    }
    update accList;
}

 
Hello,

we are trying to send an email using a custom button. The email is intended for a specific email address. This is the code we are using:
 
{!REQUIRESCRIPT("/soap/ajax/30.0/connection.js")}

var message = new sforce.SingleEmailMessage(); 

message.setToAddresses = 'test@test.com';
message.plainTextBody = 'It would be so awesome if this worked.';
message.setCcAddresses = 'test2@test.com';
message.setBccAddresses = 'test3@test.com';
message.setSubject = 'Data upload report';

var result = sforce.connection.sendEmail([message]); 
alert(result);

unfortunately this is the error message we are getting.

error

what are we doing wrong?


Thank you.
Hello everyone,

I am having issues getting value of the date field from the Opportunity object. I need to get Start date and End date, store them in a variable to send them as a part of an XMLH request. I have tried few things:
var startDate  = [SELECT Start_Date__c FROM Opportunity where Id = 'XYZ']; 
var startDate = {!Opportunity.Start_Date__c}; - this is a weird one I get a long number, but it's not the milliseconds, and it starts with 0.00049578....

var c = new sforce.SObject("Opportunity");
var startDate = c.Start_Date__c;

nothing works. I have a feeling I am very close, but can't quite get there. Any help apprechiated.