I think you want to post this in the Photoshop Lightroom forum (this is the Lightroom SDK forum, for plugin authors).
Or have I misunderstood the question? (collection:getParent() to get parent in lua code).
Or are you trying to call the catalog function to create a collection, but don't know what to use for parent collection set? If this is the case, then you will have to create a collection set if you can't find something suitable to act as parent (e.g. a selected collection set obtained from catalog:getActiveSources()). Reminder: parent parameter is optional - if omitted, then collection will be created in root of catalog (or publish service) - that's another option.
Most of my plugins that create collections create a collection set in the root, named after the plugin, and put all sub-collections/sets in it.
You must supply the parent collection set when you create the collection. Whichever collection set you pass, will be the parent of the new collection.
When iterating the catalog's child collection sets, you can look at the collection set name to see if it's the right one, assuming you will know the correct name when you see it - will you always?
Consider posting actual code snippets if you can.
function publishServiceProvider.updateCollectionSettings( publishSettings, info )
local pubcol = LrCatalog:getPublishedCollectionByLocalIdentifier( info.publishedCollection.localIdentifier )
local parent = pubcol:getParent()
-- parent is nil when i create new collection
If parent is nil then parent is root. Make sure when you create the collection, that you are passing a valid collection set as parent, if you don't want it created in the root.
In the code you posted, you are not actually creating a collection, but rather getting a reference to an already existing collection, which was created in the root of the publishing service.
Do you also have the code that is creating the collection?
Do you have the SDK API doc? - these are from the top of the page about publish services:
publishService:createPublishedCollection( name, parent, canReturnExisting )
Creates a new published collection in this publish service.
publishService:createPublishedCollectionSet( name, parent, canReturnExisting )
Creates a new collection set in this publish service.
publishService:createPublishedSmartCollection( name, searchDesc, parent, canReturnExisting )
Creates a new published smart collection in this publish service.
Do you want the parent of the collection to be the collection set named 'BatchUpload'?
In any case, you need to determine the parent before creating the collection. If the parent does not already exist, then you need to create it. If the parent does already exist, then you need to find it, by rummaging through existing collection sets.
Note: if the target collection set may be nested, you may need to use recursion to find it, since there is no method to get a complete list of all collection set children.
Europe, Middle East and Africa