This discussion is archived
2 Replies Latest reply: Nov 1, 2009 12:23 AM by 587686 RSS

Accessing UDFs through Web Services

708184 Newbie
Currently Being Moderated
Hi,

I'm not sure if this is the proper place to put this question, but I couldn't see a better place to put it. Here's my question if someone could answer it:

I'm writing an applicationthat pulls projects/activities off a Primavera Database. After pulling down the project into my program, I need to be able to access a value in one of the UDF fields and multiply that value by several of the acitivty properties. I can pull down the normla properties of activities and projects fine, but I can not figure out how to retrieve UDFs from a project/activity. I've tried using the Export Service, but after trying for over a month with primavera support, we couldn't solve the issues causing the export to fail. So unfotunately that is not an option. I need to be able to retrieve UDFs directly from the project/activity. If it makes any difference, the UDF I'm interested in always has the same name.

I've been trying to do this in C#, using the P6WSDemo as basis, but as I said the export service fails, and that example doesn't include a way to access UDFs. If anyone has accessed UDFs or know how, could you tell me how to do it?

Thanks in advance
  • 1. Re: Accessing UDFs through Web Services
    587686 Newbie
    Currently Being Moderated
    Hi
    we have done this using Java..see if this helps...

    am attaching snippets:

    // load all activities of the project or based on afilter
                   boiActivity = m_project.loadAllActivities(new String[]{"ObjectId", "Id", "Name", "EarlyStartDate", "EarlyFinishDate"}, null, "Id asc");

    while (boiActivity.hasNext()) {
                        
                        try {
                             Activity activity = (Activity)boiActivity.next();
                             m_activityObjId = activity.getObjectId();
    // for each activity
    // load all the UDF's you like by name
                   +bo = m_manager.loadUDFValues(new String[] { "UDFTypeTitle", "Text", "UDFTypeObjectId", "ForeignObjectId", "ProjectObjectId" },
                             "ForeignObjectId = '" + m_activityObjId + "' and ProjectObjectId = '" + m_projectObjId + "' and Upper(UDFTypeTitle) IN ('WO NUMBER', 'TASK', 'WOTASK')", null);+*

    // these are the values you get in a list or an array - which has name and value
    // this might be slightly complicated if you have text, number and date UDF's that you want to get in one shot.

    if you need more help, please do ping me..

    Thanks

    Sury

    Sury
  • 2. Re: Accessing UDFs through Web Services
    587686 Newbie
    Currently Being Moderated
    i have used the API for this but you can find the corresponding web service call..

    please read

    UDFValues.ReadUDFValues call..

    Thanks

    Sury

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points