Call a script include from dictionary entry?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2019 08:59 AM
I have a field that when I click it, I only want to see certain options dependant on if another field is populated or not. If it is populated, I want to use the populated data to determine what is going to happen with my first field. That's the overview.
To start off I'm simply trying to right click on the field, click dictionary, then use Advanced to call a script include...
It currently looks like "javascript: new nameOfScriptInclude().nameOfFuncInScriptInclude();" but my script include doesn't run. I'm guessing it's one of two things, either the way I'm calling the script include or the code in my script include, which at this moment in time is as simple as...
'client callable' is ticked;
nameOfFuncInScriptInclude: function() {
var gr = new Gliderecord('a table');
gr.addQuery('status', 'active');
return gr;
}
I was expecting when this was called that I would only see the results in the field that are active but I still see everything.
This is the first script include I've done and I feel like I've read every article out there but I'm non the wiser. Can anyone help please?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2019 09:01 AM
Just to add, is it the fact that I'm using GlideRecord? (I have capitalised it in my code) Should I be using something else?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2019 09:26 AM
Just as a thought. Why not make field dependant
May be we are missing query() and next() functions?
nameOfFuncInScriptInclude: function() {
var gr = new Gliderecord('a table');
gr.addQuery('status', 'active');
gr.query();
if(gr.next()){
return gr;
}
}
Please mark my response as correct and helpful if it helped solved your question.
-Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2019 09:48 AM
Hi,
1st of all try replacing
from: "javascript: new nameOfScriptInclude().nameOfFuncInScriptInclude();"
to: "javascript: (new nameOfScriptInclude()).nameOfFuncInScriptInclude(current);"
2nd: you not doing any query in your script - your script should look ore like this:
nameOfFuncInScriptInclude: function(grRecord) {
var gr = new GlideRecord('a table'); // Glide and Record should start from capital letter
gr.addQuery('status', 'active');
gr.addQuery('priority',grRecord.priority); // you need to use values of your record - do you?
gr.query(); // you missing this line !!!!!!!!!!!!!!!!!!!!!!!!!!!!!1
return gr;
}
3rd: In your case the field will change options only after UPDATE operation - not user-interactive. However may be it is something you looking for. In other hand - if you want this script to be interactive based on user's action on a form - you need combination of Client Script and GlideAjax