Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Sometimes it is necessary to disable the Submit Quote button in Quote Configurator. There are two ways to do this.

 

One way is to throw an exception, which automatically disables the Submit Quote button. This must be done in the quote header logic post-phase.

 

This is usually done only for some users. Rather than assigning this functionality to various groups (such as Sales, Marketing, Pricing, etc.) I find it much easier to create a single group called “Block Submit” and then add the users to that group as necessary – regardless of the other groups they may belong to. This way there is no need to touch the code every time the client decides that another group should have the Submit Quote button disabled for them.

Code Block
def ug = api.find("U", Filter.equal("groups.uniqueName", "Block Submit"))

def loginName = api.user().loginName

if (quoteProcessor.isPostPhase() && api.isUserInGroup("Block Submit", loginName) == true) {
  api.throwException("This user does not have permission to submit quote")
}

Note: the  The exception MUST be thrown in PostPhase. Otherwise it won't work.

This way has a couple of drawbacks. When this functionality is triggered the QC displays a generic error message “Quote calculated with errors”, which may confuse the user. Also, if another exception is thrown it’s not as obvious to the user because an error is expected. But more importantly throwing an exception may interfere with other functionality in the quote – such as Meta Configurator.

 


Another – and possible possibly a better – way to disable the Submit Quote button is to create a HIDDEN input with a required value and assign null to the value. Like so:

...