Hi!
Can you clarify your issue a bit? Do IÂ understand you correctly, that you want to subtract number of available day per user, once his request for a specific absence type is approved?
In such case - just use the "Update List Item" action to set the new value. You are right - you cannot do it dynamically, ex. in a single action get current value, subtract it and update.
You first need to get the current value, using a "set variable" or any other action, where you can set a variables value using "advanced lookup". Then subtract it and finally using the "Update List Item" action set the new value.
Regards,
Tomasz
Hi Tomasz,
My issue comes when i have to select which field is needed to update.
On list B i got a register with Person A - Type1 - Type2 - Type3 where TypeX are the remaining hours for an specific type of absences.
On the listWF on listA, the person is selecting 1 type of absences from a dropdown (Type1 - Type2 - Type3).
After the WF is approved I need to update the remaining hours for the selected type of absence.
Using the UpdateListItem action, it is not possible to assign a WFvariable where I saved the Type on the field to update right?
Which would it be the best solution? Making as many conditional branch as types there are, and update the type depending on the branch or it would be better to use WebService calls?
Thanks for all,
Hold your horses
Right, so once again the scenario:
- You have two lists - users' leave requests (A) and users' leave quotas (B).
- User places new leave request on a list A
- The request gets approved
- Now you need to subtract the approved amount, for the approved leave request type, for a specific user, from the list B.
I see two options. Ok, three to achieve what you need:
- The "Update List Item" action allows you to provide just a single "filter" rule. So you can select an item to be updated using ex. the user as a comparison. To overcome it, you can query all the quotas, that belongs to the requester, then subtract the one, that got approved, and then using the action update all quotas, having in mind, that in the end only one will be changed.
- OR you can do, as you wrote - create a switch action, and in each branch of that switch do an update of a specific quota.
- OR you can use the "Office 365 Update Items" action (be aware, it requires much more time for completion, as it is executed outside of your tenant) and in the "Fields to update" dynamically pass the field name you want to update. This approach is far more the most flexible, so in case you add a new absence type, you won't need to update the whole workflow
Please, let me know if the information I provided helped you.
Regards,
Tomasz
Hi Tomasz,
It's so useful, just a question.
I tried to fill the field value under Fields to Update with a WFvariable named AbsenceType and that brings the column name that I want to update. I'm filling it that way:
But it is not working...any special format to the field that i have to use?
Thanks again!
Be sure the field, on the list B ist the "Number" type. Maybe you have used a different type. Also - check if the display name is equal to internal name of the column you want to update. You should provide there the internal name, but... maybe try also with the display name
Not working mate
The internal name is Maternidad, same as display name.
The type of the field is Number.
If I hardcode Maternidad on the field it is being updated properly.
I'll go for "option B", but I have like 10 types of absence, and it will be a very "ugly" WF development.
Kind regards,
That may be the reason... If you pass column name as a variable it doesn't work. But still, this is weird. It should have!
Are you sure your variable contains a correctly typed value, correct size of cases, no white spaces?
If still no luck, then the last possible solution is to use the "Call HTTP Web Service" action, knowing the ID of the item, from the list B you want to update:
The "var_Headers_Dict":
The "var_Body_Metadata_Dict":
The "var_Body_Dict" (your <qouta-field> along with the value should be set dynamically):
Check it out. That solution should do the trick. Also, get more familiar with the SharePoint REST Endpoints documentation here: Lists and list items REST API reference .
Regards,
Tomasz
Hi Tomasz,
Same response, I'm not able to set the <quota-field> as a dynamic value
Am I doing something wrong or is it just impossible to achieve that via dynamic values?
If I put one of the column Names hardcoded where now you see {Variable:TipoA...} it is working, but if I try to set the value from a WFVariable, there's no way.
Keep in touch,
Regards,
Err... Right. My fault. You cannot set it there dynamically.
So the only approach left is the "Web Request" action, where you build headers and URL request strings dynamically. You have to build the whole request body yourself.
The only thing, to keep in mind - Nintex Workflow has problems with string variables starting and ending on brackets { and }).
To achieve that, simply create a string, having ex. ### in the beginning and @@@ in ending, and then replace them using "regex" action with { and }.
Regards,
Tomasz
Well, I cannot make it work.
Â
Getting a 403 Forbidden on the WebRequest.
Â
Logs:
Â
bodyAsString before Regex: @@@"__metadata":@@@"type":"SP.Data.HorasVacAusenciasListItem"###,"Paternidad":5###
bodyAsString after Regex: {"__metadata":{"type":"SP.Data.HorasVacAusenciasListItem"},"Paternidad":5}
BodyAsString: {"__metadata":{"type":"SP.Data.HorasVacAusenciasListItem"},"Paternidad":5}Â Â Â Â Â Â
ResponseCodeStatus: <?xml version="1.0" encoding="utf-8"?><m:error xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"><m:code>-2130575251, Microsoft.SharePoint.SPException</m:code><m:message xml:lang="es-ES">La validación de seg
httpStatusCode: 403Â Â Â Â Â Â
ResponseHeaders: e"Transfer-Encoding=chunked","Cache-Control=private, max-age=0","Content-Type=application/xml;charset=utf-8","Expires=Sun, 22 Oct 2017 12:15:52 GMT","Last-Modified=Mon, 06 Nov 2017 13:15:52 GMT","Set-Cookie=rtFa=qLUzvLUGEhzu/ZUdn8BÂ Â Â Â Â Â Â Â Â
responseCookies: "temp=","FedAuth=77u/PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48U1A+VjMsMGguZnxtZW1iZXJzaGlwfDEwMDMwMDAwYTQ4MDBjMTFAbGl2ZS5jb20sMCMuZnxtZW1iZXJzaGlwfHRva2lvdGFAYXJpdGV4Lm9ubWljcm9zb2Z0LmNvbSwxMzE1NDQ0Nzc1MTAwMDAwMDAsMTMxNDÂ Â Â Â Â Â Â Â Â Â Â Â Â Â Â
Â
I attach an image of the WebRequest:
Â
Â
Keep in touch,
Thanks in advance,
Â
Best regards,
Uh.. This is really hard to debug it that way  Make sure the account you are using has sufficient permissions (right, you surely use the account having sufficient permissions ).
Maybe try removing login and password from your action. Or try to put the action inside the "Action Set" with elevated permissions.Â
You can as well try to execute the action using ex. Postman to check, if that really works for you.
THE LAST option is to obtain rtFA and fedAuth cookies and use them as the header parameters (Working with security credentials (RequestDigest, FedAuth, rtFa)).
Regards,
Tomasz
Hi again,
About Working with security and credentials...
On the step 6, The "Cookie" response header is the 6th element in the collection, I'm not getting the cookies, I'm getting other values. I reviewed some other properties by index and I'm not able to find the Cookies.
Any change on that post?
Any documentation on that?
AS last question, is there an easy way to log more than 256chars? Or debug to see a Variable while the WF is being executed?
Thanks,
Regarding the cookie - are you using the "modern site" or the old one?
Sorry, that has nothing in common. Try my answer from the blog post - have you tried simulating this requests with Postman app for example?
Regarding 255 limit - no. The only way is to send yourself an email with the data
Regards,
Tomasz
What do you mean by modern site or the old one? The Experience set on SharePoint Online?
If it's that, is a modern site.
I'll send me an email then, thanks for the suggestion.
Keep in touch,
Regards
Still getting an 403 Forbidden response when using FedAuth and rtFa.
With PostMan or with the WebRequest, bot are responding with the 403.
Any sugestion? (Executed WF as SiteCollectionAdmin, with granted permissions, and tried it inside an Action Set)
Regards,