How to map one record producer to two tables?

Supriya P
Tera Contributor

Hii,

We have requirement, in that we want to map one record producer to two different tables.

Eg There is one variable BCM with two choices Project And Account.

If user selects project level approach then record should inserted into Plan table and Analysis table.

And the name should be project name.

If user selects account level approach then record should inserted into Plan table and Analysis table.

And the name should be account name.

 

 

3 REPLIES 3

Valmik Patil1
Kilo Sage

Hi ,

For table 1 you can map to record producer and assign variables to that table fields

Then for table 2 you can write Glide Record in script section of record producer to insert record in different table. You can map same variables with table 2 fields and insert record.

And for Project name and account name you need to apply condition as below

var Name
if(producer.bcm == "project"){

      var Name = <project variable value>;
     
}
if(producer.bcm == "account"){
     Name = <account variable value>;
}

// you can assign this name to your current.name  and Glide record object name for insertion

 

Please let me know if you need any other help

Thanks,

Valmik

SumanthDosapati
Mega Sage
Mega Sage

Hi,

For second table you can use Record Producer Script field in the record producer to map data into another table.

 

Regards,

Sumanth

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

Approach 1

1) have 2 record producers both having same target table and same variables

2) if user selects Account level approach redirect that user to other record producer and pass the variables filled on 1st record producer as URL parameters

3) then on the other record producer create onLoad catalog client script and get the variable values from URL and auto-populate them

3 Ways to Populate Values in ServiceNow via the URL

Approach 2

1) In the record producer script if the user selects Account level then submit the record producer via script

https://community.servicenow.com/community?id=community_question&sys_id=c5440f29dbd8dbc01dcaf3231f96...

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader