- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-23-2014 12:54 PM
When I use a record producer and use the applyTemplate function on the current GlideRecord object I end up with two records with the same task number. The Record Producer has a template field, but the template I am using varies depending upon the options chosen during the wizard.
Does anyone know of a work around? I'm having troubles coming up with one.
Update:
I believe the problem is that the Record Producer and GlideRecord.applyTemplate does an Insert. So when I apply the template the current record gets inserted, and then inserted again when the record producer finishes running the code. If there is a way to specify at runtime what template the record producer should use this problem could be easily solved.
Message was edited by: Jason Butz
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-24-2014 05:25 AM
I appears as though my assumption that Record Producers run a current.insert()
after running the script may be correct. I looked through the Record Producers in the sandbox instance of ServiceNow at https://sandbox.service-now.com and found that the New LDAP Server Record Producer manually inserted the record and then called current.setAbortAction(true)
. That gave me the idea to run a current.update()
and then abort the action. This ended up working, I no longer get duplicate records.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-24-2014 04:45 AM
Make sure your templae doesn't have the number also. Remove it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-24-2014 04:47 AM
The template does not have the number field in it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-24-2014 05:25 AM
I appears as though my assumption that Record Producers run a current.insert()
after running the script may be correct. I looked through the Record Producers in the sandbox instance of ServiceNow at https://sandbox.service-now.com and found that the New LDAP Server Record Producer manually inserted the record and then called current.setAbortAction(true)
. That gave me the idea to run a current.update()
and then abort the action. This ended up working, I no longer get duplicate records.