• Rajesh3699
  • 230 Points
  • Member since 2016

  • Chatter
  • 7
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
  • 86
I am trying to use a custom controller to get back case comments for a particular case (case id will be in URL).  I need to do this so I can sort columns (very annoying that Salesforce doesn't allow this with dataTables).  Right now I'm just trying to get some data back from my controller and failing miserably.

How can I do this?

So far this doesn't work....
****My test VF page****
<apex:page standardController="Case" extensions="TestController"> 
    <apex:form >   
        <apex:pageBlock title="{!Case.CaseNumber}"> 
***My test controller***
public class TestController {
    public List<Case> caseComm {get;set;}
    public TestController(ApexPages.StandardController controller) {
    public List<Case> caseComm() {   
		List<Case> comments = [Select (Select Id, 
                            From CaseComments) From Case ];
        return comments;

Hi All,
Through custom coding and not a configuration.
I want to Map Contact to Opportunity Custom field while converting Lead.
I'm able to map Existing contact and Account name but after conveting Lead newly created contact i need to Map.Please any one have any Idea?

  • March 25, 2019
  • Like
  • 0
hello , i am not being able to run my test class for this controller , 

public class addLaborProposalCntrl {
    Public string leadID{get;set;}
    Public string testlpropID{get;set;}
    Public Lead lead {get;set;}
    Public Laborer_Mid_Construction_Proposal__c lprop {get;set;}
    Public Laborer_Mid_Construction_Proposal__c testlprop {get;set;}

    public addLaborProposalCntrl () {                  
    testlprop = [SELECT Marketing_Material__c, Holiday_Coverage__c,Management_and_Supervision__c, Over_Time_Hours__c, Pricing__c , Payment_Terms__c,Statement_of_Work__c,Supplies_and_Equipment__c FROM Laborer_Mid_Construction_Proposal__c where Name LIKE 'Test%' Limit 1 ];
    leadID = apexpages.currentpage().getparameters().get('id');
    lead = new Lead(ID = leadID);
    lprop = new Laborer_Mid_Construction_Proposal__c(Lead__c = LeadID );
Public PageReference saveRecordlprop(){
upsert lead;
update testlprop ; 
lprop.Marketing_Material__c = testlprop.Marketing_Material__c;
lprop.Holiday_Coverage__c = testlprop.Holiday_Coverage__c;
lprop.Management_and_Supervision__c = testlprop.Management_and_Supervision__c ;
lprop.Over_Time_Hours__c = testlprop.Over_Time_Hours__c ;
lprop.Payment_Terms__c = testlprop.Payment_Terms__c ;
lprop.Pricing__c = testlprop.Pricing__c ;
lprop.Statement_of_Work__c = testlprop.Statement_of_Work__c  ;
lprop.Supplies_and_Equipment__c = testlprop.Supplies_and_Equipment__c ;
upsert lprop;  
    PageReference p = new PageReference('/' + this.lprop.Id );
    return p;


this is my Test Class 

public class addLaborProposalCntrlTest{

static testMethod void testMethod1() {

        Lead testRecord= new Lead();
        testRecord.LastName = 'test name ';
        testRecord.Company = 'test company';
        testRecord.Status = 'new';
        testRecord.Credit_Limit_Amount__c = 12344;
        insert testRecord;

        Laborer_Mid_Construction_Proposal__c testRecord2 = new Laborer_Mid_Construction_Proposal__c();
        testRecord2.Lead__C = testRecord.ID;
        testRecord2.Marketing_Material__c = 'test';
        testRecord2.Holiday_Coverage__c = 'test';
        testRecord2.Management_and_Supervision__c = 'test';
        testRecord2.Over_Time_Hours__c = 'test';
        testRecord2.Payment_Terms__c = 'test';
        testRecord2.Pricing__c = 'test';
        testRecord2.Statement_of_Work__c = 'test';
        testRecord2.Supplies_and_Equipment__c = 'test';
        testRecord2.Name = 'test';
        insert testRecord2;
        update testRecord2;

        System.currentPageReference().getParameters().put('id', testRecord2.Id);
        addLaborProposalCntrl addjobCntrlTestIns = new addLaborProposalCntrl();

it gives this error 

System.TypeException: Invalid id value for this SObject type: a091g0000085HO8AAM error 

can anyone please help me in this 
Create a Vf page Which displays Accounts Name and related contact[Picklist] in a table format and Having a button in the last Column ""Delete"".It will delete the account and all the contacts related to the account."
Hi All,
We have a trigger on our case object that summarizes a number field on each related activity when that case closes.  Problem is the trigger only works for some employees for some reason. I have a debug file for a user when the trigger fails but the file its too long to post on this forum (I can only paste 32,000 characters in a post. What should i do to go about solving this issue? I have a feeling the issue is a very simple fix for someone that uderstands apex code well.


Hi,am sharing screen shot for need to dipsly related contacts of Account and selected record needs to be delete for this I need VF page code and controller 
User-added image
I'm trying to complete the Trailhead: Customize a Sales Path for Your Team > Customize Opportunity Stages.  One of the steps is adding the field "Main Competitors" to the Needs Analysis tab in the Path.  I can't find that field as an option.  Oddly, I can't find that as an Opportunity field in any of my orgs.  I tried adding it both as a custom text area and a multi-picklist.  Neither succeeded.  I can't complete the trail because I keep getting an error on that step.

Any ideas what I need to do?
Hello All,

Its been mentioned in  the Apex Guide that, we can keep track of the email i,e number of times the email has been opened etc.
We have this option  mail.setSaveAsActivity(true) that will create a activity in salesforce for specific record, but that does not show up how many times the email has been opened / not opened.

Can we someone let me know how we can achieve this..?
User-added image
Hello All,

I have 3 questions.

1. In Pardot, the prospect shows as Never Actiive, and I have read that, only by opening a form, visiting webpages, clicking a link can make a prospect as active, Is that true...?

Is there a way apart from above to make a prospect active...?

2. If the prospect is shown as never active, can we not send emails using Automation rules..?

3. Say for ex: 5 prospects are matched to the automation rule criteria, and after I make the Automation rule to resume. Will the action associated with the Automation rule start performing for the 5 prospect or how ..?

Thank You
I have written a test on invocable apex class used in process builder and its failed. plz find the below code and help me out where i am going wrong also atteched the error 

Error --
System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_EXECUTE_FLOW_TRIGGER, We can't save this record because the “Account Owner Change” process failed. Give your Salesforce admin these details. <b>An unhandled fault has occurred in this flow</b><br>An unhandled fault has occurred while processing the flow.  Please contact your system administrator for more information.: []

code --
public class RequestPortalRecordsTest {

    static testMethod void OwnerUpdateMethodTest() {
        Food_Service_Bulk_Data_Processing_Limit__c c=new Food_Service_Bulk_Data_Processing_Limit__c();
        insert c;
          Account acc = new Account();
          acc.Name = 'TestAccount';
       insert acc;
       Request_Portal__c rp = new Request_Portal__c ();
        rp.Account_Name__c = acc.id;
        insert rp;
        List<Request_Portal__c> rpList = new List<Request_Portal__c> ();
         //  public static void ReqChange(List<Request_Portal__c> rp)

I'm creating a Workflow rule. My requirement is to send an email when the criteria and formula meet.
Whenever a new Lead is created and Lead Stage =Marketing Qualified or Lead owner is edited. It will trigger an email.

My Formula:AND( 
Text(Status)= 'Marketing Qualified', 
OR(isChanged(OwnerId), isChanged(Status), isChanged(Number_of_Form_Submissions__c), isNew()) 
Please any one help me on this.



-i want image placed in side by side but i will show vertically.
- requrement is simple:

- i want grand chaild of image URL field Show on Parent object. 
IP(Parent Object) --> WO(Child Object) --- Grand Child(SI)

*******APEX controller***********************

public class WorkOrdersInstaIPTemplateSharinPixImage{
    public List<IP_Template__c> IPTemplateLst {get;set;}
    public List<String> urlList {get;set;}
    public Map<String, List<ImageParam>> urlString{get;set;}
    public Boolean hasNoImage{set;get{
        return urlString.size()==0?true:false;
    public  WorkOrdersInstaIPTemplateSharinPixImage (ApexPages.StandardController stdCtrl) {
        Id workOrderId = stdCtrl.getId();   // Work order ID
        urlString= new Map<String, List<ImageParam>>();
        Set <ID> installedProductSet= new Set <ID>();  // SET of Installed Product ID
        System.debug('Installed Product :' + installedProductSet);
        List<SVMXC__Service_Order__c> workOrderLSt = new  List<SVMXC__Service_Order__c>(); //List Of Work Order
        workOrderLSt=[select Id,SVMXC__Component__c,IP_Template_Type__c from SVMXC__Service_Order__c where Id = :workOrderId AND IP_Template_Type__c !=NUll]; //Fetch the Wo related Installed Product
        for(SVMXC__Service_Order__c woInstall: workOrderLSt)
            system.debug('woInstall.SVMXC__Component__c:- '+woInstall.SVMXC__Component__c);
            system.debug('installedProductSet:- '+installedProductSet);
        IPTemplateLst= [SELECT
                        (Select Id, sharinpix__ImageURLFull__c,Landscape_Portrait__c,sharinpix__FileName__c, sharinpix__AlbumID__c FROM SharinPix_Images__r order by sharinpix__SortPosition__c ASC),
                        (SELECT Id, sharinpix__SharinPix_Token__c FROM SharinPix_Albums__r)
                        FROM IP_Template__c
                        Where Installed_Product__c IN:installedProductSet AND Type__c!=Null
                        ORDER BY
                        ASC]; //Fetch the IP temate related to Installed Product
        urlList= new List<String>();
        System.debug('IPTemplateLst :'+IPTemplateLst);
        List<IP_Template__c> IPTemplate = new List<IP_Template__c>(); 
        For(IP_Template__c  ip: IPTemplateLst)
            For(SVMXC__Service_Order__c work:workOrderLSt)
                if((ip.Installed_Product__c==work.SVMXC__Component__c)&& (ip.Type__c==work.IP_Template_Type__c ))
        for(IP_Template__c titleUrl:IPTemplateLst) 
            List<ImageParam> urlValues = new List<ImageParam>();
            for(SVMXC__Service_Order__c work:workOrderLSt){
                if((titleUrl.Installed_Product__c==work.SVMXC__Component__c)&& (titleUrl.Type__c==work.IP_Template_Type__c ) )
                    for(sharinpix__SharinPixImage__c b: titleUrl.SharinPix_Images__r)
                        urlValues.add(new ImageParam(b, titleUrl.SharinPix_Albums__r[0].sharinpix__SharinPix_Token__c));                
                    urlString.put(titleUrl.Title__c, urlValues);     
        System.debug('urlString :'+urlString);
    public class ImageParam{
        public String imageUrl{set;get;}
        public String albumId{set;get;}
        public String tokenString{set;get;}
        public String LandscapePortrait{set;get;}
        public String fileName{set;get;}
        public ImageParam(sharinpix__SharinPixImage__c img, String tokenString){
            this.imageUrl = img.sharinpix__ImageURLFull__c;
            this.albumId = img.sharinpix__AlbumID__c;
            this.LandscapePortrait = img.Landscape_Portrait__c;
            this.fileName = img.sharinpix__FileName__c;
             sharinpix.Client spClient = sharinpix.Client.getInstance();
            Map<String, Object> params = new Map<String, Object> {
            	'album_id' => albumId,
            	'path' => '/pagelayout/'+albumId,
            	'exp' => (DateTime.now().getTime()/1000) + 300,
                'Id' => albumId,
            	'abilities' => new Map<String, Object> {
                    'tags' => new Map<String, Object> {
                           'read' => true     
					albumId => new Map<String, Object> {
						'Access' => new Map<String, Object> {
                            'see' => true,
                            'image_list' => true,
                            'image_upload' => true,
                            'image_delete' => true,
                            'image_annotate' => true,
                            'image_tag' => true
                        'Display' => new Map<String, Object>{
                            'see' => true,
                            'tags' => true,
                            'date' => 'L'
            this.tokenString = spClient.token(params);
************* VF code***************
<apex:page standardController="SVMXC__Service_Order__c" extensions="WorkOrdersInstaIPTemplateSharinPixImage">
    <apex:form >
        <apex:pageBlock rendered="{! !hasNoImage}">
            <apex:outputPanel style="overflow:hidden; height:100%"> 
                <apex:pageBlockTable value="{!urlString}"  var="title" >
                    <apex:column style="vertical-align: top;">
                        <apex:facet name="header">Title</apex:facet>
                    <apex:column >
                        <apex:facet name="header">IP Template Images</apex:facet>  
                        <apex:panelGrid columns="5">
                            <apex:repeat value="{!urlString[title]}" var="img">
                                            <figure style="margin-left: -0.5rem;">
                                                <a href="javascript:void(0);"
                                                   onclick="openImage('{! img.albumId }', '{! img.tokenString}')" >
                                                    <img src="{!img.imageUrl}" height="150" width="160" alt="img not available" style= "display: block; padding-right: 0.5rem; padding-left: 0.5rem; padding-top: 1rem; margin:0" />
                                                <figCaption style='font-size: smaller;'>&nbsp;&nbsp;{! img.fileName } &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{! img.LandscapePortrait }</figCaption>
        <apex:outputPanel rendered="{!hasNoImage}">
            <span style="background-color: #FFFFFF; font-size: 300%; height: 700px; width: 600px;">
                No Image Found
    function openImage(albumId, tokenString){
    <!--    <sharinpix:SharinPix parameters="{! parameters }" height="500px"></sharinpix:SharinPix> -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.4.1/semantic.min.css"/> 
        .pbBody table.list tr.headerRow td, body .pbBody table.list tr.headerRow th {
        min-width: 5rem;


User-added image​​​​​​​
I'm doing a trigger that is triggered from the Assigned Resource.  The trigger works in the UI, however, I'm having an issue with the Test Code.

I receive an error:
FIELD_CUSTOM_VALIDATION_EXCEPTION, Cannot change status from New to Scheduled: []

Now, if i do the same from the UI, there is no error regarding the status change.  The status change is allowed in the FSL administration.  I can assign using the dispatcher console - all good.  And I can mimic the process i'm using in the test code in the UI (editing the SA directly) with out error.  
Wondering if any one has seen this error before?
Code is included below:
@isTest static void test_AssignedResource_Insert() {
		List<AssignedResource> toInsert = new List<AssignedResource>();

		//retrieve a service resource
		List<ServiceResource> listSR = new List<ServiceResource>([SELECT Id, Name FROM ServiceResource WHERE Name = 'Technician One']);
		ServiceResource sr1 = listSR[0];

		// retrieve the Service Appointment created by test data
		List<WorkOrder> workOrders = new List<WorkOrder>([SELECT Id FROM WorkOrder WHERE Subject ='Test Subject1']);
		List<Id> woIds = new List<Id>();
		for (WorkOrder wo : workOrders ) {
		if (woIds.size() > 0 ) {
			List<ServiceAppointment> appts = new List<ServiceAppointment> ();
			appts = [SELECT Id FROM ServiceAppointment WHERE Work_Order__c IN :woIds];
			//for all the appts - should be one - create an assigned resource
			if(appts.size()>0) {
				for( ServiceAppointment sa : appts ) {
					sa.SchedStartTime = datetime.newInstance(2019, 4, 19, 11, 00, 0);
					sa.SchedEndTime = datetime.newInstance(2019, 4, 19, 11, 30, 0);

					AssignedResource ar = new AssignedResource(ServiceAppointmentId=sa.Id,ServiceResourceId=sr1.Id);
				update appts;

				insert toInsert;

				List<ServiceAppointment> assignedSA = new List<ServiceAppointment>([SELECT Id,Technician_Name__c FROM ServiceAppointment WHERE Work_Order__c IN :woIds]);
				System.assertEquals(assignedSA.size(), 1);

			} else {


		} else {
			System.assertNotEquals(woIds.size(), 0);

the error occurs on the insert of the assigned resources
insert toInsert;
IF i change the code such that I manually do the status change in the code example:
sa.SchedStartTime = datetime.newInstance(2019, 4, 19, 11, 00, 0);
sa.SchedEndTime = datetime.newInstance(2019, 4, 19, 11, 30, 0);
sa.Status = 'Scheduled';
the error is returned for the update of the service appointments.
update appts;

Feed back greatly appreciated.


How to throw the Error message in field side and manidatry field also throw the error message one by one field.
not error throw message in top and botume
example image  User-added image
I am trying to use a custom controller to get back case comments for a particular case (case id will be in URL).  I need to do this so I can sort columns (very annoying that Salesforce doesn't allow this with dataTables).  Right now I'm just trying to get some data back from my controller and failing miserably.

How can I do this?

So far this doesn't work....
****My test VF page****
<apex:page standardController="Case" extensions="TestController"> 
    <apex:form >   
        <apex:pageBlock title="{!Case.CaseNumber}"> 
***My test controller***
public class TestController {
    public List<Case> caseComm {get;set;}
    public TestController(ApexPages.StandardController controller) {
    public List<Case> caseComm() {   
		List<Case> comments = [Select (Select Id, 
                            From CaseComments) From Case ];
        return comments;

I noticed that I cannot create a rollup summary from the Account and Contact objects. I have created a custom checkbox on the contact field labeled "Champion" as well as a custom number field on the Account object labeled "Number of Champions." I created a trigger on the contact object but it does not seem update the "Number of Champions" field. This is my first trigger, so guidance would be greatly appreciated.

User-added imageUser-added imageUser-added image

Wondering if I get an email with the most recent case comment and I reply back, is there a way to have it save as a case comment in the case it came from?  We do not use email-to-case as we don't want cases created from emails.  Just want the emails someone replies to to save as a case comment on the case they came from. 
  • April 01, 2019
  • Like
  • 0
Hi there, i have an error while click on save button.

"System.NullPointerException: Attempt to de-reference a null object
Error is in expression '{!upload}' in component <apex:commandButton> in page aqthc:booking_funnel_settings: Class.aqthc.FileUploadController.upload: line 31, column 1".

<apex:page controller="FileUploadController">
  <apex:sectionHeader title="Visualforce Example" subtitle="File Upload Example"/>
  <apex:form enctype="multipart/form-data">
    <apex:pageMessages />
    <apex:pageBlock title="Upload a File">
      <apex:pageBlockButtons >
        <apex:commandButton action="{!upload}" value="Save"/>
      <apex:pageBlockSection showHeader="false" columns="2" id="block1">
        <apex:pageBlockSectionItem >
          <apex:outputLabel value="File Name" for="fileName"/>
          <apex:inputText value="{!document.name}" id="fileName"/>
        <apex:pageBlockSectionItem >
          <apex:outputLabel value="File" for="file"/>
          <apex:inputFile value="{!document.body}" filename="{!document.name}" id="file"/>
        <apex:pageBlockSectionItem >
          <apex:outputLabel value="Description" for="description"/>
          <apex:inputTextarea value="{!document.description}" id="description"/>
        <apex:pageBlockSectionItem >
          <apex:outputLabel value="Keywords" for="keywords"/>
          <apex:inputText value="{!document.keywords}" id="keywords"/>
        <form action="/action_page.php">
        Select your favorite color:
            <input style="margin-left: 1px;" type="color" name="favcolor" value="#ff0000"/>
            <input style="margin-left: 30px;" type="submit"/>
public with sharing class FileUploadController {
 public List<aqthc__Healthcare_Settings__c> objHSList {get;set;}
  public Document document {
    get {
      if (document == null)
        document = new Document();
      return document;
  public PageReference upload() {
    document.AuthorId = UserInfo.getUserId();
    document.FolderId = UserInfo.getUserId(); // put it in running user's folder
    try {
      insert document;
    } catch (DMLException e) {
      ApexPages.addMessage(new ApexPages.message(ApexPages.severity.ERROR,'Error uploading file'));
      return null;
    } finally {
      document.body = null; // clears the viewstate
      document = new Document();
    ApexPages.addMessage(new ApexPages.message(ApexPages.severity.INFO,'File uploaded successfully'));
    aqthc__Healthcare_Settings__c objHc = new aqthc__Healthcare_Settings__c();
        objHc.Name = document.name;
        //objHc.aqthc__Background_Color__c = document  ;
        //objHc.aqthc__Background_Image_URL__c = document.FolderId;
       insert objHSList;
    return null;

Please help!
Hi Guys,

I have designed class to send email to opprotunity contact roles. i need to write test class for below class
public class OppsendEmail {   
    public String subject {get; set;}
    public String body {get; set;}
    public blob attbody {get; set;}
    public String attname {get; set;}
    public String sendTo {get; set;}
    public list<string> toAddresses {get; set;}
   // public String Opportunity.Contact__c {get; set;}
    public String oppList {get; set;}
    public list<document> docList {get; set;}
    public List<Opportunity> Opp = new list<Opportunity>();
    public Map<Id, Opportunity> relatedOppMap = new Map<Id, Opportunity>();
    List<OpportunityContactRole> contactRoleArray = new List<OpportunityContactRole>();
    List<Contact> ContactList = new List<Contact>();
    public List<AttchCls> attchLst {set;get;}
    public String currentUserEmail {get; set;}
    // Custom Label
    public string customLabelValue{get;set;}   
    public String accountnumber { get; set; }
    public String accountid { get; set; }
    public Opportunity Opportu {get;set;}
    ApexPages.StandardController controller;
    /* Content */
    public string content { get; set; }
    public transient  ContentVersion contentRecord { get; set; } 
    // Constructor to get Opportunity data
    public OppsendEmail(ApexPages.StandardController controller){     
        contentRecord = [select id, Title, VersionData, PathOnClient, FileExtension from ContentVersion 
                         where ContentDocumentId =: system.Label.New_Project_Survey_ID LImit 1];
        content = contentRecord.Title;      
        this.controller = controller;
         Opportu = (Opportunity)controller.getRecord();

        opp = [Select OwnerId, (Select OpportunityId, Contact.Email From OpportunityContactRoles) From Opportunity 
                                where id in (Select OpportunityId From OpportunityContactRole where ContactId != '') 
                                AND Id =: ApexPages.currentPage().getParameters().get('id')];
        system.debug('ApexPages.currentPage().getParameters().get() >>>>>. Line 19'+ApexPages.currentPage().getParameters().get('id'));
        contactRoleArray =[select ContactID, Contact.Email, isPrimary, opportunityId from OpportunityContactRole Where isPrimary = true AND opportunityId =: ApexPages.currentPage().getParameters().get('id')];
        currentUserEmail = UserInfo.getUserEmail();
        body = 'Default body';
        subject = 'Default subject';
        system.debug('contactRoleArray >>>>> Line 18  '+contactRoleArray);
        system.debug('Emaillist >>>>>. Line 34'+sendTo);
        system.debug('currentUserEmail >>>>>. Line 28'+currentUserEmail );
    public void PopulateAccNumber() {
     contactRoleArray =[select ContactID, Contact.Email, isPrimary  from OpportunityContactRole Where isPrimary = true AND opportunityId =: ApexPages.currentPage().getParameters().get('id')];
    public PageReference uploadPDF(){
        String CurrentLoginUserId = UserInfo.getUserId();
        Opportu = (Opportunity)controller.getRecord();
        Id ContactID = Opportu.Contact__c;
        system.debug('Opportu'+Opportu.Contact__c+'   '+'ContactID   '+ContactID);        
        sendTo = [SELECT Id, Email, Name From Contact WHERE Id =: ContactID].Email;
        system.debug('sendTo Line 75 >>>'+sendTo);

        try {
            Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage();  
            customLabelValue = System.Label.New_Project_Survey_ID;          
            transient ContentVersion  cv_list = [select id, Title, VersionData, PathOnClient, FileExtension from ContentVersion 
                                                    where ContentDocumentId = : customLabelValue LImit 1];
            string EamilAttTitle = cv_list.Title+'.'+cv_list.FileExtension;
            transient Blob b = cv_list.versionData;
            // Create the email attachment
            Messaging.EmailFileAttachment efa = new Messaging.EmailFileAttachment();
            email.setFileAttachments(new Messaging.EmailFileAttachment[] {efa});
            String[] toAddresses = new String[]{SendTo};
            String[] currentUserEmails = new String[]{currentUserEmail};
            email.setToAddresses( toAddresses );
            String[] ccAddresses = new String[] {currentUserEmail};
            // Sends the email  
            Messaging.SendEmailResult [] r = Messaging.sendEmail(new Messaging.SingleEmailMessage[] {email});
            List<Task> taskList = new List<Task>();
            for(Opportunity Op : opp){
                   Op.Survey_Sent_Date__c = Date.today(); 
                   Op.Survey_Status__c = 'Sent';
                       Task newTask = new Task(
                       WhatId = op.Id,                    
                       OwnerId = CurrentLoginUserId ,                    
                       ActivityDate = Date.today(),
                       Subject = 'New Project Survey Sent',
                       Description = ' ',
                       WhoId = ContactID 
            update opp;
            insert taskList;
         Id Opport = ApexPages.currentPage().getParameters().get('id');
         system.debug('Opport 95'+Opport);
         PageReference pgref = new PageReference('/' + Opport);
         return pgref;
        catch(exception e){
            apexPages.addMessage(new ApexPages.Message(ApexPages.Severity.INFO,'e-'+e));
        return null;
    public class AttchCls{
        public boolean isSel {set;get;}
        public boolean ishd {set;get;} 
        public id cvId {set;get;}
        public Attachment att {set;get;}
Started test class
public class OppsendEmailTest{
    static testMethod void createAccount(){
        Account a = new Account();
        a.Name = 'Test Co.';
        a.BillingStreet = '4332 Holden Street';
        a.BillingCity = 'San Diego';
        a.BillingState = 'California';
        a.BillingPostalCode = '92101';
        a.BillingCountry = 'United States';
        a.Phone = '501-555-5555';
        a.Website = 'www.testco.com';
        insert a;
        System.debug('created account');
        //Then create a primary contact
        Contact c = new Contact();
        c.FirstName = 'Paul';
        c.LastName  = 'Test';
        c.AccountId = a.id;
        c.MailingStreet = '298 S. Ringo Street';
        c.MailingCity = 'San Diego';
        c.MailingState = 'California';
        c.MailingPostalCode = '92101';  
        c.MailingCountry = 'United States';       
        insert c;
        System.debug('created primary contact');
        //Then create another non-primary contact
        Contact ci = new Contact();
        ci.FirstName = 'Bob';
        ci.LastName  = 'Test';
        ci.AccountId = a.id;
        ci.MailingStreet = '298 S. Ringo Street';
        ci.MailingCity = 'San Diego';
        ci.MailingState = 'California';
        ci.MailingPostalCode = '92101'; 
        ci.MailingCountry = 'United States';
        insert ci;
        System.debug('created primary contact');
        //Now create an opportunity
        Opportunity o = new Opportunity();
        o.RecordType = [SELECT Id, Name, DeveloperName FROM RecordType WHERE Name = 'Airway Opportunity' LIMIT 1];
        o.Name = 'New Record';
        o.StageName = 'Posted';
        o.CloseDate = Date.today();
        o.Description = 'Test Record';
        insert o;
        System.debug('created opportunity');
        //Now update the OCR for the primary contact
        OpportunityContactRole ocr = new OpportunityContactRole();
        ocr.ContactId = c.Id;
        ocr.OpportunityId = o.Id;
        ocr.IsPrimary = TRUE;
        ocr.Role = 'Decision Maker';
        insert ocr;
        System.debug('created opportunity contact role for primary');
        //Now update the OCR for the non-primary contact
        OpportunityContactRole ocr1 = new OpportunityContactRole();
        ocr1.ContactId = ci.Id;
        ocr1.OpportunityId = o.Id;
        ocr1.IsPrimary = FALSE;
        ocr1.Role = 'Decision Maker';
        insert ocr1;
        System.debug('created opportunity contact role for non-primary contact');
        Update o;           

iam unable to pass data into test class . Help me to design test class
Hi Friends. sorry to post such a blatant cry for help. But I can't this to work. I have a VF Page that renders as a PDF. I need to get the final  <td> in to align left and merge two rows so that the output is centered. Everything I ends up causing the entire page to fall apart. 

Here is a sample of a block I need to adjust. The final <td> That contains the <apex:outputText> should span two rows that the output can be centered vertically. 
<tr width="100%">
            <td width="25%" class="icon-label">
                <span class="icon-label">
                    Percent of Influencers Contacted
            <td width="50%" align="center">
                <apex:outputText value="{0, number, 0}%" style="font-size: 38px; font-weight: bold;
                                        font-family: SansSerif;
                                     color: {!if(Region__c.Percent_Influencers_Contacted__c >= 50, '#00a846',
                                     if(Region__c.Percent_Influencers_Contacted__c >= 35, '#aabb1a',
                                     if(Region__c.Percent_Influencers_Contacted__c >= 20,'#f0b428',
                                     if(Region__c.Percent_Influencers_Contacted__c >= 10, '#FF6428', '#B42846'))))}">

                    <apex:param value="{!FLOOR(Region__c.Percent_Influencers_Contacted__c)}"/>
            <td width="25%">
        <tr width="100%">
            <td width="25%" class="icon">
                <apex:image url="{!$Resource.icon_percent_contacted}" height="45" width="45"/>
            <td width="50%" class="center_text">
                Percentage of total influencers who have received at
                least one email communication in the past 90 days
            <td width="25%" align="center" class="grade_Output">
                <apex:outputText value="{!Region__c.Percent_Contacted_Grade__c}"
                                 style="font-size: 51px; font-weight: bold;
                                 margin-bottom: 20px; font-family: SansSerif;
                                     color: {!if(Region__c.percent_contacted_grade__c='A', '#00a846',
                                     if(Region__c.percent_contacted_grade__c ='B', '#aabb1a',
                                     if(Region__c.percent_contacted_grade__c ='C','#f0b428',
                                     if(Region__c.percent_contacted_grade__c ='D', '#FF6428', '#B42846'))))}"/>
The end state is the block where the letter F is right now should be centered vertically. 

User-added imageThank you for an
If oppotunity amount filed has more than 1.5M, how to restrict every one except manger, every one has access if amount is less than 1.5M.
Also in the report how to stop viewing, if some one else can create the report also shouldn't be able to make it.
  • March 26, 2019
  • Like
  • 0