Dynamic Choice list items using JavaScript?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-22-2016 03:57 AM
I have noticed in the baseline that some Choice list items have javascript labels like:
javascript:"System (" + gs.getSysTimeZone() + ")"
My question is if it's possible to have JavaScript call a function in a script include the same way?
I cannot get this to work using the usual syntax:
javascript: new scriptInclude().getfunction();
I have tried different amalgamations of the two without any success.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-22-2016 04:29 AM
On the script include do you have "Client Callable" checked?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-22-2016 04:33 AM
Hello Alex, yes the Client callable checkbox is ticked.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-22-2016 04:33 AM
Hi Martin,
You can use either a function or a class.
For functions use:
javascript:myFunction(current)
and name your script include as myFunction with function myFunction(){}
or create a class
var myClass = Class.create();
myClass.prototype = {
test : function() {
gs.log("classTest");
},
type: "myClass"
}
call your script include as myClass and use it: javascript:new myClass().test()
Cheers
Greg
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-22-2016 04:39 AM
Hello Greg,
Yep the Script Include is coded ok, there's no issues with that. The issue is with the calling, I wanted to know if people have used this kind of concept then naming Choice list labels and values in the Choice List record.
There is an OOB javascript call in this syntax: javascript:"System (" + gs.getSysTimeZone() + ")"
That works well and I understand the syntax.
My one is something like this: javascript: new scriptInclude().functionName()
or
javascript:'System (' + new scriptInclude().functionName() + ')'
and it's not working.