• girbot
  • NEWBIE
  • 0 Points
  • Member since 2008

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 13
    Replies

Hi all,

I have two Parent records that share the same Child record. I would like to be able to count the number of related Child records. Neither are master-detail records, hence the requirement for an Apex Trigger.

I have a working count trigger for the Parent records (included below for referece), but I suspect I need another trigger on the Child records in order for the Count trigger to fire?

The other question: An attendee (Child record) can be removed from an Event or Group without the record being deleted. A user will edit the Attendee and clear the lookup field. Is this possible to include in the same Child trigger to fire the Count Trigger on the Parent?

 

I'm fairly new to triggers :)

 

Event - Parent
Group - Parent

Attendee - Child

 

trigger CountRelatedAttendees on event_c__c (before insert, before update) {
    event_c__c[] s = Trigger.new;
    String sid = null;    
    Sid = s[0].id;

    	Integer i = [select count() from attendees__c where Event_no__c = :sid];

    s[0].Places_used__c = i;
    }

 

 

  • August 18, 2011
  • Like
  • 0
Hi Y'all, Is it possible to have a criteria based sharing rule which references the current user id? For example we have an custom object, called events, and we would like the presenters to only see the events they are running. I have had a look at the criteria based sharing, but have not been able to reference the current user id to achieve this. Any ideas? Thanks in advance :)

Hello All,

This is my first go at writing an APEX trigger so apologies if there is something obvious I am missing...

My aim: When the object event is created, the region field is set depending on the value of a field called country.

This is what I am trying at the moment:

 

 

trigger EventRegion on Event__c(after insert){
        
        Event__c[] courseList = trigger.new;  
        if(Event__c.Country__c='UK') {
        Event__c.Region__c='1';
    
}// else nothing  
}

 

 

The above gives me - Error: Compile Error: Expression cannot be assigned at line -1 column -1 

 

I've read about how it is prefferable to support the bulk nature of triggers, but I quite get my head around it. Am I missing something obvious?

 

Thanks in advance.

I will try and explain this as well as I can...

 

Basically I am looking to create a custom button that will generate a PDF and email it to a related contact (without going through the selecting template/contact page). I have done this easily enough by following the "Quick email button" tutorial - https://sites.secure.force.com/blogs/ideaView?c=09a30000000D9xoAAC&id=087300000006tqz&returnUrl=%2Fapex%2FideaList%3Fc%3D09a30000000D9xoAAC%26category%3DFor%2BCustomer%2BService

 

Currently we use something like:

location.replace('/email/author/emailauthor.jsp?retURL=/{!object__c.Id}&p3_lkid={!Certificate__c.Id}&rtype=003&p2_lkid={!object__c.Cn_Id__c}&new_template=1&template_id=12345678910&p5=&save=1');

 

However now there is a requirement for 2 PDF templates, depending on certain criteria. Is it possible to create a VF button with the same function as the javascript option, but to include an IF statement to select the correct template depending on a picklist?

 

I get the impression from what I have read so for the IF statement isn't a issue but is VF able to replicate the "URL hacking" approach? Am I looking at building email services to achieve this?

 

Many thanks in advance for any help.

  • November 18, 2010
  • Like
  • 0

Hi All,

 

I have been trying to follow the example on how to do this - http://wiki.developerforce.com/index.php/VisualForceEmailTemplates_sample

 

I have a custom object with Contacts as a related list. I wish to be able to list the Contacts within the email template much like the sample above.

 

I receive the error  "Error: Invalid Field Contacts for SObject customobject__c" using the below:

 

<apex:repeat var="cx" value="{!relatedTo.Contacts}">
        {!cx.FirstName}
        {!cx.LastName}
</apex:repeat>

 

I am assuming the sample is applicable to custom objects. Any suggestions appreciated.

 

 

Hi all,

I have two Parent records that share the same Child record. I would like to be able to count the number of related Child records. Neither are master-detail records, hence the requirement for an Apex Trigger.

I have a working count trigger for the Parent records (included below for referece), but I suspect I need another trigger on the Child records in order for the Count trigger to fire?

The other question: An attendee (Child record) can be removed from an Event or Group without the record being deleted. A user will edit the Attendee and clear the lookup field. Is this possible to include in the same Child trigger to fire the Count Trigger on the Parent?

 

I'm fairly new to triggers :)

 

Event - Parent
Group - Parent

Attendee - Child

 

trigger CountRelatedAttendees on event_c__c (before insert, before update) {
    event_c__c[] s = Trigger.new;
    String sid = null;    
    Sid = s[0].id;

    	Integer i = [select count() from attendees__c where Event_no__c = :sid];

    s[0].Places_used__c = i;
    }

 

 

  • August 18, 2011
  • Like
  • 0
Hi Y'all, Is it possible to have a criteria based sharing rule which references the current user id? For example we have an custom object, called events, and we would like the presenters to only see the events they are running. I have had a look at the criteria based sharing, but have not been able to reference the current user id to achieve this. Any ideas? Thanks in advance :)

Hello All,

This is my first go at writing an APEX trigger so apologies if there is something obvious I am missing...

My aim: When the object event is created, the region field is set depending on the value of a field called country.

This is what I am trying at the moment:

 

 

trigger EventRegion on Event__c(after insert){
        
        Event__c[] courseList = trigger.new;  
        if(Event__c.Country__c='UK') {
        Event__c.Region__c='1';
    
}// else nothing  
}

 

 

The above gives me - Error: Compile Error: Expression cannot be assigned at line -1 column -1 

 

I've read about how it is prefferable to support the bulk nature of triggers, but I quite get my head around it. Am I missing something obvious?

 

Thanks in advance.

I will try and explain this as well as I can...

 

Basically I am looking to create a custom button that will generate a PDF and email it to a related contact (without going through the selecting template/contact page). I have done this easily enough by following the "Quick email button" tutorial - https://sites.secure.force.com/blogs/ideaView?c=09a30000000D9xoAAC&id=087300000006tqz&returnUrl=%2Fapex%2FideaList%3Fc%3D09a30000000D9xoAAC%26category%3DFor%2BCustomer%2BService

 

Currently we use something like:

location.replace('/email/author/emailauthor.jsp?retURL=/{!object__c.Id}&p3_lkid={!Certificate__c.Id}&rtype=003&p2_lkid={!object__c.Cn_Id__c}&new_template=1&template_id=12345678910&p5=&save=1');

 

However now there is a requirement for 2 PDF templates, depending on certain criteria. Is it possible to create a VF button with the same function as the javascript option, but to include an IF statement to select the correct template depending on a picklist?

 

I get the impression from what I have read so for the IF statement isn't a issue but is VF able to replicate the "URL hacking" approach? Am I looking at building email services to achieve this?

 

Many thanks in advance for any help.

  • November 18, 2010
  • Like
  • 0

Hi,

 

I want to send an email after my user clicks on the "Send email" custom button.

How do i trigger email after click.Serached through some of the posts, but to no luck.

 

Can any one help/point me in right direction.

 

Thanks,

Sales4ce

Hi All,

 

I have been trying to follow the example on how to do this - http://wiki.developerforce.com/index.php/VisualForceEmailTemplates_sample

 

I have a custom object with Contacts as a related list. I wish to be able to list the Contacts within the email template much like the sample above.

 

I receive the error  "Error: Invalid Field Contacts for SObject customobject__c" using the below:

 

<apex:repeat var="cx" value="{!relatedTo.Contacts}">
        {!cx.FirstName}
        {!cx.LastName}
</apex:repeat>

 

I am assuming the sample is applicable to custom objects. Any suggestions appreciated.

 

 

I am trying to get Connector installed and configured but I get the error "Compile error in hidden module: DistMon".  Once, I saw the floating toolbar, but have not been able to see it since.  I just get this error.
 
Any help would be appreciated.
  • August 25, 2007
  • Like
  • 0