• Wizrad
  • 685 Points
  • Member since 2010

  • Chatter
  • 27
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 29
  • 165

I am trying to create a VF email template that will be sent based off a date field on a custom object (Service_Plans__C_).  In the subject line, I'm trying to get it to display the name of the Opportunity that's related to the Service Plan.. but it displays the Opportunity ID, not the text name.


What should I use in place of {!relatedTo.Opportunity__c} to get the text name and not the ID? 


Service Plans is Master-Detail(Opportunity) if that matters.


<messaging:emailTemplate subject="Notification - Service Plan, {!relatedTo.Name}, for {!relatedTo.Opportunity__c} expires on {!relatedTo.Service_Plan_End_Date__c}" recipientType="User" relatedToType="Service_Plans__c">





Here's an interesting test that I need to work out.

The method sendConfirmations in this class gets a list of deals older than two minutes and sends a confirmation email to the customer (I've got it hard coded to send to me while I'm testing it). The reason for this delay is that there's an external system that takes a little while to insert all of the information and related objects under this deal. This method is then scheduled to run every 5 minutes.

Because I only query deals older than 2 minutes, I can't create objects to test, as the new objects are not older than 2 minutes, so they aren't seen.

How can I get around this and test the method without relying on existing objects in the salesforce?

global class ConfirmationsScheduledSend implements Schedulable {
	global void execute(SchedulableContext sc) {
	global static void sendConfirmations() {
		Id template = '00XD0000001WNxW';
		String debugEmail = 'logan.moore@velocitytrade.co.nz';
		Boolean debugEnabled = true;
		// We need to ensure that we've given felix enough time to upload any
		// outgoing payment information, so we only want to query deals older than 2 minutes
		Datetime twoMinutesAgo = Datetime.now().addMinutes(-2);
		List<Deal__c> deals = [SELECT Id, Felix_Trading_Account__r.OwnerId, Felix_Trading_Account__r.Contact__c FROM Deal__c WHERE Send_Confirmation_Flag__c = true AND CreatedDate < :twoMinutesAgo];
		// We're also going to need a list of all salesforce users, as we
		// will be blind carbon copying the owner in on all of their auto confirmations.
		Map<Id,User> users = new Map<ID,User>([Select Id, Name, Email FROM User]);
		// Set up the email queue and reserve email capacity
		List<Messaging.SingleEmailMessage> emailQueue = new List<Messaging.SingleEmailMessage>();
		Messaging.reserveSingleEmailCapacity( users.size() );
		for (Deal__c deal : deals) {
			// Figure out the deal owner
			User owner = users.get(deal.Felix_Trading_Account__r.OwnerId);
			// Compiling a list of BCCs for this email
			List<String> bccList = new List<String>();
			//bccList.add(String.valueOf(owner.Email)); // bcc the owner in all cases
			if (debugEnabled)
			// Build up the email message object
			Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage();
			// now that the email is queued, we remove the flag and set the last send datetime.
			deal.Send_Confirmation_Flag__c = false;
			deal.Last_Confirmation_Sent__c = Datetime.now();
		// Try sending the email in a try-catch block. If something goes wrong, I NEED to know about it ASAP.
		try {
			if (emailQueue.size() > 0) {
			update deals;
		catch (EmailException ex) {
			Messaging.SingleEmailMessage errorEmail = new Messaging.SingleEmailMessage();
			errorEmail.setToAddresses(new List<String>{ debugEmail });
			errorEmail.setSubject('ALERT: Confirmations Email Failed');
			errorEmail.setPlainTextBody('HIGH PRIORITY ALERT:\n\nThere was an error trying to send automatic confirmations. The error reads as follows:\n\n' + ex);
			Messaging.sendEmail(new List<Messaging.SingleEmailMessage>{ errorEmail });





I have a question about triggers.


Is there a way to prevent a record from being inserted by checking the record on a before insert trigger?


Thanks a lot



  • August 10, 2011
  • Like
  • 0

In this trigger than I am working on I am needing to seperate leads that are members of a group from  leads that are owned by individual users.


Here is my Error

System.QueryException: List has no rows for assignment

 Erroneous Code

lUser = [select id from user where id =: lead[0].ownerid].id;

 Complete Code:


trigger cmOwner on CampaignMember (Before Insert, Before Update) {

    Set<Id> lIds = new Set<Id>();
    Set<Id> cIds = new Set<Id>();
    for(CampaignMember cm : Trigger.new) {
    System.debug('**** 1 lIds id : '+cm.leadid);
    System.debug('**** 1.5 cIds id : '+cm.contactid);


    System.debug('**** 2 lIds id : '+cm.leadid);
    System.debug('**** 2.5 cIds id : '+cm.contactid);

   String sUser;
   String lUser; 
   List<lead> lead = [select ownerid from Lead where id in: Lids];
   sUser = [select id from user where Name = 'Shayla Wentz'].id;
   lUser = [select id from user where id =: lead[0].ownerid].id;
   List<contact> contact = [select ownerid from contact where id in:cIds];

    for(CampaignMember c: trigger.new){
      If(c.Lead.ownerid == lUser){   
        c.OwnerName__c = lead[0].ownerid;
        } else{
        c.OwnerName__c = sUser;
     if(c.contactid <> null){
        c.OwnerName__c = contact[0].ownerid;


How do I determine if the Lead ownerid is a user.id rather than a queue id?


Thank you

I was wonderting if there is a way to get a certain number of characters from a Long Text Area Field. I only want 500 Characters of the Long Text Area Field. 

The code that is coming out false reads: if(maprtID_rtName.get(escalatedcase.id) == 'NationalClientService') {
for some reason, it comes out false... not sure why, but i tried to debug it by pritning out the value for maprtID_rtName.get(escalatedcase.id)) and it errors saying that it is printing nulls.
here's my record type: 
Record Type Label	National Client Service	Active	
Support Process	National Client Service	 	 
Record Type Name	NationalClientService


trigger EscalateCase on Case (before update) {
  List<RecordType> rTypes = [select id,name from RecordType where SobjectType='Case'];    //pull recordtype Id's and record type names from recordtypes where the sobject is contract
  MAP<Id , String> maprtID_rtName = new MAP<ID , String>();  //map record type ID's to record type names.
  for(RecordType rTypeObj :  rTypes)
  	maprtID_rtName.put(rTypeObj.id , rTypeObj.Name); //for all recordtypes... log id's and record type names.
  List<RecordType> rTypesCases = [select name,id from RecordType where SobjectType='Case'];    //pull recordtype Id's and record type names from recordtypes where the sobject is contract
  MAP<String, ID> maprtName_rtIDCases = new MAP<String, ID>();  //map record type ID's to record type names.
  for(RecordType rTypeObj :  rTypesCases)
  	maprtName_rtIDCases.put(rTypeObj.Name, rTypeObj.id); //for all recordtypes... log id's and record type names.

List<Case> Cases = new List<Case>();
for (Case escalatedcase:Trigger.new){

//trying to close the parent case while children are still open	
if (escalatedcase.Status=='Closed') { //trying to close the parent case while children are still open
	integer close = [Select count() from Case where ParentId = :escalatedcase.id and isClosed != true];
	if (close > 0) {
		escalatedcase.addError('There are still Child Cases Open - Please close and try again!');
//END trying to close the parent case while children are still open

	if(maprtID_rtName.get(escalatedcase.id) == 'NationalClientService') { // This is the IF statement that is failing.
		if (escalatedcase.Escalate_to__c == 'Tier 2 - Internal Support') {
			if(escalatedcase.Tier_2_Escalation_Level__c == 'Billing Resolution') {
				if (escalatedcase.IsEscalated==false) {
					if(escalatedcase.ParentId == null) {
						Case CaseAdd = escalatedcase.clone(false, true);
						CaseAdd.RecordTypeId = maprtName_rtIDCases.get('Billing Resolution');
						CaseAdd.ParentId = escalatedcase.id;
						escalatedcase.Status = 'Escalated to Tier 2';
						escalatedcase.IsEscalated = true;
					} else {
						if(escalatedcase.Status == 'Closed') {
							Case CaseAdd = new Case(Id = escalatedcase.ParentId);
							CaseAdd.Status = 'Completed';
							CaseAdd.IsEscalated = false;
	} else {
		escalatedcase.addError(maprtID_rtName.get(escalatedcase.id)); ///It's throwing the error down here... because the if statement from above is false


upsert Cases;



Record Type LabelNational Client ServiceActiveChecked
Support ProcessNational Client Service  
Record Type NameNationalClientService

I am writing a test on the a class where about half the code is inside the classes if statement. How do I cover the if statement?


Here is the test code:

@IsTest private class TestQuoteExtend {

    /* This is a basic test which simulates the primary positive case for the 
       save method in the quoteExt class. */
    public static testmethod void basicSaveTest() {
        Opportunity o = TestQuoteExtend.setupTestOpportunity();
        /* Construct the standard controller for quote. */
        ApexPages.StandardController con = new ApexPages.StandardController(new quote());

        /* Switch to runtime context */

        /* Construct the quoteExt class */
        QuoteExtend ext = new QuoteExtend(con);
          PageReference result = ext.save();
        /* Switch back to test context */

        /* Construct the standard controller for quote. */
        ApexPages.StandardController con = new ApexPages.StandardController(new Quote());

        /* Construct the quoteExt class */
        QuoteExt ext = new QuoteExt(con);

        /* Call save on the ext */

    /* This setup method will create an opportunity with line items and a primary
       contact role for use in various tests. */
    private static Opportunity setupTestOpportunity() {

        /* Create an account */
        Account a = new Account();
        a.name    = 'TEST';

        /* Get the standard pricebook. There must be a standard pricebook already 
           in the target org.  */
        Pricebook2 pb = [select name, isactive from Pricebook2 where IsStandard = true limit 1];

        if(!pb.isactive) {
            pb.isactive = true;

        /* Get a valid stage name */
        OpportunityStage stage = [select MasterLabel from OpportunityStage limit 1];

        /* Setup a basic opportunity */
        Opportunity o  = new Opportunity();
        o.Name         = 'TEST';
        o.AccountId    = a.id;
        o.CloseDate    = Date.today();
        o.StageName    = stage.masterlabel;
        o.Pricebook2Id = pb.id;

        /* Create the opportunity */

        /* Setup a basic Template*/
        PDF_Template__c pd  = new PDF_Template__c();
        pd.Name         = 'English';
        pd.Template_Address__c = 'apex/English';
        /* Create the Template */

        /* Setup a basic quote*/
        Quote q  = new Quote();
        q.Name         = 'TEST';
        q.OpportunityId    = o.id;
        q.PDF_Template__c = pd.id;

        /* Create the quote*/

        /* Create a contact */
        Contact c   = new Contact();
        c.lastname  = 'LASTNAME';
        c.firstname = 'FIRSTNAME';


        /* Create the opportunity contact role */
        OpportunityContactRole r = new OpportunityContactRole();
        r.ContactId     = c.id;
        r.OpportunityId = o.id;
        r.IsPrimary     = true;
        r.role          = 'ROLE';


        /* Create a product2 */
        Product2 p = new Product2();
        p.Name     = 'TEST';


        /* Create a pricebook entry. */
        PricebookEntry pbe = new PricebookEntry();
        pbe.Pricebook2Id = pb.id;
        pbe.Product2Id   = p.id;
        pbe.IsActive     = true;
        pbe.UnitPrice    = 1;


        /* Create a line item */
        OpportunityLineItem i = new OpportunityLineItem();
        i.opportunityId       = o.id;
        i.pricebookentryid    = pbe.id;
        i.quantity            = 1;
        i.unitprice           = 1;


        /* Set up the opportunity with the related records */
        r.Contact        = c;
        r.Opportunity    = o;
        o.Account        = a;
        i.Opportunity    = o;
        pbe.Product2     = p;
        pbe.Pricebook2   = pb;
        i.PricebookEntry = pbe;

        return o;
        PageReference pref = Page.NewQuoteOverride;

        return o;


Here is the regular class:


public class quoteExtend {

    ApexPages.StandardController controller;
        public opportunity o {get;set;}
        public quote q {get;set;}
        public ID oid {get; set;}
        Id u = UserInfo.getUserId();
        string bv = 'Key BV English';
        string ww = 'Key WW English';
    public quoteExtend (ApexPages.StandardController c) {
        controller = c;

        q = (quote) c.getRecord();
        system.debug('SFDC TEST *******'+q);
        oid = System.currentpageReference().getParameters().get('oppid');
        String Typ = System.currentpageReference().getParameters().get('Type');
        String Rec = System.currentpageReference().getParameters().get('Rec');
        id brecordtypeid = [select id,name from RecordType where sobjecttype='Quote' and name='Budget Quote'].id;
        Integer bi = 1+ [select count() from Quote where opportunityid = :oid and RecordTypeId=:brecordtypeid ];
        id frecordtypeid = [select id,name from RecordType where sobjecttype='Quote' and name='Firm Quote'].id;
        Integer fi = 1+ [select count() from Quote where opportunityid = :oid and RecordTypeId=:frecordtypeid ];
       List<OpportunityContactRole> ocr = [select id, opportunityid, isprimary, ContactId,
           Contact.Name, Contact.Phone, Contact.Fax, Contact.Email from
           OpportunityContactRole where opportunityid = :oid and isprimary = true];

        if(oid != null) {
            o = [select id, Account.Name, Account.BillingStreet, Account.BillingCity, Account.BillingState,
                Account.BillingCountry, Account.BillingPostalCode, Account.ShippingStreet, Account.ShippingCity,
                Account.ShippingState, Account.ShippingCountry, Account.ShippingPostalCode, SFDC_For_Quote__c,
                Equip_Services_Options_to_be_quoted__c, Opportunity_Region__c,Pricebook2Id from opportunity where id = :oid];    
       string title;
           If (rec == 'Budget Quote') {
               title = 'B-' + o.SFDC_for_quote__c + '-' + bi;
           } else if (Rec =='Firm Quote')  {
               title = 'F-' + o.SFDC_for_quote__c + '-' + fi;
        q.Opportunityid = o.Id;
        q.name = title;
        If (rec == 'Budget Quote') {
               q.Recordtypeid = brecordtypeid;
           } else if (Rec =='Firm Quote')  {
               q.Recordtypeid = frecordtypeid;
        If (o.Opportunity_Region__c == 'Europe') {
               q.PDF_Template_Name__c = bv;
           } else   {
               q.PDF_Template_Name__c = ww;
        q.BillingName = o.Account.Name;
        q.BillingStreet = o.Account.BillingStreet;
        q.BillingCity = o.Account.BillingCity;
        q.BillingState = o.Account.BillingState;
        q.BillingPostalCode = o.Account.BillingPostalCode;
        q.BillingCountry = o.Account.BillingCountry;
        q.ShippingName = o.Account.Name;
        q.ShippingStreet = o.Account.ShippingStreet;
        q.ShippingCity = o.Account.ShippingCity;
        q.ShippingState = o.Account.ShippingState;
        q.ShippingPostalCode = o.Account.ShippingPostalCode;
        q.ShippingCountry = o.Account.ShippingCountry;
        q.Contactid = ocr[0].contactid;
        q.Email = ocr[0].contact.email;
        q.Phone = ocr[0].contact.Phone;
        q.Fax = ocr[0].contact.Fax;
        q.Pricebook2Id = o.Pricebook2Id;
        q.Project_Scope__c = o.Equip_Services_Options_to_be_quoted__c;

    public PageReference save() {

        PageReference p = controller.save();
        id oid = controller.getId();
          return p;



Thank you,


We are in the process of changing pricebooks to mass update all of our prices and costs. The challenge is we heavily use the quote object and are needing to requote opportunities that already have a quote record attached. In order to change a pricebook, one must delete the quote line items, quotes, and opportunity line items, which I think can be done with apex and visualforce. The general outline would be.


1. Unsync any Quote
2. Remove Quote Line Items, Quotes, Opportunity Line Items.
3. Change Price Book
4. Add Opportunity Line Items, Quotes, Quote Line Items


At one point in this process, the records will have to be stored in the code after the records are deleted and before the new records are created. At a conceptual leve, how do I store records and data in the code?


Has anyone seen this done before?




I'm currently writing a Visualforce page that prompts the user to select an object in their org, and then choose a field from that object. I've found a way to compile the list of objects without any trouble, but I'm struggling to compile a list of the fields belonging to that object. When the user selects an object, I store the object name as a string. I can find the fields for a designated object using the code below:


Map<String, Schema.SobjectField> M = Schema.SObjectType.Account.fields.getMap();
List<Schema.SObjectField> resultList = M.values();


However, I can't seem to use that code to display the fields of every object. The object name goes where it says "Account" but when I try using the string name for the object that was selected, it throws me an error message. I can't find a way to reference any object without manually typing the name in. I know I need to either convert the string name to some other sort of data type or come up with a new algorithm altogether.


Does any one have any suggestions?

Hi Everyone,


Has anyone attended Salesforce.com Developer training hosted/run by 3rd party vendors?


I need to find courses equivalent to DEV 401, DEV 501 and DEV 531 and am looking all all my options


I am also considering learning XML, Java, PHP and Python in order to become a successful developer, have I missed any languages?


My background so far is that I have been an SF Administrator since 2007 and have recently done some development work. Now I am trying to learn APEX and Visualforce


Thanks in advance,


Hi All,

I am trying to update a Lookup Field on an Account with a Trigger.  Essentially I have a Custom Object (Box_Assumptions_c) related to an Account (Account1) and I want to update an a Custom Field (X9Box_Assumptions__c) on a different Account (Account2) with a Box Assumption that is related to Account1 by using the Owner's (Portal User) Contact Account (Account1).


trigger updatecustomer9box on Account (before insert, before update) {
    //Get Account ID of the current record.
    set<id> acctid = new set<id>();
    for (account a : trigger.new)
    map<id, box_assumptions__c> boxmap = new map<id, box_assumptions__c>([select id 
                                                                     from box_assumptions__c
                                                                     where account__c in : acctid]);
    for (account a : trigger.new){
        box_assumptions__c thisbox = boxmap.get(a.x9box_assumptions__c);
        a.x9box_assumptions__c = thisbox.id;

 I am getting a Null Pointer Exception so any advice would be helpful!


-Thanks in advance!


I have a field that I would like to tab over or at least move over a couple of spaces to the right. I am having a hard time doing that. Can someone give me a hand. A code sample would be nice. If not then a link can work just as well. 




<div style="float:right"><br/><apex:outputText value="Welcome: {!partner.Name}" style="font-size: 12pt"/></div>



It is a pretty simple scenario so I will summarize it.   I cannot find anything to explain this behaviour so I am hoping some of you Apex geniuses can tell me that I am just making a simple mistake.


The users enters input into a field and then clicks a button.  The button calls the controller to create another sObject and it is displayed on the VF page using a repeat.  Another button is suppose to delete the last item from the list.  The field the user is inputting is a master-detail and therefore is a required field but why do I get the "Error: You must enter a value" when I am trying to just remove the last sObject from the list?

Here is the code.


<apex:repeat value="{!requests}" var="r">
                    <apex:pageBlockSection columns="1">
                    <apex:inputField value="{!r.Contact__c}"/>


public List<Attendee__c> requests {get; set;}


public void addAttendee() {
        attendeesList.add(new Attendee__c(Meeting__c = meet.Id));


public void removeAttendee() {
        if(attendeesList.size() > 0){



Thank you!

How can I programatically verify whether or not a page by the name of "xyz" exists?


Neither the ApexPages namespace nor the PageReference object seem to provide any such method.


In my visualforce page, i want to rerender a table after the user inputs value in the table. The last column in this table of each row is a simple formula field that sums up the values for other fields (e.g. June volume = 100, July Volume = 200 then the last column of Total will be 300). My VF page is like this:

<apex:page standardcontroller="Annual_Supply_Plan__c" sidebar="false" extensions="annualSupplyPlanController">
  <apex:form >
  <apex:pageBlock title="Annual Supply Plan Objects">
      <apex:dataTable value="{!listASPItems}" var="listASPItem" border="1" style="height:20;float: left;" id="ASPItemstable">
	  <apex:column headerValue="FY'11 Initial Shipment Forecast" width="5px" footerValue="Total">
              <apex:outputField value="{!listASPItem.Product_Category__c}" style="align: center" />
          <apex:column headerValue="June" width="5px" footerValue="Total June">
              <apex:inputField value="{!listASPItem.June_Volume__c}"/>
          <apex:column headerValue="July" footerValue="Total July">
              <apex:inputField value="{!listASPItem.July_Volume__c}"/>
          <apex:column headerValue="Tons" footerValue="Total">
             <apex:outputPanel id="shipmentForecasts">
              <apex:outputField value="{!listASPItem.Total_Volume__c}"/>
    <apex:pageBlockButtons >
        <apex:commandButton action="{!SaveForecasts}" value="Save Forecasts" reRender="shipmentForecasts, {!listASPItems}"/>


 But after clicking Save Forecasts, the table (last column specifically) is not refreshed. Can anyone please help me?


My controller is very simple:

public with sharing class annualSupplyPlanController {
    List<ASP_Item__c> listASPItems = new List<ASP_Item__c>();
    List<ASP_Yearly_Forecast__c> listASPYrlyFcsts = new List<ASP_Yearly_Forecast__c>();
    public id idASP = System.currentPageReference().getParameters().get('id');
    public annualSupplyPlanController(ApexPages.StandardController controller) {
    	System.debug(logginglevel.INFO, 'in CreateASPItems listASP is '+ ApexPages.currentPage().getParameters().get('id'));
        listASPItems = [Select a.September_Volume__c, a.Product_Category__c, a.October_Volume__c, a.November_Volume__c, a.Name, a.Month__c, 
        				a.May_Volume__c, a.March_Volume__c, a.June_Volume__c, a.July_Volume__c, a.January_Volume__c, a.Id, a.February_Volume__c, a.December_Volume__c,
        				a.Date_of_Month__c, a.August_Volume__c, a.April_Volume__c, a.Annual_Supply_Plan__c, a.Total_Volume__c From ASP_Item__c a 
        				where a.Annual_Supply_Plan__c =: idASP order by a.Product_Category__c, a.Date_of_Month__c];
    public List<ASP_Item__c> getlistASPItems(){
        return listASPItems;
	public List<ASP_Yearly_Forecast__c> getlistASPYrlyFcsts(){
		return listASPYrlyFcsts;
	public PageReference SaveForecasts() {
            update listASPItems;
            return null;

      public PageReference cancel() {
            return null;


 Appreciate your help.


  • December 02, 2010
  • Like
  • 0

Let's say I create a List of 10 new Account records called accts.  If I do a successful DML insert, then the records in the List will each have the new ID.


If I do successful Database.insert, will the records in the List also have the new ID?  If I do a Database.Insert(accts, false) and one of the accounts is a failed insert, will the other nine in the List still get IDs?






I am trying to display the relatedchild list by  <apex:relatedList list="Credit_Cards" />

I keep getting the error "'Credit_Cards' is not a valid child relationship name for entity Person".

 When I checked on the custom field relationship info for the master-detail relationship, it showed the the Child Relationship Name as "Credit_Cards".

I'm not  sure why the error. Is there an API name for the relationship which I should be using?



i have a lookup field to contacts in the lead and i want a field up the lookup field base in the name the user select in a pick list, the picklist have the names of some of the contact i have 

for example in the picklist i have kevin johnson if the user select kevin i want the triger to prepopulate the lookup field so the lead relates to that contact


is this possible 


i was playing with the trigger and this is what i got



trigger updateAE on Lead (after insert) {
  for (lead l:Trigger.new){
  l.L_RRx_AE__c = l.L_Special_Instructions__c;

 and every time i used it a get and error saying :


Error: Invalid Data. 
Review all error messages below to correct your data.
Apex trigger updateAE caused an unexpected exception, contact your administrator: updateAE: execution of AfterInsert caused by: System.StringException: Invalid id: kevin johnson: Trigger.updateAE: line 3, column 3




if(lstcoa3[i].Contact__c == c.id) 


I know what the error is, but am not sure how to fix it.


count is sometimes higher than the lists (lstcoa1, lstcoa2, lstcoa3, lstcoa4) because they are different sizes.lstcoa1.size() could be 10 and lstcoa2.size() could be 25.


I need it to to loop through and only calculate if "i" will return for lstcoa1[i] and not provide an error.


I've tried basic if statements that say if(lstcoa1.size() < i) but that didn't  seem to work.


Thoughts on how to get this error to go away?





for(Integer i = 0; i < count; i++)
        if(lstcoa1[i].Contact__c == c.id)
        numSent = numSent + 1;
        if(lstcoa2[i].Contact__c == c.id) 
        numOpened = numOpened + 1;
        if(lstcoa3[i].Contact__c == c.id) 
        numClicked = numClicked + 1;
        if(lstcoa4[i].Contact__c == c.id) 
        numBounced = numBounced + 1;



  • November 17, 2010
  • Like
  • 0



I've created a custom page that queries an account and its opened cases. For that page I've created an apex controller that queries for the account based on one of the account's fields.


Until now everything works fine, the query is a very simple one:


    List <Account> account =  [select  field1_c field2_c etc from Account where field1_c = :'ggggg'];

    List<Case> cases = [select  field1_c field2_c etc from Case where field1_c = :'ggggg'];


Now I would like to also have access to a relationship field and I would like to know how to query it.

The field I'm trying to show in that page is:




How should I write the select in order to query for this type of field?

They appear as default when I create a page with a standard controller referencing the account object.






  • November 15, 2010
  • Like
  • 0



I've been writing some Ruby code that utilizes wsdl2ruby and the Apex WSDL to run unit tests from ruby.


rtr = RunTestsRequest.new(:allTests  => false, :classes   => 'MyClassName')      
@sfApex.runTests(:runTestsRequest => rtr)

 Code above is pretty simple, just attempting to run a single test class with a one small unit test.


Problem is that this takes way longer to execute than it should.  This class executes in about 10 seconds in the browser but takes about half an hour to run as shown above from irb.


Anyone try to do something similar before?

Noticing some oddities with base 64 decoding PDF attachments.


(1) Create a visualforce page that renders as PDF.  Save the resulting PDF as an attachment to salesforce.  Lets call the resulting PDF "original pdf".

(2) Write some javascript


var results = sforce.connection.query("SELECT Name, Body FROM Attachment WHERE Id ='<id of attachment i just uploaded>' ");
var records = results.getArray("records");
var unencodedPDF = sforce.Base64Binary.prototype.decode(records[0].Body);

 (3) Turn unencodedPDF into a pdf.  Lets call this "new pdf".

 (4) Compare "original pdf" and "new pdf".  Notice "new pdf" is just a blank white page.


What am I missing?

Hi all,


I'm using the streaming api and see ive hit the "Maximum number of events per day" of 10k.


I'm not really sure why I would've hit this limit.  Is there some place I can see when my 10k will reset or what used up my 10k?



  • March 28, 2012
  • Like
  • 0

While trying to debug some of my batch apex, i'm noticing that batches can run in parallel, whereas I used to think they always ran in sequence.


I have a batch job, that ends up consisting of 4 batches, i.e. 4 calls of execute().  Let's call the batches A, B, C, and D.  Their times of execution are noted below.


A runs from 14:51:16.017 to 14:51:16.067
B runs from 14:51:17.019 to 14:51:17.148
C runs from 14:51:17.019 to 14:51:17.108
D runs from 14:51:17.022 to 14:51:17.259

 These times are taken from debug logs, and you can see that B, C, and D run in parallel.


I was under the impression that these batches run serially.  Infact, the following post says that as well:


Filed a Case to ask this question, and got this response from Tech Support:
1. Is it possible for the execute() method to be running more than once at the same time? (I've already confirmed that the batch job was launched only once.)

All execute methods for batches within a batch job are synchronous so they will not "trip" over each other.

[posted at: http://boards.developerforce.com/t5/Apex-Code-Development/Batch-Apex-can-execute-invocations-run-concurrently/m-p/261857#M45628]


I'm hoping that this is true, that somehow you can have the batches run in sequence, but my experience above says otherwise.  Aftering performing timings with Database.stateful, I see that has no effect on the parallel execution of execute().


Anyone have any input on this topic?  Should I rewrite my batch job so that batches are not dependent of other batches?  Ideally, i'd like the batches to execute sequentially.



  • December 13, 2011
  • Like
  • 0

Hi all,


I have a query, and while it is quite long, it excutes fine under one profile and gives the "Query Too Complicated" error on another profile.


AFAIK, the only differences between the two profiles is that one user has "Modify All" on the object being queried, and one user has records shared with them.


Does sharing play a role in "query complication"?



  • November 09, 2011
  • Like
  • 0

Hey guys,


I have a question about formula compile size:


1) I notice that hitting the "Save" button and the "Check Syntax" button reports different compile sizes.  I have a formula that is apparently about 2700 characters in compile size, or at least thats what it says when I hit "Check Syntax".  If I click "Save" it says the formula cannot be saved because its compile size is about 5500 characters.  If I paste the formula into word it says the formula is under 1000 characters, I understand this is not the same thing as compile size, but that seems to be a bloated compilation.  What is the difference between the number reported when I hit "Save" as opposed to when I hit "Check Syntax"?


2) I understand oracle db has a 64k or 128k limit on its queries, but why is there a limit on individual formulas?  Wouldnt be limiting the size of the SOQL query be enough?  Can I get formula compile size black tabbed?



  • October 20, 2011
  • Like
  • 0

Hi all,


I am encountering an issue where I cannot download attachments from the standard salesforce interface with this combination of programs.  If I disable the google toolbar I am able to download them.  I am also able to download attachments from other websites just fine.


My peers are able to download the attachments with the same combination of programs.  What else could be going wrong here?  Has anyone experienced this?



  • August 12, 2011
  • Like
  • 0

Hi all,


I am trying to optimize some code which takes a while to run.


First I wrapped a DML statement in the following to get the time of execution:


Long start = System.currentTimeMillis();
update something;
Long diff = System.currentTimeMillis() - start;

 Results show an execution time of about 2 seconds.  So I drilled in deeper and wrapped the triggers in the same code and found that the triggers execute in about 200 milliseconds.


I verified there are no workflows firing and at this point and am starting to scratch my head.


So I took it another step further and take the time before the dml update statement, and then take the time as the first line of the before trigger...and lo and behold salesforce is spinning its wheels for 2 seconds.


Next I looked at the Triggers and Order of Execution entry in the Apex Developers guide, the only things that happen are:


On the server, Salesforce:

  1. Loads the original record from the database or initializes the record for an upsert statement.
  2. Loads the new record field values from the request and overwrites the old values. If the request came from a standard UI edit page, Salesforce runs system validation to check the record for:
    • Compliance with layout-specific rules
    • Required values at the layout level and field-definition level
    • Valid field formats
    • Maximum field length
    Salesforce does not perform system validation in this step when the request comes from other sources, such as an Apex application or a Web services API call.
  3. Executes all before triggers.

What this says to me is that for 1 record (my dml operation is only updating a single record) its taking force 2 seconds to do steps 1 & 2.  This is really only an issue with this sObject.  Other sObjects with more complicated triggers take less execution time.  I am thinking this 2 seconds is due to there being ~100 formula fields on the sObject I am updating, and force needs to perform a query on all fields on the sObject as apart of step 1.  Can some SFDC mastermind confirm my findings?  Is there anything I can do or is this the cost of developing on the platform?




  • August 10, 2011
  • Like
  • 0

When I try to deploy via ant migration tool.  Have not tried any other way because I want to deploy this local copy I have, not what is on the server.


1) Upon error about 16 seemingly random classes are listed along with the error.  None of my code implements batchable.

2) I have pushed this same code to multiple other orgs.

3) Under Setup->Monitoring->Apex Jobs there is nothing with status other than "Completed" or "Aborted".

4) Under Setup->Monitoring->Scheduled Jobs there is nothing scheduled with type "Scheduled Apex".

5) I executed the following code in hopes of killing zombie jobs:


for(AsyncApexJob aaj : [SELECT Id FROM AsyncApexJob]) {

None of this worked.  Error on deploy.  At this point im fairly confident its an sfdc issue but maybe the community has ran into this and has some secret knowledge.



I am running into a very serious error with deploys, and before I log a case, was wondering if anyone else has seen this.


I have two sandboxes, A and B.  A is in Spring 11 and B is in Summer 11.


In my org, I have a VF Page and its controller which utilizes javascript remoting.  It works fine in both Sandbox A and B.


Now lets say I make a change to an sobject, such as adding a field that is not referenced anywhere, then deploy just this changed sobject to sandbox B.


After the deploy, the VF Page and its controller break in Sandbox B, but continue to work in Sandbox A.  The error given is a strange one:


Visualforce Remoting Exception: Cannot call test methods in non-test context


I am definitely not calling test methods from my remote apex.  If I drill into the error with Firebug, I can see it gets thrown in the following code (which is salesforces):



Visualforce.remoting.Util = {
log: function(msg, obj) {
if (typeof console === 'undefined' || !console.groupCollapsed || !console.log || !console.groupEnd) return;
if (typeof obj !== 'undefined' && obj !== null) {
try {
} catch(e) {}
} else {
try { console.log(msg); } catch(e) {}



I can then add one dummy line (it literally does not matter what I add) of code to the problematic VF page and its controller, then I can redeploy the page and its controller, and things work again in Sandbox B.


This is quite strange, but I can consistently reproduce it with these steps.


Any ideas?

Hi all,


I am writing some simple code here, and it doesn't work at all.


First code block is a simple wrapper class.



global class OverrideStatusCoupler {
	global Boolean selected {get; set;}
	global Something__c status {get; set;}
	global OverrideStatusCoupler(Something__c overStatus) {
		selected = false;
		status = overStatus;


Code block below is code that utilizes the wrapper class.




global with sharing class AController {
    global List<OverrideStatusCoupler> oscList {get; set;}
    global AController() {
    	oscList = new List<OverrideStatusCoupler>();	
    global PageReference submitForApproval() {
	//System.assertEquals('im', '' + oscList.size());
    	for(OverrideStatusCoupler osc : oscList) {
    		if(osc.selected) {
    			System.assertEquals('I', 'succeeded');
    	return null;



Finally, below is some VF that binds to the list.



<apex:repeat value="{!oscList}" var="currStatus">
		<td style="width:4%;">
			<apex:inputCheckbox value="{!currStatus.selected}"  />
		<td style="width:20%;">
			<apex:outputField value="{!currStatus.status.Something__r.Name__c}" />
		<td style="width:26%;">
			<apex:outputField value="{!currStatus.status.Field_Label__c}" />
		<td style="width:20%;">
			<apex:outputField value="{!currStatus.status.Override_Value__c}" />
		<td style="width:30%;">
			<apex:inputText style="width:90%;" value="{!currStatus.status.Comments__c}"  />



Ultimately my wrapper class couples an sobject with a boolean and then the VF page displays a list of records with the checkboxes.  Pretty standard stuff.  Unfortunately, AController.cls doesn't seem to care about the state of the selected boolean -- it is false no matter what I do.  I can even change the definition of the wrapper class to default selected to true, and it still acts like selected is false.  The control flow never goes in the if statement so the assertion...


System.assertEquals('I', 'succeeded');


...never fails.  It keeps hitting at the...


System.assertEquals('I', 'failed');

...assertion.  If I uncomment the assertion that assets the lists' size, I can see the list has 21 elements.


I've tried things such as rerendering the checkbox onchange, putting action regions around the checkbox.  Nothing helps.


Things to note about this page:

+Javascript remoting is enabled.

+Standard stylesheets disabled

+No sidebar or header


Any ideas?



  • April 18, 2011
  • Like
  • 0

Hi all,


When you create a field of type number, you are allowed to enter a number of digits before and after the decimal.  My understanding was that if you entered  a value with too many digits before or after the decimal place, you would get an error on insert/update.  However, that is not the case.



MyObject__c mo = new MyObject__c();
mo.Name = 'Testing rounding';
mo.Temporary__c = 123.4567890; //This field defined as Number(10,2)
insert mo;
System.debug('val = ' + mo.Temporary__c);



I would expect one of two outcomes from the above code:


1) Exception when I try to insert.


2) Truncate or round the number accordingly.


However, instead the debug statement prints out:



14:42:44.063|USER_DEBUG|[6]|DEBUG|val = 123.4567890



So...what does limiting the number of digits before/after the decimal place even do?  Do I really have to manually chop this number off at 2 decimal places every time I want to use it?



  • March 07, 2011
  • Like
  • 0

Hey all,


I would like to iterate over all field sets for an object and get the label for the field sets.  For example:


<apex:repeat value="{!$ObjectType.Account.FieldSets}" var="currFS">
     <apex:pageBlockSectionItem value="{!currFS.label}">
         <apex:repeat value="{!currFS}" var="currentField">
               <apex:inputField value="{!Account[currentField]}" />

Seems like I can't do this and would just like to get confirmation.





  • February 23, 2011
  • Like
  • 0

Hi all,


I am trying to create a field "Opportunity.Amount__c".  This field would be a rollup of "Quote__c.Quote_Amount__c".  Quote__c is the child in a master detail relationship with Opportunity.  "Quote__c.Quote_Amount__c" is a rollup summary of "Quote_Line_Item__c.Total_Price__c".  Quote_Line_Item.Total_Price__c is a formula field with data type currency.


I have 3 environments with the same schema (or at least I would like to believe it is the same).  1 config sandbox, 1 full copy sandbox, and 1 production.


In the full copy and production environment I am able to create this "Opportunity.Amount__c" field.  However, in the config sandbox I am unable to.  I can choose to create a rollup summary on "Quote__c" from Opportunity, but I am not able to pick "Quote_Amount__c" as the field to roll up on.


What limitations are there around picking the field you want to roll up on?









  • February 09, 2011
  • Like
  • 0



I am onsite at a client teaching them about the wonderful ways of salesforce development and have run into an issue when they try to "Run All Tests" within the browser.


First it seemed like it was working normally, there are quite a few unit tests in the org, so it is expected to take about 10 minutes to run to completion.  However, an hour rolled around and it still claimed to be "Running Tests...".  I had them close their browser and try again, and now they are presented with the "Organization Administration Locked" message.


So I tried my self to run these tests, thinking there is no way that the server is still executing unit tests, and low and behold 7 minutes later I have run all tests to completion.  So I had them try to run all tests again and they are still being shown an "Organization Administration Locked" message.


I am on a Mac, they are on PCs.  I am using Chrome, they are using IE7.  I don't think either of these things are the cause of the issue.  However, they are on a pretty locked down network while I am using a hotspot, but I would have assumed that if you could login to the org from their browser, that they would be able to run all tests from their browser.  Do I need them to setup proxy settings in their browser or something?  Has anyone else ever run into this?  Maybe its an issue with the new release?


In any event I will log a case with salesforce if I cant get this issue resolved by noon MST tomorrow.


Thanks all!






  • February 07, 2011
  • Like
  • 0

Hi all,


I see that if I use String.valueOf() or '' + on a Double that has 8 digits or more, it turns it into scientific notation.


Is there any way to prevent this?  I see that a .format() works, but that adds commas.  I can replace the commas with empty string, but this only works in my locale.


Am I really being forced to split on capital E, take the number after the E, and tack on the appropriate amount of zeros?  There must be a better solution.



  • January 06, 2011
  • Like
  • 0

So after hitting some view state errors I cleaned up my code to significantly decrease the size of the viewstate.


It sort of worked.


My view state is now at 88kb in size.  Inspecting the viewstate shows that my controller takes up about 15kb, the other 73kb is used by "Internal".  What is "Internal" and why is it so big?

  • December 28, 2011
  • Like
  • 0

Hi all,


I've got a currency field on a record where the currency iso code is CAD.


If I take the value from the currency field, put it in a local variable of type double, then format the double, you end up with the number formatted to the CAD locale.


For example, "14 000,24" or 14 thousand and 24 cents.


Client has asked that I transform this back to the US based format, "14,000.24".


You may be wondering, why even use .format()?  I use .format() because it gives me commas (or when currencyisocode = 'CAD' whitespace) every three digits.


Anyways...I am able to change "14 000,24" to "14 000.24" easily.  The problem is changing the whitespace to a comma.  You could try to trim this string, you could try to replace all whitespace with commas in this string, and it doesn't matter.  It ignores your requests, returning the original string.  What mysterious character is FORCE using here?  Would I be better off not using .format(), and instead using Pattern and Matcher classes to add the commas in correctly?



  • December 13, 2010
  • Like
  • 0

Hi all,


Let's say I had a simple page...something along the lines of the following...



<apex:page controller="SomeController">
  <apex:pageMessages id="error1" />
  <apex:pageMessages id="error2" />



Now lets say somewhere in this "SomeController" class I am adding a message to the page.



ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.INFO, 'My message here.'));

 I don't want this message to go to both pageMessages, I only want it to go to 1.


I could swear the DEV 501 videos say that you can do this by doing something similar to the following:



ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.INFO, 'My message here.'), 'error1');




Yet the documentation says nothing about this.  I'm not really in the mood to watch more of Chris Barry to find where he says this.  Anyone know how to accomplish this?



  • December 10, 2010
  • Like
  • 0

Hi all,


I've got a simple test method, within this method I am System.debug()ing out two date time values which are almost always equal, then the next line is an assertion to see if one is >= the other one and it fails.  Code is shown below.



System.debug('HERE = ' + objList[0].Start_Time__c + ' / ' + timeBeforeExecution);                                     
System.assert(objList[0].Start_Time__c >= timeBeforeExecution);



Below this is the result of the debug log.



11:04:31.274|USER_DEBUG|[56]|DEBUG|HERE = 2010-12-09 19:04:29 / 2010-12-09 19:04:29
11:04:31.274|EXCEPTION_THROWN|[57]|System.AssertException: Assertion Failed


If I change the assertion to == it works.  Not sure why == would work but not >=.  I guess as a work around I can just assert thats its > || its ==, but I was wondering if anyone had any ideas why this would be happening.




  • December 09, 2010
  • Like
  • 0

I am trying to create a VF email template that will be sent based off a date field on a custom object (Service_Plans__C_).  In the subject line, I'm trying to get it to display the name of the Opportunity that's related to the Service Plan.. but it displays the Opportunity ID, not the text name.


What should I use in place of {!relatedTo.Opportunity__c} to get the text name and not the ID? 


Service Plans is Master-Detail(Opportunity) if that matters.


<messaging:emailTemplate subject="Notification - Service Plan, {!relatedTo.Name}, for {!relatedTo.Opportunity__c} expires on {!relatedTo.Service_Plan_End_Date__c}" recipientType="User" relatedToType="Service_Plans__c">





Alright I have wound up in a situation where I am using a Text(255) field to field in the value parameter of a SelectList in Visualforce.  When the selectList has multiSelect set to false this works perfectly.  When multiSelect is set to true, it writes the value back to the field exactly as expected.  However if there is already a value in the field, it will not show up preselected.  The value is stored as val1;val2;val3 etc... and is in the same format that the selectList wrote it there as.  Can anyone think of a way to get the selectList to preselect the correct values?  Please do not tell me to use inputField along with the correct field type, trust me that is not an option here. 

i  have a javascript that is querying my custom object. what i want is to get an email value. this is my javascript


var result = sforce.connection.query("Select Main_Email__c From Candidate_ATS__c where Name ='{!JobApplicant_ATS__c.Candidate_Name__c}' ");
var records = result.getArray("records");

//If there are no  record
if (records.length == 0){
alert("no record");
//If there is a record


When i alert records this is what am getting:


{type:'Candidate_ATS__c', Id:null, Main_Email__c:'abc@abc.com', }


pliz help get my email i.e. abc@abc.com

  • August 09, 2012
  • Like
  • 0

I have built a custom object that attaches two accounts together, similar to the Parent Account function, but allows to add details about the relationship.  I set it up as a M-D to Accounts, so there is a Master (Parent) Account on this record and a lookup (Child) to another Account on this record along with other fields that detail the type of relationship between the two Accounts.  What I would like to do is show all the Contacts on the "Child" Accounts that are related to the "Parent" Account on that Accounts detail page.  My thought was to create a VF page and put it in a section on the Account detail page that shows this list/report, but I am having trouble figuring out how to get the necessary data in there.  I would like it in the following format if possible...


Relationship Type       Account Name

    Contact name        Contact Phone    Contact Email


Buyer      ACME

  John Smith     111-222-3333    johnsmith@acme.com

  Jane Smith     111-222-4444    janesmith@acme.com

Seller     RoadRunner Inc.

  Blue Bird        333-333-4444    bluebird@rrinc.com

  Fast Bird        333-333-9999    fastbid@rrinc.com



So, effectively you are interating over the custom object on an Account to list all those records and some details from those records and then iterate over the contacts from the accounts on each of those records.  Any guidance would be greatly appreciated...

how do i pass a javascipt variable into apex variable.

Like i get the id corresponding to a checkbox in javascipt .how do i reflect it into apex varible





I've been writing some Ruby code that utilizes wsdl2ruby and the Apex WSDL to run unit tests from ruby.


rtr = RunTestsRequest.new(:allTests  => false, :classes   => 'MyClassName')      
@sfApex.runTests(:runTestsRequest => rtr)

 Code above is pretty simple, just attempting to run a single test class with a one small unit test.


Problem is that this takes way longer to execute than it should.  This class executes in about 10 seconds in the browser but takes about half an hour to run as shown above from irb.


Anyone try to do something similar before?

I have the following Apex REST class and I'm getting the following error when calling it via the API.  The query runs fine in the console, and the error dissapears when I remove the query from the class.   My ultimate goal is to email a Knowledge Article Attachment Ideas?




global with sharing class SendAttach {
    global static String doGet() {
        RestRequest req = RestContext.request;
        RestResponse res = RestContext.response;
        List<XXXXXXX__kav> myArticles = [SELECT Id, Article_Attachment__Body__s FROM XXXXX__kav WHERE Id = 'testHardCodedIdGoesHere'];
        return 'true';






An unexpected error occurred. Please include this ErrorId if you contact support: 67049153-20127 (1467520363)


Just starting to delve into the SF world; getting the feeling there's a lot of good resources, once you get over the initial steep learning curve.


I'm wanting to add a trigger so that when a new set of inventory and price are added, the system adds in the previous figures added in.  That way you can calculate the movements and plot out the results as an up/down pattern.


I thought I can then scan through each of the entries and copy the previous price and inventory into the next entry as the "previous price" etc.  That means I could add formula fields like 'large increase' or flag things for review.  Yes the end result could be done by comparing the dates modified but I want the ability to backfill the data at a later date so I need to be able to loop through the list in order of delivery date (date is a custom field in the object btw).


I think I'm right in saying that I can't do a sort on a custom object though.  I suppose that the for() loop might not necessarily go from start to finish or top to down if you know what I mean.  I'm not sure where I go from here or if my bet bet is to make a new list, fill it with the dates, sort that and then run the two against each other?  This is what I had so far


Trigger FetchPreviousDaysInfo on Delivery_Data__c (before insert, after update )
List <Delivery_Data__c> DeliveryData =
From Delivery_Data__c ii
For Update



Double LastPrice = 0;
Double LastStocks = 0;


for(Delivery_Data__c TheEntry: DeliveryData)
     if (LastPrice <> 0)
         TheEntry.Previous_Price__c = LastPrice;
         TheEntry.Previous_Stocks__c = LastStocks;
     LastPrice = TheEntry.Price__c;
     LastStocks = TheEntry.Stocks__c;



update DeliveryData;

Noticing some oddities with base 64 decoding PDF attachments.


(1) Create a visualforce page that renders as PDF.  Save the resulting PDF as an attachment to salesforce.  Lets call the resulting PDF "original pdf".

(2) Write some javascript


var results = sforce.connection.query("SELECT Name, Body FROM Attachment WHERE Id ='<id of attachment i just uploaded>' ");
var records = results.getArray("records");
var unencodedPDF = sforce.Base64Binary.prototype.decode(records[0].Body);

 (3) Turn unencodedPDF into a pdf.  Lets call this "new pdf".

 (4) Compare "original pdf" and "new pdf".  Notice "new pdf" is just a blank white page.


What am I missing?

I have a custom controller that queries 3 objects for fields.


For my custom object called Job_Aids__c, is there a way of retrieving all the field names instead of having to list them all out as I have below ?


I hope the answer is yes because I have over 300 fields. Please help

public Job_Aid__c getJob_Aid() {
         return [select id, createddate,U_opportunityname__c,X3rd_party_pressuring_improved_bus_perf__c,text__c from Job_Aid__c  where U_opportunityname__c = :ApexPages.currentPage().getParameters().get('id')]; 


  • March 27, 2012
  • Like
  • 0

I deleted the starthere and xmldom class, along with the start here page. I was trying to remove all unnecessary classes so I could complete my testing for code coverage. However, now when I log in I receive an error page. Obviously, something is still referencing the start here page. Can anyone help me figure out how to completely remove these?


Visualforce Error

Page LFI__Start_Here does not exist

Create Page LFI__Start_Here



The StandardSetController that allows VisualForce pages and Apex to paginate through the records has a "Save" method. According to SalesForce documentation:



Inserts new records or updates existing records that have been changed. After this operation is finished, it returns aPageReference to the original page, if known, or the home page.




The issue that I am facing right now is everytime I make an update to any of the records and use the save method provided by that query, it always returns me to page 1.


For example, if I go to page 3, make an update, and perform a "Save" it always returns to the first page. I thought that it should return to the original page (which is the current page you are on). Am I misunderstanding the documentation? 

throw new IllegalArgumentException('Strings must not be null');



How do i give the above java line in  Apex




Managed Package Functionality:

I am developing on managed package app which will be used by different customer.In this app, I am using one object called Job. I need to use one field as Job Number. This Job Number field is populated based on Customer's demand.


For example,
Customer 1 has requirement to populate it as YYYY_MM_AutonumberValue.


Customer 2 has requirement to populate it as MM_YYYY_AutonumberValue.


Customer 3 has requirement to populate it as only AutonumberValue.


Customer needs to have ability to to provide different criteria to set this value.


I also want to use this field on visualforce pages, apex code.


What would be suggestion to handle such scenarios?




I have a component that accepts a Boolean attribute. Certain combinations of inline functions generate the error message shown in the subject line. See code below for details:


<!-- this produces the error --> <c:myComponent myBooleanValue="{!LEN(myObj__c.myField__c) == 0}" .../> <!-- this produces the error --> <c:myComponent myBooleanValue="{!LEN(myObj__c.myField__c) = 0}" .../> <!-- this works! --> <c:myComponent myBooleanValue="{!NOT(LEN(myObj__c.myField__c) > 0)}" .../>


Obviously I have a workaround (the last example) but I'm curious to know why the other two do not work.

Hi ,
is there any way to login from one Salesforce.com org into another Salesforce.com org using Apex. Actually, i have written one Apex class and wanted to login into a different SFDC org from that class.

Please post me if anyone have any solution.

Thanks in advance,
  • February 28, 2008
  • Like
  • 0