I'm still trying to 'connect the dots' in my understanding of the javascript Create and Validate rule scripts. Specifically, can 'out of context' data be queried? Or maybe there is another way to accomplish my task?
In a case workflow, I need to filter the 'Assigned To User' SSA to display only users in team 'Regulatory'. My approach is to, 1) Get the chan_channelid of the channel where the chan_description = Regulatory. 2) Iterate the channel_link table to get the user Id's linked to the channelId. 3) Use RemoveLookUp() to remove the users from the selection list who are not on the team.
Starting with the first step to query the channel table, I get 'Channel Id is undefined' result from my simple debug Create script:
var channel = CRM.FindRecord("channel","chan_description='Regulatory'");
valid = false;
ErrorStr = "Channel Id is " + channel.chan_channelid;
I've tried different filters (second param in FindRecord), with and without quotations.
What am I missing?