• AdamDaw
  • NEWBIE
  • 65 Points
  • Member since 2010
  • Head of Engineering
  • CoVenture


  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 30
    Replies
Was wondering if anyone found a work around to editing Html / Visual Force Template in preview before sending ?
I need to incorporate a table within the template but some section of the email has to editable.

Has anyone succesfully logged into a sandbox instance using the beatbox client? I've tried setting the default server url value to https://test.salesforce.com/services/Soap/u/20.0 instead, but I'm getting an INVALID_LOGIN SoapFaultError when I try to log in from that point.

 

Cheers

 

Adam

Hello Everyone,

 

I hope there's a straightforward solution to this, but I've looked over the documentation and searched the web for a while, and maybe it's the length of time I've been staring at this conundrum but I'm at a loss as to how to resolve it.

 

Here's the situation:

 

- ObjectA has a lookup relationship to ObjectB

- ObjectA has a master-detail relationship to ObjectC (A detail, C Master)

- ObjectB has a master-detail relationship to ObjectD

- ObjectD has a lookup relationship to ObjectC (D detail, C Master)

 

I'm trying to create a trigger on Object A insert/updates that will rollup the values for a field on all 'Object A's related to an Object D (through Possibly Multiple 'Object B's) and display that sum on the Object D. 

 

So right now, I'm doing the following:

 

 

trigger ARollup on ObjectA (after insert, after update) {
double sumTotalValue = 0.0;

ObjectD[] od = new ObjectD[]{};

if(Trigger.isInsert)
{
ObjectA[] aNew = trigger.new;

for(ObjectA a : aNew)
{
for (ObjectB[] ob : [select Id, ObjectBtoObjectDKey from ObjectB where Id = :a.ObjectAtoObjectBKey] )
{
for (ObjectD[] o : [select Id, SumField from ObjectD where Id in :ob.ObjectBtoObjectDKey])
{
for (ObjectA oa: [select Id, FieldtoSum from ObjectA where Id = :a.id])
{
sumTotalValue += oa.FieldtoSum;
}
o.SumField = sumTotalValue;

od.add(o);
}

}
}
update od;
}
}

 

Naturally, this doesn't work at this point, as I'm getting a "Save error: Initial term of field expression must be a concrete SObject: LIST:SOBJECT:ObjectB" error from the IDE, but I'm just not sure how to work around it. I thought about going through ObjectC, but I'm not sure if that's the place I should go.

 

I hope this makes sense - if not, I'll be happy to clarify.

 

Any help figuring out how to go about this properly would be greatly appreciated.

 

Update: I've bypassed the error by selecting where id = ob.get(0).ObjectBtoObjectDKey , but I still feel like this is wrong, so any other suggestions would be helpful.

 

 

Best Regards

 

ZG 

 

Message Edited by ZenGuin on 01-11-2010 06:48 PM
Working on a test class and am missing something basic, error is System.NullPointerException: Attempt to de-reference a null object  and the stack trace is Class.programclone.<init>: line 39, column 1
Class.testclonedppage.test_method_one: line 52, column 1

VF page 
 
<apex:page Controller="programclone" >
 


     <apex:form id="frm1" >
     

     
        <apex:pageblock >
        
            <apex:pageBlockButtons >
                <apex:commandButton value="Save" action="{!Save}" />
                <apex:commandButton value="Cancel" action="{!cancel}" />
            </apex:pageBlockButtons>
            
            
                    <apex:pageBlockTable value="{!Records}" var="Record"> 
            <apex:column > 
                <apex:facet name="header">Account Name</apex:facet> 
                <apex:outputText value="{!Record.Account_Name__r.name}"/> 
            </apex:column> 
            
                        <apex:column > 
                <apex:facet name="header">EWS Territory</apex:facet> 
                <apex:outputText value="{!Record.Account_Name__r.Territory_EWS__c}"/> 
            </apex:column> 
            
            <apex:column > 
                <apex:facet name="header">City</apex:facet> 
                <apex:outputText value="{!Record.Account_Name__r.billingcity}"/> 
            </apex:column> 
            
            <apex:column > 
                <apex:facet name="header">State</apex:facet> 
                <apex:outputText value="{!Record.Account_Name__r.billingState}"/> 
            </apex:column> 
            
            <apex:column > 
                <apex:facet name="header">Key Contact</apex:facet> 
                <apex:outputText value="{!Record.DIST_EXEC_SPONSOR__r.firstname}"/> 
            </apex:column> 

            <apex:column > 
                <apex:facet name="header">Email</apex:facet> 
                <apex:outputText value="{!Record.DIST_E_S_Email__c}"/> 
            </apex:column>             
            <apex:column > 
                <apex:facet name="header">Program Type </apex:facet> 
                <apex:outputText value="{!Record.RecordType.name }"/> 
            </apex:column> 
            
            <apex:column > 
                <apex:facet name="header">Status</apex:facet> 
                <apex:outputText value="{!Record.Program_Status__c }"/> 
            </apex:column> 
            
            <apex:column > 
                <apex:facet name="header">100%</apex:facet> 
                <apex:Outputtext value="{!Record.CS_100PercentCommitted__c }"/> 
            </apex:column> 
           
           
           
             <apex:column > 
                <apex:facet name="header">YTD Sales</apex:facet> 
              <apex:Outputtext value="{!Record.CS_YTD_Sales__c}"/> 
            </apex:column>  
            
            <apex:column > 
                <apex:facet name="header">Run Rate</apex:facet> 
               <apex:Outputtext value="{!Record.CS_Run_Rate__c}"/> 
            </apex:column>  
                         
            <apex:column > 
                <apex:facet name="header">Projected Payout</apex:facet> 
               <apex:Outputtext value="{!Record.CS_Projected_Payout__c}"/> 
            </apex:column>  
            
            
            <apex:column > 
                <apex:facet name="header">Clone</apex:facet> 
                <apex:inputField value="{!Record.Clone_no_send__c}"/> 
            </apex:column> 
            
            
                        <apex:column > 
                <apex:facet name="header">Send now</apex:facet> 
                <apex:inputField value="{!Record.Clone_Send_now__c }"/> 
            </apex:column> 
            
        </apex:pageBlockTable> 
            
            
            
        </apex:pageblock>
    </apex:form>
 
 
</apex:page>

and controller
public class programclone {

    public programclone() {
    
     String myterr = [Select Sales_Territory__c From User Where Id = :UserInfo.getUserId()][0].Sales_Territory__c ;
    System.debug(cloneyear );
        Records =[select Account_Name__r.name,
                         Account_Name__r.billingcity, 
                         Account_Name__r.billingstate, 
                         Account_Name__r.Territory_EWS__c,
                         DIST_EXEC_SPONSOR__r.name,
                         DIST_EXEC_SPONSOR__r.firstname,
                         DIST_E_S_Email__c,
                         Account_Number__c, 
                         Program_Status__c, 
                         RecordTypeid, 
                         Program_Year__c,
                         recordtype.name,
                         CS_YTD_Sales__c,
                         CS_Run_Rate__c,
                         CS_Projected_Payout__c,
                         CS_100PercentCommitted__c,  
                         Clone_Send_now__c , 
                         Clone_no_send__c 
                         from Distributor_Program__c 
                         Where Program_Status__c='active' 
                         and ( CreatedByid = :UserInfo.getUserid()  or   Account_Name__r.Territory_EWS__c = :myterr ) 
                         and Program_Year__c = :cloneyear 
                         and   Clone_no_send__c  != true 
                         and   Clone_Send_now__c != true 
                         order by Account_Name__r.name limit 200]; 


    }


        cloan_program_year__c settings = cloan_program_year__c.getInstance('cloneyear');
   
        string cloneyear =string.valueof(settings.Year__c);

       
   

public List<Distributor_Program__c> Records {get; set;} 


 

    public PageReference cancel() {
             return new PageReference('/home/home.jsp');
    }


    public PageReference Save() {
       update records;
        return new PageReference('/apex/nextstep');

    }



    }

And the test class 
 
@isTest
private class testclonedppage {

private static final Id acctrtid = Schema.SObjectType.account.getRecordTypeInfosByName().get('Distributor').getRecordTypeId();
private static final Id dpid = Schema.SObjectType.Distributor_Program__c.getRecordTypeInfosByName().get('PS Cornerstone').getRecordTypeId();

	@isTest static void test_method_one() {
		 
   

	Profile p = [SELECT Id FROM Profile WHERE Name='Standard User']; 
	User u = new User(Alias = 'standt', Email='standarduser@testorg.com', 
	EmailEncodingKey='UTF-8', LastName='Testing', LanguageLocaleKey='en_US', 
	LocaleSidKey='en_US', ProfileId = p.Id, 
	TimeZoneSidKey='America/Los_Angeles', UserName='standarduser@hammybuiltthis.com',
	Sales_Territory__c = '1');

  	cloan_program_year__C cs = new cloan_program_year__c(name = 'cloneyear' , year__c = '2016', year1__c = '2017' );

  	Account acc = new Account();
  	acc.Name='Abce';
	acc.Type='Distributor';
	acc.recordtypeid = acctrtid;
	acc.Territory_EWS__c = '1';
  	
  	insert acc;

  	Contact c = new Contact();
  	c.Firstname = 'first';
  	c.Lastname = 'last';
  	c.Email = 'email@email.com';
  	c.Accountid = acc.id;


  	insert c;

	System.runAs(u) {

		Distributor_Program__c  dp = new Distributor_Program__c();
		dp.RecordTypeId = dpid;
		dp.Account_Number__c = '1';
		dp.Program_Year__c = cs.year__c;
		dp.Account_Name__c = acc.id;
		dp.DIST_EXEC_SPONSOR__c = c.id;
		insert dp;
		
System.debug('Current Contact name: ' + c.firstname);
System.debug('Current User: ' + UserInfo.getUserName());
System.debug('Current Profile: ' + UserInfo.getProfileId());
		
		Test.setCurrentPage(Page.programclone);
		programclone controller = new programclone();
	
		controller.save();


		

		}

	}
	

	
}

 
Was wondering if anyone found a work around to editing Html / Visual Force Template in preview before sending ?
I need to incorporate a table within the template but some section of the email has to editable.
Hi,
We have an application that developed on Java 1.6 that is integrated with Salesforce, we have hosted the application in Jboss Application Server 5.1 and the Windows Sever where we have deployed the application Windows 2003 Server.

We have received a notification from Salesforce that Salesforce will be disabling TLS 1.0 soon, how do I find out whether my application integrated with Salesforce is using TLS 1.0? What actions should we do at our end to disable the TLS 1.0 and enable TLS 1.1 and higher.

I greatly appreciate your guidance and support.
How can this be? I received this error for: Case, Contact, Opportunity, Lead and Account. 
I'm getting this error when I try to install my package on a dev org. With the package I'm shipping my own record types for every object that I listed above. Is this a bug? All the classes compile fine, the tests pass, packaging is ok. At install this happens...
I've created a Visualforce page (and simple getter/setter class) that hosts a Flow and renders a couple of dataTables by passing sObject Collection variable data to the page. One thing I'm trying to do that would really enhance the flow is to pass a couple of boolean or text variables from the flow to the VF page and use them as the "rendered=" value of each dataTable to turn them on and off from within the flow.

I've created a variable in the VF page:
<apex:variable var="renderPanel" value="{!myflow.RenderContactsPanel}"></apex:variable>

For the datatable, I plug that variable into the "rendered=" parameter:
​<apex:dataTable value="{!myflow.sc_ContactsInAccount}" var="contact" rowClasses="odd,even" border="1" cellpadding="4" rendered="{!renderPanel}" >
In the flow itself, RenderContactsPanel is a variable set to "true" or "false" at different points in the flow, depending on where the flow is using an Assignment logic. I've tried the RenderContactsPanel variable as both a boolean and a text variable (when text, it gets assigned to a Text Template with content="true" or "false") and regardless, the dataTable remains unrendered.

Any insight on the correct approach to this problem would be appreciated.
Hello,

I are trying to run automation tests using selenium against my developer org for few VF pages. When I am running it from my laptop then tests are passing through but when I am trying to run the same tests using a selenium grid (a server not running locally) the tests are passing the first scenario of logging in but then errors out. On little bit of troubleshooting I found that the next screen after login is presented with a one time code as the browser is not identified.

Has anyone had this problem? Really appreciate if you have a solution.

Thanks in advance! 
Sachin
Hello SF Gurus,

Total number of callouts (HTTP requests or Web services calls) in a transaction 100
Maximum number of methods with the future annotation allowed per Apex invocation 50

Does that mean I can make 100 callouts in each future call (i.e. 100*50 callouts) or total of 100 across the 50 future callouts?

Thanks,
KB
I am looking for some help with a simple if statement and the code coverage

here is the trigger

trigger Case4fromRD on RD_Site_Report__c (after insert, after update) {
List<Service_Call_Log__C>SCL=New list<Service_Call_Log__C>();
    For(RD_Site_Report__C b:trigger.new)
    {
        IF (b.case_topic__C !=null){
           SCL.add(new Service_Call_Log__C(Subject__C='A Case has been created from an RD Site Report',job__C=b.Job__C, description__C=b.case_Topic__C, Web_email__C=b.contact_email__C));
            insert SCL; 
        }
       
    
    }
}

and here is the test class

@isTest
public class Rd_Site_Report_SCL1{

static testMethod void CasefromRD(){

RD_Site_Report__c sRDSR = new RD_Site_Report__c();

sRDSR.Reason__C='Customer Complaint';
sRDSR.Case_Topic__c ='Test';
sRDSR.Job__C='a013000000UHggN';
sRDSR.case_topic__C='Test';
sRDSR.Contact_Email__C='tmonson@cms4.com';

Test.StartTest();

insert sRDSR;

test.stopTest();

}
}
Hi,
New to VF and I have a page that I am trying to test but I am not successful.  Need assistance as I don't understand why its getting that error.

Thank you.

TEST Code
  Test.startTest();
  PageReference pageRef = Page.SE_Designation_Section;
  Test.setCurrentPage(pageRef);
  ApexPages.CurrentPage().getParameters().put('Rack','Test Rack');
  DesignationEditorController controller = new DesignationEditorController();
  controller.Add();
  controller.Save();
  controller.DeleteDesignation();
  Test.stopTest();

ERROR
Compile error at line 5 column 44
Constructor not defined: [DesignationEditorController].<Constructor>()
 
VF CONTROLLER
public class DesignationEditorController {

public List<SE_Designation__c> Designations { get; set; }

private final Discovery__c ParentDiscovery;

public String Blurb { get; set; }

//used to get a hold of the record selected for deletion

public string SelectedDeleteId { get; set; }

public DesignationEditorController(ApexPages.StandardController stdController) {

this.ParentDiscovery = (Discovery__c) stdController.getRecord();

refreshDesignations();

}

public void Add() {

doSave();

SE_Designation__c newDes = initNewDesignation();

insert newDes;

refreshDesignations();

}

public void Save() {

doSave();

return;

}

private void doSave() {

update Designations;

}

private SE_Designation__c initNewDesignation() {

SE_Designation__c d = new SE_Designation__c();

d.Discovery__c = ParentDiscovery.Id;

d.Name = 'New';

return d;

}

private void refreshDesignations() {

Designations = [SELECT Id,Dest_Position__c,Dest_Time_Line__c,Dest_Pri_Power_Prod_pick__c,Dest_Pri_Receptacle__c,

Dest_Red_Power_Prod_pick__c,Dest_Red_Receptacle__c,Dest_DC_Product_pick__c,Dest_V_Drop__c,Dest_DC_Lug__c,Dest_DC_Term__c,

Dest_Cabinet_Footprint__c, Dest_DEMARC__c, Dest_Weight__c, Dest_Cab_Notes__c FROM SE_Designation__c

WHERE Discovery__c = :ParentDiscovery.Id

ORDER BY LastModifiedDate ASC NULLS FIRST

];

}

public void DeleteDesignation() {

// if for any reason we are missing the reference

if (SelectedDeleteId == null) {

return;

}

// find the record within the collection

SE_Designation__c tobeDeleted = null;

for(SE_Designation__c d : Designations)

if (d.Id == SelectedDeleteId) {

tobeDeleted = d;

break;

}

//if record found delete it

if (tobeDeleted != null) {

delete tobeDeleted;

}

//refresh the data

refreshDesignations();

}

}
Hello, 

I'm trying to render a visualforce page based on a value passed from another record.  The Custom Button URL i'm using to open the VF page is:
/apex/AvailableInstructors?id={!Lesson__c.Id}&Date_c={!Lesson__c.Lesson_Date__c}


and rendering the records using the following:
 
<apex:pageblocktable value="{!schedules}" var="s" columns="13" rendered="{!Schedule_Availability__c.Date__c== DATEVALUE($CurrentPage.parameters.Date__c)}" >
The VF page is showing all records and not rendering it based on the date value passed.  Any help would be appreciated!

Thanks!
I have a simple workflow that is checking for one checkbox field, if the field is checked, the workflow fires.  There is only one action in the workflow, an email alert (it is a visualforce email template).  I have verified that the workflow is firing (by putting a field update to "un-check" the checkbox that fired the workflow).  However the email is never sent.  I even have my email address as one of the "additonal 5" emails - that email is never sent either.

What sort of things should I be checking to try to troubleshoot this?
 
Hi All,

I have a custom object named Payment, which has look up to Lead. On Payment page, I have a button to call Apex class, which changes Lead status which in turn results in after update lead trigger that converts lead using  Database.convertLead() method.
I am having System Administrator profile, but I am getting error as ConvertLead failed. First exception on row 0; first error: UNAVAILABLE RECORDTYPE EXCEPTION, Unable to find default record type

Note: I just created new sandbox, and this function has stopped working on new sandbox. Same functionality is working on Production. My profile has default record type assigned for Account, which is common answer found for this issue. But that is already in place and issue still persists.

Lead, Opportunity do not have record types and there is no custom field vaidation exception shown in debug log.

Any help is highly appreciated.

Approval Page Error on Payment details page:
User-added image
 
//Code for class called from Payment detail page button: 

global class nmLeadWebService 
{
    //New method for Approve registration by IC
    webService static string ApproveRegistrationNew(String strLeadId) 
    {
         Lead objLead = new Lead(id=strLeadId);
         objLead.nm_LeadContacted__c = 'Yes'; 
         
         update objLead;
        
         objLead.nm_PaymentCompleted__c = true;
         
         update objLead;
       
         objLead = [select id, ConvertedAccountId, convertedOpportunityId from Lead where id =: strLeadId];
        
         //Code to transfer registration payment record to opportunity from lead
         List<nm_Payment__c> lstPayment = [select id, nm_OpportunityNew__c from nm_Payment__c where nm_Lead__c =: strLeadId and nm_PaymentStatus__c='Payment Made'];
         if(lstPayment != null && lstPayment.size() > 0)
         {
            for(nm_Payment__c objPayment : lstPayment)
            {
                       
                objPayment.nm_Lead__c = null;
                objPayment.nm_OpportunityNew__c = objLead.ConvertedOpportunityId;               
            }
            
            update lstPayment;
         }
         system.debug('Done');
         return objLead.ConvertedAccountId;
    }
 
//Code in Lead Trigger handler class
//Method to convert lead once Registration payments completed
    public void ConvertLead(list<Lead> lstLead, map<id, Lead> leadOldMap)
    {
        if(lstLead != null && lstLead.size() > 0)
        {
            set<string> strDuplicate = new set<string>();
            //Adding Email MobilePhone in set in string format 
            for(Lead objLead : lstLead)
            {
                strDuplicate.add(((String)objLead.Email + (String) objLead.MobilePhone ).toLowerCase());
                System.debug('**strDuplicate'+strDuplicate);
            }
            
            //getting accounts already in Account
            list<Account> lstAccount = [select id,(select id from Contacts limit 1), 
                                        nm_CheckDuplicate__c from Account
                                         where nm_CheckDuplicate__c in : strDuplicate];
            System.debug('**lst account'+lstAccount);
            map<string, Account> mapDupAccounts = new map<string, Account>();
            for(Account objAccount : lstAccount)
            {
                mapDupAccounts.put(objAccount.nm_CheckDuplicate__c, objAccount);
            }
            LeadStatus convertStatus = [SELECT Id, MasterLabel FROM LeadStatus WHERE IsConverted=true LIMIT 1];
            for(Lead objLead : lstLead)
            {
                //Checking is registration payment done
                if(objLead.nm_Program__c != null && objLead.nm_EligiblityCriteria__c != null && objLead.nm_PaymentCompleted__c == true && leadOldMap.get(objLead.id).nm_PaymentCompleted__c == false)
                {
                    string strLead = ((String)objLead.Email + (String) objLead.MobilePhone ).toLowerCase();
                    if(mapDupAccounts.get(strLead) != null)
                    {
                        Database.LeadConvert lc = new Database.LeadConvert();
                        
                        lc.setLeadId(objLead.id);
                        lc.setAccountId(mapDupAccounts.get(strLead).id);
                        
                        lc.setContactId(mapDupAccounts.get(strLead).Contacts[0].id);
                        
                        
                        lc.setConvertedStatus(convertStatus.MasterLabel);
                        
                        try{
                            Database.LeadConvertResult lcr = Database.convertLead(lc);
                        }
                        catch(exception ex)
                        {
                            objLead.addError(ex.getMessage()); 
                        }
                    }
                    
                    else
                    {
                        Database.LeadConvert lc = new Database.LeadConvert();
                        
                        lc.setLeadId(objLead.id);
                        
                       // LeadStatus convertStatus = [SELECT Id, MasterLabel FROM LeadStatus WHERE IsConverted=true LIMIT 1];
                        lc.setConvertedStatus(convertStatus.MasterLabel);
                        
                        try{
                            Database.LeadConvertResult lcr = Database.convertLead(lc);
                        }
                        catch(exception ex)
                        {
                            objLead.addError(ex.getMessage());
                        }
                    }                   
                }
            }
        }
    }