manswaag
manswaag

Reputation: 11

Guidewire Unique ID/Number generation

I'm trying to generate a new unique ID/number for a check in the claimcenter.

I've read that we need to use the SequenceUtil class, but I've no idea how to proceed further.

package libraries

uses gw.plugin.claimnumbergen.IClaimNumGenAdapter
uses gw.plugin.util.SequenceUtil

class PaymentNumberGenerate implements IClaimNumGenAdapter {

  override function generateNewClaimNumber(claim : Claim) : String {
    return null
  }

  override function generateTempClaimNumber(claim : Claim) : String {
    return null
  }

  override function cancelNewClaimNumber(claim : Claim, claimNumber : String) {

  }
}

Upvotes: 1

Views: 133

Answers (2)

SteveDripps
SteveDripps

Reputation: 557

You will need to use the gw.api.system.database.SequenceUtil.next function to generate unique check numbers, but for this problem in ClaimCenter you will not be implementing the IClaimNumGenAdapter interface again. Since you want to be careful with the sequences you generate and keep track of I have always found it better to have a wrapper class for these and only call the gw.api.system.database.SequenceUtil.next from this class.

For example (psuedo code, not guaranteed to compile):

class SequenceUtilWrapper {

  //You'd call this from your IClaimNumGenAdapter implementation class
  public static function getNextClaimNumber() : long {
    gw.api.system.database.SequenceUtil.next(1, "ClaimNumber")
  }

  //You'd call this from somewhere during the Check Wizard
  public static function getNextCheckNumber() : long {
    gw.api.system.database.SequenceUtil.next(1, "CheckNumber")
  }
}

If you have multiple check number sequences (for example for multiple banks) you can specify different wrapper methods for each bank. Keep in mind that the SequenceUtil.next() returns a primitive long and you'll have to write your own code to turn it into a String with the appropriate leading zeros for your scenario.

Upvotes: 1

tech.ninja
tech.ninja

Reputation: 31

Do you want to generated Random Numbers (16365,15232), Or in Sequence (1,2,3,4)?

  • If you need to get sequence for Claim Numbers :

gw.api.system.database.SequenceUtil.next(1, "SEQUENCEKEY")

(Doc here : Link)

  • If you need to get Unique Numbers/Strings, you might have to use UniqueKeyGenerators.

Upvotes: 1

Related Questions