We can mandatory the attachment in OAF page thorugh CO extension by follow these easy steps -
Step 1) We have to find the right controller to extend.
Step 2) Inside ProcessFormRequest of that controller we should catch the id of Submit button by -
if (pageContext.getParameter("SubmitButtonID")!=null
Step 3) We should catch the id of FileUploadBean by -
OAMessageFileUploadBean UploadBean= (OAMessageFileUploadBean)webBean.findIndexedChildRecursive("UploadBeanID");
pageContext.writeDiagnostics(this,"Check if upload bean is not null"+UploadBean,1);
Step 4) Now we have to find that is there any value in UploadBean or not, if there is value that mean the file is attached.
String val = (String)UploadBean.getValue(pageContext);
pageContext.writeDiagnostics(this,"value of val is :"+val,1);
Step 5) Raise the error if file is not attached -
if (val == null)
{
throw new OAException ("Please attach a file !!! ",OAException.ERROR);
}
Hello Amit,
ReplyDeleteCan you please help me to get this UploadBeanID from?
in standard OAF page, it is OAAttachmentImageBean.