The CreatorCon Call for Content is officially open! Get started here.

Need assistance with script Include

Community Alums
Not applicable

Hi All,

 

I have below script include which I want to use in two different reference qualifier. It is not working, Can anyone help me out what's wrong in below script include.

var GetDepList = Class.create();
GetDepList.prototype = {
    initialize: function(organizationLevel) {
        this.organizationLevel = organizationLevel;
    },
    returnDepQuery: function() {
        var filterString = "";
        if (this.organizationLevel) {
            filterString = 'parent=' + this.organizationLevel + '^u_active=true^correlation_idISNOTEMPTY';
        } else {
            filterString = 'u_active=true^correlation_idISNOTEMPTY';
        }
        return filterString;
    },

    type: 'GetDepList'
};

// for  (level_2_organization)
var depLevel2 = new GetDepList(current.variables.level_1_organization);
// Reference qulif I used:   javascript:depLevel2.returnDepQuery();

//for  (level_3_organization)
var depLevel3 = new GetDepList(current.variables.level_2_organization);
//Reference qulif I used:   javascript:depLevel3.returnDepQuery();

 

1 ACCEPTED SOLUTION

Hi @Community Alums,

 

Use the reference qualifiers as provided below.

 

If you run into an issue, please let me know.

var GetDepList = Class.create();
GetDepList.prototype = {
    initialize: function(organizationLevel) {
        this.organizationLevel = organizationLevel;
    },
    returnDepQuery: function() {
        var filterString = "";
        if (this.organizationLevel) {
            filterString = 'parent=' + this.organizationLevel + '^u_active=true^correlation_idISNOTEMPTY';
        } else {
            filterString = 'u_active=true^correlation_idISNOTEMPTY';
        }
        return filterString;
    },

    type: 'GetDepList'
};
//for  (level_1_organization)
//Reference qulif I used:   javascript: new GetDepList(current.variables.level_1_organization).returnDepQuery();

// for  (level_2_organization)
// Reference qulif I used:   javascript: new GetDepList(false).returnDepQuery();

//for  (level_3_organization)
//Reference qulif I used:   javascript: new GetDepList(current.variables.level_2_organization).returnDepQuery();

Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.

View solution in original post

3 REPLIES 3

Peter Bodelier
Giga Sage

Hi @Community Alums 

 

Can you please elaborate some more about your requirements, and what is exactly not working.

To get you started, I corrected some points in your script.

 

var GetDepList = Class.create();
GetDepList.prototype = {
    initialize: function(organizationLevel) {
        this.organizationLevel = organizationLevel;
    },
    returnDepQuery: function() {
        var filterString = "";
        if (this.organizationLevel) {
            filterString = 'parent=' + this.organizationLevel + '^u_active=true^correlation_idISNOTEMPTY';
        } else {
            filterString = 'u_active=true^correlation_idISNOTEMPTY';
        }
        return filterString;
    },

    type: 'GetDepList'
};

// for  (level_2_organization)
// Reference qulif I used:   javascript: new GetDepList (false).returnDepQuery();

//for  (level_3_organization)
//Reference qulif I used:   javascript: new GetDepList (current.variables.level_2_organization).returnDepQuery();

Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.

Community Alums
Not applicable

Hi @Peter Bodelier ,

I have two different script include both's are working fine, so I want to merge them into one

1st Script include

 

 

var GetDepList = Class.create();
GetDepList.prototype = {
    initialize: function() {},

    returnDepQuery: function() {
        newValue = current.variables.level_2_organization;
        var filterString = "";
		
        if (newValue)
            filterString = 'parent=' + current.variables.level_2_organization + '^u_active=true^correlation_idISNOTEMPTY';
		
        else if (newValue == "")
            filterString = 'u_active=true^correlation_idISNOTEMPTY';
        return filterString;
    },
    type: 'GetDepList'
};

//In reference qualifier of the variable put javascript;new GetDepList().returnDepQuery();

 

 

2nd script Include

 

 

var GetDepList1= Class.create();
GetDepList1.prototype = {
    initialize: function() {
    },

    returnDepQuery: function() {
        newValue = current.variables.level_1_organization;
        var filterString = "";
		
        if (newValue)
            filterString = 'parent=' + current.variables.level_1_organization + '^u_active=true^correlation_idISNOTEMPTY';
		
        else if (newValue == "")
            filterString = 'u_active=true^correlation_idISNOTEMPTY';
        return filterString;
    },
    type: 'GetDepList1'
};

//In reference qualifier of the variable put javascript;new GetUserList1().returnDepQuery();

 

 

 

Hi @Community Alums,

 

Use the reference qualifiers as provided below.

 

If you run into an issue, please let me know.

var GetDepList = Class.create();
GetDepList.prototype = {
    initialize: function(organizationLevel) {
        this.organizationLevel = organizationLevel;
    },
    returnDepQuery: function() {
        var filterString = "";
        if (this.organizationLevel) {
            filterString = 'parent=' + this.organizationLevel + '^u_active=true^correlation_idISNOTEMPTY';
        } else {
            filterString = 'u_active=true^correlation_idISNOTEMPTY';
        }
        return filterString;
    },

    type: 'GetDepList'
};
//for  (level_1_organization)
//Reference qulif I used:   javascript: new GetDepList(current.variables.level_1_organization).returnDepQuery();

// for  (level_2_organization)
// Reference qulif I used:   javascript: new GetDepList(false).returnDepQuery();

//for  (level_3_organization)
//Reference qulif I used:   javascript: new GetDepList(current.variables.level_2_organization).returnDepQuery();

Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.