on 2016 Jan 19 6:43 AM
Hi Experts,
We have the following requirement - when a new Supplier is created using the Supplier Management -> Suppliers -> Create Supplier screen, there is a mandatory field External ID. This field should be pre-populated with a meaningful unique value, like say VEN-001. I tried creating a new numbering table (please see the attached screenshot) but not sure how to make the External ID field refer to this value. Please help. If this is not the way to achieve this requirement, please let me know the correct way. I first thought of writing a Script Definition but found that numbering table has no iAPI defined.. so cannot access it from script.
Thanks in advance!
- Gayathri
Request clarification before answering.
HI Gayathri,
Numbering Table generates the UNIQUE_DOC_NAME of the Supplier. If you want to copy the UNIQUE_DOC_NAME to the External ID then you need to write 2 scripts on the class Supplier(607):
Hope it helps!
Best,
Kushagra A
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for the quick reply Kushagra. External Id is a key field in masterdata.Vendor and I am not able to update it after it is saved in db. For now I have written a script on Create event of Supplier(607). This script creates a string like "VEN-xxxx" where xxxx is a four-digit random number generated using java.util.Random. I am not able to maintain a running sequence number for this "xxxx" value (that is what the customer really wants).. is there some sequence table other than Numbering table that i can access using iAPIs?
Thanks,
Gayathri
HI Gayathri,
As mentioned earlier, you can use Supplier Numbering Table for setting the External ID in the sequential manner generated from the Supplier Numbering Table. For this you need to write the logic of setting the DocumentID of the Supplier to the EXTERNAL_ID on SAVE Event.
Let me know if it works for you.
Best,
Kushagra A
I had missed calling the supplier home save in my earlier code. Thanks Kushagra, this is the correct Save event script that updates external id with same value as doc id:
//Supplier Post Save Script
//Check if Ext id is already updated to Unique Doc ID
if (doc.getDocumentId().equals(doc.getExternalId()))
return;
// Update the External Id with the Document Id...
try {
supHome = doc.getIBeanHomeIfc();
doc.setExternalId(doc.getDocumentId());
supHome.save(doc);
} catch(e) {
supHome.save(doc);
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.