• Prasad Avala(SFDC)
  • NEWBIE
  • 215 Points
  • Member since 2015

  • Chatter
    Feed
  • 7
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 22
    Replies
Workflow Action Failed to Trigger Flow
The record couldn’t be saved because it failed to trigger a flow. A flow trigger failed to execute the flow with version ID 30128000000RUrR. Flow error messages: <b>An unhandled fault has occurred in this flow</b><br>An unhandled fault has occurred while processing the flow. Please contact your system administrator for more information. Contact your administrator for help.

Explaination : Even after i deleted the trigger, i am getting this while updating the account fields.
 
I have this Trigger: 
trigger OnBoardingUpdateFromTask on Task (after update) 
{
List<Customer_OnBoard__c> OnBoardingsToUpdate = new List<Customer_OnBoard__c>();
Map<Id, Customer_OnBoard__c> OnBoardingIDToOnBoardingObjMap = new Map<Id, Customer_OnBoard__c>();
for (Task t: Trigger.new)
{
if (t.subject=='AWF: RealTime Project Kick Off' && t.Status =='Completed')
{    
    if(OnBoardingIDToOnBoardingObjMap.get(t.WhatId) == null){
        Customer_OnBoard__c o = new Customer_OnBoard__c(Id=t.WhatId);
        o.Project_Kick_Off_rt__c = TRUE;
        OnBoardingIDToOnBoardingObjMap.put(t.WhatId, o);
    }
 }

if (t.subject=='AWF: Traveler Project Kick-Off' && t.Status =='Completed')
{
    if(OnBoardingIDToOnBoardingObjMap.get(t.WhatId) == null){
            Customer_OnBoard__c o = new Customer_OnBoard__c(Id=t.WhatId);
            o.Project_Kick_Off_TR__c = TRUE;
            OnBoardingIDToOnBoardingObjMap.put(t.WhatId, o);
        }
}  
    

 if (t.subject=='AWF: Update Monthly Billing for Customer' && t.Status =='Completed')
 {
    if(OnBoardingIDToOnBoardingObjMap.get(t.WhatId) == null){
            Customer_OnBoard__c o = new Customer_OnBoard__c(Id=t.WhatId);
            o.Monthly_Billing_Update__c = TRUE;
            OnBoardingIDToOnBoardingObjMap.put(t.WhatId, o);
        }
 }

if (t.subject=='AWF: Renewal Monthly Billing Update' && t.Status =='Completed')
 {
    if(OnBoardingIDToOnBoardingObjMap.get(t.WhatId) == null){
            Customer_OnBoard__c o = new Customer_OnBoard__c(Id=t.WhatId);
            o.Renewal_Monthly_Billing__c = TRUE;
            OnBoardingIDToOnBoardingObjMap.put(t.WhatId, o);
        }
 }    
   
   if (t.subject=='AWF: Decommission Monthly Billing Update' && t.Status =='Completed')
 {
    if(OnBoardingIDToOnBoardingObjMap.get(t.WhatId) == null){
            Customer_OnBoard__c o = new Customer_OnBoard__c(Id=t.WhatId);
            o.Decommission_Monthly_Billing_Update__c = TRUE;
            OnBoardingIDToOnBoardingObjMap.put(t.WhatId, o);
        }
 }     
    
            if (t.subject=='AWF: Decommission Hardware' && t.Status =='Completed')
{
    if(OnBoardingIDToOnBoardingObjMap.get(t.WhatId) == null){
            Customer_OnBoard__c o = new Customer_OnBoard__c(Id=t.WhatId);
            o.Decommission_Hardware__c = TRUE;
            OnBoardingIDToOnBoardingObjMap.put(t.WhatId, o);
        }   
}
  
             if (t.subject=='AWF: Decommission OnDemand Vehicles' && t.Status =='Completed')
{
    if(OnBoardingIDToOnBoardingObjMap.get(t.WhatId) == null){
            Customer_OnBoard__c o = new Customer_OnBoard__c(Id=t.WhatId);
            o.Decommission_Vehicles__c = TRUE;
            OnBoardingIDToOnBoardingObjMap.put(t.WhatId, o);
        }   
}   
    
   
       if (t.subject=='AWF: Enable Additional Vehicles' && t.Status =='Completed')
{
    if(OnBoardingIDToOnBoardingObjMap.get(t.WhatId) == null){
            Customer_OnBoard__c o = new Customer_OnBoard__c(Id=t.WhatId);
            o.Enable_Additional_Vehicles__c = TRUE;
            OnBoardingIDToOnBoardingObjMap.put(t.WhatId, o);
        }
}   
    

if (t.subject=='AWF: OnDemand Project Kick-Off' && t.Status =='Completed')
{
    if(OnBoardingIDToOnBoardingObjMap.get(t.WhatId) == null){
            Customer_OnBoard__c o = new Customer_OnBoard__c(Id=t.WhatId);
            o.Project_Kick_Off_OD__c = TRUE;
            OnBoardingIDToOnBoardingObjMap.put(t.WhatId, o);
        }
}


if (t.subject=='AWF: Order Inventory' && t.Status =='Completed')
{
    if(OnBoardingIDToOnBoardingObjMap.get(t.WhatId) == null){
            Customer_OnBoard__c o = new Customer_OnBoard__c(Id=t.WhatId);
            o.Order_Inventory__c = TRUE;
            OnBoardingIDToOnBoardingObjMap.put(t.WhatId, o);
        }
}


if (t.subject=='AWF: Confirm OSM Region Added' && t.Status =='Completed')
{

    if(OnBoardingIDToOnBoardingObjMap.get(t.WhatId) == null){
                Customer_OnBoard__c o = new Customer_OnBoard__c(Id=t.WhatId);
                o.Confirm_OSM_Added__c = TRUE;
                OnBoardingIDToOnBoardingObjMap.put(t.WhatId, o);
            }
 }

if (t.subject=='AWF: Finance Confirm Payment Received' && t.Status =='Completed')
{

    if(OnBoardingIDToOnBoardingObjMap.get(t.WhatId) == null){
                Customer_OnBoard__c o = new Customer_OnBoard__c(Id=t.WhatId);
                o.Finance_Confirm_Payment__c = TRUE;
                o.Confirm_Payment__c = TRUE;
                o.Confirm_Payment_Count__c = 1;
                OnBoardingIDToOnBoardingObjMap.put(t.WhatId, o);
            }
 }

if (t.subject=='AWF: Confirm Receipt of SIS' && t.Status =='Completed')
{
     if(OnBoardingIDToOnBoardingObjMap.get(t.WhatId) == null){
                Customer_OnBoard__c o = new Customer_OnBoard__c(Id=t.WhatId);
                o.Confirm_SIS_Received__c = TRUE;
                
                OnBoardingIDToOnBoardingObjMap.put(t.WhatId, o);
            }
 }

if (t.subject=='AWF: GTFS and Backend Setup' && t.Status =='Completed')
{
    if(OnBoardingIDToOnBoardingObjMap.get(t.WhatId) == null){
                Customer_OnBoard__c o = new Customer_OnBoard__c(Id=t.WhatId);
                o.Create_GTFS_Feed_and_Backend_Setup__c = TRUE;
                
                OnBoardingIDToOnBoardingObjMap.put(t.WhatId, o);
            }
 }

if (t.subject=='AWF: Enable Survey' && t.Status =='Completed')
{

    if(OnBoardingIDToOnBoardingObjMap.get(t.WhatId) == null){
                Customer_OnBoard__c o = new Customer_OnBoard__c(Id=t.WhatId);
                o.Enable_Survey__c = TRUE;
                
                OnBoardingIDToOnBoardingObjMap.put(t.WhatId, o);
            }
}

if (t.subject=='AWF: Send the SIS to Customer' && t.Status =='Completed')
{
    if(OnBoardingIDToOnBoardingObjMap.get(t.WhatId) == null){
                Customer_OnBoard__c o = new Customer_OnBoard__c(Id=t.WhatId);
                o.Send_the_SIS_to_the_Customer__c = TRUE;
                
                OnBoardingIDToOnBoardingObjMap.put(t.WhatId, o);
            }
}

if (t.subject=='AWF: RealTime New Product Training' && t.Status =='Completed')
{

 if(OnBoardingIDToOnBoardingObjMap.get(t.WhatId) == null){
                Customer_OnBoard__c o = new Customer_OnBoard__c(Id=t.WhatId);
                o.New_Product_Training_rt__c = TRUE;
                
                OnBoardingIDToOnBoardingObjMap.put(t.WhatId, o);
            }
}

if (t.subject=='AWF: Traveler New Product Training' && t.Status =='Completed')
{
 if(OnBoardingIDToOnBoardingObjMap.get(t.WhatId) == null){
                Customer_OnBoard__c o = new Customer_OnBoard__c(Id=t.WhatId);
                o.New_Product_Training_TR__c = TRUE;
                
                OnBoardingIDToOnBoardingObjMap.put(t.WhatId, o);
            }
 }

if (t.subject=='AWF: OnDemand New Product Training' && t.Status =='Completed')
{

    if(OnBoardingIDToOnBoardingObjMap.get(t.WhatId) == null){
                Customer_OnBoard__c o = new Customer_OnBoard__c(Id=t.WhatId);
                o.New_Product_Training_od__c = TRUE;
                
                OnBoardingIDToOnBoardingObjMap.put(t.WhatId, o);
            }
 }

if (t.subject=='AWF: Preview Period' && t.Status =='Completed')
{
   
            if(OnBoardingIDToOnBoardingObjMap.get(t.WhatId) == null){
                Customer_OnBoard__c o = new Customer_OnBoard__c(Id=t.WhatId);
                o.Preview_Period__c = TRUE;
                
                OnBoardingIDToOnBoardingObjMap.put(t.WhatId, o);
            }
 }

if (t.subject=='AWF: RealTime Product Go Live' && t.Status =='Completed')
{
     if(OnBoardingIDToOnBoardingObjMap.get(t.WhatId) == null){
                Customer_OnBoard__c o = new Customer_OnBoard__c(Id=t.WhatId);
                o.Product_Go_Live_RT__c = TRUE;
                
                OnBoardingIDToOnBoardingObjMap.put(t.WhatId, o);
            }
}

if (t.subject=='AWF: Traveler Product Go Live' && t.Status =='Completed')
{
     if(OnBoardingIDToOnBoardingObjMap.get(t.WhatId) == null){
                Customer_OnBoard__c o = new Customer_OnBoard__c(Id=t.WhatId);
                o.Product_Go_Live_TR__c = TRUE;               
                OnBoardingIDToOnBoardingObjMap.put(t.WhatId, o);
            }
 }

if (t.subject=='AWF: OnDemand Product Go-Live' && t.Status =='Completed')
{    
    if(OnBoardingIDToOnBoardingObjMap.get(t.WhatId) == null){
                    Customer_OnBoard__c o = new Customer_OnBoard__c(Id=t.WhatId);
                    o.Product_Go_Live_OD__c = TRUE;               
                    OnBoardingIDToOnBoardingObjMap.put(t.WhatId, o);
                }
 }

if (t.subject=='AWF: Provide Credentials to Agency' && t.Status =='Completed')
{
 if(OnBoardingIDToOnBoardingObjMap.get(t.WhatId) == null){
                Customer_OnBoard__c o = new Customer_OnBoard__c(Id=t.WhatId);
                o.Provide_Credentials_to_Agency__c = TRUE;
                o.Date_OnDemand_Ready__c = Date.today();
                OnBoardingIDToOnBoardingObjMap.put(t.WhatId, o);
            }
}

if (t.subject=='AWF: Request Logo' && t.Status =='Completed')
{

    if(OnBoardingIDToOnBoardingObjMap.get(t.WhatId) == null){
                Customer_OnBoard__c o = new Customer_OnBoard__c(Id=t.WhatId);
                o.Request_Logo__c = TRUE;
                o.Date_Traveler_Ready__c = Date.TODAY();
                OnBoardingIDToOnBoardingObjMap.put(t.WhatId, o);
            }
}


if (t.subject=='AWF: Ship Units To Customer' && t.Status =='Completed')
{

    if(OnBoardingIDToOnBoardingObjMap.get(t.WhatId) == null){
                Customer_OnBoard__c o = new Customer_OnBoard__c(Id=t.WhatId);
                o.Ship_Units_To_Customer__c = TRUE;               
                OnBoardingIDToOnBoardingObjMap.put(t.WhatId, o);
            }
}

if (t.subject=='AWF: Enable Go-Live' && t.Status =='Completed')
{
     if(OnBoardingIDToOnBoardingObjMap.get(t.WhatId) == null){
                Customer_OnBoard__c o = new Customer_OnBoard__c(Id=t.WhatId);
                o.Weekly_Tasks__c = TRUE;               
                OnBoardingIDToOnBoardingObjMap.put(t.WhatId, o);
            }
 }

if (t.subject=='AWF: Schedule Travel' && t.Status =='Completed')
{


     if(OnBoardingIDToOnBoardingObjMap.get(t.WhatId) == null){
                Customer_OnBoard__c o = new Customer_OnBoard__c(Id=t.WhatId);
                o.Schedule_Travel__c = TRUE;               
                OnBoardingIDToOnBoardingObjMap.put(t.WhatId, o);
            }
}

if (t.subject=='AWF: Check Inventory' && t.Status =='Completed')
{
    if(OnBoardingIDToOnBoardingObjMap.get(t.WhatId) == null){
                Customer_OnBoard__c o = new Customer_OnBoard__c(Id=t.WhatId);
                o.Check_Inventory__c = TRUE;               
                OnBoardingIDToOnBoardingObjMap.put(t.WhatId, o);
            }
 }

    if (t.subject=='AWF: Order Inventory' && t.Status =='Completed')
{
    if(OnBoardingIDToOnBoardingObjMap.get(t.WhatId) == null){
                Customer_OnBoard__c o = new Customer_OnBoard__c(Id=t.WhatId);
                o.Order_Inventory__c = TRUE;               
                OnBoardingIDToOnBoardingObjMap.put(t.WhatId, o);
            }
}


if (t.subject=='AWF: Update Inventory' && t.Status =='Completed')
{
    if(OnBoardingIDToOnBoardingObjMap.get(t.WhatId) == null){
                Customer_OnBoard__c o = new Customer_OnBoard__c(Id=t.WhatId);
                o.Update_Inventory__c = TRUE;               
                OnBoardingIDToOnBoardingObjMap.put(t.WhatId, o);
            }
}

if (t.subject=='AWF: Submit Expense Form' && t.Status =='Completed')
{
    if(OnBoardingIDToOnBoardingObjMap.get(t.WhatId) == null){
                Customer_OnBoard__c o = new Customer_OnBoard__c(Id=t.WhatId);
                o.Expense_Form__c = TRUE;               
                OnBoardingIDToOnBoardingObjMap.put(t.WhatId, o);
            }
 }

    if (t.subject=='AWF: Decommission Hardware' && t.Status =='Completed')
{
    if(OnBoardingIDToOnBoardingObjMap.get(t.WhatId) == null){
                Customer_OnBoard__c o = new Customer_OnBoard__c(Id=t.WhatId);
                o.Hardware_Decommissioned__c = TRUE;               
                OnBoardingIDToOnBoardingObjMap.put(t.WhatId, o);
            }
}
  
       if (t.subject=='AWF: Decommission OnDemand Vehicles' && t.Status =='Completed')
{
    if(OnBoardingIDToOnBoardingObjMap.get(t.WhatId) == null){
                Customer_OnBoard__c o = new Customer_OnBoard__c(Id=t.WhatId);
                o.OnDemand_Decommission_Product__c = TRUE;               
                OnBoardingIDToOnBoardingObjMap.put(t.WhatId, o);
            }
} 
    
    
    for(Id id : OnBoardingIDToOnBoardingObjMap.keyset()){
    Customer_OnBoard__c thisOnb = new Customer_OnBoard__c();
    thisOnb = OnBoardingIDToOnBoardingObjMap.get(id);
    OnBoardingsToUpdate.Add(thisOnb);

}
   try {
        update OnBoardingsToUpdate; 
    } catch (system.Dmlexception e) {
        system.debug (e);
    }
}
}

With this Test Class:
 
@isTest (seeAllData=false)
private class TestOnBoardingUpdateFromTask {

    public static List<Task> tasksList;
    public static List<Opportunity> opportunitiesList;
    public static List<Account> accountsList;
    public static String subject;
    
    static void init(){
    tasksList = new List<Task>();
    opportunitiesList = new List<Opportunity>();
    accountsList = new List<Account>();    
    
        accountsList.add(new Account(Name = 'Test', Sales_Region__c = '1 - Southeast', Type = 'Prospect' ));                       
        opportunitiesList = new List<Opportunity>{
            new Opportunity(
                        Name = 'Test1',
                        CloseDate = date.today().addDays(5),
                        AccountId = accountsList[0].Id,
                        Type = 'New Business', 
                        TransLoc_Hardware__c = 'Yes',
                        Integration__c = 'NO', 
                        StageName = 'Proposal'),
                new Opportunity(
                        Name = 'Test2',
                        CloseDate = date.today().addDays(5),
                        AccountId = accountsList[0].Id,
                        Type = 'New Business', 
                        TransLoc_Hardware__c = 'Yes',
                        Integration__c = 'NO', 
                        StageName = 'Proposal'),
                new Opportunity(
                        Name = 'Test3',
                        CloseDate = date.today().addDays(5),
                        AccountId = accountsList[0].Id,
                        Type = 'New Business', 
                        TransLoc_Hardware__c = 'Yes',
                        Integration__c = 'NO', 
                        StageName = 'Proposal'),
                new Opportunity(
                        Name = 'Test4',
                        CloseDate = date.today().addDays(5),
                        AccountId = accountsList[0].Id,
                        Type = 'New Business', 
                        TransLoc_Hardware__c = 'Yes',
                        Integration__c = 'NO', 
                        StageName = 'Proposal'),
                new Opportunity(
                        Name = 'Test5',
                        CloseDate = date.today().addDays(5),
                        AccountId = accountsList[0].Id,
                        StageName = 'Proposal')
            };
    }
    
    static testMethod void testWithExistingTask() {
    init();
    Test.startTest();
    
        tasksList = new List<Task>{new Task(
        Subject = subject, Status='Completed',  Priority = 'Normal'
        ),
        new Task(Subject='AWF: RealTime Project Kick Off', Status ='Completed'),
        new Task(Subject='AWF: RealTime New Product Training' , Status='Completed'),
        new Task(Subject='AWF: RealTime Product Go Live' , Status='Completed'),  
        
        new Task(Subject='AWF: Check Inventory', Status='Completed'),
        new Task(Subject='AWF: Order Inventory' , Status='Completed'),
        new Task(Subject='AWF: Start Installation Checklist' , Status='Completed'),
        new Task(Subject='AWF: Ship Units To Customer' , Status='Completed'), 
        new Task(Subject='AWF: Submit Expense Form' , Status='Completed'),
        new Task(Subject='AWF: Update Inventory' , Status='Completed'),
        new Task(Subject='AWFl Schedule Travel', Status = 'Completed'),
          
        new Task(Subject='AWF: OnDemand Product Go-Live' , Status='Completed'), 
        new Task(Subject='AWF: OnDemand Project Go Live' , Status='Completed'), 
        new Task(Subject='AWF: OnDemand Project Kick-Off' , Status='Completed'),
        new Task(Subject='AWF: OnDemand New Product Training' , Status = 'Completed'),
            
        new Task(Subject='AWF: Traveler New Product Training' , Status='Completed'),
        new Task(Subject='AWF: Traveler Product Go Live' , Status='Completed'),
        new Task(Subject='AWF: Traveler Project Kick-Off' , Status='Completed'),
        
        new Task(Subject='AWF: Preview Period' , Status='Completed'),
        new Task(Subject='AWF: Request Logo' , Status='Completed'),
        new Task(Subject='AWF: Confirm Receipt of SIS' , Status='Completed'),
        new Task(subject='AWF: Provide Credentials To Agency' , Status='Completed'),
        new Task(Subject='AWF: Enable Survey' , Status='Completed'),
        new Task(Subject='AWF: GTFS and Backend Setup' , Status = 'Completed'),
        new Task(Subject='AWF: Enable Go-Live', Status='Completed') ,
        new Task(Subject='AWF: Confirm OSM Region Added', Status ='Completed'),
        new Task(Subject='AWF: Enable Additional Vehicles' , Status = 'Completed'),
        new Task(Subject='AWF: Decommission OnDemand Vehicles', Status = 'Completed'),
        new Task(Subject='AWF: Decommission Hardware' , Status = 'Completed'),
            
        new Task(Subject='AWF: Finance Confirm Payment Received' , Status = 'Completed'),
        new Task(Subject='AWF: Decommission Monthly Billing Update' , Status = 'Completed'),
        new Task(Subject='AWF: Renewal Monthly Billing Update' , Status = 'Completed'),
        new Task(Subject='AWF: Update Monthly Billing for Customer' , Status = 'Completed')
        
        };
        
        
        insert accountsList;
        insert opportunitiesList;
        insert tasksList;       
        
    tasksList = [
        SELECT Id, WhatId
        FROM Task
        
        ];

        //if (!tasksList.isEmpty()){
        Integer i = 0;
        for(Task t : tasksList){
            t.WhatId = opportunitiesList[i].Id;
            //i++;
        }
        
        update tasksList;
        
    //System.assertEqual(tasksList[0].WhatId, opportunitiesList[0].Id);
    
    //Test.stopTest();
    }
    
 }

When I run the Test Class I get the following email from a Process Flow that is being executed:
 
An error occurred at element myRule_5_A1 (FlowRecordUpdate).
UPDATE --- UPDATE FAILED --- ERRORS : (LIMIT_EXCEEDED) System.LimitException: Too many DML statements: 151
________________________________________
This report lists the elements that the flow interview executed. The report is a beta feature.
We welcome your feedback on IdeaExchange.
Flow Details
Flow Name: Activity_Updates_for_Visual_Workflow
Type: Workflow
Version: 14
Status: Active
Flow Interview Details
Interview Label: Activity_Updates_for_Visual_Workflow-14_Task
Current User: Chris Fraser (005d00000066RvV)
Start time: 11/3/2016 3:12 PM
Duration: 0 seconds
How the Interview Started
Chris Fraser (005d00000066RvV) started the flow interview.
Some of this flow's variables were set when the interview started.
myVariable_old = null
myVariable_current = 00TP000000FJyvpMAD
RecursiveCountVariable = 2.00
ASSIGNMENT: myVariable_waitStartTimeAssignment
{!myVariable_waitStartTimeVariable} Equals {!Flow.CurrentDateTime}
Result
{!myVariable_waitStartTimeVariable} = "11/3/2016 3:12 PM"
DECISION: myDecision
DECISION: myDecision2
DECISION: myDecision4
Executed this outcome: myRule_5
Outcome conditions: and
1. {!myVariable_current.Subject} (AWF: OnDemand New Product Training) Contains OnDemand New Product Training
2. {!myVariable_current.IsClosed} (true) Equals true
Logic: All conditions must be true (AND)
RECORD UPDATE: myRule_5_A1
Find all Task records where:
Id Equals {!myVariable_current.Id} (00TP000000FJyvpMAD)
Update the records’ field values.
New_Product_Training_od__c = true
Result
Failed to update records that meet the filter criteria.
________________________________________
Error Occurred: UPDATE --- UPDATE FAILED --- ERRORS : (LIMIT_EXCEEDED) System.LimitException: Too many DML statements: 151
________________________________________
________________________________________

Can someone point out the error of my ways?
I'm getting " TLS 1.0 has been disabled in this organization. Please use TLS 1.1 or higher when connecting to Salesforce using https." error when I refresh my eclipse. I performed below actions to fix the issue, but I'm not able to fix the error. 

1) Checked the critical updates - There is no update related to TLS 1.0 in my sandbox
2) I have Java 1.7 Version and enabled TLS 1.1 and 1.2. 
3) Enabled TLS 1.1 , 1.2 in all the browsers.
4) Added "-Dhttps.protocols=TLSv1.1,TLSv1.2"

Please let me know, is anything am missing here to fix this issue? 

User-added image
 Hi All...

I have a multiselect field Production_Region__c contains values A,B,C,D and E.

Using process builder have to create a new record if Production_Region__c field value does not contain value D.
For example: If user selects values A and D , process should not create any new record
If any one or more values(A,B,C and E) except value D is selected, process should create a new record

can any one suggest me some approach?
Hi all, i have used the Vf page and controller to split the values of a single filed into multiple columns.

The issue is each name is getting diplayed 3 times on the page. But if i use Set insted a List i'm able to eliminate the duplicates.

Please see the below code and let me know where exactly the issue is(i guess the issue is inside the for loop but could not sort it out
Note: i'm using custom settings object and retrieving the values to display them on page with a name and checkbox
VF page: 
	<apex:pageBlockTable value="{!MyWrappers}" var="wrap" id="pgtbl">
   <apex:column width="100px">
 <apex:inputCheckBox value="{!wrap.checkbox1}"/>
 <apex:outputField value="{!wrap.mySec1.name}"/>
    </apex:column>
 <apex:column width="100px">
   <apex:inputCheckBox value="{!wrap.checkbox2}"/>
    <apex:outputField value="{!wrap.mySec2.name}"/>
 </apex:column>
 <apex:column width="100px">
   <apex:inputCheckBox value="{!wrap.checkbox3}"/>
   <apex:outputField value="{!wrap.mySec3.name}"/> 
 </apex:column>
</apex:pageBlockTable>

Controller code:
public with class Controller {
Public  List<MyWrapper> myWrappers{get; set;}

public class MyWrapper
 {
    public Boolean checkbox1{get;set;}
    public Boolean checkbox2{get;set;}
    public Boolean checkbox3 {get;set;}
    public Custom_settings_Object__c myLead1{get;set;} 
    public Custom_settings_Object__c myLead2{get;set;}
    public Custom_settings_Object__c myLead3{get;set;}
    
 }     
    public pagereference initiallds()----calling this action from page component
    {     
  myWrappers=new List<MyWrapper>();
  Integer idx=0;
  MyWrapper wrap;      
    for(Custom_settings_Object__c ld: Custom_settings_Object__c.getall().values())   
    {               
      if (Math.mod(idx, 3)==0)
       {   
          wrap =  new MyWrapper();
           wrap.myLead1=ld; 
           
       }
      if (Math.mod(idx, 3)==1)
       {
          wrap.myLead2=ld;
      
       }
   if (Math.mod(idx, 3)==2)
       {           
       wrap.myLead3=ld;
           
       }           
          ++idx;        
          myWrappers.add(wrap);
                }    
return null;
    }
	}



 
Hi All,

          Two of my test classes are passing without any issues but the code coverage on the respective classes is 0% . Can anyone let me know what the possible issue might have been?
  • October 21, 2015
  • Like
  • 0
I have a small problem. I'm trying to run the code snipper provided in the TrailHead for apex testing on "Creating TEst Data for Apex Tests" and my test code fails two test cases out 4. Here what my test runs results.

User-added image

Here what the code looks like:
@isTest
private class TestAccountDeletion {

    @isTest static void TestDeleteAccountWithOneOpportunity() {
        // Test data setup
        // Create one account with one opportunity by calling a utility method
        Account[] accts = TestDataFactory.createAccountsWithOpps(1,1);
        
        // Perform test
        Test.startTest();
        Database.DeleteResult result = Database.delete(accts[0], false);
        Test.stopTest();

        // Verify that the deletion should have been stopped by the trigger,
        // so check that we got back an error.
        System.assert(!result.isSuccess());
        System.assert(result.getErrors().size() > 0);
        System.assertEquals('Cannot delete account with related opportunities.',
                             result.getErrors()[0].getMessage());
    }
    
    @isTest static void TestDeleteAccountWithNoOpportunities() {
        // Test data setup
        // Create one account with no opportunities by calling a utility method
        Account[] accts = TestDataFactory.createAccountsWithOpps(1,0);
        
        // Perform test
        Test.startTest();
        Database.DeleteResult result = Database.delete(accts[0], false);
        Test.stopTest();

        // Verify that the deletion was successful
        System.assert(result.isSuccess());
    }
    
    @isTest static void TestDeleteBulkAccountsWithOneOpportunity() {
        // Test data setup
        // Create accounts with one opportunity each by calling a utility method
        Account[] accts = TestDataFactory.createAccountsWithOpps(200,1);
        
        // Perform test
        Test.startTest();
        Database.DeleteResult[] results = Database.delete(accts, false);
        Test.stopTest();

        // Verify for each record.
        // In this case the deletion should have been stopped by the trigger,
        // so check that we got back an error.
        for(Database.DeleteResult dr : results) {
            System.assert(!dr.isSuccess());
            System.assert(dr.getErrors().size() > 0);
            System.assertEquals('Cannot delete account with related opportunities.',
                                 dr.getErrors()[0].getMessage());
        }
    }
    
    @isTest static void TestDeleteBulkAccountsWithNoOpportunities() {
        // Test data setup
        // Create accounts with no opportunities by calling a utility method
        Account[] accts = TestDataFactory.createAccountsWithOpps(200,0);
        
        // Perform test
        Test.startTest();
        Database.DeleteResult[] results = Database.delete(accts, false);
        Test.stopTest();

        // For each record, verify that the deletion was successful
        for(Database.DeleteResult dr : results) {
            System.assert(dr.isSuccess());
        }
    }
}

Any help much appreciated.
Hi All,
We are planning to enable state and country pick list feature in our org.First we have implemented this in our sandbox and followed all the 3 steps specified by Salesforce(document). We have updated all the references in Apex classes and VF pages which are showed up in scan results. But still very few of the Apex classes and VF pages are showing up in the scan results(re-ran the scan) even after converting all state and country fields to stateCode and countryCode.

Am i missing something? Can any one through some light?

Note: we are using field sets in VF pages for address fields, when we try to update those fields we are getting error since we have used those field sets for Google map Managed package.

Thanks for looking into the post and helping...
Hi All,
We are planning to enable state and country pick list feature in our org.First we have implemented this in our sandbox and followed all the 3 steps specified by Salesforce(document). We have updated all the references in Apex classes and VF pages which are showed up in scan results. But still very few of the Apex classes and VF pages are showing up in the scan results(re-ran the scan) even after converting all state and country fields to stateCode and countryCode.

Am i missing something? Can any one through some light?

Note: we are using field sets in VF pages for address fields, when we try to update those fields we are getting error since we have used those field sets for Google map Managed package.

Thanks for looking into the post and helping...
HI, I am trying to check a chk box if there is a child record present , if no then unchk this chk box (look up relation to the custom object from Opportunity)
list<id> ids = new list<id>();
    if(trigger.isinsert || trigger.isupdate){
        
        
       for(Apttus_Proposal__Proposal__c p : trigger.new){
            ids.add(p.Apttus_Proposal__Opportunity__c);
        }
        list<opportunity> opp = [select id,Has_Quote_Proposal__c from opportunity where id in :ids];
        list<opportunity> oppttyupdate = new list<opportunity>(); 
        for(opportunity o : opp){
            o.Has_Quote_Proposal__c=true;
            oppttyupdate.add(o);
        }
        update oppttyupdate;
    }
    
    
    if(trigger.isdelete){
        
        list <id> ids3 = new list<id>();
        for(Apttus_Proposal__Proposal__c p : trigger.old){
            ids3.add(p.Apttus_Proposal__Opportunity__c);
        }
      
      
        list<opportunity> opp = [select id,Has_Quote_Proposal__c,(select id,name from XXXXX0000001yUfDEAU__r) from opportunity where id in :ids3];
        list<opportunity> oppttyoupdate = new list<opportunity>(); 
        for(opportunity o : opp){
            
            if(o.XXXXXXX0000001yUfDEAU__r.size()<1){
                o.Has_Quote_Proposal__c = false;
                oppttyoupdate.add(o);
            }
        }
        update oppttyoupdate;              
            }
                                     }
                             
                     }
Advance thanks 
Workflow Action Failed to Trigger Flow
The record couldn’t be saved because it failed to trigger a flow. A flow trigger failed to execute the flow with version ID 30128000000RUrR. Flow error messages: &lt;b&gt;An unhandled fault has occurred in this flow&lt;/b&gt;&lt;br&gt;An unhandled fault has occurred while processing the flow. Please contact your system administrator for more information. Contact your administrator for help.

Explaination : Even after i deleted the trigger, i am getting this while updating the account fields.
 
I have this Trigger: 
trigger OnBoardingUpdateFromTask on Task (after update) 
{
List<Customer_OnBoard__c> OnBoardingsToUpdate = new List<Customer_OnBoard__c>();
Map<Id, Customer_OnBoard__c> OnBoardingIDToOnBoardingObjMap = new Map<Id, Customer_OnBoard__c>();
for (Task t: Trigger.new)
{
if (t.subject=='AWF: RealTime Project Kick Off' && t.Status =='Completed')
{    
    if(OnBoardingIDToOnBoardingObjMap.get(t.WhatId) == null){
        Customer_OnBoard__c o = new Customer_OnBoard__c(Id=t.WhatId);
        o.Project_Kick_Off_rt__c = TRUE;
        OnBoardingIDToOnBoardingObjMap.put(t.WhatId, o);
    }
 }

if (t.subject=='AWF: Traveler Project Kick-Off' && t.Status =='Completed')
{
    if(OnBoardingIDToOnBoardingObjMap.get(t.WhatId) == null){
            Customer_OnBoard__c o = new Customer_OnBoard__c(Id=t.WhatId);
            o.Project_Kick_Off_TR__c = TRUE;
            OnBoardingIDToOnBoardingObjMap.put(t.WhatId, o);
        }
}  
    

 if (t.subject=='AWF: Update Monthly Billing for Customer' && t.Status =='Completed')
 {
    if(OnBoardingIDToOnBoardingObjMap.get(t.WhatId) == null){
            Customer_OnBoard__c o = new Customer_OnBoard__c(Id=t.WhatId);
            o.Monthly_Billing_Update__c = TRUE;
            OnBoardingIDToOnBoardingObjMap.put(t.WhatId, o);
        }
 }

if (t.subject=='AWF: Renewal Monthly Billing Update' && t.Status =='Completed')
 {
    if(OnBoardingIDToOnBoardingObjMap.get(t.WhatId) == null){
            Customer_OnBoard__c o = new Customer_OnBoard__c(Id=t.WhatId);
            o.Renewal_Monthly_Billing__c = TRUE;
            OnBoardingIDToOnBoardingObjMap.put(t.WhatId, o);
        }
 }    
   
   if (t.subject=='AWF: Decommission Monthly Billing Update' && t.Status =='Completed')
 {
    if(OnBoardingIDToOnBoardingObjMap.get(t.WhatId) == null){
            Customer_OnBoard__c o = new Customer_OnBoard__c(Id=t.WhatId);
            o.Decommission_Monthly_Billing_Update__c = TRUE;
            OnBoardingIDToOnBoardingObjMap.put(t.WhatId, o);
        }
 }     
    
            if (t.subject=='AWF: Decommission Hardware' && t.Status =='Completed')
{
    if(OnBoardingIDToOnBoardingObjMap.get(t.WhatId) == null){
            Customer_OnBoard__c o = new Customer_OnBoard__c(Id=t.WhatId);
            o.Decommission_Hardware__c = TRUE;
            OnBoardingIDToOnBoardingObjMap.put(t.WhatId, o);
        }   
}
  
             if (t.subject=='AWF: Decommission OnDemand Vehicles' && t.Status =='Completed')
{
    if(OnBoardingIDToOnBoardingObjMap.get(t.WhatId) == null){
            Customer_OnBoard__c o = new Customer_OnBoard__c(Id=t.WhatId);
            o.Decommission_Vehicles__c = TRUE;
            OnBoardingIDToOnBoardingObjMap.put(t.WhatId, o);
        }   
}   
    
   
       if (t.subject=='AWF: Enable Additional Vehicles' && t.Status =='Completed')
{
    if(OnBoardingIDToOnBoardingObjMap.get(t.WhatId) == null){
            Customer_OnBoard__c o = new Customer_OnBoard__c(Id=t.WhatId);
            o.Enable_Additional_Vehicles__c = TRUE;
            OnBoardingIDToOnBoardingObjMap.put(t.WhatId, o);
        }
}   
    

if (t.subject=='AWF: OnDemand Project Kick-Off' && t.Status =='Completed')
{
    if(OnBoardingIDToOnBoardingObjMap.get(t.WhatId) == null){
            Customer_OnBoard__c o = new Customer_OnBoard__c(Id=t.WhatId);
            o.Project_Kick_Off_OD__c = TRUE;
            OnBoardingIDToOnBoardingObjMap.put(t.WhatId, o);
        }
}


if (t.subject=='AWF: Order Inventory' && t.Status =='Completed')
{
    if(OnBoardingIDToOnBoardingObjMap.get(t.WhatId) == null){
            Customer_OnBoard__c o = new Customer_OnBoard__c(Id=t.WhatId);
            o.Order_Inventory__c = TRUE;
            OnBoardingIDToOnBoardingObjMap.put(t.WhatId, o);
        }
}


if (t.subject=='AWF: Confirm OSM Region Added' && t.Status =='Completed')
{

    if(OnBoardingIDToOnBoardingObjMap.get(t.WhatId) == null){
                Customer_OnBoard__c o = new Customer_OnBoard__c(Id=t.WhatId);
                o.Confirm_OSM_Added__c = TRUE;
                OnBoardingIDToOnBoardingObjMap.put(t.WhatId, o);
            }
 }

if (t.subject=='AWF: Finance Confirm Payment Received' && t.Status =='Completed')
{

    if(OnBoardingIDToOnBoardingObjMap.get(t.WhatId) == null){
                Customer_OnBoard__c o = new Customer_OnBoard__c(Id=t.WhatId);
                o.Finance_Confirm_Payment__c = TRUE;
                o.Confirm_Payment__c = TRUE;
                o.Confirm_Payment_Count__c = 1;
                OnBoardingIDToOnBoardingObjMap.put(t.WhatId, o);
            }
 }

if (t.subject=='AWF: Confirm Receipt of SIS' && t.Status =='Completed')
{
     if(OnBoardingIDToOnBoardingObjMap.get(t.WhatId) == null){
                Customer_OnBoard__c o = new Customer_OnBoard__c(Id=t.WhatId);
                o.Confirm_SIS_Received__c = TRUE;
                
                OnBoardingIDToOnBoardingObjMap.put(t.WhatId, o);
            }
 }

if (t.subject=='AWF: GTFS and Backend Setup' && t.Status =='Completed')
{
    if(OnBoardingIDToOnBoardingObjMap.get(t.WhatId) == null){
                Customer_OnBoard__c o = new Customer_OnBoard__c(Id=t.WhatId);
                o.Create_GTFS_Feed_and_Backend_Setup__c = TRUE;
                
                OnBoardingIDToOnBoardingObjMap.put(t.WhatId, o);
            }
 }

if (t.subject=='AWF: Enable Survey' && t.Status =='Completed')
{

    if(OnBoardingIDToOnBoardingObjMap.get(t.WhatId) == null){
                Customer_OnBoard__c o = new Customer_OnBoard__c(Id=t.WhatId);
                o.Enable_Survey__c = TRUE;
                
                OnBoardingIDToOnBoardingObjMap.put(t.WhatId, o);
            }
}

if (t.subject=='AWF: Send the SIS to Customer' && t.Status =='Completed')
{
    if(OnBoardingIDToOnBoardingObjMap.get(t.WhatId) == null){
                Customer_OnBoard__c o = new Customer_OnBoard__c(Id=t.WhatId);
                o.Send_the_SIS_to_the_Customer__c = TRUE;
                
                OnBoardingIDToOnBoardingObjMap.put(t.WhatId, o);
            }
}

if (t.subject=='AWF: RealTime New Product Training' && t.Status =='Completed')
{

 if(OnBoardingIDToOnBoardingObjMap.get(t.WhatId) == null){
                Customer_OnBoard__c o = new Customer_OnBoard__c(Id=t.WhatId);
                o.New_Product_Training_rt__c = TRUE;
                
                OnBoardingIDToOnBoardingObjMap.put(t.WhatId, o);
            }
}

if (t.subject=='AWF: Traveler New Product Training' && t.Status =='Completed')
{
 if(OnBoardingIDToOnBoardingObjMap.get(t.WhatId) == null){
                Customer_OnBoard__c o = new Customer_OnBoard__c(Id=t.WhatId);
                o.New_Product_Training_TR__c = TRUE;
                
                OnBoardingIDToOnBoardingObjMap.put(t.WhatId, o);
            }
 }

if (t.subject=='AWF: OnDemand New Product Training' && t.Status =='Completed')
{

    if(OnBoardingIDToOnBoardingObjMap.get(t.WhatId) == null){
                Customer_OnBoard__c o = new Customer_OnBoard__c(Id=t.WhatId);
                o.New_Product_Training_od__c = TRUE;
                
                OnBoardingIDToOnBoardingObjMap.put(t.WhatId, o);
            }
 }

if (t.subject=='AWF: Preview Period' && t.Status =='Completed')
{
   
            if(OnBoardingIDToOnBoardingObjMap.get(t.WhatId) == null){
                Customer_OnBoard__c o = new Customer_OnBoard__c(Id=t.WhatId);
                o.Preview_Period__c = TRUE;
                
                OnBoardingIDToOnBoardingObjMap.put(t.WhatId, o);
            }
 }

if (t.subject=='AWF: RealTime Product Go Live' && t.Status =='Completed')
{
     if(OnBoardingIDToOnBoardingObjMap.get(t.WhatId) == null){
                Customer_OnBoard__c o = new Customer_OnBoard__c(Id=t.WhatId);
                o.Product_Go_Live_RT__c = TRUE;
                
                OnBoardingIDToOnBoardingObjMap.put(t.WhatId, o);
            }
}

if (t.subject=='AWF: Traveler Product Go Live' && t.Status =='Completed')
{
     if(OnBoardingIDToOnBoardingObjMap.get(t.WhatId) == null){
                Customer_OnBoard__c o = new Customer_OnBoard__c(Id=t.WhatId);
                o.Product_Go_Live_TR__c = TRUE;               
                OnBoardingIDToOnBoardingObjMap.put(t.WhatId, o);
            }
 }

if (t.subject=='AWF: OnDemand Product Go-Live' && t.Status =='Completed')
{    
    if(OnBoardingIDToOnBoardingObjMap.get(t.WhatId) == null){
                    Customer_OnBoard__c o = new Customer_OnBoard__c(Id=t.WhatId);
                    o.Product_Go_Live_OD__c = TRUE;               
                    OnBoardingIDToOnBoardingObjMap.put(t.WhatId, o);
                }
 }

if (t.subject=='AWF: Provide Credentials to Agency' && t.Status =='Completed')
{
 if(OnBoardingIDToOnBoardingObjMap.get(t.WhatId) == null){
                Customer_OnBoard__c o = new Customer_OnBoard__c(Id=t.WhatId);
                o.Provide_Credentials_to_Agency__c = TRUE;
                o.Date_OnDemand_Ready__c = Date.today();
                OnBoardingIDToOnBoardingObjMap.put(t.WhatId, o);
            }
}

if (t.subject=='AWF: Request Logo' && t.Status =='Completed')
{

    if(OnBoardingIDToOnBoardingObjMap.get(t.WhatId) == null){
                Customer_OnBoard__c o = new Customer_OnBoard__c(Id=t.WhatId);
                o.Request_Logo__c = TRUE;
                o.Date_Traveler_Ready__c = Date.TODAY();
                OnBoardingIDToOnBoardingObjMap.put(t.WhatId, o);
            }
}


if (t.subject=='AWF: Ship Units To Customer' && t.Status =='Completed')
{

    if(OnBoardingIDToOnBoardingObjMap.get(t.WhatId) == null){
                Customer_OnBoard__c o = new Customer_OnBoard__c(Id=t.WhatId);
                o.Ship_Units_To_Customer__c = TRUE;               
                OnBoardingIDToOnBoardingObjMap.put(t.WhatId, o);
            }
}

if (t.subject=='AWF: Enable Go-Live' && t.Status =='Completed')
{
     if(OnBoardingIDToOnBoardingObjMap.get(t.WhatId) == null){
                Customer_OnBoard__c o = new Customer_OnBoard__c(Id=t.WhatId);
                o.Weekly_Tasks__c = TRUE;               
                OnBoardingIDToOnBoardingObjMap.put(t.WhatId, o);
            }
 }

if (t.subject=='AWF: Schedule Travel' && t.Status =='Completed')
{


     if(OnBoardingIDToOnBoardingObjMap.get(t.WhatId) == null){
                Customer_OnBoard__c o = new Customer_OnBoard__c(Id=t.WhatId);
                o.Schedule_Travel__c = TRUE;               
                OnBoardingIDToOnBoardingObjMap.put(t.WhatId, o);
            }
}

if (t.subject=='AWF: Check Inventory' && t.Status =='Completed')
{
    if(OnBoardingIDToOnBoardingObjMap.get(t.WhatId) == null){
                Customer_OnBoard__c o = new Customer_OnBoard__c(Id=t.WhatId);
                o.Check_Inventory__c = TRUE;               
                OnBoardingIDToOnBoardingObjMap.put(t.WhatId, o);
            }
 }

    if (t.subject=='AWF: Order Inventory' && t.Status =='Completed')
{
    if(OnBoardingIDToOnBoardingObjMap.get(t.WhatId) == null){
                Customer_OnBoard__c o = new Customer_OnBoard__c(Id=t.WhatId);
                o.Order_Inventory__c = TRUE;               
                OnBoardingIDToOnBoardingObjMap.put(t.WhatId, o);
            }
}


if (t.subject=='AWF: Update Inventory' && t.Status =='Completed')
{
    if(OnBoardingIDToOnBoardingObjMap.get(t.WhatId) == null){
                Customer_OnBoard__c o = new Customer_OnBoard__c(Id=t.WhatId);
                o.Update_Inventory__c = TRUE;               
                OnBoardingIDToOnBoardingObjMap.put(t.WhatId, o);
            }
}

if (t.subject=='AWF: Submit Expense Form' && t.Status =='Completed')
{
    if(OnBoardingIDToOnBoardingObjMap.get(t.WhatId) == null){
                Customer_OnBoard__c o = new Customer_OnBoard__c(Id=t.WhatId);
                o.Expense_Form__c = TRUE;               
                OnBoardingIDToOnBoardingObjMap.put(t.WhatId, o);
            }
 }

    if (t.subject=='AWF: Decommission Hardware' && t.Status =='Completed')
{
    if(OnBoardingIDToOnBoardingObjMap.get(t.WhatId) == null){
                Customer_OnBoard__c o = new Customer_OnBoard__c(Id=t.WhatId);
                o.Hardware_Decommissioned__c = TRUE;               
                OnBoardingIDToOnBoardingObjMap.put(t.WhatId, o);
            }
}
  
       if (t.subject=='AWF: Decommission OnDemand Vehicles' && t.Status =='Completed')
{
    if(OnBoardingIDToOnBoardingObjMap.get(t.WhatId) == null){
                Customer_OnBoard__c o = new Customer_OnBoard__c(Id=t.WhatId);
                o.OnDemand_Decommission_Product__c = TRUE;               
                OnBoardingIDToOnBoardingObjMap.put(t.WhatId, o);
            }
} 
    
    
    for(Id id : OnBoardingIDToOnBoardingObjMap.keyset()){
    Customer_OnBoard__c thisOnb = new Customer_OnBoard__c();
    thisOnb = OnBoardingIDToOnBoardingObjMap.get(id);
    OnBoardingsToUpdate.Add(thisOnb);

}
   try {
        update OnBoardingsToUpdate; 
    } catch (system.Dmlexception e) {
        system.debug (e);
    }
}
}

With this Test Class:
 
@isTest (seeAllData=false)
private class TestOnBoardingUpdateFromTask {

    public static List<Task> tasksList;
    public static List<Opportunity> opportunitiesList;
    public static List<Account> accountsList;
    public static String subject;
    
    static void init(){
    tasksList = new List<Task>();
    opportunitiesList = new List<Opportunity>();
    accountsList = new List<Account>();    
    
        accountsList.add(new Account(Name = 'Test', Sales_Region__c = '1 - Southeast', Type = 'Prospect' ));                       
        opportunitiesList = new List<Opportunity>{
            new Opportunity(
                        Name = 'Test1',
                        CloseDate = date.today().addDays(5),
                        AccountId = accountsList[0].Id,
                        Type = 'New Business', 
                        TransLoc_Hardware__c = 'Yes',
                        Integration__c = 'NO', 
                        StageName = 'Proposal'),
                new Opportunity(
                        Name = 'Test2',
                        CloseDate = date.today().addDays(5),
                        AccountId = accountsList[0].Id,
                        Type = 'New Business', 
                        TransLoc_Hardware__c = 'Yes',
                        Integration__c = 'NO', 
                        StageName = 'Proposal'),
                new Opportunity(
                        Name = 'Test3',
                        CloseDate = date.today().addDays(5),
                        AccountId = accountsList[0].Id,
                        Type = 'New Business', 
                        TransLoc_Hardware__c = 'Yes',
                        Integration__c = 'NO', 
                        StageName = 'Proposal'),
                new Opportunity(
                        Name = 'Test4',
                        CloseDate = date.today().addDays(5),
                        AccountId = accountsList[0].Id,
                        Type = 'New Business', 
                        TransLoc_Hardware__c = 'Yes',
                        Integration__c = 'NO', 
                        StageName = 'Proposal'),
                new Opportunity(
                        Name = 'Test5',
                        CloseDate = date.today().addDays(5),
                        AccountId = accountsList[0].Id,
                        StageName = 'Proposal')
            };
    }
    
    static testMethod void testWithExistingTask() {
    init();
    Test.startTest();
    
        tasksList = new List<Task>{new Task(
        Subject = subject, Status='Completed',  Priority = 'Normal'
        ),
        new Task(Subject='AWF: RealTime Project Kick Off', Status ='Completed'),
        new Task(Subject='AWF: RealTime New Product Training' , Status='Completed'),
        new Task(Subject='AWF: RealTime Product Go Live' , Status='Completed'),  
        
        new Task(Subject='AWF: Check Inventory', Status='Completed'),
        new Task(Subject='AWF: Order Inventory' , Status='Completed'),
        new Task(Subject='AWF: Start Installation Checklist' , Status='Completed'),
        new Task(Subject='AWF: Ship Units To Customer' , Status='Completed'), 
        new Task(Subject='AWF: Submit Expense Form' , Status='Completed'),
        new Task(Subject='AWF: Update Inventory' , Status='Completed'),
        new Task(Subject='AWFl Schedule Travel', Status = 'Completed'),
          
        new Task(Subject='AWF: OnDemand Product Go-Live' , Status='Completed'), 
        new Task(Subject='AWF: OnDemand Project Go Live' , Status='Completed'), 
        new Task(Subject='AWF: OnDemand Project Kick-Off' , Status='Completed'),
        new Task(Subject='AWF: OnDemand New Product Training' , Status = 'Completed'),
            
        new Task(Subject='AWF: Traveler New Product Training' , Status='Completed'),
        new Task(Subject='AWF: Traveler Product Go Live' , Status='Completed'),
        new Task(Subject='AWF: Traveler Project Kick-Off' , Status='Completed'),
        
        new Task(Subject='AWF: Preview Period' , Status='Completed'),
        new Task(Subject='AWF: Request Logo' , Status='Completed'),
        new Task(Subject='AWF: Confirm Receipt of SIS' , Status='Completed'),
        new Task(subject='AWF: Provide Credentials To Agency' , Status='Completed'),
        new Task(Subject='AWF: Enable Survey' , Status='Completed'),
        new Task(Subject='AWF: GTFS and Backend Setup' , Status = 'Completed'),
        new Task(Subject='AWF: Enable Go-Live', Status='Completed') ,
        new Task(Subject='AWF: Confirm OSM Region Added', Status ='Completed'),
        new Task(Subject='AWF: Enable Additional Vehicles' , Status = 'Completed'),
        new Task(Subject='AWF: Decommission OnDemand Vehicles', Status = 'Completed'),
        new Task(Subject='AWF: Decommission Hardware' , Status = 'Completed'),
            
        new Task(Subject='AWF: Finance Confirm Payment Received' , Status = 'Completed'),
        new Task(Subject='AWF: Decommission Monthly Billing Update' , Status = 'Completed'),
        new Task(Subject='AWF: Renewal Monthly Billing Update' , Status = 'Completed'),
        new Task(Subject='AWF: Update Monthly Billing for Customer' , Status = 'Completed')
        
        };
        
        
        insert accountsList;
        insert opportunitiesList;
        insert tasksList;       
        
    tasksList = [
        SELECT Id, WhatId
        FROM Task
        
        ];

        //if (!tasksList.isEmpty()){
        Integer i = 0;
        for(Task t : tasksList){
            t.WhatId = opportunitiesList[i].Id;
            //i++;
        }
        
        update tasksList;
        
    //System.assertEqual(tasksList[0].WhatId, opportunitiesList[0].Id);
    
    //Test.stopTest();
    }
    
 }

When I run the Test Class I get the following email from a Process Flow that is being executed:
 
An error occurred at element myRule_5_A1 (FlowRecordUpdate).
UPDATE --- UPDATE FAILED --- ERRORS : (LIMIT_EXCEEDED) System.LimitException: Too many DML statements: 151
________________________________________
This report lists the elements that the flow interview executed. The report is a beta feature.
We welcome your feedback on IdeaExchange.
Flow Details
Flow Name: Activity_Updates_for_Visual_Workflow
Type: Workflow
Version: 14
Status: Active
Flow Interview Details
Interview Label: Activity_Updates_for_Visual_Workflow-14_Task
Current User: Chris Fraser (005d00000066RvV)
Start time: 11/3/2016 3:12 PM
Duration: 0 seconds
How the Interview Started
Chris Fraser (005d00000066RvV) started the flow interview.
Some of this flow's variables were set when the interview started.
myVariable_old = null
myVariable_current = 00TP000000FJyvpMAD
RecursiveCountVariable = 2.00
ASSIGNMENT: myVariable_waitStartTimeAssignment
{!myVariable_waitStartTimeVariable} Equals {!Flow.CurrentDateTime}
Result
{!myVariable_waitStartTimeVariable} = "11/3/2016 3:12 PM"
DECISION: myDecision
DECISION: myDecision2
DECISION: myDecision4
Executed this outcome: myRule_5
Outcome conditions: and
1. {!myVariable_current.Subject} (AWF: OnDemand New Product Training) Contains OnDemand New Product Training
2. {!myVariable_current.IsClosed} (true) Equals true
Logic: All conditions must be true (AND)
RECORD UPDATE: myRule_5_A1
Find all Task records where:
Id Equals {!myVariable_current.Id} (00TP000000FJyvpMAD)
Update the records’ field values.
New_Product_Training_od__c = true
Result
Failed to update records that meet the filter criteria.
________________________________________
Error Occurred: UPDATE --- UPDATE FAILED --- ERRORS : (LIMIT_EXCEEDED) System.LimitException: Too many DML statements: 151
________________________________________
________________________________________

Can someone point out the error of my ways?

Hi I am new in Salesforce,
Is ther any way to extraction, processing, and re-loading milliions of data in one atempt of SFDC and store into thierd party database ?.
I found 'Heroku' tool we can use but 
Heroku Connects main purpose is to sync data between a third party database and Salesforce. Our purpose is extraction, processing, and re-loading.
The scale of data required for the extraction does not make Heroku Connect viable 
Heroku Connect is simply not applicable in this use case, then we will need to callout directly to the API with many callouts which may hit up against Salesforces own API limits. But these limits are adjustable and we are only looking to do an extract once or twice.
Please help me on the same. how I can use Heroku in this case?

Please if you have any document or link please forward me
Hi,

I am having a problem changing the recipent fot the flow error emails.
I modified all of the flows with the user i want the flow error email to be sent to and it didn't worked..
When i looked at the user setting the checkbox "Send Apex Warning Emails" it is turned off.
So i still can't understand why this user keeps getting thos mails :/

Can someone please consult?

Thanks for all the answers!
Can I reference my List type of Custom Setting in my validation rule ?If yes can anyone please let me know how?

Thanks.
The senario is I want to perform insert and update operation on Case object and execute different operations on the basis of this before trigger execute.

The thing is I have wrote a before trigger and used three helper classes for insert, update and operation process .not getting error after saving entire apex code  but while updating record I am getting ,

An error has occurred while processing your request. The salesforce.com support team has been notified of the problem. If you believe you have additional information that may be of help in reproducing or correcting the error, please contact Salesforce Support. Please indicate the URL of the page you were requesting, any error id shown on this page as well as any other related information. We apologize for the inconvenience. 

Thank you again for your patience and assistance. And thanks for using salesforce.com!
Error ID: 1825935943-342219 (1204153959)

This eror please let me know the solution idf you know.

What could be the reson i am getting this error...?
I'm getting " TLS 1.0 has been disabled in this organization. Please use TLS 1.1 or higher when connecting to Salesforce using https." error when I refresh my eclipse. I performed below actions to fix the issue, but I'm not able to fix the error. 

1) Checked the critical updates - There is no update related to TLS 1.0 in my sandbox
2) I have Java 1.7 Version and enabled TLS 1.1 and 1.2. 
3) Enabled TLS 1.1 , 1.2 in all the browsers.
4) Added "-Dhttps.protocols=TLSv1.1,TLSv1.2"

Please let me know, is anything am missing here to fix this issue? 

User-added image
 Hi All...

I have a multiselect field Production_Region__c contains values A,B,C,D and E.

Using process builder have to create a new record if Production_Region__c field value does not contain value D.
For example: If user selects values A and D , process should not create any new record
If any one or more values(A,B,C and E) except value D is selected, process should create a new record

can any one suggest me some approach?
Hi,

Here i am using the wrapper class to dispaly records ............
My concern : I want to edit the record after the display how ?

My VF Page

<apex:page controller="CheckAllUsingJavascriptController"> <script type="text/javascript"> function selectAllCheckboxes(obj,receivedInputID){ var inputCheckBox = document.getElementsByTagName("input"); for(var i=0; i<inputCheckBox.length; i++){ if(inputCheckBox[i].id.indexOf(receivedInputID)!=-1){ inputCheckBox[i].checked = obj.checked; } } } </script> <apex:form > <apex:pageBlock > <apex:pageBlockTable value="{!wrapAccountList}" var="accWrap" id="table" title="All Accounts"> <apex:column > <apex:facet name="header"> <apex:inputCheckbox onclick="selectAllCheckboxes(this,'inputId')"/> </apex:facet> <apex:inputCheckbox value="{!accWrap.selected}" id="inputId"/> </apex:column> <apex:column value="{!accWrap.acc.Name}" /> <apex:column value="{!accWrap.acc.BillingState}" /> <apex:column value="{!accWrap.acc.Phone}" /> </apex:pageBlockTable> </apex:pageBlock> </apex:form> </apex:page>


My Controller

public class CheckAllUsingJavascriptController {
    public List<wrapAccount> wrapAccountList {get; set;}
     
    public CheckAllUsingJavascriptController(){
        if(wrapAccountList == null) {
            wrapAccountList = new List<wrapAccount>();
            for(Account a: [select Id, Name,BillingState, Website, Phone from Account limit 10]) {
                // As each Account is processed we create a new wrapAccount object and add it to the wrapAccountList
                wrapAccountList.add(new wrapAccount(a));
            }
        }
    }
     
    public class wrapAccount {
        public Account acc {get; set;}
        public Boolean selected {get; set;}
 
        //This is the contructor method. When we create a new wrapAccount object we pass a Account that is set to the acc property. We also set the selected value to false
        public wrapAccount(Account a) {
            acc = a;
            selected = false;
        }
    }
}

Advance Thanks
Siv
 
  • November 08, 2015
  • Like
  • 0
Dear Experts,

        I want to "Create a new lead  using controller and visualforce and displaythe saved data in new visualforce in output format and in same page in output format"

       Please send me code for this.

Regards,
Venkat.
Hi all, i have used the Vf page and controller to split the values of a single filed into multiple columns.

The issue is each name is getting diplayed 3 times on the page. But if i use Set insted a List i'm able to eliminate the duplicates.

Please see the below code and let me know where exactly the issue is(i guess the issue is inside the for loop but could not sort it out
Note: i'm using custom settings object and retrieving the values to display them on page with a name and checkbox
VF page: 
	<apex:pageBlockTable value="{!MyWrappers}" var="wrap" id="pgtbl">
   <apex:column width="100px">
 <apex:inputCheckBox value="{!wrap.checkbox1}"/>
 <apex:outputField value="{!wrap.mySec1.name}"/>
    </apex:column>
 <apex:column width="100px">
   <apex:inputCheckBox value="{!wrap.checkbox2}"/>
    <apex:outputField value="{!wrap.mySec2.name}"/>
 </apex:column>
 <apex:column width="100px">
   <apex:inputCheckBox value="{!wrap.checkbox3}"/>
   <apex:outputField value="{!wrap.mySec3.name}"/> 
 </apex:column>
</apex:pageBlockTable>

Controller code:
public with class Controller {
Public  List<MyWrapper> myWrappers{get; set;}

public class MyWrapper
 {
    public Boolean checkbox1{get;set;}
    public Boolean checkbox2{get;set;}
    public Boolean checkbox3 {get;set;}
    public Custom_settings_Object__c myLead1{get;set;} 
    public Custom_settings_Object__c myLead2{get;set;}
    public Custom_settings_Object__c myLead3{get;set;}
    
 }     
    public pagereference initiallds()----calling this action from page component
    {     
  myWrappers=new List<MyWrapper>();
  Integer idx=0;
  MyWrapper wrap;      
    for(Custom_settings_Object__c ld: Custom_settings_Object__c.getall().values())   
    {               
      if (Math.mod(idx, 3)==0)
       {   
          wrap =  new MyWrapper();
           wrap.myLead1=ld; 
           
       }
      if (Math.mod(idx, 3)==1)
       {
          wrap.myLead2=ld;
      
       }
   if (Math.mod(idx, 3)==2)
       {           
       wrap.myLead3=ld;
           
       }           
          ++idx;        
          myWrappers.add(wrap);
                }    
return null;
    }
	}



 
I have a small problem. I'm trying to run the code snipper provided in the TrailHead for apex testing on "Creating TEst Data for Apex Tests" and my test code fails two test cases out 4. Here what my test runs results.

User-added image

Here what the code looks like:
@isTest
private class TestAccountDeletion {

    @isTest static void TestDeleteAccountWithOneOpportunity() {
        // Test data setup
        // Create one account with one opportunity by calling a utility method
        Account[] accts = TestDataFactory.createAccountsWithOpps(1,1);
        
        // Perform test
        Test.startTest();
        Database.DeleteResult result = Database.delete(accts[0], false);
        Test.stopTest();

        // Verify that the deletion should have been stopped by the trigger,
        // so check that we got back an error.
        System.assert(!result.isSuccess());
        System.assert(result.getErrors().size() > 0);
        System.assertEquals('Cannot delete account with related opportunities.',
                             result.getErrors()[0].getMessage());
    }
    
    @isTest static void TestDeleteAccountWithNoOpportunities() {
        // Test data setup
        // Create one account with no opportunities by calling a utility method
        Account[] accts = TestDataFactory.createAccountsWithOpps(1,0);
        
        // Perform test
        Test.startTest();
        Database.DeleteResult result = Database.delete(accts[0], false);
        Test.stopTest();

        // Verify that the deletion was successful
        System.assert(result.isSuccess());
    }
    
    @isTest static void TestDeleteBulkAccountsWithOneOpportunity() {
        // Test data setup
        // Create accounts with one opportunity each by calling a utility method
        Account[] accts = TestDataFactory.createAccountsWithOpps(200,1);
        
        // Perform test
        Test.startTest();
        Database.DeleteResult[] results = Database.delete(accts, false);
        Test.stopTest();

        // Verify for each record.
        // In this case the deletion should have been stopped by the trigger,
        // so check that we got back an error.
        for(Database.DeleteResult dr : results) {
            System.assert(!dr.isSuccess());
            System.assert(dr.getErrors().size() > 0);
            System.assertEquals('Cannot delete account with related opportunities.',
                                 dr.getErrors()[0].getMessage());
        }
    }
    
    @isTest static void TestDeleteBulkAccountsWithNoOpportunities() {
        // Test data setup
        // Create accounts with no opportunities by calling a utility method
        Account[] accts = TestDataFactory.createAccountsWithOpps(200,0);
        
        // Perform test
        Test.startTest();
        Database.DeleteResult[] results = Database.delete(accts, false);
        Test.stopTest();

        // For each record, verify that the deletion was successful
        for(Database.DeleteResult dr : results) {
            System.assert(dr.isSuccess());
        }
    }
}

Any help much appreciated.