JavaScript error in your browser console - g_form.getParameter is not a function

mosowski1988
Tera Contributor

Hello,

I have an error when using Portal, there is a onLoad Catalog Client Script with beginning:

var catalog_item_sys_id = g_form.getParameter("sysparm_id");

It work perfectly outside the Portal (using Try it or from Catalog) but in Portal I receive an error when item is opening:

There is JavaScript error in your browser console and details in the console says:

Error while running Client Script "Get Details2": TypeError: g_form.getParameter is not a function

It happens on the DEV instance (Jakarta).

It was working ok, but suddenly it stopped and I receive this error.

Can you help me?

6 REPLIES 6

Shishir Srivast
Mega Sage

is this code on your client script? if yes, this will not work, what value are you trying to fetch?



var catalog_item_sys_id = g_form.getParameter("sysparm_id");


Harsh Vardhan
Giga Patron

it will not work.


please refer the thread below.



Re: g_form.getParameter


Chandu Telu
Tera Guru
Tera Guru

britwill
ServiceNow Employee
ServiceNow Employee

Hi mosowski1988-

Unfortunately the issue is central to Service Portal as it no longer recognizes the following methods under the g_form class (**):

Methods Not recognized via Service Portal under g_form

  • addDecoration(fieldName, icon, title)
  • addErrorMessage(message)
  • addInfoMessage(message)
  • addOption(fieldName, value, label, index)
  • clearMessages()
  • clearOptions(fieldName)
  • clearValue(fieldName)
  • getActionName()
  • getBooleanValue(fieldName)
  • getDecimalValue(fieldName)
  • getEncodedRecord()
  • getFieldNames()
  • getIntValue(fieldName)
  • getLabel(fieldName)
  • getParameter() **
  • getReference(fieldName, callback)
  • getRelatedListNames()
  • getSectionNames()
  • getSysId()
  • getTableName()
  • getValue(fieldName)
  • hasField(fieldName)
  • hideAllFieldMsgs(type: "info | error")
  • hideErrorBox(fieldName)
  • hideFieldMsg(fieldName, clearAll)
  • hideRelatedList(listTableName)
  • hideRelatedLists()
  • isMandatory(fieldName)
  • isNewRecord()
  • isReadOnly(fieldName)
  • isVisible(fieldName)
  • removeDecoration(fieldName, icon, title)
  • removeOption(fieldName, value)
  • save()
  • serialize(onlyDirtyFields)
  • setFieldPlaceholder(fieldName, placeholder)
  • setLabel(fieldName, label)
  • setMandatory(fieldName, isMandatory)
  • setReadOnly(fieldName, isReadOnly)
  • setSectionDisplay(sectionName, isVisible)
  • setValue(fieldName, value, displayValue)
  • setVisible(fieldName, isVisible)
  • showErrorBox(fieldName, message, scrollForm)
  • showFieldMsg(fieldName, message, type: "info | error", scrollForm)
  • showRelatedList(relatedTableName)
  • showRelatedLists()
  • submit(submitActionName)

Hope this helps.

Regards,

Brit