Expand my Community achievements bar.

Come join us for our Coffee Break next week on top takeaways from Adobe Summit!
SOLVED

identify newest baseline in an array

Avatar

Level 5

I'm currently building a scenario in which a change to the project planned completion date triggers the creation of a new baseline for that project.  In cases where the project has existing baselines, I'd like to set the most recently entered baseline as the default baseline before creating the new one.

I have 3 baselines in my sample project:

  • Original [created by WF when the project was marked Current]
  • Baseline02
  • Baseline03

I was playing around, and I've been able to (1) sort the baseline array by name; (2) get the ID for Baseline03 based upon the sort; and (3) use the ID in a Custom API module to set Baseline03 as the default baseline.

Although this works, I thought it might be cleaner if I could sort the baseline array by the baseline entry date (rather than worry about our naming conventions for baselines).  entryDate is listed as a field in the Baseline object in the API, but I can't seem to sort the array using it as a key.

Is this even possible?  Is there a better way to identify the newest baseline?

Thanks.

1 Accepted Solution

Avatar

Correct answer by
Level 1

Hello,

 

I assume you are using a custom API call to get the collection of baselines.  If you only want the latest one, here is how I would setup that query: 

dale_whitchurch_0-1707918507070.png

Then, in the resulting array with one item, the ID will be in the first index of the data[] array.  Hope that helps

View solution in original post

2 Replies

Avatar

Correct answer by
Level 1

Hello,

 

I assume you are using a custom API call to get the collection of baselines.  If you only want the latest one, here is how I would setup that query: 

dale_whitchurch_0-1707918507070.png

Then, in the resulting array with one item, the ID will be in the first index of the data[] array.  Hope that helps

Avatar

Level 5

I had been using the Read a record module for the project and selecting Baselines under Collections to pull in the array.

I'm new to working with custom APIs, but your method is much easier and cleaner and works in my scenario.  Thank you!