- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi community, I have created a record producer where it has several fields and works perfectly when submitted from the portal, but when I tried submitting from native UI some fields are not getting cleared as expected.
There is field 'A' which is a select box of 3 options.
field 'B' which is a Y/N.
field 'C&D' which are select box, 'C' has 3 options and 'D' has 2 options.
I have script were based on user selection the values get populated. For example, in field 'A' if I select 2nd option and 'B' as 'yes', then 'C&D' gets populated. Similarly, if selected 'no', value gets cleared when submitted in portal; as per written in my onsubmit script.
But if I tried same scenario from native UI (Try It), when user selects 'B' as 'no', the values show up ('C&D' should get cleared up). It should get cleared as worked in portal. Is there anything like applies to catalog item, applies to request item same as catalog item for record producer? I have kept UI type as all and targeted record as true.
These fields are mapped on Short Description on Incident form.
Solved! Go to Solution.
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @sathwikc,
This is a classic Record Producer scripting difference between Service Portal and Native UI. Your onsubmit script is working in the portal but not clearing fields in Native UI because of script context and execution differences.
Native UI and Service Portal have different script execution contexts:
| Native UI | Service Portal |
| Synchronous client scripts | Asynchronous client scripts |
| g_form behaves differently | g_form + Angular context |
| Form submission happens faster | Form waits for script |
You have to tackle the situation by using a combination of onChange and onSubmit.
Hope this helps!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @sathwikc,
This is a classic Record Producer scripting difference between Service Portal and Native UI. Your onsubmit script is working in the portal but not clearing fields in Native UI because of script context and execution differences.
Native UI and Service Portal have different script execution contexts:
| Native UI | Service Portal |
| Synchronous client scripts | Asynchronous client scripts |
| g_form behaves differently | g_form + Angular context |
| Form submission happens faster | Form waits for script |
You have to tackle the situation by using a combination of onChange and onSubmit.
Hope this helps!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
So do I need to create scripts again for native UI, as I do have for onChange and onSubmit?
I have been testing it out like making inactive and active back the scripts. Works perfectly in portal, but not on native UI
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
did you debug the client script if alert came for native?
what debugging did you do?
share your script and config screenshot for client script
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Sorry that I can't share you the script, but after thorough testing, I got to know that there are some conflicts within my scripts and UI policies
