Skip to main content
4-Participant
January 5, 2024
Solved

need API for set state in promotion request for promotion object iterations in same revision.

  • January 5, 2024
  • 1 reply
  • 1286 views

Hi, Myself Akash,
here in Promotion Request, having set object state event that contains below expression (screenshot)

AS_10747835_0-1704471474797.png

this expression only setting to iteration which is added as  a promotion Object, below iterations are still having same previous state. 
need API for set state all iterations in same revision of Promotion Object.

Best answer by HelesicPetr

Hi @AS_10747835 

That API does not exists. You need to create own method where you set the state to all iterations of the object.

OOTB each iteration can be in different state.

PetrH

1 reply

HelesicPetr
22-Sapphire II
22-Sapphire II
January 5, 2024

Hi @AS_10747835 

That API does not exists. You need to create own method where you set the state to all iterations of the object.

OOTB each iteration can be in different state.

PetrH

4-Participant
January 5, 2024

If you knows please suggest few methods.

i can write a method inside expression page of that robo or write it in workflow helper java file?

 

HelesicPetr
22-Sapphire II
22-Sapphire II
January 8, 2024

Hi @AS_10747835 

You can try this code:

if (primaryBusinessObject instanceof PromotionNotice)
{
	PromotionNotice promotionNotice = (PromotionNotice) primaryBusinessObject;

	QueryResult qr = null;
	State newState = promotionNotice.getMaturityState();
	try
	{
		qr = MaturityHelper.service.getPromotionTargets(promotionNotice);
	} catch (WTException e)
	{
		e.printStackTrace();
	}

	WTList objectToSetState = new WTArrayList();
	while (qr.hasMoreElements())
	{
		objectToSetState.add(qr.nextElement());
	}
	try
	{
		if (!objectToSetState.isEmpty())
		{
			LifeCycleHelper.service.setLifeCycleState(objectToSetState, newState, true);
		}
	} catch (WTException e)
	{
		e.printStackTrace();
	}
}

PetrH