- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-14-2016 11:23 AM
Hello All,
I know this particular topic has been discussed quite a bit around the community and every document I've read has been more or less dancing around what my particular issue is. So here we go. I have created a document_id field on a custom table("Approval Base") . This approval base table is the parent table for a couple of other tables. So, my current functionality is that, on any of the extended tables(Table B or Table C), when I create a record, it will generate a new record on the approval base table where the document_id field is.
What I want to happen, is for that document_id field to get populated with the record and table name of the record that generated it. That's all. But, I can't seem to make that happen. Any suggestions on how to accomplish this?
P.S. Another article I read, mentioned querying other tables, etc. The problem with that, is that it can be a large number of tables that can generate an approval base record. I will never know exactly which table is going to generate the record so writing a query for that wouldn't quite work.
Solved! Go to Solution.
- Labels:
-
User Interface (UI)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-15-2016 11:07 AM
After tinkering around with the Business Rule concept suggested by sumeet.n I have a solution to populate this document_id field with the correct values. This is being done via getRecordClassName() in an after insert Business Rule. The value returned from that is the table name of the record that generated the new record and the sys_id of the new record directly relates back to a record on the originating table. This might be a unique case based on how my tables are extended from each other but nonetheless, with those 2 pieces of information, I can properly fill in the document_id field as needed. Thanks for the assist sumeet.n
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-14-2016 11:57 AM
Hi Kenneth,
Just wanted to check if the 'Souce table' field is implemented and dependency is defined to that source table..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-14-2016 12:06 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-14-2016 12:10 PM
You are missing a field (I referred to as Source Table) of type 'Table Name', which you need to link it to your 'ID' field in dictionary in 'Dependent field' tab. And everytime you insert a record and you have to set Document Id field, you need to set the 'source table' field as well.
Please refer below link.
Creating a Document ID Field - ServiceNow Wiki
Document Id field works for my custom table if followed the steps above.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-14-2016 12:17 PM
Ok, so by your explanation, that's what those 2 fields do. See below...
This is an example of one that I manually created. I selected the table name and the record by clicking the magnifying glass for the ID field. I then saved the record, and the table name was automatically populated. That functionality works as expected and as designed. What I need to do, is not have to enter that information manually. If this record were generated because of it's relationship to another table, I need it to automatically populate the table name and ID as if I went through and manually did it.
Edit : So for further context, that example above is one that I manually created. When I don't manually create the record, this is what I get...
That's a screenshot of the the example above from the list view, and another one that I did not manually create. There is no ID or Table captured.