0

I need to be able to initiate a record-triggered flow on the Quote object whenever a quote has been saved within the QLE.

I need to be able to accurately determine if a quote line have been added, removed, or simply anytime the QLE has been saved to run the flow. I've been struggling to find a way to accurately detect this. I'm trying to use a record-triggered flow on Quote that should only run after the quote lines have saved to the database so that I can analyze them.

I tried leveraging the Quote.SBQQ__LastSavedOn__c and Quote.SBQQ__LastCalculatedOn__c fields and looking for delta changes in their timestamps. But the fields are unreliable and do not consistently update with each QLE save.

I could use a roll-up summary to detect a change in the number of child records, but that obviously wouldn't always be accurate if the user removes 1 quote line and adds 1 quote line.

I could use the Last Modified Date on the quote, but that could trigger the flow to run too often since our users also update fields manually on the quote and I only need the flow to run after the user saves the quote within the QLE.

I also tried using a Price Rule, and having it run last in the series of price rules, to run anytime a quote is saved and update a hidden field on the Quote in order and having the flow trigger when that field has been changed. But the problem is that price rules run and finish before the QLE has committed quote lines to the database, and therefore if my flow uses a Get Quote Lines query I'm actually picking up the quote lines that exist before the QLE is saved and not after.

There's got to be some way to do this accurately in CPQ, but I haven't been able to find the magic method to detect when the QLE has been saved.

1
  • Since you need to understand when a quoteline is added, deleted or just updated on the QLE, doesn't it make sense to move the trigger on the quoteline object and call an autolaunched flow that does logic on the related Quote?
    – vila994
    Commented Sep 6, 2023 at 12:01

1 Answer 1

0

I recently implemented a similar requirement, whereas i am using flow custom errors to replicate 'product rules' as i have the Large Quote Threshold enabled and have issues with quotes over said threshold.

I found out the object - Record Job - is set during CPQ calculations and set by the CPQ apex when jobs are run. This is triggered anytime an async calc is run or clicking the 'calculate' button on quote as well. The only time it does not fire immediately is if lines are > the Large Quote Threshold. I built a custom model to account for that during approval process.

So, my reccommendation would be exploring the Record Job object as a way to control when CPQ is currently calculating, if needing to run a Record-Triggered Flow off of this. This is created and updated during every cpq calculation and a record exists for each quote (unique per quote). For example, i set the Quote lookup field in one before save flow and have second that runs when quote is set and controls all of my custom validations. Record Job is used for Quote Doc, Amendment service, etc as CPQ uses it to store error messages and insights on job statuses. I highly doubt any intent was for admins to configure off of it, but alas, we are here.

There can be some funky behavior to this, and i am still learning it myself, but it is certainly working for my similar use case!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .