📚 SAP Business One SDK Help

UpdateEmployeeRoleSetup Method
See Also  Example
pIEmployeeRoleSetup
The data for the role to be updated. The EmployeeRoleSetup object must contain the key of the object to be updated.

Description

Updates an existing employee role.

The data for the role, including the key of the role to be updated, is contained in the EmployeeRoleSetup passed to the method. To update a role, you must first retrieve it using the GetEmployeeRoleSetup method.

Syntax

Visual Basic
Public Sub UpdateEmployeeRoleSetup( _
   ByVal pIEmployeeRoleSetup As EmployeeRoleSetup _
) 

Parameters

pIEmployeeRoleSetup
The data for the role to be updated. The EmployeeRoleSetup object must contain the key of the object to be updated.

Remarks

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

Example

Updating a role (C#)Copy Code
public void update() 

    try 
    { 
        EmployeeRoleSetupParams getLine; 
        SAPbobsCOM.EmployeeRoleSetup updateLine; 
        getLine = (EmployeeRoleSetupParams)oRoleSrv.GetDataInterface(EmployeeRolesSetupServiceDataInterfaces.erssEmployeeRoleSetupParams); 
         
        //update a record 
        //please note that the typeID should be the typeID of an existing record. 
        getLine.TypeID = 19; 
 
        updateLine = oRoleSrv.GetEmployeeRoleSetup(getLine); 
        updateLine.Name = "role updated"; 
        updateLine.Description = "role updated"; 
        oRoleSrv.UpdateEmployeeRoleSetup(updateLine); 
         
        oRoleSrv.UpdateEmployeeRoleSetup(updateLine); 
    } 
    catch (Exception ex) 
    { 
        Interaction.MsgBox(ex.Message, (Microsoft.VisualBasic.MsgBoxStyle)(0), null); 
    } 

Example

See Also