Best practice forum (Archived)

Auto assignment rules for audiences?

 
Matthew Lee
Auto assignment rules for audiences?
by Matthew Lee - Thursday, 14 March 2013, 1:09 PM
 

Hello everyone

We are trying to set up the rules in audiences that allow you to dynamically assign new users to the audience based on a rule. We essentially set up a rule that says if custom profile filed X equals X then assign to this audience. However, we can't get the system to add anyone to the audience. We've tried adding new users and editing existing ones. Is this rule system tied to a custom cron job we need to set up? Is there an admin setting somewhere that needs to be turned on? Any help would be appreciated.

thanks

Matt

me
Re: Auto assignment rules for audiences?
by George Angus - Thursday, 14 March 2013, 1:45 PM
Group Totara

Hi Matt,

This isnt tied to cron, can you give me more details?

regards,

George.

Matthew Lee
Re: Auto assignment rules for audiences?
by Matthew Lee - Thursday, 14 March 2013, 2:00 PM
 

I'm not sure what additional information you are looking for? We have set up a rule tied to a custom profile field. When a user is created, this custom profile field is required. There are two selections in it. If one of them is selected, it is supposed to then automatically add that person to the audience. The audience is then enrolled in a program. We are adding users and selecting filling the custom field with the desired selection but no one gets added to the audience. We have tried updating existing users and we have added new users. The site is currently in maintenance mode so users are not able to create their own accounts, which is the one method we have not tried. Could that be it? Do users have to create their own accounts for this type of rule to be triggered? If so, is there a work around to that? This customer will never have anyone creating their own accounts.

thanks

Matt

me
Re: Auto assignment rules for audiences?
by George Angus - Thursday, 14 March 2013, 2:27 PM
Group Totara

Hi Matt,

The reason I asked was I created a custom text field to test it and it worked immediately, so I wonder if there is an issue with populating the custom field?

cheers,

George.

Matthew Lee
Re: Auto assignment rules for audiences?
by Matthew Lee - Thursday, 14 March 2013, 2:40 PM
 

Our text field is a picklist. Does it need to be just a plain text field? I created another rule tied to email address. It says email "equals" X and then a created a user with that email address. After about 20 minutes, the user was added to the audience and consequently added to the program. It would seem that it is tied to a cron?

Matt

me
Re: Auto assignment rules for audiences?
by George Angus - Thursday, 14 March 2013, 2:53 PM
Group Totara

Hi Matt,

My understanding is once you hit "save" on the rule it should work immediately. Have you tried changing "is equal" to "not equal" in the rule to see what it does? Could you send me screenshots? Also - are you sure youve approved the critera changes in the ruleset?

G.

Matthew Lee
Re: Auto assignment rules for audiences?
by Matthew Lee - Friday, 15 March 2013, 11:20 AM
 

Hi George

First off, thank you for the notes here. We figured out the issue so I wanted to provide you wilh some notes. Here is what my developer discovered.

--------

Ok I did some looking through there code and I figured out the problem.
It's checking for lowercase text matches, which doesn't work on picklists. You may notice if you add a rule for a text field, it saves it as lower case (no matter what you type in). But if you add a rule for a picklist, it doesn't alter the case. 
The database query it uses when running the rules checks for lowercase data on a user.
So basically, it's looking for: lowercase(userdata) = 'Vidyo Partner Sales Certification Program'
Which of course would never happen since the string has uppercase letters.
To verify I created another program that is all lowercase, and that one worked.
So Totara will need to modify the code to either save the rules text string in lowercase, or to not use the lower() function in the SQL query when checking picklist values. I'm thinking that they should probably just not use lower() because I'm pretty sure Moodle would consider "Test" and "test" to be 2 different strings (case sensitive), so Totara should also be observing case in those situations.
---------
I'm not sure how to submit this to the Totara development team. Can you point me in the right direction?
thanks
Matt
me
Re: Auto assignment rules for audiences?
by George Angus - Sunday, 17 March 2013, 1:41 PM
Group Totara

Hi Matt,

Thanks for your contribution! I shall pass this on to the devs & raise a bug report. Could you tell me what version you are on?

many thanks,

George.