• Jancy Mary
  • NEWBIE
  • 114 Points
  • Member since 2015
  • Software Engineer
  • Revature Consultancy Services Limited

  • Chatter
    Feed
  • 2
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 9
    Questions
  • 28
    Replies
Why do we need a custom extension when we are using a custom controller .
Please help me on this.

Thanks.
Hi All,

How to refresh an excting sand box in production? i Need the process step by step ..Kindly  don't share the lync .

Any one can help me .

Regards,
viswa
Hi All,

I saw some videos related to sales process where they mentioned we can setup milestone on Opportunity by creating custom fields, I need some more details on this.

Thanks in advance. 
Hello All,

Need some information, suppose I have 2 fields called Age & DOB in a controller, these are not a getter setter fields, I have a button on the VF page, when I click the button these fields should get loaded to the page, how to achieve this.

Thanks in advance.
Jancy
Hey guys,

Need some help, I have a apex class with soql query on Reports of type (Task & Events) in the UAT, the reports for now returns 0 records as I have some filters as Date = Last 30 Days, I'm not able to cover the query line in test class as the report result 0 count, if the same report result atleat 1 record the query line are covered in the test class. Rest all the code lines are covered except these query lines.

Also a question, while moving the code from sandbox to production through change set will the test class validate against production org data or sandbox.

Thanks in advance,
Jancy Mary
Hi,

I need help on creating a cumulative dashboard. My requirement was to create a Dashboard that shows the Record Count(y-axis) vs Account Name(x-axis), however I would like to set the Record Count as cumulative, and plot an additional line which is Target. Target is a Summary Formula on reports, this is a workaround to get Target line. 

If suppose I have 3 Accounts: Account1, Account2, Account3 and I have the Placements created for these Accounts as below:
Account1- 1 Placement Record
Account2- 1 Placement Record
Account3- 2 Placement Records

My dashboard shows the Data like this when I dont check Cumulative:When Cumulative is not checked

When I check the Cumulative, Record Count and the Target line both are Cumulated which is not the way I wanted.
User-added image

I want it to be the way below:
If this can be met through any standard functionality or through Visual Force page.

I had a discussion with Salesforce Technical support team and even they confirmed that we can not achieve this through standard functionality.

Any help or suggestion on this is much Appreciated.

Thanks,
Jancy Mary
 
Hi All,

Placement object has a lookup relationship to Account and Contact, I want to show the number of placements on each Account, however if multiple Placements are associated to the same Contact in different interval of time period which intern is associated to particular Account, then all those Placements which are associated to that Contact should be considered as 1 count under that particular Account. 

I tried writing the below apex class, but stuck in the middle. With the below code I am able to fetch the ContactID and the AccountID when a placement record is inserted, however I am unable to compare the Contact's Account with the fetched AccountID. Or if there is any alternative way to achieve this please suggest.


public class totalOfPlacementsTriggerHelper{

 public static void handleAfterInsert(List<rnm__Placement__c> placementlist)
  {
    List<Account> acc= new List<Account>();
    Set<Id> accActiveId= new Set<Id>();
    Set<Id> conId= new Set<Id>();
  
      for(rnm__Placement__c p: placementlist)
      {
        if(p.Active__c==True)
        {
        if(p.rnm__Employer__c!=null && p.rnm__Contact__c!=null)   //rnm__Employer__c is a lookup to Account
        {
        accActiveId.add(p.rnm__Employer__c);
        conId.add(p.rnm__Contact__c);
        system.debug('TESTING'+accActiveId+' '+conId);
        }
      } 
      }
}


Thanks in Advance,
Jancy Mary
Hi Guys,

Can anyone help me with some presentation on SOAP vs REST, or I would say some straight bullet points would be great. I went through many online documentation and got more information. But I did not find strong lines that justify to use REST instead of SOAP.

1. What exactly mean by Architectural style in terms of REST. 
2. Why REST(not a standard method) is chosen the most now a days than SOAP(Standard).
3. How secured REST when compared to SOAP. I understand that SOAP has strongly coupled security, but why REST is chosen on top of this.

Thanks in advance for any help on this.
Hi,

I am newbie to web services, I wrote a simple Apex class and made it as Apex SOAP web service, I tried to import the WSDL for my web service after importing the enterprise WSDL for my salesforce org on SOAP UI. Unfortunately I get the error as below,

Source: file:/C:/Users/Mvision/Desktop/New%20folder/SOAPTEST1.xml
Error: type 'RecordTypesSupported@http://soap.sforce.com/schemas/class/SOAPTEST1' not found.
Source: file:/C:/Users/Mvision/Desktop/New%20folder/SOAPTEST1.xml
Error: type 'RelationshipReferenceTo@http://soap.sforce.com/schemas/class/SOAPTEST1' not found.
Source: file:/C:/Users/Mvision/Desktop/New%20folder/SOAPTEST1.xml
Error: type 'SearchLayoutButtonsDisplayed@http://soap.sforce.com/schemas/class/SOAPTEST1' not found.
Source: file:/C:/Users/Mvision/Desktop/New%20folder/SOAPTEST1.xml
Error: type 'SearchLayoutFieldsDisplayed@http://soap.sforce.com/schemas/class/SOAPTEST1' not found.


Here is my code:

global with sharing class SOAPTEST1
{
webservice static List<Contact> OneCon(List<Contact> Con)
{
List<Contact> cc=[select Id, Name from Contact where SystemModStamp >=LAST_N_DAYS:30];
return cc;
}
}

I tried the same code last week and was able to get the expected result on SOAP UI, I remember that I did not make any changes to the code, not sure what went wrong since then I am unable to import the wsdl for this. I followed the below blog which gave me all clear explainations, but I am stuck with my code.

http://blog.deadlypenguin.com/blog/2012/02/03/salesforce-and-soapui/

Any help is much appreciated, thanks in advance:-)
Hi guys,
 
I worked on a requirement where I defined a web service on my org with the help of Apex REST, now I need it to be defined Asynchronous. I wrote the below apex class. I tested it using postman(google) client. It returns perfect result. But not sure about the Asynchronous which I defined. Can anyone guide me here if I am wrong.
 
Thank you in advance
 
@RestResource(urlMapping='/MyView/v1')

global with sharing class MyUpdatedContacts
 {

 @HttpGet

global static List<Contact> recentUpdatedCon(){
RestRequest req = RestContext.request;
RestResponse res = RestContext.response;
List<Contact> Contact;
String contactId= req.requestURI.substring(req.requestURI.lastIndexOf('/')+1);
Contact=[select Id, Name from Contact where SystemModStamp >=LAST_N_DAYS:30];
return Contact;
 }

 @future (callout=true)
     
public static void firstTest(){
   recentUpdatedCon();
    }
}
 
Hi Developers,

Can anyone help me on this issue, I have a Child object that has a Lookup to Parent. I wrote the below apex class and the trigger on child, such that the count of Child records should be shown on each Parent record. I have a number field on the Parent which should be update as per the Trigger.

It works fine except in one scenario, it does not consider the existing Child records on the Parent, hence it shows incorrect count on the Parent record. It works perfect if I add the new Child records. I heard that Batch Apex can resolve this issue, I am not sure how Batch Apex is related here to resolve the isssue. Can I get some guidance here to proceed further.


Any help on this is much appreciated.
Thank you.

Apex Class:

public class ChildCountHelper{
    
    //List<Parent__c> parentList = [select id, child_count__c, (select id from child__r) from Parent__c where id in :parentIDSet];
    
    public List<ID> conList= new List<ID>();
    
    public static void handleBeforeInsert(List<Child__c> childList){
        Set<ID> parentIDSet = new Set<ID>();
        
        for(Child__c childRec: childList){
     
            parentIDSet.add(childRec.Parent__c);
            
        }
        
        Map<ID, Parent__c> parentMap = new map<ID, parent__c>([select id, child_count__c from Parent__c where id in :parentIDSet]);
        for(Child__c childRec: childList){
            if(parentMap.get(childRec.Parent__c).child_count__c == null){
                parentMap.get(childRec.Parent__c).child_count__c = 0;
            }
            parentMap.get(childRec.Parent__c).child_count__c ++;
        }
        update parentMap.values();
    }
    
    public static void handleBeforeUpdate(List<Child__c> newChildList, List<Child__c> oldChildList){
        Set<ID> parentIDSet = new Set<ID>();
        Map<ID, ID> oldChildMap = new Map<ID, ID>();
        
        for(Child__c childRec: newChildList){
            parentIDSet.add(childRec.Parent__c);
        }
        
        for(Child__c childRec: oldChildList){
            parentIDSet.add(childRec.Parent__c);
            oldChildMap.put(childRec.Id, childRec.Parent__c);
        }
        
        Map<ID, Parent__c> parentMap = new map<ID, parent__c>([select id, child_count__c from Parent__c where id in :parentIDSet]);
        for(Child__c childRec: newChildList)
       {
        /*if(ChildRec.Parent__c!=null){  */
            if(parentMap.get(childRec.Parent__c).child_count__c == null){
                parentMap.get(childRec.Parent__c).child_count__c = 0;
            }
           // }
            if(childRec.Parent__c != oldChildMap.get(childRec.id)){
                if(oldChildMap.get(childRec.id) == null && childRec.Parent__c != null){
                    parentMap.get(childRec.Parent__c).child_count__c ++;
                }else if(oldChildMap.get(childRec.id) != null && childRec.Parent__c == null){
                    parentMap.get(oldChildMap.get(childRec.id)).child_count__c --;
                }else if(oldChildMap.get(childRec.id) != null && childRec.Parent__c != null){
                    parentMap.get(oldChildMap.get(childRec.id)).child_count__c --;
                    parentMap.get(childRec.Parent__c).child_count__c ++;
                }
            }
            
        }
        update parentMap.values();
    }
    
    public static void handleBeforeDelete(List<Child__c> childList){
        Set<ID> parentIDSet = new Set<ID>();
        for(Child__c childRec: childList){
            parentIDSet.add(childRec.Parent__c);
        }
        
        Map<ID, Parent__c> parentMap = new map<ID, parent__c>([select id, child_count__c from Parent__c where id in :parentIDSet]);
        for(Child__c childRec: childList){
            if(parentMap.get(childRec.Parent__c).child_count__c == null){
                parentMap.get(childRec.Parent__c).child_count__c = 0;
            }
            parentMap.get(childRec.Parent__c).child_count__c --;
        }
        update parentMap.values();
    }
    
    public static void handleBeforeUnDelete(List<Child__c> childList){
        Set<ID> parentIDSet = new Set<ID>();
        for(Child__c childRec: childList){
            parentIDSet.add(childRec.Parent__c);
        }
        
        Map<ID, Parent__c> parentMap = new map<ID, parent__c>([select id, child_count__c from Parent__c where id in :parentIDSet]);
        for(Child__c childRec: childList){
            if(parentMap.get(childRec.Parent__c).child_count__c == null){
                parentMap.get(childRec.Parent__c).child_count__c = 0;
            }
            parentMap.get(childRec.Parent__c).child_count__c ++;
        }
        update parentMap.values();
    }

}




Trigger:


trigger ChildTrigger on Child__c (before insert, after update, after delete, after undelete) {
    if (Trigger.isInsert) {
        ChildCountHelper.handleBeforeInsert((List<Child__c>)Trigger.NEW);
    }else if (Trigger.isUpdate) {
        ChildCountHelper.handleBeforeUpdate((List<Child__c>)Trigger.NEW, (List<Child__c>)Trigger.OLD);
    }else if (Trigger.isDelete) {
        ChildCountHelper.handleBeforeDelete((List<Child__c>)Trigger.OLD);
    }else if (Trigger.isUndelete) {
        ChildCountHelper.handleBeforeUnDelete((List<Child__c>)Trigger.NEW);
    }
}  
Hey guys,

Need some help, I have a apex class with soql query on Reports of type (Task & Events) in the UAT, the reports for now returns 0 records as I have some filters as Date = Last 30 Days, I'm not able to cover the query line in test class as the report result 0 count, if the same report result atleat 1 record the query line are covered in the test class. Rest all the code lines are covered except these query lines.

Also a question, while moving the code from sandbox to production through change set will the test class validate against production org data or sandbox.

Thanks in advance,
Jancy Mary
Hello All,

Need some information, suppose I have 2 fields called Age & DOB in a controller, these are not a getter setter fields, I have a button on the VF page, when I click the button these fields should get loaded to the page, how to achieve this.

Thanks in advance.
Jancy
HI, I have a scenario, where I need to make a Tab visible or insible for Users, based on a checkbox checked for that User.
Kindly help me achieve this.
Hey guys,

Need some help, I have a apex class with soql query on Reports of type (Task & Events) in the UAT, the reports for now returns 0 records as I have some filters as Date = Last 30 Days, I'm not able to cover the query line in test class as the report result 0 count, if the same report result atleat 1 record the query line are covered in the test class. Rest all the code lines are covered except these query lines.

Also a question, while moving the code from sandbox to production through change set will the test class validate against production org data or sandbox.

Thanks in advance,
Jancy Mary
Hello All ,

I have a requirement where i need to stop sending the email notification to the customer, when the field name "SRR is NO".This field is going to be updated by one of the user.Once it is updated how can i stop sending email.How can i achieve this.Any help very much appreciated.
Why do we need a custom extension when we are using a custom controller .
Please help me on this.

Thanks.
Hi All,

Placement object has a lookup relationship to Account and Contact, I want to show the number of placements on each Account, however if multiple Placements are associated to the same Contact in different interval of time period which intern is associated to particular Account, then all those Placements which are associated to that Contact should be considered as 1 count under that particular Account. 

I tried writing the below apex class, but stuck in the middle. With the below code I am able to fetch the ContactID and the AccountID when a placement record is inserted, however I am unable to compare the Contact's Account with the fetched AccountID. Or if there is any alternative way to achieve this please suggest.


public class totalOfPlacementsTriggerHelper{

 public static void handleAfterInsert(List<rnm__Placement__c> placementlist)
  {
    List<Account> acc= new List<Account>();
    Set<Id> accActiveId= new Set<Id>();
    Set<Id> conId= new Set<Id>();
  
      for(rnm__Placement__c p: placementlist)
      {
        if(p.Active__c==True)
        {
        if(p.rnm__Employer__c!=null && p.rnm__Contact__c!=null)   //rnm__Employer__c is a lookup to Account
        {
        accActiveId.add(p.rnm__Employer__c);
        conId.add(p.rnm__Contact__c);
        system.debug('TESTING'+accActiveId+' '+conId);
        }
      } 
      }
}


Thanks in Advance,
Jancy Mary
I'd like to start working with the macros in the Service Cloud Console, but each help article begins with "Click the Macros widget in the bottom right of your screen." Yet, I don't see it. I'm a Sys Admin, so I have read/edit access to the macros object. Any ideas?
Hi I need to write test class for this please tell me how to write.It has reports and dashboards.
public class Embedded_Analytics_Extn{
    
    public Id AccPlanId{get; set;}
    public GE_HQ_Account_Plan__c aPlan{get;set;}
    public String DashId{get; set;}
    public String Report0Id{get; set;}
    public String Report0Name{get; set;}
    public String Report1Id{get; set;}
    public String Report1Name{get; set;}
    public String Report2Id{get; set;}
    public String Report2Name{get; set;}
    public String Report3Id{get; set;}
    public String Report3Name{get; set;}
    public String Report4Id{get; set;}
    public String Report4Name{get; set;}
    public String Report5Id{get; set;}
    public String Report5Name{get; set;}
    public String Report6Id{get; set;}
    public String Report6Name{get; set;}
    
    public String AccPlanName{get; set;}
    Public String DDUNS{get; set;}
    public List<SelectOption> tiers{get;set;}
    public String tier2{get;set;}
    public String tier3{get;set;}
    public String accName{get;set;}
    public Embedded_Analytics_Extn(ApexPages.StandardController controller){
        //Report r0=[select id,name,developerName from Report where developerName='TOTAL_CurrYr_IFRU'];
        //Report0Id=r0.id;
        //Report0Name=r0.name;
        Report r1=[select id,name,developerName from Report where developerName='OG_Tier_1_O_G_Region_Current_Year'];
        Report1Id=r1.id;
        Report1Name=r1.name;
        Report r2=[select id,name,developerName from Report where developerName='OG_Forecast_by_PL_Current_Year'];
        Report2Id=r2.id;
        Report2Name=r2.name;
        Report r3=[select id,name,developerName from Report where developerName='OG_Tier_2_Account_Region_Current_Year'];
        Report3Id=r3.id;
        Report3Name=r3.name;
        Report r4=[select id,name,developerName from Report where developerName='OG_SalesMgr_Current_Year_OPEN'];
        Report4Id=r4.id;
        Report4Name=r4.name;
        Report r5=[select id,name,developerName from Report where developerName='OG_Oppty_by_Stage_Current_Year'];
        Report5Id=r5.id;
        Report5Name=r5.name;
        Report r6=[select id,name,developerName from Report where developerName='OG_SalesMgr_Current_Year_Forecast'];
        Report6Id=r6.id;
        Report6Name=r6.name;
                
        DashId=[select id,developerName from Dashboard where developerName='OG_Account_Plan_Dashboard'].id;
        List<DashboardComponent> comp=[select id,name from DashboardComponent where DashboardId=:DashId];
        Map<String,DashboardComponent> DashCompMap=new Map<String,DashboardComponent>();
        for(DashboardComponent c: comp){
            DashCompMap.put(c.name,c);    
        }
        this.aPlan=(GE_HQ_Account_Plan__c)controller.getRecord();
        GE_HQ_Account_Plan__c AccPlan=[select id,name,GE_HQ_DDUNS_fm__c,GE_HQ_DDUNS_Number__c from GE_HQ_Account_Plan__c where id=:aPlan.Id];
        
        AccPlanName=AccPlan.Name;
        DDUNS=AccPlan.GE_HQ_DDUNS_fm__c;
        Account acc=[select id,name from Account where id=:AccPlan.GE_HQ_DDUNS_Number__c];
        this.accName=acc.name;
        /*
        tiers=new List<SelectOption>();
        tiers.add(new SelectOption('','None'));
        tiers.add(new SelectOption('Turbo Machinery','Turbo Machinery'));
        tiers.add(new SelectOption('PII Pipeline Solutions','Pipeline Solutions'));
        tiers.add(new SelectOption('Global Services (GS)','Global Services'));
        tiers.add(new SelectOption('Mesurement & Control (M&C)','Mesurement & Control'));
        tiers.add(new SelectOption('Drilling & Surface (D&S)','Drilling & Surface'));
        tiers.add(new SelectOption('Subsea (SS)','Subsea'));
        */
    }
    
    public PageReference setTiers(){
        this.tier2=aPlan.GE_OG_Tier_2_P_L__c;
        this.tier3=aPlan.GE_OG_Tier_3_P_L__c;
        return null;
    }
    
}

Hi All,

 

As shown below the  execution of the process order is right  r not?if not so Please do the changes and let me know.

 

Validation

Apex class

Triggers

Workflows

 

Thanks

Hi,

If we have constructor in a class,Kindly let me know how can we write code to cover that constructor in test method?

 

Thanks ,

Eswar.

Hello,


I actually have two questions around apex code.

 

  1. Suppose I want to turn off or delete my apex class, how do I go about doing that in production?  I do not see a way to deactivate or delete the code?
  2. Prior to installing the DupeBlocker 2.0 application in the Sandbox my code was at 89% code coverage but after I installed the third party application it dropped to 23%!  I see that SFDC is using some of the DupBlocker code classes that are firing when I run my test script.  What will I do to get around this because once I install DupeBlock into production I will be faced with this kind of mishap all the time!!!

I've created a master-detail relationship field on a custom child object, looking to a custom parent object. When I create the child record, of course the master-parent record is required, and I'm then able to save the child record.

 

But once the child record has been saved, the master-detail lookup field to the parent record is now locked - I'm unable to edit the master-parent record, even though I had edit read-only field rights.

 

Any ideas would be great, thanks!

Hi,
 
Yesterday I had deployed aan apex trigger from sandbox to production env. The trigger is an "before insert, before update" to check for duplicate account names. The trigger works fine in prodiuction for preventing duplicate Account names.
 
But today when I tried to mass update Accounts for some other field using Apex Data Loader, I get the following error:
 

Apex script unhandled trigger exception by user/organization: 00530000000nHi3/00D300000006QZD

Trg_Account_Name_Dedup: execution of BeforeUpdate

caused by: System.Exception: Too many SOQL queries: 21

Trigger.Trg_Account_Name_Dedup: line 1, column 143

Can anyone please advise on how to disable triggers in production env so that I can carry out other mass updates in Account using Apex Data loader tool.

Thanks and regards,
Ambili

  • February 12, 2008
  • Like
  • 0