Pattern extension - Adding fields to table already populated

Miguel Sanchez1
Tera Contributor

Hello everyone,

We have created a pattern extension for routers to make some customization. Basically we are trying to get the description from the device's interfaces and populate the field "short_description" in table "dscy_router_interface". Since that table has already been populated by the OOB pattern we only need to add the values for that specific field but haven't found a way to do it.

We only need to add the description and don't want to wipe out the current content of the table because there are already relations with other tables.

Is there a way to iterate through that table and assign to each router interface the correct description based on the interface index (that index works as the identifier of the interface)?

Thanks in advance for the help!

4 REPLIES 4

Ashutosh Munot1
Kilo Patron
Kilo Patron

Hi,

You can do it here:

Go to the pattern and create a extension and in this update that table.

 

Thanks,
Ashutosh

Thanks for the info Ashutosh, but the actual issue is with the logic behind actually populating the field.

Venky VA
ServiceNow Employee
ServiceNow Employee

We only need to add the description and don't want to wipe out the current content of the table because there are already relations with other tables

Possible Solutions:

use java script approach access all records in tabled scy_router_interface and update short description by iterating.

OR

Fetch router_interface records and update shot description.

Save values into temporary table.

Later do union of temporary table and dscy_router_interface.

 

Hello Venky,

Thanks for the answer. How are cmdb tables referenced from the javascript code? I'm trying to iterate using a "set parameter value" step in combination with "eval()", however I haven't found a way to directly reference and modify the "dscy_router_interface[].short_description" field while looping.

I tried something like this but is not working:

for(i=0; i<${dscy_router_interface}.size(); i++){
    ${dscy_router_interface[i].short_description} = ${if_alias_table[i].ifAlias};   
}

where:

  • ${dscy_router_interface} is the target table
  • ${if_alias_table} is a merged table that contains the description I need

What am I missing?

Thanks!