The CreatorCon Call for Content is officially open! Get started here.

g_form.getParameter("sysparm_item_guid"); is not working on service portal

ArcRaj
Giga Contributor

Hi all,

g_form.getParameter("sysparm_item_guid"); is not working  on service portal  AND

g_form.getUniqueValue() is also not working

is there any alternate way.

 

 

1 ACCEPTED SOLUTION

Harsh Vardhan
Giga Patron

in newyork its available , without writing a single code. 

 

find_real_file.png

 

Give a try. 

View solution in original post

13 REPLIES 13

Harsh Vardhan
Giga Patron

g_form.getUniqueValue() should work. 

 

make sure UI type set as ALL. can you add screenshot. 

also try to add alert(g_form.getUniqueValue()), let me know what are you getting ?

Mark Roethof
Tera Patron
Tera Patron

Hi there,

Could you explain your requirement? Is this for example for new records on the Service Portal, for example when submitting a Catalog Item. Or is this for when viewing existing records? And is it the sys_id of the new record to create, or the sys_id of the Catalog Item?

g_form.getParameter("sysparm_item_guid"); is indeed not available.

For new... g_form.getUniqueValue() indeed doesn't work. Or it does give you a value, though maybe not what you expect? I mean... what is the value you expect?
sys_id of that new record? Or sys_id of that Catalog Item? You will only get your hands on the sys_id of the Catalog Item, not of the new record.

If my answer helped you in any way, please then mark it as helpful.

Kind regards,
Mark
2020 ServiceNow Community MVP
2020 ServiceNow Developer MVP

---

LinkedIn
Community article list

 

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

My requirement is to make attachment mandatory on catalog item in service portal

when i use g_form.getParameter(sysparm_item_guid) its giving the sys_id of item which matches with table_sys_id field on sys_attachment table.(on console)

getUniquevalue() is working on portal and console as well,but value returned is giving item sys_id which doesnot matches with table_sys_id on sys_attachment table.

If it's only about mandatory, read this article I wrote a while back:

Service Portal Catalog Items: Hide Attachment / Mandatory Attachment [Madrid]

If my answer helped you in any way, please then mark it as helpful.

Kind regards,
Mark
2020 ServiceNow Community MVP
2020 ServiceNow Developer MVP

---

LinkedIn
Community article list

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn