I recently ran into a scenario where a WORKORDER attribute has a table domain but the “validation where clause” of that domain should be different between the different applications. I needed two domains and assigned them dynamically based on the application name using a new feature in Automation Scripts which turned out to be super easy!
- Create an attribute automation script, set the “Events” to “Retrieve List”
- In the source code use the implicit attribute “domainid” to assign a domain to your attribute. My code looked like this:
if app == “APP1”:
domainid = “DOMAIN1”
domainid = “DOMAIN2”
Be careful when using the implicit “app” attribute. It only returns a value if your script runs against the same object as the main object of your application. So, if your script is against WORKORDER object and it is triggered because of an action in a work order based app (WOTRACK, PLUSDWOTRK etc.) then it will return the app name. But let’s say your script is based on LABTRANS object and it got triggered in WOTRACK. Because the script object is different from the main object of the app, the “app” will return null.