Create new publication and add to TranslationJob

I am working on creating a new publication, followed by creating a TranslationJob and adding the publication to it. I have been able to make it work with an existing publication, but for a new publication, I keep getting an error about empty baseline

(

<?xml version="1.0" encoding="utf-16"?><baseline ref="GUID-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"><objects><object ref="GUID-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" source="expand:None" type="ISHNone"><reportitems><reportitem reportresult="ObjectMissingInBaseline" /></reportitems></object></objects></baseline>

). I am completing my baseline as follows:

List<string> languages = new List<string>() { "es-US" };

startLogicalIds.Add(Utility.getIshFieldValue(xmlPubList, "FISHMASTERREF", pub));

string pubBaselineID = Utility.getIshFieldValue(xmlPubList, "FISHBASELINE", pub);

 string baselineID = baseline.CompleteBaselineByCandidateAndMode(baseline.GetBaselineId(pubBaselineID), "", Trisoft.Utilities.ServiceReferences.Baseline25ServiceReference.BaselineAutoCompleteMode.ISHLatestAvailable, startLogicalIds, emptyList, languages, languages, languages, resolutions);

Thanks in advance for your help.

Parents
  • Hi Akheil,

    You are missing a step in your process.
    The code shown above is indeed autocompleting the baseline towards the latest available version of the referenced objects by the publication.

    However you do not save the baseline information towards the repository. You only have it in memory in the baselineID variable.

    You need to transform the retrieved information in the baselineID variable into a 'baseline modifications' structure (see: https://docs.sdl.com/806356/70873/sdl-tridion-docs-14-sp3/baseline-modifications).
    This structure is the required input for the baseline2.5 update method in order to save the baseline information.

    Adding the transformation from you autocomplete structure towards the baseline modifications structure and updating the baseline object will solve your problem.

    Kind Regards,


    Raf

Reply
  • Hi Akheil,

    You are missing a step in your process.
    The code shown above is indeed autocompleting the baseline towards the latest available version of the referenced objects by the publication.

    However you do not save the baseline information towards the repository. You only have it in memory in the baselineID variable.

    You need to transform the retrieved information in the baselineID variable into a 'baseline modifications' structure (see: https://docs.sdl.com/806356/70873/sdl-tridion-docs-14-sp3/baseline-modifications).
    This structure is the required input for the baseline2.5 update method in order to save the baseline information.

    Adding the transformation from you autocomplete structure towards the baseline modifications structure and updating the baseline object will solve your problem.

    Kind Regards,


    Raf

Children