简体   繁体   中英

PeopleSoft Component Interfaces: Create Method Doesn't Persist The New Object

I'm working with the PSJOA library. I have a Java app, and I'm testing each of the standard operations using the CI_PERSONAL_DATA. Everything works fine with the Get, Find and Save. But not with the Create, even though when I invoke the method, I get an OK response, with no apparent errors. The input parameter I'm sending (taken from the CreateKeys) is the KEYPROP_EMPLID.

The odd thing here is that, if instead I call the Create method using Web Services (through SoapUI), the new instances is correctly created. However, in this scenario, passing just the primary key KEYPROP_EMPLID is not enough and I have to fill more fields (as it I was performing an update).

Can someone point to me what might be happening? Is there some missing data? Maybe I misunderstood the creation behavior?

Thanks.

What exactly goes awry when you call create? That will create a new entry in the personal data component in PeopleSoft for the person with the supplied emplid. It will be editable, so you can fill in other information, but it will not persist until/unless you call save() afterwards.

Does the emplid already exist in the personal data component? If so, you should be calling get() instead.

Does the emplid already exist in the peoplesoft instance? If not, you should make sure it is in the system prior to using it.

Regarding the lack of error behavior, I have found the peoplesoft component interface APIs for java are notoriously unreliable. You can test them in real time through Application Designer (Via the "Test Component Interface" option in the drop-down menu), which I often find helpful.

Finally, calling session.checkMessages() on your session after performing a method on a CI can often generate error messages that otherwise will not be displayed.

EDIT: Here is a snippet of how we typically call/use it in our PeopleSoft HR instance:

ICiPersonalData wh = (ICiPersonalData)ses.getComponent("CI_PERSONAL_DATA");
if (wh == null) throw new UpdateException("Failed to get component");
wh.setInteractiveMode(true);
wh.setGetHistoryItems(true);
wh.setEditHistoryItems(true);
wh.setKeypropEmplid(emplid);
if (!existsInHR(emplid)) { // Direct database check
        LOG.debug("Creating a new HR person.");
    if ( ! wh.create() )
        LOG.warn("wh.create returned false for emplid ="+emplid);
    ses.checkMessages(); // will throw exception if errors exist

    wh.setPropDerivedEmp("Y");
    rs.put("NEW","Y");
    setKeyPersonalData(wh, emplid, rs); // Sets name, etc.

} else {
    if (!wh.get())
        LOG.warn("wh.get returned false for emplid ="+emplid);
    ses.checkMessages();
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM