Highlighted
New Member.
3135 views

Overwrite EnteredBy value

Hi,

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.

0 Likes
6 Replies
Highlighted
Micro Focus Expert
Micro Focus Expert

hi vel,

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);

cr.setValue(enteredBy, differentuser);

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.

ftp://stsdkcust:LpeEFPwNMJ@emeaftp.microfocus.com/14.0/starteam140.zip

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.

0 Likes
Highlighted
New Member.

Hi Anil,

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.

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

Hi Vel,

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.

0 Likes
Highlighted
New Member.

Thanks Anil, where do I find extensions samples?

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

Hello Vel,

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.

0 Likes
Highlighted
New Member.

Hi Andrew,

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.

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.