Some time we get requirement that based on some conditions, document category should be changed.
In my case, I was working on task page, so if I open task1 then task1 document category should be displayed and if I open task2 then task2 document category will be displayed.
Below are the steps to achieve this requirment.
1. Create all required document category in oracle apps.
2. Create attachment in your page, assign entity map and create primary key. But do not create category map at design time. We will create it in our controller.
3. Now in your controller take control of your attachment bean.
accessing bean in controller
OAMessageInlineAttachmentBean taskDtlsAttachments =
(OAMessageInlineAttachmentBean)webBean.findChildRecursive("TaskDtlsAttachments");
accessing entity map of attachment
String taskDtlsAttachEntityId = taskDtlsAttachments.getEntityId();
if some how entity map is null assign entity mapif (taskDtlsAttachEntityId == null)
{
taskDtlsAttachEntityId = "XXPRO_ENTITY_MAP";
}
if you do not want misc document category, use this code
taskDtlsAttachments.setDefaultMiscCategoryEnabled(false); use setCategoryMap method to set document category at run time. In this method we pass entity map, array of document category and pageContext. if (task==task1) taskDtlsAttachments.setCategoryMap(taskDtlsAttachEntityId,
new String[] { TASK1_document_category }, pageContext);
else if (task==task2)
taskDtlsAttachments.setCategoryMap(taskDtlsAttachEntityId,
new String[] { TASK2_document_category }, pageContext);
In my case, I was working on task page, so if I open task1 then task1 document category should be displayed and if I open task2 then task2 document category will be displayed.
Below are the steps to achieve this requirment.
1. Create all required document category in oracle apps.
2. Create attachment in your page, assign entity map and create primary key. But do not create category map at design time. We will create it in our controller.
3. Now in your controller take control of your attachment bean.
accessing bean in controller
OAMessageInlineAttachmentBean taskDtlsAttachments =
(OAMessageInlineAttachmentBean)webBean.findChildRecursive("TaskDtlsAttachments");
accessing entity map of attachment
String taskDtlsAttachEntityId = taskDtlsAttachments.getEntityId();
if some how entity map is null assign entity mapif (taskDtlsAttachEntityId == null)
{
taskDtlsAttachEntityId = "XXPRO_ENTITY_MAP";
}
if you do not want misc document category, use this code
taskDtlsAttachments.setDefaultMiscCategoryEnabled(false); use setCategoryMap method to set document category at run time. In this method we pass entity map, array of document category and pageContext. if (task==task1) taskDtlsAttachments.setCategoryMap(taskDtlsAttachEntityId,
new String[] { TASK1_document_category }, pageContext);
else if (task==task2)
taskDtlsAttachments.setCategoryMap(taskDtlsAttachEntityId,
new String[] { TASK2_document_category }, pageContext);

No comments:
Post a Comment