on 08-10-2010 7:01 AM
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.