• Stephanie Dodson
  • NEWBIE
  • 45 Points
  • Member since 2015

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 22
    Replies
Deployment change set error on apex email trigger Class Name:MyProfilePageControllerTest Error Message:FIELD_CUSTOM_VALIDATION_EXCEPTION "Please enter First Name"
I've got an email trigger in a sandbox I'm trying to deploy into production.

Here's the apex:
trigger EmailMessage on EmailMessage (after insert) {
List<Case> casesToAssign = new List<Case>();
AssignmentRule ar = [SELECT Id FROM AssignmentRule WHERE SObjectType = 'Case' AND Active = true LIMIT 1];
Database.DMLOptions dmlOpts = new Database.DMLOptions();
dmlOpts.AssignmentRuleHeader.AssignmentRuleId = ar.Id;
for(EmailMessage e : Trigger.new) {
if(e.Incoming) {
Case c = new Case(Id = e.ParentId);
c.setOptions(dmlOpts);
casesToAssign.add(c);
}
}
update casesToAssign;
}
Created by frontendloader

Obviously I've just copied this from this person's post.  I don't know anything about apex.

But here's the error I'm receiving while validating the inbound change set for this trigger.

Class Name:  MyProfilePageControllerTest
Method Name:  testSave
Error Message:  System.DmlException: Insert failed. First exception on row 0; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Please enter First Name: [] 
Stack Trace: Class.MyProfilePageControllerTest.testSave: line 34, column 1

Can anyone help with this error?
I am trying to create a custom action for case feeds called "Reply All".  I have created a visualforce page and a custom action and it seems to be working ok but missing a few pieces.

I need to refresh the page after the email is sent. 
Also, I need to pass values to the To and CC address fields.

Here is what I have:

<apex:page standardController="Case" >
<apex:emailPublisher entityId="{!case.id}"
autoCollapseBody="false"
emailBodyFormat="textAndHTML"
emailBodyHeight="200em"
bccVisibility="editableWithLookup"
ccvisibility="editableWithLookup"
expandableHeader="false"
fromvisibility="selectable"
showadditionalFields="true"
showattachments="true"
showsendButton="true"
showtemplates="true"
subjectvisibility="editable"
tovisibility="editableWithLookup"
/>
</apex:page>


 
I am new to coding.  I need a little assistance.  I have embedded my flow in a visualforce page and I am trying to create a custom controller to have the flow finish with redirecting the user to the newly created record.

Page:

<apex:page Controller="SplitCaseController">
<flow:interview name="Split_Case" interview="{!myFlow} finishLocation="/{!FinishPage}">
<apex:param name="CurrentCaseID" value="{!Case.Id}"/>
<apex:param name="CurrentUserID" value="{!$User.Id}"/>
</flow:interview>
</apex:page>

Controller

1
2
3
4
5
6
7
8
9
10
11
12
13
14
public class SplitCaseController {

public Flow.Interview.Split_Case myFlow { get; set; }

public String getmyID() {
if (myFlow==null) return '';
else return myFlow.NewCaseID;
}

public PageReference getFinishPage(){
PageReference p = new PageReference('/' + getmyID());
p.setRedirect(true);
return p;
}}

But every time I try to save the page I get the error "Unknown property 'SplitCaseController.Case'

Help!
Hi all,

I have this part of code, which is an outputpanel and renders the second outputpanel when a condition is met.
Now I want to implement the functionality for the button CANCEL, so by clicking on that button the second outputpanel disappears.

I couldn't find any examples in order to show how this can be done.

Did anybody have experience with this?

 
Hi, Im working in visualforce right now, and I am adding a javascript code that should work like this.

http://jsfiddle.net/k5hkR/

However, it isnt working as I want it, any help on this?

Thank you,
 
<apex:page controller="ContactSearchController2" sidebar="false">

  <apex:form >
  <apex:pageMessages id="errors" />

  <apex:pageBlock title="Find Me A Customer!" mode="edit">

  <table width="100%" border="0">
  <tr>  
    <td width="200" valign="top">

      <apex:pageBlock title="Parameters" mode="edit" id="criteria">

      <script type="text/javascript">
      function doSearch() {
        searchServer(
          document.getElementById("firstName").value,
          document.getElementById("lastName").value,
          document.getElementById("accountName").value,
          document.getElementById("technology").value
          );
          var $rows = $("tr");

          $("doSearch();").keyup(function() {
    var val = $.trim(this.value);
    if (val === "")
        $rows.show();
    else {
        $rows.hide();
        $rows.has("td:contains(" + accountName + ")").show();
    }
});

      }
      </script> 

      <apex:actionFunction name="searchServer" action="{!runSearch}" rerender="results,debug,errors">
          <apex:param name="firstName" value="" />
          <apex:param name="lastName" value="" />
          <apex:param name="accountName" value="" />
          <apex:param name="technology" value="" />
      </apex:actionFunction>

      <table cellpadding="2" cellspacing="2">
      <tr>
        <td style="font-weight:bold;">First Name<br/>
        <input type="text" id="firstName" onkeyup="doSearch();"/>
        </td>
      </tr>
      <tr>
        <td style="font-weight:bold;">Last Name<br/>
        <input type="text" id="lastName" onkeyup="doSearch();"/>
        </td>
      </tr>
      <tr>
        <td style="font-weight:bold;">Account<br/>
        <input type="text" id="accountName" onkeyup="doSearch();"/>
        </td>
      </tr>
      <tr>
        <td style="font-weight:bold;">Interested Technologies<br/>
          <select id="technology" onchange="doSearch();">
            <option value=""></option>
            <apex:repeat value="{!technologies}" var="tech">
              <option value="{!tech}">{!tech}</option>
            </apex:repeat>
          </select>
        </td>
      </tr>
      </table>

      </apex:pageBlock>

    </td>
    <td valign="top">

    <apex:pageBlock mode="edit" id="results">

        <apex:pageBlockTable value="{!contacts}" var="contact">

            <apex:column >
                <apex:facet name="header">
                    <apex:commandLink value="First Name" action="{!toggleSort}" rerender="results,debug">
                        <apex:param name="sortField" value="firstName" assignTo="{!sortField}"/>
                    </apex:commandLink>
                </apex:facet>
                <apex:outputField value="{!contact.firstName}"/>
            </apex:column>

            <apex:column >
                <apex:facet name="header">
                    <apex:commandLink value="Last Name" action="{!toggleSort}" rerender="results,debug">
                        <apex:param name="sortField" value="lastName" assignTo="{!sortField}"/>
                    </apex:commandLink>
                </apex:facet>
                <apex:outputField value="{!contact.lastName}"/>
            </apex:column>

            <apex:column >
                <apex:facet name="header">
                    <apex:commandLink value="Account" action="{!toggleSort}" rerender="results,debug">
                        <apex:param name="sortField" value="account.name" assignTo="{!sortField}"/>
                    </apex:commandLink>
                </apex:facet>
                <apex:outputField value="{!contact.account.name}"/>
            </apex:column>

            <apex:column >
                <apex:facet name="header">
                    <apex:commandLink value="Technologies" action="{!toggleSort}" rerender="results,debug">
                        <apex:param name="sortField" value="interested_technologies__c" assignTo="{!sortField}"/>
                    </apex:commandLink>
                </apex:facet>
                <apex:outputField value="{!contact.Interested_Technologies__c}"/>
            </apex:column>

        </apex:pageBlockTable>

    </apex:pageBlock>

    </td>
  </tr>
  </table>

  <apex:pageBlock title="Debug - SOQL" id="debug">
      <apex:outputText value="{!debugSoql}" />           
  </apex:pageBlock>    

  </apex:pageBlock>

  </apex:form>

</apex:page>

 
Deployment change set error on apex email trigger Class Name:MyProfilePageControllerTest Error Message:FIELD_CUSTOM_VALIDATION_EXCEPTION "Please enter First Name"
I've got an email trigger in a sandbox I'm trying to deploy into production.

Here's the apex:
trigger EmailMessage on EmailMessage (after insert) {
List<Case> casesToAssign = new List<Case>();
AssignmentRule ar = [SELECT Id FROM AssignmentRule WHERE SObjectType = 'Case' AND Active = true LIMIT 1];
Database.DMLOptions dmlOpts = new Database.DMLOptions();
dmlOpts.AssignmentRuleHeader.AssignmentRuleId = ar.Id;
for(EmailMessage e : Trigger.new) {
if(e.Incoming) {
Case c = new Case(Id = e.ParentId);
c.setOptions(dmlOpts);
casesToAssign.add(c);
}
}
update casesToAssign;
}
Created by frontendloader

Obviously I've just copied this from this person's post.  I don't know anything about apex.

But here's the error I'm receiving while validating the inbound change set for this trigger.

Class Name:  MyProfilePageControllerTest
Method Name:  testSave
Error Message:  System.DmlException: Insert failed. First exception on row 0; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Please enter First Name: [] 
Stack Trace: Class.MyProfilePageControllerTest.testSave: line 34, column 1

Can anyone help with this error?
Hello,

I am displaying questions on a VF page and their options in form of radio buttons, but when I try to get the selected values of all the radio buttons and insert them for each record, blank value is passed.
Following is my code :
VF PAGE :
<apex:page controller="DisplayController" sidebar="false">
  <apex:form >
        <apex:repeat value="{!Questions}" var="q">
          <apex:outputField value="{!q.Related_Question__r.Question__c}"/>
          <apex:selectRadio value="{!q.Related_Question__r.Selected_Value__c}" id="RadioButtonValue" >
             <apex:selectOptions value="{!Options}" ></apex:selectOptions>
          </apex:selectRadio><br /><br />
       </apex:repeat>  
     <apex:commandButton action="{!SubmitSurvey}" value="Save" title="Save"/>
  </apex:form>
 </apex:page>


APEX CONTROLLER :
public with sharing class DisplayController {

    Public Survey_Main__c mainobj{get;set;}
    Public Survey_Question_Table__c questobj{get;set;}
    Public Survey_Option_table__c optobje{get;set;}
    Public List<Survey_Main__c> mainList{get;set;}
    Public List<Survey_Question_Table__c> questList{get;set;}
    Public List<Survey_Option_Table__c> optList{get;set;}

    Public String SelectedValue{get;set;}

    Public DisplayController(){
        
    }

   Public List<Survey_Option_Table__c> getQuestions(){
    
        optList = [select id, name,Option_One__c,Option_Two__c,Option_Three__c,Option_Four__c,Option_Five__c,Answer__c, Related_Question__r.Question__c,Related_Question__r.Selected_Value__c,Related_Question__r.Related_Survey__c from Survey_Option_Table__c where Related_Question__r.Related_Survey__c = 'a0d28000001GVcw'];
        
        return optList;
    }


    Public List<SelectOption> getOptions(){
        questList = [select id, name, Question__c,Selected_Value__c,Related_Survey__c from Survey_Question_Table__c where Related_Survey__c = 'a0d28000001GVcw'];
        optList=[select id, name, Option_One__c,Option_Two__c,Option_Three__c,Option_Four__c,Option_Five__c,Answer__c, Related_Question__c from Survey_Option_Table__c where Related_Question__c =: questList];
        
        List<SelectOption> options = new List<SelectOption>();
          for(integer i=0;i<1;i++)
                 {
                 system.debug('++++++++++++++OPTION BLOCK+++++++++++++++'+optList[i]);
                 options.add(new SelectOption('Option One','Option One'));
                 options.add(new SelectOption('Option Two','Option Two'));
                 options.add(new SelectOption('Option Three','Option Three'));
                 options.add(new SelectOption('Option Four','Option Four'));
                 options.add(new SelectOption('Option Five','Option Five'));
                 }
          return options;
    }
   
   
   public PageReference SubmitSurvey() {
    
    for (Survey_Option_Table__c sqItem : getQuestions()) {
 if(sqItem.Related_Question__r.Selected_Value__c != null || sqItem.Related_Question__r.Selected_Value__c != ' '){
     
               //Inserting The Survey Result
               Survey_Result__c SurveyResult = new Survey_Result__c(
                      Answer__c = sqItem.Related_Question__r.Selected_Value__c,
                      Related_Question__c = sqItem.Related_Question__r.Id
                     );
               insert SurveyResult;
        }  else{

             ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'Please Select Atleast one value'));  
        }

    }
        return null;
}


Need help on this...Urgent !

Thanks.
I created a custom visual force page with inputs everywhere. I added the save button that is initially created with every object but the button is not saving any of the new content to the fields. How would I begin to create my own custom button that would save all the fields on my page?
I am very new to salesforce so as much information as possible would be of great help.
Hi

I have a custom button on Case object that when clicked on starts a flow .  What I want to do is close the pop up window when the flow finishes and return to the orignal page which is refreshed so the record is updated with the new data .

I have this code on my button which is calling a flow and the following vf page forceclose to close the window but now I need it to refresh the page.  It is currently refreshing the home page and not the page where i call the flow from i.e my Case record

 
<apex:page showChat="false" showHeader="false" sidebar="false" applyBodyTag="false" applyHtmlTag="false">
<html>
    <head>
        <title>ESCAPE</title>
        <script>
        
            function closeWindow(){      
            window.opener.location.href="/{!$CurrentPage.parameters.id}";
            window.top.close();
      
            }
        </script>       
    </head>
    <body onload="closeWindow()">
      
   
      
    
 
       
    </body>
</html>
</apex:page>


And my button custom button code is 
 
/flow/Restart_Case_Milestones?CaseID={!Case.Id}&retURL=https://cs86.salesforce.com/{!Case.Id}


 
Im sure this is a simple mistake as I do not have much coding experience. It says my error is on line 5.

I am trying to update the field GUI on the account if it is blank. I want it to update with the Candian GUI if there is an accout populated in the related field "Canada_Account".
 
trigger Update_GUI on Account (before insert, before update) {
    for(Account acc : Trigger.new){
        if(acc.GUI__c = null){
            if(acc.Canada_Account__c != null){
                acc.GUI__c == acc.Canada_Account__r.GUI__c;
            }
        }
    }
}

 
I'm not a developer. I'm hoping someone can tell me whether it's possible for a developer to code something to allow a user to use keyboard shortcuts to toggle between the Case Feed and Case Detail views? My users find it cumbersome and not very intutive to use the icons to do this. 

User-added image
I am trying to create a custom action for case feeds called "Reply All".  I have created a visualforce page and a custom action and it seems to be working ok but missing a few pieces.

I need to refresh the page after the email is sent. 
Also, I need to pass values to the To and CC address fields.

Here is what I have:

<apex:page standardController="Case" >
<apex:emailPublisher entityId="{!case.id}"
autoCollapseBody="false"
emailBodyFormat="textAndHTML"
emailBodyHeight="200em"
bccVisibility="editableWithLookup"
ccvisibility="editableWithLookup"
expandableHeader="false"
fromvisibility="selectable"
showadditionalFields="true"
showattachments="true"
showsendButton="true"
showtemplates="true"
subjectvisibility="editable"
tovisibility="editableWithLookup"
/>
</apex:page>


 
Hey all,

I'm creating a workflow that I'd like to trigger when a Billing Contact is updated - not when one is added for the first time and not when it is changed to a blank text value.  I had the following formula, but it's triggering when it changes from blank to a name and I just want it to trigger when it changes from one name to another name.  Let me know if I can provide any more information, thanks!

AND(ISCHANGED(Billing_Contact__c )
I am new to coding.  I need a little assistance.  I have embedded my flow in a visualforce page and I am trying to create a custom controller to have the flow finish with redirecting the user to the newly created record.

Page:

<apex:page Controller="SplitCaseController">
<flow:interview name="Split_Case" interview="{!myFlow} finishLocation="/{!FinishPage}">
<apex:param name="CurrentCaseID" value="{!Case.Id}"/>
<apex:param name="CurrentUserID" value="{!$User.Id}"/>
</flow:interview>
</apex:page>

Controller

1
2
3
4
5
6
7
8
9
10
11
12
13
14
public class SplitCaseController {

public Flow.Interview.Split_Case myFlow { get; set; }

public String getmyID() {
if (myFlow==null) return '';
else return myFlow.NewCaseID;
}

public PageReference getFinishPage(){
PageReference p = new PageReference('/' + getmyID());
p.setRedirect(true);
return p;
}}

But every time I try to save the page I get the error "Unknown property 'SplitCaseController.Case'

Help!