• elpaso750
  • NEWBIE
  • 25 Points
  • Member since 2009

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

Hi guys,

I'm sorry to bother you again, but still finding myself is a sticky patch with Test classes.

 

We have an escalation policy for Cases which includes an integration with an external system. We kept the integration pretty easy, via email.

 

now, I've created a Class to handle the 'return' message from the external system which updates a field in the CASE:

 

/**
 * Email services are automated processes that use Apex classes
 * to process the contents, headers, and attachments of inbound
 * emails.
 */ 
    
global class processSIACASE implements Messaging.InboundEmailHandler {

CASE[] updateCase = new Case[0];

  // Create variables to handle incoming email  
    
 global Messaging.InboundEmailResult handleInboundEmail(

  Messaging.InboundEmail email, 
  Messaging.InboundEnvelope envelope) {
Messaging.InboundEmailResult result = 
        new Messaging.InboundEmailresult();
   
 
  // Retrieves content from the email.  
  // Splits each line by the simbol # character  
      
string subject = email.subject;    

String[] emailBody = email.plainTextBody.split('#', 0);
String CRNumber = emailBody[1];
String case_number = emailBody[2];

   // RUN an SQL to find the ID of the case to update.

system.debug('value of CRNumber'+CRNumber);
system.debug('value of case_number'+case_number);

CASE cs;
cs = [select ID from CASE where CaseNumber =:case_number limit 1];
    
  // update the case from the information     
  // retrieved from the inbound email  

   try
    {
      updateCase.add(new CASE(ID = cs.id,
      Service_Provider_CR_number__c = CRNumber,
      SIA_Resolution_Description__c = subject));
 
      update updateCase;
   }
    
   catch (System.DmlException e)
   {
System.debug('ERROR: Not able to update CASE: ' + e);
   }
 
return result;
    }   
}

I've tested it sending emails from the external system and this works, and does the job as requested. 

 

Now I've created the Test class in order to deploy it in production:

 

@isTest
private class TestProcessSIACASE {

    static testMethod void myUnitTest() {
     
        Account acct= New Account(Name='Testing Account');
        Insert acct;
        
        Case cs=new Case(Subject='Test Case', 
         AccountId=acct.Id,
         origin='Project',
         Type='Latency', 
         Description='This is a test'); 
       insert cs;
       system.debug('Case entered has Number: '+cs.CaseNumber);
        
       //Test.StartTest(); 
        
           // Create a new email, envelope object and Attachment
	   Messaging.InboundEmail email = new Messaging.InboundEmail();
	   Messaging.InboundEnvelope env = new Messaging.InboundEnvelope();
	 
	   //email.subject = 'MTS: Call Request # 632561 # 50676 # opened';
	   email.plainTextBody = 'MTS: Call Request # 632561 # ' + cs.caseNumber +' # opened';
	   env.fromAddress = 'elpaso750@gmail.com';
	 
	   // call the class and test it with the data in the testMethod
	   ProcessSIACASE TestObj = new ProcessSIACASE();
	   TestObj.handleInboundEmail(email, env );                     
	  //Test.StopTest();
    }
}

 but I'm getting the following error :

 

System.QueryException: List has no rows for assignment to SObject

Class.processSIACASE.handleInboundEmail: line 38, column 6 Class.TestProcessSIACASE.myUnitTest: line 32, column 5 External entry point.

 

Now I put some system.debug to try and troubleshoot what was going wrong. I also did try and force the CASENUMBER to a CASE NUMBER I knew was there in the DB

 

email.plainTextBody = 'MTS: Call Request # 632561 # 50676 # opened';

 

but still get the same error :

 

23:47:49.970|SOQL_EXECUTE_BEGIN|[38]|Aggregations:0|select ID from CASE where CaseNumber =:case_number limit 1
23:47:49.977|SOQL_EXECUTE_END|[38]|Rows:0
23:47:49.977|EXCEPTION_THROWN|[38]|System.QueryException: List has no rows for assignment to SObject
23:47:49.977|METHOD_EXIT|[32]|processSIACASE.handleInboundEmail(Messaging.InboundEmail, Messaging.InboundEnvelope)
23:47:49.977|FATAL_ERROR|System.QueryException: List has no rows for assignment to SObject

 

It appears the Select is not returning any value.

 

 

 

Any suggestion would be highly appreciated.

 

Bye now,

Alex

 

Hi,
I'm overriding standard pagelayout with a visualforce page, but at the same time I'd like to render fields based on the selected recordtype.

I can easily get the recordtype Id by
public string rectypeid {
    get
    {
    rectypeid=ApexPages.currentPage().getParameters().get('RecordType');
    return rectypeid;
}
    set;
    }
Is there an easy way to retrieve the RecordtypeName (like above) or am I forced to use a query:
String RTName = [select Name from RecordType where RecordType.SobjectType = 'My_Obj__c' and RecordtypeId =: rectypeid  limit 1][0].Name;
In order to make the code more readable in the future, I'd prefer to use the name string rather than the Id.

Even if I know maintaining the Id is probably easier than the Name.

thanks for any suggestion,
Alex



 

Hi,

 

hope to get some help on this. 

 

I have made the following class sometime ago and forgot to create the Test Class :

 

public with sharing class mytest2runedit {

public Testing_Item__c ftt {get;set;}
public Software_Testing__c st {get;private set;} 

ApexPages.StandardController ct;

public mytest2runedit(ApexPages.standardController controller){
	   Tests_to_run__c t2r = (Tests_to_run__c)controller.getRecord(); 
        
       ct = controller;       
       t2r = [select id, Software_testing__c, Testing_Item__c, Completed__c, Compulsory__c, Assigne_to_User__c from Tests_to_run__c where id=:controller.getRecord().Id limit 1];
       
        st = [select id, version__c, Software_to_Be_Tested__c from Software_Testing__c where id =: t2r.Software_Testing__c limit 1];
        ftt = [select id, Software__c, name, Description__c from Testing_Item__c where id =: t2r.Testing_Item__c limit 1];
}

public PageReference save()
 {        ct.save();
         return ct.view();
             }
}

 which is working fine, just letting parent records field show up on child record page.

 

Now in hurry to create the test class and getting an invalid type error:

 

    static testMethod void Test_run_edit(){
          // TO DO: implement unit test
        
               // setup a reference to the page the controller is expecting with the parameters
        PageReference pref = Page.Test2Run;
        Test.setCurrentPage(pref);
        
         // create new Software_Testing__c record
        Software_Testing__c po = new Software_Testing__c();
        po.Expected_Test_Complete__c = Date.newInstance(2020,01,01);
        po.Version__c = '4.3.25';  
        po.Platform__c = 'CMF'; 
        po.Software_to_Be_Tested__c = 'MTS Multimarket';
        insert po; 
    
        // create new Testing_Item__c record
 	    Testing_Item__c ti = new Testing_Item__c();
 	    ti.Description__c = 'My Testing Item';
 	    ti.Def_Compulsary__C = true;
 	    ti.Platform__c = 'CMF';
 	    ti.Software__c = 'MTS Multimarket';
		insert ti;	    	
    
        // create new Tests_to_run__c record
 	    Tests_to_run__c tr = new Tests_to_run__c();
 	    tr.Software_Testing__c = po.id;
 	    tr.Testing_Item__c = ti.id;
 	    tr.Compulsory__c = true;
		insert tr;	    	    
    
            // Construct the standard controller
        ApexPages.StandardController con = new ApexPages.StandardController(tr);
 
        // create the controller
Here is where I get the error  
    mytest2runeditController ext = new mytest2runeditController(con);
 
        // Switch to test context
        Test.startTest();
     
        PageReference ref = ext.save();
        // Switch back to runtime context
        Test.stopTest();
    
    }

 

 

Any suggestion, please ?

 

Alex

Hello,

 

what I'm trying to achieve is to have a visualforce page to show both Parent and child fields (VF page object is child)

 

 

I have a custom object 'Tests_to_run__c' with two look-up relations to two custom objects.  
'Tests_to_run__c' is the child.
Object parent 1 is 'Software_Testing__'c and child relationship name is 'Tests2run__r'
Object parent 2 is 'Testing_Item__c' and child relationship name is  'Test_item_to_run__r'
 I'm trying to have the visualforce page to show some fields from the parent Objects here's the page :
<apex:page standardController="Tests_to_run__c" showHeader="true" extensions="mytest2runedit">
<apex:sectionHeader title="Testing the functionality" subtitle="{!ftt.name}"/> 
<apex:form id="Test2run" >
  <apex:messages />
  <apex:pageBlock title="Testing the functionality" id="Test_Block" mode="edit">
  <apex:messages />
      <apex:pageBlockbuttons >
        <apex:commandButton value="Save" action="{!save}"/>
        <apex:commandButton value="Cancel" action="{!cancel}"/>
      </apex:pageBlockbuttons> 
  
   <apex:pageBlockSection title="Complete the Test assigned to you" columns="2" collapsible="False">

      <apex:outputField value="{!Tests_to_run__c.Name}"/>
      <!--  apex:outputField value="{!Tests_to_run__c.Owner}"/-->
      <apex:outputField value="{!st.Software_to_Be_Tested__c}"/> 
	  <apex:outputField value="{!st.Version__c}"/> 

      <apex:outputField value="{!ftt.Software__c}"/>
      <apex:outputField value="{!ftt.Description__c}"/>

      <apex:inputField value="{!Tests_to_run__c.Compulsory__c}"/>
      <apex:inputField value="{!Tests_to_run__c.Assigne_to_User__c}"/>
      <apex:inputField value="{!Tests_to_run__c.Completed__c}"/>      
      <apex:inputField value="{!Tests_to_run__c.Test_Comments__c}"/>            
  
  </apex:pageBlockSection>    
 
  
  </apex:pageBlock>
  </apex:form>
</apex:page>

 

and the controller extensions :
public class mytest2runedit {

public Testing_Item__c ftt {get;set;}
public Software_Testing__c st {get;private set;} 

public mytest2runedit(ApexPages.standardController controller){
	   Tests_to_run__c t2r = (Tests_to_run__c)controller.getRecord(); 
              
       t2r = [select id, Software_testing__c, Testing_Item__c, Completed__c, Compulsory__c, Assigne_to_User__c from Tests_to_run__c where id=:controller.getRecord().Id limit 1];
       
       Software_Testing__c st = [select id, version__c, Software_to_Be_Tested__c from Software_Testing__c where id =: t2r.Software_Testing__c limit 1];
       Testing_Item__c ftt = [select id, Software__c, name, Description__c from Testing_Item__c where id =: t2r.Testing_Item__c limit 1];
}
}

 

If I run the code in the controller from the System Log, I can actually see the above retrieves the parent fields values correctly, but when running the page the values from the parent fields do not appear in the page.
I'm probably justy missing something which I'm unable to figure out.
Any suggestions ?

 

 

Thanks in advance for any help on this.

 

Alex

 

Hi,

our sales and I'm too, are finding hard to use Opportunities and Opportunities Products, becuase:

 

1. when select the products and changing search or page, all the selected products are lost 

1.1. each search shows max 25 products.

2. While selecting the products there's no 'window' showing the already selected products

3. If a/some products are already selected and click again add products, the already selected product appear in the selecteable lists and it is actually possible to duplicate records.

 

Anyone else facing the same situation ?

 

I'm therefore creating something similar using custom objects.

 

as of now I was able to create something which is very similar to the Opportunities Products, now in order to show the already selected products and make sure these do not appear again in the list of products to be selected I'm creating a set of Ids for the items already selected.

 

 

		//Get a set of tests alerady associated to the Object
		Set<ID> seltestIDSet = seltestset();

 and

 
 Private Set<ID> seltestset(){
    Set<ID> seltestIDSet = new Set<ID>();

        
String stqry = 'Select st.name, st.Testing_Item__c, st.Id From Tests_to_run__c st Where st.Software_Testing__c = :o.id Order By st.Name';
         for (Tests_to_run__c st : Database.query(stqry)){

            seltestIDSet.add(st.Testing_Item__c);}
	    return seltestIDSet; 		
}

 now the issue I have is the o.id, where I get Variable not defined.

 

well actually o is defined in the costructor : 

 

    private ApexPages.StandardController controller;
 
    // constructor
    private final Software_Testing__c o;
    public TestSearchController(ApexPages.StandardController stdController) {
         this.o = (Software_Testing__c)stdController.getRecord();       
         }

 

funny thing is I'm using the same o.id (variable) when saving the records:

 

//The list of Tests to Run records to insert
        list <Tests_to_run__c> test2runList = new list <Tests_to_run__c>();
        
        for (TestWrapper cw : selectedTests) {
        	test2runList.add(new Tests_to_run__c 
        	                 (Software_Testing__c = o.id,
        	                  Testing_Item__c = cw.cat.id,
        	                  Compulsory__c = cw.cat.Def_Compulsary__c,
        	                  Assigne_to_User__c = cw.cat.Def_Functionality_Owner__c));
        }
        if (test2runList.size() > 0) {
          insert test2runList;
        }
        controller = new ApexPages.StandardController(o);
        return controller.view();

 

 

And there I did not get any error.

 

Any suggestion ?

 

Thanks

Alex

 

 

Hi,

I'm pretty new to Apex development.

Upon request I was able to create a simple apex class which based on some logic, saves and clones a contact to a new Account. A Visual force page complets the set.

 

Here's the VF page :

 

 

<apex:page standardController="Contact" showHeader="true" tabStyle="contact" extensions="Contactedit">
<chatter:feedWithFollowers entityId="{!contact.id}"/>
<apex:sectionHeader title="Contact" subtitle="{!Contact.name}"/>
  <apex:form id="theForm">
  <apex:pageBlock title="Edit Contact" id="thePageBlock" mode="edit">
  <apex:pageMessages />
    <apex:pageBlockButtons >
        <apex:commandButton value="Save" action="{!save}"/>
        <apex:commandButton value="Cancel" action="{!cancel}"/>               
    </apex:pageBlockButtons>
 
 <apex:pageBlockSection title="Contact Information" columns="2" collapsible="True">
                <apex:inputField value="{!Contact.Salutation}"/>
                <apex:inputField value="{!Contact.Phone}"/>
			    <apex:inputField value="{!Contact.FirstName}"/> 
			    <apex:inputField value="{!Contact.Fax}"/>
			    <apex:inputField value="{!Contact.LastName}"/>
			    <apex:inputField value="{!Contact.MobilePhone}"/>
			    <apex:inputField value="{!Contact.AccountId}"/>
			    <apex:inputField value="{!Contact.Email}"/>
			    <apex:inputField value="{!Contact.Title}"/>
			    <apex:inputField value="{!Contact.Email_2__c}"/> 
			    <apex:inputField value="{!Contact.Department}"/>    
				<apex:inputField value="{!Contact.Email_Opt_Out_Date__c}"/>
   </apex:pageBlockSection>
   <apex:pageBlockSection id="Description" title="Description" columns="1" collapsible="True">
                 <apex:inputTextArea id="newDesc" value="{!Contact.Description}"/>    
   </apex:pageBlockSection>
   <!-- apex:pageBlockSection title="Contact Photo" columns="1">
       <apex:inputField value="{!Contact.Foto__c}"/>
   </apex:pageBlockSection !--> 
   
   <apex:pageBlockSection id="Profile" title="Contact Profile" columns="2" collapsible="True">
          <apex:inputField value="{!Contact.CMF_Profile__c}"/>  
		  <apex:inputField value="{!Contact.BV_Profile__c}"/>
		  <apex:inputField value="{!Contact.MMF_Profile__c}"/> 
          <apex:inputField value="{!Contact.Swapswire_Profile__c}"/>
          <apex:inputField value="{!Contact.Trade_Cancellation_CMF__c}"/>
          <apex:inputField value="{!Contact.BV_Approval__c}"/>
          <apex:inputField value="{!Contact.BV_Fees__c}"/>
          <apex:inputField value="{!Contact.Accounting__c}"/>
          <apex:inputField value="{!Contact.MTS_Data__c}"/>
          <apex:inputField value="{!Contact.DataFeed_UserName__c}"/>
          <apex:inputField value="{!Contact.AssistantName}"/>
		  <apex:inputField value="{!Contact.AssistantPhone}"/>
	      <apex:inputField value="{!Contact.Inactive_Contact__c}"/> 	  
   <apex:pageBlockSectionItem >
   <apex:actionRegion >
   <B><apex:outputLabel value="Left the Company"/></B>
   <apex:outputPanel >
      <apex:inputCheckbox value="{!Contact.Left_the_Company_Flag__c}">
      <apex:actionSupport event="onclick" rerender="Profile" status="status"/>
    </apex:inputCheckbox>
    <apex:actionStatus startText="applying value..." id="status"/>
   </apex:outputPanel>
   </apex:actionRegion>
   </apex:pageBlockSectionItem>
 
  <apex:pageBlockSection Title="Left the Company" columns="2" rendered="{!Contact.Left_the_Company_Flag__c}">
        <apex:inputField value="{!Contact.Moved_to__c}"/>
        <apex:inputField value="{!Contact.Clone_to_new_Account_without_Profile__c}"/>
        <apex:inputField value="{!Contact.Comment__c}"/>
        <apex:inputField value="{!Contact.Clone_to_new_Account_with_Profile__c}"/>
  </apex:pageBlockSection>
  </apex:pageBlockSection>
  
   <apex:pageBlockSection id="Address2" title="Address" columns="2">
       <apex:inputField value="{!Contact.MailingStreet}"/>   
       <apex:inputField value="{!Contact.MailingCity}"/> 
       <apex:inputField value="{!Contact.MailingPostalCode}"/>
       <apex:inputField value="{!Contact.MailingState}"/>   
       <apex:inputField value="{!Contact.MailingCountry}"/>   
    </apex:pageBlockSection>
    
    <apex:pageblocksection id="MTS" Title="MTS Market Configuration" Columns="2">
    
    <apex:inputField value="{!Contact.Linked_Membercodes__c}"/> 
    <apex:inputField value="{!Contact.MTS_CertificateType__c}"/>   
    
      <apex:pageblocksection id="CMF" Title="CMF Platform" Columns="1">
        <apex:inputField value="{!Contact.CMFI_UserID__c}"/>
        <apex:inputField value="{!Contact.CMFI_User_Profile__c}"/>
        <apex:inputField value="{!Contact.CMFI_Platform__c}"/>
	    <apex:outputField value="{!Contact.CMF_Software_Signature__c}"/>
        <apex:outputField value="{!Contact.CMFI_Last_Login__c}"/>
        <apex:outputField value="{!Contact.Multimarket_SW_version__c}"/>           
        <apex:outputField value="{!Contact.Network_Type__c}"/>
      </apex:pageblocksection>
      <apex:pageblocksection id="MMF" Title="MMF Platform" Columns="1">
       <apex:inputField value="{!Contact.MMFI_UserID__c}"/> 
       <apex:inputField value="{!Contact.MMFI_User_Profile__c}"/>
       <apex:inputField value="{!Contact.MMF_Swap_User_ID__c}"/>
       <apex:inputField value="{!Contact.Swapswire_Account__c}"/>
       <apex:inputField value="{!Contact.MMFI_Platform__c}"/> 
      </apex:pageblocksection>
    </apex:pageblocksection>
  
 </apex:pageBlock>
</apex:form>
</apex:page>

 

 

and the class :

 

 

public class Contactedit {
   public Contact Contact {get;set;}
   private ApexPages.standardController controller {get;set;}
   
   Public boolean clonawo {get;set;}
   Public boolean clonawi {get;set;}
   
    	// recovers from Accounts the billing details
    	public Account accountmoved {
        	get{
        		if (accountmoved == null) {
        			accountmoved = [select BillingStreet,BillingCity,BillingCountry,BillingPostalCode,BillingState  from account where id =: contact.moved_to__c];
        		}
                return accountmoved;
        	}
        	set;	
        }
    	
    	public contact clonecontact {
    	get{
    		//initialize the new contact
			if (clonecontact == null){
				contact t = new contact();
				//fill the fields of the new contact record
    			t.firstname = contact.firstname;
    			t.lastname = contact.lastname;
    			t.salutation = contact.salutation;
        		t.accountid = contact.moved_to__c;
        		t.title = contact.Title;
        		t.OwnerId =Userinfo.getUserId();
        		t.Left_the_Company_flag__c = false;
        		t.MailingStreet = accountmoved.BillingStreet;
        		t.MailingCity = accountmoved.BillingCity;
        		t.MailingCountry = accountmoved.BillingCountry;
        		t.MailingPostalCode = accountmoved.BillingPostalCode;
        		t.MailingState = accountmoved.BillingState;
        		t.Phone = '+00';
				
				System.debug('clonawi = ' + clonawi);
				if ((contact.Clone_to_new_Account_with_Profile__c == true)|| (clonawi == true)) {
					t.accounting__c = contact.accounting__c;
				    t.bv_approval__c = contact.bv_approval__c;
				    t.bv_fees__c = contact.bv_fees__c;
				    t.bv_Profile__c = contact.bv_Profile__c;
				    t.CMF_Profile__c = contact.CMF_Profile__c;
				    t.MMF_Profile__c = contact.MMF_Profile__c;
				    t.Swapswire_Profile__c = contact.Swapswire_Profile__c;
				    t.Trade_Cancellation_CMF__C = contact.Trade_Cancellation_CMF__C;
				    }
    			clonecontact = t;
     		}
    		return clonecontact;
    	}
    	set;
    }
    
        public Contactedit(ApexPages.StandardController stdController) {
    	// constructor
    	controller = stdController;
        this.contact= (contact)stdController.getRecord();
        
    }
        public void createcontactAndclone(){
    	// check the ownerId of the position before creating the jobApp & task
    	//  the Task cannot be owned by a Queue
    	
    	// String ownerId = checkOwnerIdForQueue(SelectedPosition.OwnerId);
    	
        
        // We update the current contact instead of insert
        
         try{
        	//insert contact;
        	
        	contact.Clone_to_new_Account_without_Profile__c = false;
        	contact.Clone_to_new_Account_with_Profile__c = false;
        	update contact;
        } catch (Exception e){
        	ApexPages.addMessages(e);
        }
        // checks if either clone was selected and of course the company where moved.
        
        //if ((contact.Moved_to__c != null) && ((contact.Clone_to_new_Account_without_Profile__c == true)||(contact.Clone_to_new_Account_with_Profile__c== true)))
        if ((contact.Moved_to__c != null) && ((clonawo == true)||(clonawi == true)))
        {
        try{
        	system.debug('#######' + clonecontact);
        	// insert the new record on contact
        	insert clonecontact;  
        	//catch exception
        } catch (Exception e){
        	ApexPages.addMessages(e);	
        }
    }
        }
    public PageReference save(){
          clonawo = contact.Clone_to_new_Account_without_Profile__c;
          clonawi = contact.Clone_to_new_Account_with_Profile__c;
    	// updated the Contact and eventually create a new one.
    	createcontactAndclone();
		
		// use the standard controller to perform the save and redirect
    	return controller.view();
    }
}

 

 

 

Making the above and testing the results took me about 2hours. OK maybe it's not the best code, but  hey I'm the new kid.
Now I'm loosing my sleep trying to get the TEST class working, it's more than 4 days now, I'm getting all different kind of errors, this is the test class :
@isTest
private class Test_Contactedit {
    public static testMethod void Contactedit_Test() {
     
       PageReference pageRef = Page.Contact_Edit_layout;
       Test.setCurrentPage(pageRef);
	   
	  Contactedit controller = new Contactedit(new ApexPages.StandardController());  
      String nextPage = controller.save().getUrl();
   
      ApexPages.currentPage().getParameters().put('ContactId', [select id from contact limit 1].id);
                  
      //extension = new contactedit(new ApexPages.StandardController(cont));              
      controller.Left_the_company_flag__c=true;
      controller.Moved_to__c='001R000000bn4Dg';
      controller.Clone_to_new_Account_with_profile__c=true;
      nextPage = controller.save().getUrl(); 
      
    }
}

 

the error I'm getting is : 
Save error: Constructor not defined: [ApexPages.StandardController].<Constructor>()	Test_Contactedit.cls	
 	line 30	Force.com save problem

 

Any help would be highly appreciated.
Alex

 

Hello
I am trying to write an vf email template as follows but keep getting this error message.  Can anyone shed any light as to why?  It is Line 84 (the section I have put in bold text) that is causing the error I think, but I don't know why?  I am learning as I go along, so please bear with me if it is something very obvious!!!  I appreciate any advice.  Thanks

<messaging:emailTemplate subject="A Business Priority 1 Incident #(Ref:IN:{!relatedto.Name}) has been Created for Service {!relatedTo.BMCServiceDesk__FKBusinessService__r.name}" recipientType="User" relatedToType="BMCServiceDesk__Incident__c">
<messaging:htmlEmailBody >
<html>
<body>

<apex:image url="https://c.cs18.content.force.com/servlet/servlet.ImageServer?id=015110000009VFN&oid=00D110000006XnK" width="100" height="30"/>

<p></p>
<h2>Coral Retail Priority 1 Business Notification  </h2>

<p></p>


<style type="text/css">
            body {font-family: Ariel; size: 12pt;}
            .left {FONT-FAMILY: Ariel; COLOR:#FFFFFF; BACKGROUND: #1669BC}
            .right {FONT-FAMILY: Ariel; COLOR:#000000; BACKGROUND: #C6DBEF}
            
            
td {
            border-width: 1px;
            padding: 1px;
            border-style: solid;
            border-color: #000000;
            
        }
        
    

        th { 
            color: #000000;
            border-width: 1px ;
            padding: 1px ;
            border-style: solid ;
            border-color: #000000;
          
        }
        

        </style>



<table>



<tr>
<td class = "left"><b>Incident Description</b></td>
<td class = "right">{!relatedto.BMCServiceDesk__incidentDescription__c}</td> 
</tr>

<tr>
<td class = "left"><b>Category</b></td>
<td class = "right">{!relatedto.BMCServiceDesk__FKCategory__r.name}</td> 
</tr>

<tr>
<td class = "left"><b>Service</b></td>
<td class = "right">{!relatedto.BMCServiceDesk__FKBusinessService__r.name}</td> 
</tr>

<tr>
<td class = "left"><b>Service Offering</b></td>
<td class = "right">{!relatedto.BMCServiceDesk__FKServiceOffering__r.name}</td> 
</tr>

<tr>
<td class = "left"><b>Incident Opened Date and Time&nbsp;&nbsp;</b></td>
<td class = "right"><apex:outputText value="{0,date,EEEE, MMMMM dd, yyyy 'at' HH:mm:ss z}"><apex:param value="{!relatedto.BMCServiceDesk__openDateTime__c + 0.041666666 }" /></apex:outputText></td> 
</tr>

<tr>
<td class = "left"><b>Incident Assigned to</b></td>
<td class = "right">{!relatedto.BMCServiceDesk__Additional_email_information__C}</td> 
</tr>

<tr>
<td class = "left"><b>Incident Number</b></td>
<td class = "right">{!relatedto.Name}</td> 
</tr>

<tr>
 <var="ih" value="{!relatedTo.BMCServiceDesk__Incident_Histories__r}">
<td class = "left"><b>Impact Analysis</b></td>
<td class = "right">{!ih.BMCServiceDesk__note__c}</td> 
</v>
</tr>

</table>
<p>
The IT Service Desk will provide an update on how the resolution of this P1 Incident is progresing in the next 30 minutes
</p>
<p>
<p>
</p>
<br></br>
<b>Regards,<br></br>
IT Service Desk</b>
</p>
<p>
<b>If replying to this email notification please do not change the subject line </b>
</p>
</body>
</html>

</messaging:htmlEmailBody>
</messaging:emailTemplate

Hi,

 

hope to get some help on this. 

 

I have made the following class sometime ago and forgot to create the Test Class :

 

public with sharing class mytest2runedit {

public Testing_Item__c ftt {get;set;}
public Software_Testing__c st {get;private set;} 

ApexPages.StandardController ct;

public mytest2runedit(ApexPages.standardController controller){
	   Tests_to_run__c t2r = (Tests_to_run__c)controller.getRecord(); 
        
       ct = controller;       
       t2r = [select id, Software_testing__c, Testing_Item__c, Completed__c, Compulsory__c, Assigne_to_User__c from Tests_to_run__c where id=:controller.getRecord().Id limit 1];
       
        st = [select id, version__c, Software_to_Be_Tested__c from Software_Testing__c where id =: t2r.Software_Testing__c limit 1];
        ftt = [select id, Software__c, name, Description__c from Testing_Item__c where id =: t2r.Testing_Item__c limit 1];
}

public PageReference save()
 {        ct.save();
         return ct.view();
             }
}

 which is working fine, just letting parent records field show up on child record page.

 

Now in hurry to create the test class and getting an invalid type error:

 

    static testMethod void Test_run_edit(){
          // TO DO: implement unit test
        
               // setup a reference to the page the controller is expecting with the parameters
        PageReference pref = Page.Test2Run;
        Test.setCurrentPage(pref);
        
         // create new Software_Testing__c record
        Software_Testing__c po = new Software_Testing__c();
        po.Expected_Test_Complete__c = Date.newInstance(2020,01,01);
        po.Version__c = '4.3.25';  
        po.Platform__c = 'CMF'; 
        po.Software_to_Be_Tested__c = 'MTS Multimarket';
        insert po; 
    
        // create new Testing_Item__c record
 	    Testing_Item__c ti = new Testing_Item__c();
 	    ti.Description__c = 'My Testing Item';
 	    ti.Def_Compulsary__C = true;
 	    ti.Platform__c = 'CMF';
 	    ti.Software__c = 'MTS Multimarket';
		insert ti;	    	
    
        // create new Tests_to_run__c record
 	    Tests_to_run__c tr = new Tests_to_run__c();
 	    tr.Software_Testing__c = po.id;
 	    tr.Testing_Item__c = ti.id;
 	    tr.Compulsory__c = true;
		insert tr;	    	    
    
            // Construct the standard controller
        ApexPages.StandardController con = new ApexPages.StandardController(tr);
 
        // create the controller
Here is where I get the error  
    mytest2runeditController ext = new mytest2runeditController(con);
 
        // Switch to test context
        Test.startTest();
     
        PageReference ref = ext.save();
        // Switch back to runtime context
        Test.stopTest();
    
    }

 

 

Any suggestion, please ?

 

Alex

Hello,

 

what I'm trying to achieve is to have a visualforce page to show both Parent and child fields (VF page object is child)

 

 

I have a custom object 'Tests_to_run__c' with two look-up relations to two custom objects.  
'Tests_to_run__c' is the child.
Object parent 1 is 'Software_Testing__'c and child relationship name is 'Tests2run__r'
Object parent 2 is 'Testing_Item__c' and child relationship name is  'Test_item_to_run__r'
 I'm trying to have the visualforce page to show some fields from the parent Objects here's the page :
<apex:page standardController="Tests_to_run__c" showHeader="true" extensions="mytest2runedit">
<apex:sectionHeader title="Testing the functionality" subtitle="{!ftt.name}"/> 
<apex:form id="Test2run" >
  <apex:messages />
  <apex:pageBlock title="Testing the functionality" id="Test_Block" mode="edit">
  <apex:messages />
      <apex:pageBlockbuttons >
        <apex:commandButton value="Save" action="{!save}"/>
        <apex:commandButton value="Cancel" action="{!cancel}"/>
      </apex:pageBlockbuttons> 
  
   <apex:pageBlockSection title="Complete the Test assigned to you" columns="2" collapsible="False">

      <apex:outputField value="{!Tests_to_run__c.Name}"/>
      <!--  apex:outputField value="{!Tests_to_run__c.Owner}"/-->
      <apex:outputField value="{!st.Software_to_Be_Tested__c}"/> 
	  <apex:outputField value="{!st.Version__c}"/> 

      <apex:outputField value="{!ftt.Software__c}"/>
      <apex:outputField value="{!ftt.Description__c}"/>

      <apex:inputField value="{!Tests_to_run__c.Compulsory__c}"/>
      <apex:inputField value="{!Tests_to_run__c.Assigne_to_User__c}"/>
      <apex:inputField value="{!Tests_to_run__c.Completed__c}"/>      
      <apex:inputField value="{!Tests_to_run__c.Test_Comments__c}"/>            
  
  </apex:pageBlockSection>    
 
  
  </apex:pageBlock>
  </apex:form>
</apex:page>

 

and the controller extensions :
public class mytest2runedit {

public Testing_Item__c ftt {get;set;}
public Software_Testing__c st {get;private set;} 

public mytest2runedit(ApexPages.standardController controller){
	   Tests_to_run__c t2r = (Tests_to_run__c)controller.getRecord(); 
              
       t2r = [select id, Software_testing__c, Testing_Item__c, Completed__c, Compulsory__c, Assigne_to_User__c from Tests_to_run__c where id=:controller.getRecord().Id limit 1];
       
       Software_Testing__c st = [select id, version__c, Software_to_Be_Tested__c from Software_Testing__c where id =: t2r.Software_Testing__c limit 1];
       Testing_Item__c ftt = [select id, Software__c, name, Description__c from Testing_Item__c where id =: t2r.Testing_Item__c limit 1];
}
}

 

If I run the code in the controller from the System Log, I can actually see the above retrieves the parent fields values correctly, but when running the page the values from the parent fields do not appear in the page.
I'm probably justy missing something which I'm unable to figure out.
Any suggestions ?

 

 

Thanks in advance for any help on this.

 

Alex

 

Is it possible to change the label on a standard button on a standard Salesforce page (e.g., change "Add Product" to "Add Line Item")?  I could create a custom button ---- but how do I find the appropriate Button/Link URL to include for Add Product functionality?

Hello, forum:

 

[Similar question to one I asked in a different thread...]

 

I've created a VF page for creating new child objects from a related list on a parent.  This page has a pageBlock at the top of the page where parent values are displayed.  The 'name' field of the parent displays just fine, but another custom field within the parent does not display.

 

I have this line in my VF page:

 

 

<apex:outputField id="projectName" value="{!Solicitor__c.SOL_Bidding_Opportunity__r.BO_Project_Name__c}"/>

 

But this field doesn't display.

 

My controller extension looks like this:

 

 

public class solicitorExtension { public solicitorExtension(ApexPages.StandardController controller) { Solicitor__c sol = (Solicitor__c)controller.getRecord(); //if you always create the child object through relatedList //parent should not be null if (sol.SOL_Bidding_Opportunity__c != null) { Bidding_Opportunity__c bo = [select BO_Bid_Due_Date_Time__c, BO_Project_Name__c from Bidding_Opportunity__c where id =: sol.SOL_Bidding_Opportunity__c limit 1]; sol.SOL_Bid_Due_Date_Time__c = bo.BO_Bid_Due_Date_Time__c; sol.SOL_Revision_Number__c = 'ORIG'; sol.SOL_Status__c = 'Prospective'; } } }

 

What am I doing wrong?

 

Thank you.

 

 

 

  • February 05, 2010
  • Like
  • 0

Hey everyone.

 

I've been using Eclipse for a while. And until today, whenever I saved my code (ctrl-s) it would save both locally and to the Server. For some reason today, ctrl-s saves only locally. I thought maybe I had a connection issue, but I'm not working offline and doing a force.com - Save to Server works...

 

I'm simply perplexed. I don't think I changed anything. Does anyone know why my ctrl-s save is now only saving locally and not to Salesforce's server? Anyone know how to fix it so it does save?

 

Please note, I am saving to a Sandbox and not production. This is not a new project or a new eclipse. I've had this open for a couple of weeks. Some of my projects for months.

 

Your help is appreciated!

 

I have created a custom component with a controller.

 

When you put this custom controller on a page, you have to set 2 parameters (objectname & searchtext).

The controller will get the values out of this custom controller by doing:

 

String strObjectName = System.currentPageReference().getParameters().get('objectname');

String strText = '%'+System.currentPageReference().getParameters().get('searchtext')+'%';

 
 
Everything is working but now I need to create a test class to deploy this component and controller.
 
How can I create a Test class that will pass the 2 parameters to the controller or how can I make the controller get a result out of System.currentPageReference().getParameters().get('objectname'); ?
 
Thanks for the info? 

Hi.  Our org. has thousands of products.  When we go to add multiple products to one order, we select a few from the first page of the products screen.  When we select "go to next page" we get the message that "your selections from this page will be lost."  How do we select multiple products from multiple pages without losing the products we have already selected?

 

Any help would be greatly appreciated.

 

Thanks.

 

E

Hi ALL

 

I've created a custom object call Quotation and I would like to create a visual force page

in Quotation Tab that will access information in Account, Contacts and other customer object as well

 

I have a field in Quotation call Account_Name which is reference to the name of the account....

 

I don't know why I cannot call the field with the following code, please help !!!

 

<apex:smileytongue:age standardController="Quotation__c">

  {!Quotation__c.Account.Name}

</apex:smileytongue:age>

 

This is the error message I can see...

Error : Invalid field Account for SObject Quotation__c

  • March 09, 2009
  • Like
  • 0
Hello everyone,

I am seeking some help and advice regarding email templates.

Our ORG currently is configured with Accounts >> Opportunities >> Opportunity Line Items (multiple "items" per opp is possible).

What I'm trying to accomplish is:

Pull Account Information, Pull Opportunity Information, BUT ALSO pull Opportunity Line Items for an email template.

Currently, if I send an email template from the opportunity object, it only pulls account and opportunity information.

Anyone have the same problem?  I've tried using VF/APEX templates but I'm pretty new to that.

Please help.

Thanks
I have a parent account which contains a value called TotalFees.
All child accounts of the parent do not contain this field.

I open cases under contacts belonging to the parent account, how can I bring the TotalFees of the parent account into a page within the case? So far I have only managed to bring in the parent account name... but that's all...

Hi,,

I have override child new button as VF page, When I click new button in Parent Related list I need to display  parent name in corresponding field in Child page.. I have to fetch values based on the parent id from another object and displayed it in child page.. But my case Parent Id is display as null ..

My code is
  <apexageBlockSection title="Information" id="info">
    <apex:inputField id="CurrentProject" value="{!Calculated_Measures__c.Project__c}"/>
  </apexageBlockSection>

Any one send sample code for resolve my problem..