cancel
Showing results for 
Search instead for 
Did you mean: 

Change the Status of Master Agreement via Script.

Former Member
0 Kudos

Hi Experts!

I'm trying to change the Status of a Master Agreement When the agreement is saved.

For that I created a script that runs after the Agreement saves.

The script is the following:

statusObjRef = doc.getStatusRef();

statusHome = IBeanHomeLocator.lookup(session,statusObjRef);

status = statusHome.findUniqueByNameType("Borrador", 10);

doc.setStatusRef(status.getObjectReference());

The problem I'm encountering is that, even after the status text actually changes to the status i'm changing it by code, after I save again (to be sure that the new status will be saved) and exit, the status doesn't change. It remains as the original. It seems to me that the code is only changing the text, but not actually changing the status.

Is there any way I could achieve what i'm looking for?

Also, any other tips on how to get information of the Master Agreement, or how to edit it by script would be very helpful

Thanks in advance!

Oscar Obeso.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Well, I could find a fix for that.

My mistake was that 1: I wasn't getting the correct ntype code for my value list type. And 2: I wasn't giving the Id name.

The new result came as this:

statusObjRef = doc.getStatusRef();

statusHome = IBeanHomeLocator.lookup(session,statusObjRef);

status = statusHome.findUniqueByNameType("Drafting Agreement", 1);

doc.setStatusRef(status.getObjectReference());

In case anyone has this problem, you should check the collection of values internal id, that's the actual ntype code (the number you send on the second parameter).

But I could still use help having some advice on the Master Agreement elements handling (getting data from the master agreement or the data thas is being edited at the moment before saving).

If anyone could give some advice, they would be very welcome

Answers (0)