Cannot Create Supplier Users via Agile Java SDK
Hi,
I am unable to create the Supplier User in Agile PLM via SDK. I am setting the ATT_SUPPLIER parameter with Supplier name as documented in SDK documentation.
However, I am gettting exception.
And can I update user’s ATT_SUPPLIER post user creation using setValue() operation on user.
Exception in thread “main” com.agile.util.exception.CMAppException: Invalid parameter.
at weblogic.utils.StackTraceDisabled.unknownMethod()
Error code : 60018
Error message : Invalid parameter.
Please help.
Thanks,
Jaydeep Mehta
Hi Jaydeep,
It shouldn’t be an issue actually. Tried with sample code with existing supplier as well as with creating a new supplier and it worked all fine.
In this sample, Supplier user mak1 is created with Supplier Number 10092.
Just verify in the UserConstants.ATT_SUPPLIER field, you should pass Supplier_Number instead of Supplier name.
HashMap<Integer, String> supplierUser = new HashMap<>();
supplierUser.put(UserConstants.ATT_GENERAL_INFO_USER_ID, “mak1”);
supplierUser.put(UserConstants.ATT_LOGIN_PASSWORD, “agile123”);
supplierUser.put(UserConstants.ATT_SUPPLIER, “10092”);
IUser supUser = (IUser) m_session.createObject(UserConstants.CLASS_USER, supplierUser);
Regards,
Arif
Hi Arif,
Thanks for your prompt solution. I got it working now. You are correct with your observation, need to use supplier number in place of supplier name.
Also, can you please assist in updating user to different Supplier. I tried editing ATT_SUPPLIER using setValue or setValues of User Object. It is throwing exception.Please help.
The code works updating other attributes. (Comment line to update supplier))
Exception in thread “main” Error code : 60029
Error message : Attribute “-3” not found.
at com.agile.api.pc.Session.createError(Session.java:2043)
at com.agile.api.pc.APIObject.createError(APIObject.java:87)
at com.agile.api.pc.DataObject.getTableForAttribute(DataObject.java:140)
at com.agile.api.pc.DataObject.setValue(DataObject.java:196)
at AgileTest.updateUser(AgileTest.java:94)
at AgileTest.main(AgileTest.java:48)
private static void updateUser(IAgileSession session, IUser user) throws APIException {
HashMap<Integer, Object> userParams = new HashMap<Integer, Object>();
/*
* userParams.put(UserConstants.ATT_LOGIN_PASSWORD, “Backspace_2018”);
* userParams.put(UserConstants.ATT_GENERAL_INFO_FIRST_NAME, “saloni1”);
* //userParams.put(UserConstants.ATT_GENERAL_INFO_LAST_NAME, “test1”);
* userParams.put(UserConstants.ATT_GENERAL_INFO_EMAIL,
* “salonitest1@gmail.com”);
*/
//userParams.put(UserConstants.ATT_SUPPLIER, “ODM00005”);
//userParams.put(UserConstants.ATT_GENERAL_INFO_POSTAL_ZIP_CODE, “361002”);
//String listArray[] = {“Price Administrator List”,”Quality Administrator List”};
//userParams.put(UserConstants.ATT_GENERAL_INFO_LISTS, new Object[] { “Price Administrator List”,”Quality Administrator List” });
user.setValue(UserConstants.ATT_SUPPLIER, “ODM00005”);
System.out.println(“User Update Success”+ user.getName());
}
Please help!!
Thanks
I am not totally clear about your requirement here. Based on your comments, my understanding of your issue is as below. Let me know:
You are able to set supplier while creating User but have having issues while trying to set a different supplier?