How to map one record producer to two tables?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-11-2022 09:39 PM
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.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-11-2022 10:09 PM
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-11-2022 10:18 PM
Hi,
For second table you can use Record Producer Script field in the record producer to map data into another table.
Regards,
Sumanth
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-11-2022 10:59 PM
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
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader