Manipulating conditions for publications using ISHRemote

I want to set conditions for a bunch of publications at once using a script. I looked into the Cmdlet list of ISHRemote, but I couldn't find one that can manipulate a publication's conditions. Is it possible to manipulate publication conditions using ISHRemote?

emoji
  • Hi Naoki,

    Technically we call it a System field, so for Tridion Docs purposes only. It has however not changed for 10+ years, so let's hope it does not change in the future either... a disclaimer Slight smile

    Below some pseudo code that should bring you really close 

    # Remember the below is your friend in browsing through fields
    Get-IshTypeFieldDefinition | Out-GridView
    
    # Retrieving the System field that holds this information
    $ishObject = Get-IshPublicationOutput -IshObject $ishObject -RequestedMetadata (Set-IshRequestedMetadataField -Level Version -Name FISHPUBCONTEXT)
    
    # Printing the information
    [xml]$context = $ishObject.fishpubcontext_version_value
    # <?xml version="1.0" encoding="utf-16"?>
    # <features>
    #   <feature name="BLUETOOTH" value="Y" />
    #   <feature name="GAMES" value="DJ" />
    #   <feature name="GAMES" value="SNAKE" />
    #   <feature name="GAMES" value="WATERRAPIDS" />
    #   <feature name="GPRS" value="Y" />
    #   <feature name="HEADSET" value="Y" />
    #   <feature name="LOUDSPEAKER" value="Y" />
    #   <feature name="MODEL" value="330" />
    # </features>
    
    # Preferably changing xml with proper XmlDocument functions to keep it valid/welformed like for example switching HEADSET from Y to N
    $context.SelectSingleNode("features/feature[@name='HEADSET']").Value='N'
    
    # Beware that there is only very basic validation on this field
    Set-IshPublicationOutput -IshObject $ishObject -Metadata (Set-IshMetadataField -Level Version -Name FISHPUBCONTEXT -Value $context.OuterXml)

    Remember that ISHRemote expect fully initialized logical-version-language entries. Earlier Tridion Docs versions allowed creation of Publication Versions (so logical-version) while later versions will enforce more complete hierarchies PublicationOutput (so logical-version-language). ISHRemote can only work with the latter - PublicationOutputs.

    Best wishes,
    Dave

    emoji