- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-09-2020 11:19 PM
g_form.getControl('order_now_button').click(); is not working on me. Can you give me an alternative. g_form.submit is working for portal but not for catalog item CMS. I want some alternative of g_form.submit which works in both.
Here is the callback function. Please help
function HelloWorldParse(response) {
if(ans1 =="success")
{
g_form.setValue('check_flag', 'true');
g_form.submit();
}
else{
alert("No field values have changed");
g_form.clearValue('application_name');
g_form.clearValue('type_of_operation');
return false;
}
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-10-2020 03:19 AM
Isolate script = false will allow DOM to work in native.
Keep it false as you have already kept it
Try this and it should work fine for native
if(ans1 =="success")
{
g_form.setValue('check_flag', 'true');
if(window == null){
// portal
g_form.submit();
}
else{
// native
$j("#oi_order_now_button").trigger('click'); // for catalog item
$j("#submit_button").trigger('click'); // for record producer
}
}
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-10-2020 03:09 AM
I am expecting Order Now in the CMS view as same as Service Portal. g_form.submit() function is allowing this to happen in Service Portal but not in CMS portal.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-10-2020 03:27 AM
please check my latest comment
that should help you
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-10-2020 12:20 AM
It is not working. In both cases, it is going into the window==null loop.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-10-2020 01:29 AM
Can you help knowing what does this CMS portal means?
please share screenshot of CMS portal view and the Service Portal view
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-10-2020 03:06 AM
Hi Ankur,
CSM means when I am using TryIt on the catalog item and filling form and submit.
Service Portal means when I am trying to submit the form through Service Portal.
Well I have just a field in Catalog client script, Isolate script to false. After that your script seems to be partially working. It is identifying whe...
if(ans1 =="success")
{
g_form.setValue('check_flag', 'true');
if(window == null){
// portal
g_form.submit();
}
else{
g_form.orderNow();
}
}