• Proposal Button
  • NEWBIE
  • 0 Points
  • Member since 2010

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 31
    Questions
  • 23
    Replies

Hi

 

I am moving my new objects,code,pages from test environment to production. I have around 8 objects and each object have number of new fields. If i add the profiles along with the new objects from force.com IDE to production does the field level security  also moves to production? 

 

Appreciate if you can anyone answer for this as i have a deployment scheduled tomorrow.

Hi

 

I am moving my new objects,code,pages from test environment to production. I have around 8 objects and each object have number of new fields. If i add the profiles along with the new objects from force.com IDE to production does the field level security  also moves to production? 

 

Appreciate if you can anyone answer for this as i have a deployment scheduled tomorrow.

Hi All

 

I was trying to validate the deployment. Added  some new  objects, existing objects which are been updated,VF pages,Apex class,Triggers through change set and it is throwing me the governor limits and test coverage limt.

 

But, If i am validating through Force.Com IDE the same changes it is showing success without any errors. Why it is throwing the error in change set and why not in Force.COM IDE Eclipse?

 

I have a release scheduled next week. I am bit worried how does my code act in production if i move through eclipse as it is throwing governor limits error while deploying through change set.

 

Can anyone please let me know why it is getting failed in change set and not in force.com IDE?

 

 

Hi All

 

i was trying to deploy the new code created as well as some changes made in the existing standard objects. I added new apex code,test class,VF page,Some standard objects and some new custom objects. When i am trying to deploy the code through force.com.IDE(Eclipse) this is the error it is throwing. Can you please help me out if you have any idea of this error. I attached the log for your reference

 

File Name:    objects/Opportunity.object   

Full Name:  Opportunity.Quotas   

Action:  NO ACTION   

Result:  FAILED   

Problem: Required field is missing: businessProcess

Hi All

 

i am trying to deploy a new project. I added all the new code,objects,pages,triggers as well as updated some existing code,objects and triggers. Here is the error it is throwing while i am deploying my changes to production.

 

Opportunity.Quotas  Required field is missing: businessProcess

 

Any help or idea will be greatly appreciated.

Hi Guys

 

Please help me out in writing a test class for the following contoller. I am calling this controller in a VF page. Here is my apex class. I am just attaching some part of my class so if i get the test class for the below code i can use this as a reference and i can write for the remeining part of the class. Appreciate your help

 

public class SSOWcontroller {

 private final SSOW__c ssow;
 private final HVoIP__c hvoip;
 private final VoIP__c voip;
public SSOWcontroller(ApexPages.StandardController stdController) {
 ssow = [ Select Id, IsDeleted, Name, CreatedDate, CreatedById, LastModifiedDate, LastModifiedById,
        SystemModstamp, Site_City__c, Site_State__c, Site_Street__c, Site_Thoroughfair__c, Site_Zip_Code__c,
  NPA_NXX__c, Division__c, Primary_Contact__c FROM SSOW__c WHERE ID = :ApexPages.currentPage().getParameters().get('id')];
 hvoip = [ Select Id, OwnerId, IsDeleted, Name, CreatedDate, CreatedById, LastModifiedDate,
        LastModifiedById, SystemModstamp, Qualifying_Product__c, Did_you_ensure_that_hosted__c,
        Did_you_indicate_the_quantity__c, Did_you_ensure_that_the_bandwidth__c FROM HVoIP__c  WHERE SSOW__c = :ssow.id];
 voip = [ Select Id, OwnerId, IsDeleted, Name, CreatedDate, CreatedById, LastModifiedDate, LastModifiedById,
        SystemModstamp, Qualifying_Product__c, Did_you_ensure_that_Voip_and_Data__c, Own_public_IP_Space__c,
        Routing_protocol_other_than_Static__c FROM VoIP__c WHERE SSOW__c = :ssow.id];

}
  
 public SSOW__c getssow()    {
        return ssow;
    }
    public HVoIP__c gethvoip()    {
        return hvoip;
    }  
    public VoIP__c getvoip()    {
        return voip;
    }  
 private void saveallobjects() {
        update ssow;
        update hvoip;
        update voip;
 }
 public PageReference saveAll() {
        saveallobjects();
         PageReference pr4 = new PageReference('/apex/SmartSOW?Id=' + ssow.Id);
        pr4.setRedirect(true);
        return pr4; 
    } 

 

 

 

Hi All

 

I wrote a simple trigger on case. I am able to save the trigger but it is not working when i am updating the records. I have a checkbox on Case whenever this checkbox becomes true the checkbox in CAF(Custom object) should become true. For this i wrote this trigger. I think i had made mistake in the where clause of the SOQL query. I am mentioning in Red. Please let me know. the relation between CAF__c and Case is lookup.

 

trigger CAFoppUpadate1 on Case (after update)
{
List <CAF__c> CAFList;
List <Id> CaseIdList = new List <Id>();
for(Case c:Trigger.new)
{
    if (c.Closed_won_opportunity__c == True)
     caseIdList.add(c.Id);
 }  
CAFList = [select Id, test_caf__c from CAF__c where ID in :Caseidlist];

    for(CAF__c ca : CAFList)
    {
        if (ca.test_caf__c != true)
            ca.test_caf__c = true;    
    }
    
    update CAFList;
}

Hi All

 

I am writing a test class for a Apex class. It only covered 12% of the apex class. Here is my apex class and i mentioned in Red the part of the class covered and the part in blue is not covered. I am new to writing the test classes

 

public with sharing class accountCreditApprovalController {
  Private string comment = '';
    public String acId= ApexPages.currentPage().getParameters().get('acId');
    public Account_Credit__c ac;
    public accountCreditApprovalController(){
      ac = [select Id, Name, Account__c, Credit_Status__c, Associated_TN__c, Credit_Reason__c,

           Department_Responsible__c, Requested_Credit_Amount__c, Credit_Reason_Comments__c, 
           Account__r.Name from Account_Credit__c where id= :acId];  
    }
    public Account_Credit__c getAc(){
        return ac; 
    }
    public string getComment(){
        return comment;
    }
    public void setComment(string Value){
        comment= Value;
    }
    public PageReference reject1() {
        PageReference pr = null;
        try{        
            ProcessInstanceWorkitem piwi = [Select ProcessInstance.Status, ProcessInstance.TargetObjectId, ProcessInstanceId,OriginalActorId,Id,ActorId From ProcessInstanceWorkitem
            where ProcessInstance.TargetObjectId = : acId and ProcessInstance.Status = 'Pending' and OriginalActorId =: UserInfo.getUserId() order by CreatedDate desc limit 1]; 
            system.debug('---Piwi---' + piwi);
            Approval.ProcessWorkitemRequest req = new Approval.ProcessWorkitemRequest();
            req.setComments(comment);
            req.setAction('Reject');
            req.setWorkitemId(piwi.Id);
            // Submit the request for approval      
            Approval.ProcessResult result =  Approval.process(req);        
            //pr = new PageReference('/home/home.jsp');
            pr = new PageReference('/apex/mobileApprovalList?sfdc.tabName=01r40000000LnKP');
        }
        catch(Exception ex){
            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR,ex.getMessage()));
        }
        return pr;
    }
    public PageReference approve1(){
        PageReference pr = null;
        try{  
            ProcessInstanceWorkitem piwi = [Select ProcessInstance.Status, ProcessInstance.TargetObjectId, ProcessInstanceId,OriginalActorId,Id,ActorId From ProcessInstanceWorkitem
            where ProcessInstance.TargetObjectId = : acId and ProcessInstance.Status = 'Pending' and OriginalActorId =: UserInfo.getUserId() order by CreatedDate desc limit 1];    
            system.debug('---Piwi---' + piwi);
            Approval.ProcessWorkitemRequest req = new Approval.ProcessWorkitemRequest();
            req.setComments(comment);
            req.setAction('Approve');
            req.setWorkitemId(piwi.Id);
            // Submit the request for approval      
            Approval.ProcessResult result =  Approval.process(req);
            //pr = new PageReference('/home/home.jsp');
            pr = new PageReference('/apex/mobileApprovalList?sfdc.tabName=01r40000000LnKP');
        }
        catch(Exception ex){
            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR,ex.getMessage()));
        }
        return pr;
    }     
}

 

Here is my Test class

 

 

@IsTest
private class testaccountCreditApproval
{
    static testmethod void testaccountcreditApproval()
    {
        accountCreditApprovalController acc = new accountCreditApprovalController();
        User user = [SELECT Id FROM User WHERE IsActive = true LIMIT 1];
        Account_Credit__c accac = new Account_Credit__c();
       
        accac.Credit_Status__c= 'Drafting';
        accac.Credit_Reason__c= 'Provisioning Issue';
        accac.Requested_Credit_Amount__c= Decimal.valueOf(1000);
        insert accac;
        
       }
       static testmethod void testPageReferencereject1() 
       {
           ProcessInstanceWorkitem piwi= new processInstanceworkitem();
           piwi.ProcessInstance.Status= 'Pending';
           piwi.ProcessInstance.TargetObjectId= '0014000000IA6n3';
           
           insert piwi;
           Approval.ProcessWorkitemRequest req = new Approval.ProcessWorkitemRequest();

 

}

}

Hi All I wrote a trigger and test class for that but when i run a test its give me following error

 

System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, UpdateOpportunitySOW: execution of AfterInsert caused by: System.NullPointerException: Attempt to de-reference a null object Trigger.UpdateOpportunitySOW: line 17, column 8Class.TriggerTests.Scope_Of_Work: line 148, column 10 External entry point

 

My trigger is 

 

trigger UpdateOpportunitySOW on Scope_Of_Work__c (after insert, after update)
{
List<id> oppIds=new List<id>();
for (Scope_of_Work__c sow : trigger.new)
{
   oppIds.add(sow.opportunity__c);
}
Map<Id, Opportunity> oppsById=new Map<Id, Opportunity>();
List<Opportunity> opps= [select id, SOW__c from Opportunity WHERE id in :oppIds];
oppsById.putAll(opps);

List<Opportunity> oppsToUpdate=new List<Opportunity>();
for (Scope_of_Work__c sow : trigger.new)

   {   
       Opportunity opp=oppsById.get(sow.Opportunity__c);
       opp.SOW__c = sow.id;
       oppsToUpdate.add(opp);
   }

update oppsToUpdate;
}

 

 

AND test class is 

 

  static testMethod void Scope_Of_Work()
     {
         Account acct = new Account(Name='Test Account', Type='Standard Account', Main_BTN__c='(123)456-7654', ShippingStreet='123 Test St', ShippingCity='Dallas', ShippingState='Tx', ShippingPostalCode='75050',
         BillingStreet='123 Test St\napt300', BillingCity='Dallas', BillingState='Tx', BillingPostalCode='75050');
         insert acct;
         
         Opportunity o = new Opportunity(Name='Test Opp1', AccountId=acct.Id, Scope_of_Work__c='Test', StageName='New', Proposal_Issued_Date__c=Date.Today(),CloseDate=System.today());
         insert o;
        
         Contact cont = new Contact (FirstName='Contact', LastName='1', Phone='123-432-4356', AccountId=Acct.Id, Contact_Type__c='Finance/Credit;On-Site Coordinator');
         insert cont;
 
         Scope_Of_Work__c sow = new Scope_Of_Work__c(Products_Sold__c='VPN',IT_Contact__c= cont.Id);
         insert Sow;
         
         }

Hi All

 

I had created a VF email template. I assigned this template to one of my approval process and it worked perfectly in sandbox. I moved it to production along with the controller and a component. But in production when i assign this template to one of my approval process and when i create a record matching the criteria of the approval process i am not able to receive the email. the email which i suppossed to receive is the VF email template. But i a m not receiving any email and also my approver is not geeting any records in the home page(Items to approve). Can you please let me know why this is happening it is working perfectly in sanbox but not in production. I enabled the apex controllers to the profiles who were using this VF template in production. please let me know on this.

Hi

 

I am bit confused inw riting a test class for the following trigger. Please help me out in this

 

trigger PerfMetricUpdate on Performance_Metric__c (after update) 
{
  Performance_Metric__c[] pm = Trigger.new;
  
  if(pm[0].Monthly_Recurring_Other_Quota__c != Trigger.oldMap.get(pm[0].Id).Monthly_Recurring_Other_Quota__c ||
  pm[0].Monthly_Recurring_Data_Quota__c != Trigger.oldMap.get(pm[0].Id).Monthly_Recurring_Data_Quota__c ||
  pm[0].Monthly_CPE_Revenue_Quota__c != Trigger.oldMap.get(pm[0].Id).Monthly_CPE_Revenue_Quota__c ||
  pm[0].Monthly_Recurring_Other_Amt_Attained__c != Trigger.oldMap.get(pm[0].Id).Monthly_Recurring_Other_Amt_Attained__c ||
  pm[0].Monthly_Recurring_Data_Amt_Attained__c != Trigger.oldMap.get(pm[0].Id).Monthly_Recurring_Data_Amt_Attained__c ||
  pm[0].Monthly_CPE_Revenue_Amt_Attained__c != Trigger.oldMap.get(pm[0].Id).Monthly_CPE_Revenue_Amt_Attained__c ||
  pm[0].Monthly_CPE_Margin_Quota__c != Trigger.oldMap.get(pm[0].Id).Monthly_CPE_Margin_Quota__c ||
  pm[0].Monthly_CPE_Margin_Amt_Attained__c != Trigger.oldMap.get(pm[0].Id).Monthly_CPE_Margin_Amt_Attained__c)    
  {
    //delete the existing Quota Reporting records for this performance metric
    Quota_Reporting__c[] deleteQR = [select id from Quota_Reporting__c where Performance_Metric__c = :pm[0].Id];
    delete deleteQR;
    
    //build the array
    Quota_Reporting__c[] insertQR = new Quota_Reporting__c[0];
      
    //start building the inserts of each type
    Quota_Reporting__c qr = new Quota_Reporting__c(Performance_Metric__c = pm[0].Id, Type__c='Rec Data', Amount__c = pm[0].Monthly_Recurring_Data_Amt_Attained__c);
    insertQR.add(qr);
      
    Quota_Reporting__c qr1 = new Quota_Reporting__c(Performance_Metric__c = pm[0].Id, Type__c='Rec Data - Quota', Amount__c = pm[0].Monthly_Recurring_Data_Quota__c);
    insertQR.add(qr1);
    
    Quota_Reporting__c qr2 = new Quota_Reporting__c(Performance_Metric__c = pm[0].Id, Type__c='Rec Other', Amount__c = pm[0].Monthly_Recurring_Other_Amt_Attained__c);
    insertQR.add(qr2);   
   
     Quota_Reporting__c qr3 = new Quota_Reporting__c(Performance_Metric__c = pm[0].Id, Type__c='Rec Other - Quota', Amount__c = pm[0].Monthly_Recurring_Other_Quota__c);
    insertQR.add(qr3);  
  
     Quota_Reporting__c qr4 = new Quota_Reporting__c(Performance_Metric__c = pm[0].Id, Type__c='Non Rec', Amount__c = pm[0].Monthly_CPE_Revenue_Amt_Attained__c);
    insertQR.add(qr4);  
  
     Quota_Reporting__c qr5 = new Quota_Reporting__c(Performance_Metric__c = pm[0].Id, Type__c='Non Rec - Quota', Amount__c = pm[0].Monthly_CPE_Revenue_Quota__c);
    insertQR.add(qr5);  
  
     Quota_Reporting__c qr6 = new Quota_Reporting__c(Performance_Metric__c = pm[0].Id, Type__c='Non Rec Margin', Amount__c = pm[0].Monthly_CPE_Margin_Amt_Attained__c);
    insertQR.add(qr6);  
   
      Quota_Reporting__c qr7 = new Quota_Reporting__c(Performance_Metric__c = pm[0].Id, Type__c='Non Rec Margin - Quota', Amount__c = pm[0].Monthly_CPE_Margin_Quota__c);
    insertQR.add(qr7);
   
     insert insertQR;
  }
}

 

 

Hi All

 

Can you please help me out in writter a test class for the following Trigger. Appreciate your help in advance

 

trigger CaseUpadate on Opportunity (after update)
{
List <Case> caseList;
List <Id> oppIdList = new List <Id>();
for(Integer i=0; i<Trigger.new.size(); i++)
{
    if (Trigger.new[i].StageName != Trigger.old[i].StageName && (Trigger.new[i].StageName == 'Closed Won' || Trigger.new[i].StageName == 'Closed - Dead/Lost'))
        
        oppIdList.add(Trigger.new[i].Id);
}   
caseList = [select Id, Opportunity_closed_won__c from Case where Opportunity__c in :oppIdList];
if (caseList.size() > 0)
{
    for(Case c : caseList)
    {
        if (c.Opportunity_closed_won__c != true)
            c.Opportunity_closed_won__c = true;    
    }
    
    update caseList;
    }
}

 

 

Hi

 

I created an custom object called Campaign Alert in that Account is lookup. There is a field in campaign alert called phone no and there is a field called Main BTN in account. If anyone gives the phone no in campaign alert it needs to search whether the phone no with BTN in account and that account needs to popup in the account field in the Campaign alert. I wrote this trigger and the trigger is saved but when i am search with phone no it is not throwing the account. Please let me know where did i went wrong

 

trigger relatedaccount on CampaignAlert__c (after insert, after update)
{
    Map<String, CampaignAlert__c> mapPhones = new Map<String, CampaignAlert__c>();
    for (CampaignAlert__c c: Trigger.new)
      { 
        if (c.phone_No__c != null) 
            {
            mapPhones.put(c.phone_No__c, c);
            }
      }

    List<String> listPhones = new List<String>();
    Map<String, Account> mapAccounts = new Map<String, Account>();
    for (list<Account> acts : [Select Id, Main_BTN__c from Account where Main_BTN__c in :listPhones]) 
        {
            for (Account act : acts) 
                {
                mapAccounts.put(act.Main_BTN__c, act);
                }
        }

    List<CampaignAlert__c> listCampaignAlerts = new List<CampaignAlert__c>();
    for (CampaignAlert__c c: mapPhones.values()) 
    {
        if(mapAccounts.get(c.phone_No__c)==null)
            continue;
        CampaignAlert__c ca = new CampaignAlert__c(Name = c.Name); 
        ca.Account__c = mapAccounts.get(c.phone_No__c).ID; 
        listCampaignAlerts.add(ca);
    }
    update listCampaignAlerts;
}

Hi I am bit confused in writting a test class for a controller. I called these controller in an component. Please help me out in writing a Test class for the following controller

 

public class CAFApprovalHistoryController {
    public String cafId {get;set;}
    public List<ProcessInstanceHistory> getApprovalSteps() {
      If (cafId != null) {
        CAF__c cafs = [Select Id, Name, CAPEX_Total__c, Off_Net_Circuit_Expense_Total__c, CAF_IRR__c, of_Revisions__c, Sales_Rep__c, Sales_Manager__c, Account__c, CAF_Title1_del__c, CAF_1__c, Products_Requested__c, Bandwidth__c, Notes_of_Consideration__c, CAF_Link__c, (Select TargetObjectId, SystemModstamp, StepStatus, RemindersSent, ProcessInstanceId, OriginalActorId, IsPending, IsDeleted, Id, CreatedDate, CreatedById, Comments, ActorId From ProcessSteps order by SystemModstamp desc) from CAF__c where Id = :cafId];
        return cafs.ProcessSteps;
      }
      return new List<ProcessInstanceHistory> ();
    } 
   }

 

Here is my component

 

 

<apex:component controller="CAFApprovalHistoryController" access="global">
    <apex:attribute name="cafId" assignTo="{!cafId}" type="String" description="Id of the CAF"/>  
    <apex:dataTable value="{!approvalSteps}" var="step">
 <td width="30%"> <apex:column value="{!step.SystemModstamp}" headerValue="Date"/> </td>
 <td width="30%"> <apex:column value="{!step.StepStatus}" headerValue="Status"/> </td>
 <td width="30%"> <apex:column value="{!step.OriginalActorId}" headerValue="Assigned To"/> </td>
 <td width="30%"> <apex:column value="{!step.ActorID}" headerValue="Actual Approver"/> </td>
 <td width="30%"> <apex:column value="{!step.Comments}" headerValue="Comments"/> </td>
        
    </apex:dataTable>
</apex:component>

 

Hi

 

I am trying to write a test class for the following controller. Here is my controller

 

public class CAFApprovalHistoryController {
    public String cafId {get;set;}
    public List<ProcessInstanceHistory> getApprovalSteps() {
      If (cafId != null) {
        CAF__c cafs = [Select Id, Name, CAPEX_Total__c, Off_Net_Circuit_Expense_Total__c, CAF_IRR__c, of_Revisions__c, Sales_Rep__c, Sales_Manager__c, Account__c, CAF_Title1_del__c, CAF_1__c, Products_Requested__c, Bandwidth__c, Notes_of_Consideration__c, CAF_Link__c, (Select TargetObjectId, SystemModstamp, StepStatus, RemindersSent, ProcessInstanceId, OriginalActorId, IsPending, IsDeleted, Id, CreatedDate, CreatedById, Comments, ActorId From ProcessSteps order by SystemModstamp desc) from CAF__c where Id = :cafId];
        return cafs.ProcessSteps;
      }
      return new List<ProcessInstanceHistory> ();
    } 
   }

 

Here is the test class i wrote and this the error it is throwing Error: Compile Error: line breaks not allowed in string literals at line 8 column -1. I mentioned the line 8 in Red

 

 

public class TestCAFApprovalHistory
{
    public static testMethod void testCAFApprovalHistory() 
         {      
        Test.startTest();
        PageReference result = Page.CAFApprovalHistory;
        Test.setCurrentPage(result);               
        CAF__c cf = new CAF__c(Name='Test', CAPEX_Total__c='$1000.00', Off_Net_Circuit_Expense_Total__c='$1000.00, CAF_IRR__c='25%', of_Revisions__c='0', Sales_Rep__c='Test', Sales_Manager__c='TestTest', Account__c='Test Account');
        insert cf;
        }
        }

 

Hi All

 

Can you please help me to write a test calss for the following code.

 

private void createOrderASOCs(Id orderId, Id accountId, QuoteLine__c[] orderASOCs){
        System.debug('In createOrderASOCs() Function');
        //******************** ASOCs ********************
        List<ASOCs__c> insertASOC = new List<ASOCs__c>();
        List<Maintenance_Plan__c> insertMaint =new List<Maintenance_Plan__c>();
        
        for(QuoteLine__c asoc:orderASOCs){
            System.debug('Looping Lines (ASOCS)');
            
            String tnId;
            Double currQTY=asoc.Quantity__c;
            
            if(asoc.Quote_Telephone_Number_Config__r!=null&&asoc.Quote_Telephone_Number_Config__r.size()>0){
                System.debug('Adding TN Level ASOCS');
                for(QuoteTelephoneNumberConfig__c orderTNs:asoc.Quote_Telephone_Number_Config__r){
                    tnId = tnMap.get(orderTNs.QuoteTelephoneNumber__r.Name);
                    System.debug('    Current TN ID:'+tnId);
                    
                    insertASOC.addAll(buildTNAsocs(tnId, orderId, asoc,1));
                    currQTY -=1;
                }
            }
            
            //********* Working with the Main BTN *********
            if(currQTY>0){
                System.debug('Adding BTN Level ASOCS');
                tnId = tnMap.get(mainBTN);
                
                System.debug('    Current BTN Id:'+ tnId);
                insertASOC.addAll(buildTNAsocs(tnId, orderId, asoc,currQTY));
            }
                        
            //Maintenance Plan
            if(asoc.MasterProduct__r!=null&&asoc.MasterProduct__r.QuantityType__c=='Maintenance Plan'){
                System.debug('Creating Maintenance Plan');
                Maintenance_Plan__c maintPlan = new Maintenance_Plan__c();
                
                maintPlan.Account__c = accountId;
                maintPlan.Order__c = orderId;
                
                maintPlan.Maintenance_Plan_Type__c = asoc.MasterProduct__r.Name;
                maintPlan.Monthly_Maintenance_Rate__c = asoc.Price__c;
                maintPlan.Contract_Term__c = asoc.Term__c;
                maintPlan.Contract_Start_Date__c = asoc.Quote__r.Contract_Start_Date__c;
                
                insertMaint.add(maintPlan);
            }
        }
        
        //PIC/IPIC
        if(otherASOCS!=null&&otherASOCS.size()>0){
            System.debug('Adding PIC and IPIC');
            
            for(ASOCs__c tmpASOC:otherASOCS){
                tmpASOC.Order__c=orderId;
                tmpASOC.Telephone_Number__c=tnMap.get(mainBTN);
                
                insertASOC.add(tmpASOC);
            }
        }
        
        if(insertASOC!=null&&insertASOC.size()>0){
            System.debug('Inserting ASOCS');
            insert insertASOC;
        }
        
        //insert Maint Plan objects.
        if(insertMaint!=null&&insertMaint.size()>0){
            System.debug('Inserting Maint');
            insert insertMaint;
        }
    }
    
    private ASOCs__c[] buildTNAsocs(Id tnId, Id orderId, QuoteLine__c asoc, Double qty){
        List<ASOCs__c> tnASOCs = new List<ASOCs__c>();
        ASOCs__c orderASOC = new ASOCs__c();
        
        orderASOC.Telephone_Number__c=tnId;
            orderASOC.Order__c=orderId;
            if(asoc.Product__r!=null){
                orderASOC.Asoc__c=asoc.Product__r.Name;
                System.debug('    ASOC Name:'+ asoc.Product__r.Name);
                orderASOC.ASOC_Description__c=asoc.Product__r.Description;
            }else{
                System.debug('    ASOC has Null Product');
                orderASOC.Asoc__c=asoc.CustomAsoc__c;
                System.debug('    ASOC Name:'+ asoc.CustomAsoc__c);
                orderASOC.ASOC_Description__c=asoc.CustomDescription__c;
            }
            orderASOC.Rate__c=asoc.Price__c;
            orderASOC.Quantity__c=qty;
            orderASOC.Magnys_Service_Code_Desc__c=asoc.Magnys_Service_Code_Desc__c;
            
            tnASOCs.add(orderASOC);
            
        //Check for BOM Items
        System.debug('ASOC BOM Items');
        
        if(asoc.Quote_Line_BOM_Items__r!=null&&asoc.Quote_Line_BOM_Items__r.size()>0){
            QuoteLineBomItem__c[] tmpBMs = asoc.Quote_Line_BOM_Items__r;
            
            for(QuoteLineBomItem__c bom:tmpBMs){
                System.debug('Looping BOM Items');
                ASOCs__c bomASOC = new ASOCs__c();
                
                bomASOC.Telephone_Number__c=tnId;
                bomASOC.Order__c=orderId;
                if(bom.Product__r!=null){
                    bomASOC.Asoc__c=bom.Product__r.Name;
                    bomASOC.ASOC_Description__c=bom.Product__r.Description;
                }else{
                    System.debug('ASOC has Null Product');
                }
                bomASOC.Rate__c=0.0;
                bomASOC.Quantity__c=bom.Quantity__c;
                bomASOC.Magnys_Service_Code_Desc__c=asoc.Magnys_Service_Code_Desc__c;
                
                tnASOCs.add(bomASOC);
            }
        }
        
        return tnASOCs;
    }
    

Hi I am trying to create a trigger to update the check box whenever the Opportunity stage changes from Closed Won to a new stage. Here is the trigger i wrote and it is throwing me an error. Please let me know whether the way i wrote the trigger is write or wrong. I mentioned the error in Red color 

 

 

trigger OpportunityUpdate on Opportunity (after update)
{
List <Opportunity> OppList;
List <Id> oppIdList = new List <Id>();
for(Integer i=0; i<Trigger.new.size(); i++)
{
    if (Trigger.old[i].StageName == 'Closed Won' && Trigger.new[i].StageName != 'Closed Won')
        
        oppIdList.add(Trigger.new[i].Id);
}   
OppList = [select Opportunity.Not_Closed_won__c from Opportunity where opportunity  :oppIdList];
if (OppList.size() > 0)
{
  
        if (Opportunity.Not_Closed_won__c != true)
        {
           Opportunity.Not_Closed_won__c = true;  
           }
    }
    
    update OppList;
    }

 

Hi I am trying to display a warning mess in the VF page. I succeded in getting the warning message but i want to display in Red color but it it throwing in black. Here is the thing i added in the controller and in the VF page

 

Controller:

 

 if(Opportunity.Not_Closed_won__c == True)
        {        
        ApexPages.Message errMsg = new ApexPages.Message(ApexPages.Severity.ERROR, 'Any changes made to the quote will not flow to Magnys');
ApexPages.addMessage(errMsg);
 }

 

 

VF page:

 <font color="red"><b><apex:messages /></b></font>

 

The characters which are in red is the warning mess i am trying to display but i am geeting the warning mess in black in the vf page. Can you please let me know why?

Hi All

 

I am trying to display a warning message in the custom VF page. Here is the thing i mentioned in the controller

 

 ApexPages.Message errMsg = new ApexPages.Message(ApexPages.Severity.FATAL, sendtomagnys.getMessage());

ApexPages.addMessage(errMsg);

This is the error it is throwing

 

Error: Compile Error: unexpected token: ')'

Can you please help me out why it is throwing me the error. I mentioned this in middle of my apex controller....
 

 

 

Hi I am creating a visual force email template. For this in the email template we require custom objects fields. So I wrote a apex controller and i called the controller in a component. And i called the component inside the VF template. I mentioned the error in red when i am calling the component in the VF template. I hope the error might be because of something missing in Component or in Controller. Can you guys pls have a look at my code and me knoe where did i went wrong. Appreciate your help in advance

 

Apex Controller

 

 

Public Class CAFDetailsController
{
    Public CAF__c CAF{get;set;}
    Public String cafid{get;set;}
    Public List<CAF__c> CAFlist{get;set;}
       { 
       If (cafid != null)
            {
                CAFlist = [Select Id, Name, CAPEX_Total__c, Off_Net_Circuit_Expense_Total__c, CAF_IRR__c, of_Revisions__c, Sales_Rep__c, Sales_Manager__c from CAF__c where Id = :cafId];
            }                
        }
}

 

Public Class CAFDetailsController{    Public CAF__c CAF{get;set;}    Public String cafid{get;set;}    Public List<CAF__c> CAFlist{get;set;}       {        If (cafid != null)            {                CAFlist = [Select Id, Name, CAPEX_Total__c, Off_Net_Circuit_Expense_Total__c, CAF_IRR__c, of_Revisions__c, Sales_Rep__c, Sales_Manager__c from CAF__c where Id = :cafId];            }                        }}

 

Component

 

 

<apex:component controller="CAFDetailsController" access="global">

    <apex:attribute name="CAFlist" description="CAF object" type="CAF__c"  assignto="{!CAFlist}" /> 

      <apex:outputLabel value="CAFlist" for="CAF__c.CAFId">

          <apex:pageBlockSection >

         <apex:outputText id="CAPEX" value="{!CAFlist.CAPEX_Total__c}"/>

          <apex:outputText id="OffNetCircuitExpense" value="{!CAFlist.Off_Net_Circuit_Expense_Total__c}"/>

        <apex:outputText id="SalesManager" value="{!CAFlist.Sales_Manager__c}"/>

 

 

 

 

        </apex:pageBlockSection>

 

         </apex:outputLabel>

 

</apex:component>

 

 

I called the above component in the following way in the VF template and i mentioned the error in red. Can you please let me know where did i do the mistake

 

VF Template

 

<c:cafvfdetails CAFlist="{!relatedTo.Id}"/>

 

Error: Unknown property 'String.CAPEX_Total__c'

Hi All

 

i was trying to deploy the new code created as well as some changes made in the existing standard objects. I added new apex code,test class,VF page,Some standard objects and some new custom objects. When i am trying to deploy the code through force.com.IDE(Eclipse) this is the error it is throwing. Can you please help me out if you have any idea of this error. I attached the log for your reference

 

File Name:    objects/Opportunity.object   

Full Name:  Opportunity.Quotas   

Action:  NO ACTION   

Result:  FAILED   

Problem: Required field is missing: businessProcess

Hi Guys

 

Please help me out in writing a test class for the following contoller. I am calling this controller in a VF page. Here is my apex class. I am just attaching some part of my class so if i get the test class for the below code i can use this as a reference and i can write for the remeining part of the class. Appreciate your help

 

public class SSOWcontroller {

 private final SSOW__c ssow;
 private final HVoIP__c hvoip;
 private final VoIP__c voip;
public SSOWcontroller(ApexPages.StandardController stdController) {
 ssow = [ Select Id, IsDeleted, Name, CreatedDate, CreatedById, LastModifiedDate, LastModifiedById,
        SystemModstamp, Site_City__c, Site_State__c, Site_Street__c, Site_Thoroughfair__c, Site_Zip_Code__c,
  NPA_NXX__c, Division__c, Primary_Contact__c FROM SSOW__c WHERE ID = :ApexPages.currentPage().getParameters().get('id')];
 hvoip = [ Select Id, OwnerId, IsDeleted, Name, CreatedDate, CreatedById, LastModifiedDate,
        LastModifiedById, SystemModstamp, Qualifying_Product__c, Did_you_ensure_that_hosted__c,
        Did_you_indicate_the_quantity__c, Did_you_ensure_that_the_bandwidth__c FROM HVoIP__c  WHERE SSOW__c = :ssow.id];
 voip = [ Select Id, OwnerId, IsDeleted, Name, CreatedDate, CreatedById, LastModifiedDate, LastModifiedById,
        SystemModstamp, Qualifying_Product__c, Did_you_ensure_that_Voip_and_Data__c, Own_public_IP_Space__c,
        Routing_protocol_other_than_Static__c FROM VoIP__c WHERE SSOW__c = :ssow.id];

}
  
 public SSOW__c getssow()    {
        return ssow;
    }
    public HVoIP__c gethvoip()    {
        return hvoip;
    }  
    public VoIP__c getvoip()    {
        return voip;
    }  
 private void saveallobjects() {
        update ssow;
        update hvoip;
        update voip;
 }
 public PageReference saveAll() {
        saveallobjects();
         PageReference pr4 = new PageReference('/apex/SmartSOW?Id=' + ssow.Id);
        pr4.setRedirect(true);
        return pr4; 
    } 

 

 

 

Hi All

 

I wrote a simple trigger on case. I am able to save the trigger but it is not working when i am updating the records. I have a checkbox on Case whenever this checkbox becomes true the checkbox in CAF(Custom object) should become true. For this i wrote this trigger. I think i had made mistake in the where clause of the SOQL query. I am mentioning in Red. Please let me know. the relation between CAF__c and Case is lookup.

 

trigger CAFoppUpadate1 on Case (after update)
{
List <CAF__c> CAFList;
List <Id> CaseIdList = new List <Id>();
for(Case c:Trigger.new)
{
    if (c.Closed_won_opportunity__c == True)
     caseIdList.add(c.Id);
 }  
CAFList = [select Id, test_caf__c from CAF__c where ID in :Caseidlist];

    for(CAF__c ca : CAFList)
    {
        if (ca.test_caf__c != true)
            ca.test_caf__c = true;    
    }
    
    update CAFList;
}

Hi

 

I created an custom object called Campaign Alert in that Account is lookup. There is a field in campaign alert called phone no and there is a field called Main BTN in account. If anyone gives the phone no in campaign alert it needs to search whether the phone no with BTN in account and that account needs to popup in the account field in the Campaign alert. I wrote this trigger and the trigger is saved but when i am search with phone no it is not throwing the account. Please let me know where did i went wrong

 

trigger relatedaccount on CampaignAlert__c (after insert, after update)
{
    Map<String, CampaignAlert__c> mapPhones = new Map<String, CampaignAlert__c>();
    for (CampaignAlert__c c: Trigger.new)
      { 
        if (c.phone_No__c != null) 
            {
            mapPhones.put(c.phone_No__c, c);
            }
      }

    List<String> listPhones = new List<String>();
    Map<String, Account> mapAccounts = new Map<String, Account>();
    for (list<Account> acts : [Select Id, Main_BTN__c from Account where Main_BTN__c in :listPhones]) 
        {
            for (Account act : acts) 
                {
                mapAccounts.put(act.Main_BTN__c, act);
                }
        }

    List<CampaignAlert__c> listCampaignAlerts = new List<CampaignAlert__c>();
    for (CampaignAlert__c c: mapPhones.values()) 
    {
        if(mapAccounts.get(c.phone_No__c)==null)
            continue;
        CampaignAlert__c ca = new CampaignAlert__c(Name = c.Name); 
        ca.Account__c = mapAccounts.get(c.phone_No__c).ID; 
        listCampaignAlerts.add(ca);
    }
    update listCampaignAlerts;
}

Hi

 

I am trying to write a test class for the following controller. Here is my controller

 

public class CAFApprovalHistoryController {
    public String cafId {get;set;}
    public List<ProcessInstanceHistory> getApprovalSteps() {
      If (cafId != null) {
        CAF__c cafs = [Select Id, Name, CAPEX_Total__c, Off_Net_Circuit_Expense_Total__c, CAF_IRR__c, of_Revisions__c, Sales_Rep__c, Sales_Manager__c, Account__c, CAF_Title1_del__c, CAF_1__c, Products_Requested__c, Bandwidth__c, Notes_of_Consideration__c, CAF_Link__c, (Select TargetObjectId, SystemModstamp, StepStatus, RemindersSent, ProcessInstanceId, OriginalActorId, IsPending, IsDeleted, Id, CreatedDate, CreatedById, Comments, ActorId From ProcessSteps order by SystemModstamp desc) from CAF__c where Id = :cafId];
        return cafs.ProcessSteps;
      }
      return new List<ProcessInstanceHistory> ();
    } 
   }

 

Here is the test class i wrote and this the error it is throwing Error: Compile Error: line breaks not allowed in string literals at line 8 column -1. I mentioned the line 8 in Red

 

 

public class TestCAFApprovalHistory
{
    public static testMethod void testCAFApprovalHistory() 
         {      
        Test.startTest();
        PageReference result = Page.CAFApprovalHistory;
        Test.setCurrentPage(result);               
        CAF__c cf = new CAF__c(Name='Test', CAPEX_Total__c='$1000.00', Off_Net_Circuit_Expense_Total__c='$1000.00, CAF_IRR__c='25%', of_Revisions__c='0', Sales_Rep__c='Test', Sales_Manager__c='TestTest', Account__c='Test Account');
        insert cf;
        }
        }

 

Hi I am trying to create a trigger to update the check box whenever the Opportunity stage changes from Closed Won to a new stage. Here is the trigger i wrote and it is throwing me an error. Please let me know whether the way i wrote the trigger is write or wrong. I mentioned the error in Red color 

 

 

trigger OpportunityUpdate on Opportunity (after update)
{
List <Opportunity> OppList;
List <Id> oppIdList = new List <Id>();
for(Integer i=0; i<Trigger.new.size(); i++)
{
    if (Trigger.old[i].StageName == 'Closed Won' && Trigger.new[i].StageName != 'Closed Won')
        
        oppIdList.add(Trigger.new[i].Id);
}   
OppList = [select Opportunity.Not_Closed_won__c from Opportunity where opportunity  :oppIdList];
if (OppList.size() > 0)
{
  
        if (Opportunity.Not_Closed_won__c != true)
        {
           Opportunity.Not_Closed_won__c = true;  
           }
    }
    
    update OppList;
    }

 

Hi I am trying to display a warning mess in the VF page. I succeded in getting the warning message but i want to display in Red color but it it throwing in black. Here is the thing i added in the controller and in the VF page

 

Controller:

 

 if(Opportunity.Not_Closed_won__c == True)
        {        
        ApexPages.Message errMsg = new ApexPages.Message(ApexPages.Severity.ERROR, 'Any changes made to the quote will not flow to Magnys');
ApexPages.addMessage(errMsg);
 }

 

 

VF page:

 <font color="red"><b><apex:messages /></b></font>

 

The characters which are in red is the warning mess i am trying to display but i am geeting the warning mess in black in the vf page. Can you please let me know why?

Hi All

 

We have our custom build quote tool. From quote tool we have a button called CLOSED WON where we can close the opportunity. If any body wants to change something in the quote they need to change the opportunity stage from closed won to a different page from opportunity and then they can make some changes in the quote and can hit CLOSE WON button from quote.

 

Now i want to display a warning message when anybody try to change some information in the quote for the CLOSE/WON opportunities..want to display as this opportunity went to different environment and any changes will not effect immediately. After displaying this mess the sales rep can save the opportunity or can cancel the changes. Please help me out how can this be done. Appreciate your help in advance

 

 

Hi I am creating a visual force email template. For this in the email template we require custom objects fields. So I wrote a apex controller and i called the controller in a component. And i called the component inside the VF template. I mentioned the error in red when i am calling the component in the VF template. I hope the error might be because of something missing in Component or in Controller. Can you guys pls have a look at my code and me knoe where did i went wrong. Appreciate your help in advance

 

Apex Controller

 

 

Public Class CAFDetailsController
{
    Public CAF__c CAF{get;set;}
    Public String cafid{get;set;}
    Public List<CAF__c> CAFlist{get;set;}
       { 
       If (cafid != null)
            {
                CAFlist = [Select Id, Name, CAPEX_Total__c, Off_Net_Circuit_Expense_Total__c, CAF_IRR__c, of_Revisions__c, Sales_Rep__c, Sales_Manager__c from CAF__c where Id = :cafId];
            }                
        }
}

 

Public Class CAFDetailsController{    Public CAF__c CAF{get;set;}    Public String cafid{get;set;}    Public List<CAF__c> CAFlist{get;set;}       {        If (cafid != null)            {                CAFlist = [Select Id, Name, CAPEX_Total__c, Off_Net_Circuit_Expense_Total__c, CAF_IRR__c, of_Revisions__c, Sales_Rep__c, Sales_Manager__c from CAF__c where Id = :cafId];            }                        }}

 

Component

 

 

<apex:component controller="CAFDetailsController" access="global">

    <apex:attribute name="CAFlist" description="CAF object" type="CAF__c"  assignto="{!CAFlist}" /> 

      <apex:outputLabel value="CAFlist" for="CAF__c.CAFId">

          <apex:pageBlockSection >

         <apex:outputText id="CAPEX" value="{!CAFlist.CAPEX_Total__c}"/>

          <apex:outputText id="OffNetCircuitExpense" value="{!CAFlist.Off_Net_Circuit_Expense_Total__c}"/>

        <apex:outputText id="SalesManager" value="{!CAFlist.Sales_Manager__c}"/>

 

 

 

 

        </apex:pageBlockSection>

 

         </apex:outputLabel>

 

</apex:component>

 

 

I called the above component in the following way in the VF template and i mentioned the error in red. Can you please let me know where did i do the mistake

 

VF Template

 

<c:cafvfdetails CAFlist="{!relatedTo.Id}"/>

 

Error: Unknown property 'String.CAPEX_Total__c'

Hi All

 

I had wrote atrigger and facing difficult in deploying. The think is it is trowing an error in an different apex test class. please have a look at my trigger(Update account) and the error is showing in an different apex test class(Test_Opportunitytoorder) which i mentioned in Red

 

trigger UpdateAccount on Opportunity (after update)
{
List<id> accIds=new List<id>();
for (Opportunity opp : trigger.new)
{
   accIds.add(opp.accountid);
}
Map<Id, Account> accountsById=new Map<Id, Account>();
List<Account> accs= [select id,Ready_to_Wincare__c from Account where id in :accIds];
accountsById.putAll(accs);
List<Account> accsToUpdate=new List<Account>();
for (Opportunity opp : trigger.new)
{
   if (opp.StageName ==  'Closed Won')
   {  
       Account acc=accountsById.get(opp.AccountId);
       acc.Ready_to_Wincare__c = True;
       accsToUpdate.add(acc);
          }
}
update accsToUpdate;
}

 

Errors

Test_OpportunityToOrder.testOpportunityToOrder System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, UpdateAccount: execution of AfterUpdate
caused by: System.ListException: Duplicate id in list: 0014000000XtFyyAAF
Trigger.UpdateAccount: line 22, column 1: []

 

 

 

In the SQL that SFA uses, what is the function name that converts the data of a field to upper case?  In Oracle SQL the name is UPPER.  The SFA SQL analyzer says this is an invalid aggregate funtion.  I need to know this so I can make the name search case insensitive. I tried using UCASE,UPPER,InUPPER but it is throwing the same error. I mentioned the error in red. please help me out on this

 

Here is the SQL I sent
SELECT w.SF_Order_Number__c,      
       w.Order_Status__c,      
       w.Name,      
       w.Email__c,      
       w.CreatedDate,      
       w.Account__c,      
       w.Account__r.name,      
       w.Main_BTN__c,      
       w.Account_Billing_State__c,      
       w.Account_Billing_City__c 
  FROM WINORDER__c w
 WHERE (InUpper(w.Account__r.name) LIKE '%WRC%SENIOR%SUPPORT%SERVICES%'      
           AND w.Account_Billing_State__c = 'PA')   
    OR w.Main_BTN__c = '(814) 849-5913'
 
Here is the reply I received
<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:soapenv="
http://schemas.xmlsoap.org/soap/envelope/" xmlns:sf="urn:fault.enterprise.soap.sforce.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 <soapenv:Body>
  <soapenv:Fault>
   <faultcode>sf:MALFORMED_QUERY</faultcode>
   <faultstring>MALFORMED_QUERY: Invalid aggregate function: InUpper</faultstring>
   <detail>
    <sf:MalformedQueryFault xsi:type="sf:MalformedQueryFault">
     <sf:exceptionCode>MALFORMED_QUERY</sf:exceptionCode>
     <sf:exceptionMessage>Invalid aggregate function: InUpper</sf:exceptionMessage>
     <sf:row>-1</sf:row>
     <sf:column>-1</sf:column>
    </sf:MalformedQueryFault>
   </detail>
  </soapenv:Fault>
 </soapenv:Body>
</soapenv:Envelope>
Thanks
Sayana