Skip to main content

Posts

Showing posts from July, 2017

SharePoint 2013 update hyperlink field URL and Description using SharePoint Designer Workflow

To update a hyperlink field URL and Description using SharePoint Designer workflow in SharePoint 2013, following steps can be used.

1. In SharePoint Designer Workflow and create a variable by clicking on 'Local Variables'.

2. Name the variable as 'hyperlinkVal' and type as 'String'.

3. From the top ribbon click ⇛ "Action" and select "Set Workflow Variable".





4. Now select the hyperlinkField and set the value as follows  "{URL}", "{Description}"     "https://url", "Click Link"
In the first part, provide the Url and in the second part give the description. Note that there is a blank space after ','.   
5. Now click on top ribbon ⇛ 'Action' ⇛ 'Set Field in Current Item' action (To set hyperlink field in the list/library)

 6. Select the hyperlink field and set the value of hyperlink. Select "Data Source" as "Workflow Variables and Parameters" and Select the variable &quo…

Start a SharePoint Designer 2013 workflow​ from another workflow using REST api

In SharePoint 2013, Microsoft introduced the new Workflow manager for managing the SharePoint 2013 workflow which needs to be installed separately. At the same time, the workflow service (2010 workflow) was retained as same. So by doing this, we have the option to create both SharePoint 2013 and SharePoint 2010 workflows using SharePoint Designer 2013.

Many new features were introduced in 2013 workflows such as stages and REST calls within workflow which definitely makes workflow a powerful tool for a developer.

Another interesting feature is the ability to trigger a 2010 workflow from the 2013 workflow. This will give the developer capability to club both the workflows together in order to achieve complex functionalities.

But there is one drawback, we don't have an out of box option in SharePoint 2013 workflow to start another 2013 workflow. Only a SharePoint 2010 workflow can be started.
But we do have an interesting alternative approach to achieve this using REST API call from a S…

JavaScript replace all commas in a string ?

JavaScript replace function can be used to replace a part of string inside a string variable.Take an example string - "one, two, three, four" Using JavaScript replace function
var str= "one, two, three, four"; str= str.replace(',',''); - but this will replace only the first occurrence of "," which will give the result as 
"one two, three, four"
if you want to remove all occurrences of the string, following RegExp can be used.
var str="one, two, three, four";str.replace(/,/g ,""); This will give output as "one two three four"

Create and Update a hyperlink field in SharePoint using CSOM

To create and update a hyperlink field in SharePoint using CSOM and server side object model, following code can be used.Create a hyperlink field using server object modelusing (SPSite site = newSPSite("Site URL")) { using (SPWeb web = site.OpenWeb()) { SPList list = web.Lists.TryGetList("List Name"); if (list != null) { SPListItem item = list.Items.Add(); SPFieldUrlValue hyperlinkField = newSPFieldUrlValue(); hyperlinkField.Description = "Title of Field"; hyperlinkField.Url = "URL here"; item["Title"] = "New item Name"; item["Hyperlink"] = hyperlinkField; item.Update();} } }
CSOM create a hyperlink field.