1
0
-1

Hello! I'm working with my team to attempt to link a Bug Work Item to a Feature Parent. I'm using the line below to attempt the linking... am I doing something wrong? Is ParentID not the right assignment?


replica.ParentId            = '34920';

    CommentAdd your comment...

    1 answer

    1.  
      1
      0
      -1

      Without knowing the exact nuances of what things are involved in this integration, it is a little hard to say, but I can definitely see something wrong with that line i.e. you are using the word replica!


      I believe the line should be:

      workItem.parentId = "34920"


      There is an extremely in depth post on the subject of hierarchies in ADO here


      Hopefully this helps you get over the line!


      Thanks

      Majid



      1. Kaleigh Garcia

        This is the full script. It seems like my dev team set it up using replica instead of workitem. Does that matter? Also new to Groovy. Syed Majid Hassan 

        /* SFDC ADO OUTGOING */
        if (entity.entityType == "XXXXX__c") {
        
            replica.Name                = entity.Name
            replica.Summary__c          = entity.Summary__c
            replica.Description__c      = entity.Description__c
            replica.Priority__c         = entity.Priority__c
            replica.Severity__c         = entity.Severity__c
            replica.IsPostRelease__c    = entity.IsPostRelease__c
            replica.attachments         = entity.attachments
            replica.RecordTypeName__c   = entity.RecordTypeName__c
            replica.CaseType__c            = entity.CaseType__c
            replica.Module__c            = entity.Module__c
            replica.StepsToReproduce__c = entity.StepsToReproduce__c
            replica.DueDate__c             = entity.DueDate__c
            replica.CriticalClinicalImpact__c = entity.CriticalClinicalImpact__c
            replica.ParentId            = entity.ParentId;
        }
        
        if(entity.entityType == "XXXXX" && entity.RecordTypeName__c == "XXXXX") {
            //replica.projectName = "XXXXXX"
            replica.projectName = 'Salesforce Connector'
            replica.issueTypeName = "Bug"
        }
        
        if(entity.entityType == "XXXXX" && entity.RecordTypeName__c == "XXXXX" && entity.IsPostRelease__c == false) {
             replica.Summary__c          = '[' + entity.Name + '] ' + entity.Summary__c
             replica.ParentId            = '59523';
        }
        
        if(entity.entityType == "XXXXX" && entity.RecordTypeName__c == "XXXXXO" && XXXXX == true) {
             replica.Summary__c          = '[' + entity.Name + ' XXXXX] ' + entity.Summary__c
             replica.ParentId            = '59536';
        }
        
        if (entity.entityType == "XXXXX" && entity.RecordTypeName__c == "XXXXx") {
            //replica.projectName = "XXXXX"
            replica.projectName = 'DevOps Test'
            replica.issueTypeName = "Defect"
            replica.Summary__c = entity.Summary__c
        }
      2. Kaleigh Garcia

        Syed Majid Hassan , I'm using Exalate to sync Salesforce to ADO if that's helpful. It seems to use replica. to move info to ADO. I think then I need to use your text above in the incoming script within ADO to set the workitem. Thank you for the help!

      3. Syed Majid Hassan

        Kaleigh Garcia So each side (SF and ADO) have their own copies of Incoming and Outgoing. 

        The outgoing packages the replica e.g. consider the line

        replica.summary = entity.summary

        This line picks the SF summary and packages it into the data structure called replica. 


        And yes, this replica is the object that is actually transported to the other side. 


        Now in the ADO incoming script, you will see a line similar to:

        workItem.summary = replica.summary

        This line is picking the summary from replica (so, basically the SF summary), and updating the workItem summary.


        Parent child hierarchies are a little tricky. Consider the line in question here:

        workItem.parentId = "34920"

        Now this line only makes sense in the ADO Incoming (you are correct) and the behavior of this line would be that whatever workitem is being worked on, will be made a child of 34920. If this is what you want, problem solved. But usually, these sort of lines are in an if block e.g. 

        if (replica.type.name == "Subtask")

              workItem.parentId = "34920"

        Note: This is just pseudo code meant to help you with the logic (I haven't tested it). 


        Thanks

        Majid


      4. Kaleigh Garcia

        This is very helpful! Thanks, Syed Majid Hassan (smile) 

      CommentAdd your comment...