How to link a Bug to a Feature within Exalate and ADO

Originally asked by Kaleigh Garcia on 16 August 2023 (original question)


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


Answer by Syed Majid Hassan on 18 August 2023

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


Comments:

Kaleigh Garcia commented on 18 August 2023

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
}
Kaleigh Garcia commented on 18 August 2023

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!

Syed Majid Hassan commented on 19 August 2023

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

Kaleigh Garcia commented on 21 August 2023

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

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.