Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Importing arrays of values with ExtendedInformations using Asset Discovery custom patterns

Julen Solla
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 10, 2023

Hello, I am a bit lost and in need of help here. I need to import additional info when scanning for applications in discovery. I need to do it at this time because I do not have enough data on the application object to update the existing object at a later time, and partial data would create a new object instead.

I need to pass a list of string values along with the Application object. I want to use said values to find and reference other objects in the CMDB. This reference can be empty or point at multiple objects, similar to its ReferencedHosts property.

I've been testing ExtendedInformations with my custom pattern and it seems like it should be the right way to go.

My issue is that the ExtendedInformation class only supports 4 types of values: String, Int, Bool or Date. I chose String. ExtendedInformation requires a name for each element, but I do not know how many elements there may be so I need to use the same name for all so I can map it in the schema. If I do this it only imports the last object. 

The report XML uses multiple <value> tags for arrays but I am unable to replicate that with a custom pattern as it will be parsed with the ExtendedInformation class structure <name><type><value>.

 Let's say I need to import and application and link it to objects with the IDs "1", "2" and "14" 

 


ApplicationInfo ai = new ApplicationInfo() { ExtendedInformations = new List<ExtendedInformation>() };

...

ai.ExtendedInformations.Add(new ExtendedInformation() { Name = "RelatedTo", Value = "1" });

ai.ExtendedInformations.Add(new ExtendedInformation() { Name = "RelatedTo", Value = "2" });

ai.ExtendedInformations.Add(new ExtendedInformation() { Name = "RelatedTo", Value = "14" });


All of them show up in the scan report but apparently only the last element will be imported, so the AQL: "My object ID" IN ${RelatedTo${0}} won't work. Naming them RelatedTo[0], RelatedTo[1]. RelatedTo[2] and then an empty RelatedTo for mapping didn't do the trick either.


I've also tried adding all values to a single element:


ai.ExtendedInformations.Add(new ExtendedInformation() { Name = "RelatedTo", Value = "1 2 14" });

But it seems there's no operator such as JQL's contains operator (~):  "My object ID" ~ ${RelatedTo} so I am unable to build a working AQL that can extract multiple values from that string.

RegEx capturing groups (\d+) won't work either, as it's only supposed to validate the data.

 

What am I missing here? Any ideas on how I could include a list of values and map it to reference multiple objects? Thank you.

0 answers

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events