Hi Everybody
How can I autocomplete a publication from ishremote?
Thanks!
Milly
Hi Everybody
How can I autocomplete a publication from ishremote?
Thanks!
Milly
Dear Milly,
Although there is no separate commandlet available in ISHRemote to autocomplete a baseline, there is a way to achieve this.
When you create a session using ISHRemote, the created session object can be used as gateway towards the API layer of SDL Tridion Docs.
So assuming that you create your session object as follows:
$mySession = New-IshSession -wsBaseUrl https://your.sdltridiondocs.url/ISHWS -PSCredential Get-Credential
you can access the Baseline25 API functions as follows:
$mySession.Baseline25.
From this reference you can trigger the required API method to autocomplete your baseline. So you can use the AutocompleteBaselineByMode method and supply this with the values applicable for your request.
The API methods are documented in the SDL Documentation portal: https://docs.sdl.com/796504/67982/sdl-tridion-docs-14-sp2/
Kind Regards,
Raf
Thanks Raf for your prompt answer.
I was not able to find AutocompleteBaselineByMode in the documentation for Baseline2.5, but I found CompleteBaselineByCandidateAndMode. I assumed you meant the latter.
However, I am having a hard time finding the right way to call the method. Here is a snippet of how I am getting the required parameters and then the error message. Could you guide me to the best way to call the method?
Milly
##############################
# Get the publication in $mypub
$mypub = Get-IshPublicationOutput -LogicalId $pubID -RequestedMetadata $requestedmeta |
Sort-Object -Descending -Property version_version_value |
Select-Object -First 1
##############################
Exception calling "CompleteBaselineByCandidateAndMode" with "9" argument(s): "[-102001] The Baseline
GUID-E05066FF-A538-466D-ADA5-63D114B70959 does not exist. [ce:"GUID-E05066FF-A538-466D-ADA5-63D114B70959"]
[102001;InvalidObject]"
At C:\BCD\EFG\Scripts\attempt_autocomplete00.ps1:34 char:1
+ $ishSession.Baseline25.CompleteBaselineByCandidateAndMode(
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : FaultException`1
Hi Mica
No, I couldn't get it to work. Sorry.
Hi Milly,
Sorry for the delay. Still with respect to the error above I think you supply not the correct set of arguments to the call.
The CompleteBaselineByCandidateAndMode expect first the baseline ID of the baseline that should be autocompleted.
The second argument could be the baseline by which you want to autocomplete. You supply in this argument the masterref value which is the GUID of the root DITAMAP and not a baseline reference. So that is why you see the error.
Please either keep the argument empty (as you do not want to autocomplete by an existing baselineline) or supply the correct value of the baseline which you want to use as guideline in the autocomplete routine.
The masterref value should be included in the StartLogicalIds list.
The fishresources value should be included in the StartResourceLogicalIds list (if you have resources attached to the publication version).
Kind Regards,
Raf
So I made it to the point where this is not throwing an error and returns the baseline report in powershell, but I am not getting the results I think I should be, either that or I am misunderstanding what the outcome of calling this API should be.
I am trying to emulate what we do currently in Publication Manager, which is: Click the Auto-complete button on the Baseline tab and select "Latest Released"
I have the following code, where for now, I'm just setting $pubID to be GUID of the pub I want to autocomplete and publish. In my test publication, the map is v1 & released, the topic is v2 & draft. I would expect the topic to fall back to v1 & released, but it does not.
$pubID = 'GUID-XXX-XXX-XXX-XXX'
$requestedMetadata = (Set-IshMetadataField -Level Version -Name FISHBASELINE -ValueType Value)
$mypub = Get-IshPublicationOutput -LogicalId $pubID -RequestedMetadata $requestedMetadata |
Sort-Object -Descending -Property version_version_value |
Select-Object -First 1
# Set arguments for CompleteBaselineByCandidateAndMode
$pasLanguages = new-object System.Collections.ArrayList($null)
$pasLanguages.Add("en-US")
$pasResolutions = new-object System.Collections.ArrayList($null)
$pasResolutions.Add("VRESLOW")
# Call method
$ishSession.Baseline25.CompleteBaselineByCandidateAndMode(
$mypub.fishbaseline_version_element,
[System.Collections.ArrayList]@(), # $mypub.fishbaseline_version_element,
'ISHLatestReleased',
$baselineList, # pasStartLogicalIds
[System.Collections.ArrayList]@(), # pasStartResourceLogicalIds,
$pasLanguages,
[System.Collections.ArrayList]@(), # pasIllustrationLanguages,
[System.Collections.ArrayList]@(), # pasResourceLanguages,
$pasResolutions)
# Publish!
$ishObject = Publish-IshPublicationOutput -LanguageCombination 'en-US' -LogicalId $pubID -OutputFormat "XHTML" -Version 1
Hi Mic-uh,
You did not handle any of the autocompleted information on your publication version.
So your code currently is retrieving the 'latest released versions' of the included objects, but you are not doing anything with the result.
You need to transform the list of retrieved latest released versions into A valid Baseline Modifications XML structure containing all changes that need to be made to the baseline.
This Baseline Modifications XML structure will state whether you want to update the selected version of a topic (object) or whether a new entry needs to be included in the baseline for a topic (object)
You can save the actual changes using the Baseline 2.5 Update function which taks this Baseline Modifications XML Structure as input.
Only after you have saved the baseline with the changes you want to apply the Publish commandlet will have the information available for further processing.
So please include the step to save the necessary updates to the baseline in your code in between the CompleteBaseline and Publish calls.
Kind Regards,
Raf
Tip: As Publication Manager is doing the exact same calls over the public API; you can insert a https://www.telerik.com/fiddler to see which API calls are triggered by Publication Manager for certain menu items and Save (as Raf mentions, thanks)
Raf, Dave, where is the "magic wand" API call? That's the one we need. :-P
I think the rub with the code above is that the baseline report returned from CompleteBaselineByCandidateAndMode doesn't actually every autocomplete with the "Latest Released" since I'm fetching an already existing baseline that already contains version numbers. According to the docs for CompleteBaselineByCandidateAndMode at https://docs.sdl.com/796504/201265/sdl-tridion-docs-14-sp2/baseline-2-5--completebaselinebycandidateandmode the API will never actually get the "Latest Relased" but only what is already there in the baseline, which for us is always a mash of draft and released and previously released but not the latest topics.
So I'm still at a bit of a loss on how to get a list of object versions that are the latest released.
I did install fiddler, but it didn't shed any light on what exactly is happening.
Allow me to summarize the request to "Click the Auto-complete button on the Baseline tab and select "Latest Released" but then fully automated. And you want LatestReleased on any baseline entry, so in turn it means you want to truncate your existing baseline and start from scratch, navigating the map-submap-tree-structure always selecting the LatestReleased version.
Before we tried to get you going by passing the right object identifiers, etc. The hint towards Publication Manager was illustrate that it can be done, although I must admit here that Publication Manager handles more use cases: Conflict resolving like your overwrite everything, so Publication Manager does more than a one-stop big calculate-save operation. But recursively does reports, in turn asking user confirmation where required, and updating the client-side Baseline tab with information... only upon Save the actual action is saved in the repository. So Fiddler shows something more complicated than required.
So indeed you don't want to complete-the-existing-baseline, you actually want to generate a new baseline from scratch. Instead of CompleteBaselineByCandidateAndMode, can you have a look at CompleteReportByCandidateAndMode where you don't provide an existing baseline as starting point (read: no existing versions of topics). You provide an empty starting baseline report (again: no existing versions, like start from root map v2 or something). Keeping psExtendBaselineId empty as well.
Please verify if this is the result you are looking for. In turn, it is still a report as result which needs to be converted to an Update to actually save it.
I did not have the time to write the code, so this is a theoretical approach to get this question on the rails again. That takes quite some time to work out.
Indeed, CompleteReportByCandidateAndMode does seem to do what I want it to do when I pass an empty baseline. I've taken that report and used it to update the existing baseline successfully (I think).
In the baseline update API call, what does "source = expand:LatestReleased" do? There are several options to choose from, but I'm not sure what this field does.
Also, is there any drawback to updating the existing baseline vs starting a new one?
Thanks!
Indeed, CompleteReportByCandidateAndMode does seem to do what I want it to do when I pass an empty baseline. I've taken that report and used it to update the existing baseline successfully (I think).
In the baseline update API call, what does "source = expand:LatestReleased" do? There are several options to choose from, but I'm not sure what this field does.
Also, is there any drawback to updating the existing baseline vs starting a new one?
Thanks!
Nice of you to share that you got further!
The "source" is mostly a field to indicate if the version selection in Publication Manager happened explicitly by the user, or was the result of an automated action (like an Autocomplete LatestReleased which makes the most sense for your scenario - other values are on SDL Documentation). It are mostly statistics, and have no effect downstream.
If you create a new baseline you need to assign it to your publication version (or if you are sharing your baseline across multiple publications). There is hardly any difference, the new baseline holds exactly what you wanted (probably ;-)), while the reuse will merge with what users already did. If it was up to me, I think the merge makes more sense as publications and their content (maps, submaps, topics, images, etc) are an ever moving target until it reaches some kind of deadline.
-Dave