cancel
Showing results for 
Search instead for 
Did you mean: 

can not clear value for extended field in created phase

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

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

Former Member
0 Kudos

Thanks a lot Alan ..

Very helpful answer .

Regards

Sudipta

Answers (0)