Hello All,
Siebel Attachment's are very useful functionality to attach documents, files ,images etc. with parent records.
There are certain consideration with attachment that comes into picture one day or the other.
1. Size Restriction on Attachments
2. Type Restriction on Attachments
3. Size control for Siebel File System
4. FS Cleanup to clear orphan Attachments
lets cover these one by one,
before starting let us first check the total size of attachments under a particular entity, (Service Request in my case)
Client Side BS to get the Size of attachment
function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { try { if(MethodName == "DeleteAttachment") { var vSRBO = TheApplication().GetBusObject("Service Request (eService)"); var vSRBC = vSRBO.GetBusComp("Service Request (eService)"); var vSRBCAtt = vSRBO.GetBusComp("Service Request Attachment"); var fileSize ="0",filebyte="0"; with(vSRBC) { ActivateField("Id"); ClearToQuery(); SetViewMode(AllView); var varSpec = "[Created] >= '1/1/2020' AND [Created] <= '1/1/2022'"; SetSearchExpr(varSpec); ExecuteQuery(); var vFirstRec = FirstRecord(); while(vFirstRec) { with(vSRBCAtt) { ActivateField("ActivityFileName"); ActivateField("ActivityFileSize"); ClearToQuery(); SetViewMode(AllView); ExecuteQuery(); var FirstRec = FirstRecord(); while(FirstRec) { var filename = GetFieldValue("ActivityFileName"); filebyte = GetFieldValue("ActivityFileSize"); fileSize = ToNumber(fileSize)+ToNumber(filebyte); FirstRec = NextRecord(); } } vFirstRec = NextRecord();
} TheApplication().RaiseErrorText("TotalSize: "+fileSize); } return(CancelOperation); } }//End Try catch(e) { // return(CancelOperation); if (typeof e.errText == "undefined") TheApplication().RaiseErrorText(e.toString()); else TheApplication().RaiseErrorText(e.errText + "\n" + e.toString()); } finally { vSRBO = null; vSRBC = null; } } |
Nice one.
ReplyDeleteI think that's just 10 megabytes, not gigabytes.
#gosiebel
Yes Alex, i had to divide the outcome by 1,000,000 to get in MB, not by 1024.
DeleteJust realised after posting it. 😆
Also, i am a big follower of you Right from 2013 when open ui was launched and you posted many articles on your initial blog siebli .
DeleteYou are my inspiration for starting this technical blog.
:)
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteKeep up the good work Rahul !
ReplyDeleteJust a note - for restricting file size and File extension on attachments many attachment related BC's have fields like FileSize and FileExt for which field property validation can be set with a validation message