on 12-30-2009 8:10 PM
HI,
When i am trying to Modify an existing MDM Record in Products Table using 7.1 Java API, i am getting the following error.
Can not update record with modification status NEW
When i directly modify the record in MDM Data Manager, it works fine, but when i try updating the record using Java API, i am getting the above Error. Can anyone advice what's wrong in here, i am using the following code.
ModifyRecordCommand modifyRecordsCommand = new ModifyRecordCommand(connecPool);
modifyRecordsCommand.setSession( usrSessionIdAdm );
modifyRecordsCommand.setRecord(emptyRecordProduct);
modifyRecordsCommand.setModifyAnyway(true);
//Create Record in MDM
modifyRecordsCommand.execute();
On "execute" command, i am getting the error.
Your help is really appreciated.
Thanks
Vijay Budati
Hi Vijay,
Does the Record "emptyRecordProduct" you are passing to the command already exist in MDM? It sounds to me like you are passing a new Record object that doesn't yet exist in MDM so the ModifyRecordCommand is the wrong command to use. Try using the CreateRecordCommand with a new Record.
-Greg
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Greg,
Thanks for the reply.
I am using the following code. "emptyRecordProduct" is not but creating an empty record first and then updated values to the fields and then telling to modify the record using "ModifyRecordCommand". As you mentioned, when i use RecordFactory.createEmptyRecord, it might mis-understood that i am trying to create a new record. If this is not the right way to use, could you advice which record i should use?
Record emptyRecordProduct = RecordFactory.createEmptyRecord(tableId) ;
emptyRecordProduct.setFieldValue(...., .....);
//Pass all the required values
ModifyRecordCommand modifyRecordsCommand = new ModifyRecordCommand(connecPool);
modifyRecordsCommand.setSession( usrSessionIdAdm );
modifyRecordsCommand.setRecord(emptyRecordProduct);
modifyRecordsCommand.setModifyAnyway(true);
//Create Record in MDM
ModifyRecordsCommand.execute();
Thanks for your help.
Thanks
Vijay Budati
Greg,
Solved.
Actually, I am using the same record which I used to create for modifying too. Now I got the reference from the existing record and modified it and worked.
Thanks
Vijay Budati
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
95 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.