none
PowerShell, project calculation service RRS feed

  • Question

  • I have a custom project field, type number, formula = 100 - [OtherField]. When I open the project in project pro or edit it in project online and publish, the custom field updates (or populates for the first time). When I call the methods in PowerShell I've used successfully for checking out and publishing, it only seems to work on text-based custom fields like a concatenation.

    $projContext.Load($projContext.Projects)
    $projContext.ExecuteQuery()
    $draftProject = $project.CheckOut()
    $draftProject.Publish($true) | Out-Null
    $projContext.ExecuteQuery()

    However, this field is one that relies on math, so I'm wondering if it really needs the project calculation service? I've seen plenty of posts about people who have gotten this to work who have an installation of project server, but I haven't been able to translate those to, or find a direct example of, how to do that in project online.

    .Update() implies it should cause a save, and I followed it publish/ execute, but it doesn't seem to call the calculation service. As I understand, only "QueueUpdateProject2" would, but I haven't found how to call that.

    Some posted a great example of "tricking" this by adding some tasks temporarily, but it's for server, not online, and I haven't been able to work out how to make it work for project online.

    Has anyone had success with updating number-based calculated fields through PowerShell for Project Online? Is there really no method that calls the calculation service for a draft project? I appreciate anyone willing to share their experience or take on the challenge.


    Ian


    Friday, October 13, 2017 3:05 PM

All replies

  • ok... definitely still interested in such a method so as to force a recalc, however, my immediate need is solved by understanding that I needed to enact some change on some project field. As soon as I did, the methods above worked to recalc. It's odd, however, that would be a requirement... since at any point you could add a custom field without wanting to change any of the other existing fields' values.

    PS, apparently the service is smart enough to know that if you aim to overwrite a field's value with the same value, that's not actually a change, so best to create some "scratch" / temp field you can goof around with to cause other fields to recalculate if you change a formula... or do an export, change all the values, then change them back.

    I'll keep this open a few days in case someone has the method to do a recalc without using what I'd view as a workaround.


    Ian


    Friday, October 13, 2017 6:19 PM