on 01-08-2013 12:02 PM
Hi All,
I am trying to create a supplier reminder object (661) using an explicit script.
I am setting all the required values but I always get an error
"At least one of the items below is invalid. Mouse over the highlighted area for more details."
I tried catching the exception and used e.getAssociatedAttribute() to get the attribute resulting in the error - REMINDERS_T (this is nothing but the subordinate collection of the reminder in the supplier object, and not useful)
The code is as follows:
// Get the vendor/supplier object |
IBeanHomeIfc vendorHome = IBeanHomeLocator.lookup(session,VendorIBeanHomeIfc.sHOME_NAME);
VendorIBeanIfc vendor = ((VendorIBeanHomeIfc) vendorHome).findByExternalId(vendor_id);
VendorIBeanHomeIfc vendor_home = (VendorIBeanHomeIfc) vendor.getIBeanHomeIfc();
vendor_home.upgradeToEdit(vendor);
// Get the collection of reminders |
SubordinateCollectionIfc activities = vendor.getCollnReminder();
// Create a new reminder collection member |
VenReminderIBeanIfc newAct = (VenReminderIBeanIfc) activities.create();
// Set the relevant attributes |
newAct.setDisplayName(disp_name);
newAct.setEffectiveDate(TypeFactory.createSysDate(new Date()));
newAct.setExpirationDate(TypeFactory.createSysDate(new Date()));
newAct.setDueDate(TypeFactory.createSysDate(new Date()));
newAct.setTypeObjRef(act_type);
newAct.setReminderInstructions(rem_instr);
newAct.setReminderComment(rem_comm);
newAct.setOwnerObjRef(vendor.getBuyerContactObjRef());
SendReminderToEnumType owner = new SendReminderToEnumType(SendReminderToEnumType.OWNER);
newAct.setSendReminderTo(owner);
newAct.setPublishToCalendar(true);
// Add the created reminder to the collection and save the vendor |
activities.add(newAct);
vendor_home.save(vendor); // Exception occurs at this line
vendor_home.downgradeToView(vendor);
Without trying this specifically, My next step would be to check the status of each "Set".
Most likely one of set methods is failing. This would cause the activities.add() to add an incomplete collection member and the failure is caught on save.
put some conditional code on each set on newAct and let us know what you find.
Regards,
Gary
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Gary,
Thank you for your response.
I did as you advised.
After setting all the values, I used their respective getter methods to ensure that the correct values were being set.
And the values are being set fine.
I also plugged in the same logic in a field validation event's script to check if the values were somehow set incorrectly.
But, the reminder was created and saved without any problems through that script.
It did not generate an Application exception like in the case of the explicitly called script.
The issue doesn't seem to be with the code.
Any thoughts?
Interesting.. Since it worked correctly as a Field Validation script. (That was a good call by the way...) I have to agree it does not sound like a code problem. You may have found an issue specific to explicitly called scripts. If you could package up the script and some screen shots on how you set it up I'll test it here and see what I can determine.
Regards,
Gary
Hi,
Thanks again for your reply.
I am attaching the code. Have made a note at the lines which you would need to change to use the code on your system.
Steps to set up are:
I am able to consistently replicate the issue.
Let me know what you find.
Any help here will be greatly appreciated!
Thanks!
Padma
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.