- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2015 06:36 AM
Hi everyone,
I'm working on creating an organization table that will have a reference to parent organizations. My concern is that when I create or change an organization, it should not be able to find a parent organization where the parent organization is already a child organization. For example, Company 1(child) has a parent of Company 2. If I go back to Company 2 and select the Parent Organization reference field, I don't want to see Company 1 in that list because its already a child of Company 2.
I was looking around the reference qualifiers and didn't see anything that could help me. Any help in the right direction would be great, thanks!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-27-2015 10:25 AM
your code should look like that
var CompanyList = Class.create(); CompanyList.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getCompanyList: function(CurrSysID)
{
var CompanyList= "";
var gr = new GlideRecord("x_mpaii_snap_trace_organizations");
gr.addEncodedQuery("sys_id!=" + CurrSysID + "^parent_organization!=" + CurrSysID);
gr.query();
while(gr.next())
{
CompanyList += gr.sys_id + ",";
}
return "sys_idIN" + CompanyList;
},
type: 'CompanyList' });
test out this code and let me know whether it works or no
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2015 09:40 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2015 11:25 AM
Ahmed,
Thanks for getting back to me! I made the script include and the reference specification changes but I don't believe it is working. I did change the GlideRecord parameter from "core_company" to my table name but everything else is the same. I tried to debug it as well, but it doesn't seem to be hittiing any breakpoints. Is there something else I could look into? Thank you again!
Eric
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2015 11:32 AM
Can you please provide snapshot for your code?
make sure that your element if you are not working with core_company table has the right name so please change everything according to your table 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-27-2015 05:59 AM
Hi Ahmed,
Here is a screenshot of my script include with my table name in it.
Here is a screenshot of the dictionary entry for the parent organization
As a sidenote, I tried to debug it and it got to the point in the script include where it was establishing a new GlideRecord, and went back to the reference qualifier.