cancel
Showing results for 
Search instead for 
Did you mean: 
wimvdv
Nintex Newbie

Workflow for O365: O365 Update Item Action (Fields to update: HyperLink)

Jump to solution

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?

Labels: (1)
0 Kudos
Reply
6 Replies
Automation Master
Automation Master

Re: Workflow for O365: O365 Update Item Action (Fields to update: HyperLink)

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

  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

Reply
wimvdv
Nintex Newbie

Re: Workflow for O365: O365 Update Item Action (Fields to update: HyperLink)

Jump to solution

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?

0 Kudos
Reply
Automation Master
Automation Master

Re: Workflow for O365: O365 Update Item Action (Fields to update: HyperLink)

Jump to solution

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

Reply
wimvdv
Nintex Newbie

Re: Workflow for O365: O365 Update Item Action (Fields to update: HyperLink)

Jump to solution

Thanks REST API it will be than :-)

0 Kudos
Reply
Automation Master
Automation Master

Re: Workflow for O365: O365 Update Item Action (Fields to update: HyperLink)

Jump to solution

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

Reply
zied_kallel_3
Nintex Newbie

Re: Workflow for O365: O365 Update Item Action (Fields to update: HyperLink)

Jump to solution

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
Reply