Siebel Tools >  How to lock and unlock a Project or Business Component with eScript

How to lock and unlock a Project or Business Component with eScript It is fairly easy - we must use Business Object = Repository Project, Business Component = Repository Project and update Field Locked. var myApplication = TheApplication();  var busobjProj  = myApplication.GetBusObject("Repository Project"); var buscompProj = busobjProj.GetBusComp("Repository Project"); After this we need two Parameters, the row_id of the project and the Name of the project.We could use just the row_id to make things simpler. The name of the project is not unique when you have multiple repositories in the database. So the next lines of Code should be: with(buscompProj) {     ClearToQuery();    ActivateField("Locked");    ActivateField("Name");    SetSearchSpec("Repository Id", RowId);    ExecuteQuery();    SetFieldValue("Locked", "Y");    WriteRecord(); } We can also add a return variable to check if the Project was indeed locked, plus a try, catch block. Also we could create a function that can lock or unlock a project based on a parameter.   function Project_locking(RowId, Lock_Unlock) {   var myApplication = TheApplication();     var busobjProj  = myApplication.GetBusObject("Repository Project");    var buscompProj = busobjProj.GetBusComp("Repository Project");     var success:Boolean=false; with(buscompProj)    {      ClearToQuery();      ActivateField("Locked");      ActivateField("Name");      SetSearchSpec("Repository Id", RowId);      ExecuteQuery();      try      {          SetFieldValue("Locked", Lock_Unlock);          WriteRecord(); success = true;       }      catch(e)      {          TheApplication().Trace(e.toString()); // The code below shows a popup                    //TheApplication().RaiseErrorText("Error Occurred "+e.toString());        }      }     return success;     } Here you can set the value of Lock_Unlock to either "Y" when you want to lock a projectand "N" when you want to unlock a project. To get the row_id of a Project, you should open the Project in Siebel Tools and go to Help -> About Record. To Lock a Business Component, we must use Business Object "Repository Business Component"  and Business Component "Repository Business Component" The function would be similar, like this function BC_locking(ProjID, Lock_Unlock)  {      var myApplication = TheApplication();       var busobjRep  = myApplication.GetBusObject("Repository Business Component");      var buscompRep = busobjRep.GetBusComp("Repository Business Component");      var success:Boolean=false;      with(buscompRep)      {         ClearToQuery();         ActivateField("Project Locked");         ActivateField("Inactive");         ActivateField("Name");         SetSearchSpec("Project Id", ProjID);         ExecuteQuery();         try         {            if(GetFieldValue("Project Locked")=="Y" and GetFieldValue("Inactive")=="N")            {                SetFieldValue("Object Locked", Lock_Unlock);                WriteRecord();                success = true;              }          }           catch(e)           {              TheApplication().Trace(e.toString()); // The code below shows a popup                         //TheApplication().RaiseErrorText("Error Occurred "+e.toString());           }          }              return success;        }