cancel
Showing results for 
Search instead for 
Did you mean: 

Problems Getting External Id of LocalizedObjectReference.

Former Member
0 Kudos

Hi!

I'm trying to retrieve the external Id of the current phase of a contract document, in order to identify in which phase it actually is (or changed to).

The problem I'm encountering is that, the method of the LocalizedObjectReference object (the one that getCurrentPhase returns) that calls the externa ld (getExternalId(com.sap.odp.common.platform.SessionContextIfc session)) is asking for a parameter that is actually different from a IapiSessionContextIfc. I tried to find what kind of object is that of SessionContextIfc but I couldn't find it anywhere on the Iapi documentation.

Does anyone know what kind of object is that method expecting?

Thanks in advance!

Accepted Solutions (1)

Accepted Solutions (1)

former_member190023
Contributor
0 Kudos

Your script is ok, the problem is that 'smart' CLM did not update the LocObjRef with the external ID from the phase.

what you need to do to fetch that is use:

ContractDocPhaseSubIBeanHomeIfc home = IBeanHomeLocator.lookup(session, phase);

realPhase = home.find(phase);

extId = realPhase.getExternalId(session);

(ps: hope my code compiles)

Regards,

Bogdan

former_member190023
Contributor
0 Kudos

LE: the getExternalId method from the phase does not have parameters, so it should be:

extId = realPhase.getExternalId();

It will work like this.

Regards,

Bogdan

Former Member
0 Kudos

And it did the trick.

Thanks a lot for the explanation!

It did help a lot in understanding how CLM works with it's variables.

You deserve a medal sir.

Answers (1)

Answers (1)

former_member190023
Contributor
0 Kudos

public abstract interface SessionContextIfc extends UserSessionIfc, IapiSessionContextIfc, Cloneable, EventRouterIfc

{ ... }

It should work with the session variable provided (did not test myself).

Regards,

Bogdan

Former Member
0 Kudos

Hi!

Thanks for the answer!

I tried with that before, using the "session" variable, but it returns null.

I thought it was a class problem, but thanks for stating that they're interchangable.

Now, back to the problem: why would it return null? Do you have any idea of why is this happening? anything that could help me getting to the source of the problem.

Thanks in advance!

former_member190023
Contributor
0 Kudos

Hello Oscar,

Only thing that comes into mind is that the LocRes object is not fetched properly. I think you are trying to use:

doc.getCurrentPhase().getExternalId(session);

What script are you using for this?

Bogdan

Former Member
0 Kudos

the part of the script that is retrieving the phase is the following:

contracts = doc.getContractDocuments();

if(contracts.size() > 0){

  mainContract = contracts.get(0);

  phase = mainContract.getCurrentPhase();

  phaseName = phase.getDisplayName(session);

  phaseId = phase.getExternalId(session);

}

It enters the conditional branch, and then send me the values to my email (So i can know the values).

It sends me everything allright except for the external id.

Thanks in advance!