Creating Configuration item using APIs

Giri6
Tera Expert

I am creating a catalog item and workflow that allows to create CI .  The form has selection for class and name. How do I create using GlideRecord?

Do I need to define new GlideRecord("cmdb_ci_' + className"); 

or

gr = new GlideRecord('cmdb_ci");

gr.class = variables.className

 

Appreciate input

1 ACCEPTED SOLUTION

Vasantharajan N
Giga Sage
Giga Sage

Please use the child table using your first syntax. 

I hope className variable will have the right class name set to it. 

For example if you want to insert a record in Windows then your className should be win_server by that with way it point to cmdb_ci_win_server table using the syntax below.

new GlideRecord("cmdb_ci_' + className"); 


Thanks & Regards,
Vasanth

View solution in original post

1 REPLY 1

Vasantharajan N
Giga Sage
Giga Sage

Please use the child table using your first syntax. 

I hope className variable will have the right class name set to it. 

For example if you want to insert a record in Windows then your className should be win_server by that with way it point to cmdb_ci_win_server table using the syntax below.

new GlideRecord("cmdb_ci_' + className"); 


Thanks & Regards,
Vasanth