- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2018 11:48 PM
Hi,
I'm trying to get the fields for any table.
The following code snippet works for incident but not for pm_project.
Any help is appreciated.
var gr = new GlideRecord("incident"); gr.query(); var fields = gr.getFields(); gs.print(fields.size());
Regards
Yusuf
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2018 01:53 AM
Hi all,
Somehow I need to do the next().
incident doesn't require but pm_project or some other tables do.
var gr = new GlideRecord("pm_project"); gr.query();gr.next(); //Works this time var fields = gr.getFields(); gs.print(fields.size());
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2018 11:55 PM
Good Morning Yusuf,
Simply use the correct table's name and for the projects records.
If you are not familiar with the exact table -> then, open such record > check its table > use it in your GlideRecord query.
Best Regards,
Georgi Mavrodiev
IT Consultant
Do IT Wise Bulgaria
You may visit us in our Web Site: www.doitwise.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2018 12:25 AM
Hi Yusuf,
I tried the below snippet :
var gr = new GlideRecord("pm_project");
gr.query();
var fields = gr.getFields();
gs.print(fields.size());
It returned me
*** Script: 154
Or you can try the below code:
var gr = new GlideRecord('pm_project');
gr.query();
gr.next();
var gRU = new GlideRecordUtil();
var fieldList = gRU.getFields(gr);
gs.print(fieldList);
I got below answer :
*** Script: sys_id,parent,shadow,watch_list,phase_type,wbs,upon_reject,sys_updated_on,discount_rate,time_card_preference,rollup,approval_history,skills,score,number
Please do mark this helpful/correct if it answered your question.
Regards,
Swathi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2018 01:50 AM
Hi Swathi,
It is exactly same as my code snippet.
Unfortunately, it returns 0.
I am trying to find out the reason may be there is a SN parameter needs to be turned on or off.
Regards
Yusuf
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2018 01:53 AM
Hi all,
Somehow I need to do the next().
incident doesn't require but pm_project or some other tables do.
var gr = new GlideRecord("pm_project"); gr.query();gr.next(); //Works this time var fields = gr.getFields(); gs.print(fields.size());