• neeru
  • NEWBIE
  • 25 Points
  • Member since 2012

  • Chatter
    Feed
  • 1
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 18
    Questions
  • 27
    Replies

Hi All

 

my dobut is

 

my trigger code coverage is 80% and my organization code coverage is 60 %..so can it possible to move this trigger in to production environmnet??

 

how  to calculates the codecoverages it takes as individual apexclass or overall organization code coverages

 

thanks in advance

thanks

neeru

  • November 29, 2012
  • Like
  • 0

Hi All,

 

     

i'm creating a report on position object in my developer free edition.By which i need to get the position records which are created yesterday and i scheduled it daily. Here my report in not gets refreshed means i'm getting same records by which i created the report for first time.
 
Clearly
i created test 1, test 2 two position records on  11/25/2012
i created report on 11/26/2012 in time frame i given the condition like position created date yesterday and it lists 2 records and in the Email i got the same.
Again i created 3 more records on 11/26/2012
as per my requirement i need to get 3 records on 11/27/2012 but i'm getting only test 1,test 2.
how to get daily created positions on scheduled report Email

 

Any help would be appreciated

 

Thanks,

neeru.

  • November 29, 2012
  • Like
  • 0

Hi All,

 

     

i'm creating a report on position object in my developer free edition.By which i need to get the position records which are created yesterday and i scheduled it daily. Here my report in not gets refreshed means i'm getting same records by which i created the report for first time.
 
Clearly
i created test 1, test 2 two position records on  11/25/2012
i created report on 11/26/2012 in time frame i given the condition like position created date yesterday and it lists 2 records and in the Email i got the same.
Again i created 3 more records on 11/26/2012
as per my requirement i need to get 3 records on 11/27/2012 but i'm getting only test 1,test 2.
how to get daily created positions on scheduled report Email

 

Any help would be appreciated

 

Thanks,

neeru.

 

 

  • November 28, 2012
  • Like
  • 0

Hi All

 

my need is i want to create a formula field it displays current month name...is it possible to display current month  name using formula field??

 

Thanks,

Jake

  • November 05, 2012
  • Like
  • 0

Hi Everyone

 

trigger Rollup on Submission__c (after insert) {
   List<Employee__c> Emp=new List<Employee__c>();
   integer count=0;
  if(trigger.isinsert){
   for(Submission__c S:trigger.new){
      for(Employee__c e:[select id,Address__c,Count__c,Organization__c from Employee__c where id=:S.Submittedby_del__c])
   
          e.Count__c = e.count__c+1;  
                                       
   }
   Emp.add(e);
}
update Emp;
}

 

Thanks,

Jake

  • November 02, 2012
  • Like
  • 0

Hi Everyone

 Hi have a employee object and submissions object with master detail relationship and i want to calculate no of submissions for each employee for each month how can i acheive this scenario using formula field

 

Thanks,

Jake

  • October 31, 2012
  • Like
  • 0

Hi

 

i have a position object and employee object,when a new position is added my employees has to get the email

 

for that i am using the workflow with email alert action.now for every day i am getting 10-15 new positions and accordingly my employees getting 10-15 emails....is there any way to get a single email with all 10-15 position details..

  • October 17, 2012
  • Like
  • 0

HI All

In Organization how many users can be activated at a point of time??

  • October 16, 2012
  • Like
  • 0

Hi EveryOne

 

              i am send Emails to My campaignmember contacts..thoe contatcs are totally 32..for tht i wrote batch apex and  scheduled this. it saves but   emails are sent to 1st 10 members only..after i am trying to send emails again it  throws an error in apex jobs(mass email limit exceeds)

 

using batch apex is it possible sent 32 emails at a time??

 

my approch

global class campaignmem implements  Database.Batchable<sobject>,Schedulable {

global final string query= 'select id,campaignid,contactid from campaignmember';   

Private final list<id> Eids=new list<id>();
global campaignmem()
{
   List<Contact> cons  = new List<Contact>();
 
  for(campaignmember cam :[select id,campaignid,contactid from campaignmember])
  {
        if(cam.contactid !=null)
    {
     cons=[select id,name,email from contact where id =:cam.contactid];
     for(Contact c:cons)
     {
       if(c.id!=null)
       {
       Eids.add(c.id);        
       }
     }
     
    }
  }   
   System.debug('--- CampaignMembers ' + query);

}
global void execute(SchedulableContext SC) {
    // invoke business logic - this method is strictly to invoke
    // the method from the scheduler...
   campaignmem CM2 = new campaignmem();
   ID batchprocessid = Database.executeBatch(CM2,10);
   
 }  
global Database.QueryLocator start(Database.BatchableContext BC)
{

   return Database.getQueryLocator(this.query);
}

global void execute(Database.BatchableContext BC, List<campaignmember> scope)
{
    Messaging.MassEmailMessage mail = new Messaging.MassEmailMessage();
       mail.setTargetObjectIds(Eids);
       mail.setTemplateId('00XE0000000s29O');
       Messaging.sendEmail(new Messaging.MassEmailMessage[] { mail });
}
global void finish(Database.BatchableContext BC){

     

}
}

  • October 12, 2012
  • Like
  • 0

Hi Everyone

 

      i came across a situation where i need to create pageblocktable  many times so i want to create a component which will create pageblock table dynamically i have this idea how to resolve it...

 

My Approch is

 

Here i am retrieving the object id from the url in visualforce page through object id i have the code to retrieve the object name and fields of that object dynamically...and also i retrieving the records through dynamic soql.....But i stuck How to Display These Records in PageBlockTable......

 

help me out in this scenario.

 

visualforce page:

<apex:page >
          <c:Dynamicpbt objId="{!$Currentpage.parameters.id}"/> 
</apex:page>

                 // here we get the object from url dynamically through objid....

 

Component:

 

<apex:component controller="dynamicpbt">
  <apex:attribute name="objId" type="String" description="The id of the object to which PBT for" required="true" assignTo="{!sobjId}"/>
   <apex:form id="PBTForm">
    <apex:pageBlock title="DYNAMICPBT">
    </apex:pageBlock>
   </apex:form>
</apex:component>
 
Controller Logic:
 
//this code retrives the fields name ,Object names  dynamically
 
List<Schema.SObjectType> gd = Schema.getGlobalDescribe().Values();
Map<String,String> objectMap = new Map<String,String>();
for(Schema.SObjectType f : gd)
{
     objectMap.put(f.getDescribe().getKeyPrefix(), f.getDescribe().getName());
}
 
String sampleId ='00390000003LIVw';(//here we can pass objctid through objid)
String prefix =  sampleId.substring(0,3);
String objectName = objectMap.get(prefix);
System.debug('** SObject Name ** '+objectName);
 
Map<String, Schema.SObjectField> desResult = Schema.getGlobalDescribe().get(objectName).getDescribe().Fields.getMap();
List<String> fieldList = new List<String>();
fieldList.addAll(desResult.keySet());
for(integer i =0;i<fieldList.size();i++)
{
    System.debug('** Field Name ** '+fieldList[i]);
 
}
 
 
along these we can write a dynamic soql query to retrieve the records ...i'm stuck here to bind these records to component to disply in pageblock table
 
String soqlquery = 'Select '+fieldlist+' from '+objectname+' ';
        // Run the query
        queryresult = Database.query(soqlquery);
        return queryresult;
 
 
Thanks,
neeru
  • October 02, 2012
  • Like
  • 0

Hi All,

i am new to testclasses i dont know how to write test classes exactly...but i am tried but i am geting 80% code coverage only..but i need 100% can any one help this please??

 

 

 

public with sharing class accounts_based_on_months
{
 
   public String selected_month { get; set; }
   public list<account>acc;
   public list<account>accounts;
   

   public PageReference getrecords()
   {
        string dat='';
         accounts=new list<account>();
         //acc.clear();
        acc=new list<account>();
        acc=[select id,Createddate,name,phone from account];
        for(account a:acc)
        {
            dat=a.Createddate.format('MMMM');
            
            if(selected_month ==dat)
            {
              accounts.add(a);
             }
            
        }
       return null;
   }


   public list<account> getAccounts()
   {
     
           return accounts;
   }
}

 

thanks,

bhagi

  • October 01, 2012
  • Like
  • 0

Hi everyone,

i am writing the controller for save,cancel,save &New buttons ..when i entering the values after i click the save button it throws error.and after i click the save&new button i am not getting any error but the values are not saved..

 

can anyone help this scenario please??

This is my Controller..

 

public with sharing class newtest {
 public Organizers__c org { get; private set; }
 public Organizers__c org1;
private ApexPages.StandardController sController;  
    private String queryString;  
              public newtest (ApexPages.StandardController controller) {  
        sController = controller;  
        org = (Organizers__c)controller.getRecord();  
     List<string> pageUrl = ApexPages.currentPage().getUrl().split('\\?');  
        queryString = pageUrl[1];  
    }  
        public newtest(){
        Id id = ApexPages.currentPage().getParameters().get('id');
        org1 = (id == null) ? new Organizers__c() :
            [SELECT FirstName__c, LastName__c, Organizer_Email__c,ProductType__c,Status__c FROM Organizers__c WHERE Id = :id];
    }

    public PageReference save() {
                    
        //  After Save, navigate to the default view page:
    
        return (new ApexPages.StandardController(org)).view();
    }
    public PageReference cancel() {
        
            return null;
        }
 public PageReference saveAndNew() {  
          
                  try {  
            // Save the current sObject  
            sController.save();  
 
            // Get the Meta Data for Foo__c  
            Schema.DescribeSObjectResult describeResult = sController.getRecord().getSObjectType().getDescribe();  
            // Create PageReference for creating a new sObject and add any inbound query string parameters.  
            PageReference pr = new PageReference('/' + describeResult.getKeyPrefix() + '/e?' + queryString);  
            // Don't redirect with the viewstate of the current record.  
            pr.setRedirect(true);  
            return pr;  
        } catch(Exception e) {  
            // Don't redirect if something goes wrong. May be a validation or trigger issue on save.  
       ApexPages.addMessages(e);  
            return null;  
    }
          
}
}

  • September 21, 2012
  • Like
  • 0

Hi All,

 

                   i have a search button when i gor for search by name it gives name ..dat's working fine but my need is when i click dat it goes to the detail page of that name??

 

can anyone help this scenario pls?

 

thanks

bhagi

  • September 12, 2012
  • Like
  • 0

Hi All,

  

 

          How To implement search button+browse button in visualforce customobject page

can anyone help this scenario please

 

Thanks,

neeru.

  • September 11, 2012
  • Like
  • 0

Hi Everyone,

 

 

i need to develope an apex component in such a way that it should create a pageblocktable by taking object name ,fields name dynamically.For this i written a controller but it is not make my need.my approach is i'm trying to retrieve field names from wrapper class,object name dynamically from database.query and i will bind this wrapper to my page block table.
 Can anyone help this scenario with some sample code please guys??
 
Thanks,
bhagi
  • September 10, 2012
  • Like
  • 1

Hi Everyone,

 

my need is when i write a componet  and  i call that componet in my visualforce page  it shows objectname(Account) and fieldname(phone) with in the pageblocktable and i use this componet in another object(contact) it will also display like this only...

 

how i pass the values dynamically in components??

 

 

 

 

I am are getting Error in Controller like
 unexpected token: ')' at line 11 column 33

 

 

public class testcon {
public String acon{get; set;}

    // ApexPages.StandardSetController must be instantiated
    
    // for standard list controllers
    
    public testcon(){
    list<Schema.SObjectType> obj = Schema.getGlobalDescribe().Values();
    ApexPages.StandardSetController setCon = new ApexPages.StandardSetController(Database.getQueryLocator(
         [SELECT obj.getDescribe().getName() from sObject]));
    }
    
    public ApexPages.StandardSetController setCon {
        get{
            
            
            return setCon;
        }
        set;
    }

    // Initialize setCon and return a list of records
    
    public List<sObject> getacc() {
        return (List<sObject>) setCon.getRecords();
    }
}

Thanks&Regards

neeru

  • September 07, 2012
  • Like
  • 0

Hi Everyone

  

My need  is when i write the component  with the pageblock headers of objname(account) and filedname(billingcity)  ..and i call this component in visualforce its automatically  shows the no of accounts and  thier adresses  how i pass those values dynamically

can anyone explain with sample code please??

 

Thanks&Regards

neeru

  • September 05, 2012
  • Like
  • 0

Hi Everyone

 

i written a trigger to restrict a chatter free user to maka a post,comment,file upload,link upload it is working fine.Now i developed a VF page with some checkboxes like postrestrictions,comment restrivtions,

fileuploadrestrictions etc with an extension controller.
 
Now my requirement is when a particular check box is checked for example post restrictions is checked then only it has to restrict.
how can i achieve this.
 
My approach is
 
VF page:
 
<apex:page StandardController="FeedItem" Extensions="Utility1">
 <apex:form >
  <apex:pageBlock >
   <apex:inputCheckbox id="Comm" value="{! CommentRestrictions}" label="CommentRestrictions">Comment Restrictions</apex:inputcheckbox> 
<apex:pageblockButtons >
     <apex:commandButton action="{!save}" value="Save"/>
    </apex:pageblockButtons>
  </apex:pageBlock>
 </apex:form> 
</apex:page> 
 
Controller:
 
public  class Utility1 {
  public Boolean PostRestrictions=true;
public Boolean Post;
public Apexpages.Standardcontroller cont;
    public Utility1(Apexpages.Standardcontroller controller) {
        controller=cont;
        System.debug('this is constructor');
    }
    
    public void setPostRestrictions(Boolean b) {
    this.PostRestrictions = b;         // I THINK DIS SETS THE CHECK BOX CHECKED VALUE
    }
    public Boolean getPostRestrictions() {
     post=this.PostRestrictions;   // i think this will stores the checked value elther true r false
    return this.PostRestrictions;     // IT RETURNS CHECKED VALUE
    }
)
 
Trigger:
 
trigger CFURestrictions on FeedItem (after insert) {
 
-----
-----
-----
ApexPages.StandardController sc = new ApexPages.standardController(new FeedItem());
    Utility1 u1=new Utility1(sc); // calling controller in trigger
if((exp=true)&& (u1.post==true))
{
if(!validuser)
{
fitem.adderror('You do not have permission to share a post.');
}
}
}
 
 
  • August 29, 2012
  • Like
  • 0

Hi Everyone,

 

 

i need to develope an apex component in such a way that it should create a pageblocktable by taking object name ,fields name dynamically.For this i written a controller but it is not make my need.my approach is i'm trying to retrieve field names from wrapper class,object name dynamically from database.query and i will bind this wrapper to my page block table.
 Can anyone help this scenario with some sample code please guys??
 
Thanks,
bhagi
  • September 10, 2012
  • Like
  • 1

Hi All

 

my need is i want to create a formula field it displays current month name...is it possible to display current month  name using formula field??

 

Thanks,

Jake

  • November 05, 2012
  • Like
  • 0

Hi Everyone

 

trigger Rollup on Submission__c (after insert) {
   List<Employee__c> Emp=new List<Employee__c>();
   integer count=0;
  if(trigger.isinsert){
   for(Submission__c S:trigger.new){
      for(Employee__c e:[select id,Address__c,Count__c,Organization__c from Employee__c where id=:S.Submittedby_del__c])
   
          e.Count__c = e.count__c+1;  
                                       
   }
   Emp.add(e);
}
update Emp;
}

 

Thanks,

Jake

  • November 02, 2012
  • Like
  • 0

Hi Everyone

 Hi have a employee object and submissions object with master detail relationship and i want to calculate no of submissions for each employee for each month how can i acheive this scenario using formula field

 

Thanks,

Jake

  • October 31, 2012
  • Like
  • 0

HI EveryOne

 

I have a custom object  Position__c everyday new positions will add to the object .I have 6 users. i want to send the position details that are created recently (today) to all the users in a single email.how can i achieve this.any help appreciated.

 

How to add my records data into email part in dynamic apex

 

can anyone help this scenario

 

Thanks

 

Jake

 

  • October 30, 2012
  • Like
  • 0

Hi,
I have question about workflow.I create a custom object ="Product" on opportunity object .I create three (3) fields on custom object = Product and the filed description is below:
Field # 1:Application Received By(which is lookup(user)field)
field #2 : Closing Stage (pick list field; option is recieved)
field # 3: Closing Stage Owner ((which is lookup(user)field)

I have the requirment that :
If Application Received By not null
then
condition # 1 : set 
Closing Stage = recieved
and 

condition # 2 : set Closing Stage Owner = Application Received By

Example: If  
Application Received By = steve then according to workflow it should update the Closing Stage = recieved and Closing Stage Owner =steve

I create workflow for this and i am able to satisfy the condition # 1  but I am not to create work field update for condition # 2. 
I am new to salesforce and could anyone of you help.

thanks

Hi Everyone

 

      i came across a situation where i need to create pageblocktable  many times so i want to create a component which will create pageblock table dynamically i have this idea how to resolve it...

 

My Approch is

 

Here i am retrieving the object id from the url in visualforce page through object id i have the code to retrieve the object name and fields of that object dynamically...and also i retrieving the records through dynamic soql.....But i stuck How to Display These Records in PageBlockTable......

 

help me out in this scenario.

 

visualforce page:

<apex:page >
          <c:Dynamicpbt objId="{!$Currentpage.parameters.id}"/> 
</apex:page>

                 // here we get the object from url dynamically through objid....

 

Component:

 

<apex:component controller="dynamicpbt">
  <apex:attribute name="objId" type="String" description="The id of the object to which PBT for" required="true" assignTo="{!sobjId}"/>
   <apex:form id="PBTForm">
    <apex:pageBlock title="DYNAMICPBT">
    </apex:pageBlock>
   </apex:form>
</apex:component>
 
Controller Logic:
 
//this code retrives the fields name ,Object names  dynamically
 
List<Schema.SObjectType> gd = Schema.getGlobalDescribe().Values();
Map<String,String> objectMap = new Map<String,String>();
for(Schema.SObjectType f : gd)
{
     objectMap.put(f.getDescribe().getKeyPrefix(), f.getDescribe().getName());
}
 
String sampleId ='00390000003LIVw';(//here we can pass objctid through objid)
String prefix =  sampleId.substring(0,3);
String objectName = objectMap.get(prefix);
System.debug('** SObject Name ** '+objectName);
 
Map<String, Schema.SObjectField> desResult = Schema.getGlobalDescribe().get(objectName).getDescribe().Fields.getMap();
List<String> fieldList = new List<String>();
fieldList.addAll(desResult.keySet());
for(integer i =0;i<fieldList.size();i++)
{
    System.debug('** Field Name ** '+fieldList[i]);
 
}
 
 
along these we can write a dynamic soql query to retrieve the records ...i'm stuck here to bind these records to component to disply in pageblock table
 
String soqlquery = 'Select '+fieldlist+' from '+objectname+' ';
        // Run the query
        queryresult = Database.query(soqlquery);
        return queryresult;
 
 
Thanks,
neeru
  • October 02, 2012
  • Like
  • 0

Hi All,

i am new to testclasses i dont know how to write test classes exactly...but i am tried but i am geting 80% code coverage only..but i need 100% can any one help this please??

 

 

 

public with sharing class accounts_based_on_months
{
 
   public String selected_month { get; set; }
   public list<account>acc;
   public list<account>accounts;
   

   public PageReference getrecords()
   {
        string dat='';
         accounts=new list<account>();
         //acc.clear();
        acc=new list<account>();
        acc=[select id,Createddate,name,phone from account];
        for(account a:acc)
        {
            dat=a.Createddate.format('MMMM');
            
            if(selected_month ==dat)
            {
              accounts.add(a);
             }
            
        }
       return null;
   }


   public list<account> getAccounts()
   {
     
           return accounts;
   }
}

 

thanks,

bhagi

  • October 01, 2012
  • Like
  • 0

Hi everyone,

i am writing the controller for save,cancel,save &New buttons ..when i entering the values after i click the save button it throws error.and after i click the save&new button i am not getting any error but the values are not saved..

 

can anyone help this scenario please??

This is my Controller..

 

public with sharing class newtest {
 public Organizers__c org { get; private set; }
 public Organizers__c org1;
private ApexPages.StandardController sController;  
    private String queryString;  
              public newtest (ApexPages.StandardController controller) {  
        sController = controller;  
        org = (Organizers__c)controller.getRecord();  
     List<string> pageUrl = ApexPages.currentPage().getUrl().split('\\?');  
        queryString = pageUrl[1];  
    }  
        public newtest(){
        Id id = ApexPages.currentPage().getParameters().get('id');
        org1 = (id == null) ? new Organizers__c() :
            [SELECT FirstName__c, LastName__c, Organizer_Email__c,ProductType__c,Status__c FROM Organizers__c WHERE Id = :id];
    }

    public PageReference save() {
                    
        //  After Save, navigate to the default view page:
    
        return (new ApexPages.StandardController(org)).view();
    }
    public PageReference cancel() {
        
            return null;
        }
 public PageReference saveAndNew() {  
          
                  try {  
            // Save the current sObject  
            sController.save();  
 
            // Get the Meta Data for Foo__c  
            Schema.DescribeSObjectResult describeResult = sController.getRecord().getSObjectType().getDescribe();  
            // Create PageReference for creating a new sObject and add any inbound query string parameters.  
            PageReference pr = new PageReference('/' + describeResult.getKeyPrefix() + '/e?' + queryString);  
            // Don't redirect with the viewstate of the current record.  
            pr.setRedirect(true);  
            return pr;  
        } catch(Exception e) {  
            // Don't redirect if something goes wrong. May be a validation or trigger issue on save.  
       ApexPages.addMessages(e);  
            return null;  
    }
          
}
}

  • September 21, 2012
  • Like
  • 0