cancel
Showing results for 
Search instead for 
Did you mean: 

doc.getCurrentPhase doesnt return Executed phase

Former Member
0 Kudos

Hi All,

I have written a script on onLoad for a contract(2002 class). I have to enable/disable an extension collection based on the phase in which the contract is there. So i have written the following code.

phase=doc.getCurrentPhase().getDisplayName();

if(("Executed").equalsIgnoreCase(phase))

IapiDocumentLockManager.unlockField(session,doc,"Coll_attachment");

else

IapiDocumentLockManager.lockField(session,doc,"Coll_attachment");

But the problem is doc.getCurrentPhase().getDisplayName() is returning a value only when the contract is in draft stage. If the contract is moved to any other phase like supplier draft, waiting for approval or executed doc.getCurrentPhase().getDisplayName() is not returning anything.

Thanks in advance.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi

Try doc.getCurrentPhase().getDisplayName(session) instead of doc.getCurrentPhase().getDisplayName() and see if it makes a difference.

Rest looks fine.

Regards

Mudit Saini

Former Member
0 Kudos

Hi Mudit,

Thanks for the reply....

I have tried with getCurrentPhase().getDisplayName(session) but it is throwing some exception. Instead tried getCurrentPhase().getDisplayName() then it atleast displayed Draft phase.

Is there anything we are missing like do we need to do anything from configuration?

Thanks,

Srikanth Emani

Former Member
0 Kudos

Hi

getCurrentPhase().getDisplayName() is not going to give the desired results. What exception are you getting with getCurrentPhase().getDisplayName(session)?

Regards

Mudit Saini

Edited by: Mudit_UCB on Nov 4, 2011 8:41 AM

Former Member
0 Kudos

Hi ,

Wenever i use displayname(session). The master agreement doesnt open at all. List of master agreements gets displayed and wen we click on any MA the circle turns round and round and round but it doesnt open any MA.

Thanks,

Srikanth Emani

Former Member
0 Kudos

Hi

I think you are using scripting context: Document Lifecycle Event with Target: Loaded. Kindly correct me if I am wrong.

Try Target: Validated or Saved and see the behaviour.

Regards

Mudit Saini

Former Member
0 Kudos

Hi Mudit,

Tried the same code in Validated but the result is same. It is not returning the phase.

Thanks,

Srikanth Emani