Hi everyone. As it has been a common requirement for clients to add documents to the case during the adding of the case , here is a simple turnaround that i came across and working fine with me.
This trick will work like this :- after the user fills in the properties of the case and press the add button a new addContentItemDialog will pop up with the case folder specified as the folder to save in the document,
On the add case page , add a new script adapter and do the wiring as follows :

Then use this code inside the script adapter , it relies on retrieving the case folder once the add case button is pressed and the case folder is created.
calling caseObject.getCaseFolder() won't work as you need to call the plugin service on the case object coming from the case editable to retrieve the content item of the case folder as in this moment it's not retrieved by default
here is the documentation mentioned for this part :
/****************************/
* The ContentItem for the Case folder in the Case Manager repository.
* <p>
* This variable will be null if the case folder object has not yet been
* retrieved. Call retrieveCaseFolder() to ensure this object has been
* retrieved.
* @public
caseFolder: null,
* Returns the ecm.model.ContentItem object corresponding to the case folder.
* This either represents the Case folder in the Case Manager P8 repository or the
* proxy folder in the CM8 repository depending on the integration type of the solution.
*
* If case folder has not been retrieved yet, this method will return null. Call
* retrieveCaseFolder() to ensure the object is retrieved.
*
* @return ecm.model.ContentItem
*/
getCaseFolder: function()
/**************************************************/
at last , here is the code snippet:
var caseEditable = payload.caseEditable;
caseEditable.getCase().retrieveCaseFolder(function(parentCaseFolder){
var repositroy = parentCaseFolder.repository;
var addContentItemDialog = new ecm.widget.dialog.AddContentItemDialog();
addContentItemDialog.show(repositroy, parentCaseFolder,true, false, null, null, false, null);
});
of course you can customize the add content item dialog as you wish by changing the parameters passed to the dialog ,using the callback function , use entry templates and you can also choose a default document class using
addContentItemDialog.setDefaultContentClass("Document Class Symbloic Name");
No comments:
Post a Comment