1

I have a site collection at https://extranet/sites/mysite, represented as URL below, that contains a list (A). I then have a subsite with a list (B) at URL/subsite. When an item is added to B a workflow is triggered. The first part, through REST, sums up all the items (total column) in the same category and stores it in a workflow variable. This part is working.

What I am then trying to do is update a budget list in the root site with the new total (the only field that this workflow needs to update). For this part I have tried the following (I put the contents of dictionaries I built below the build step):

Set Variable: url to URL/_api/contextinfo
Build {...} Dictionary (Output to Variable: contextHeaders)
    Accept String application/json; odata=verbose
    Content-Type String application/json; odata=verbose 
    Content-Length String 255

Call [%Variable: url%] HTTP web service with request (ResponseContent to Variable: responseContent |ResponseHeaders to responseHeaders |ResponseStatusCode to Variable: responseCode )

Get d/GetContextWebInformation/FormDigestValue from Variable: responseContent (Output to Variable: digestValue )

Set Variable: url to URL/web/lists/getbytitle('Budget')/items?$filter=(SchoolAndYear0 eq '[%Current Item:School%] [%Current Item:School Year%]')
#Note this does in the browser does return just 1 item

Build {...} Dictionary (Output to Variable: POST_RequestHeader )
    Accept String application/json; odata=verbose
    Content-Type String application/json; odata=verbose
    X-HTTP-Method String MERGE
    IF-MATCH String *
    X-RequestDigest String [%Variable: digestValue%]
    Authentication String <blank> #Nothing is set for this one, I have tried with and without it

Build {...} Dictionary (Output to Variable: POST_Metadata )
    type String SP.Data.BudgetListItem
Build {...} Dictionary (Output to Variable: POST_Parameters )
    __metadata Dictionary Variable:POST_Metadata
    Total Number Variable:schoolTotal #Note Generated earlier in the WF


Call Variable: url HTTP web service with Variable: POST_Parameters (ResponseContent to response |ResponseHeaders to responseHeaders |ResponseStatusCode to Variable: responseCode )

Set Workflow Status to Finished

The responseCode for the last call returns 'BadRequest'.

I was originally getting Unauthorised, started using App Step (which this is all contained within), along with various headers which got me from Unauthorised to Forbidden and now to this point of BadRequest. I'm not sure what I'm missing or if perhaps I'm trying to accomplish something here that is not possible through SPD without, perhaps a custom activity or some other approach? I've also played with eTag's a bit but haven't been successful with that either.

Any help is appreciated. Thanks!

0

I found this article that might apply to what you're doing and what I'm also trying to accomplish:

http://www.fabiangwilliams.com/2014/06/19/gotcha-on-sharepoint-designer-workflows-in-app-step/

  • Did this work for you? It appears it only reads the data of the parent site, which setting up the app permissions I was able to do; however, my end goal was to update a list item in the parent site. Were you able to do this? My workaround to get the product ready in time was to just move that particular functionality up to the parent site and lock down the list using permissions. – Devin Sep 28 '16 at 15:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.