- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-11-2016 07:02 AM
Hi,
I am setting the fields in knowledge form read only based on some conditions.
I have written an onLoad client script which is working when the state is published or retired and current user is not the manager of the corresponding knowledge base.
I am doing a glideAjax call which is returning the right value.
After that I am setting the floowing fields readonly:
function setReadOnly(response) {
var answer = response.responseXML.documentElement.getAttribute("answer");
if(answer == 'false'){
g_form.setReadOnly('text',true);
g_form.setReadOnly('kb_knowledge_base',true);
g_form.setReadOnly('kb_category',true);
g_form.setReadOnly('short_description',true);
g_form.setReadOnly('language',true);
g_form.setReadOnly('valid_to',true);
g_form.setReadOnly('direct',true);
g_form.setReadOnly('parent',true);
g_form.setReadOnly('article_type',true);
g_form.setReadOnly('source',true);
g_form.setReadOnly('image',true);
g_form.setReadOnly('roles',true);
g_form.setReadOnly('display_attachments',true);
}
}
Everything is setting the value readOnly but category is not getting set. Category is dependent on knowledge base but I am setting knowledge base also as read only. Knowledge base is working fine.
Please help me.
Regards,
Anasuya
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-11-2016 09:14 AM
Anasuya,
There is another Client Script called "Enable or disable form fields". It runs onChange, but its also executed onLoad due to the missing !isLoading check.
This script will mark the "kb_category" (KB version 3) or "category" (KB version 2) field as writeable again.
You might want to comment out the category fields in that script if you want your script to be triggered correctly. You can easily test this by setting the above mentioned script to inactive for a quick test.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-11-2016 09:06 AM
Are you sure you have the right field name? If you are working on the kb_knowledge table, the Category field is "category", not "kb_category".
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-11-2016 09:14 AM
Anasuya,
There is another Client Script called "Enable or disable form fields". It runs onChange, but its also executed onLoad due to the missing !isLoading check.
This script will mark the "kb_category" (KB version 3) or "category" (KB version 2) field as writeable again.
You might want to comment out the category fields in that script if you want your script to be triggered correctly. You can easily test this by setting the above mentioned script to inactive for a quick test.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-11-2016 07:44 PM
Hi Frank!
Thank you.
I have made the Enable or disable form fields client script inactive as we are using only kb version 3. All the knowledge bases are created with version 3. Hope that will not be a problem.
Only state field value was not read only but as per the requirement it should be always read only. So from dictionary entry I have made the value read only
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-12-2016 09:10 AM
If you simply deactivated that script you will still receive changes to it during the next upgrade cycle in case there are changes. If you modified some code in that script, it will be considered "owned by you" and therefore it will be skipped during the next upgrade (again, only in case there are any changes). You can still review the skipped records after an upgrade and decide to apply the new version if applicable.