Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

Widget clone - Could not save record because of a compile error

larsbowassini
Kilo Expert

I have made a clone of the "SC Categories" widget, but I can't save it because of an error in a part of the script I haven't changed. It's in the Client controller field:

find_real_file.png

I get the error "Missing name in function declaration" - but the original widget uses this code - so what can I do?

1 ACCEPTED SOLUTION

Arnoud Kooi
ServiceNow Employee

If you scroll down and click on the UI Action: "Open in Widget Editor"



find_real_file.png




You will be able to save it in the new window that opens.



find_real_file.png


View solution in original post

8 REPLIES 8

ColeM
Mega Sage

I was able to get rid of the error by adding 

api.controller = 

before the function 

api.controller = function() {
}

 

GalSh
Tera Contributor

Hi , 

After cloning the widget :

at the client section add this : "api.controller=" at the beginning : 

api.controller=function ($scope, spUtil, $rootScope...) {}
 
in the link section add the name "link" to the function :
function link(..){
}

GalSh
Tera Contributor

change client and link section to this : 


FSTA
Kilo Sage

It's 2026 now, and ServiceNow did not use the last DECADE to fix this.