• Vidhyasagaran Muralidharan
  • NEWBIE
  • 388 Points
  • Member since 2014

  • Chatter
    Feed
  • 11
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 7
    Questions
  • 158
    Replies
I have 2 objects policy and  Interview. On Interview Record, i have policy as a lookup.

If interview fields contact name , Insured name  matches with any policy record's contact name , Annuity name  Then i have to pull the Policy record on to the Interview. I have written below code but failed. please any one update this ?


trigger Interview_PolicyUpdate on Interviews__c(before insert,before update) {

set<id> cset = new set<id>();

Map<Id,List<Policy__c>> policyMap = new Map<Id,List<Policy__c>>();
List<policy__c> poList = [select Id,name,Contact__c,Type__c,Annuitiant_Name__c from Policy__c where Contact__c in:cset ];

Map<Id,string> Intmap = new Map<id,string>();

for(Policy__c poli : PoList ){
if(policyMap.get(poli.Contact__c) !=null){
policyMap.put(poli.Contact__c,new list<policy__c>());
Intmap.put(poli.Id,poli.Annuitiant_Name__c);
}
}
for(Interviews__c Intrvews : Trigger.new){
for(Policy__c polic : PoList ){
if(policyMap.ContainsKey(Intrvews.Contact__c)&&policyMap.ContainsKey(Intrvews.Insured_Name__c)){ // Comparing  both policy,Interview matches

Intrvews.Policy1__c = Polic.Id;
}
}
}
}
  • July 22, 2014
  • Like
  • 0
Hi,
I have the following code which runs correct from a workspace in developer console. However,  when i put them into a test class, the same code return the List Index Out Of Bounds Error. It is as if in a test class , no records can be retrieved. 
Anyone who has the same experience? would appreciate very much for a solution
---------------------------------------------------------------
List<Warehouse_Transaction__c> w = [SELECT Name FROM Warehouse_Transaction__c WHERE Name = :'INV-0000'];
        List<Merchandise__c> m = [SELECT Name FROM Merchandise__c WHERE Name = :'M-00010'];
        system.debug(w[0].Name);
        system.debug(m[0].Name);
Hi,

I want to display a picklist field in my vf page followed by continue and cancel button , Please help me with a sample code


Thanks in Advance
So I watched this video:  https://www.youtube.com/watch?v=J4yX17_yxbI

And found their code base on GitHub:  https://github.com/sbhanot-sfdc/UberJet

And used much of their code to build a front end page and back end class fitting my needs.  I can save the Controller/Class perfectly well (no errors) but when I try and save the VF page that references that class/controller I get the following message:

The error message

Now, the funny thing is that that when I click on either of these to create these "Methods" and "Properties" it just spins and spins and doesnt' go anywhere.  No error message.  It just stalls on the spinning icon as if it is doing something but never actually does it.  

Does anyone know what's going on here?


hi friends ,
pls help me to write following trigger
here contact is having custom field primary of type checkbox
● Each account may have multiple contacts but only one marked “Primary”
● Each account must have 1 primary contact.
● The account should display the name of its primary contact on the account detail screen (i.e. in a field).

pls help me
How to change the colour of the text in the visualforce page countinuesly with in 10 sec time span ?

Hi

how do I submit my Visualforce page with buttons language:
English, Portuguese and Spanish?

Its a quick way to do this, using features of Salesforce?
 
public with sharing class empdepExtensionNew
{

    public Contact[] Availabledeps {get;set;}
    public dep__c[] shoppingCart{get; set;}
    //public dep__c[] total{get; set;}
    public emp__c theemp {get; set;}
    public String tonSelect{get; set;}
    public String toUnselect{get; set;}
    public String searchString{get; set;}
    //public String value{get; set;}
    public Boolean AccountRT{get; set;}
    public Boolean ContactRT{get; set;}
    public Boolean LeadRT{get; set;}
    public Boolean OpportunityRT{get; set;}
    public String UserID {get; set;}

    private dep__c[] forDeletion = new dep__c[]{};
    private ApexPages.StandardController controller;

    //Constructor

    public empdepExtensionNew (ApexPages.StandardController controller)
    {
        this.controller= controller;
        if(controller.getrecord() == null)
        system.debug(controller.getrecord().id);

        //UserID = UserInfo.getname(); 

        //emping Custom Setting object for Recordtypes in emp object

        Record_Type_Name__c Accrt = Record_Type_Name__c.getValues('AccRecordTypeID');
        Record_Type_Name__c Conrt = Record_Type_Name__c.getValues('ConRecordTypeID');
        Record_Type_Name__c Leart = Record_Type_Name__c.getValues('LeaRecordTypeID');
        Record_Type_Name__c Opprt = Record_Type_Name__c.getValues('OppRecordTypeID');

        //Condition to check the record type for emp object 

        if(ApexPages.currentPage().getParameters().get('RecordType') == Accrt.Record_Type__c){
            AccountRT = TRUE;
        }
        if(ApexPages.currentPage().getParameters().get('RecordType') == Conrt.Record_Type__c){
            ContactRT = TRUE;
        }
        if(ApexPages.currentPage().getParameters().get('RecordType') == Leart.Record_Type__c){
            LeadRT = TRUE;
        }
        if(ApexPages.currentPage().getParameters().get('RecordType') == Opprt.Record_Type__c){
            OpportunityRT = TRUE;
        }

      { 
            //String value = ApexPages.currentPage().getParameters().get('Id');

            //total =[Select id,name,empId__c,Contact_Id__c,emp_Date__c,dep__c.Contact_Id__r.Name from dep__c ];
            shoppingCart = [Select id,name,empId__c,Contact_Id__c,emp_Date__c,dep__c.Contact_Id__r.Name from dep__c where id =: tonSelect]; 

       }
       updateAvailableList();
     }

    public void updateAvailableList() 
    {

        UserID = UserInfo.getUserId(); 
        String qString =  'select id, Name, Title, Contact.MailingCity,Contact.MailingState,Contact.Account.Name from Contact  where User_Id__c not in (select ID from User where id =: UserID )' ;
        system.debug(qString);

        if(searchString!=null)

        {          
            qString+= ' and ( Contact.Name like \'%' + searchString + '%\' or Contact.RACFID__c like \'%' + searchString + '%\' or Contact.Officer_Code__c like \'%' + searchString + '%\') ';                       
        }

       Set<Id> selectedEntries = new Set<Id>();
       if(tonSelect!=null)
        for(dep__c d : shoppingCart){
            selectedEntries.add(d.Contact_Id__c);
        }

        if(selectedEntries.size()>0){
            String tempFilter = ' and id not in (';
            for(id i : selectedEntries){
                tempFilter+= '\'' + (String)i + '\',';
            }
            String extraFilter = tempFilter.substring(0,tempFilter.length()-1);
            extraFilter+= ')';

            qString+= extraFilter;
        } 

        qString+= ' order by Name';
        qString+= ' limit 12';
        system.debug('qString:' +qString );               
        Availabledeps = database.query(qString);
        system.debug(Availabledeps);

    } 

    public void addToShoppingCart()

    // This function runs when a user hits "select" button next to a dep

    { 
      for(Contact part : Availabledeps)
       {
        if((String)part.id==tonSelect)
            {

                shoppingCart.add(new dep__c (Contact_Id__c =part.id));
                system.debug(shoppingCart);
                system.debug(shoppingCart.size());
                break;

            }          

        }
         updateAvailableList();

    }  

      public PageReference removeFromShoppingCart(){

        // This function runs when a user hits "remove" on "Selected dep" section

        Integer count = 0;

        for(dep__c del : shoppingCart){
            if((String)del.Contact_Id__c==toUnselect){

                if(del.Id!=null)
                    forDeletion.add(del);

                shoppingCart.remove(count);
                break;
            }
            count++;
        }

        updateAvailableList();

        return null;
    }

     // This function runs when user hits save button

     public PageReference onSave(){

        try{

            PageReference pageRef = controller.save();
            system.debug(controller.getrecord().id);

                if(shoppingCart.size()>0) 

                  for (dep__c partmember : shoppingCart ){
                     partmember.empId__c=controller.getrecord().id;
                     System.debug(partmember.empId__c);
                  }

                  System.debug('size' +shoppingCart.size());
                  insert(shoppingCart);
                }


            catch(Exception e){
            ApexPages.addMessages(e);
            return null;
        }  
           System.debug('completed');

        // After save return the user to the emp
       return new PageReference('/' + controller.getrecord().id);  
    }     
}
Test class:
@istest(seealldata=true)
Public class Test_empdepExtensionNew
{
Public static testmethod void empdepExtensionNew_test()
{
    Record_Type_Name__c opprt =[select  ID,name,Record_Type__c from Record_Type_Name__c where name ='OppRecordTypeID']; 
    PageReference nextpage = new PageReference('/apex/empCustomNew?id='+opprt.Id);
    nextpage.setredirect(true);
    emp__c  c = new emp__c(Subject__c = 'TestdepExtension',emp_Type__c = 'BD Monthly Update',emp_Date__c = system.today(),
    Status__c = 'DONE',OpportunityId__c='006q0000004QWR7',RecordtypeId=opprt.Record_Type__c);
    insert c;
    empdepExtensionNew e = new  empdepExtensionNew(new ApexPages.StandardController(c));
    contact con = new contact(LastName='test',Contact_Type__c='Business contact',AccountId='001q000000BDufL');
    insert con;
        e.updateAvailableList();
        e.addToShoppingCart();
        e.removeFromShoppingCart();
        e.onSave(); 
        dep__c p1 = new dep__c(empId__c=c.id,Contact_Id__c='003q000000CrgjD');
        dep__c p2 = new dep__c(empId__c=c.id,Contact_Id__c='003q000000CvPct');
        List<dep__c> part = new List<dep__c>();
        part.add(p1);
        part.add(p2);
        insert part; 
        //System.assertEquals(3, [select count() from dep__c where empId__c=:c.id]);
    }    
}

At present code coverage is 66%.Kindly help me out to increae my code coverage. thanks
Apex code:
Public class drop
{
public List<SelectOption> addopt{get;set;}
Public string name{get;set;}
Public void drop()
{
addopt= new List<SelectOption>();
}
Public void addlist()
{
addopt.add(new SelectOption(name,name));
}
}
 Vf page:
<apex:page controller="drop">
<apex:form >
<apex:inputField value="{!name}"/>
<apex:selectList id="lis">
<apex:selectOptions value="{!addOpt}">
</apex:selectOptions>
</apex:selectList><p/>
<apex:commandButton action="{!addlist}" value="Save" reRender="lis"/>
</apex:form>
</apex:page>

Error:Error: Could not resolve the entity from <apex:inputField> value binding '{!name}'. <apex:inputField> can only be used with SObjects, or objects that are Visualforce field component resolvable

Guys help me out
vf page:
<apex:page controller="vfcontrol" showHeader="false" sidebar="false">
<apex:form >
<apex:selectList size="1">
<apex:selectOptions value="{!selectedObject}"/>
</apex:selectList><p/>
</apex:form> 
</apex:page>

Apex code:
Public Class vfcontrol{
public List<selectoption> selectedObject {get; set;}
public vfcontrol()
{
selectedObject = new List<selectoption>();
}
Public void Objectnames()
{
for(Schema.SObjectType objTyp : Schema.getGlobalDescribe().Values()){
selectedObject.add(new selectoption(objTyp.getDescribe().getLocalName().toLowerCase() ,objTyp.getDescribe().getLabel() ));
}
}
}
Plese help me object name arenot displaying in vf page
Public Class vfcontrol{
public List<selectoption> selectedObject {get; set;}
public vfcontrol()
{
selectedObject = new List<selectoption>();
}
Public void Objectnames()
{
for(Schema.SObjectType objTyp : Schema.getGlobalDescribe().Values()){
String name = objTyp.getDescribe().getName(); 
selectedObject.add(new SelectOption(name));
}
}
}
Error:Compile Error: Constructor not defined: [System.SelectOption].<Constructor>(String
I have a requirement like there are five objects in my app. and each object has set of records.And there is VF page in that i have one picklist .
which contains all these five object names.If i select a object name it should dynamically populate records and column name for the particular object in to that visulaforce page.

Guys help me in this.
trigger updateday on case_obj__c (before insert){
for(case_obj__c a :trigger.new)
{
Date dt = a.case_dt__c;
String dayOfWeek=dt.format('EEEE');
a.day__c=dayOfWeek;
}
}
I tried this code but i am gethhing this error:Error: Compile Error: Method does not exist or incorrect signature: [Date].format(String)
whats is the problem?
Like i am trying to create recruiting app.in that i need create my own hierarchy .but in dveloper edition there is sammple hierarchy.I dont want to use that.I need to create my own.whether there is any way?
 
public with sharing class empdepExtensionNew
{

    public Contact[] Availabledeps {get;set;}
    public dep__c[] shoppingCart{get; set;}
    //public dep__c[] total{get; set;}
    public emp__c theemp {get; set;}
    public String tonSelect{get; set;}
    public String toUnselect{get; set;}
    public String searchString{get; set;}
    //public String value{get; set;}
    public Boolean AccountRT{get; set;}
    public Boolean ContactRT{get; set;}
    public Boolean LeadRT{get; set;}
    public Boolean OpportunityRT{get; set;}
    public String UserID {get; set;}

    private dep__c[] forDeletion = new dep__c[]{};
    private ApexPages.StandardController controller;

    //Constructor

    public empdepExtensionNew (ApexPages.StandardController controller)
    {
        this.controller= controller;
        if(controller.getrecord() == null)
        system.debug(controller.getrecord().id);

        //UserID = UserInfo.getname(); 

        //emping Custom Setting object for Recordtypes in emp object

        Record_Type_Name__c Accrt = Record_Type_Name__c.getValues('AccRecordTypeID');
        Record_Type_Name__c Conrt = Record_Type_Name__c.getValues('ConRecordTypeID');
        Record_Type_Name__c Leart = Record_Type_Name__c.getValues('LeaRecordTypeID');
        Record_Type_Name__c Opprt = Record_Type_Name__c.getValues('OppRecordTypeID');

        //Condition to check the record type for emp object 

        if(ApexPages.currentPage().getParameters().get('RecordType') == Accrt.Record_Type__c){
            AccountRT = TRUE;
        }
        if(ApexPages.currentPage().getParameters().get('RecordType') == Conrt.Record_Type__c){
            ContactRT = TRUE;
        }
        if(ApexPages.currentPage().getParameters().get('RecordType') == Leart.Record_Type__c){
            LeadRT = TRUE;
        }
        if(ApexPages.currentPage().getParameters().get('RecordType') == Opprt.Record_Type__c){
            OpportunityRT = TRUE;
        }

      { 
            //String value = ApexPages.currentPage().getParameters().get('Id');

            //total =[Select id,name,empId__c,Contact_Id__c,emp_Date__c,dep__c.Contact_Id__r.Name from dep__c ];
            shoppingCart = [Select id,name,empId__c,Contact_Id__c,emp_Date__c,dep__c.Contact_Id__r.Name from dep__c where id =: tonSelect]; 

       }
       updateAvailableList();
     }

    public void updateAvailableList() 
    {

        UserID = UserInfo.getUserId(); 
        String qString =  'select id, Name, Title, Contact.MailingCity,Contact.MailingState,Contact.Account.Name from Contact  where User_Id__c not in (select ID from User where id =: UserID )' ;
        system.debug(qString);

        if(searchString!=null)

        {          
            qString+= ' and ( Contact.Name like \'%' + searchString + '%\' or Contact.RACFID__c like \'%' + searchString + '%\' or Contact.Officer_Code__c like \'%' + searchString + '%\') ';                       
        }

       Set<Id> selectedEntries = new Set<Id>();
       if(tonSelect!=null)
        for(dep__c d : shoppingCart){
            selectedEntries.add(d.Contact_Id__c);
        }

        if(selectedEntries.size()>0){
            String tempFilter = ' and id not in (';
            for(id i : selectedEntries){
                tempFilter+= '\'' + (String)i + '\',';
            }
            String extraFilter = tempFilter.substring(0,tempFilter.length()-1);
            extraFilter+= ')';

            qString+= extraFilter;
        } 

        qString+= ' order by Name';
        qString+= ' limit 12';
        system.debug('qString:' +qString );               
        Availabledeps = database.query(qString);
        system.debug(Availabledeps);

    } 

    public void addToShoppingCart()

    // This function runs when a user hits "select" button next to a dep

    { 
      for(Contact part : Availabledeps)
       {
        if((String)part.id==tonSelect)
            {

                shoppingCart.add(new dep__c (Contact_Id__c =part.id));
                system.debug(shoppingCart);
                system.debug(shoppingCart.size());
                break;

            }          

        }
         updateAvailableList();

    }  

      public PageReference removeFromShoppingCart(){

        // This function runs when a user hits "remove" on "Selected dep" section

        Integer count = 0;

        for(dep__c del : shoppingCart){
            if((String)del.Contact_Id__c==toUnselect){

                if(del.Id!=null)
                    forDeletion.add(del);

                shoppingCart.remove(count);
                break;
            }
            count++;
        }

        updateAvailableList();

        return null;
    }

     // This function runs when user hits save button

     public PageReference onSave(){

        try{

            PageReference pageRef = controller.save();
            system.debug(controller.getrecord().id);

                if(shoppingCart.size()>0) 

                  for (dep__c partmember : shoppingCart ){
                     partmember.empId__c=controller.getrecord().id;
                     System.debug(partmember.empId__c);
                  }

                  System.debug('size' +shoppingCart.size());
                  insert(shoppingCart);
                }


            catch(Exception e){
            ApexPages.addMessages(e);
            return null;
        }  
           System.debug('completed');

        // After save return the user to the emp
       return new PageReference('/' + controller.getrecord().id);  
    }     
}
Test class:
@istest(seealldata=true)
Public class Test_empdepExtensionNew
{
Public static testmethod void empdepExtensionNew_test()
{
    Record_Type_Name__c opprt =[select  ID,name,Record_Type__c from Record_Type_Name__c where name ='OppRecordTypeID']; 
    PageReference nextpage = new PageReference('/apex/empCustomNew?id='+opprt.Id);
    nextpage.setredirect(true);
    emp__c  c = new emp__c(Subject__c = 'TestdepExtension',emp_Type__c = 'BD Monthly Update',emp_Date__c = system.today(),
    Status__c = 'DONE',OpportunityId__c='006q0000004QWR7',RecordtypeId=opprt.Record_Type__c);
    insert c;
    empdepExtensionNew e = new  empdepExtensionNew(new ApexPages.StandardController(c));
    contact con = new contact(LastName='test',Contact_Type__c='Business contact',AccountId='001q000000BDufL');
    insert con;
        e.updateAvailableList();
        e.addToShoppingCart();
        e.removeFromShoppingCart();
        e.onSave(); 
        dep__c p1 = new dep__c(empId__c=c.id,Contact_Id__c='003q000000CrgjD');
        dep__c p2 = new dep__c(empId__c=c.id,Contact_Id__c='003q000000CvPct');
        List<dep__c> part = new List<dep__c>();
        part.add(p1);
        part.add(p2);
        insert part; 
        //System.assertEquals(3, [select count() from dep__c where empId__c=:c.id]);
    }    
}

At present code coverage is 66%.Kindly help me out to increae my code coverage. thanks
Hi All,

Actually I have 10 reports. need to put it in a picklist. When I select a report for picklist it must be go to partcular reprtpage. can any one pls help me.



Thanks,
anitha.
Hi developers,
Need help i am stuck with how to get total expenses with aggregateresults as of now i done with the aggregateresults value but not able to store in custom field  i.e total_expenses__c

mycode is:
trigger total_expenses on DailyExpense__c (before insert,after insert)
{
Integer totalexpense;

DailyExpense__c de  = new DailyExpense__c();
list<AggregateResult> ar = new list<AggregateResult>();


if(trigger.Isbefore)
{
   for(DailyExpense__c de1 :trigger.new)
   {
    de1.Total_Monthly_income__c =25000;
   }
}
  ar = [select sum(Amount__c)amt from DailyExpense__C Group by CALENDAR_MONTH(Dates__c)];

for( AggregateResult obj:ar)
{

   totalexpense = Integer.valueOf(obj.get('amt'));
   de.Total_expenses__c = totalexpense;
 
}
  // update de;
}

Regrads,
ashish

Hi, I have one feedback__c object and  having status picklist field 
status values are  open,draft,pending reply and pending submiter

we have extra fileds created to capture the time difference opentat__c,replytat__c etc

my requirement is i want to do calculate time difference  and display in hours when the status is changed to open to draft --- stored in the opentat__c filed

pendingreply to pending submitter---replytat__c
pending submiter to open ---opentat__c


please anybody  help me out to resolve this .



Regards,
Isha

 

hi all,

I have a functionality wherein i need to use aepx:actionfunction and apex:param for an apex:outputlink
The problem:


<apex:column >
         <apex:outputLink value="/{!item.id}" target="_blank" onclick="callAcc();">
         {!item.name}
         <apex:param name="passid" value="{!item.id}"/>
         </apex:outputLink>
        </apex:column>
***********************************

 Id accid=ApexPages.currentPage().getParameters().get('passid');
        System.debug('**** new accountid is'+accid);


When i try to get the param passed in controller it fetches null.How do i fix it?

Thanks,
SFDC Coder
Hello,

I am in the process implementing my first APEX chart into my org and have run into a wall that I can't seem to get through.

I am receiving the following error when attempting to save the code:

Error: Compile Error: Variable does not exist: cas.Account.Id at line 18 column 73

Any help at all would be greatly appreciated.

public class ChartController {
    public Case cas { get; set; }
    // Return a list of data points for a chart
    public List<Data> getData() {
        return ChartController.getChartData();
    }
    public ChartController(ApexPages.StandardController sc) {
        this.cas = (Case)sc.getRecord();
    }
    
    public static List<Data> getRemoteData() {
        return ChartController.getChartData();
    }

    public static List<Data> getChartData() {
        List<Data> data = new List<Data>();

        Integer jan =[SELECT count() FROM Case WHERE Case.Account.Id = :cas.Account.Id AND status='Resolved' AND CALENDAR_MONTH(ClosedDate)=1];
        data.add(new Data('Jan', jan));
        Integer feb =[SELECT count() FROM Case WHERE status='Resolved' AND CALENDAR_MONTH(ClosedDate)=2];
        data.add(new Data('Feb', feb));
        Integer mar =[SELECT count() FROM Case WHERE status='Resolved' AND CALENDAR_MONTH(ClosedDate)=3];
        data.add(new Data('Mar', mar));
        Integer apr =[SELECT count() FROM Case WHERE status='Resolved' AND CALENDAR_MONTH(ClosedDate)=4];
        data.add(new Data('Apr', apr));
        Integer may =[SELECT count() FROM Case WHERE status='Resolved' AND CALENDAR_MONTH(ClosedDate)=5];
        data.add(new Data('May', may));
        Integer jun =[SELECT count() FROM Case WHERE status='Resolved' AND CALENDAR_MONTH(ClosedDate)=6];
        data.add(new Data('Jun', jun));
        Integer jul =[SELECT count() FROM Case WHERE status='Resolved' AND CALENDAR_MONTH(ClosedDate)=7];
        data.add(new Data('Jul', jul));
        Integer aug =[SELECT count() FROM Case WHERE status='Resolved' AND CALENDAR_MONTH(ClosedDate)=8];
        data.add(new Data('Aug', aug));
        Integer sep =[SELECT count() FROM Case WHERE status='Resolved' AND CALENDAR_MONTH(ClosedDate)=9];
        data.add(new Data('Sep', sep));
        Integer oct =[SELECT count() FROM Case WHERE status='Resolved' AND CALENDAR_MONTH(ClosedDate)=10];
        data.add(new Data('Oct', oct));
        Integer nov =[SELECT count() FROM Case WHERE status='Resolved' AND CALENDAR_MONTH(ClosedDate)=11];
        data.add(new Data('Nov', nov));
        Integer dec =[SELECT count() FROM Case WHERE status='Resolved' AND CALENDAR_MONTH(ClosedDate)=12];
        data.add(new Data('Dec', dec));
        return data;
    }
    
    // Wrapper class
    public class Data {
        public String name { get; set; }
        public Integer data1 { get; set; }

        public Data(String name, Integer data1) {
            this.name = name;
            this.data1 = data1;

        }
    }
}

Hi All,

Since rollup summary(count) is available only for master detail how do i get this count of child objects for a lookup relationship.

Trigger is a solution but how would that update existing records?

Is it possible to update existing records with trigger.Please help with sample code if this is possible

Please advise.
I need to get the count for a report
I have a visualforce form that i use for a custom object. The help text works with all fields except these:

<apex:pageBlockSection title="Precall Planning Questions" columns="1">
            <p><apex:inputField value="{!Precall_Plan_2__c.Question1__c}" label="What is my long range sales target for this account?"/></p>
            <p><apex:inputField value="{!Precall_Plan_2__c.Question2__c}" label="What is my specific objective for this call?"/></p>
            <p><apex:inputField value="{!Precall_Plan_2__c.Question3__c}" label="What do I plan to show? (Product, demo, sample, chart, etc.)"/></p>
            <p><apex:inputField value="{!Precall_Plan_2__c.Question4__c}" label="Who or What is your competition and what are their disadvantages?  What is their primary advantage?"/></p>
            <p><apex:inputField value="{!Precall_Plan_2__c.Question5__c}" label="What benefit or solution can you provide to this customer?"/></p>
            <p><apex:inputField value="{!Precall_Plan_2__c.Question6__c}" label="What is the monetized value of your solution?"/></p>
            <p><apex:inputField value="{!Precall_Plan_2__c.Question7__c}" label="What is your 'TARGETED BENEFIT STATEMENT'?"/></p>
            <p><apex:inputField value="{!Precall_Plan_2__c.Question8__c}" label="What needs analysis questions do you intend to ask?"/></p>
            <p><apex:inputField value="{!Precall_Plan_2__c.Question9__c}" label="What is your sellers leverage?"/></p>
            <p><apex:inputField value="{!Precall_Plan_2__c.Question10__c}" label="What objections do you anticipate?"/></p>
            <p><apex:inputField value="{!Precall_Plan_2__c.Question11__c}" label="How do you plan to overcome these objections?"/></p>
            <p><apex:inputField value="{!Precall_Plan_2__c.Question12__c}" label="What closing techniques/statements will you use?"/></p>
            <p><apex:inputField value="{!Precall_Plan_2__c.Question13__c}" label="What potential value can you bring to this customer?"/></p>
            <p><apex:inputField value="{!Precall_Plan_2__c.Question14__c}" label="Who else is on this call and what is their role?"/></p>
            <p><apex:inputField value="{!Precall_Plan_2__c.Question15__c}" label="In 30 words or less, define the account strategy; include necessary resources to support."/></p>
        </apex:pageBlockSection>

I'm not sure why it doesnt work for these fields only. Can someone help me? Thanks
I am having 3 objects
1 contact (Standard Object)
2 Banking
3 Customer

Banking is having lookup of contact
Customer is having lookup of Banking

I have this trigger to insert a customer record as a banking record is created

Now i want to insert the values of standard field on contact ( related to Banking via lookup  ) into text fields of Customer record on insert

like Customer.First_name__c = Contact.first name

Please suggest


trigger Banking_PopulatecustomerRecord on Banking__c (after insert){
Set<Id> IdSet = new Set<Id>();

   for(Banking__c mp:trigger.new)
   IdSet.add(mp.Id);
     
   List<Customer __c> BankingstubToCreate = new List<Customer __c>();
   for(Banking__c mp:trigger.new)
   {
    if(IdSet.size()>0 )
   {
     Customer __c s = new Customer __c();
      s.Banking__c =mp.Id ;
      mccystubToCreate.add(s);
   }
   }
   
   if(BankingstubToCreate.size()>0)
   {
    Database.SaveResult[] lsr = Database.insert( BankingtubToCreate, false);
             //insert finalCreateListOfStub  
   }
   
 
}
Dear All,

I have written a apex trigger to create a child object record when there is an update on the parent object.

The parent is account and child is account status note.

I am unable to cover the code on the trigger with the test class written.

I am posting both the trigger and class here. Please help me.

Trigger - 

trigger MissCallStatusNote on Account (after update) {
  if(recursivecheckBankingExsLease.runOnce())
    {
  integer i=1;
  DateTime val = DateTime.now();

  for (Account  acc : trigger.new) {
    Account_Status_Note__c asn = new Account_Status_Note__c ();
   
  
    if(acc.Misscall__c == true){
  
    asn.Account_Name__c = acc.id;
    asn.OwnerId = acc.OwnerId;
    asn.Status_Notes__c = 'Missed Call Email sent';
    asn.Follow_Up_Date__c = val + 1 ;
  
   
   
   
    insert asn;
   
   }
  }
  }
  }


Test Class

@isTest
private class UnitTestsMissCallStatusNote {

    static testMethod void myUnitTest() {
        // TO DO: implement unit test
       
      
       
        LIST<User> u4 = [select id from user where LastName = 'CRM Support Helpdesk'];  
        for(integer i = 0 ; i < u4.size(); i++){
       
        //create test account
        Account a = new Account();
        a.LastName = 'testabcd';
        a.PersonEmail='testyyy@test.com';
        a.Phone='85765';
        a.OwnerId = u4[i].id;
        a.Misscall__c = true;
        a.pb__Status__c = 'Unqualified';
        insert a;
        
       
       
      
        DateTime val = DateTime.now();
   
        Account_Status_Note__c asn = new Account_Status_Note__c ();
        asn.Account_Name__c = a.id;
        asn.OwnerId = a.OwnerId;
        asn.Status_Notes__c = 'Missed Call Email sent';
        asn.Follow_Up_Date__c = val + 1 ;
  
   
   
   
   
       insert asn;
   
      
       }
       
    }
}

Thanks a lot

Finney
Hi All,
          I am trying to access  reports from customer portal but its throwing "Insufficient previlage error" .And I am using Overage high volume customer portal license ,Is there any way to access reports from customer portal with my license.
Hi Force devs

Can we lock the record order from the apex code. not from approval process.

Rgrds
SR
<apex:page standardController="Contact"   >
<apex:form >
<apex:pageBlock title="Contact">
<apex:pageMessages />
<apex:pageBlockSection >
<apex:inputField value="{! contact.accountid}"/>
<apex:inputField value="{! contact.phone}"/>
<apex:inputField value="{! contact.FirstName}"/>
<apex:inputField value="{! contact.LastName}"/>
<apex:inputField value="{! contact.Fax}"/>
<apex:inputField value="{! contact.Email}"/>
<apex:inputField value="{! contact.title}"/>
<apex:inputField value="{! contact.phone}"/>

<apex:inputField value="{! contact.HomePhone}"/>
<apex:inputField value="{! contact.Department}"/>
<apex:inputField value="{! contact.Birthdate}"/>
<apex:inputField value="{! contact.MobilePhone}"/>



<apex:commandButton action="{! save }" value="save"/>

</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>

when i save this  it goes to the standard page

i wnat when i save this it should open like
/apex/MyFormContact?id=00190000010HAtb  and not        https://ap1.salesforce.com/00390000013dAX7
Hi guys,

I'm a newbie in salesforce.
I try to create 2 applications. The first application contains the Staff object, the second application contains the Asset object.
I created one more object named Asset History (ID is auto number).
I created a trigger on Asset object to add Asset History  data whenever Asset information is changed. However, no Asset History record is created. 
When I try to add Asset History record by clicking New button, the data is created and ID of new data is increased.

I guess that Asset History record was created an then deleted, but I don't understand the root cause of this issue.
Can anyone give me some hints?
Thanks.