Hi Thnak very much you two. I am not now at the office, so I will test it tomorrow and say you about the results.
Regards. 2012/10/25 Maxime Pelletier <[email protected]>: > Hi Juan, > > In case it can help, we use this to handle this situation: > > (typeof(dstBean)=='undefined') > > This obviously returns true when dstbean is not defined. So with that, we > only have a <forceValue> that handle create and update case. > > Regards, > > Maxime > > Clément OUDOT <[email protected]> a écrit : > > >> 2012/10/25 Juan Asensio Sánchez <[email protected]>: >>> Hi >>> >>> I think it would be like this: >>> >>> ======================================================= >>> >>> <defaultPolicy>FORCE</defaultPolicy> >>> >>> <conditions> >>> <changeId>false</changeId> >>> </conditions> >>> >>> <dataset> >>> <name>userAccountControl</name> >>> >>> <forceValues> >>> <string><![CDATA[js: >>> >>> var uac = dstBean.getDatasetFirstValueById('userAccountControl'); >>> >>> // Desactivación de la cuenta >>> if ( ( srcBean.getDatasetFirstValueById("nsAccountLock") != null ) && >>> ( >>> srcBean.getDatasetFirstValueById("nsAccountLock").equalsIgnoreCase("true") >>> ) ) { >>> // Comprobar y desactivar cuenta >>> if ( ! AD.userAccountControlCheck (uac, AD.UAC_ACCOUNTDISABLE) ) { >>> uac = AD.userAccountControlSet( uac, [AD.UAC_SET_ACCOUNTDISABLE] ); >>> } >>> } >>> else { >>> // Comprobar y activar cuenta >>> if ( AD.userAccountControlCheck (uac, AD.UAC_ACCOUNTDISABLE) ) { >>> uac = AD.userAccountControlSet( uac, [AD.UAC_UNSET_ACCOUNTDISABLE] ); >>> } >>> } >>> >>> // Devolver el valor modificado del atributo >>> uac; >>> >>> ]]></string> >>> </forceValues> >>> >>> <createValues> >>> <string><![CDATA[js: >>> >>> var uac = AD.userAccountControlSet( "0", [AD.UAC_SET_NORMAL_ACCOUNT] ) >>> >>> // Desactivación de la cuenta >>> if ( ( srcBean.getDatasetFirstValueById("nsAccountLock") != null ) && >>> ( >>> srcBean.getDatasetFirstValueById("nsAccountLock").equalsIgnoreCase("true") >>> ) ) { >>> // Comprobar y desactivar cuenta >>> if ( ! AD.userAccountControlCheck (uac, AD.UAC_ACCOUNTDISABLE) ) { >>> uac = AD.userAccountControlSet( uac, [AD.UAC_SET_ACCOUNTDISABLE] ); >>> } >>> } >>> else { >>> // Comprobar y activar cuenta >>> if ( AD.userAccountControlCheck (uac, AD.UAC_ACCOUNTDISABLE) ) { >>> uac = AD.userAccountControlSet( uac, [AD.UAC_UNSET_ACCOUNTDISABLE] ); >>> } >>> } >>> >>> // Devolver el valor modificado del atributo >>> uac; >>> >>> ]]></string> >>> </createValues> >>> >>> </dataset> >>> >>> ======================================================= >>> >>> But I am already getting the error: >>> >>> oct 25 12:46:56 - ERROR - javax.script.ScriptException: >>> sun.org.mozilla.javascript.internal.EcmaError: ReferenceError: >>> "dstBean" is not defined. (<Unknown source>#5) in <Unknown source> at >>> line number 5 >>> >>> As it looks is also executing the forceValues... >> >> Yes you are right, my mistake. So the only solution is to test >> dstBean. Are you sure that a test like if (dstBean == null) do not >> work? >> >> Clément. >> _______________________________________________________________ >> Ldap Synchronization Connector (LSC) - http://lsc-project.org >> >> lsc-users mailing list >> [email protected] >> http://lists.lsc-project.org/listinfo/lsc-users >> > > > _______________________________________________________________ > Ldap Synchronization Connector (LSC) - http://lsc-project.org > > lsc-users mailing list > [email protected] > http://lists.lsc-project.org/listinfo/lsc-users > _______________________________________________________________ Ldap Synchronization Connector (LSC) - http://lsc-project.org lsc-users mailing list [email protected] http://lists.lsc-project.org/listinfo/lsc-users

