Function getUser is not allowed in scope sn_sc

jamesmcwhinney
Giga Guru

We have a basic record producer that creates incidents.   It has worked fine in CMS.

We are currently working on upgrading from Helsinki Patch 11b to Jakarta patch 4 and transitioning from CMS to Service Portal at the same time.

What we have found is that our record producer still works fine in CMS, but in Service Portal, it generates the below error:

"Function getUser is not allowed in scope sn_sc".

83FEC1E8.PNG

Anyone ever seen anything like this before?

I have no catalog client scripts associated with this record producer.

Thanks,

- James

1 ACCEPTED SOLUTION

jamesmcwhinney
Giga Guru

Found it,.. inside the record producer, there was an associated template "New Incident" which defaulted certain fields of the generated incident.


I was setting the location to "javascript:gs.getUser().getLocation()";



Once I removed this the error dissapeared.


Seems like service portal somehow doesnt support this while CMS does.


View solution in original post

7 REPLIES 7

Brent Sutton
Mega Sage

Hi James, can you please post the code that is associated with the record producer? There may be something in there using gs.getUser() that is no longer supported.



You may also want to review any variables that map to sys_user reference fields i.e. caller_id. We have our caller_id field default to the person logged in using: -



javascript:gs.getUserID()



This works fine with Service Portal in Helsinki. Any additional information you can provide would be useful.


jamesmcwhinney
Giga Guru

Found it,.. inside the record producer, there was an associated template "New Incident" which defaulted certain fields of the generated incident.


I was setting the location to "javascript:gs.getUser().getLocation()";



Once I removed this the error dissapeared.


Seems like service portal somehow doesnt support this while CMS does.


As an FYI - the OOTB 'Report an Issue' from Istanbul uses the code below in the 'script' window - not sure if this will help guide to get you what you need instead?



current.caller_id = gs.getUserID();


current.contact_type = "self-service";


current.impact = 2;


current.urgency = 2;


current.priority = 3;


if (!JSUtil.nil(producer.comments))


current.description = producer.comments;


else


current.description = producer.short_description;


gs.addInfoMessage("Thank you - we'll take a look and see what we can do to help");