Lee Savidge Posted June 27 Share Posted June 27 I have a system that has around 300 GL accounts. I want to create a smart rule that prevents users from creating AR/AP invoices, AR/AP adjustments, AR /AP advances, AR/AP payments, GL Journals, basically any record where a subset of 32 of these GL accounts is used on a line item is restricted for use in only 1 entity. Anything else is allowed. To clarify, I would ideally like to put a restriction on a GL acocunt to say that it cannot be chosen outside of a specific entity, but I don't think I can put a restriction on like I can with customers and vendors. Example: E100 and E200 are entities and GL Accounts 1000 can be used in any entity and 2000 and 3000 can only be used in E200 If I created an AR invoice with the following: E100 1000 Allow I don't care about GL account 1000 E100 2000 Fail 2000 is restricted to E200 only E200 1000 Allow I don't care about GL account 1000 E200 2000 Allow GL Account 2000 is restricted for use only within E200 I don't think I can put a smart rule on the GL account, so I would have to put this on the AR sales invoice detail. The rule would be an error on create and set and the condition I have so far is (wrong): {!ARINVOICEITEM.ARINVOICE.MEGAENTITYID!} == 'E200' && IN({!ARINVOICEITEM.ACCOUNTNO!},['2000,'3000']) I tried != 'E200' but that didn't work either. The condition logic I always have issues with because it just seems to be backward. If the condition is true, the smart rule doesn't fire. If the condition doesn't return true, the smart rule fires. When I mentally think this through I want to say in my mind "if this happens that fire the rule" not "if this doesn't happen, fire the rule" The problem that I'm having is that if I choose any account that has no restrictions on it, the rule breaks and blocks the save. I don't want it to care about anything else other than the list defined in the IN block Link to comment Share on other sites More sharing options...
Members Sterio, Louis Posted June 27 Members Share Posted June 27 To make this easier I would create a custom field checkbox on the GL Account called "Restricted" or whatever you want. I will use "Restricted" in my example. Then "tick" that checkbox on all the accounts you want associated with this rule. This becomes easier to manage as well as easier to write the rule. I have not tested this myself yet but the logic should look like this on the Invoice > detail object: ({!ARINVOICEITEM.ARINVOICE.MEGAENTITYID!} != 'E200' || {!ARINVOICEITEM.GLACCOUNT.RESTRICTED!} != true) The above logic says "If ARINVOICEITEM -> ARINVOICE header MEGAENTITY ID field is equal to "E200" AND ARINVOICEITEM > GLACCOUNT > RESTRICTED is equal to "true") then execute the rule. 1 Link to comment Share on other sites More sharing options...
Lee Savidge Posted June 27 Author Share Posted June 27 Nice. I will have a look at that idea. Hadn't thought of adding a custom field on the GL account. Cheers @Sterio, Louis Link to comment Share on other sites More sharing options...
Recommended Posts