Yes. I had put my script in the same place than my lsc.xml : /etc/lsc/supanntoad/accountexpirationdate.js
and i had modified my lsc.xml like this : <?xml version="1.0" ?> <lsc xmlns="http://lsc-project.org/XSD/lsc-core-2.1.xsd" revision="0 »> …. <tasks> <task> …. <dataset> <name>accountExpires</name> <policy>FORCE</policy> <forceValues> <string><![CDATA[js:AD.getAccountExpires(return_maxleavingdate(srcBean.getDatasetFirstValueById("description")),"yyyyMMdd")]]></string> </forceValues> </dataset> </propertiesBasedSyncOptions> <scriptInclude> <string>supann2ad/accountexpirationdate.js</string> </scriptInclude> </task> </tasks> </lsc> here is my script accountexpirationdate.js, that i test it whtih succes with array input with test data : function grep_leavingdate (description) { var patterndepart = /{LEAVINGDATE}(.*)/; var trouve = description.match(patterndepart); if (trouve !== null ) return trouve[1]; } function return_maxleavingdate(description) { var descriptionfiltreDatesDeparts = description.filter (grep_leavingdate); var DatesDepart = descriptionfiltreDatesDeparts.map(grep_leavingdate); var DateDepartMax = Math.max(...DatesDepart); return DateDepartMax; } -- Pour toute demande de support informatique : [email protected]<mailto:[email protected]> Pour une assistance à distance : cliquez ici --- Vincent Lepetit Administrateur Systèmes, Réseaux et Télécom Tel : +33 176 218 318 Mob : +33 634 422 573 Paris Sciences et Lettres 60 rue mazarine Paris, 75006 http://www.univ-psl.fr Le 1 févr. 2018 à 13:01, Soisik Froger <[email protected]<mailto:[email protected]>> a écrit : On 01/02/2018 12:32, Vincent LEPETIT wrote: Hi, I had write a javascript to make a process in one of my dataset. I had followed this page to declare my script in lsc.xml : https://lsc-project.org/documentation/latest/scripting/start my function name : return_maxleavingdate This function work on « description » source ldap attribute And i call my function like this : <dataset> <name>accountExpires</name> <policy>FORCE</policy> <forceValues> <string>js:AD.getAccountExpires(return_maxleavingdate(srcBean.getDatasetFirstValueById("description")),"yyyyMMdd")</string> </forceValues> </dataset> or like this : <dataset> <name>accountExpires</name> <policy>FORCE</policy> <forceValues> <string><![CDATA[js:AD.getAccountExpires(return_maxleavingdate(srcBean.getDatasetFirstValueById("description")),"yyyyMMdd")]]></string> </forceValues> </dataset> but when i call my function i had this error messages : févr. 01 12:24:43 - ERROR - Fail to compute expression: AD.getAccountExpires(return_maxleavingdate(srcBean.getDatasetFirstValueById("description")),"yyyyMMdd") on id=uid=utest002,ou=people,dc=univ-psl,dc=fr Reason: javax.script.ScriptException: sun.org.mozilla.javascript.EcmaError: ReferenceError: "return_maxleavingdate" n'est pas défini (<Unknown source>#5) in <Unknown source> at line number 5 févr. 01 12:24:43 - ERROR - Error while synchronizing ID {uid=utest002}: org.lsc.exception.LscServiceException: javax.script.ScriptException: sun.org.mozilla.javascript.EcmaError: ReferenceError: "return_maxleavingdate" n'est pas défini (<Unknown source>#5) in <Unknown source> at line number 5 Could you tell me what is wrong ? Your function is not found by LSC. Did you declare it, place it at the right location, and make sure it has no syntax error? Could you send us the code? -- Soisik _______________________________________________________________ Ldap Synchronization Connector (LSC) - http://lsc-project.org lsc-users mailing list [email protected] https://lists.lsc-project.org/cgi-bin/mailman/listinfo/lsc-users
_______________________________________________________________ Ldap Synchronization Connector (LSC) - http://lsc-project.org lsc-users mailing list [email protected] https://lists.lsc-project.org/cgi-bin/mailman/listinfo/lsc-users

