• cmoynihan
  • NEWBIE
  • 50 Points
  • Member since 2011

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

I have a before trigger running on Cases where I am checking a few fields for changes, and notifying the Case Contact owner via email.

 

I am using trigger.new and grabbing the LastModifiedById from the record, but it seems to be the previous person who made the update (the old record value) not the person who just made the update (the new record value).

 

Is that field updated after the record is committed? And if so, how can I find out who made the changes to the record so I can include it in my notification? 

I am getting an error with the line "mail.setToAddresses" in the following code:

 

String email = '';
String ownerName = '';
// Check if Owner is a User if (ownerType == 'User'){ User owner = [select Name, Email from User where Id = :c.OwnerId]; email = owner.Email; ownerName = owner.Name; System.debug('Email: ' + email + ', Name: ' + ownerName); String[] toAddresses = new String[]{email}; mail.setToAddresses(toAddresses); ...

 The debug message is outputting the Email (and Name) just fine, so I am not sure what the problem is. I use the same syntax is another method and it works just fine, so I'm really not sure what the issue is. Any ideas?

I am testing a trigger I wrote for Case Comment notifications, and I want to be able to see my debug messages when a Self Service Portal User enters a comment.

 

How do I go about viewing these? They don't show up in the debug logs, but I am guessing that is because the SSP User is the one setting off the trigger, ont any of the internal users.

I have an actionFunction defined that calls an Apex function called register() that does some work with contacts. Depending on the result of the function, it sets a message variable with some results.

 

When I call my actionFunction normally I see the message displayed on my page:

 

 

<apex:actionFunction name="register" action="{!register}" rendered="true" immediate="false"  />
<p>Message: {!message}</p>

 

 

 

 When I try to call some Javascript (a function which displays an jQuery Tools overlay, with the message variable as text) using the oncomplete attribute, my message is lost.

 

<apex:actionFunction name="register" action="{!register}" rendered="true" immediate="false" oncomplete="showMsg()" />
 
<apex:outputPanel layout="block" styleClass="simple_overlay" id="regMessage">
  <p>Message: {!message}!</p>
</apex:outputPanel>

 

I am guessing this is because somehow once the actionFunction is complete, the method variables get cleared out. If that's the case, can I somehow return the message from the Apex method so that I can use it on my page?

I want to be able to call an Apex commandlink action from Javascript. Can I do that?

 

Here is what I have:

 

<apex:commandlink action="{!register}" styleClass="button" id="regSubmit">Register</apex:commandlink>

 And I would like to be able to do something like this in JS:

/* Link in page */
<a href="#" class="button" id="regSubmit">Register</a> </div>


/* JS code */
$("#regSubmit").click(function() {
   var validated = myValidator.data("validator").checkValidity();
   if (validated) {
      /* Do the commandlink action here */
   }
});

 Anyone have any ideas? Thanks.

I have a before trigger running on Cases where I am checking a few fields for changes, and notifying the Case Contact owner via email.

 

I am using trigger.new and grabbing the LastModifiedById from the record, but it seems to be the previous person who made the update (the old record value) not the person who just made the update (the new record value).

 

Is that field updated after the record is committed? And if so, how can I find out who made the changes to the record so I can include it in my notification? 

I am getting an error with the line "mail.setToAddresses" in the following code:

 

String email = '';
String ownerName = '';
// Check if Owner is a User if (ownerType == 'User'){ User owner = [select Name, Email from User where Id = :c.OwnerId]; email = owner.Email; ownerName = owner.Name; System.debug('Email: ' + email + ', Name: ' + ownerName); String[] toAddresses = new String[]{email}; mail.setToAddresses(toAddresses); ...

 The debug message is outputting the Email (and Name) just fine, so I am not sure what the problem is. I use the same syntax is another method and it works just fine, so I'm really not sure what the issue is. Any ideas?

I am testing a trigger I wrote for Case Comment notifications, and I want to be able to see my debug messages when a Self Service Portal User enters a comment.

 

How do I go about viewing these? They don't show up in the debug logs, but I am guessing that is because the SSP User is the one setting off the trigger, ont any of the internal users.

I have had the audit fields (created by, created dates, last modified by, etc) opened by sfdc, and need to see if there is a way to populate these via an update rather than an insert. Through the data loader, they are only available via insert. Is this a data loader limitation or a salesforce limitation? We also have DB Amp, and do not have access on an update either. Anyway around this?

I want to be able to call an Apex commandlink action from Javascript. Can I do that?

 

Here is what I have:

 

<apex:commandlink action="{!register}" styleClass="button" id="regSubmit">Register</apex:commandlink>

 And I would like to be able to do something like this in JS:

/* Link in page */
<a href="#" class="button" id="regSubmit">Register</a> </div>


/* JS code */
$("#regSubmit").click(function() {
   var validated = myValidator.data("validator").checkValidity();
   if (validated) {
      /* Do the commandlink action here */
   }
});

 Anyone have any ideas? Thanks.