Showing results for 
Search instead for 
Did you mean: 

Null pointer error in Pre Phase change script

Former Member
0 Kudos

Hi Expert,

We have build a 1- step workflow and Approver are selected based on Commodity and Country of Master Agreement from a Custom Master Data Table.

We are having a requirement to call the workflow xpdl if there is a valid approver in Custom Master Data Table. If there is no match then prompt an error message to user that there is no matching Approver in Table.

We have assigned the workflow xpdl in "Route for Approval" phase.

So we have created a script in Pre Phase change scripting context to validate the table entry. We extracted the next phase in the script and if the next phase is "Route for Approval" then trigger this script and validate the custom table and the Script is working properly as expected.

But now when we are creating a new Contract Document it is throwing an error as "Null Pointer in Method Invocation" in findValidNextPhasesExternalIds().

home = doc.getIBeanHomeIfc();

nextPhase = home.findValidNextPhasesExternalIds(doc).get(0);

Can you please suggest how to get rid of this error message.

Appreciate your help.



Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Ravi,

When you are creating a new contract document, the initial phase would be "created". And then, when it is saved, it moves to "Draft" phase. Since there is not any phase definition with valid next phases for "created", i think it is throwing you a null pointer exception.

Instead, can you try using the variable "other_phase" in your pre-phase change script to identify the next phase that you are transitioning to instead of using findValidNextPhasesExternalIds() method? 

other_phase represents internal ID of target phase of document in Pre-Phase change script or previous phase in Post-Phase change script. Refer the scripting and workflow guide for more details if required.

Let me know if this helps.



Answers (0)