01-19-2018 04:41 PM
Say we have a custom model named common:faq. It has properties cm:name, common:question, common:answer. How do i tell alfresco to set the default mimeype as text/plain for the contents created from this model?
When we create a content from this model, we see that the mimetype is set as 'application/octet-stream. instead we want this to be set to text/plain. How to configure this?
Note: when we create a content from other content models which has a cm:content property, alfresco sets the mimetype as text/plain by default.
Alfresco content service version: 5.2
01-23-2018 08:19 PM
I don't think you will be able to set the mimetype using the available Share actions.
At least I tried to find the right way to do it by using the form configuration, and I could not find it.
So, you should try another way, that is using the action Execute Script, and then having a javascript with a code just like the following:
document.mimetype = "text/plain";
document.save();
I tried it this way myself and it worked.
01-21-2018 09:06 AM
This is something you'd have to do via a policy / behaviour (i.e. onCreateNode) if you cannot already provide the correct mimetype as part of the content upload or implied via the file name (Alfresco will use the file extension to "guess" mimetypes, i.e. if your node is named xy.txt it will set text/plain automatically).
01-22-2018 11:14 AM
Hi,
Thanks, Can you please give more detail on how to do it via a policy / behaviour (i.e. onCreateNode). This is an ongoing issue in our app which needs immediate fix.
01-22-2018 11:19 AM
Can we able to do it by mentioning as below,
<show id="mimetype" />.
We don't want to show the field to the user and we want to set the value to text/plain always. How to set that?
01-23-2018 01:43 PM
I have created a rule to be run for updating the mimetype but it does not work.
01-23-2018 03:46 PM
Is the node already of the required type during creation / moving into the folder? Otherwise you may want to also add the "When" for items updated. You can also add a mimetype check as a criteria, so it does not get triggered when the mimetype is already complete.
01-23-2018 04:12 PM
Hi,
We are creating the content from create menu item. This means, we have a list of custom models in a dropdown from which we can create content. I added "when" for items updated, but still mimetype not set to text/plain.
01-23-2018 04:17 PM
The rule does not run at all. I just changed the condition like if name equals something set the mimetype.
I removed the condition totally and tried. Even this rule does not trigger.
So i think setting the cmis:contentStreamMimeType value does not work.
01-23-2018 08:19 PM
I don't think you will be able to set the mimetype using the available Share actions.
At least I tried to find the right way to do it by using the form configuration, and I could not find it.
So, you should try another way, that is using the action Execute Script, and then having a javascript with a code just like the following:
document.mimetype = "text/plain";
document.save();
I tried it this way myself and it worked.
01-24-2018 12:25 AM
Seem to be working. Let me try more scenarios.
Thanks for the help.
Explore our Alfresco products with the links below. Use labels to filter content by product module.