- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
on 09-21-2016 01:29 PM
Hello again!
Before we dive in, let me explain what "Field Name" is referencing in this document. Field Name is a little used field type that is scattered around the system. It looks like a drop down list that shows the list of fields on a table (usually defined by another field sitting on the form). Here's a screenshot to help.
While these fields have their practical uses, there is a slight hiccup with them. We aren't able to see the fields of any referencing tables to the one we're currently in. That's all well and good if everything is contained in one table, but can be a challenge if say, there's a difficult filter condition that needs to be included on the same record, so the table has to jive with meeting that requirement as well (I'm looking at you survey trigger conditions!).
Thankfully, there is a solution. Even though we can't see referencing table fields from the Field Name picker, we can still force it to use one of these fields via scripting. Let's say I'm building a Trigger Condition for Survey, and I need the trigger condition to start at the Task table due to a condition. I still need to set the Field Name field to the Caller field from an Incident though. To do that, we can run a background script that sets the Field Name to the referencing field we want.
var gr = new GlideRecord('asmt_condition'); //table with the Field Name field here
gr.addQuery('sys_id', sysid); //grab the sys_id of the record, and put it in here
gr.query();
while(gr.next()){
gr.user_field = 'ref_incident.caller_id'; //here is where we set the Field Name
//Going to the starting table, then creating a filter condition there to figure out the path for the referencing table field is the easiest way to find it
//Basic structure is putting ref_ before the name of the referencing table, then dot walking
gr.update();
}
Once the background script is run, we can head back to the record and confirm the change took.
And voila! Make sure to test anything running based off of this field to ensure it works. There's a bug in Fuji that prevents survey conditions (for legacy surveys) from working correctly by using this. Always good to check to see if it works instead of just assuming it does.
Hope this helps someone out there!
- 3,601 Views
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hello,
After you extend the table with other table eg. Task table automatically all fields are appears from extened table, You just have to manage them using form layout or list layout as per your need.
Thank you.