Skip to main content

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?

 

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):

  1. URL
    ‍{Workflow Context:Current site URL}‍/_api/web/lists/GetByTitle('‍{Workflow Context:List Name}‍')/items(‍{Current Item:ID}‍)‍‍‍‍
  2. Method
    POST

  3. Headers
    Content Type: application/json;odata=verbose
    Accept: application/json;odata=verbose
    X-RequestDigest: {REQUEST DIGEST VALUE - how to obtain, read here: How to execute a SP2013 REST API request with Nintex Workflow, or if for some reason this solution doesn't work, read my post: Working with security credentials (RequestDigest, FedAuth, rtFa)}

  4. Body
    Content ({Workflow Context:List Name} is a variable, and 'Hyperlink'  is the internal name of the URL column, btw )
    {  
       '__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.



    In the end, the actual "Body" of the request is this variable.



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:

  1. select option checkbox "XML" under "Fields to update"
  2. use following XML

    <?xml version="1.0" encoding="utf-8"?><MetaDataCollection xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><MetaData><Key>URL_InternalFieldName</Key>
    <URL><Url>https://nintex.com</Url><Description>Nintex Website</Description></URL></MetaData></MetaDataCollection>
  3. Save Action without changing or switching back the option checkbox "Builder"

Problem or limitations by XML option:

  • Use of Workflow Context properties, Workflow Variables is not possible!
  • Only hardcoded text values

I can't find this option. Is this in the 'Update List Item' action?
This is the "Office 365 Update Items" action not the 'Update List Item' action.

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} 


Sorry, I got the order wrong on my previous reply. It should be {URL};{DisplayText}.


Reply