Highlighted
Absent Member.. Absent Member..
Absent Member..
337 views

Import contacts from LDAP to SM without using Connect-it (Only operators created)

1 - The slapconfig must be configured with LDAP parameters. (Operators must be synchronized).

2- Search the library script (triggerContactsOperators) and locate the function syncContactToOperator.

3- add the lines in red bold, considering that you must place your company information among "".

function syncContactToOperator(IdRecord, record, oldrecord)

{

      var doSync = checkIfOperatorChanged(IdRecord, record, oldrecord);

     

      if (doSync)

      {

            var ConId = record.contact_name;

            var fContact = new SCFile("contacts");

            var rc = fContact.doSelect("contact.name=\""+ConId+"\"");

            if ( rc == RC_SUCCESS )      

            {

           

                  fContact.full_name = record.full_name;

                  fContact.email = record.email;

                  fContact.operator_id = record.name;

                  fContact.fax_phone = record.fax;

                                   

                  var ret = new Datum();

                  system.functions.rtecall("trigger", ret, 0);

                  var rc=fContact.doUpdate();                    

                  system.functions.rtecall("trigger", ret, 1);

                  if (rc==RC_SUCCESS)

                  {

                        themessage2=system.functions.scmsg(102, "ScriptLibrary", [fContact.contact_name]);

                        print(themessage2);

                  }

            }    

            else

            {

                  themessage2=system.functions.scmsg(103, "ScriptLibrary", [ConId]);

                  print(themessage2);          

            }

            //inicio

            //@wwwific

            print( "Creating new contact record..." );

            var tblOperator = new SCFile("operator");

            var lstOperator = tblOperator.doSelect("name=\""+IdRecord.name+"\"");

                  if (lstOperator == RC_SUCCESS){

                        var fname = tblOperator.full_name;

                        var ccname = tblOperator.contact_name;

                        var email = tblOperator.email;

                        var redname = tblOperator.name;

                  }

 

            //Create new contact

            var newContact = new SCFile("contacts");

            newContact.user_type = "";

            newContact.dept_name = "";

            newContact.dept = "";

            newContact.dept_id = "";

            newContact.corp_structure = "";

 

            newContact.contact_name = ccname;

            newContact.operator_id = redname;

            newContact.full_name = fname;

            newContact.email = email;

            var rc = newContact.doInsert();

                  if ( rc == RC_SUCCESS ){

                        print("user created and synchronized");

                        return newContact

                        }

                  else{

                        print( "Don't create the user " + RCtoString( rc ) );

                        return null

                  }

            }

}

 

Tags (1)
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.