is there and equivalent of "g_form.getElement('sysparm_item_guid').value" in the portal ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2021 01:36 AM
Looking to revise one of my old Client Scripts which depends on checking a record while the user is in a catalog item
In the old CMS I would use g_form.getElement('sysparm_item_guid').value which obviously fails in the Portal, but wondered if there is an equivalent I can use
I can see the Catalog Item is already assigned a new sys_id in the instance, but I cannot find how to access this Id from the portal.
Any ideas ?
TIA
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2021 03:04 AM
If you wish to have mandatory attachment check; please refer my blog and enhance
It works well in Native + Portal
Verify Mandatory Attachments Count on Catalog Item
If my blog helps please mark it helpful and also bookmark it
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
07-26-2021 03:42 AM
Hi Ankur
I have variations on the count and name check, but it is the content type that now needs to be addressed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2021 03:53 AM
so the file attachment extension is to be validated?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2021 04:02 AM
No, validation of extention (which I do via a regex) is not enough for the current client.
Most examples use the indexOf - so if I check for an xls extension, in most examples the following will match
a.file.xls.is.not.a.true.excel.file.txt
whereas, using a regex and the $ anchor ensures the file name has to end with xls
However, for the current client I need to validate the content type is what it says it is.
My CMS code does this, but I cannot get the sys_id to then go and look at the sys_attachment table
I have just looked through a PDI
The sys_id of the catalog item is "596fec022ffcf0103c345fd62799b635"
In the sys_attachment table I have
I cannot find the sys_id 9ff51bca2fe9bc503c345fd62799b610 anywhere in the instance - the sc_cart_item table is empty
I cannot see The sys_id of the catalog item is 596fec022ffcf0103c345fd62799b635 in the form either
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2021 04:12 AM
Hi,
okay you are using old CMS and not the portal
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader