cancel
Showing results for 
Search instead for 
Did you mean: 

How to get Vendor External ID from from Master aggrement page

Former Member
0 Kudos

I am now struggling to get the value of a referenced object from master aggrement Page.

I want to get the Vendor External_ID from vendor name which is getting displayed in Supplier tab of Master aggrement page.

doc.getVendorRef()

doc.createApplicationException(null,""+doc.getVendorRef());

with the above code I am getting the vendor name but we want to get the Vendor External Id. Any suggestions on how to retrieve this value?

Thanks in Advance.

Regards

Su

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

import com.frictionless.api.doccommon.masterdata.VendorIBeanHomeIfc;

vendorObj=doc.getVendorRef();

VendorHome=IBeanHomeLocator.lookup(session,VendorIBeanHomeIfc.sHOME_NAME);

vendorBean=VendorHome.find(vendorObj);

throw doc.createApplicationException(null,vendorBean.getExternalId());

Regards,

Immanuel

Answers (2)

Answers (2)

Former Member
0 Kudos

Thanks by Answers, but appears nex error:

Sourced file: inline evaluation of: ``import com.frictionless.api.contracts.; import com.frictionless.api.contracts. . . . '' : Error in method invocation: No args method getVendorRef() not found in class'com.frictionless.api.doccommon.doc.contract.ContractDocumentIBeanImpl' : at Line: 40 : in file: inline evaluation of: ``import com.frictionless.api.contracts.; import com.frictionless.api.contracts. . . . '' : doc .getVendorRef ( )

Are you famaliar with this error?

Thanks in advanced.

Former Member
0 Kudos

Hi Carlos,

The above solution has been written for a script that executes on Master Agreement/Sub Agreement. You seem to be trying to run the same code on a Contract Document's script, hence the error.

Get the parent of the Contract Document and then run the code.

parentBean = doc.getParentIBean();

vendorObjRef = parentBean.getVendorRef();

The rest of the script should remain same as the one given by Immanuel above.

Thanks

Devesh

Former Member
0 Kudos

The following code will populates Vendor External Id field on the Vendor Info tab of the Master Agreement document.

Please make sure to create an extension (referred in below code: "VEND_EXT_ID") on the Master Agreement Extensions, and display it below the Vendor Details. Also make sure you make the extension field as READ ONLY.

//create Vendor home

VendorIBeanHomeIfc vendorHome = (VendorIBeanHomeIfc) IBeanHomeLocator

.lookup(session, VendorIBeanHomeIfc.sHOME_NAME);

// get Vendor External Id

vendorExternalId = vendorHome.find(doc.getVendorRef()).getExternalId();

//populate in vendor external id field on vinfo tab

if(hasValue(vendorExternalId)) { doc.getExtensionField("VEND_EXT_ID").set(vendorExternalId);}

I hope this helps. Let me know, if you need additional details.

Regards,

Parankush