Add Publishing Context via API

Hello,

          I am trying to add publishing context for publication object via API and below is the Ishfield I have added

  ishfields.add(new IshField("FISHPUBCONTEXT", IshField.ISHLevel.LOGICAL,"<features><feature name='product' value='DME' /></features>"));

 

The Exception I get is

"com.sdl.trisoft.PublicationOutput.PublicationOutputCreateInfoShareFaultFaultMessage: [-102003] The FieldValue \"FISHPUBCONTEXT\" cannot be returned, because it is not initialized. [102003;ObjectNotInitialized]"

 

Any suggestions?

 

Thanks

  • Dear Divyamanasa,

    This question is a duplicate from the question raised in the Tridion Docs group and has been answered there.

    For completion reasons I'll duplicate (the combined answer) here as well.

    Answer:
    -----------
    This is caused by the fact that the FISHPUBCONTEXT field is defined on the VERSION level.

    So update you statement in order to reflect the following:
    ishfields.add(new IshField("FISHPUBCONTEXT", IshField.ISHLevel.VERSION,"<features><feature name='product' value='DME' /></features>"));

    To avoid guessing on field names and levels, there are a couple of ways to look them up depending on the CMS version in play.

    If you have WebApp server access, you can use the C:\InfoShare\App\Database\Common\DatabaseIndependent\Examples\Full-Export\FullExport.ps1 in a Remote Desktop Session or so as it generate an HTML page
    If you have 13/13.0.0 or higher there is a web service API call that offers you your setup including customer fields. On 2016/12.0.x and earlier the ISHRemote cmdlet will only offer you the standard fields back as the API call is missing there. Have a look at ISHRemote Webinar at this time index


    I hope this helps.
    Kind Regards,

    Raf