In a previous post on adding a laborcode field to the workorder we used a custom java class to get it to work. Our friend, PRiMoZ mentioned that we could also do the same thing with table domains, so this tutorial will walk you through setting that up and it’s pretty easy to get working. Read the previous post to get a basic understanding of what we are trying to accomplish.
First thing we need to do is setup a table domain. So go to System Configuration -> Platform Configuration -> Domains. Click on “Add New Domain”. Let’s give it an ID of “ACTIVELABOR”. Click on “New Row” and enter the following values:
- Object: LABOR
- Validation Where Clause: laborcode = :assignedlabor and status = ‘ACTIVE’
- List Where Clause: status = ‘ACTIVE’
- Error Message Group: signature
- Error Message Key: NotActiveUser
If you read the previous post, you will know that the :assignedlabor is a new field that we added within Database Configurations to the WORKORDER object. If you have not yet created it, go ahead and create it. You can find info on how to do that in the previous post. So now that you have created a table domain, it is time to go into the Database Configurations and go to the WORKORDER object and bring up the ASSIGNEDLABOR attribute or field property. Here, if you have the “class” field populated from the previous post, you need to remove it and leave it blank. Next, in the “Domain” field, enter the ID of the table domain we just created, which would be ACTIVELABOR.
Save your changes and apply the configuration changes to the database. If you already added the field on the workorder, then everything should work as planned.