none
Display custom field value when reassign task RRS feed

  • Question

  • I've created new task and inserted values for custom fields and reassigned this task to another resource but that custom fields display nothing (empty).

    Can anyone help ?


    Monday, February 18, 2013 10:19 AM

Answers

  • Yes, for custom fields;

    Ben Howard [MVP] blog | web

    • Marked as answer by Bashar Karajeh Tuesday, February 26, 2013 9:44 AM
    Tuesday, February 26, 2013 5:47 AM
    Moderator
  • In its simplest form, where it is just taking the assignment value and overwriting the task value it is this:

    Sub rolluper()
    Dim T As Task
    Dim R As Resource
    Dim A As Assignment
    Dim AA As Assignment
    
    For Each T In ActiveProject.Tasks
        If Not (T Is Nothing) Then
            T.text1 = ""
            T.Number1 = 0
            T.Date1 = "NA"
        End If
    Next T
    
    
    For Each R In ActiveProject.Resources
        If Not (R Is Nothing) Then
            For Each A In R.Assignments
                'sets task text1 = assignment text1 (last save wins if there is more than one assignemnt)
                'If a later assignment had a blank value then the task field would be blank even if an earlier assignment had a value
                ActiveProject.Tasks(A.taskID).text1 = A.text1
                
                'puts sum of assignments into task
                ActiveProject.Tasks(A.taskID).Number1 = ActiveProject.Tasks(A.taskID).Number1 + A.Number1
                
                'Puts earliest assignment date into task date
                If ActiveProject.Tasks(A.taskID).Date1 = "NA" Then
                    ActiveProject.Tasks(A.taskID).Date1 = A.Date1
                ElseIf A.Date1 < ActiveProject.Tasks(A.taskID).Date1 Then
                    ActiveProject.Tasks(A.taskID).Date1 = A.Date1
                End If
                
                'puts latest assignemnt date into task date
                If ActiveProject.Tasks(A.taskID).Date2 = "NA" Then
                    ActiveProject.Tasks(A.taskID).Date2 = A.Date2
                ElseIf A.Date2 > ActiveProject.Tasks(A.taskID).Date2 Then
                    ActiveProject.Tasks(A.taskID).Date2 = A.Date2
                End If
            Next A
        End If
    Next R
    
    
    End Sub

    the text field part only works well if there is only one resource on the task. If there are several then you need to add some checks to specify which values should be rolled up.


    Brian Kennemer - Project MVP
    DeltaBahn Senior Architect
    endlessly obsessing about Project Server…so that you don’t have to.
    Blog | Twitter | LinkedIn

    Tuesday, February 26, 2013 10:07 PM
    Moderator

All replies

  • The custom field needs to be "rolled down" to the assignment level - I suspect the code to do this is in Project - try opening and republishing the project using MSProject and then let us know if that works.

    Ben Howard [MVP] blog | web

    Monday, February 18, 2013 5:12 PM
    Moderator
  •  

    It's "rolled down" and didn't work!!

    this example for my problem:

    Custom field is not read-only, I want resource A to change value for custom field from tasks window and save after that reassign task to resource B, but resource B doesn't see custom field new value or any update which inserted by resource A.

    Saturday, February 23, 2013 6:48 AM
  • Hi, well, because it rolls down does not mean it rolls up.  This needs custom code.

    Ben Howard [MVP] blog | web

    Sunday, February 24, 2013 4:05 AM
    Moderator
  • You mean that i need to set a code to let any updates on custom fields in assignment level reflects on project (task level) just like start or finish or % work complete ?? please advise ?
    Monday, February 25, 2013 8:54 AM
  • Yes, for custom fields;

    Ben Howard [MVP] blog | web

    • Marked as answer by Bashar Karajeh Tuesday, February 26, 2013 9:44 AM
    Tuesday, February 26, 2013 5:47 AM
    Moderator
  • Can you advise what is the codes ?

    Tuesday, February 26, 2013 6:39 AM
  • In its simplest form, where it is just taking the assignment value and overwriting the task value it is this:

    Sub rolluper()
    Dim T As Task
    Dim R As Resource
    Dim A As Assignment
    Dim AA As Assignment
    
    For Each T In ActiveProject.Tasks
        If Not (T Is Nothing) Then
            T.text1 = ""
            T.Number1 = 0
            T.Date1 = "NA"
        End If
    Next T
    
    
    For Each R In ActiveProject.Resources
        If Not (R Is Nothing) Then
            For Each A In R.Assignments
                'sets task text1 = assignment text1 (last save wins if there is more than one assignemnt)
                'If a later assignment had a blank value then the task field would be blank even if an earlier assignment had a value
                ActiveProject.Tasks(A.taskID).text1 = A.text1
                
                'puts sum of assignments into task
                ActiveProject.Tasks(A.taskID).Number1 = ActiveProject.Tasks(A.taskID).Number1 + A.Number1
                
                'Puts earliest assignment date into task date
                If ActiveProject.Tasks(A.taskID).Date1 = "NA" Then
                    ActiveProject.Tasks(A.taskID).Date1 = A.Date1
                ElseIf A.Date1 < ActiveProject.Tasks(A.taskID).Date1 Then
                    ActiveProject.Tasks(A.taskID).Date1 = A.Date1
                End If
                
                'puts latest assignemnt date into task date
                If ActiveProject.Tasks(A.taskID).Date2 = "NA" Then
                    ActiveProject.Tasks(A.taskID).Date2 = A.Date2
                ElseIf A.Date2 > ActiveProject.Tasks(A.taskID).Date2 Then
                    ActiveProject.Tasks(A.taskID).Date2 = A.Date2
                End If
            Next A
        End If
    Next R
    
    
    End Sub

    the text field part only works well if there is only one resource on the task. If there are several then you need to add some checks to specify which values should be rolled up.


    Brian Kennemer - Project MVP
    DeltaBahn Senior Architect
    endlessly obsessing about Project Server…so that you don’t have to.
    Blog | Twitter | LinkedIn

    Tuesday, February 26, 2013 10:07 PM
    Moderator