Overwrite EnteredBy value
I' have written a program to create CR using SDK . Is it possible to set the EnteredBy field to a different user other than log on user?
I tried cr.setenteredby(differentuser) but it sets the user through which I logged on.
you've discovered a bug in the code, and i'll get a fix out with the next patch release.
in the meantime, you can work around it by changing your code a little.
ChangeRequest.Type crType = server.getTypes().CHANGE_REQUEST;
PropertyCollection pc = crType.getProperties();
Property enteredBy = pc.find(ChangeRequest.Type.EnteredByProperty.NAME);
On the other hand, if you would rather wait for the patch release build, but continue testing with your existing code, I've placed a private 14.0 SDK .jar on the forum ftp site.
you can download the zip using filezilla, unpack it and copy the .jar's to your 14.0 sdk lib folder, overwrite the existing ones.
Thanks for the help. As per your suggestion I have changed the code and it works, but it is not reflecting in CR form. when I tried cr.getenteredby() it returns the expected result, but the CR form shows the user value through which I logged on. I have sent you a mail with screenshots.
I didn't realize that you are working with the extensions.
I don't think you populate those fields with the core sdk api's.
i believe that there are explicit extensions api's you need to use
something like get(String propertyName)
set(String propertyName, object value)
you'll have to check the extensions samples, and i'll ask someone in support to help you.
Can I ask exactly you are trying to achieve by manipulating the 'Entered By' value?
Are you wishing to modify this value is the Custom Form when the CR is opened in the form? (using custom code that Anil supplied earlier, directly the ChangeRequestForm java code)? This would occur each and every time a Change Request is opened within the CPC, which may not be effective.
Or are you trying to correct CRs that were incorrectly entered in the first place?
You may need to commit the CR (create a new revision) for the changed 'Entered By' value to be updated on the database)
If you have a series of Change Requests that need this value updated just once i.e. corrected, then this 'may' be achievable using 'stcmd update' command from the StarTeam SDK, rather than using custom code in the CR form.
Actually I'm trying to create a CR. By Using StarTeam SDK I can create the new CR and set values to the fields but when I attempt to overwrite the EnteredBy value it fails. I mean the change is not reflected in CR form while the CR properties shows the expected value.