📚 SAP Business One SDK Help

DeleteEmployeeRoleSetup Method
See Also  Example
pIEmployeeRoleSetupParams
The key of the role to be deleted

Description

Deletes an existing employee role.

The role is specified by its key (TypeID), which is contained in the EmployeeRoleSetupParams object passed to the method.

Syntax

Visual Basic
Public Sub DeleteEmployeeRoleSetup( _
   ByVal pIEmployeeRoleSetupParams As EmployeeRoleSetupParams _
) 

Parameters

pIEmployeeRoleSetupParams
The key of the role to be deleted

Remarks

System roles -- those with their Locked field set to Y -- cannot be deleted.

Roles that have been assigned to an employee, via the EmployeeRolesInfo object, cannot be deleted.

Example

Deleting a role (C#)Copy Code
public void delete() 

  try 
  { 
      EmployeeRoleSetupParams delLine; 
      delLine = (EmployeeRoleSetupParams)oRoleSrv.GetDataInterface(SAPbobsCOM.EmployeeRolesSetupServiceDataInterfaces.erssEmployeeRoleSetupParams); 
 
      //delete a record 
      //please note that the typeID should be the typeID of an existing record. 
      delLine.TypeID = 19; 
      //delete 
      oRoleSrv.DeleteEmployeeRoleSetup(delLine); 
  } 
  catch (Exception ex) 
  { 
      Interaction.MsgBox(ex.Message, (Microsoft.VisualBasic.MsgBoxStyle)(0), null); 
  } 

See Also