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

2 comments:

  1. and I thought that RaiseErrorText was banned from scripting 😅...

    ReplyDelete
  2. we have implemented this approach with Data Validation. For example for BC."Action Attachment", we added the conditinal expression "[ActivityFileSize] > 8388608", and under RUle Detail this Expression "[ActivityFileSize] <= 8388608". if conditions match then we raised this error "This file cannot be uploaded to Siebel. It exceeds the allowed size of 8MB." (Please verify the maximum file size that is allowed)". The Rule is calling later from Runtime Events.

    🤚, Jose Luis

    ReplyDelete

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...