Jump to content

Parent object references in Smart Rule/Event Conditions and Triggers


 Share

Go to solution Solved by Chris Prime,

Recommended Posts

Is there any way to reference a parent object in any of these scenarios?

 

I'm trying to limit the GL accounts allowed on a GL entry based on the journal of the header batch. We have a custom journal that should only allow 9xxx accounts and all other journals should allow all accounts EXCEPT 9xxx.

 

I need a rule or trigger that can validate both the account on the entry line object as well as the journal on the parent batch object. In the trigger you have access to special objects like CURRENTUSER. If you can't reference the parent from the child, is there a special object like CURRENTTRANSACTION that is available instead?

Link to comment
Share on other sites

  • Members

To make things easier I would create a custom field checkbox on the GL account object called "allow" or whatever you want, in my example I will use "allow".

Tick that custom field on all the account you would like to allow (all of the 9xxx accounts).

Now your smart rule would be on the Gl Transaction Line level and would look something like this:

({!GLENTRY.GLBATCH.JOURNAL!} != "GJ" || {!GLENTRY.ACCOUNT.ALLOW!} == true)

The above condition says If the Header of GLENTRY is related to the GJ Journal AND The custom field on the related GLENTRY >  Account object is NOT set to "true" then trigger the error.

 

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...

Louis, I appreciate the idea, but this isn't a good solution for us. It would probably work in this specific scenario, but being able to look at data on a header and line at the same time is the reason behind using a relational database and we'll want to do this often. Extending objects and managing new fields for every new requirement or new record that could otherwise be fulfilled with a join and logic comparison isn't a tenable solution. It's much more likely for us to run into errors if we have to also build a trigger to set a default on new accounts, set all of the existing ones once, and prevent users from changing the check mark when really we should just be able to join the line back to the header and compare 2 values. Not to mention it makes the product look really inflexible when we have to tell the customer we built this semi-complex solution that they have to maintain to get around the fact that we can't program  something like "record.header.value like '9%'".

I've run into a similar issue with reporting where we need to be able to report GL data alongside AR/AP data and Intacct just doesn't give us the ability to "join" across objects/modules. Granted, when building reports you actually can join the header/line data, so I wish the triggers and smart rules at least had that capability, but it would be best if all system features allowed you join across all objects as long as you have access to the keys to make the joins. 

Thanks again for taking the time to respond.

Link to comment
Share on other sites

  • Solution

I was able to make it work in a Smart Rule, but not a Trigger. Here's my condition:

(({!GLENTRY.ACCOUNTNO!} >= "9000") && ({!GLENTRY.GLBATCH.JOURNAL!} == "EBITDA")) || (({!GLENTRY.ACCOUNTNO!} < "9000") && ({!GLENTRY.GLBATCH.JOURNAL!} != "EBITDA"))

 

 

 

So, if the user is in the EBITDA journal they can use any 9000+ account without error or they can use any account <9000 in any other journal without error. No custom field required. It would be nice if the same references could be used on a Trigger for consistency, but at least it works in the Smart Rule.

Link to comment
Share on other sites

 Share

×
×
  • Create New...