Throw error in calculated field formula

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bandtank
    Active Community Member
    • Mar 2017
    • 385

    Throw error in calculated field formula

    Is there a way to stop a Before Save Custom Script from successfully saving if a custom validation rule fails? For example:

    Code:
    ifThenElse(
        subType == 'Cell Phone' &&
        (total != 0 && total != 15 && total != 25 && total != 50),
        throw new Error("Total must equal 0, 15, 25, or 50 when subType is 'Cell Phone'")
    )
    That doesn't work, but that's how I want it to work. When the user clicks save, they should be given an error message indicating that the total must equal, 0, 15, 25, or 50 if subType is 'Cell Phone'. Is there a way to do this in a custom save formula or do I have to use a controller method?
  • yuri
    Member
    • Mar 2014
    • 8624

    #2
    There is no way.
    If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

    Comment

    • bandtank
      Active Community Member
      • Mar 2017
      • 385

      #3
      Thanks

      Comment

      Working...