• Stephanie Boggs 17
  • NEWBIE
  • 55 Points
  • Member since 2016
  • Sales Operations Analyst
  • Montage


  • Chatter
    Feed
  • 0
    Best Answers
  • 3
    Likes Received
  • 0
    Likes Given
  • 16
    Questions
  • 23
    Replies
Hello!

My goal is to require 2 fields prior to a user rejecting an approval process. A validation rule is not working, and other resources are stating to use a trigger. I am purely declarative, so my attempting to tweak the trigger base that I found is not perfect. Can someone assist in correcting it? Please feel free to explain what's being updated and why as I have no issue with learning, I just don't know where all the characters and special nuances go. 

Object = MQL_SQL__c
Required Fields = Reject_Reason__c & Reject_Reason_Notes__c
Field that tracks the approval status = SAL_Approval_Status__c

Let me know if anything else is needed! Thank you!

Provided base code:
for(Object cr : Trigger.New)
    {
        String oldStatus=Trigger.oldMap.get(cr.Id).Status__c;
        if(cr.Status__c==CR_STATUS_APPROVED && oldStatus!=CR_STATUS_APPROVED)
        {
            // Effective Date is required if approved

            if(cr.effective_date==null) 
            {

                isValid = false;
                cr.addError('You must supply an effective date in order to approve the object.);
            }
            
My attempt at updating:  
for(MQL_SQL__c cr : Trigger.Rejection)
    {
        String oldStatus=Trigger.oldMap.get(cr.Id).SAL_Approval_Status__c;
        if(cr.SAL_Approval_Status__c==CR_STATUS_APPROVED && oldSAL_Approval_Status__c!=CR_STATUS_APPROVED)
        {
            // Reject Reason and Reject Notes are required if rejected

            if(cr.Reject_Reason__c==null) &&
            if(cr.Reject_Reason_Notes__c==null) 
            {

                isValid = false;
                cr.addError('Reject Reason and Reject Notes must be completed prior to Rejecting the SQL.);
            }            
Hello,

I have a VF page named "Contract Request" that is accessed from the Opportunity (standard object) and has input fields for both the Opp and the related Account (standard object). I need to be able to write back field updates to both the Opportunity and the related Account upon Save. 

Let me know if there are any questions.

Thanks!
I added the Contact Roles related list on a Visualforce page with <apex:relatedList list="OpportunityContactRoles"/>. I have the following in the VF page to display in Lightning - lightningStylesheets="true"

When in Lightning, I click a button, get taken to the VF page. Click New on Contact Roles to add a new one, but get taken to the Classic view of adding a new contact role, not the new Lightning view. How can I make it so the user stays in Lightning the whole time?
I have a Visualforce page that was used in Classic with the Notes and Attachments related list on it. I am in the process of making this object Lightning friendly and changed the related list to Files with <apex:relatedList list="AttachedContentDocuments"/>

Everything looks good, but I when adding a file the page darkens like it's processing and freezes. No clicking or scrolling works, nothing occurs, but refreshing the page shows that the file did upload as expected. When the page goes dark it does display "javascript:void(0)" in the bottom left for a few seconds. Is there a way around this so that it is clear to the end user that the upload occurred?
Hello, a user clicked the standard related contacts quick link and kept scrolling to see more than the first 50 and then instead of loading, there was the error. One account has 57 contacts and another account has 64 contacts. The error is not happening every time. 

Error is: 
ui.services.connection.api.PartnerConnectionException: INVALID_QUERY_LOCATOR: invalid query locator

I went to Salesforce Support and after I asked some questions (1) What is the contact default batch size? 2) Is the contact default batch value configurable? 3) When referencing the client code, since the client is web-based, does this imply multiple tabs are open or is it storing all data from a single session?) they informed me of the following: "Unfortunately based on the error you receive are only handled by Developer team, and we are not trained on developer part so I would not set any false expectations. I would suggest you to contact your internal developer who will be the best person to answer your questions. I have also provided you some developer forum links where you can post your queries."

I am an Admin and don't know enough about apex to resolve this issue. We don't have an internal developer (it's just me). We don't have any custom code. Any code we have is installed from AppExchange packages.

Any assistance would be helpful. Thank you!
Hello,

This is currently an OnClick JS button that I have. Can this be converted into a Lightning Component?

location.replace('/email/author/emailauthor.jsp?retURL=/{!Demo__c.Id}&template_id=00XF0000001UAxV&p3_lkid={!Demo__c.Id}&p24={!Demo__c.BR_Email__c}');
Hello! Thank you in advance for your assistance! I have been working on this for over 24 total changing the Controller and Component in small ways here and there to test and re-test, and I think I am going in circles at this point.

We have 8 custom Javascript buttons for our Cases - one per department. What these buttons do is allow the user to own the case with one click. It enters their name into a custom user lookup "owner" field for that department, updates their name to the standard Owner field, and updates the Status to Assigned. 

The current, working, custom JS button is:
{!REQUIRESCRIPT("/soap/ajax/13.0/connection.js")} 
var caseObj = new sforce.SObject("Case"); 
caseObj.Id = '{!Case.Id}'; 

caseObj.CST_Owner__c = '{!$User.Id}'; 
caseObj.OwnerId = '{!$User.Id}'; 
caseObj.Status = "Assigned"; 

var result = sforce.connection.update([caseObj]); 
window.location.href=window.location.href;

My Case Buttons Component is currently - this shows on the page and allows for button clicks and will sometimes throw an error and sometimes not but makes no changes:
<aura:component implements="flexipage:availableForAllPageTypes" access="global">
    <aura:attribute name="CaseObj" type="Case" />
        <lightning:button label="Own CST" onclick="{! c.owncst}"/>
</aura:component>

My Controller is currently:
({
owncst : function(component, event, helper) {
    var btnClicked = event.getSource();
    var CaseObj = component.get('v.CaseObj',true)
    component.set('v.CaseObj.Description', "true");
}})
I am thinking that Apex is my only hope for this, but if this can be done without let me know!

I have a formula field on the Lead that pulls the email domain (i.e. gmail.com) (Email_Domain__c) from the email field. I have a field on the Account that contains the primary email domain via a text field (Primary_Email_Domain__c).

When a Lead is created, I want to compare the Lead's Email Domain to all Primary Email Domain Account field values to find a match and then assign the Lead to the Account Owner for conversion.

Please and Thanks!! 
I have a trigger where if the Approval Process is Rejected and the Comments are blank the following page displays. My issue is that I would like to customize the error page so that the actual error is more prominent for the users. Is this possible?

Everything I see is related to error messages from VF pages.

trigger RequireRejectionComment on Contact (before update) 
{

  Map<Id, Contact> rejectedStatements 
             = new Map<Id, Contact>{};

  for(Contact inv: trigger.new)
  {
    /* 
      Get the old object record, and check if the approval status 
      field has been updated to rejected. If so, put it in a map 
      so we only have to use 1 SOQL query to do all checks.
    */
    Contact oldInv = System.Trigger.oldMap.get(inv.Id);

    if (oldInv.SAL_Approval_Status__c != 'Rejected' 
     && inv.SAL_Approval_Status__c == 'Rejected')
    { 
      rejectedStatements.put(inv.Id, inv);  
    }
  }
   
  if (!rejectedStatements.isEmpty())  
  {
    // UPDATE 2/1/2014: Get the most recent approval process instance for the object.
    // If there are some approvals to be reviewed for approval, then
    // get the most recent process instance for each object.
    List<Id> processInstanceIds = new List<Id>{};
    
    for (Contact invs : [SELECT (SELECT ID
                                              FROM ProcessInstances
                                              ORDER BY CreatedDate DESC
                                              LIMIT 1)
                                      FROM Contact
                                      WHERE ID IN :rejectedStatements.keySet()])
    {
        processInstanceIds.add(invs.ProcessInstances[0].Id);
    }
      
    // Now that we have the most recent process instances, we can check
    // the most recent process steps for comments.  
    for (ProcessInstance pi : [SELECT TargetObjectId,
                                   (SELECT Id, StepStatus, Comments 
                                    FROM Steps
                                    ORDER BY CreatedDate DESC
                                    LIMIT 1 )
                               FROM ProcessInstance
                               WHERE Id IN :processInstanceIds
                               ORDER BY CreatedDate DESC])   
    {                   
      if ((pi.Steps[0].Comments == null || 
           pi.Steps[0].Comments.trim().length() == 0))
      {
        rejectedStatements.get(pi.TargetObjectId).addError(
          'Please provide a rejection reason in the Comments field. Click the back arrow on your browser to go back to the Approve/Reject page.');

      }
    }  
  }
}

User-added image
Hello,

I installed the Unmanaged Action Plans App (https://appexchange.salesforce.com/listingDetail?listingId=a0N30000003HcINEA0&tab=r) in sandbox, and we use a custom Activity Type field to allow more functionality that the standard one. 

Can someone assist me in editing the existing triggers/classes or creating a new trigger/class so that the Activity Types match and reference each other between the 4 Action Plan objects? I am not very knowledgeable in writing apex, however, I did search the classes to find where "Type" was used and updated them to Activity_Type__c and only one custom value is populating, but the others are not. What could I be missing?

Let me know if I can clarify further, and thank you in advance!
Stephanie
Hello,

I want to ensure that I am reviewing this accurately. https://help.salesforce.com/articleView?id=Hyperlink-Formula-Fields-for-JavaScript-Disablement&language=en_US&type=1

Is there a way to report on all the formula fields and what the formulas are so that I can search to see if my org is affected by this change?

I don't believe that we will be affected, but I want to do my due diligence, so any help in how I should go about this would be greatly appreciated!

Thanks!
Stephanie
Hello,

I installed the Unmanaged Action Plans App (https://appexchange.salesforce.com/listingDetail?listingId=a0N30000003HcINEA0&tab=r) in sandbox, and we use a custom Activity Status value of "Cancelled". 

Can someone assist me in editing the existing triggers or creating a new trigger so that the Status' match and reference each other between the 4 Action Plan objects? I am not very knowledgeable in writing apex.

It would also be ideal that all other dependent tasks and/or all other tasks for that action plan are able to be canceled without being deleted in one click. 

i.e. We might have an action plan to call, email, etc and if we get a not interested response we won't want to continue reaching out and want to keep the call task as complete but have the others be marked canceled.

Let me know if I can clarify further, and thank you in advance!
Stephanie
Hello,

I am following the instructions at https://developer.salesforce.com/page/Using_Data_Loader_from_the_command_line and am getting the following error.

c:\Program Files (x86)\salesforce.com\Data Loader\bin>process.bat "C:\Program Files (x86)\salesforce.com\Data Loader\bin\conf" csvAccountExtractProcess
2016-12-27 21:05:15,487 INFO  [main] controller.Controller initLog (Controller.java:396) - Using built-in logging configuration, no log-conf.xml in c:\Program Files (x86)\salesforce.com\Data Loader\bin\log-conf.xml
2016-12-27 21:05:15,495 INFO  [main] controller.Controller initLog (Controller.java:398) - The log has been initialized
2016-12-27 21:05:15,498 INFO  [main] process.ProcessConfig getBeanFactory (ProcessConfig.java:104) - Loading process configuration from config file: C:\Program Files (x86)\salesforce.com\Data Loader\bin\conf\process-conf.xml
2016-12-27 21:05:15,564 INFO  [main] support.AbstractApplicationContext prepareRefresh (AbstractApplicationContext.java:495) - Refreshing org.springframework.context.support.FileSystemXmlApplicationContext@53e25b76: startup date [Tue Dec 27 21:05:15 CST 2016]; root of context hierarchy
2016-12-27 21:05:15,603 INFO  [main] xml.XmlBeanDefinitionReader loadBeanDefinitions (XmlBeanDefinitionReader.java:315) - Loading XML bean definitions from file [C:\Program Files (x86)\salesforce.com\Data Loader\bin\conf\process-conf.xml]
2016-12-27 21:05:15,664 INFO  [main] support.DefaultListableBeanFactory preInstantiateSingletons (DefaultListableBeanFactory.java:557) - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@1936f0f5: defining beans [csvAccountExtractProcess]; root of factory hierarchy
2016-12-27 21:05:15,700 INFO  [csvAccountExtract] controller.Controller initConfig (Controller.java:334) - config dir created at C:\Program Files (x86)\salesforce.com\Data Loader\bin\conf
2016-12-27 21:05:15,711 INFO  [csvAccountExtract] controller.Controller initConfig (Controller.java:362) - The controller config has been initialized
2016-12-27 21:05:15,712 INFO  [csvAccountExtract] process.ProcessRunner run (ProcessRunner.java:116) - Initializing process engine
2016-12-27 21:05:15,712 INFO  [csvAccountExtract] process.ProcessRunner run (ProcessRunner.java:119) - Loading parameters
2016-12-27 21:05:15,713 ERROR [csvAccountExtract] config.Config initEncryption (Config.java:731) - Error initializing encryption for key file ?c:\Temp\key.txt: Cannot Access Key File: ?c:\Temp\key.txt
2016-12-27 21:05:15,714 FATAL [main] process.ProcessRunner topLevelError (ProcessRunner.java:238) - Unable to run process csvAccountExtract
java.lang.RuntimeException: com.salesforce.dataloader.exception.ConfigInitializationException: Error initializing encryption for key file ?c:\Temp\key.txt: Cannot Access Key File: ?c:\Temp\key.txt
        at com.salesforce.dataloader.process.ProcessRunner.run(ProcessRunner.java:162)
        at com.salesforce.dataloader.process.ProcessRunner.run(ProcessRunner.java:100)
        at com.salesforce.dataloader.process.ProcessRunner.main(ProcessRunner.java:253)
Caused by: com.salesforce.dataloader.exception.ConfigInitializationException: Error initializing encryption for key file ?c:\Temp\key.txt: Cannot Access Key File: ?c:\Temp\key.txt
        at com.salesforce.dataloader.config.Config.initEncryption(Config.java:732)
        at com.salesforce.dataloader.config.Config.postLoad(Config.java:651)
        at com.salesforce.dataloader.config.Config.loadParameterOverrides(Config.java:678)
        at com.salesforce.dataloader.process.ProcessRunner.run(ProcessRunner.java:120)
        ... 2 more

My process-conf is:
<beans>
    <bean id="csvAccountExtractProcess"
          class="com.salesforce.dataloader.process.ProcessRunner"
          singleton="false">
      <description>csvAccountExtract job gets account info from salesforce and saves info into a CSV file."</description>
        <property name="name" value="csvAccountExtract"/>
        <property name="configOverrideMap">
            <map>
                <entry key="sfdc.debugMessages" value="false"/>
                <entry key="sfdc.debugMessagesFile" value="c:\dataloader\samples\status\sfdcSoapTrace.log"/>
                <entry key="sfdc.endpoint" value="https://login.salesforce.com/"/>
                <entry key="sfdc.username" value="myusername@email.com"/>
                <entry key="sfdc.password" value="b028bead3a6fa728a40c9176df0fa742"/>
                <entry key="process.encryptionKeyFile" value="‪c:\Temp\key.txt"/>
                <entry key="sfdc.timeoutSecs" value="600"/>
                <entry key="sfdc.loadBatchSize" value="200"/>
                <entry key="sfdc.entity" value="Implementation__c"/>
                <entry key="sfdc.extractionRequestSize" value="500"/>
                <entry key="sfdc.extractionSOQL" value="SELECT Name,Account_Manager__c,Account_Executive__c,Question_Reset_Allowed__c,Configuration_Notes__c,Special_Use_Cases__c,Using_Integration__c,Integration_System__c,Integration_Notes__c,Utilizes_Roles__c,Utilizes_Group_Access__c,Client_creates_new_users__c,Contact_for_New_User_Setup__c FROM Implementation__c WHERE Implementation_Stage__c != 'Inactive'"/>
                <entry key="process.operation" value="extract"/>
                <entry key="process.mappingFile" value="C:\Program Files (x86)\salesforce.com\Data Loader\bin\conf\mappings.sdl"/>
                <entry key="dataAccess.type" value="csvWrite"/>
                <entry key="dataAccess.name" value="C:\Users\User1\Documents\extract.csv"/>
            </map>
        </property>
    </bean>
</beans>
Hello,

I am using the following code I found online, and I get an error when attempting to upload a document that is more than 135KB. I do not have apex coding skills, so I am having a tough time altering the code myself. I have found some forums that go over fixes to other similar code but not sure where to make what changes to what I have. Also, if I could get a "Your document has been uploaded" message inline I would be so thankful! There is nothing that informs the users it's been uploaded and they are uploading the file(s) multiple times.

Apex Class:
public class attachmentsample {

    public attachmentsample(ApexPages.StandardController controller) {

    }
    Public Attachment myfile;
    Public Attachment getmyfile()
    {
        myfile = new Attachment();
        return myfile;
    }
   
    Public Pagereference Savedoc()
    {
        String accid = System.currentPagereference().getParameters().get('id');

        Attachment a = new Attachment(parentId = accid, name=myfile.name, body = myfile.body);
         
         /* insert the attachment */
         insert a;
        return NULL;
    }   

}

Visualforce Page: (I have other VF code, but this is the part that is affected by what I am attempting to do.)
</apex:pageBlockSectionItem>
<apex:inputfile value="{!myfile.body}" filename="{!myfile.Name}" />
<apex:commandbutton value="Attach File" action="{!Savedoc}"/>
</apex:pageblocksection>
I have a VF page that appears when a button is clicked on the Opportunity to assist in getting certain fields completed for a process. I currently have a couple of Contact lookups for the Opportunity. For one of them, I need to pull in the Title, Phone, and Email fields for the user to confirm that they are complete and/or accurate and update them if they are not currently completed prior to kicking off the process. 
Hello,

I am attempting 2 different types of automation for creating Opportunity Contact Roles (OCRs).
  1. Adding a contact with a certain level of activity as an Influencer.
    • I have custom fields on the contact that calculates the total activity and a simple checkbox that determines if the contact should be an OCR or not (if an Opportunity is open).
    • Adding only when meeting the criteria, not removing at all. Removal can be manual.
  2. Copying OCRs from a previous opportunity to a renewal opportunity. 
    • When an opportunity is closed won a renewal opportunity is created automatically. We would like the OCRs for the original opportunity to be copied over to the renewal. 
I have attempted to do this with Flows and Process Builder, but Process Builder is limited in regards to creating OCRs. I have reviewed the most popular OCR blogs, but they are mostly based on having a Contact lookup field on the Opportunity, and I don't want more than one lookup. Even if I somehow made the single lookup auto-update with a contact when it reaches the criteria I don't know how I would update the single field since the opportunity is not yet related to the contact (this might be easiest if you can tell me how to do this!).

I am a click-to-code admin (VF is not easy for me) so any help with APEX/Triggers would be AMAZING! Or at least possible brainstorming or simple triggers/code to assist with a flow/process builder.

THANK YOU!!!
Hello,

I want to ensure that I am reviewing this accurately. https://help.salesforce.com/articleView?id=Hyperlink-Formula-Fields-for-JavaScript-Disablement&language=en_US&type=1

Is there a way to report on all the formula fields and what the formulas are so that I can search to see if my org is affected by this change?

I don't believe that we will be affected, but I want to do my due diligence, so any help in how I should go about this would be greatly appreciated!

Thanks!
Stephanie
Hello!

My goal is to require 2 fields prior to a user rejecting an approval process. A validation rule is not working, and other resources are stating to use a trigger. I am purely declarative, so my attempting to tweak the trigger base that I found is not perfect. Can someone assist in correcting it? Please feel free to explain what's being updated and why as I have no issue with learning, I just don't know where all the characters and special nuances go. 

Object = MQL_SQL__c
Required Fields = Reject_Reason__c & Reject_Reason_Notes__c
Field that tracks the approval status = SAL_Approval_Status__c

Let me know if anything else is needed! Thank you!

Provided base code:
for(Object cr : Trigger.New)
    {
        String oldStatus=Trigger.oldMap.get(cr.Id).Status__c;
        if(cr.Status__c==CR_STATUS_APPROVED && oldStatus!=CR_STATUS_APPROVED)
        {
            // Effective Date is required if approved

            if(cr.effective_date==null) 
            {

                isValid = false;
                cr.addError('You must supply an effective date in order to approve the object.);
            }
            
My attempt at updating:  
for(MQL_SQL__c cr : Trigger.Rejection)
    {
        String oldStatus=Trigger.oldMap.get(cr.Id).SAL_Approval_Status__c;
        if(cr.SAL_Approval_Status__c==CR_STATUS_APPROVED && oldSAL_Approval_Status__c!=CR_STATUS_APPROVED)
        {
            // Reject Reason and Reject Notes are required if rejected

            if(cr.Reject_Reason__c==null) &&
            if(cr.Reject_Reason_Notes__c==null) 
            {

                isValid = false;
                cr.addError('Reject Reason and Reject Notes must be completed prior to Rejecting the SQL.);
            }            
Hello,

I have a VF page named "Contract Request" that is accessed from the Opportunity (standard object) and has input fields for both the Opp and the related Account (standard object). I need to be able to write back field updates to both the Opportunity and the related Account upon Save. 

Let me know if there are any questions.

Thanks!
I added the Contact Roles related list on a Visualforce page with <apex:relatedList list="OpportunityContactRoles"/>. I have the following in the VF page to display in Lightning - lightningStylesheets="true"

When in Lightning, I click a button, get taken to the VF page. Click New on Contact Roles to add a new one, but get taken to the Classic view of adding a new contact role, not the new Lightning view. How can I make it so the user stays in Lightning the whole time?
I have a Visualforce page that was used in Classic with the Notes and Attachments related list on it. I am in the process of making this object Lightning friendly and changed the related list to Files with <apex:relatedList list="AttachedContentDocuments"/>

Everything looks good, but I when adding a file the page darkens like it's processing and freezes. No clicking or scrolling works, nothing occurs, but refreshing the page shows that the file did upload as expected. When the page goes dark it does display "javascript:void(0)" in the bottom left for a few seconds. Is there a way around this so that it is clear to the end user that the upload occurred?
Hello, a user clicked the standard related contacts quick link and kept scrolling to see more than the first 50 and then instead of loading, there was the error. One account has 57 contacts and another account has 64 contacts. The error is not happening every time. 

Error is: 
ui.services.connection.api.PartnerConnectionException: INVALID_QUERY_LOCATOR: invalid query locator

I went to Salesforce Support and after I asked some questions (1) What is the contact default batch size? 2) Is the contact default batch value configurable? 3) When referencing the client code, since the client is web-based, does this imply multiple tabs are open or is it storing all data from a single session?) they informed me of the following: "Unfortunately based on the error you receive are only handled by Developer team, and we are not trained on developer part so I would not set any false expectations. I would suggest you to contact your internal developer who will be the best person to answer your questions. I have also provided you some developer forum links where you can post your queries."

I am an Admin and don't know enough about apex to resolve this issue. We don't have an internal developer (it's just me). We don't have any custom code. Any code we have is installed from AppExchange packages.

Any assistance would be helpful. Thank you!
Hello,

This is currently an OnClick JS button that I have. Can this be converted into a Lightning Component?

location.replace('/email/author/emailauthor.jsp?retURL=/{!Demo__c.Id}&template_id=00XF0000001UAxV&p3_lkid={!Demo__c.Id}&p24={!Demo__c.BR_Email__c}');
Hello! Thank you in advance for your assistance! I have been working on this for over 24 total changing the Controller and Component in small ways here and there to test and re-test, and I think I am going in circles at this point.

We have 8 custom Javascript buttons for our Cases - one per department. What these buttons do is allow the user to own the case with one click. It enters their name into a custom user lookup "owner" field for that department, updates their name to the standard Owner field, and updates the Status to Assigned. 

The current, working, custom JS button is:
{!REQUIRESCRIPT("/soap/ajax/13.0/connection.js")} 
var caseObj = new sforce.SObject("Case"); 
caseObj.Id = '{!Case.Id}'; 

caseObj.CST_Owner__c = '{!$User.Id}'; 
caseObj.OwnerId = '{!$User.Id}'; 
caseObj.Status = "Assigned"; 

var result = sforce.connection.update([caseObj]); 
window.location.href=window.location.href;

My Case Buttons Component is currently - this shows on the page and allows for button clicks and will sometimes throw an error and sometimes not but makes no changes:
<aura:component implements="flexipage:availableForAllPageTypes" access="global">
    <aura:attribute name="CaseObj" type="Case" />
        <lightning:button label="Own CST" onclick="{! c.owncst}"/>
</aura:component>

My Controller is currently:
({
owncst : function(component, event, helper) {
    var btnClicked = event.getSource();
    var CaseObj = component.get('v.CaseObj',true)
    component.set('v.CaseObj.Description', "true");
}})
I am thinking that Apex is my only hope for this, but if this can be done without let me know!

I have a formula field on the Lead that pulls the email domain (i.e. gmail.com) (Email_Domain__c) from the email field. I have a field on the Account that contains the primary email domain via a text field (Primary_Email_Domain__c).

When a Lead is created, I want to compare the Lead's Email Domain to all Primary Email Domain Account field values to find a match and then assign the Lead to the Account Owner for conversion.

Please and Thanks!! 
I have a trigger where if the Approval Process is Rejected and the Comments are blank the following page displays. My issue is that I would like to customize the error page so that the actual error is more prominent for the users. Is this possible?

Everything I see is related to error messages from VF pages.

trigger RequireRejectionComment on Contact (before update) 
{

  Map<Id, Contact> rejectedStatements 
             = new Map<Id, Contact>{};

  for(Contact inv: trigger.new)
  {
    /* 
      Get the old object record, and check if the approval status 
      field has been updated to rejected. If so, put it in a map 
      so we only have to use 1 SOQL query to do all checks.
    */
    Contact oldInv = System.Trigger.oldMap.get(inv.Id);

    if (oldInv.SAL_Approval_Status__c != 'Rejected' 
     && inv.SAL_Approval_Status__c == 'Rejected')
    { 
      rejectedStatements.put(inv.Id, inv);  
    }
  }
   
  if (!rejectedStatements.isEmpty())  
  {
    // UPDATE 2/1/2014: Get the most recent approval process instance for the object.
    // If there are some approvals to be reviewed for approval, then
    // get the most recent process instance for each object.
    List<Id> processInstanceIds = new List<Id>{};
    
    for (Contact invs : [SELECT (SELECT ID
                                              FROM ProcessInstances
                                              ORDER BY CreatedDate DESC
                                              LIMIT 1)
                                      FROM Contact
                                      WHERE ID IN :rejectedStatements.keySet()])
    {
        processInstanceIds.add(invs.ProcessInstances[0].Id);
    }
      
    // Now that we have the most recent process instances, we can check
    // the most recent process steps for comments.  
    for (ProcessInstance pi : [SELECT TargetObjectId,
                                   (SELECT Id, StepStatus, Comments 
                                    FROM Steps
                                    ORDER BY CreatedDate DESC
                                    LIMIT 1 )
                               FROM ProcessInstance
                               WHERE Id IN :processInstanceIds
                               ORDER BY CreatedDate DESC])   
    {                   
      if ((pi.Steps[0].Comments == null || 
           pi.Steps[0].Comments.trim().length() == 0))
      {
        rejectedStatements.get(pi.TargetObjectId).addError(
          'Please provide a rejection reason in the Comments field. Click the back arrow on your browser to go back to the Approve/Reject page.');

      }
    }  
  }
}

User-added image

I have the following SOQL used in a VisualForce page:

 

"Select c.Product__r.PA_Product_Class__c productClass, sum(c.Rolling_12_Current__c) sales from PA_Customer_History__c c where c.Account__c = '{!account.Id}' group by c.Product__r.PA_Product_Class__c"

 

The field Rolling_12_Current__c is a currency field and the records I am querying are all in USD. Our corporate currency is EUR. My user is set up with a currency of USD. When the query is run, the sum() returns back a converted value in EUR instead of USD. According to the documentation at http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_soql_querying_currency_fields.htm, this shouldn't happen: "Currency data is converted to the user's locale and then processed by the aggregate function."

 

My user's currency is in USD, so it should display it properly in USD. As a temporary work around, I've changed our exchange rate to 1. Can someone please let me know how I can get the SOQL aggregate to return the values in my user's currency? I tried using convertCurrency, but I get a malformed query error.