• Medhya Mahajan
  • SMARTIE
  • 725 Points
  • Member since 2016
  • Salesforce Developer


  • Chatter
    Feed
  • 22
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 80
    Replies
Hi guys,
if i insert or update 1 account i need to create 5 contacts to that account Using Trigger how can approach this one 
can anyone help me out if possible send me code 
Advance Thanks
Am I am able to simply create a new change set with the missing piece and then delopy that in production or do I have to start all over?  I am new to change sets and am creating one with customer objects, flows, report and record types, approval processes, and an apex trigger. I have been working on this in sandbox for month and months. There is a chance that I may have forgot something.  I think I have it all. But, if I do not, what can be done?  Thanks!
public  class Notificationserviceclass {
List<Notification__c> notifylist1 = new list<Notification__c>();
List<Notification__c> notifylist2 = new list<Notification__c>();
public void onAfterInsert(Account[] newAccounts){
for(Account accname:newAccounts)
{
Notification__c notifyvar=new Notification__c();
notifyvar.name=accname.name;
notifyvar.Action__c='Add';
notifylist2.add(notifyvar);
}
insert notifylist2;
}
public void onAfterUpdate(Account[] newAccounts, map<id, Account> oldMap ){
 
for(Account Acc:newAccounts){
 
 Account oldname = oldMap.get(Acc.Id);
 
if(Acc.name!=oldname.name){
 
Notification__c memb = new Notification__c();
 
memb.name=Acc.name;
 
       memb.Action__c= 'Modify';
 
       notifylist1.add(memb);
 
       }
 
       if(notifylist1.size()>0 && notifylist1.size()!=null)
 
       {
 
       insert notifylist1;
 
       }
 
       }
 
     }
 
       }
 
hi all,
In Account object picklist called Rating..
in rating picklist when i select value called Hot than after save.
in detailed page i want to hide or read only for fields as 
Billing Street and Billing City.
no need any code.

please help for this.


regards,
Nandireddy Nagarjuna Reddy
How to write a test class for the below class
public with sharing class GSDASDPHPEAccountTeam {
    public GSD_Account_Success_Delivery_Plan__c mainAcctID;
    public GSDASDPHPEAccountTeam(ApexPages.StandardController std)
    {
        mainAcctID = [select id, Account__c, Related_To_Account_Business_Plan__c,Related_To_Account_Business_Plan__r.primary_accountaccount__c from GSD_Account_Success_Delivery_Plan__c where id = :std.getId()];
    }
   
    public list<HPE_Account_Team__c> getHPEAccountTeam(){
        return [select Name, Account__r.Name,Name__r.Name, Phone__c, Email__c, Role__c, Role_Scope__c, Role_Scope_Description__c from HPE_Account_Team__c where Account__c = : mainAcctID.Account__c];
    }
    
}

 
 Hi,

I am relavively new to apex and triggers and this may sound a silly question.  How do I now make amendments to an existing class i have already deployed in production?
Do I amend it in sandbox and deploy the same class in a change set and it overrides the existing one?

Thanks
  • September 15, 2016
  • Like
  • 0
All i'm trying to create a detail button that when clicked checks a checkbox.  I found some java script in one of the forums for this purpose, but am having trouble making it work.  I get an error "Cannot set property AECaseMgmt__Program_Case__c.Generate_Closing_Summary__c of undefined."  Any ideas?  Thanks.
{!REQUIRESCRIPT("/soap/ajax/30.0/connection.js")} 
var newRecords = []; 
var c = new sforce.SObject("AECaseMgmt__Program_Case__c"); 
c.id ="{!AECaseMgmt__Program_Case__c.Name}"; 
c.AECaseMgmt__Program_Case__c.Generate_Closing_Summary__c = true;
newRecords.push(c); 
result = sforce.connection.update(newRecords); 
window.location.reload();

 
Hi, 

  I wrote a trigger which is working as expected for the requirement my problem is with the test class I wrote a test class which is giving only 54% code coverage I need suggest on the lines which are not covered in the trigger 
 
trigger GenQuoteApproval on QuoteLineItem (After Insert, After Update, After Delete) {

  Decimal LineMaxDiscount;
  Decimal LineMaxACV;
  Decimal SubLineMaxDiscount;
  Decimal SubLineMaxACV;
  Decimal SerLineMaxDiscount;
  Decimal SerLineMaxACV;
  Decimal TraLineMaxDiscount;
  Decimal TraLineMaxACV;
  Map<ID, Quote> ParentQuote = new Map<ID, Quote>();
  String SALREPID;
  String MRGID;
  String SALID;
  String CFOID;
  String SERID;
  String TRAID;
  String Level;
  Integer GSublevel1Count;
  Integer GSublevel2Count;
  Integer GSublevel3Count;
  Integer GSublevel4Count;
  Integer GSerlevel1Count;
  Integer GSerlevel2Count;
  Integer GSerlevel3Count;
  Decimal SubscriptionTerm;
  Integer GTralevel1Count;
  Integer GTralevel2Count;
  Integer GTralevel3Count;
 
Try 
{
if ( Trigger.isAfter)
  {
 List<Id> listIds = new List<Id>();
 //Set<Id> listIds = new Set<Id>();

 List<Quote> QuotetList = new List<Quote>();

 /* Get Quote ID */
 for (QuoteLineItem childquoteline :  Trigger.new)
 {
        listIds.add(childquoteline.QuoteId);
    }

 ParentQuote = new Map<Id, Quote>([SELECT id,Level_1__c,Level_2__c,Level_3__c,Level_4__c FROM Quote WHERE ID IN :listIds]);


  /* Get service list of all quote id */
  list<id> serviceid = new list<id>();
  for(QuoteLineItem getserviceid : [select id  from  QuoteLineItem
                                     where quoteid in :listIds and
                                           product2.Productcode  like 'CBSVC%'] )
   {
      serviceid.add(getserviceid.id);

   }

  /* Get subscription list of all quote id */
  list<id> subscriptionid = new list<id>();
  for(QuoteLineItem getsubscriptionid : [select id  from  QuoteLineItem
                                     where quoteid in :listIds and
                                           Subscription_Terms__c <> 0] )
   {
      subscriptionid.add(getsubscriptionid.id);

   }

 /* Subscription Discount and ACV */
    List<AggregateResult> MaxSubscription = [select max(Discount_Percent__c) SubQuoteLineMaxDiscount,sum(f_ACV__c) SubQuoteLineMaxACV
                                                   from  QuoteLineItem
                                                   where quoteid in :listIds and Subscription_Terms__c <> 0 and
                                                         ID not in :serviceid
                                                 ];

  for (AggregateResult SubQuoteMaxDiscount : MaxSubscription)
  {
  SubLineMaxDiscount = (Decimal)SubQuoteMaxDiscount.get('SubQuoteLineMaxDiscount');
  SubLineMaxACV = (Decimal)SubQuoteMaxDiscount.get('SubQuoteLineMaxACV');
  }

   system.debug('Subscription Line Discount  :' + SubLineMaxDiscount);
   system.debug('Subscription Line ACV  :' + SubLineMaxACV);

   /* Service Discount and ACV */
  List<AggregateResult> MaxService = [select max(Discount_Percent__c) SerQuoteLineMaxDiscount,SUM(f_ACV__c) SerQuoteLineMaxACV
                                      from  QuoteLineItem
                                      where quoteid in :listIds and product2.Productcode  like 'CBSVC%' and
                                            id not in :subscriptionid];

  for (AggregateResult SerQuoteMaxDiscount : MaxService)
  {
  SerLineMaxDiscount = (Decimal)SerQuoteMaxDiscount.get('SerQuoteLineMaxDiscount');
  SerLineMaxACV = (Decimal)SerQuoteMaxDiscount.get('SerQuoteLineMaxACV');
  }

   system.debug('Service Line Discount  :' + SerLineMaxDiscount);
   system.debug('Service Line ACV  :' + SerLineMaxACV);
   
   
   /* Training Discount and ACV */
  List<AggregateResult> MaxTraining = [select max(Discount_Percent__c) SerQuoteLineMaxDiscount,SUM(f_ACV__c) TraQuoteLineMaxACV
                                      from  QuoteLineItem
                                      where quoteid in :listIds and product2.Productcode  like 'T%' and
                                            id not in :subscriptionid];

  for (AggregateResult TraQuoteMaxDiscount : MaxTraining)
  {
  TraLineMaxDiscount = (Decimal)TraQuoteMaxDiscount.get('TraQuoteLineMaxDiscount');
  TraLineMaxACV = (Decimal)TraQuoteMaxDiscount.get('TraQuoteLineMaxACV');
  }

   system.debug('Training Line Discount  :' + TraLineMaxDiscount);
   system.debug('Training Line ACV  :' + TraLineMaxACV);
   

  Opportunity Opp = [select ownerid
                    from opportunity
                    where
                    id in (select OpportunityId from quote where id in :listIds) ];

  system.debug(listIds);
  
  SubscriptionTerm = ApprovalUtils.GetSubscriptionTerm(listIds);
  

  system.debug('Get New Subscription Term' + SubscriptionTerm);
  
  /* Get Manager ID */
  User Usr = [select managerid from user where id = :opp.ownerid];

 /* Subscription Query to get level 1..4 values */
   if ( SubscriptionTerm != null &&
        SubLineMaxACV != null &&
        SubLineMaxDiscount != null)
   {
       GSublevel1Count = ApprovalUtils.SubLevel1(SubscriptionTerm , SubLineMaxACV , SubLineMaxDiscount);

       system.debug('Subscription Level1 :' + GSublevel1Count);

       GSublevel2Count = ApprovalUtils.SubLevel2(SubscriptionTerm , SubLineMaxACV , SubLineMaxDiscount);

       system.debug('Subscription Level2 :' + GSublevel2Count);

       GSublevel3Count = ApprovalUtils.SubLevel3(SubscriptionTerm , SubLineMaxACV , SubLineMaxDiscount);

       system.debug('Subscription Level3 :' + GSublevel3Count);

       GSublevel4Count = ApprovalUtils.SubLevel4(SubscriptionTerm , SubLineMaxACV , SubLineMaxDiscount);

       system.debug('Subscription Level4 :' + GSublevel4Count);

        
   }    
   
      /* Service Query to get level 1..4 values */
   if (SerLineMaxACV != null && SerLineMaxDiscount != null)
    {
       GSerlevel1Count = ApprovalUtils.SerLevel1(SerLineMaxACV,SerLineMaxDiscount);

       system.debug('Service Level1 :' + GSerlevel1Count);

        GSerlevel2Count = ApprovalUtils.SerLevel2(SerLineMaxACV,SerLineMaxDiscount);

       system.debug('Service Level2 :' + GSerlevel2Count);

        GSerlevel3Count = ApprovalUtils.SerLevel3(SerLineMaxACV,SerLineMaxDiscount);

       system.debug('Service Level3 :' + GSerlevel3Count);
    } 
    
        /* Training Query to get level 1..4 values */
   if (TraLineMaxACV != null && TraLineMaxDiscount != null)
    {
        GTralevel1Count = ApprovalUtils.TraLevel1(TraLineMaxACV,TraLineMaxDiscount);

       system.debug('Training Level1 :' + GTralevel1Count);

        GTralevel2Count = ApprovalUtils.TraLevel2(TraLineMaxACV,TraLineMaxDiscount);

       system.debug('Training Level2 :' + GTralevel2Count);

        GTralevel3Count = ApprovalUtils.TraLevel3(TraLineMaxACV,TraLineMaxDiscount);

       system.debug('Training Level3 :' + GTralevel3Count);
    }
   
   If( GSublevel1Count >= 1  || GSerlevel1Count >= 1 ||  GTralevel1Count >= 1 )
     {
      SALREPID = Opp.OwnerId;
      SERID = '0053400000839zg';
      TRAID = '00580000006GbpI';
      }   
     
     
    If (GSublevel2Count >= 1 || GSerlevel2Count >= 1 || GTralevel2Count >= 1 )
    {
      SALREPID = NULL;
      MRGID = Usr.managerid;
      SERID = '0053400000839zg';
      TRAID = '00580000006GbpI';
    }
       
    
    /* Future here you may have to change for amount > 1000000 if its going only to SVP */
   If ( GSublevel3Count >= 1 || GSerlevel3Count >= 1 || GTralevel3Count >= 1)
      {
      SALREPID = NULL;
      MRGID = Usr.managerid;
      SALID = '00580000007jaoA';
      SERID = '0053400000839zg';
      TRAID = '00580000006GbpI';
      }
      
    If ( GSublevel4Count >= 1 )
    {
    SALREPID = NULL;
    MRGID = Usr.managerid;
    SALID = '00580000007jaoA';
    CFOID = '00580000006HV0w';
    Level = '4sub';
    }  
  
    //system.debug('Which Level :' + Level);
    system.debug('Sales Rep :' + SALREPID);
    system.debug('Manager :' + MRGID);
    system.debug('Sales Ops :' + SALID);
    system.debug('CEO CFO :'  + CFOID);

for (QuoteLineItem gqtl : Trigger.new)
 {
   Quote MyParentQuote = ParentQuote.get(gqtl.QuoteId);

    MyParentQuote.Level_1__c = SALREPID;
    MyParentQuote.Level_2__c=MRGID;
    MyParentQuote.Level_3__c=SALID;
    MyParentQuote.Level_4__c=CFOID;
    MyParentQuote.Level_5_Service__c = SERID;
    MyParentQuote.Level_6_Training__c = TRAID;
 
  }

  update ParentQuote.values();

 }
}

catch(Exception e) {
    System.debug('The following exception has occurred: ' + e.getMessage());    
}
  
}
In trigger line 157 to 243 code is not covered in above trigger which is high lighting red in color below is the test class which i have written which is giving only 54% code coverage please suggest me how to get 100% code coverage 

Test class
@istest(seealldata=true)
public class ApprovalUtils_Test_New{
    @isTest(SeeAllData=true) // required for using the standard pricebook, unfortunately
    public static void ApprovalUtilsTest() {
        Decimal SubscriptionTerm;
        
                 ApprovalUtils.SubLevel1(1,0,0);
                 ApprovalUtils.SubLevel2(1,0,10);
                 ApprovalUtils.SubLevel3(1,0,11);
                 ApprovalUtils.SubLevel4(1,0,41);
               
                 ApprovalUtils.SerLevel1(1,1);
                 ApprovalUtils.SerLevel2(1,10);
                 ApprovalUtils.SerLevel3(1,41);
                 
                 ApprovalUtils.TraLevel1(1,1);
                 ApprovalUtils.TraLevel2(1,10);
                 ApprovalUtils.TraLevel3(1,41);
                 
        
      Profile pf = [SELECT Id FROM Profile WHERE Name='Standard User']; 
      
       User u2 = new User(Alias = 'newUser', Email='newuser@testorg.com', 
         EmailEncodingKey='UTF-8', LastName='Testing', LanguageLocaleKey='en_US', 
         LocaleSidKey='en_US', ProfileId = pf.Id, 
         TimeZoneSidKey='America/Los_Angeles', UserName='newuser@testorg.com');         
                 
        Account a = new Account(Name = 'Test Account');
        insert a;

        Opportunity o = new Opportunity(Name = 'Test Opp', StageName = 'Test Stage', CloseDate = Date.today(), AccountId = a.Id);
        insert o;

        Pricebook2 pb = [select Id from Pricebook2 where IsStandard = true limit 1];

        Product2 p = new Product2(Name = 'T-Product', isActive = true);
        insert p;

        PricebookEntry pbe = new PricebookEntry(Pricebook2Id = pb.Id, Product2Id = p.Id, UnitPrice = 1, isActive = true);
        insert pbe;

        Quote q = new Quote(Name = 'Test Quote', OpportunityId = o.Id, PriceBook2Id = pb.Id);
        insert q;

        QuoteLineItem qli = new QuoteLineItem(QuoteId = q.Id, PriceBookEntryId = pbe.Id, Quantity = 1, UnitPrice = 100,
                       Subscription_Terms__c=1,Number_of_Nodes__c=1);
        insert qli;
        
                     
    }
     
    }


Thanks
Sudhir
 
  • September 07, 2016
  • Like
  • 0
hi,

i have set the OWD to public read/write and  profile is read only .  i have a sharing rule ( with read/ write)in which  user A wants to share that record to the another user B (in the same profile) .here i have doubt is whether the second user can edit the records or not.

1)and my secod question is profile over rides the OWD....? 

 
Hi,

I have a field on Opportunity (parent_opportunity_owner) that needs to be updated with the parent opportunity owner(opportunity has a lookup relationship with opportunity using opportunity_parent field). I need to achieve this using a trigger. Can anyone help me out. Thanks in advance.
Please help, I have 50% coverage for the trigger below. However, I am receiving the following error and nor do I know if I'm writing the correct test class: 

System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, RollupEnrollmentCount: execution of AfterInsert
caused by: System.NullPointerException: Attempt to de-reference a null object
Trigger.RollupEnrollmentCount: line 43, column 1: []
_____________________________

trigger RollupEnrollmentCount on DJEnrollment__c (after insert, after update, after delete) {

     Set<Id> CampaignIds = new Set<Id>();
   
   if(Trigger.isDelete) {
     for(DJEnrollment__c test:Trigger.Old) {
      
        CampaignIds.add(test.EnrollClass_Name__c);   
    
    }   
   
   }
   else
   if(Trigger.isUpdate) {

     for(DJEnrollment__c test:Trigger.New) {
      
        CampaignIds.add(test.EnrollClass_Name__c);   
    
     }

     for(DJEnrollment__c test:Trigger.Old) {
      
        CampaignIds.add(test.EnrollClass_Name__c);   
    
     }   
   
   }
   else
   {
     for(DJEnrollment__c test:Trigger.New) {
      
        CampaignIds.add(test.EnrollClass_Name__c);   
    
     }
   }

    AggregateResult[] groupedResults = [SELECT count(id)enrollmentCount, EnrollClass_Name__c FROM DJEnrollment__c WHERE EnrollClass_Name__c in :CampaignIds GROUP BY EnrollClass_Name__c];
    
    Map<id,Campaign> campaignMap = new Map<Id,Campaign>([SELECT id, Class_Total_Enrollments__c FROM Campaign WHERE Id in :CampaignIds]); 
    
    for(AggregateResult ar: groupedResults) {
          campaignMap.get((Id)ar.get('EnrollClass_Name__c')).Class_Total_Enrollments__c = (decimal) ar.get('enrollmentcount');
    }
    
    try {
        update campaignMap.values();
    }   catch(DmlException e) {
        System.debug(e.getMessage());
    }

}
Hello,

I am system admin , when i try to deploy something, i get below errors

A_test.mytest System.DmlException: Insert failed. First exception on row 0; first error: INVALID_CROSS_REFERENCE_KEY, Record Type ID: this ID value isn't valid for the user: 012b0000000TmUJAA0: [RecordTypeId] 
A__test.mytest: line 18, column 1

B_delete_test.mytest1 System.DmlException: Insert failed. First exception on row 0; first error: INVALID_CROSS_REFERENCE_KEY, Record Type ID: this ID value isn't valid for the user: 012b0000000TmUJAA0: [RecordTypeId] Class.B_delete_test.mytest1: line 17, column 1

I wonder what can be exact reason ?

Hello,

When i click on Send email like below

User-added image
To:  always let ypu choose from the Contact. 
Is it possiblechange the object to Other custom object. and also the field type

Class:-

public with sharing class MyLoginController{
private ApexPages.StandardController controller;
public Login__c login{get;set;}
public id loginId{get;set;}


//constructor
public MyLoginController(ApexPages.StandardController controller) {
 this.controller=controller;
 this.login= (Login__c)Controller.getRecord();
 System.debug('@@@@@'+login.Id);


}



//Login method when user clicks on login button
public ApexPages.PageReference LoginMethod() {
system.debug('&&&&&&&&'+login);

loginId = [SELECT Id FROM Login__c 

                      WHERE Name =: login.Name].Id;
string password = [SELECT password__c FROM Login__c 

                      WHERE Name =: login.Name].password__c;
                      
             system.debug('!!!!!!!!'+login.Name);
           
       
        
        system.debug('@@@'+password);
        
        if(login.password__c==password) {
        system.debug('%%%%%%');
        PageReference redirectPage = new PageReference ('/apex/Nomination_msg');
        //redirectPage.setRedirect(true);
        //redirectPage.getParameters().put('id',controller.getId());
        
        return redirectPage;
        }
        else{

        login.Name.addError('Incorrect username or password.Please Enter correct value.');
        return null;
        }


}



//save method when user clicks on save button on nomination msg page
public pagereference save(){
login__c l= [select name,password__c,First_Name__c,Last_Name__c,age__c,Email__c,Country_of_user__c from login__c where id =: loginId ];
l.First_Name__c=login.First_Name__c;
l.Last_Name__c=login.Last_Name__c;
l.age__c=login.age__c;
l.Email__c=login.Email__c;
l.Country_of_user__c=login.Country_of_user__c;
update l;
try{
       system.debug('Entered into the Method');
    PageReference redirectPage = new PageReference ('/apex/successful_msg');
        return redirectPage;
             return null;
                }
    Catch(Exception dmle){
    ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR,'Error'));
    //ApexPages.addMessages(dmle);
    //ApexPages.addMessage(myMsg);
    return null;
    } 
    }           




//signup method when the user clicks on signup button on login page
public pagereference signup() {
Pagereference pg=new Pagereference('https://ap2.salesforce.com/066280000027Mwq');
try{
system.debug('@@@###$$$$%%%%');
  PageReference redirectPage = Page.SignupPage;
               redirectPage.setRedirect(true);
                 return redirectPage;
              }
                 
      Catch(Exception dmle){
    ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR,'Error'));
    //ApexPages.addMessages(dmle);
    //ApexPages.addMessage(myMsg);
    }          
return null;
}




//submit method when the user clicks on submit button on signup page
public pagereference Submit(){
login__c lp=new login__c();
lp.Name=login.Name;
lp.password__c=login.password__c;
lp.RePassword__c =login.RePassword__c ;
try{
 PageReference redirectPage = new PageReference ('/apex/Nomination_msg_a');
       system.debug('Entered into the Method');
          if(login.Password__c == login.Repassword__c) {
               Insert lp;
                return redirectPage;
                }
                else {
                login.Repassword__c.adderror('Please enter correct password');
                redirectPage.setRedirect(false);
                return null;
                }
                }
    Catch(Exception dmle){
    ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR,'Error'));
    //ApexPages.addMessages(dmle);
    //ApexPages.addMessage(myMsg);
    return null;
    } 
}





//savesignup method when user clicks on save option on Nomination_msg_a page
public pageReference savesignup(){
loginId = [SELECT Id FROM Login__c WHERE Name =: login.Name].Id;
login__c log=[select name,password__c,First_Name__c,Last_Name__c,Age__c,Email__c,Country_of_user__c, id from login__c where id =: loginid];
log.First_Name__c=login.First_Name__c;
log.Last_Name__c=login.Last_Name__c;
log.Age__c=login.Age__c;
log.Email__c=login.Email__c;
log.Country_of_user__c=login.Country_of_user__c;
update log;
system.debug('&&&&&&&'+log);
try{
 
       system.debug('Entered into the Method');
       
            PageReference redirectPage = new PageReference ('/apex/successful_msg');
                return redirectPage;
                }
                
    Catch(Exception dmle){
    ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR,'Error'));
    //ApexPages.addMessages(dmle);
    //ApexPages.addMessage(myMsg);
    return null;
    } 


}

Test class:-

@isTest(SeeAllData=false)

public class MyLoginControllerTest{

static List<login__c > Lstlogs = new List<login__c >();

static testMethod void testMyLoginController(){
test.startTest();

login__c login=new login__c();
login.Name='Testing';
login.Password__c='sss';
login.RePassword__c='sss';
login.First_Name__c ='Shruthi GM';
login.Last_Name__c ='GM';
login.age__c =12;
login.Email__c ='shruthi.gm@gmail.com';
login.Status__c='Registration Complete';
login.Country_of_user__c ='India'; 
insert login;



ApexPages.StandardController sc = new ApexPages.StandardController(login);
MyLoginController mec = new MyLoginController(sc);
ApexPages.currentPage().getParameters().put('id',login.id);

 mec.LoginMethod();
 mec.signup();
 mec.submit();
 mec.save();
 mec.savesignup();

Test.stopTest();


}
}

Test class is covering 60% with System.QueryException: List has more than 1 row for assignment to SObject error msg near the line "mec.savesignup();".How do I need to rectify this error?Please help.
Hello Everyone,

I am creating a picklist field with 5 different values, where while adding the value, for each specific value I am adding a description in the decription field (which we get while adding a picklist value); In that description field, I need to add another field value and that should be displayed when user select a specific value from the pikclist dropdown, than in hover details, the user should be able to see the description data + the field value.

Example:
In Opportunity, when we select a value say "Closed Won" and if we hover the details for "Closed Won" than we should get the details as " You won this Opportunity on 17 May 2016".

So here 17 May,2016 is another field on Opportunity whoes details are displayed in the hover detail of stage field when user select a specific value.

Can someone please assist whether this is possible with the standard functionality or need a Trigger?

Thanks in advance!
Heena
Hi,

Can anyone please help me differentiate between the above meanings. Appreciate your help.

Thanks
Hi
I need to Sort entries of quoteLineItemList by PriceBookEntry.Product2.Product_Family__r.Sort_Order__c and PriceBookEntry.Product2.ProductCode and then store the sorted list in orderedLineItem.

How can I do this using apex code.


 
Hi, 

I am experiencing an error In Lightning Experience but not in salesforce classic.

 User-added image

Basically on click of a custom button, I am creating a Lead Record and then redirecting the user to the Lead edit Page and then use Save URl to take the user to the detail page. 

I read about collision detection and to bring to your notice, we are not using any Sales path, nor any batch is updating records.

Strangely the error is being displayed stating that record is being updated my user itself. 

Also this is not happening in Salesforce classic. 

Any help would be greatly appreciated.

Thanks in Advance 
Medhya
Hi guys,
if i insert or update 1 account i need to create 5 contacts to that account Using Trigger how can approach this one 
can anyone help me out if possible send me code 
Advance Thanks
Am I am able to simply create a new change set with the missing piece and then delopy that in production or do I have to start all over?  I am new to change sets and am creating one with customer objects, flows, report and record types, approval processes, and an apex trigger. I have been working on this in sandbox for month and months. There is a chance that I may have forgot something.  I think I have it all. But, if I do not, what can be done?  Thanks!
public  class Notificationserviceclass {
List<Notification__c> notifylist1 = new list<Notification__c>();
List<Notification__c> notifylist2 = new list<Notification__c>();
public void onAfterInsert(Account[] newAccounts){
for(Account accname:newAccounts)
{
Notification__c notifyvar=new Notification__c();
notifyvar.name=accname.name;
notifyvar.Action__c='Add';
notifylist2.add(notifyvar);
}
insert notifylist2;
}
public void onAfterUpdate(Account[] newAccounts, map<id, Account> oldMap ){
 
for(Account Acc:newAccounts){
 
 Account oldname = oldMap.get(Acc.Id);
 
if(Acc.name!=oldname.name){
 
Notification__c memb = new Notification__c();
 
memb.name=Acc.name;
 
       memb.Action__c= 'Modify';
 
       notifylist1.add(memb);
 
       }
 
       if(notifylist1.size()>0 && notifylist1.size()!=null)
 
       {
 
       insert notifylist1;
 
       }
 
       }
 
     }
 
       }
 
Hi All,
I'm getting the following error while inserting quote in a test class :
System.DmlException: Insert failed. First exception on row 0; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, List has no rows for assignment to SObject: []
Please find the test class appended herewith :
@istest(SeeAllData=true)  private class TestSubmitforQuoteApproval {             static testmethod void test() {        Test.startTest();                   //Account acc = [select Id from Account limit 1];                   Opportunity oppr = new Opportunity();           //oppr.AccountId = acc.ID;           oppr.Annual_Contract_Value_ACV__c = 111;           oppr.BU__c = 'MJ';           oppr.CloseDate = Date.today();           oppr.Contract_Opportunity_Estimate_CoE__c = 111;           oppr.Total_Contract_Value_TCV__c = 111;            oppr.Name = 'SubmitforQuoteApproval';            oppr.StageName = 'Prospecting';             oppr.Date_on_Opportunity_Prospecting_Stage__c = Date.today();             //oppr.UpdatedForReminderToApprover__c = Date.today();           insert oppr;                      Quote quot = new Quote ();           quot.Name = 'TestPropForSandbox2016-1';            //quot.Status ='Draft';           quot.OpportunityId = oppr.id ;           insert quot;
}
}

Any help towards resolving this issue will be much appreciated

Thanks & Rgards,

Debendra Ray
hi all,
In Account object picklist called Rating..
in rating picklist when i select value called Hot than after save.
in detailed page i want to hide or read only for fields as 
Billing Street and Billing City.
no need any code.

please help for this.


regards,
Nandireddy Nagarjuna Reddy
How to write a test class for the below class
public with sharing class GSDASDPHPEAccountTeam {
    public GSD_Account_Success_Delivery_Plan__c mainAcctID;
    public GSDASDPHPEAccountTeam(ApexPages.StandardController std)
    {
        mainAcctID = [select id, Account__c, Related_To_Account_Business_Plan__c,Related_To_Account_Business_Plan__r.primary_accountaccount__c from GSD_Account_Success_Delivery_Plan__c where id = :std.getId()];
    }
   
    public list<HPE_Account_Team__c> getHPEAccountTeam(){
        return [select Name, Account__r.Name,Name__r.Name, Phone__c, Email__c, Role__c, Role_Scope__c, Role_Scope_Description__c from HPE_Account_Team__c where Account__c = : mainAcctID.Account__c];
    }
    
}

 

I need custom picklist fields on Account to be autopopulated on creating New Account. I have written trigger for this. It is working on before update but not working for Before insert. Please help.
User-added image
Hai, I have two object named Employee and visit, here Employee is a lookup. In Employee I have one field called job time and in Visit the field name is last visit(both fields are in number type). I need to poulate the value of job time in last visit.how should I do that someone tells me use formula type with same name and return type as number.I do the same using formula type but I can't get the result I wanted.What should I do?
 Hi,

I am relavively new to apex and triggers and this may sound a silly question.  How do I now make amendments to an existing class i have already deployed in production?
Do I amend it in sandbox and deploy the same class in a change set and it overrides the existing one?

Thanks
  • September 15, 2016
  • Like
  • 0
Hello guys,

Can anyone explain me this code.

<apex:page standardController="Opportunity" recordSetVar="accounts">
   <apex:form>
       <apex:selectList value="{!filterid}" size="1">
           <apex:selectOptions value="{!listviewoptions}"/>
       </apex:selectList>
       <apex:commandButton value="Go" action="{!list}"/>
   </apex:form>
</apex:page>
  • September 15, 2016
  • Like
  • 0
I want to update price to 100 of all Invoice Number whose status is 'open'.
Please help me write code.
  • September 08, 2016
  • Like
  • 0
All i'm trying to create a detail button that when clicked checks a checkbox.  I found some java script in one of the forums for this purpose, but am having trouble making it work.  I get an error "Cannot set property AECaseMgmt__Program_Case__c.Generate_Closing_Summary__c of undefined."  Any ideas?  Thanks.
{!REQUIRESCRIPT("/soap/ajax/30.0/connection.js")} 
var newRecords = []; 
var c = new sforce.SObject("AECaseMgmt__Program_Case__c"); 
c.id ="{!AECaseMgmt__Program_Case__c.Name}"; 
c.AECaseMgmt__Program_Case__c.Generate_Closing_Summary__c = true;
newRecords.push(c); 
result = sforce.connection.update(newRecords); 
window.location.reload();