Jump to content

Smart Rule to make sure field is unique


 Share

Recommended Posts

I have a requirement from a client to ensure the Reference Number on a GL Batch is unique. In order to check if the reference number is unique, I figured I could use the Intacct API to query on that field and if any results were returned, I know it's been used. Therefore, I would need to use a Trigger rather than a Smart Rule. However, is there a way to manually throw a validation error from the Intacct API trigger type? Any other ideas on how to achieve this if not?

Also, is there a search engine for this forum?

Link to comment
Share on other sites

Josh, I just had a look back through my notes as I was certain I had done this before.  I did have an issue using the loop and the only way I could get it to work on the GL Batch object was to use the Original ID of the view, rather than the object ID.

I've attached a Word document with screens shots, code and explanation - hopefully this will work for you if you update the original id based on your instance.  Although, could be worth trying the object id first to see if it works.

Error on journal reference number.docx

Edited by Preston, Charlie
  • Like 1
  • Thanks 1
Link to comment
Share on other sites

20 minutes ago, Josh Kenzer said:

Hey Charlie, what does the (1) after GLBATCH.REFERENCENO in the loop declaration? I have the code running and it works perfectly, I'm just curious about this syntax:

GLBATCH.REFERENCENO(1)

Never mind, found it:
"When the system parses this formula, it creates JavaScript code for each loop or record that the view shows. Processing long lists of records can cause your JavaScript to time out. You can avoid this by tightly filtering the view to reduce the number of records or by setting a loop limit in your script. You set a loop limit in parentheses following the ID pointer. "

  • Like 1
Link to comment
Share on other sites

 Share

×
×
  • Create New...