$rootScope not defined in UI script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-21-2025 09:28 AM - edited ‎01-22-2025 06:57 AM
So I have a UI script that sets a variable on a Record Producer. The value of that variable needs to be broadcasted to another widget. However, Im getting a "$rootScope is not defined" error. I had a similar error with g_form but added a few lines per this post:
So Im thinking I need to do the same for $rootScope.$broadcast but I dont know what to import.
I do see some OOTB UI Scripts use $rootScope.$broadcast but Im not sure what to extract from them.
Thoughts?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-21-2025 09:36 AM
Can you provide some more information:
- What variable does the UI script set on the record producer (and how)?
- Is the widget that receives the broadcast located on the same record producer?
- Why does the widget that receives the broadcast need the variable value?
I think there is another way to achieve what you're trying to do, with less complexity.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-22-2025 06:49 AM - edited ‎01-22-2025 06:58 AM
Hello!
1) It's just a custom variable that stores a response from another page. The UI script handles the user interaction, then calls g_form.setValue() to update this variable.
2) The widget receiving the broadcast is on the same Page, not in the record producer. Sorry, should have made it clear this is on the Portal and a page has the OOTB SC Catalog Item widget.
3) To display something per requirements.
My issue is that Im getting an error of "$rootScope is not defined" in my UI script. I had this same issue with g_form until I had to add a couple lines which seems to import it.
Modifying my original post for clarity.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-22-2025 09:43 AM
I've actually never used a UI Script before. An alternative would be to use GlideAjax and a client script and then broadcast from there. I would also recommend asking ChatGPT for an idea; it's typically very good at filling in the blanks.