- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2014 07:23 PM
I have an OU call consultant that we store consultant ad accounts in. I have also created a Consultant true/false field on the sys_user table. I am trying to mark the consultant field to true when the source field contains OU=Consultant. I have crated this business rule to make the change.
Before
insert/update
var target = new GlideRecord("sys_user");
target.addQuery("consultant","CONTAINS","OU=Consultant");
target.query();
while (target.next()){
target.consultant = "true";
target.update();
}
Am I missing something?
Solved! Go to Solution.
- Labels:
-
Service Mapping
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-14-2014 08:51 AM
I forgot to wrap it in a function.
checkConsultant();
function checkConsultant(){
if(current.u_consultant)
return;
if(!current.u_consultant)
current.u_consultant = true;
}
That error goes away. However I would *really* suggest taking care of this in the LDAP transform map if at all possible.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-14-2014 09:17 AM
This BR is only going to touch records that have been created or updated. If nothing is changing from the LDAP side, then they won't update. That's why this should be addressed on the ldap transform map. It will take care of existing and new records.