Create another record on submit of record producer.

Sharath807
Tera Contributor

Hi all can anyone help to achieve this.

so I have created two tables 1. u_schedule maintenance

                                               2.u_maintenance task.(This table extends task table).

The u_schedule maintenance tables record is created by using record producer, which was also created.

Next is when i click submit on record producer the (u_schedule maintenance) record should be created as well as the (u_maintenance task) record also should be created simultaneously.

7 REPLIES 7

Hari Prasath
Tera Guru

Hi @Sharath807 

 

We can create records in two tables using a record producer. I just created a producer with your requirement for the tables I used Incident and Change. 

Give the target table as one table and the other table in the record producer record producer script. 

I've attached the created record producer below, follow the same but change the tables as you want. You can achieve your requirement.

 

Please mark the answer as helpful if it helped you accordingly!

 

Thanks,

Hari

Sonu Parab
Mega Sage
Mega Sage

Hi @Sharath807 ,
1] Create one onSubmit Catalog Client Script on record producer.
2] Please refer below thread to create Client Script and Script Include(For creating new record in u_maintenance task table.)
using GlideAjax to insert a new user record onSubmit of a form 

Let me know if you are facing any issue.

If I could help you with your Query then, please hit the Thumb Icon and mark as Correct !!

Thank You

Sharath807
Tera Contributor

@Sonu Parab But in my case ..it should be like if we order catalog item Sc_task will be created na.

Like that if i create schedule maintenance using record producer and if i click sumbit, maintenance task should be created sir 

Hi @Sharath807 , 
Consider two table Table A  - u_schedule maintenance 
                                  Table B - u_maintenance task
If you click on Submit button then first record will be created in Table A. 

and if you want to create record in Table B along with this then need to create After Insert Business Rule on Table A.  
And take help of below script to create new record in Table B.

(function executeRule(current, previous /*null when async*/ ) {

    // Add your code here

    var gr = new GlideRecord("Table_B");
    gr.initialize();
    gr.tableB_assigneTo = current.tableA_assigneTo;
    gr.tableA_assignmentGroup = current.tableA_assignmentGroup;
    gr.insert();

})(current, previous);

 

If I could help you with your Query then, please hit the Thumb Icon and mark as Correct !!

Thank You