It's the only possible way. Because the dataset is filtered you know the value of the department. So filling the field before the record is saved is normal.