Discussions

Ask a Question
Back to all

Accessing ContentKey and ContentItemKey in Custom iParts

I'm developing a custom content type iPart with two files, index.html (display) and config.html (configuration dialog). My goal is to have the display iPart dynamically read the settings saved through the config dialog.

My first approach was to use JsonSettings to persist the config values, which works fine on the config side. However, JsonSettings is only available in the config dialog and cannot be accessed from index.html.

My second approach uses the ContentItem API endpoint, which requires both ContentKey and ContentItemKey as query parameters. This works, but the only way I've gotten it to function is by hardcoding those keys directly in index.html — which isn't viable since the keys change across instances and deployments.

I noticed that other iPart implementations read these keys via $attrs.asiContentkey and $attrs.asiContentitemkey in AngularJS. However, since my iPart is built in plain JavaScript, I'm not sure if iMIS injects those attributes in a non-Angular context. Is there a recommended way to pass ContentKey and ContentItemKey to the display iPart at runtime without hardcoding them?

Contact us
Copyright © Advanced Solutions International, All rights reserved.