How to use jsonUtils in a script?

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-12-2013 10:04 AM
I'd like to use jsonUtils in a script (not a webscript).
My intent is to convert a javascript object to json.
My understanding is that it's available to webscripts but not scripts.
Is there any way I can configure Alfresco to make it available to regular scripts?
Is there something similar that's already available to regular scripts?
If not, is it possible to call a webscript from a script? How would I do so?
Thanks,
Matthew
My intent is to convert a javascript object to json.
My understanding is that it's available to webscripts but not scripts.
Is there any way I can configure Alfresco to make it available to regular scripts?
Is there something similar that's already available to regular scripts?
If not, is it possible to call a webscript from a script? How would I do so?
Thanks,
Matthew
Labels:
- Labels:
-
Archive
3 REPLIES 3
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-12-2013 01:27 PM
Can you explain what you see as the difference between a webscript and a script? Do you mean using Javascript on the client side (in the browser) or do you mean scripts in Rules and behaviours?
Bob Johnson
Bob Johnson

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-12-2013 01:33 PM
By script, I mean a js file that resides in "Data Dictionary\Scripts" and can be set as the script of a rule that 'executes script'
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-12-2013 02:00 PM
I had exactly this problem. According to the documentation jsonUtils should be available in any script that runs in the repository context (alfresco) which unless someone tells me otherwise rule scripts do; except, as you have found, out it isn't available or at least wasn't available in 4.0a (I haven't tried it in 4.2c). See my post
http://forums.alfresco.com/forum/developer-discussions/alfresco-share-development/jsonutils-rules-sc...
which sadly drew no replies.
All you need to do is include the java bean that provides jsonUtils in the configuration of root objects in rules. I never got round to doing this (but I probably will have to soon) so I cannot give you chapter and verse on how you do this (hopefully someone on the forums can do this).
I have added my own objects in rules,so it has to be achievable, but in the end I didn't bother with jsonUtils.
Wish I could be more help; I hope someone can.
Bob Johnson
http://forums.alfresco.com/forum/developer-discussions/alfresco-share-development/jsonutils-rules-sc...
which sadly drew no replies.
All you need to do is include the java bean that provides jsonUtils in the configuration of root objects in rules. I never got round to doing this (but I probably will have to soon) so I cannot give you chapter and verse on how you do this (hopefully someone on the forums can do this).
I have added my own objects in rules,so it has to be achievable, but in the end I didn't bother with jsonUtils.
Wish I could be more help; I hope someone can.
Bob Johnson
