cancel
Showing results for 
Search instead for 
Did you mean: 

Issue while creating contract document through Import Lifecycle Script

Former Member
0 Kudos

Hi Experts,


I am trying to create contract document through a script i.e reading attachment from shared location and creating new Contract Document object but the object created through script doesn't appear in Master agreement Contract Document tab. ( We don't want to use Contract Document importer option as there is no way to schedule that )


On comparing the contract document which is created via script and the one uploaded directly on system. We found out that CURR_CONFIG_PHASE_OBJECT_ID is not present in the one created through script.


Now I am trying to create an instance for Ibean ContractDocPhaseSubIBeanIfc and assign it to my contract document. But I am not able to find any methods in the interface for that.


Can you please help with the code which I can use to create instance of ContractDocPhaseSubIBeanIfc and assign it to Contract Document field CURR_CONFIG_PHASE_OBJECT_ID?


I have tried following to create instance but it throws out error. Also a point to be noted is for each Contract Document, there are four entries for each contract Document in table FCI_DOC_CONTRACT_PHASE one each for phase Draft, Supplier Draft, Waiting For Executed Approval and Executed. So will we need four instance of ContractDocPhaseSubIBeanIfc ?



ContractDocPhaseSubIBeanHomeIfc docPhaseHome = (ContractDocPhaseSubIBeanHomeIfc)IBeanHomeLocator.lookup(session, ContractDocPhaseSubIBeanHomeIfc.sHOME_NAME);

  ContractDocPhaseSubIBeanIfc docPhase = docPhaseHome.create();

Below is my method which creates contract Document.


void addContractAttachment(ContractIBeanIfc contract, AttachmentIfc attach) throws Exception

{

  ContractDocumentIBeanIfc c1 = (ContractDocumentIBeanIfc)contract.getContractDocuments().create();

  c1.setDisplayName(import_record.getField("DOC_DISPLAY_NAME"));

  queryExe = IapiQueryExecFactory.createQueryExec(session,QRY_GET_CONTRACT_DOC_TYPE_REFERENCE);

  params = queryExe.getParameterSet(session,QRY_GET_CONTRACT_DOC_TYPE_REFERENCE);

  Map filters = new HashMap();

  filters.put("DocId", "Contract");

  IapiQueryResultSetIfc docRecords = queryExe.execute(filters);

  IapiQueryResultSetMetaDataIfc docMetadata = docRecords.getMetaData();

  docRecords.next();

  ContractDocumentTypeIBeanHomeIfc cdHome = (ContractDocumentTypeIBeanHomeIfc)IBeanHomeLocator.lookup(session, ContractDocumentTypeIBeanHomeIfc.sHOME_NAME);

  ContractDocumentTypeIBeanIfc cdoc = cdHome.findByUniqueDocName(docRecords.getString(docMetadata.getFieldIndex("maDocName")));

  c1.setTypeObjRef(cdoc.getObjectReference());

  DocumentVersionIBeanIfc docVer = c1.getDocVersions().create();

  docVer.setDoc(attach);

  docVer.getFieldMetadata("VERSION").set(docVer, 1);

  docVer.getFieldMetadata("ADDED_BY_USER").set(docVer,(session.getUserAccount().getObjRef()));

  docVer.setDisplayName("CLM Import Test");

  c1.getDocVersions().add(docVer);

  c1.getFieldMetadata("SIGNED_DOC").set(c1, attach);

  contract.getContractDocuments().add(c1);

}

Let me know if you need any more information.

Thanks

Ankit

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi &

Request your help on above query.

Thanks.

Ankit

Former Member
0 Kudos

Hi Ankit,

I had same requirement. I did it in two steps.

1) Added contract document as attachment to Master/Sub Agreement using Script .

2) Used Data Import Monitor to load Contract Document CSV.

  > Data Import Monitor for Contract Document will create a contract document from the attachment loaded in step 1).

Hope this helps you.

Thanks

Sai

Former Member
0 Kudos

Hi

Thanks for replying. I have few questions on approach suggested by you.

For the step 2, its not manual step right ? You are scheduling Data Import Monitor task for that right?

Do we need to write anything in the import lifecycle script for ContractDocument class or its out of box functionality ?

What do we provide in FILE_NAME, by giving just the file name without any location path will it pick it from Attachments present in Master agreement ?

Are you using attached contractdocument template in following link to import contract document?

https://www.dropbox.com/s/ijacbn0s4rcjn1w/ContractDocuments_template.xls?dl=0

If no, Can you please share the ContractDocument template you had used on my email Id ( please visit my profile for emailID as its not allowed to paste email addresses) ?

Thanks

Ankit

Former Member
0 Kudos

Hi Sai,

I tested your suggestion, it works but Attachment Order Code is mandatory field in CSV.

From the table data, I got to know that is multiple of 1000 ( 1000, 2000, 3000, etc) but How to get that value for our attachment while we create a import file?

Thanks,

Ankit

Former Member
0 Kudos

Hi Sai,

We are also trying to create Contract document via explicit callable script. Can you please share the ContractDocument template you have used so that i can give a try using your logic. My email id is komaltaneja.08@gmail.com

Thanks in advance.

Former Member
0 Kudos

Hi Komal,

The CD template which I had used in my script to load contract document from Master Agreement attachment is available on below link. You can also create template from the CSV fields of the contract document class in IAPI docs.

Dropbox - ContractDocument_sample.xls

Regards,

Ankit