- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-18-2020 04:55 AM
Hi All,
I have found an issue on portal, we have a record producer created in Global scope which is available on portal. Now we are using Security Operations. So this record producer is available to Create Security Incidents.
On record producer We have a variable type 'Date/time' and it is not mapped to to any field on security incident table.
So now we have a onSubmit client script where we are using Ajax.Complete to prompt the form submission when the future date is selected. Now due to use of ajax.complete, the form requires double click to submit the form. The first click does not work.
It is a cross scoping, and xmlWait does not work on portal, i even read setAbortAction does not work too.
How do i fix this issue.
Please help me
Thank You!
Best Regards,
Manisha
Solved! Go to Solution.
- Labels:
-
Security Incident Response
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-18-2020 08:16 PM
Basically one thing you can do from client script is
1) if the validation fails then clear the date and make it mandatory
So this will allow user to select valid date and then only form will get submitted.
In case that date variable is not mandatory then you can take below approach
Create a string variable and hide it on form load
Based on your validation from onChange client script set this hidden variable with value as allowed or not allowed
Then in onSubmit client script check this hidden variable value
function onSubmit(){
if(g_form.getValue('hidden_variable') == 'not allowed'){
alert('You are not allowed to submit');
return false;
}
}
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
‎11-18-2020 05:07 AM
Hi,
getXMLWait() is not supported in portal.
Please share what are you trying to perform
I would recommend to push the validation of date on the change of variable.
Also to stop form submission in case validation fails create hidden variable to set whether form is allowed to submit based on what your onchange script determines
Then use that hidden variable in onSubmit client script to check if user is allowed to submit or not
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
‎11-18-2020 09:20 AM
Hi Ankur,
Thank You, so what i need is... that my user should not be able to select any date after today.
it can only be today or may be before today. if they select future date then the form should not be submitted or may be the date field should get cleared out and form should not be submitted.
we had a onchange client script using async ajax call. that was working partially and the user was still able to submit the form even when the date was selected for future.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-18-2020 08:16 PM
Basically one thing you can do from client script is
1) if the validation fails then clear the date and make it mandatory
So this will allow user to select valid date and then only form will get submitted.
In case that date variable is not mandatory then you can take below approach
Create a string variable and hide it on form load
Based on your validation from onChange client script set this hidden variable with value as allowed or not allowed
Then in onSubmit client script check this hidden variable value
function onSubmit(){
if(g_form.getValue('hidden_variable') == 'not allowed'){
alert('You are not allowed to submit');
return false;
}
}
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
‎11-19-2020 01:47 AM
Hi Ankur,
Thank You!
The field is already 'Mandatory' we can clear it that works, for UI 16 i can make the user to select the right date the then only he can submit it. But this catalog client script is not serving it's purpose only in Portal.
So I went with your other option to create a hidden variable.
It worked 🙂 🙂
Thank You!