function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Marco Pollastri 1Marco Pollastri 1 

call a flow via a trigger

Hi,
I am trying to call a Flow with a trigger when the 'clone price book' field check box in the Pricebook object is marked as true.

trigger Clonepricebook on Pricebook2 (after insert) {
for(Pricebook2 Price: Trigger.new){
        If (Price.Clone_Price_Book__c == true ){
        flow.Interview.Clone_Client_Price_Book myFlow= new Flow.Interview.Clone_Client_Price_Book;        }
    }
}
Unfortunately, Salesforce does not allow to create actions from price book

So i think the trigger is the only solution to recall the Flow.

Thanks 
Suraj Tripathi 47Suraj Tripathi 47
Hi Marco Pollastri 1,
kindly find the solution
 
trigger Clonepricebook on Pricebook2 (after insert) {
for(Pricebook2 Price: Trigger.new){
        If (Price.Clone_Price_Book__c == true ){
        flow.Interview.Clone_Client_Price_Book myFlow= new Flow.Interview.Clone_Client_Price_Book;     
    myFlow.start();   //added
        }
    }
}
If you find your Solution then mark it as a best answer. 

Thanks and Regards
Suraj Tripathi.
Marco Pollastri 1Marco Pollastri 1
Hey Suraj,
Thanks for your answer, 
I receive this error message on line 4: Unexpected token';'