• PaulMac
  • NEWBIE
  • 50 Points
  • Member since 2009

  • Chatter
    Feed
  • 2
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 11
    Questions
  • 17
    Replies

Currently my related list shows 3 lines of a custom "Comment" field. I would like it to show more or all of the lines. Is this possible?

 

thanks,

Paul

Hi,

 

I have a custom object which has a lookup field called "Assigned To". Next to this field I would like to see a hyperlink similar to the [Change Owner] link on the standard Owner field.

 

It would look like this

 

Onwer: Joe Blow [Change]  <-- this works now

Assigned To: Jane Doe [Change]

 

Is this possible?

 

thanks,

Paul

Just hoping someone could get me started with the proper syntax or psuedo code.

 

The trigger should fire on Account "Before Insert"

 

On the incoming record, first I want to check if there's a value present for a particular field...say Account.MyIndustry__c

 

(If the length of MyIndustry__c is 0, I can exit the trigger)

 

If so, then do a lookup for this value on another table (object)

select NewIndustry__c
        from IndustryLookupTable__c
        where IndustryLookupTable__c.Name = (this incoming MyIndustry__c value)

 

Then append this found value in Account.Industry

 

In English, trying to insert a record where MyIndustry__c = "Auto Parts Manufacturing". The lookup for this value in IndustryLookupTable__c is = "Manufacturing". So I want "Manufacturing" inserted to Account.Industry

 

Thanks for any help you can offer!

I am trying to set up an email template that uses a component which references a class. I think I'm very close, but I can't seem to pass the argument to the class. Any help would be greatly appreciated.

 

If I replace :partnerid in the class with an actual string value....it all works fine.

 

The Class

//```````````````````````````````````````````````````````````````

public with sharing class findPartnerAccountsByPartnerName {

private final List<Account> accounts;

public String partnerid {
      get; set;
    }    

public findPartnerAccountsByPartnerName() {
    
accounts = [select Name,ShippingCity,ShippingState,ShippingPostalCode,
            Type,industry,ShippingCountry,partner_id__c from Account

where Partner_ID__c = :partnerid
 and Inactive_Account__c = False
order by type asc, Name asc];

}
public List<Account> getAccounts() {
return accounts;
}

}

 

//````````````````````````````````````````````````````````````````

 

The Component (snipet)

<apex:component controller="findPartnerAccountsByPartnerName" access="global">
<apex:attribute name="mypartnerid"
    description="This is the ID of the partner."
    type="String" assignTo="{!partnerid}" />
<apex:dataTable cellspacing="5"  value="{!Accounts}" var="a">

 

//````````````````````````````````````````````````````````````````

 

The Email Template

<messaging:emailTemplate subject="Current List of Tactician Customers and Prospects"
 recipientType="Contact" relatedToType="Account"
>
<messaging:htmlEmailBody >
 <html>
 <body >
<p>Below is a list of ...</p>

<c:PartnerCustomers mypartnerid="{!relatedTo.PartnerConnect__c}">
</c:PartnerCustomers>

</body>
</html>
</messaging:htmlEmailBody>
</messaging:emailTemplate>

 

I'm trying to send an automatic email with Schedule Apex Code. Still learning Apex. The class seems to complile fine:

 

Global class SendOpenCasesEmail_CompanyX implements Schedulable{

global void execute (SchedulableContext SC){

 {   
 Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
  mail.setTargetObjectId('0035000000d0APT'); //email recipient id
  mail.setTemplateId('00X500000013ngY'); //email template id
  String[] bccaddress = new String[]{'paulmac106@gmail.com'};
  mail.setBccAddresses(bccaddress);
  mail.setWhatID('0015000000KJImA'); //account id (show cases for this account)
 Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
}
}
}

 

But when the sceduler tries to run the job I get this email:

 

Apex script unhandled exception by user/organization: 00550000001Esxxx/00D500000007xxx

 

Scheduled job 'SendVal' threw unhandled exception.

 

caused by: System.EmailException: SendEmail failed. First exception on row 0; first error: UNKNOWN_EXCEPTION, java.lang.NullPointerException: Argument Error: Parameter value is null: []

 

Class.SendOpenCasesEmail_CompanyX.execute: line 12, column 2 External entry point

 

Any help with what I'm doing wrong would be greatly appreciated.

 

thanks!!

 

  • September 02, 2010
  • Like
  • 0

Hi,

 

Just looking for some help with how to set up a test class for a class that simply sends an email.

 

My Code:

 

global

 

class SendOpenCasesEmail_CompanyName implements Schedulable {

global

}

 

void execute (SchedulableContext SC){

public

{Messaging.SingleEmailMessage mail =

mail.setTargetObjectId(

void SendEmail()new Messaging.SingleEmailMessage();'0035000000RXXXc'); //email recipient id

mail.setTemplateId(

'00X5000000XXXgY'); //email template id

String[] ccaddress =

ccaddress.add(

ccaddress.add(

ccaddress.add(

ccaddress.add(

mail.setccAddresses(ccaddress);

mail.setWhatID(

new String[]{};'joe@abc.com');'jane@abe.com'));'0015000000XXXt4'); //account id (show cases for this account)

Messaging.sendEmail(

}

 

}

 

 

thank you!

new Messaging.SingleEmailMessage[] { mail });

 

 

Hi,

 

Can I add some kind of formatting tag to this to remove the leading zeros:

<apex:outputField value="{!cx.CaseNumber}"/>

 

the above yields: 00004788, but I would like just 4788

 

I'm using the above line in a VisualForce email template.

 

thank you!

Hi,

 

I was looking for some opinion for my approach. The goal is: when a user is entering sales order line items, if they enter certain product code, other related products should get entered. For instance, they enter a line for Product A, then ProductB, ProductC, and ProductD would automatically get entered. Normally I would put this code in the data entry form, but I don't think anything like that is available to me. The only thing I could think of was to use an AfterInsert trigger. My original try at this didn't work because the trigger had too many characters. I could probably code it better, but I want to make sure this Trigger approach is the way to go. One immediate downside is that I have to hardcode the particular product codes inside my trigger code. I'd rather do it with some kind of lookup table.

 

Any suggestions would be greatly appreciated.

 

thanks!!

I'm just looking for a high level approach to what I want to do (i.e. do I need a Trigger or a Class, or something else).

 

When a user adds a certain product code to a sales order, look for associated product codes and automatically enter them in for the user.

 

I tried a huge trigger with many Else If statements and Insert statements. Although the code seems to compile. I can't save it to the server. Looks like I violating some governer limits.

 

Ideally, I'll have Product and Associated products in a table.

 

ProductA | ProductAQuaterlyUpdate1

ProductA | ProductAQuaterlyUpdate2

ProductA | ProductAQuaterlyUpdate3

ProductA | ProductAQuaterlyUpdate4

ProductB | ProductBSemiAnnualUpdate1

ProductB | ProductBSemiAnnualUpdate2

 

Any thoughts on how I go about this?

 

thanks for your time!

Does anyone know the max length in characters an Apex trigger can be? I get a message about my trigger being too long, but the limit is not provided.

 

Thanks!

I see that I can show or hide this list, but I would like to add a field [Last Update Date] and sort by that field. Is this possible?

 

thanks,

Paul

Currently my related list shows 3 lines of a custom "Comment" field. I would like it to show more or all of the lines. Is this possible?

 

thanks,

Paul

Hi,

 

I have a custom object which has a lookup field called "Assigned To". Next to this field I would like to see a hyperlink similar to the [Change Owner] link on the standard Owner field.

 

It would look like this

 

Onwer: Joe Blow [Change]  <-- this works now

Assigned To: Jane Doe [Change]

 

Is this possible?

 

thanks,

Paul

Just hoping someone could get me started with the proper syntax or psuedo code.

 

The trigger should fire on Account "Before Insert"

 

On the incoming record, first I want to check if there's a value present for a particular field...say Account.MyIndustry__c

 

(If the length of MyIndustry__c is 0, I can exit the trigger)

 

If so, then do a lookup for this value on another table (object)

select NewIndustry__c
        from IndustryLookupTable__c
        where IndustryLookupTable__c.Name = (this incoming MyIndustry__c value)

 

Then append this found value in Account.Industry

 

In English, trying to insert a record where MyIndustry__c = "Auto Parts Manufacturing". The lookup for this value in IndustryLookupTable__c is = "Manufacturing". So I want "Manufacturing" inserted to Account.Industry

 

Thanks for any help you can offer!

I am trying to set up an email template that uses a component which references a class. I think I'm very close, but I can't seem to pass the argument to the class. Any help would be greatly appreciated.

 

If I replace :partnerid in the class with an actual string value....it all works fine.

 

The Class

//```````````````````````````````````````````````````````````````

public with sharing class findPartnerAccountsByPartnerName {

private final List<Account> accounts;

public String partnerid {
      get; set;
    }    

public findPartnerAccountsByPartnerName() {
    
accounts = [select Name,ShippingCity,ShippingState,ShippingPostalCode,
            Type,industry,ShippingCountry,partner_id__c from Account

where Partner_ID__c = :partnerid
 and Inactive_Account__c = False
order by type asc, Name asc];

}
public List<Account> getAccounts() {
return accounts;
}

}

 

//````````````````````````````````````````````````````````````````

 

The Component (snipet)

<apex:component controller="findPartnerAccountsByPartnerName" access="global">
<apex:attribute name="mypartnerid"
    description="This is the ID of the partner."
    type="String" assignTo="{!partnerid}" />
<apex:dataTable cellspacing="5"  value="{!Accounts}" var="a">

 

//````````````````````````````````````````````````````````````````

 

The Email Template

<messaging:emailTemplate subject="Current List of Tactician Customers and Prospects"
 recipientType="Contact" relatedToType="Account"
>
<messaging:htmlEmailBody >
 <html>
 <body >
<p>Below is a list of ...</p>

<c:PartnerCustomers mypartnerid="{!relatedTo.PartnerConnect__c}">
</c:PartnerCustomers>

</body>
</html>
</messaging:htmlEmailBody>
</messaging:emailTemplate>

 

I'm trying to send an automatic email with Schedule Apex Code. Still learning Apex. The class seems to complile fine:

 

Global class SendOpenCasesEmail_CompanyX implements Schedulable{

global void execute (SchedulableContext SC){

 {   
 Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
  mail.setTargetObjectId('0035000000d0APT'); //email recipient id
  mail.setTemplateId('00X500000013ngY'); //email template id
  String[] bccaddress = new String[]{'paulmac106@gmail.com'};
  mail.setBccAddresses(bccaddress);
  mail.setWhatID('0015000000KJImA'); //account id (show cases for this account)
 Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
}
}
}

 

But when the sceduler tries to run the job I get this email:

 

Apex script unhandled exception by user/organization: 00550000001Esxxx/00D500000007xxx

 

Scheduled job 'SendVal' threw unhandled exception.

 

caused by: System.EmailException: SendEmail failed. First exception on row 0; first error: UNKNOWN_EXCEPTION, java.lang.NullPointerException: Argument Error: Parameter value is null: []

 

Class.SendOpenCasesEmail_CompanyX.execute: line 12, column 2 External entry point

 

Any help with what I'm doing wrong would be greatly appreciated.

 

thanks!!

 

  • September 02, 2010
  • Like
  • 0

Hi,

 

Just looking for some help with how to set up a test class for a class that simply sends an email.

 

My Code:

 

global

 

class SendOpenCasesEmail_CompanyName implements Schedulable {

global

}

 

void execute (SchedulableContext SC){

public

{Messaging.SingleEmailMessage mail =

mail.setTargetObjectId(

void SendEmail()new Messaging.SingleEmailMessage();'0035000000RXXXc'); //email recipient id

mail.setTemplateId(

'00X5000000XXXgY'); //email template id

String[] ccaddress =

ccaddress.add(

ccaddress.add(

ccaddress.add(

ccaddress.add(

mail.setccAddresses(ccaddress);

mail.setWhatID(

new String[]{};'joe@abc.com');'jane@abe.com'));'0015000000XXXt4'); //account id (show cases for this account)

Messaging.sendEmail(

}

 

}

 

 

thank you!

new Messaging.SingleEmailMessage[] { mail });

 

 

Hi,

 

Can I add some kind of formatting tag to this to remove the leading zeros:

<apex:outputField value="{!cx.CaseNumber}"/>

 

the above yields: 00004788, but I would like just 4788

 

I'm using the above line in a VisualForce email template.

 

thank you!

Hi All,

 

I'm looking for a relatively simple solution to pull data from the SF database into Access to build some custom reports.  I've looked at OpenAccess ODBC and it works nicely but very expensive ($2000).  Also looked at Dataloader but it requires Enterprise edition and we have Professional.    DBAmp is also very expensive at $1250 per year.

 

Is there any type of lower cost solution to get access to the SF database?

 

Thanks,

 

Paul 

Hi,

 

 I would like to send a mail to  a contact when case is created.The Email contains list of cases related to account.

So i created workflow with condition(case status = new) and type is Email Alert.

 

It is working  fine when I send it from a Send Email button on a Contact detail. When trying from work flow,its sends the mail but doesn't populate any  values.

 

Code as below

<messaging:emailTemplate recipientType="Contact"  relatedToType="Account"
    subject="Case report for Account: {!relatedTo.name}">
<messaging:htmlEmailBody >
  
        <html>
            <body>
               <p>Dear {!recipient.name},</p>
               <p>Below is a list of cases related to the account: {!relatedTo.name}.</p>
         <table border="0" >
                 <tr >
                     <th>Action</th><th>Case Number</th><th>Subject</th><th>Creator Email</th><th>Status</th>
                  </tr>

                  <apex:repeat var="cx" value="{!relatedTo.Cases}">
       <tr>
           <td><a href="https://na1.salesforce.com/{!cx.id}">View</a> | 
           <a href="https://na1.salesforce.com/{!cx.id}/e">Edit</a></td>
           <td>{!cx.CaseNumber}</td>
           <td>{!cx.Subject}</td>
           <td>{!cx.Contact.email}</td>
           <td>{!cx.Status}</td>
       </tr>
    </apex:repeat>    
        </table>
    <p/>
    <center>
        <apex:outputLink value="http://www.salesforce.com">
        For more detailed information login to Salesforce.com
    </apex:outputLink>
</center>
</body>
</html>
</messaging:htmlEmailBody>
</messaging:emailTemplate>

 

Thanks for any help

 

 

 

 

 

  • January 12, 2010
  • Like
  • 0

I'm just looking for a high level approach to what I want to do (i.e. do I need a Trigger or a Class, or something else).

 

When a user adds a certain product code to a sales order, look for associated product codes and automatically enter them in for the user.

 

I tried a huge trigger with many Else If statements and Insert statements. Although the code seems to compile. I can't save it to the server. Looks like I violating some governer limits.

 

Ideally, I'll have Product and Associated products in a table.

 

ProductA | ProductAQuaterlyUpdate1

ProductA | ProductAQuaterlyUpdate2

ProductA | ProductAQuaterlyUpdate3

ProductA | ProductAQuaterlyUpdate4

ProductB | ProductBSemiAnnualUpdate1

ProductB | ProductBSemiAnnualUpdate2

 

Any thoughts on how I go about this?

 

thanks for your time!

Does anyone know the max length in characters an Apex trigger can be? I get a message about my trigger being too long, but the limit is not provided.

 

Thanks!