Josh Kenzer Posted June 20 Share Posted June 20 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 More sharing options...
Preston, Charlie Posted June 20 Share Posted June 20 Have a look at loops : https://www.intacct.com/ia/docs/en_GB/help_action/Default.htm#cshid=Formula_expressions You can use a trigger of type validation and use the loop in the formula box at the bottom. If the value is found, then return the error message...otherwise return null to allow the transaction to post. Link to comment Share on other sites More sharing options...
Preston, Charlie Posted June 20 Share Posted June 20 Regarding the search - there is a magnifying glass at the top of the page. It searches the clubs you are a member of, and does seem to work. Link to comment Share on other sites More sharing options...
Preston, Charlie Posted June 20 Share Posted June 20 (edited) 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 June 20 by Preston, Charlie 1 1 Link to comment Share on other sites More sharing options...
Josh Kenzer Posted June 20 Author Share Posted June 20 Amazing! Charlie thanks so much! Link to comment Share on other sites More sharing options...
Josh Kenzer Posted June 20 Author Share Posted June 20 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) Link to comment Share on other sites More sharing options...
Josh Kenzer Posted June 20 Author Share Posted June 20 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. " 1 Link to comment Share on other sites More sharing options...
Recommended Posts