- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
For configurable workspaces that use the "standard" record page --- e.g. "CSM default record page" for CSM/FSM Configurable Workspace; "SRP Record" for Service Operations Workspace --- the controller has the form.fields object which you access via api.data.record.form.fields. There does not appear to be any distinct event on the controller or the associated Form component that indicates when the form.fields object is available for use. My workaround was to handle the controller's "Record property changed" event checking for when form.fields was finally not undefined, then firing my own event so the page would know when it could be used. There HAS TO be another way to know that ServiceNow has fully loaded one of the more important client-side objects on the record page. Anyone have ideas?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Thx for the response @IronPotato but I had previously tried both of those and the form.fields object was still undefined. Only the Record property changed event seems to do the trick, although not an event triggered by the actual form.fields object being set.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @Jamie Stroud ,
the event you are looking for is "Record Data Fetch Succeeded" OR "Record Data Fetch Completed" on Form Controller. Add client script on both of these events and log the api.data.record.form.fields objects and observe which one will return the object first.
Please mark helpful if this helped you solve the issue.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Thx for the response @IronPotato but I had previously tried both of those and the form.fields object was still undefined. Only the Record property changed event seems to do the trick, although not an event triggered by the actual form.fields object being set.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Stupid question, but just in case....do you have the same client script on all 3 events? Meaning, are you sure you have the correct path to the form fields in that client script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
I just had a "Log Event" client script. Really basic; something to put a breakpoint in and check the status of api.data.record.form.fields. And in any event I handled to perform that check, only the Record Property Changed event would be fired at a point when form.fields was not undefined (i.e. ready to be used). I may check again on the events you mentioned, but I'm virtually 100% certain I already did.