Forum Stats

  • 3,872,820 Users
  • 2,266,482 Discussions
  • 7,911,332 Comments

Discussions

Validation Script: Move.Values post-move returns Unexpected Null Value

MNW
MNW Member Posts: 118

Hey all,

I'm creating a custom validation using JavaScript in DRM 11.1.2.4.302. The script needs to determine the value of a node's property before the move and compare it to its value after the move.

Name: MoveValidation

Class: Script

Level: Move

Activation: Run-Time

Code - This returns a JS error: "DRM 16009 - There was an unexpected null value":

if(move.IsPre) {

    return true

}

if(move.IsPost) {

    move.Values.myValue = true;

    return move.Values.myValue;

}

Code - This code runs without error:

if(move.IsPre) {

    move.Values.myValue = true;

    return move.Values.myValue;

}

if(move.IsPost) {

    return true;

}

Code - This is the code I want but it causes the same error as the first set of code:

if(move.IsPre) {

    move.Values.myValue = true;

    return move.Values.myValue;

}

if(move.IsPost) {

    return move.Values.myValue;

}

It seems there's an issue referencing move.Values during the post-move validation. But the Validations Using Scripts documentation states that move.Values persists across pre and post move calls.

Any help or guidance would be appreciated.

Best Answer

Answers

  • Denzz
    Denzz Member Posts: 813 Gold Badge
    edited Mar 1, 2016 5:59AM

    @MNW

    Hi,

    Could you please copy the entire code over here? The piece of code that you have given here already runs absolutely fine and does not give any error.

    Also, you get the error when you click on evaluate?

    Thanks

    Denzz

  • MNW
    MNW Member Posts: 118
    edited Mar 1, 2016 8:41AM

    Thanks Denzz. So far, that's the full code because we aren't able to successfully run even that piece. Can you tell me which version you're running this from? It may be an issue in our current DRM version that requires a patch. We are on version 11.1.2.4.302.

    Evaluate runs successfully, but what I noticed is that when you evaluate the script it only runs the IsPre part of a move. It does not simulate both pre-move and post-move validation runs. I validated this fact by using the following code which evaluated the value of true but when tested in the actual hierarchy returned false:

    if(move.IsPre) {

                return true;

    }

    if(move.IsPost) {

        return false;

    }

  • Denzz
    Denzz Member Posts: 813 Gold Badge
    edited Mar 1, 2016 8:51AM

    @MNW

    I am on 11.1.2.4.310

    Yes it does not evaluate the Post part, I am wondering if that's a miss on Oracle's part.

    So i checked with this- which also fails for you but runs fine for me.

    if(move.IsPre) {

        move.Values.myValue = true;

        return move.Values.myValue;

    }

    if(move.IsPost) {

        return move.Values.myValue;

    }

  • Denzz
    Denzz Member Posts: 813 Gold Badge
    edited Mar 1, 2016 8:52AM

    @MNW

    Could you tell me your exact requirement that you want implemented?

    Thanks

    Denzz

  • MNW
    MNW Member Posts: 118
    edited Mar 1, 2016 9:11AM

    We have a requirement that a specific member (Identified by the value of a specific property) in a hierarchy is the first member under its parent. The property logic sets the value to a string if the member is the first child under a parent. This validation runs to ensure that this member cannot be moved or re-ordered in a way that it is not the first member under that parent. All other members in the hierarchy can be moved at will.

    So we're storing the value of this member's parent in the move.Values object as well as the value of the property that defines which member we're concerned about and ensuring that:

    • Member with that property value maintains the property value and the same parent before and after move (Does not move, does not reorder)
    • Members without that property do not gain that property value (Members are not reordered and become the first member under a parent)
  • Denzz
    Denzz Member Posts: 813 Gold Badge
    edited Mar 1, 2016 9:23AM

    @MNW

    Like you already said- I am beginning to notice that the values from the Pre phase are not flowing over to that post Phase.

    Its in the Post phase where null reference error is coming.

  • MNW
    MNW Member Posts: 118
    edited Mar 1, 2016 9:24AM

    So you are seeing the same issue then?

  • Denzz
    Denzz Member Posts: 813 Gold Badge
    edited Mar 1, 2016 9:35AM

    Yes i am,

    It doesn't come when I evaluate it coz, the post phase doesn't get evaluated.

    But i am getting it when i play with the hierarchy.

    This is really ugly

  • MNW
    MNW Member Posts: 118
    edited Mar 1, 2016 10:08AM Answer ✓

    Just glad I'm not crazy. Spent a few hours trying to figure this one out. Guess I'll put in a support ticket.

  • Denzz
    Denzz Member Posts: 813 Gold Badge
    edited May 27, 2016 1:03AM

    @MNW

    Had you got any resolution to this from Oracle? The move.IsPost just won't work properly its giving me that null reference error.

    Thanks

    Denzz

This discussion has been closed.