cancel
Showing results for 
Search instead for 
Did you mean: 

How to update value of LAST_AUDIT_DATE

Former Member
0 Kudos

Hi,

Due to some business requirements, we created a custom collection for audit.

Now I want to update the OOB field LAST_AUDIT_DATE with a value from the custom collection as this is used in an existing report. I am trying to set the value in my script using the syntax below:

doc.getFieldMetadata("LAST_AUDIT_DATE").set(doc, <someauditDate>);

But my script throws an Nullpointer exception stating  Attempt to invoke method set on null value.

What am I missing? Do I need to access this field by some other way?

Thanks,

Priyanka

Accepted Solutions (0)

Answers (2)

Answers (2)

kushagra_agrawal
Active Participant
0 Kudos

Hi Priyanka,

I got your question in a wrong way.

Try the below piece of code:

import com.sap.odp.api.common.types.TypeFactory;

newdate=doc.getExpirationDate().getDate(); // I have taken as example, you can take value from your extension collection and set.

date= TypeFactory.createSysDate(newdate);

doc.getFieldMetadata("LAST_AUDIT").set(doc,date);

Let me know if it helps.

Regards,

Kushagra

kushagra_agrawal
Active Participant
0 Kudos

Hi Priyanka,

As per my understanding LAST_AUDIT_DATE is extension field you have created and you have to set this extension field value with some other Extension Collection value?

Correct me if I am wrong. If this is the case then try below code and you have to make use of loop and get which value you want to assign from the colection.

value=doc.getExtensionCollection("collectionId").get(i).getDisplayName();

doc.getExtensionField("LAST_AUDIT_DATE").set(value);

Also you have to make sure that Value is which you are setting and the data type of the Extension definition in which you are setting the value should be same.

I am presuming the data type is String.

Let me know if it helps.

Thanks

Kushagra A

Former Member
0 Kudos

Hi Kushagra,

Thanks for responding.

As I mentioned, this is not a custom field. You can see it in FCI_Contract table. But like other fields like renewal_reminder date, effective date etc., I am unable to update it.

Hope it helps in understanding my issue.

Priyanka