• sridhar sridhar
  • NEWBIE
  • 40 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 16
    Questions
  • 23
    Replies
Hi,

Can anybody help me on this please.
I have two custom objects.1) Fund 2) Refund
 
have 15  custom fields on both objects   like i) Primary_value__C ii) Primary_1_value__C
we have writtern a chandler class which is calling  on before update trigger. 
class is working ,Handler class code snippet: 
a.Primary_value__C  = b.Primary_1_value__C ; 
a.Inventory_price__C = b.Inventory_1_value__C;
a.Monthly_val_c = b.Monthly_1_val__c;
.
.
.
.
.
But, 
i am facing code coverge issue for all mapped fields, remaining whole class getting code coverage. 
In test class i initiated two objects and passed values for all the fields and inserted, still unable to code coverage for those 15 mapped fields. so i am getting only 54% code coverage which is creatig deploymet problem. 

How can i come out of this problem?? 

 
Hi

we need all the fields (standard&Custom) names,type,length of opportunity into exel

How can we do this?

 
HI all , 
Serious PROD issue. Can any one provide solution ...
Below Batch class which update Fact_Revenue__C in Opportunity  from Revenue__c object . it runs daily basis 
Issue: many records are not populating correct values into Fact_Revenue__C . 

Suppose : Sum(ttlRmrev__C)  = $ 100 same has to populate in Fact_Revenue__C  in opportunity but for many records it is failing .. updaing less than the correct value.
 
global without sharing class batchrevenue implements Database.Batchable<sObject>{
    public String strQuery ='';
    public DateTime dtProvided ; 
    AggregateResult[] tlrevenue ;
     set<id> sopids;
    global batchableSumGroupBookingCodeRevenue(Date sldte){
        if(sldte == null){
            sldte = date.today().addDays(-20);
        }
        dtProvided = DateTime.newInstance(sldte.year(),sldte.month(),sldte.day(),0,0,0);
        if(test.isRunningTest()){
            strQuery = 'Select Id From Opportunity where  glc_Code__C != null limit 2';
        }
        else
        {
            strQuery = 'Select Id From Opportunity where  glc_Code__C != null ';
        }   
        sopids= new Set<Id>();   
    }

 global Database.QueryLocator start(Database.BatchableContext BC)
{   
    system.debug('==========::strQuery::==========='+strQuery); 
    return Database.getQueryLocator(strQuery); 
}
global void execute(Database.BatchableContext BC, List<Opportunity> scopeOpty)
{        
    if(sopids != null){
        sopids= new Set<Id>();
    }
    for(Opportunity opty: scopeOpty)
    {
        system.debug('xxxx::opty::===========>'+opty);
        sopids.add(opty.Id);                    
    }   

    tlrrmrev(sopids); 

}
public void tlrrmrev( set<id> sopids ){
    try{
        list<Opportunity> selOpportunity = new list<Opportunity>();
        tlrevenue =[select SUM(ttlRmrev__C) totalRevenue, Opportunity__c   Opportunity
                        From Revenue__c 
                        where Opportunity__c in : sopids GROUP BY Opportunity__c];
        for(AggregateResult agreeResult : tlrevenue){
            system.debug('xxxx:agreeResult.get(Opportunity)::===========>'+agreeResult.get('Opportunity'));
            if(agreeResult.get('Opportunity') != null){
                selOpportunity.add(new Opportunity(id = (string) agreeResult.get('Opportunity'), Fact_Revenue__C = (decimal) agreeResult.get('totalRevenue')));
            }
        }
        if(selOpportunity.size() > 0){
            system.debug('xxxx::selOpportunity::===========>'+selOpportunity);
            update selOpportunity;
        }
    }
    catch(exception ex){
         System.debug('Exception is :::' + ex.getMessage());
    }       

    //
}

}


 
HI all, 

I have a text field in custom object called asserts .. where i have text field used to enter eail of the assert owner.
for client requirment i have to populate same into case object as Eamil data type field.

how can i achive. 
can workflow help here ??
or 
Trigger will work? 

But sould not be formula field... those field will need to use some wehre as Email type. 

Thanks in advance 
 
Hi all, 
Greetings, 

I am facing a error while sending a email notification to the property (custom object Property__C) general manager. 
Error:
execution of AfterInsert caused by: System.EmailException: SendEmail failed. First exception on row 0; first error: INVALID_TYPE_FOR_OPERATION, Only User, Contact, Lead, or Person objects are allowed for targetObjectId:


Apex Code: 
=========
for (case cass : casss){

if(cass.Notify_Property__C == True ){
Csid=cass.Property_Name__c;
}
Property__c pr = [select id, General_Manager_Email__c from Property__C where id =: csid]; 

propertyId.add(pr.General_Manager_Email__c); 
string Emailaddress = pr.General_Manager_Email__c; 
if (propertyId.size()> 0){
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
String[] address= new String[] {Emailaddress};
System.debug('Query email address ]]'+ address  );
mail.setToAddresses(address);
mail.setTargetObjectId(pr.id);

mail.setSenderDisplayName('Delivery notice');
EmailTemplate et=[Select id from EmailTemplate where Name=:'Product Delivery Notice'];
mail.setTemplateId(et.id);
Messaging.SendEmailResult [] r = Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });

can you help on the issue. if any code changes need  you can twist and place it in the post. 

Thanks 
Hi all, 

Html version is not shoing the all the table data in the text body
User-added image

Actually if we clinck "Click here to view HTML version" it has to show all the body contented in the HTML view

but it is not showing, if 50 tables are there only 10 only it is showing. 

how to solve this issue??? 
Hi all, 
Created custom button(Apex controller classs) to clone the record during cloning operation but, The following list 1-6 related lists(child objects) do not want to clone while cloning record. 

1.Open Activities
2.Activity History
3.Notes & Attachments
4.Related Vendors
5.Stage History
6.Opportunity Field History. 

How to achieve this??

 

Hi all, 

clone(custom clone ) button is not change the record owner after clone. 

but here record owner should change to who have cloned the record.

how to achive this???  
Hi all 
i have to deploy  15 test classes into production.  
among these some are new and few are goint to overwirte the existing test classes. 
what are the steps to follow to deploy?? 

if i go throught he changesets
do i need to validate the test classes before deploy or directly can deploy? 

shall we expect any deployment errors
 
Hi all, 

I made few changes to the  one of the Apex classes in UAT, I want to move same class into Production( already same class exist in Production) by useing change sets.

is it like same process adding classes and testclasses into change sets then validation and deploy?? 
why because same test class already exist in prodcution, so do i need to add again test class to the chang set??
which option is suitable during deployment to run test classes among four?? ..i dont want to run all the test classes in prodcution at this case  
Is it going to overwrite the exist class?? 
is there any possible errors can occur during deployment in this case?? 

Thanks in advance.
Hi, 

I am not able to get code coverage for the the catch block.. 
how to get test code coverage for this. 
thanks 

}catch(exception e){
            o=null;
            Apexpages.addMessage(new ApexPages.Message(ApexPages.Severity.FATAL, 'The URL entered is not exist.'));
            errorMessage=true;
HI, 

we have 15 record types in case object.

do not want to allow to CLOSE/EDIT other records types cases . 

but 3 record types are allowed to close/edit each other cases? 

How to achieve this? 

 
HI all, 
Request you to give a detaild explanation... if possible provide any snippet code. thanks 

i am keep on hitting while deploying classes into production  Organigaion code coverage is 45%. 
I noticed that some classes and triggers have 0% code coverage. 

1.How it could be possible to deploy a calss having 0% code coverage??. 
2. there is no test classes for few classes.. How it could be possible? 
3. for few classes have hidden code... how to sort out managed packes code coverage problem??
4. unmanaged packages have test classes and methods  in the apex class?? ... does it creating 0% code coverage issue to the classes?? 
 
Hi all, i want to run all test classes in production ? to know code coverage in production.
is this operation will effect or problem to the current  fuctionality due to" run all tests"??  ..
is there any effect to the live users at the time of run all tests operation??
if i get test classes failure during run all tests operation.. will it effect existing functionality or any problem to the live user??


thanks
sridhar
//These two sections are not covering in code coverage  plz provide a solution
section1
for(Case selectedCase : selectedCases)
        {
           caselist.add(selectedCase);
section 2
catch (DMLException e){       
         for(case c :caselist){
         c.adderror('xxxxxx.');
Apex trigger casetriger caused an unexpected exception, contact your administrator: casetriger: execution of BeforeUpdate caused by: System.QueryException: List has no rows for assignment to SObject: Trigger.casetriger: line 63, column 1
Hi

we need all the fields (standard&Custom) names,type,length of opportunity into exel

How can we do this?

 
HI all , 
Serious PROD issue. Can any one provide solution ...
Below Batch class which update Fact_Revenue__C in Opportunity  from Revenue__c object . it runs daily basis 
Issue: many records are not populating correct values into Fact_Revenue__C . 

Suppose : Sum(ttlRmrev__C)  = $ 100 same has to populate in Fact_Revenue__C  in opportunity but for many records it is failing .. updaing less than the correct value.
 
global without sharing class batchrevenue implements Database.Batchable<sObject>{
    public String strQuery ='';
    public DateTime dtProvided ; 
    AggregateResult[] tlrevenue ;
     set<id> sopids;
    global batchableSumGroupBookingCodeRevenue(Date sldte){
        if(sldte == null){
            sldte = date.today().addDays(-20);
        }
        dtProvided = DateTime.newInstance(sldte.year(),sldte.month(),sldte.day(),0,0,0);
        if(test.isRunningTest()){
            strQuery = 'Select Id From Opportunity where  glc_Code__C != null limit 2';
        }
        else
        {
            strQuery = 'Select Id From Opportunity where  glc_Code__C != null ';
        }   
        sopids= new Set<Id>();   
    }

 global Database.QueryLocator start(Database.BatchableContext BC)
{   
    system.debug('==========::strQuery::==========='+strQuery); 
    return Database.getQueryLocator(strQuery); 
}
global void execute(Database.BatchableContext BC, List<Opportunity> scopeOpty)
{        
    if(sopids != null){
        sopids= new Set<Id>();
    }
    for(Opportunity opty: scopeOpty)
    {
        system.debug('xxxx::opty::===========>'+opty);
        sopids.add(opty.Id);                    
    }   

    tlrrmrev(sopids); 

}
public void tlrrmrev( set<id> sopids ){
    try{
        list<Opportunity> selOpportunity = new list<Opportunity>();
        tlrevenue =[select SUM(ttlRmrev__C) totalRevenue, Opportunity__c   Opportunity
                        From Revenue__c 
                        where Opportunity__c in : sopids GROUP BY Opportunity__c];
        for(AggregateResult agreeResult : tlrevenue){
            system.debug('xxxx:agreeResult.get(Opportunity)::===========>'+agreeResult.get('Opportunity'));
            if(agreeResult.get('Opportunity') != null){
                selOpportunity.add(new Opportunity(id = (string) agreeResult.get('Opportunity'), Fact_Revenue__C = (decimal) agreeResult.get('totalRevenue')));
            }
        }
        if(selOpportunity.size() > 0){
            system.debug('xxxx::selOpportunity::===========>'+selOpportunity);
            update selOpportunity;
        }
    }
    catch(exception ex){
         System.debug('Exception is :::' + ex.getMessage());
    }       

    //
}

}


 
HI all, 

I have a text field in custom object called asserts .. where i have text field used to enter eail of the assert owner.
for client requirment i have to populate same into case object as Eamil data type field.

how can i achive. 
can workflow help here ??
or 
Trigger will work? 

But sould not be formula field... those field will need to use some wehre as Email type. 

Thanks in advance 
 
Hi all 
i have to deploy  15 test classes into production.  
among these some are new and few are goint to overwirte the existing test classes. 
what are the steps to follow to deploy?? 

if i go throught he changesets
do i need to validate the test classes before deploy or directly can deploy? 

shall we expect any deployment errors
 
Hi all, 

I made few changes to the  one of the Apex classes in UAT, I want to move same class into Production( already same class exist in Production) by useing change sets.

is it like same process adding classes and testclasses into change sets then validation and deploy?? 
why because same test class already exist in prodcution, so do i need to add again test class to the chang set??
which option is suitable during deployment to run test classes among four?? ..i dont want to run all the test classes in prodcution at this case  
Is it going to overwrite the exist class?? 
is there any possible errors can occur during deployment in this case?? 

Thanks in advance.
Hi, 

I am not able to get code coverage for the the catch block.. 
how to get test code coverage for this. 
thanks 

}catch(exception e){
            o=null;
            Apexpages.addMessage(new ApexPages.Message(ApexPages.Severity.FATAL, 'The URL entered is not exist.'));
            errorMessage=true;
HI, 

we have 15 record types in case object.

do not want to allow to CLOSE/EDIT other records types cases . 

but 3 record types are allowed to close/edit each other cases? 

How to achieve this? 

 
Hi all, i want to run all test classes in production ? to know code coverage in production.
is this operation will effect or problem to the current  fuctionality due to" run all tests"??  ..
is there any effect to the live users at the time of run all tests operation??
if i get test classes failure during run all tests operation.. will it effect existing functionality or any problem to the live user??


thanks
sridhar
//These two sections are not covering in code coverage  plz provide a solution
section1
for(Case selectedCase : selectedCases)
        {
           caselist.add(selectedCase);
section 2
catch (DMLException e){       
         for(case c :caselist){
         c.adderror('xxxxxx.');
Apex trigger casetriger caused an unexpected exception, contact your administrator: casetriger: execution of BeforeUpdate caused by: System.QueryException: List has no rows for assignment to SObject: Trigger.casetriger: line 63, column 1
HI ,

I need to delete the post in the community , could anyone help me.

this is the link

https://developer.salesforce.com/forums/ForumsMain?id=906F0000000BVjIIAW

Thanks in advance
hi all,

I urgently need to edit/delete a post made by me on this discussion forum...But its not allowing me to do so and pops up
saying that 'you cant delete this question as others are interested in it'.
There are no likes and no comments on it still i am unable  to delete it
Any help would be highly appreciated

Its very urgent,
Thanks,