This topic contains 4 replies, has 0 voices, and was last updated by srussell 6 years, 7 months ago.

  • Author
    Posts
  • #18077

    srussell

    I have a custom record type with a script that creates an externalid when a new record is entered. The externalid is a concatenation of several record fields, which should always be unique. When it is a duplicate the script throws an error, but the record gets created anyway. Is there a way for the script to catch that error and stop before the record gets created? I can probably do it with a search, but I’m wondering if there’s a simpler way.
    This is a cached copy. Click here to see the original post.

  • #18078

    Olivier Gagnon NC

    What script trigger are you using? Before Submit, or After Submit?

  • #18079

    srussell

    After. For some reason I couldn’t get the scripted externalid to save on a before submit trigger.

  • #18080

    Olivier Gagnon NC

    Ok that’s why. After Submit, as the name implies, triggers after the record has been committed to the database. So any script errors do not prevent save – save already occurred.

    If you cannot resolve the issue with External ID (there may indeed be a NS limitation there, I cannot recall off the top of my head), you would need to include a delete feature of your after submit script to destroy the record, rather than just throwing an error.

  • #18081

    srussell

    Makes sense. Thanks.

You must be logged in to reply to this topic.