cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Help us improve the PTC Community by taking this short Community Survey! X

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

AS_10747835
4-Participant

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

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.

ACCEPTED SOLUTION

Accepted Solutions

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

View solution in original post

3 REPLIES 3

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

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?

 

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

Announcements

Top Tags