Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

Create Advanced Script on User Criteria for locations

mkader
Kilo Guru

Hello,

I am trying to create an Advanced Script for User Criteria to make a content item available for certain locations. There are about 100 locations that the content item should be available for. Below is the script that I am using and is not working.

checkCondition();

function checkCondition() {
    var queryString = 'city=Sacramento^ORcity=Wichita';
    var gr = new GlideRecord('cmn_location');
        gr.addEncodedQuery(queryString);
        gr.query();
    if (gr.hasrNext()) {
        answer = true;
    } 
	
	return false;
}

Any idea on what I am doing wrong?

Thanks!

16 REPLIES 16

So I just found out that we are not using the location field. We use a custom field locations, which is a list collector since there can be multiple locations. The location number is referenced in the locations field. How can I script to pull information on a list collector?

mikereaves
Tera Expert

Has anyone ever successfully incorporated a field from the User Criteria form into the Advanced script???

I would like to "recurse" through the parents of the sys_user.department (gs.getUserID()) looking for the department record appearing on the user criteria record.

Can I use "current.[field name]" in the advanced script ?

If I find a match I'll return true, else false.<