cancel
Showing results for 
Search instead for 
Did you mean: 

On create- Accessing Extension field

Former Member
0 Kudos

I have a situation here..When an agreement is being created out of Project document toolbar(action-create agreement) I would like to write some logic on new Agreement being created is loaded. I observe that certain fields which were copied over from Project document into Agreement were still null during create script trigger.

They are still null while accessing on create for this event..

       That means there is no way to access any copied over extension field value during on create script?

If you have come across situation..I just wanted to know if its possible?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Victor,

What I have understood is- you are creating an Agreement by the project toolbar . True, it will trigger Agreement create event. you can populate the value in Agreement Extension fields which are custom created at created event, it is possible.

If you are setting values of project fields to Agreement fields then you can do it.

I think doc.getExtensionField("XXX").set(object) and it should work.

2 things you need to take care of....the object data type and Extension field data type should be same else you will have to change data type of object by using TypeFactory  and 2nd you are saving the agreement by calling doc.IBeanHomeIfc().save(doc) via script.

I have seen this situation and we were able to make it work. Hope the same happens for you

Regards,

Kumud

Former Member
0 Kudos

Hi Kumud,

First of all, Thanks for the reply ..As always, you continue to rock in this forum.

Just to add here, I just want to get access to a field which is copied over from project to Agreement by default ( since its identical field). but on create of agreement script it is returning null....but when loaded new agreement to create in UI I see them copied from Project document.

Is it because, during on create script  trigger, the copying over of field value from project to agreement is not accomplished...may be after the create script trigger event only it copied that field value.

Former Member
0 Kudos

Hi Victor,

You are welcome.

What I got is something like this-

Two conditions arise-

1. You create an Agreement from a Project and the field xyz in Agreement is copied across from Project to Agreement as it is common in both documents and Attribute ID is same for both Extension Field.

2. You created an Agreement from Master Agreement(Not from Project this time) and this field xyz is left empty...If this is the case then set method could not find the object of project field to set in Agreement. You can use some default in this case or flag which differentiates between Agreements created from Project and others.

Another case could be that the moment Agreement is created the field xyz is not having any value but null. The moment save event is triggered the value of the field is copied across from Project to Agreement. If this is the case then the script which does this copying is written in save/validate event. You may want to write it in created event.

It is possible I did not get at all what you wanted to convey. Please let me know in that case.

Regards,

Kumud

Former Member
0 Kudos

Exactly Kumud..just add specifics,

I go to a project..it has field x with some value,

go to action-Agreement

takes me to few steps to specify type,vendor,coll,date etc till it

finally opens up in create mode..(which could be saved later, thats not the case...I am just interested till it opens up in create mode..) if you now x field of agreement is getting the value from Project..thats fine..expected..

...now, if you print the value of x from agreement doc..it prints null..

on create event of agreement, written like doc.getExtensionField("x").get()...

Former Member
0 Kudos

Hi Victor,

I think it is standard behaviour. Just to ensure whether the field has been copied  from project or not you can assign an object to the value of doc.getExtensionField("x").get() after setting the project field value in required field of Agreement and print in logs.

I am not sure whether it will work or not, but if you want it be copied at created event then you can call doc.getIBeanHomeIfc.save(doc) just after copying the value using doc.getExtensionField("X").set(projectfieldValue) in Agreement created event.

Please let me know if it solves your problem.

Kumud

Former Member
0 Kudos

Hi Kumud,

I have one requirement, while we duplicate (copy) any project document from existing one, all the fields should be cleared up in new document. can you help me on this.

Regards, KP

Answers (0)