0

I know my HTTP call is working fine; I can create an item in another site.

The problem: I am trying to retrieve the newly created item ID, to use in a link included in an email. So I tried to create variables, and log these variables results in my workflow history. However, every variable results return a 0. Picture of my logs entries:

Variable results

My target columns: Title (contains last name) - Single line of text FirstName - Single line of text Gender - Choice Position - Single line of text SupervisorName - Person or group

My workflow (Sorry, no picture here; everything would be in French anyway):

Call [%CurrentSiteURL%] HTTP web service with Variable:parameters (ResponseContent to Variable:response | ResponseHeaders to Variable:header | ResponseStatusCode to Variable:responseCode)

Get d/results from Variable:response(Output to Variable:response)
Get Id from Variable:response(Output to Variable:theNewItemId)
Log theNewItemId
Get d/results from Variable:response(Output to Variable:requestAnswer)
Log requestAnswer
Get d/results/Title from Variable:response(Output to Variable:titres)
Count titres (Output to Variable:nombre)
Log nombre
Get /Id from Variable:requestAnswer(Output to Variable:newitemid)
Log newitemid
Get d/results(0)/ID from Variable:response(Output to Variable:number)
Log number
Get Current item:ID from Variable:response(Output to Variable:responseID)
Log responseID
Get d/id from Variable:response(Output to Variable:did)
Log did

My variables:

  • theNewItemId : Integer
  • requestAnswer : Dictionary
  • nombre : Integer
  • newitemid : Integer
  • number : Integer
  • responseID : Integer
  • did : Integer

Tried those earlier (same result)

  • itemID : Number

  • nouvelElementID : Integer

I'm at my wits' end. Like the famous song, "Won't you please, please help me?"

  • Is there any field in the data you send in the HTTP call that is unique for every item? – Sergio Jan 27 '18 at 3:02
  • I edited my question to include my target columns. As one can see, there are no really a unique field, sorry. – The girl with red hair Jan 29 '18 at 13:15
0

As you have mentioned, there is no unique field sent. In this case, I would create and send a unique field, something like this:

{
    "Title": "aaa",
    "FirstName": "bbb",
    "Gender": "ccc",
    "SupervisorName": "ddd"
    "SentID": 1 
}

So, after you create the item in the other list through the HTTP call, you might be able to retrieve this item by the SentID through another HTTP call. Then, you could get the ID you want.

  • OK. What you mean is there is no OOTB way to retrieve the newly created item ID ?!? I guess then my best bet is to make another call in the same workflow, of type GET and retrieve the last item's ID and pass it in my email link. Something like .../_api/web/lists(guid'blablabla')/items?$select=Id&$orderby=Id desc&$top=1 – The girl with red hair Jan 29 '18 at 18:50
  • I don’t think there is an OOTB way to do that. You could retrieve easily the latest created item ID if it were on the same list, but this isn’t the case. If you do what you say, imagine there are two HTTP calls really together, maybe when you retrieve last item’s ID, you wouldn’t get the item’s ID you want, you know what I mean? That’s why I say to you to send a unique ID and then make another HTTP call based on that “SentID”, then to get the ID o the item you retrieve after creating item. As an alternative you could code your workflow in C#, you have more control. – Sergio Jan 29 '18 at 21:35

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.