• Prasanth Reddy M
  • NEWBIE
  • 125 Points
  • Member since 2013

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 20
    Questions
  • 21
    Replies
Hi Everyone,
   Can anyone tell me what is the difference between account and parent account
Thanks in advance
Karthick
Hi,

I have a custom object named "Sales Order", would like to save object record as pdf on save under Files related list of the Sales Order.

Provision to format the pdf record with HTML/CSS and restricting the fields to get saved is highly desirable.

Can some one help with available options for me.

Thanks,
Prasanth

 
Hi,
The bellow Account Redirect page for EDIT is working fine for VF pages but for standard layouts after editing the record it is not returning home page instead of account detail page.

Am i missing something here?
Pls suggest.
public with sharing class DispatcherAccounteditController {
public DispatcherAccounteditController(ApexPages.StandardController controller) {
        this.controller = controller;
    }

    public PageReference getRedir() {
Account acc = [Select id, recordtypeid From Account Where Id = :ApexPages.currentPage().getParameters().get('id')];

        PageReference newPage;

        if (acc.recordtypeid == '0123B000000Hs88') {
            newPage = Page.AccountEdt;
        } else {
            newPage = new PageReference('/' + acc.id +'/e');
            newPage.getParameters().put('nooverride', '1');     
        }
 			 newPage.getParameters().put('id', acc.id);
       
             return newPage.setRedirect(true);

    }
     
    private final ApexPages.StandardController controller;

}

 
Hi,

For the below controller the test coverage is not exceeding 50%.
highlighted 2 lines are showing as not covered in test class.
Can someone please correct me on this?

Public with sharing class DispatcherAccountNewController {

public DispatcherAccountNewController(ApexPages.StandardController controller) {
        this.controller = controller;
    }

    public PageReference getRedir() {

        PageReference newPage;

        if (ApexPages.currentPage().getParameters().get('RecordType') == '0123B000000Hs88') {
            newPage = Page.newaccount;
            return newPage.setRedirect(true);
        }
            else if (ApexPages.currentPage().getParameters().get('RecordType') == '01232000000DxHz') {
            newPage = Page.abc_new_account;
            return newPage.setRedirect(true);

        }
            else if (ApexPages.currentPage().getParameters().get('RecordType') == '0120d0000009grC') {
            newPage = Page.health_integrated_new_account;
            return newPage.setRedirect(true);
        }     
             else if (ApexPages.currentPage().getParameters().get('RecordType') == '01232000000DxI0') {
            newPage = Page.olsi_new_account;
            return newPage.setRedirect(true);
        }   
            else {
      return null;
                    
        }

    }

    private final ApexPages.StandardController controller;
}

testclass - 
@isTest
private class DispatcherAccountNewController_Test{
  @testSetup
  static void setupTestData(){
    test.startTest();
    Account account_Obj = new Account(Name = 'Name897', RecordTypeId = '0123B000000Hs88');
    Insert account_Obj; 
    test.stopTest();
  }
  static testMethod void test_getRedir_UseCase1(){
    List<Account> account_Obj  =  [SELECT Name,RecordTypeId from Account];
    System.assertEquals(true,account_Obj.size()>0);
    PageReference newpage = Page.newaccount;
    newpage.getParameters().put('RecordTypeid','0123B000000Hs88');
    Test.setCurrentPage(newpage);
    DispatcherAccountNewController obj01 = new DispatcherAccountNewController(new ApexPages.StandardController(account_Obj[0]));
    obj01.getRedir();
  }
}
 
Hi,

For Account, we have few record types. we want to have the related vf page displayed when a specific record type is selected.

However, upon selecting a record type, the below vf page is not directing the VF new record page specific to record type.

We also have a domain for our instance.

Am i missing something here?
 
<apex:page standardController="Account" extensions="NewAccountExtension" action="{!redirectToNewVFPage}">
</apex:page>

public with sharing class NewAccountExtension {

    public String recordTypeId;

    public NewAccountExtension(ApexPages.StandardController std) {

    }

    public Pagereference redirectToNewVFPage(){
        Pagereference pg = null;
        if(ApexPages.CurrentPage().getParameters().get('RecordType') != null){
            recordTypeId = ApexPages.CurrentPage().getParameters().get('RecordType');
            if(recordTypeId == Schema.SObjectType.Account.getRecordTypeInfosByName().get('Finance_Account').getRecordTypeId()){
                pg = new Pagereference('https://avantegrande.cs50.my.salesforce.comapex/fin_new_account');

            }else if(recordTypeId == Schema.SObjectType.Account.getRecordTypeInfosByName().get('Logistics_Account').getRecordTypeId()){
                pg = new Pagereference('https://avantegrande.cs50.my.salesforce.com/apex/logi_account');
            }
            pg.setRedirect(true);
            return pg;
        }
        return null;
    }
}


 
Hi Guys,

Have exposed account object's 3 fields to a custom object with the help of lookup relationship of account with the custom object. I just want to ensure any changes for these 3 fields in the Account object should not overwrite the values initial values in custom object when the record created for the first time.

How can we achieve this?
Hi,

Below is my Apex Trigger and Test Class i have writte, the trigger is only showing 67% code coverage. Am i missing something here ?
 
trigger LeadandContactfieldsinTask on Task (after insert) {
 Set<Id> leadids = new Set<Id>();
   Set<Id> contactids = new Set<Id>();
    List<Task> taskstoupdate = new list<Task>();
     String FName = 'Sathiya';
    //Fetch only Leads which follow criteria
    for(Lead ld : [ SELECT Id, company, Leadsource, Rating, Title, sales_offering__c  FROM lead WHERE Owner.FirstName!= :FName])
        {
            leadids.add(ld.Id);
    }
    
    //Fetch only Leads which follow criteria
    for(Contact cts : [SELECT Id, Account.Name, LeadSource, Rating__c, Title, Sales_Offering__C from Contact])
    
        {
            contactids.add(cts.Id);
    }
    
    //Iterate over all Leads and modify Tasks for them + Add to a list variable 
    for(Lead ld : [SELECT Id, company, Leadsource, Rating, Title, sales_offering__c, (SELECT Id, Company_Account__c, Lead_Source__c,   Qualification__c, Solution_of_Interest__c, Title__c   FROM Tasks) from Lead Where Id IN : leadids])
    
     {
        for(Task t : ld.Tasks) {
        
            t.Company_Account__c = ld.company;
            t.Lead_Source__c = ld.Leadsource;
            t.Qualification__c=ld.Rating;
            t.Title__c= ld.Title;
            t.Solution_Of_Interest__c = ld.Sales_Offering__C;
            taskstoupdate.add(t);
        }
    }
    
    
    for(Contact cts : [SELECT Id, Account.Name, LeadSource, Rating__c, Title, Sales_Offering__C, (SELECT Id, Company_Account__c, Lead_Source__c,   Qualification__c, Solution_of_Interest__c, Title__c   FROM Tasks) from contact Where Id IN : contactids])
    
    {
        for(Task t : cts.Tasks)
    {
            t.Company_Account__c = cts.Account.Name;
            t.Lead_Source__c = cts.Leadsource;
            t.Qualification__c=cts.Rating__c;
            t.Title__c= cts.Title;
            t.Solution_Of_Interest__c = cts.Sales_Offering__C;
            taskstoupdate.add(t);
    
    }
        
    }
    
    //Update Tasks
    if(taskstoupdate.size()>0) {
        update taskstoupdate;
    }
    
}

Test Class - 
@isTest
private class LeadandContactfieldsinTask {

    static testMethod void myUnitTest() {
    
    
    
    Lead l1 = new Lead(
        LastName = 'Last',
        Title='CEO',
        Company='ABC Corp',
        Leadsource = 'webinar',
        Rating='Hot',
        Sales_offering__c = 'Quality',
        ownerid = '005700000012VFZ');      
       
        insert  (l1);  
        string l1Id = l1.id;
        
  Account ACC = new Account(
        name = 'ABC Corp',
        Ownerid='005700000012VFZ',
        Type = 'Prospect');
   
   Insert (Acc); 
       string accId = acc.Id;  
       string AccName = acc.Name;
        
   Contact c1 = new Contact(
        LastName = 'last',
        AccountID = ACC.ID,
        Title = 'CEO',
        LeadSource = 'Webinar',
        Rating__C = 'Hot',
        Sales_Offering__C='HEOR');
        insert (c1);
        string c1Id = c1.Id;
        
        test.startTest();
          
        Task tsk1 = new Task(
            Subject = 'Test task for Lead',
            Status = 'Not Started',
            Priority = 'High',
            Type_of_Correspondence__c ='call',
            Whoid= l1.id);
        insert (tsk1);
        
        Task tsk2 = new Task(
            Subject = 'Test for Contact Task',
            Status = 'Not Started',
            Priority = 'High',
            Type_of_Correspondence__c = 'call',
            whoid = c1.Id);
         insert (tsk2);  
        
        
    }
}

 
Hi,

For below trigger, when i have deployed in production, i am getting the "limit exception : too many query rows : 50001"
trigger TaskUpdatewithLeadComments on Task (after insert) {
     Set<Id> leadids = new Set<Id>();
    List<Task> taskstoupdate = new list<Task>();
    
    //Fetch only Leads which follow criteria
    for(Lead ld : [ SELECT Id, company  FROM lead ])
        {
            leadids.add(ld.Id);
    }
    //Iterate over all Leads and modify Tasks for them + Add to a list variable 
    for(Lead ld : [SELECT Id, Prospect_notes__c,(SELECT Id, Whatid, Description FROM Tasks) from Lead Where Id IN : leadids])
    
     {
        for(Task t : ld.Tasks) {
        
           if(t.Description==null)
            t.Description = ld.prospect_notes__c;
            taskstoupdate.add(t);
        }
    }
    
    //Update Tasks
    if(taskstoupdate.size()>0) {
        update taskstoupdate;
    }
}

how can i fix this ?
Hi, I am getting nullpointer exception while running below test class.

After inserting both contact and campaign objects only, i am referring them in campaign member object, wondering what i am missing here.
@isTest

public class CampaignMemberTaskcreation {

    Static testmethod void testtask(){

        Contact co1 = new Contact(
        LastName = 'Last',
        Title='CEO');
        
        insert  co1;
        string co1Id = co1.id;

        Campaign ca1 = new Campaign(
            Name = 'Testcampaign',
            Date_Sent__c=Date.today(),
            IsActive = TRUE);
        insert ( ca1 );
        string ca1Id = ca1.id;

        CampaignMember m1 = new CampaignMember();
            m1.Contact.Id = co1.Id; 
            m1.Campaign.Id = ca1.Id;
            m1.status='Responded';
        insert m1;
    }

}



Below is the error
Class CampaignMemberTaskcreation
Method Name testtask
Pass/Fail Fail
Error Message System.NullPointerException: Attempt to de-reference a null object
Stack Trace Class.CampaignMemberTaskcreation.testtask: line 22, column 1
I have received below error, when testing below trigger.

Trigger:

trigger CampaignMemberTaskCreation on CampaignMember (after update) {

list<Task> AddTask=new List<Task>();
for(CampaignMember CM : Trigger.new) {
if(cm.Status == 'Responded'){
AddTask.add(new Task(
WhoId = CM.ContactId,
Status = 'Completed',
Description='CM.Description',
Subject = 'Call - ' + CM,
Whatid= CM.CampaignId));
}
}
insert AddTask;
}
Error Message, when tried to update the campaign member status:

Sandbox
 
Apex script unhandled trigger exception by user/organization: 00570000003003D/00D190000000OrW Source organization: 00D700000008ieh (null)
CampaignMemberTaskCreation: execution of AfterUpdate
 
caused by: System.DmlException: Insert failed. First exception on row 0; first error: STRING_TOO_LONG, Subject: data value too large: Call - CampaignMember:{Id=00v19000000TEZkAAO, IsDeleted=false, CampaignId=70119000000A3qoAAC, LeadId=00Q19000001eGJWEA2, ContactId=null, Status=Responded, HasResponded=true, CreatedDate=2015-10-15 16:55:39, CreatedById=00570000003003DAAQ, LastModifiedDate=2016-01-25 09:59:56, LastModifiedById=00570000003003DAAQ, SystemModstamp=2016-01-25 09:59:56, FirstRespondedDate=2016-01-25 00:00:00, Name=null, Email__c=false} (max length=255): [Subject]
 
Trigger.CampaignMemberTaskCreation: line 14, column 1


How i can resolve the exception here?
Hi,

Got "Account Hierarchy" custom  button in "App Shark Account Hierarchy" Package.

The button is working fine in standard page Account layouts, but when tried to use in VF with below code, it is showing 'URL No longer exists'

<apex:commandButton onclick="window.open('/apex/AppShark_AH__Account_Hierarchy?id={!Account.id}','Account Hiererchy', '_blank');" styleClass="buttonStyle" style="background:White;width:90px;" value="Account Hierarchy" immediate="true"/> 

How can i fix this ?
Hi Friends,

I have installed a package, it has a custom button for Account object , which is directing to a visualforce page.

I am using visual force page for Accoutn detail and below is the call i am using for the custom button.

 <apex:commandButton onclick="('/apex/texcellency__DefinitiveHospitalManager?id={!Account.id}', 'Import DMC Data', '_blank');" />

on clicking above custom button, it is not redirecting to the VF Page "DefinitiveHospotal Manager"

Could some one please help with a solution here.



 
Hi,

I have a picklist field called Customer Type in Opportunity page with options, NEW, EXISTING and INACTIVE. I wan to make it required, if Opportunity stage is CLOSED WON.

How can this be achieved ?
Hi,

I have installed version salesforce for outlook version 2.6.1 on top of version 2.5.2

I could able to see side panel, but i couldn't able to see any details of any lead/contact after i entered email id in To address field?

Will un-installing previous version is the reason for this ?

Please clarrify ...
Hi,

Managed package we have installed is having sections, which we can add to leads and accounts page . But as we are using tabbed leads/account detail pages, Wondering, on how to add the sections for the page ?

Any solution here ...
I have a common custom picklist field in leads & contacts, i want to map it to the activitity records of leads and contacts.

It has to be in such way that, if the activity record is of a lead, then the activity record has to get the relevent lead records custom picklist value.Same as well for contat.

Is there a way to achieve it ?
when i am trying below custom formula field for creating object in activities, it is continuously showing syntax error...can anyone one help with correct formula here...

IF(
BEGINS(WhatId, “006″), “Opportunity”,
IF(
BEGINS(WhatId, “001″), “Account”,
IF(
BEGINS(WhoId, “00Q”), “Lead”,
IF(
BEGINS(WhoId, “003″), “Contact”,””))))
We have created a lookup field for in leads for linking leads with accounts.due to this, we are able to see the leads and contacts both for an account in the account detail page.When it comes to activities we are able to see only the activities associated with contacts but not leads activities.

Is there a way to see leads activities as well in accounts detail page ?
In Leads Page, I want to have  a Sales Score Text field (formula field ), which needs to be updated by first checking the campaign field is empty or not and has to update the Sales Score field based on other Campaign Score field (Number field).

Is this is possible with Formula fields, if so how ...

Please clarrify..
I want to have a number field in contact page in salesforce, i have integrated outlook with salesforce. Based on the activity/tasks happining for that perticular contact in Outlook mail, i want the number field to be updated by assigning some score depending on the number of activities/tasks .

Please help will this is possible, if so, how .
Hi,

For Account, we have few record types. we want to have the related vf page displayed when a specific record type is selected.

However, upon selecting a record type, the below vf page is not directing the VF new record page specific to record type.

We also have a domain for our instance.

Am i missing something here?
 
<apex:page standardController="Account" extensions="NewAccountExtension" action="{!redirectToNewVFPage}">
</apex:page>

public with sharing class NewAccountExtension {

    public String recordTypeId;

    public NewAccountExtension(ApexPages.StandardController std) {

    }

    public Pagereference redirectToNewVFPage(){
        Pagereference pg = null;
        if(ApexPages.CurrentPage().getParameters().get('RecordType') != null){
            recordTypeId = ApexPages.CurrentPage().getParameters().get('RecordType');
            if(recordTypeId == Schema.SObjectType.Account.getRecordTypeInfosByName().get('Finance_Account').getRecordTypeId()){
                pg = new Pagereference('https://avantegrande.cs50.my.salesforce.comapex/fin_new_account');

            }else if(recordTypeId == Schema.SObjectType.Account.getRecordTypeInfosByName().get('Logistics_Account').getRecordTypeId()){
                pg = new Pagereference('https://avantegrande.cs50.my.salesforce.com/apex/logi_account');
            }
            pg.setRedirect(true);
            return pg;
        }
        return null;
    }
}


 
Hi Guys,

Have exposed account object's 3 fields to a custom object with the help of lookup relationship of account with the custom object. I just want to ensure any changes for these 3 fields in the Account object should not overwrite the values initial values in custom object when the record created for the first time.

How can we achieve this?
Hi Everyone,

In Batch Apex can anyone explain me what this <sObject> is needed for. what exactly it does...?

 
Hi,

For below trigger, when i have deployed in production, i am getting the "limit exception : too many query rows : 50001"
trigger TaskUpdatewithLeadComments on Task (after insert) {
     Set<Id> leadids = new Set<Id>();
    List<Task> taskstoupdate = new list<Task>();
    
    //Fetch only Leads which follow criteria
    for(Lead ld : [ SELECT Id, company  FROM lead ])
        {
            leadids.add(ld.Id);
    }
    //Iterate over all Leads and modify Tasks for them + Add to a list variable 
    for(Lead ld : [SELECT Id, Prospect_notes__c,(SELECT Id, Whatid, Description FROM Tasks) from Lead Where Id IN : leadids])
    
     {
        for(Task t : ld.Tasks) {
        
           if(t.Description==null)
            t.Description = ld.prospect_notes__c;
            taskstoupdate.add(t);
        }
    }
    
    //Update Tasks
    if(taskstoupdate.size()>0) {
        update taskstoupdate;
    }
}

how can i fix this ?
I have received below error, when testing below trigger.

Trigger:

trigger CampaignMemberTaskCreation on CampaignMember (after update) {

list<Task> AddTask=new List<Task>();
for(CampaignMember CM : Trigger.new) {
if(cm.Status == 'Responded'){
AddTask.add(new Task(
WhoId = CM.ContactId,
Status = 'Completed',
Description='CM.Description',
Subject = 'Call - ' + CM,
Whatid= CM.CampaignId));
}
}
insert AddTask;
}
Error Message, when tried to update the campaign member status:

Sandbox
 
Apex script unhandled trigger exception by user/organization: 00570000003003D/00D190000000OrW Source organization: 00D700000008ieh (null)
CampaignMemberTaskCreation: execution of AfterUpdate
 
caused by: System.DmlException: Insert failed. First exception on row 0; first error: STRING_TOO_LONG, Subject: data value too large: Call - CampaignMember:{Id=00v19000000TEZkAAO, IsDeleted=false, CampaignId=70119000000A3qoAAC, LeadId=00Q19000001eGJWEA2, ContactId=null, Status=Responded, HasResponded=true, CreatedDate=2015-10-15 16:55:39, CreatedById=00570000003003DAAQ, LastModifiedDate=2016-01-25 09:59:56, LastModifiedById=00570000003003DAAQ, SystemModstamp=2016-01-25 09:59:56, FirstRespondedDate=2016-01-25 00:00:00, Name=null, Email__c=false} (max length=255): [Subject]
 
Trigger.CampaignMemberTaskCreation: line 14, column 1


How i can resolve the exception here?
Hi,

Got "Account Hierarchy" custom  button in "App Shark Account Hierarchy" Package.

The button is working fine in standard page Account layouts, but when tried to use in VF with below code, it is showing 'URL No longer exists'

<apex:commandButton onclick="window.open('/apex/AppShark_AH__Account_Hierarchy?id={!Account.id}','Account Hiererchy', '_blank');" styleClass="buttonStyle" style="background:White;width:90px;" value="Account Hierarchy" immediate="true"/> 

How can i fix this ?
Hi Friends,

I have installed a package, it has a custom button for Account object , which is directing to a visualforce page.

I am using visual force page for Accoutn detail and below is the call i am using for the custom button.

 <apex:commandButton onclick="('/apex/texcellency__DefinitiveHospitalManager?id={!Account.id}', 'Import DMC Data', '_blank');" />

on clicking above custom button, it is not redirecting to the VF Page "DefinitiveHospotal Manager"

Could some one please help with a solution here.



 
Hi,

I have a picklist field called Customer Type in Opportunity page with options, NEW, EXISTING and INACTIVE. I wan to make it required, if Opportunity stage is CLOSED WON.

How can this be achieved ?
Hi,

I have installed version salesforce for outlook version 2.6.1 on top of version 2.5.2

I could able to see side panel, but i couldn't able to see any details of any lead/contact after i entered email id in To address field?

Will un-installing previous version is the reason for this ?

Please clarrify ...
Hi,

Managed package we have installed is having sections, which we can add to leads and accounts page . But as we are using tabbed leads/account detail pages, Wondering, on how to add the sections for the page ?

Any solution here ...
when i am trying below custom formula field for creating object in activities, it is continuously showing syntax error...can anyone one help with correct formula here...

IF(
BEGINS(WhatId, “006″), “Opportunity”,
IF(
BEGINS(WhatId, “001″), “Account”,
IF(
BEGINS(WhoId, “00Q”), “Lead”,
IF(
BEGINS(WhoId, “003″), “Contact”,””))))
Hi Everyone,
   Can anyone tell me what is the difference between account and parent account
Thanks in advance
Karthick
We have created a lookup field for in leads for linking leads with accounts.due to this, we are able to see the leads and contacts both for an account in the account detail page.When it comes to activities we are able to see only the activities associated with contacts but not leads activities.

Is there a way to see leads activities as well in accounts detail page ?
I want to have a number field in contact page in salesforce, i have integrated outlook with salesforce. Based on the activity/tasks happining for that perticular contact in Outlook mail, i want the number field to be updated by assigning some score depending on the number of activities/tasks .

Please help will this is possible, if so, how .