Unable to set tha value of OutlineCode custom fields

L

lumar

I am writing a script to create a MSPP project (actually a .mpp file), apply
a template to it, set the values of some custom fields and finally publish
the project to MSPS.
Everything works, except for setting the values of 5 custom fields.
Actually 7 project (NOT task) custom fields are defined; 2 are text fields
(pjCustomResourceEnterpriseText1 and pjCustomResourceEnterpriseText2), the
remaining 5 are outlinecode fields (pjCustomResourceEnterpriseOutlineCode(1
to 5)).
I got the project summary task and applied the SetField method recursively
(on a list of fiels IDs); this method sets the value of the 2 text fields,
but does nothing in the remaining outlinecode fields.
I am sure I am passing it the correct field IDs because if I call the
CustomFieldGetName(fieldid) method I get the expected field name.
Am I forgetting anything?
Please help me, I have to complete this script before Friday.
Thanks in advance.
 
S

Stephen Sanderlin

lumar said:
I am writing a script to create a MSPP project (actually a .mpp
file), apply a template to it, set the values of some custom fields
and finally publish the project to MSPS.
Everything works, except for setting the values of 5 custom fields.
Actually 7 project (NOT task) custom fields are defined; 2 are text
fields (pjCustomResourceEnterpriseText1 and
pjCustomResourceEnterpriseText2), the remaining 5 are outlinecode
fields (pjCustomResourceEnterpriseOutlineCode(1 to 5)).
I got the project summary task and applied the SetField method
recursively (on a list of fiels IDs); this method sets the value of
the 2 text fields, but does nothing in the remaining outlinecode
fields. I am sure I am passing it the correct field IDs because if I
call the CustomFieldGetName(fieldid) method I get the expected field
name. Am I forgetting anything?
Please help me, I have to complete this script before Friday.
Thanks in advance.

Well, first thing that comes to mind is why are you trying to set the
value of *Resource* Custom Fields on a *Project*?

--
Stephen Sanderlin
Principal Consultant
MSProjectExperts
For Project Server Consulting: http://www.msprojectexperts.com
For Project Server Training: http://www.projectservertraining.com
For Project Server Books: http://www.projectserverbooks.com
For Project Server FAQS: http://www.projectserverexperts.com

Owner/Founder - EPMFAQ
http://www.epmfaq.com/
http://forums.epmfaq.com/

This electronic message, along with any information, advice, and
opinions it contains, are mine alone and are not representative of my
employer. All information is provided in "GOOD FAITH" and on an "AS IS"
basis only. I provide no presentations or warranties, express or
implied, including implied warranties of fitness for a particular
purpose, merchantability, title, and noninfringement. I strongly advise
you to extensively test any changes, workarounds, or techniques
described herein on a development system prior to implementation in a
production environment, and you are hereby notified that I bear no
responsibility whatsoever for any loss, harm, or otherwise negative
outcomes resulting from your actions, whether or not said actions were
a result of this electronic message, directly or indirectly.
 
L

lumar

Do you mean a field pjCustomResource - like ?
No, they're all pjCustomProjectEnterpriseOutlineCode - like.
I identified their IDs in the PjCustomField Enumeration page of the Project
Model Object Reference in MSDN:
"188744589", "188744590", "188744591", "188744592", "188744593".
When I execute the method:
apllication.CustomFieldGetName(ID)
I get the field name I am expecting.
However, the method
newProject.ProjectSummaryTask.SetField(ID,"my value")
does not valorize them.
It succeeds only for those 2 pjCustomProjectEnterpriseText fields.
I am working with MSPP2003 and MSPS2003.
 
J

Jack Dahlgren

Stephen,

Wow! Look at your sig. Tradition is that it be no longer than 4 lines. I
only mention it because it made it difficult to read the message on the tiny
screen I'm dealing with.

-Jack Dahlgren
 
S

Stephen Sanderlin

Jack said:
Stephen,

Wow! Look at your sig. Tradition is that it be no longer than 4
lines. I only mention it because it made it difficult to read the
message on the tiny screen I'm dealing with.

-Jack Dahlgren


I try to trim it in replies, but I understand your point.

Better? :)

--
Stephen Sanderlin
Principal Consultant
MSProjectExperts
For Project Server Consulting: http://www.msprojectexperts.com
For Project Server Training: http://www.projectservertraining.com

Owner/Founder - EPMFAQ
http://www.epmfaq.com/
http://forums.epmfaq.com/
 
S

Stephen Sanderlin

Your original posting said CustomResource, hence my confusion. Thank
you for clarifying that and which version you are working with.

For your reference, the PjCustomField Enumeration
(http://msdn.microsoft.com/en-us/library/bb221982.aspx) in MSDN is for
Project 2007. I have not gone through the entire list, so I cannot say
with confidence that it's exactly the same as 2003. For this reason, I
pull my values from the MSP_CONVERSIONS table or use the PjField
enumeration directly.

If you're not recieving an error, I'm not sure what the problem is.
I've tested on your behalf with both the ID and the PjField enumeration
and had no trouble.

Have you tried setting a breakpoint and stepping through the code to
verify that the code is executing as you expect?

--
Stephen Sanderlin
Principal Consultant
MSProjectExperts
For Project Server Consulting: http://www.msprojectexperts.com
For Project Server Training: http://www.projectservertraining.com

Owner/Founder - EPMFAQ
http://www.epmfaq.com/
http://forums.epmfaq.com/
 
M

Marcus Wolfe

Two things I can think of to check:
1. are the code masks and lookup tables for the outline codes defined before
you start trying to enter values?
2. Your "Value" needs to be the same as the "FullName" value for the field
entry, i.e. contain values for all levels of the outline code mask with the
proper separators.
cheers,
Marcus
 
L

lumar

I've changed my approach to the problem: now I start a winproj application
with the /s /u /p switches, so I am connected to the MSPS db, and I can set
the values of those fields.
There's only one minor issue still open: so far I've not been able to set a
value when the value contains a space (e.g. "data center").
Should I format the string in a particular way?
 
L

lumar

Now I've solved on my own even this issue.

lumar said:
I've changed my approach to the problem: now I start a winproj application
with the /s /u /p switches, so I am connected to the MSPS db, and I can set
the values of those fields.
There's only one minor issue still open: so far I've not been able to set a
value when the value contains a space (e.g. "data center").
Should I format the string in a particular way?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top