Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

UI Action to Create Record in Another Table.

dfry123
Mega Expert

Hello,

I have a parent table (table1) that extends the CMDB table. I also have another table that extends table1 (table2).

I created a UI action on Table 2 that will create a record on Table1 with the data from Table2. This works without issue except the choice lists I have on Table 2 does not go over to Table 1 even though the choice lists contain the same names/values. I tested by forcing the value like this "phone.u_phone_manufacturer = "Apple";"   and it worked without issue.  

Any help would be appreciated... my script is below.

var phone = new GlideRecord('table1');

                  phone.initialize();

                        phone.u_phone_manufacturer = current.u_requested_manufacturer();

                          phone.assigned_to = current.assigned_to();
                          phone.u_type = current.u_type();
phone.u_color = "blue" ;
                         

                 

phone.insert();

action.setRedirectURL(phone);
action.setReturnURL(current);

1 ACCEPTED SOLUTION

nthumma
Giga Guru

var phone = new GlideRecord('table1');


                  phone.initialize();



                        phone.u_phone_manufacturer = current.u_requested_manufacturer;


                          phone.assigned_to = current.assigned_to;


                          phone.u_type = current.u_type;


phone.u_color = "blue" ;


                       


               


phone.insert();


action.setRedirectURL(phone);


action.setReturnURL(current);



can you try like above without parenthesis '()'?


View solution in original post

5 REPLIES 5

Yea that worked.



Basically table 1 holds all of the records for physical phones. Table 2 is to request a phone.. so once it gets transferred to table 1 (It gets approved) the record on table 2 will be closed.