AE calling CI to hire a person and Assign Current Employee with New Job

I am using AE calling CI to hire a person and also assign current employee with new job. For completely new hire, the process works great. But for adding secondary job to the current employee, it does not work. unless I hardcode the values. In the state record, deptid, jobcode and other fields are blank except the PI field. But in the sql trace file, they are extracted into the buffer by %select. So am very confused. I think because the state record does not have those required values, that is y the process does not work.

Popular White Paper On This Topic

First question I would ask is the CI doing just an Item or is it also doing an InsertItem based on condition. Sounds like with new hires, it is just an item, which is fine. For additional records, you would want to use the insert item. Then of course, the question is, is this a new empl_rcd, or is it just a new effdt / effseq row with a new jobcode, deptid, etc.? A new empl_rcd would dictate that you would use the create method and not the find method. A new effdt / effseq row dictates a find method.

For the values in the state record, if they were populated by the %select and not later being re-populated (additional fields possibly) by %selectinit, then they still should still be there, available for use.

Yes, for new hire, it is item, for secondary job , it is insertitem and both are using create method. And the variables are not initialized by %selectinit.

I do not know if the error really means what is wrong here. It complains about a date field value in the %select for the secondary job. This %select is almost the same as the other %select for new employee, except that new empl %select returns the rows without national_id existing in the system. And the %select for secondary job returns the ones already existing in the system. The first one for new hire works perfectly, but when I tested it for the secondary job, it complained.

I could be wrong, but for the secondary job, if you are using the create method, I am assuming here it is a new empl_rcd. If that is the case, then for the secondary job, you would use item as well and not insertitem. Otherwise, you are going to have an empty row and will have errors.

If the secondary job is for an existing empl_rcd, then you need to use the find method in order to use the insert item.

On a side note, the SQL suggests you are processing employees within a DoSelect Step.
CI errors may then cause the AE to fail. It is better not to have any open sql cursor when executing a CI in an AE (sql objects, doselect, ...).