on 01-22-2013 11:23 PM
Hello
I have an extended field "ZEND_DATE" of date type in project page . Value for this field is carried over from some other page (UDO) while creating project from that UDO ( project creation has been enabled for that UDO ) .
My requirement is - this value should be clear while creating project .So I have tried creating a script for project in 'document life cycle' with 'created' phase.This script should run while creating the project and clear the predefined carried over value . But somehow the value is not clearing while I am creating project
However , when I am creating project solely ( manually ) this script is working good and clearing value but not working if I create project from UDO
My code is -
if (hasValue(doc.getExtensionField("ZEND_DATE").get(doc,null))){
doc.getExtensionField("ZEND_DATE").set(null);
}
also tried with -
doc.getFieldMetadata("ZEND_DATE").set(null);
Can anyone help please ?
Thanks in advance
Sudipta
Sudipta,
What's happening is that the script is triggering before the data can be populated from the related document.
So essentially you are setting a field that is already null at that point in time.
The way to handle this is to trigger the script to run on the create lifecycle of a document link. if the parent of the link is of class project then you know you have the right document. Then load that project and set the field to null.
Regards,
Alan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.