Using Nintex Online we would like to update a field of type HyperLink, of an item using the O365 Update Item action.
We would like the option to pass the url (Web address) value and the Description to have a user friendly looking url in our Hyperlink field.
Does anyone has an example on how to achieve this with the Fields to Update options Builder and XML for this action?
Which syntax should be used?
Solved! Go to Solution.
Yeah.. That is not easy as the "Description" and "URL" are kept in separate columns in SharePoint content database... So you cannot use CAML query and the actions office 365 update items action, when you choose the field type "URL" doesn't provide you separate fields for link and description:
I thought that maybe the idea posted here: how to set a hyperlink field would work, but without a success.
Other actions, like update list item or "set field in current item" doesn't provide the interface either
But hey, there is the REST API to the rescue!
You can achieve it using the REST API in fact. The web request action should be configured that way (assuming you are working in the current site, on the current item):
{Workflow Context:Current site URL}/_api/web/lists/GetByTitle('{Workflow Context:List Name}')/items({Current Item:ID})
{
'__metadata':{
'type':'SP.Data.{Workflow Context:List Name}ListItem'
},
'Hyperlink':{
'__metadata':{
'type':'SP.FieldUrlValue'
},
'Description':'Nintex',
'Url':'http://nintex.com'
}
}
There is one trick with the Body. There is a bug in Nintex, that prevents you from pasting JSON string directly. But there is a workaround. I do it that way: first I replace all braces ({ and }) with square brackets ([ and ]). Then such string I put in the regular expression action and I configure it to replace all opening, square brackets with braces:
Then the output I again put in regular expression action to replace all closing square brackets with braces.
And that's it
Regards,
Tomasz
Thank you Tomasz, the info you provided is very helpful.
I just have one question in my scenario I'm in a root site and need to write this url to an item in a sub site.
Could this also be achieved with a REST call?
Any Idea how the XML option instead of the CAML Builder option could help here?
Of course, with REST you can update item in any site/ subsite of your tenant.
With the XML would be the same problem as with the CAML imho. Try googling, I must admit I have never had such requirement and was never wondering how to do that
Regards,
Tomasz
Thanks REST API it will be than :)
You can mark my answer as correct if you find it as a solution for your question, or wait until you test it out
Its important because other users will know they can find here a solution if having similar question.
Regards,
Tomasz
Tomasz Poszytek Good solution but a bit complicated for some cases..
Here is another solution:
Problem or limitations by XML option:
I was having this same issue, trying to populate a hyperlink field from a workflow. Using the method I used in SharePoint 2013, setting the field to {Display Text}, {URL}, wasn't working in SharePoint Online. But replacing the comma and space with a semicolon worked for me - {Display Text};{URL}