How to dot walk in a field from a variable

odinx16
Kilo Contributor

I have the following requirement:

In a catalog item, to have a field where I can select fields from a table associated with a variable. 

Let's assume there will be two fields - one in which i select the variable (one of the variables of the item - always a reference variable)

The second field has to offer me a filtered choice of the columns in the table that the variable refers. 

For example - if the variable refers to a service - the second one can be Service Owner, or Service Technical manager, etc.

 

Is this feasible, and any suggestions on how to approach it?  

2 REPLIES 2

kazidon
Giga Contributor

you can use 

var some_variable = g_form.getReference('variable from form', doSomething);

function doSomething(some_variable)
{
  alert(some_variable.related_variable);
}

 

that will work for dot walking a variable, not sure about the other stuff your asking, maybe some screen shots will help.

 

sachin_namjoshi
Kilo Patron
Kilo Patron

i will suggest below approach.

 

- Develop script include which returns service owner or service technical manager based on your input service from catalog item variable.

- Develop on change client script on service variable which does GlideAjax to above script include.

- This client script will set service owner, service technical manager etc based on service variable value passed.

 

I assume that you are storing service to service owner relationship in your CMDB or any lookup table.

 

Regards,

Sachin