Skip to Content
avatar image
Former Member

Problem accessing standard collection in contract template document

Hello All,

We have requirement to read the sections and its clauses from the contract document template to validate the upload date via VALIDATE script event. I have written attached code. It returns correct collection size but when I access the records via index it returns null. Please let me know how to retrieve the details correctly to read the sections and its clause from contract document template


collSec = doc.getCollectionMetadata("SECTIONS").get(doc);
if (collSec.size() > 0 ) {
// returns correct number records in the standard collection
for (int i = collSec.size() - 1; i >= 0; --i){
section = collSec.get(i); // it fails. return null value if I refer the collection object with index
throw doc.createApplicationException("SECTIONS",collSec.get(i).toString());
if (hasValue(section)) {
//SECTION = IBeanHomeLocator.lookup(session,com.sap.eso.api.contractgen.SectionIBeanHomeImpl.sHOME_NAME).find(valueSection);
throw doc.createApplicationException("SECTIONS",section.toString()); } } }

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • avatar image
    Former Member
    Mar 29, 2016 at 01:31 PM

    Hi,

    The code returns null because collSec.get(i) is not an actual Section(1803), it is a SectionSub(1804).

    In RefGuide you can see that the SECTIONS collection in the template actually contains references to contractgen.SectionSub

    Try this code:

    section = collSec.get(i).getSectionObjRef();

    *it should return an objRef you can pass on to the home class.

    Regards,

    Bogdan

    Add comment
    10|10000 characters needed characters exceeded