on 10-11-2011 4:15 PM
Hello,
I am trying to write a script to create a new UDO of type "SRF Form" (name of the document type) from within an RFX. I get an error stating "ID: This field is required and must have a valid value." I assumed that the create method would automatically assign the id of the UDO based on the numbering table assigned in the document setup. I tried to print the ID by getDocumentId() and got a null in the log. I cannot find any setter for the id. The weird thing is, after running the script, if I try to manually create the UDO, the numbers are skipped indicating that the numbering table has incremented. Can anyone please help me figure out what I am doing wrong?
Thanks,
MP
This is my code:
logMsg = Logger.createLogMessage(session);
try{
udoHome =IBeanHomeLocator.lookup(session, UserDefinedBizDoc1IBeanHomeIfc.sHOME_NAME);
udoBean = udoHome.create("SRF Form");
udoBean.setDisplayName("Test Auto"+doc.getDisplayName());
udoBean.setInternalCatObjRef(doc.getIntCategory());
udoBean.setCurrency(doc.getCurrency());
logMsg.setLogMessage("*****MP get the id **"+udoBean.getDocumentId());
Logger.info(logMsg);
udoHome.save(udoBean);
}
catch (Exception e){
throw doc.createApplicationException(null,e.getMessage());
}
Hi,
The ID (UNIQUE_DOC_NAME) is assigned to document during Save (Validation /pre Save time). getDocumentID() method returns the UNIQUE_DOC_NAME value. From the exception it seems to could be due to a different ID field. Please check.
thanks,Baski
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you for responding Baski,
I manually created a new UDO of type "SRF Form"(my custom UDO document type). I hit save without entering any value, the only 2 fields where this error was thrown was Display Name and the Internal Category, I have assigned both of these through the script. The currency is defaulted, I am anyway assigning it in the script. The Document Type and Company are defaulted and displayed as labels and not editable fields, so I do not think I need to take care of these.
Do you have any suggestions on how I can debug this?
Thanks,
MP
User | Count |
---|---|
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.