You are here

Disable Print & Export Options in Siebel

The Print and Export options are available in Application File Menus, Applet Menus and Toolbar buttons (i.e. Quick Print Icon ). The Print option is centrally controlled in Siebel by the built-in Business Service (BS) “PrintListService”. This BS needs some code to be included to disable the print. But there is no such central place to add code to disable Export data option, this is a Siebel Product limitation.
 
The alternate way to disable Export data option is, to write server side script in all the List Applet’s “PreCanInvokeMethod” therein setting CanInvoke=FALSE for the event method “ExportQuery”.
 
To restrict Print and Export data options only to Admin Positions of an Organization (i.e. for Japan), a new Business Service should be created (to avoid code redundancy in each applet) to include this business rule and return a YES or NO flag value. Based on this BS output flag, the ExportQuery method should be enabled or disabled for each list applets.
 
To avoid hard-coding the specific organization (for example, Japan) in the BS code, there needs to be a new dummy LOV Type and LOV value created. This LOV Type should include the required Organization (for example, Japan) in the Organization MVG. In the BS Code, write scripts to query for Standard LOV Business Component (shortened as BC) “List of Values” with filters as current users position organization, the dummy LOV Value’s LIC Name (for example, LIC for dummy LOV value as DISABLE_EXPORT). If LOV record available for these filter conditions then proceed checking for current login User’s Position Type to disable or enable Print/Export options.
 
Below are the high level steps to achieve this functionality:
 
Application Admin Set Up:

  1. Create new dummy LOV Type and LOV Value
  2. Include required Organizations via LOV Type’s Organization MVG.

 
Siebel Tools Configuration:
1.    Create new BS called “BS Disable Export” to disable Export data option.
2.    Add Scripts to all the required List Applets “PreCanInvokeMethod” to check for the method “ExportQuery”.
3.    Modify the “PrintListService” to ignore Print methods by setting “CanInvoke” parameter to FALSE (disable Print)
4.    Compile all the new objects and edited objects into the .SRF to test.
5.    Ensure to Clear Cache the LOVs before testing
 
The detailed steps with eScript as follows:
 

  1. Open Siebel Client Application, Navigate to Sitemap->Data Administration->LOV Explorer View, create new LOV Type as shown below,

 
a.     Type: TEST_VALIDATION
 Organization: In Organization MVG, Add all the required  organizations, for example, Japan.
 
b.     Create new LOV Value for the above LOV Type as shown below,
 
Code: DISABLE_EXPORT
 Display Value: DISABLE_EXPORT
                    Organization: Select “Japan” the Organization Dropdown Picklist
 
                     
 
 
                            
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

  1. In Tools, Create new BS named “BS Disable Export” and create new method “GetDisableExportFlag” as shown below,

 
 
 
Write the below code in “Service_PreCanInvokeMethod”,
 
function Service_PreCanInvokeMethod (MethodName, &CanInvoke)
{
            if ( MethodName == "GetDisableExportFlag")
            {
                        CanInvoke ="TRUE";
                        return (CancelOperation);
            }
           
                        return (ContinueOperation);

}
 
 

Below is screenshot from Tools,

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Write the below code in “Service_PreInvokeMethod” of BS,

 
function Service_PreInvokeMethod (MethodName, Inputs, Outputs)
{
            if ( MethodName == "GetDisableExportFlag")
            {
                                               
                 try
                {
                                    var CurrPosId = TheApplication().PositionId();
                                    var sPosType = "";
                                    var sOrgId="";
                                               
                                    // get Positioin Name and Org
                                    var bo = TheApplication().GetBusObject("Position");
                                    var bc = bo.GetBusComp("Position");
                                    bc.ClearToQuery();
                                    bc.ActivateField("Position Type");
                                    bc.ActivateField("Organization Id");
                                    bc.ActivateField("Organization");
                                    bc.SetSearchSpec("Position Id", CurrPosId);
                                    bc.ExecuteQuery(ForwardOnly);
                                    if (bc.FirstRecord())
                                    {
                                                sOrgId = bc.GetFieldValue("Organization");
                                                sPosType = bc.GetFieldValue("Position Type");
                                    } 
                                    bc = null;
                                    bo = null;
                                   
                                    var sRestrictOrg="";
var oBOLOV =TheApplication().GetBusObject("List Of Values");
                                    var oBCLOV =oBOLOV.GetBusComp("List Of Values");
                                   
with (oBCLOV)
                                    { //...2
                                                SetViewMode(AllView);
                                                ClearToQuery();
                                                SetSearchSpec("Type", “TEST_VALIDATION”);
                                                SetSearchSpec("OrganizationId", sOrgId);
                                                SetSearchSpec("Name","DISABLE_EXPORT");
                                                ExecuteQuery(ForwardOnly);
 
                                                if(FirstRecord())
                                                {
                                                            sRestrictOrg = "Y";
                                                }else {
                                                            sRestrictOrg = "N";
                                                }
                                    }
                                   
                                    if((sRestrictOrg =="Y")&&(sPosType.indexOf("Admin")<0 ))
                                    {
                                                Outputs.SetProperty("DisableExport","Y");
                                    }else
                                    {
                                                Outputs.SetProperty("DisableExport","N");
                                    }
 
                                    return (CancelOperation);
 
                 }catch(e)              
                 {
                        throw(e);
                                   
                 }finally {
                                    //clean up
                                    oBCLOV = null;
                                    oBOLOV = null;
 
                 }
                       
             }
 
             return (ContinueOperation);

}

 
Below is screenshot from Tools,

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

  1. In Tools, add Scripts to all the required List Applets that needs Export menu to be disabled, for example, select “Contact List Applet”, add below server side script to “PreCanInvokeMethod”,

 
function WebApplet_PreCanInvokeMethod (MethodName, &CanInvoke)
{
                  //Export Option disable/enable logic included
      if(MethodName == "ExportQuery")
      {               
            try
            {
                        // invoke BS to check business rule
var oBusinessService = TheApplication().GetService("BS Disable Export");
                        var psInputs = TheApplication().NewPropertySet();
                        var psOutputs = TheApplication().NewPropertySet();
                                               
oBusinessService.InvokeMethod ("GetDisableExportFlag", psInputs, psOutputs);
 
// get output flag value from the BS
                        var sDisableExport = psOutputs.GetProperty("DisableExport");      
 
                        if (sDisableExport=="N")
                        {
                                    CanInvoke = "TRUE";
                                    return (CancelOperation);
                        } else
                        {
                                    CanInvoke = "FALSE";
                                    return (CancelOperation);
                        }
 
            } catch(e){
                        throw(e)
            } finally
            {
                        oBusinessService = null;
            }
     }
     return (ContinueOperation);
 }
 
below is screenshot from Tools,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

  1. In Tools, Query for the built-in BS “PrintListService”, write script in this BS, to check for current login user’s Positions Type and Organization. In the Script, query for the BC “List of Values” with filters as the dummy LOV Type created in Step 1 and for the current User’s Position Organization. If record available then check for Position Type, if Position Type is other than Admin then set CanInvoke parameter to FALSE (disable Print), below is the actual eScript code,

 
function Service_PreCanInvokeMethod (MethodName, &CanInvoke)
{         
 
   try
    {
                      var CurrPosId = TheApplication().PositionId();
                      var sPosType = "";
                      var sOrgId="";
                                               
                      // get current user login Positioin and Organization
          var bo = TheApplication().GetBusObject("Position");
          var bc = bo.GetBusComp("Position");
            bc.ClearToQuery();
            bc.ActivateField("Position Type");
            bc.ActivateField("Organization Id");
            bc.ActivateField("Organization");
            bc.SetSearchSpec("Position Id", CurrPosId);
            bc.ExecuteQuery(ForwardOnly);
 
            if (bc.FirstRecord())
            {
                        sOrgId = bc.GetFieldValue("Organization");
                        sPosType = bc.GetFieldValue("Position Type");
            } 
            bc = null;
            bo = null;
                                   
            var sRestrictOrg="";
            var oBOLOV =TheApplication().GetBusObject("List Of Values");
            var oBCLOV =oBOLOV.GetBusComp("List Of Values");
            with (oBCLOV)
            {
                        SetViewMode(AllView);
                        ClearToQuery();
                        SetSearchSpec("Type", "TEST_VALIDATION");
                        SetSearchSpec("OrganizationId", sOrgId);
                        SetSearchSpec("Name","DISABLE_EXPORT");
                        ExecuteQuery(ForwardOnly);
 
                        if(FirstRecord())
                        {
           
if(sPosType.indexOf("Admin") >= 0 || sPosType.indexOf("admin") >= 0 || sPosType.indexOf("ADMIN") >= 0)    
                                    {
                                                 return (ContinueOperation);
                                     }else
                                     {
                                                return (CancelOperation);
                                     }
                        }
                        }
 
       } catch(e) {
                        throw(e);
       } finally {
                       
            oBCLOV = null;
            oBOLOV = null;
       }
 return (ContinueOperation);
}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
The Screenshot from tools as follows,
 
 
 

  1. Compile all the new objects created or edited objects into the Application .SRF file and test from application.

 
 
Conclusion:
 
The solution suggested in this document to disable Export and Print options for specific Organizations using dummy LOV Type, can be applied to implement any such Organization specific requirements in a Multi-Organization Siebel Application.
 
The dummy LOV Type based approach avoids hard-coding Organization Names in Scripting and addresses all future Organizations that may need this functionality too. The limitation of this approach is, the script written in each list applet to enable/disable “ExportQuery” Event Method. The code redundancy is due to the present Siebel Product drawback.