Skip to main content
Jake7732
Inspiring
December 18, 2018
Answered

Select all MSO's and change to state 2

  • December 18, 2018
  • 1 reply
  • 704 views

Hi,

I am setting up a price guide where I have the same document that has end user pricing and customer pricing. The only thing changing is the pricing on all pages.

If I setup a multi-state object I have to manually select each one and change it to either state.

Is there a way, or coding, that can change the state of all MSO's at the same time instead of one by one? Or is there a different way I should be doing this?

Thanks!

This topic has been closed for replies.
Correct answer Manan Joshi

Hi Jake,

Did you investigate using Data Merge for this?

-Manan

1 reply

Manan JoshiCommunity ExpertCorrect answer
Community Expert
December 18, 2018

Hi Jake,

Did you investigate using Data Merge for this?

-Manan

-Manan
Jake7732
Jake7732Author
Inspiring
December 18, 2018

This is what I needed.


Thank you!!

Community Expert
December 19, 2018

Hi Jake,

there is also a way to address all MSOs of a document and make the second state the active one.

Are some MSOs nested in other structures like groups?

If not the task can be done like that:

var doc = app.documents[0];

var MSOs = doc.multiStateObjects.everyItem().getElements();

for( var n=0; n<MSOs.length; n++ )

{

MSOs.activeStateIndex = 1 ;

};

EDIT:

Or even faster:

app.documents[0].multiStateObjects.everyItem().activeStateIndex = 1 ;

Regards,
Uwe