cancel
Showing results for 
Search instead for 
Did you mean: 

How to get selected value and {shortName} of PublishingDropDownMenu

janaka1984
Star Contributor
Star Contributor

Hi ,

i have used aikau widget “PublishingDropDownMenu”. here i need to get custom “URL” with {shortName} and “selected value” on publishpayload.

if i use publishPayloadType: “PROCESS”, then it is possible to render {shortName} with url, but selected value can not be processed by using
ProjectStatus: { alfType: “payload”, alfProperty: “value”},.

how can i short out this issue please help?

I used following widget

{
name: “alfresco/renderers/PublishingDropDownMenu”,
config: {
additionalCssClasses: “unmargined no-title”,
propertyToRender: “customProperties.stcpSmiley Tonguehase.value”,
postParam:”prop_stcp_Phase”,
publishTopic: “ALF_CRUD_UPDATE”,
disablementProperty: “node.permissions.user.Write”,//”GROUP_ALFRESCO_ADMINISTRATORS”,
publishPayloadType: “PROCESS”,
publishPayloadItemMixin: false,
publishPayloadModifiers: [“processCurrentItemTokens”],
publishToParent:true,
publishPayload: {

shortName: {
alfType: “item”,
alfProperty: “shortName”
},
ProjectStatus: {
alfType: “payload”,
alfProperty: “value”
},
url:”ivory/vdr-project-update-repo/{shortName}”,

isUpdate: “project-status”,
noRefresh: true

},

optionsConfig: {
fixed: [
{label: I18nUtils.msg(“”,”message.site-visibility-dropdown-public-label”), value: “PUBLIC”},
{label: I18nUtils.msg(“”,”message.site-visibility-dropdown-moderated-label”), value: “MODERATED”},
{label: I18nUtils.msg(“”,”message.site-visibility-dropdown-private-label”), value: “PRIVATE”}
]
}
}
}

Regards

Janaka

1 ACCEPTED ANSWER

ddraper
World-Class Innovator
World-Class Innovator

No, not currently... it's neither possible use multiple payload types, nor does BUILD support token substitution and PROCESS doesn't have access to the received payload. These changes would either require a pull request to Aikau or a feature request for them to be implemented for inclusion in a future release.

The available workarounds on the current latest release (at the time of writing 1.0.89) would be to either extend the PublishingDropDownMenu widget (and extend either the buildPayload, processValue or onPublishChange functions...

...or...

Create an intermediary Service that would transform the payload of the publication and publish it to the CrudService.

...or...

Define a new service rather than rely on the CrudService. This would be my preferred option as it would be the most future proof.

View answer in original post

3 REPLIES 3

ddraper
World-Class Innovator
World-Class Innovator

You want to configure it like this (note: this isn't the exact solution, just an example to highlight how to get the data you want):

{

   name: "alfresco/renderers/PublishingDropDownMenu",

   config: {

      publishTopic: "RM_USER_SECURITY_CLEARANCE_SET",

      publishPayloadType: "BUILD",

      publishPayload: {

         currentItemValue: {

            alfType: "item",

            alfProperty: "shortName"

         },

         dropdownValue: {

            alfType: "payload",

            alfProperty: "value"

         }

      },

      propertyToRender: "name",

      optionsConfig: {

         fixed: [

            {value:"1"},

            {value:"2"},

            {value:"3"}

         ]

      }

   }

}

The key thing to note is that we're using the "publishPayloadType" of "BUILD". This allows the payload to use the "alfType" and "alfProperty" attributes to construct a value - this makes it possible to distinguish between values takes from the currentItem object the received payload.

In this case the received payload is the change in value of the drop-down menu... so if the user selects "2" from the drop-down menu, and the "shortName" attribute of the currentItem is "site1" then the published payload will be:

{

   currentItemValue: "site1",

   dropdownValue: 2

}

Hopefully that makes sense, let me know if not.

i hope to use publishTopic: "ALF_CRUD_UPDATE"  instead of custom topic.

therefore i need to pass whole URL with dynamic site id  (e.g: url:"ivory/vdr-project-update-repo/{shortName}" ) within  "publishPayload" . this can not be done with "BUILD" type.

if i use type "PROCESS", i can not use  this dropdownValue: {  alfType: "payload", alfProperty: "value"           } 

is there any way to use both together?

ddraper
World-Class Innovator
World-Class Innovator

No, not currently... it's neither possible use multiple payload types, nor does BUILD support token substitution and PROCESS doesn't have access to the received payload. These changes would either require a pull request to Aikau or a feature request for them to be implemented for inclusion in a future release.

The available workarounds on the current latest release (at the time of writing 1.0.89) would be to either extend the PublishingDropDownMenu widget (and extend either the buildPayload, processValue or onPublishChange functions...

...or...

Create an intermediary Service that would transform the payload of the publication and publish it to the CrudService.

...or...

Define a new service rather than rely on the CrudService. This would be my preferred option as it would be the most future proof.

Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.