• pris
  • NEWBIE
  • 0 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 4
    Replies
Hello Everyone,

I would kike to know few of the answers to the below questions, 
1. There are two fields, if the user populate two field values if we combine those values uniqueness should be maintained, how to achieve this without coding?

2.There are two workflow rules on the same object say namely wf1 and wf2. If wf1 fires then a field will be updated on the same object, if the field updated and due to this wf2 criteria meets then what will happen, wf2 will fire or not?

3. How many maximum groupings we can do for summary, matrix and join reports?

Thanks in advance!!
I am beginner :  Not able to solve Trailhead challange for-Developer Beginner :Process Automation-Automate Basic Business Processes with Process Builder
"
Create a process to update child record when the parent is updated.
You've been given a requirement to keep Contact addresses in sync with the Account they belong to. Use Process Builder to create a new process that updates all child Contact addresses when the address of the Account record is updated. This process:
Can have any name.
Must be activated.
Must update Contact mailing address fields (Street, City, State, Post Code, Country) when the parent Account shipping address field values are updated.
NOTE: You may have to deactivate the validation rule for the Contacts object (created from a previous challenge) in order to complete this challenge."

 What I had tried 
Deleted validation rule on contact  from previous challange.
 Using Process builder created new Process with below details
Object: Account
Criteria:'Update Address' with condidtion

Field: selected shipping street, city, state,postalcode and country
Operator: Ischanged
Type: boolean
value: true

Condition:
Any condition met (OR)

 For Immediate action
Action name: Mailing address change
Records: Account.contacts
Criteria for Updating Records:No criteria—just update the records!

Set new field values for the records you update:

Field: selected Mailing street, city, state,postalcode and country
Type: Reference
value:  selected shipping street, city, state,postalcode and country

 after this saved and activated. So Once I check challange got below error:
"Challenge Not yet complete... here's what's wrong:
An update to an account record failed to update the mailing address fields of all child contact records. Make sure that the process is correct and that it is activated."

So Please help.





 

Hi All,

Here by i'm adding my trigger & triggerHandler class that i have written. Can anybody give me TestClass for this?Urgent reply needed.
Trigger
_------------------
trigger CaseTrigger on Case (after undelete, before delete, before insert, after update) {

    CaseTriggerHandler handler = new CaseTriggerHandler();    

    //Delete related action plans
    if (trigger.isdelete ){
        handler.OnBeforeDelete(trigger.old);        
    }    
    //Undelete related action plans
    else if (trigger.isUnDelete ){
        handler.OnAfterUndelete(trigger.new);       
    }
    // deleting the cases if Delete_Case__c sets to true
    else if (trigger.isUpdate && trigger.isAfter){        
        handler.OnAfterUpdate(trigger.new);
    }
}

/*********************************************************************************
CaseTriggerHandler  class:
----------------------------------------------
public without sharing class CaseTriggerHandler {
     List<Case>          deleteCasesList     =     new list<case>();
     // constructor
     public CaseTriggerHandler(){}     
     // Call on after update trigger to delete all cases where Delete_Case__c is true
     public void OnAfterUpdate(List<Case> ListCase){         
         for( Case c : ListCase){
                 // if Delete case is true add this record to list
                 if(c.Delete_Case__c){
                    Case c1=new Case(Id=c.Id);
                    deleteCasesList.add(c1);
                 }
            }
            // deleting the list items 
            if(deleteCasesList != null && deleteCasesList.size()>0){            
                 delete deleteCasesList;
            }
     }
     // Call on Before Delete trigger on Case Object
     public void OnBeforeDelete(List<Case> ListCase){     
        set<ID>             cIds    = new set<ID>();
        List<String>        apIds   = new List<String>();
        List<ActionPlan__c> deletePermantently_apIds= new List<ActionPlan__c>();       
        for( Case c : ListCase ){
            cIds.add( c.Id );
        }
        
        /* GET Action Plans to delete from recycle bin */
        deletePermantently_apIds = [ select Id, Name , LastModifiedDate from ActionPlan__c where Case__c in : cIds and isDeleted = true ALL ROWS ];
        
        if ( deletePermantently_apIds.size() >0 ){          
            Database.emptyRecycleBin(deletePermantently_apIds);
        }           
        
        //Get all action plans associated with Campaigns
        for( Case a : [Select (Select Id From Action_Plans__r) From Case a where Id in : cIds]){
            if (a.Action_Plans__r.size() >0 ){
                for(ActionPlan__c ap :a.Action_Plans__r ){
                    apIds.add(ap.Id);
                }
            }
        }
        if ( apIds.size() >0 ){
            ActionPlansBatchDelete aPBatch = new ActionPlansBatchDelete(apIds, Userinfo.getUserId());
            Database.ExecuteBatch( aPBatch );       
        }
    }
    // Call on After Undelete trigger on Case Object
    public void OnAfterUndelete(List<Case> ListCase){    
        set<ID>             cIds    = new set<ID>();           
        for( Case c : ListCase){
            cIds.add( c.Id );
        }
        list <ActionPlan__c> aPs = [ select Id from ActionPlan__c where Case__c in : cIds ALL ROWS ];
        
        try{
            if(ActionPlanObjectTriggerTest.isTest){
                //throw dmlException
                insert new Contact();   
            }
            //undelete aPs;
            Database.undelete( aPs,false);
        } catch ( Dmlexception e ){
            for (Case c: ListCase){
                c.addError('You can not undelete an action plan whose related object is deleted.');
            }
        }
    }
    
}