Monday 4 April 2022

Working with Attachments in Siebel - Part3 Putting TypeRestriction

 Hello All, 

In this post let us try to put restriction on the Type of files while adding new Attachments.

The Logic is pretty simple, 

1. Identify the Target Attachment BC

2. Identify the File Type Field

3. Write Script on PreWriteRecord of Business Component

In any attachment applet, we can see the Fields Name, Size (in Bytes) ,Type etc.


 



Lets Try to write a Piece of Code to fetch the Type of File:

The code below prevent to attach exe, msi or apk files that can be cause potential threats to system 

function BusComp_PreWriteRecord ()

{

var ext= GetFieldValue("FileExt"); //Get the File Extension

switch(ext) {

  case "exe":  

TheApplication().RaiseErrorText("This Type of File is Not Allowed");                    

break;

  case "EXE":

TheApplication().RaiseErrorText("This Type of File is Not Allowed");

break;

  case "msi":

TheApplication().RaiseErrorText("This Type of File is Not Allowed");

break;

  case "apk":

TheApplication().RaiseErrorText("This Type of File is Not Allowed");

break;

  case "APK":

TheApplication().RaiseErrorText("This Type of File is Not Allowed");

break;

  default:

//do nothing 

}

}




Error Popup on Save Record:









This way we can keep our file system clean from any virus, unwanted apps etc..
Smart way to secure application :-) 


Previous Post                        Next Post

Friday 1 April 2022

Working with Attachments in Siebel - Part2 Putting Size Restriction

 Hello All, 

In this post let us try to put size restriction while adding new Attachments.

The Logic is pretty simple, 

1. Identify the Target Attachment BC

2. Identify the File Size Field

3. Write Script on PreWriteRecord of Business Component

In any attachment applet, we can see the Fields Name, Size (in Bytes) ,Type etc.


 



Lets Try to write a Piece of Code to fetch the Size:

function BusComp_PreWriteRecord ()

{

    this.ActivateField("FileSize");

    var size= this.GetFieldValue("FileSize"); //Field that has size

    var sizeMB = size/1000000 ; //converting Bytes to MB

if (ToNumber(sizeMB) >= 5 ) //checking the size to less then 5 MB

{

TheApplication().RaiseErrorText("Please add file less then 5 MB");                     

}

}


Error Popup on Save Record:









very simple effective solution to Keep Siebel File System under control :-) ,any suggestions are always welcome.


Previous Post                        Next Post

Siebel GoTo View - Handling Realtime cases

 Hello All,  We all must have used GoTo view functionality of siebel to navigate to a particular view from current view. What if the require...