Forum Replies Created

  • Vishant

    Member
    June 20, 2017 at 10:00 am in reply to: Trigger to update contact owner in Salesforce

    Yes I had done the same step that you had done in your  latest attached document. There might be some issues with process builder thts y i m doing it with triggers but encountering the same probz

     

  • Vishant

    Member
    June 20, 2017 at 9:20 am in reply to: Trigger to update contact owner in Salesforce

    Still not working i had done the same thing and the error is

     
    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 3016F000000QT26. 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.

    Click here to return to the previous page.

     

     

    Can u do it with the trigger

  • Vishant

    Member
    June 20, 2017 at 6:47 am in reply to: Trigger to update contact owner in Salesforce

    Yes thats the scenario ...i tried it with Process builder but there was an error of flow...i encountered same error from the trigger

  • Hi Mohit ,

    I am attaching a trigger to count no. of contacts on account (Roll up-action-count)

     

     

    Trigger countContacts on Contact (after insert){

    Set<Id> accIdset = new Set<Id>();
    List<Account> accList = new List<Account>();
    List<AggregateResult> arList = new List<AggregateResult>();
    Map<String,Double> acmap = new Map<String,Double>();
    //Added Account Id in Set
    for (Contact con: Trigger.new){

    accIdset.add(con.accountId);
    }
    // Query Contact Created
    if(accIdset.size()>0){
    arList = [select AccountId aid,Count(Id) i from Contact where AccountId IN :accIdset group by AccountId];
    }

    for(AggregateResult q : arList){
    acmap.put((String)q.get('aid'),(Double)q.get('i'));
    }

    for (Account acc:[Select Id,Total_Count__c From Account Where Id in: accIdset]){

    acc.Total_Count__c = acmap.get(acc.Id);
    accList.add(acc);
    }
    update accList;
    }

  • Actually i have to deal with all three of them(Account,contact,opportunity) on the same VF page and after selection particular records i want them to get displayed on a new page block

Popular Salesforce Blogs