Query for the Item Next Promotion States
Copy
You want to get the next promotion states for an Item and use the states as the choices for a dropdown control.
Technique
Use the item action getItemNextStates
to get the next state values. This recipe assumes there is a select input field on the form for us to populate with state values.
HTML
<select id="mySelect"></select>
JavaScript
var results = document.thisItem.apply(“getItemNextStates”);
var nextStates = results.getItemsByXPath('//Item[@type="Life Cycle State”]’);
var count = nextStates.getItemCount();
var oSelect = document.getElementById(‘mySelect’);
for (var i=0; i<count; ++i) {
var item = nextStates.getItemByIndex(i);
var opt = document.createElement(‘option’);
opt.text = item.getProperty(‘name’);
oSelect.add(opt);
}