Hi Guys, please I need your help on creating a validation rule on the object Journal Line Items
Basically I want to create a validation rule to make the product field (a lookup field) a mandatory field for a set of GL accounts (the general ledger field is a look up field) so that the journal line item record cannot be saved without a product when these specified GL accounts are used
Examples of the GL accounts include:
10020 - Accrued Income - Initial Fee - New Clients
20000 - Deferred Income - Initial Fee - New Clients
Can someone please help on how to write this rule?
Thanks
You could create a checkbox in your GL Account record that captures if a product is required for that GL and then reference that checkbox in your validation.
Something like this:
You can make that checkbox only available to certain profiles (for example the Sys Admin or a Finance profile).
I'd recommend the checkbox approach because it's scalable rather than using the GL account name directly in the validation.
Validation:
AND( GL_Account__r.Product_Required__c = TRUE, ISBLANK(Product_2__c))
Product_2__c is the API name of the product in your Journal Line Items.
Make sure to use the "Insert Field" button when creating the formula to get the correct API name