Appian Community
Site
Search
Sign In/Register
Site
Search
User
DISCUSS
LEARN
SUCCESS
SUPPORT
Documentation
AppMarket
More
Cancel
I'm looking for ...
State
Not Answered
Replies
7 replies
Subscribers
7 subscribers
Views
2220 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
General
Is there a OOTB functionality to empty the contents of KC or to get all the top
sikhivahans
over 9 years ago
Is there a OOTB functionality to empty the contents of KC or to get all the top level folders present in KC?...
OriginalPostID-121528
OriginalPostID-121528
Discussion posts and replies are publicly visible
0
alexanders411
over 9 years ago
AtryeTstfy
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Eduardo Fuentes
Appian Employee
over 9 years ago
Some useful plug-ins you can combine to meet your requirement or use as examples to build your own:
Content Functions
forum.appian.com/.../summary
Empty Folder
forum.appian.com/.../summary
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
sikhivahans
over 9 years ago
Thanks eduardo but I have already gone through these functions and didn't find one such that satisfies the requirement. Could you please let me know if I am missing any thing here?
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Eduardo Fuentes
Appian Employee
over 9 years ago
1. You can use the Content Functions as an example to create your own custom function plug-in to retrieve all folders from a KC. Here's an example:
@Function
@FolderDataType
public Long[] GetAllFoldersFromKC(ServiceContext sc, ContentService cs, @Parameter(required=true) @KnowledgeCenterDataType Long knowledgeCenter) {
ContentFilter cf = new ContentFilter(ContentConstants.TYPE_FOLDER);
return cs.getAllChildrenIds(knowledgeCenter, cf, ContentConstants.GC_MOD_NORMAL);
}
2. Then you can pass the result of calling this function to the Empty Folder smart service available in the second plug-in from my post
3. You can now use the Delete Folder smart service to delete the empty folders that function #1 will return.
Or you can merge these three things in your own custom smart service called "Empty KC"
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
sikhivahans
over 8 years ago
@Eduardo I have created a smart service as per your suggestion #3. But I do have a question - as of now the smart service has a input called 'knowledgeCenterId' which is of type Number Integer. In the smart service how can I check if a knowledge center exists or not with the input received from smart service? Because if I doesn't make this check, the smart service is fetching the child contents of the object (irrespective of KC or folder) based on the id and deleting them.
I know that I could do it with KnowledgeCenter data type but I would like to prefer to do it with the knowledgeCenterId which is of type Number. Is there any mistake in this approach?
It would be grateful to hear back from you.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Eduardo Fuentes
Appian Employee
over 8 years ago
Once you have the retrieved the Content object based on the ID do something like this:
if (content.getType().equals(ContentConstants.TYPE_COMMUNITY_KC)){
......
}
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
sikhivahans
over 8 years ago
@Eduardo Many thanks. Unfortunately I didn't find getType() initially.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel