Discovery Pattern - Map a value to a Reference Field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2025 12:39 PM
Hello Guys,
I am working on a custom pattern and running into an issue. I can hit an API endpoint and return a string value for a device/hostname. I am then trying to map the returned value to a reference field to the cmdb_ci_computer table. I do realize that the reference field must be a sysid rather than a string. I am not certain of the process of performing the lookup using the returned string from the API Endpoint and then populating the sysid into the reference field.
For example,
1. The API returns a client and host server name
2. The pattern creates the Client CI as expected. However, there is a host field that I am hoping to reference the cmdb_ci_computer table and perform a lookup with the string that's returned from the API and then populate the reference field if found.
I believe this would be accomplished with a Pre Post Processing Script. However, I am not sure where to start or if this is the correct course of action for what I am attempting to accomplish. Thank you in advance.
- Labels:
-
Discovery

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2025 10:26 AM
@gagribben You can use Pre Post processing script here. Adding one blog URL, this might give you starting step to fulfill your requirement.
Using Pre/Post Processing Scripts to handle reference fields via Discovery Pattern
Thanks,
Harsh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-19-2025 11:19 AM
Hi @gagribben ,
Yes, pre-post processing script is the correct approach to handle this situation but then just make sure there are no duplicate records with same name in the cmdb_ci_computer table.
Regards,
srinija
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-19-2025 06:07 PM
Hi @gagribben
That's correct, you need to implement the pre post processing script in that select pre-sensor script .