• ngabrani
  • 391 Points
  • Member since 2010

  • Chatter
  • 15
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 8
  • 134

Cod ecoverage for this class


public class MDFException extends Exception{





It's urgent ...please help

  • April 02, 2012
  • Like
  • 0



my client wants to have a weekly email that displays the list of records being updated(only) to keep track of what record is being updated.


my initial plan is to do it in workflow rule but i learned that there are some limitations(time-dependent functionality is only used when record is created only ONCE)


im thinking of using a chatter. is it possible?



thanks in advance,



  • January 10, 2012
  • Like
  • 0

I need to write some validatio/trigger on attachment object. Is there any possibility of doing that ?

We had a consultant do a demo page for a website project we are scoping.  Just had him do 1 page so other pages won't work.  Anyone either have any comment on how this was done or how I might be able to tell, as a non developer, if looks like person has some good development skills?  Site is below (no login needed)





I have created  one visual force page using custom object. I want to show  field history tracking as a related list in a visual force page. Does anyone know what API name is used for field history traking, I tried to find the API name but couldn't get it.


  • March 18, 2011
  • Like
  • 0

Hi all,


I'm trying to build a VF page in which some of the formatting changes depending on the result of IF and CASE statements.  As part of the true or false results, I'm trying to add line breaks <br />, include links <a href...>, or even throw in some images.  I am currently presented with this error:


Syntax error. Found '<'


Example code:

If(MyField__c = 'Pass', <a href="www.myurl.com">You passed!</a>,'')


Any ideas?

I need to display the date in "Nov 25th,2010" format.How can i include "th" along with date format.

  • November 25, 2010
  • Like
  • 0

Hi every body !


I need some help to finish my test class.


Y have a customer object (Int_Call_Plan__c), which has a lookup to object Account, through a customer field.


In the map to load the object via the data loader, I have this for the concerned field :




In my test class, I need to set this field. I have done this, I know it's wrong, but I can't find how to write it. I have tried others combinations (for example with the Id of Account I try to get after insert), without success for now.


public with sharing class Test_IntCallPlanResult2 {

static testMethod void testIntCallPlanResult2() {
        Account testAccount1 = new Account();
        testAccount1.Name = 'TestAccount1';
        testAccount1.External_key__c = 'XXXPOS1';
        insert testAccount1;
        Account IdtestAccount1 = [select Id from Account where External_key__c ='XXXPOS1' limit 1];
        test IntCallPlan

        Int_Call_Plan__c intCallPlanNew1 = new Int_Call_Plan__c();
        upsert intCallPlanNew1;


Thanks for your help, anyone.. !




  • November 16, 2010
  • Like
  • 0



i am wondering if it is possible to access specific values of a map in a Visualforce page.


I would like to iterate over a map and select a specific value in the map by referencing its key.


For example like this: {!Map.key} gives out the value of the given key.


Is this in any way possible?




  • November 15, 2010
  • Like
  • 0



I am trying to display the only first four lines of  a field not the whole field value in the dataTable's column. 


Any idea how to do this?




Hey all,


I am trying to figure out how to use a command button that will save a Visualforce Page, then open a new Visualforce page passing in Parameters for the new page to use. 


I know that I would use a controller extension on the first page and include the standard save component, but what would I do afterwards? This is the code for the commandbutton itself and the parameters to pass to the new page



<apex:pageBlockButtons >
<Apex:commandbutton value="Save and Add Call Attendee" Action="{!save}"><Apex:param name="Account" value="{!Call_Report__c.Account__c}"/><apex:param name="CallReport" value="{!Call_Report__c.Name}"/></apex:commandbutton>



And this is the save component.  How would I open a new page after the save?  Is it a simple PageReference call to the new VF page? Is there something much more complicated? 



public PageReference save()
        PageReference CRsave = controller.save();
        //I imagine something else would go here...
        return CRSave;







Hi ,
I have  a custom object Purchase_Order__c which has a child object Purchase_order_line__c.
Now i have a page button on the Purchase_Order "Receive" which calls a visualforce page that displays the related purchase_order_lines as a table with the received quantity as input fields.There is also a "Save" Button.
But when i make changes and click on the save button the changes are not saved.

This is because the id passed to the page is the purchase_order id and nopt the related list.My code was as below:
<apex:page standardController="Purchase_Order__c">
    <apex:form >
            <apex:pageBlock >
            <apex:pageBlockButtons location="bottom">
                <apex:commandButton action="{!save}" value="Save"/>
            <apex:pageBlockTable value="{!Purchase_Order__c.Purchase_Order_Lines__r}" var="line"  border="1">
<td><apex:column value="{!line.name}" style="white-space:nowrap ;font-weight:bold"/></td>
<apex:column />
<apex:column value="{!line.Product__c}"/>
<apex:column headerValue="Purchase Quantity">
   <apex:outputField value="{!line.Quantity__c}"/>
         <apex:column headerValue="Received Quantity">
   <apex:inputField value="{!line.Received_Quantity__c}"/>
             <apex:column headerValue="RMA Quantity">
   <apex:inputField value="{!line.RMA_Quantity__c}"/>

Now to resolve this i tried to write a controller extension  for purchase_order to update the records when save is clicked:

public class receiveController {
  // Constructor
 public receiveController(ApexPages.StandardControlle​r controller) {
  this.po = (Purchase_order__c)controller.getRecord();          
     this.pol = [ SELECT
       d.Name, d.quantity__c
      purchase_order_line__c d
      d.purchase_order__c = :po.id ];
 // Action Method called from page button
 public pagereference saveChanges() {
  upsert this.pol;
  return null;
 // Action Method called from page link
 public pagereference newRec() {
  Purchase_order_line__c d = new Purchase_order_line__c();
  d.Purchase_order__c =this.po.id;
 pol.add( d );
  return null;
 // public Getter to provide table headers
 public string[] getheaders() { return new string []
  {'Name','Quantity__c'} ; }
 // public Getter to list
 public Purchase_order_line__c[] getRecs() {
  return this.pol;
 // class variables
Purchase_order__c po;
Purchase_order_line__c[] pol;

But i get a compile error:

Error: Compile Error: Invalid type: ApexPages.StandardControlle​r at line 4 column 27.


Can somebody please help me? iam really stuck here badly....


I am unable to downlaod the force.com developer guide.can anybody plz send me the  link.




Would anyone be able to let me know the limitations (or location of a document that provides these limits) for the following items?



  • Record Types
  • Page Layouts
  • Items in a Picklist
  • Formula Fields (I am aware that there is a 500 field limit per object but is there a specific limit for the number of formula fields?)
I'm sure there was a document stating this but I can't find it anywhere...




I have been using Apex data loader to export data. Today i am unable to login in Apex data loader. Can someone help me out to resolve it?



Daisy K

  • January 18, 2010
  • Like
  • 0

Does Salesforce support triggers on Chattergroup object?


Kindly send a link (if any) to standard documention on this.

I have a Word file in documents folder in Salesforce. I need to convert this Word file to PDF format. Is there any web service that I can invoke to convert the Word file into PDF? I can then invoke this web service from Apex.


I dont think there is any feature in Salesforce to convert Word to PDF.

Astrea Infotech is a registered Salesforce partner. Astrea also runs the leading free Salesforce online certification resource

In a short timeframe Astrea has built a reputation of providing excellent quality on Salesforce development, without spending a fortune. Please contact us at admin At astreait dot com

I need to display an image in Salesforce Visualforce page with the following behavior. When the image is clicked, depending upon the x and y coordinates of the click, I need to update the contents of a table on the same page. How do I get the x and y coordinates of the image that the user has clicked.


Appreciate your help.


I have three triggers and 1 test case that I am trying to upload from staging to production. In Staging I get a test coveragae of 85% when I run this one test case. However when I try to upload this changeset to production, I get an error that the test coverage is just 72% and the required test coverage is 75%.


Can I get more details on this 72%, when the test cases are being run during deployment. What is the breakup of test coverage  at class level. Also how do I view the debug log, when a change set is being deployed, on production, and test cases are being run at that time. All I am getting is a message like -


Deploy Error

Average test coverage across all Apex Classes and Triggers is 72%, at least 75% test coverage is required


Appreciate your help.

I need to perform a SOQL query in Apex with dynamic parameters. The object names and field names are dynamic. A query something like
select :fieldName1, :fieldName2 from :objectName

The fieldName1, fieldName2 and objectName will be known only at runtime.

Is there any way to perform such a query in Salesforce?

Many Thanks,


Couple of questions on displaying collections in a tabular format

1. Lets say an Apex controller is returning an List of 50 elements. I want to display five columns of ten elements each - first column with first ten elements, second column with next ten and so on... What is the best way to implement this


2. Lets say an Apex controller is returning a Map. Key is a String and value is a list of String. In VisualForce, For all the keys, I need to display Key as the column header, and I need to display strings in the list corresponding to the key as elements in the column. What is the best way to implement this.


Many Thanks.

1. Is there a way to explicitly call a Apex setter method from Visualforce. Lets say there is a field i of type Integer in a Controller Extension Apex code. I want to set the value of i from the corresponding Visualforce by explicitly calling setI. Is this possible?

2. I have defined a getter method in a Controller Extension. This method takes an argument. I want to call this getter method from Visualforce and pass a value. Is this supported?

3. Does Apex support two dimensional Lists. Can I declare something like -
      List<10><Rate_Set__c> roomRates;


Much Appreciated

We have an immediate requirement for a mobile app to be developed.  I think what we need can be achieved on the current Salesforce One mobile app platform.


We have a specific brief of what it needs to do and I am looking to discuss with a (ideally London based) developer or company.





I am not able to create a report on Avg NO.of cases that are closed by an agent in a day can any one suggest me on this


How to calculate the no of cases closed per hour in a day and find avereage ?


.thanks in advance

When an Account is deleted, I need to update all the related cases with a new 'matched' Account Id and then delete the Original Account.

In the BeforeDelete Trigger of Account, Cases attached to the account are being successfully updated to a new matched account

However, the Delete of Original Account fails, with message 'Delete failed. as account is still associated with Cases'


Any ideas on why the original Account is throwing an error and not being deleted ? Do I need to disassociate original account with the cases attached to it, at the account level. If so how ?





I am new to salesforce.pl anyone can help me how to implement trigger for the following

        When a number is inserted, how to find that number is even/odd or prime number or armstrong or a palindrome.

Thanks in advance

I have a master table say employee and a chile table called employee_subordinates


So it is 1 to n relationship b/w them.

I am looking at cloning function which will help me to clone both the master and child tables when i click on clone. Any example code for this clone function is very helpful. Thanks in advance


I have a question, Why do we need to disable Triggers at the time of Data migtation? And if we have to do this then what abt Data which never gets updated. 

I am not sure how to overcome this situation. Other way round is to update field already in csv file. But that cannot be handle for large number of records.

If anyone faced the same problem please provide your solution.




Is it possible to define an error method for an entire Apex class? 


Many thanks


Hi All,


I am having 10 months of experience on force.com platform. I have achieved ADM201 and DEV401 few months back. I want to get DEV501 certified. Will this help me in getting good job on salesforce.com platform. 


Is there any statistics available which will tell DEV401, DEV501 certification count?


Please reply.



I am really knew to all this and having trouble deploying a trigger that will udpate a field in a contact when the status of an activity changes.  At this point I have the trigger working just find but the class I created for testing fails and I have no idea why.  Thank you for taking the time to thelp!  


The message I get when I run the class is: 

System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, Update_Last_VM_Left: execution of AfterInsert caused by: System.DmlException: Update failed. First exception on row 0; first error: MISSING_ARGUMENT, Id not specified in an update call: [] Trigger.Update_Last_VM_Left: line 7, column 1: []


Stack Trace:

Class.TaskTestMethod.TestTasktrigger: line 12, column 1



And here's my code:



trigger Update_Last_VM_Left on Task (after insert, after update)
  Task ts= Trigger.new[0];
  if(ts.Status == 'VM Left'){
      Contact contactToUpdate = new Contact(id=ts.WhoID);
      contactToUpdate.Last_VM_Left__c = date.today();
      update contactToUpdate;



private class TaskTestMethod{
static testMethod void TestTasktrigger()
            Task[] CreateTask = new Task[]{};
            Contact[] CreateContact = new Contact[]{};
            for(Integer x=0; x<100;x++){
            Task ts = new Task(Subject='Apex Test',Status='VM Left');
        insert CreateTask;


  • September 29, 2012
  • Like
  • 0

I need to make a copy of an existiing quote and update the original quote with the different values in the field.


Like original is A copy of A is B(copied quote) and from C(another quote) copy to A.

Cod ecoverage for this class


public class MDFException extends Exception{





It's urgent ...please help

  • April 02, 2012
  • Like
  • 0

Just checking if this can be done. I have 6 custom objects and I want to create a page that has a tab for each of these objects. They are not related to each other they are all stand alone objects. I just need to group them all on one page so that an administrator can edit the data in one place.


Is this doable?  any code snippet to get me going?  the only code I find is the code for the Account sample: http://wiki.developerforce.com/page/Tabbed_Accounts_in_30_seconds


can this code be modified to point to unrelated objects and not based on a standard object?



I have on Opportunity a trigger and a test class for a special case (created and deployed for a long time by someone else).


I have created another trigger (always on opportunity) to do totaly something else and I created a test class to cover the code. (100% of coverage)


When I want to deploy my new trigger and its test class in production I have this error :

Failure Message: "System.LimitException: Too many query rows: 50001", Failure Stack Trace:...


It tries to test not my test class but the other test class of the old trigger.


I don't understand why the other Test Class is executed and for the wrong trigger ? Why don't it take the good test class ?

Could you explain to me and give me a solution for this pb ?


Thank you.



I am deploying a newly created email template from sandbox to production. I don't want RunAll test to be executed as org is very big and running all tests will lock the org.

So can anybody please confirm me if RunAll test will be kicked on, if I am only deploying 1 email template.

Hello everyone,



Is there any simple way to schedule a massive delete of a custom object?


I want to insert new records everyday, but I want to save time and schedule a massive delete during the night


Thanks in advance



  • January 17, 2012
  • Like
  • 0

Hi all,

     I have this trigger written here. Now i wanna calculate the value of field Age_Of_ Insurance and assign it to the record that is entered.See the bold Line.

trigger Calculation  on Contact (before insert,before update)
   String  a='';
   String  month='';
   String  yr='';
   String  x='';
   String  dat='';
   integer m=0;
   integer d=0;
   integer z=0;
   integer i=0;
   integer yar=0;
   integer year=0;
   boolean variable=false;
   for (Contact c: trigger.new)
        If(c.RecordTypeId  == '012O00000000Au3')                          //to make sure that trigger fires only in case of corporate contact record types.
          a=c.SSN_for_Customer__c;                                       //assign ssid__c to a string variable 'a'. 
          if (a.length() != 8)
           c.addError('Please enter SSID in yymmdd-x format');

        month=a.substring(2,4);                                          //fetch string representing month in 'a'.
        dat=a.substring(4,6);                                            //fetch string representing date in 'a'.
        yr=a.substring(0,2);                                             //fetch string representing year in 'a'
        m=integer.valueof(month);                                        //CALCULATE INTEGER VALUE OF MONTH IN SSID
        yar=integer.valueof(yr);                                         //calculate integer value of yy in ssid.
        d=integer.valueof(dat);                                          //CALCULATE INTEGER VALUE OF DATE IN SSID
        z=integer.valueof(x);                                            //CALCULATE INTEGER VALUE OF X (century).
            if(z==1 || z==2 || z==5 || z==6)
               i=1900;                                                   // calculate century.
        year=i+yar;                                                      // to get value of year in YYYY format.
        Date myDate =date.newinstance(year, m, d);                       //create date outh of given integer values.
        Date today=System.today();                                       //fetch todays date from the system.
        integer numbermonths=myDate.monthsBetween(today);                //calculate number of months between two dates
                     c.addError('Please enter SSID date lesser than current date in yymmdd-x format');


                      integer addmonth=numbermonths+6;                                 //add 6 to total number of months
                      double y=addmonth/12;                                            //get total number of years in between two dates
                      c.Age_Of_Insurance__c=y;                                         //assign this value to Age_Of _Insurance__c

Now I wanna achieve this by writing the trigger after Insert and After Update.

How Can this be done?

Using the same code if I change The actions to after Insert it gives error.


c.Age_Of_Insurance__c iis a read only field.

Whereas at back end its a number field.



How can i provide a link in an object record  dynamically to an notes and attachment presnt in another object record.




  • January 16, 2012
  • Like
  • 0

I need to write some validatio/trigger on attachment object. Is there any possibility of doing that ?

How do I export a single contact from Salesforce to Outlook. Is there any way to quickly export a contact as a VCF.
  • September 12, 2007
  • Like
  • 1