The selected user(s) may not be valid on the site this workflow is published on

Hi friends, in this SharePoint 2013 tutorial we are going to solve an issue of email error. While developing SharePoint workflow in SharePoint designer 2013, we need to send an email notifications to the user. Sometimes user may not be valid SharePoint user. These users are called as external users. When you try to add Email ID of such users, we usually get following error.

“The selected user(s) may not be valid on the site this workflow is published on. If a recipient is not a valid SharePoint user, he or she will not receive workflow emails.”

not-a-valid-sharepoint-user-email-error

There are two methods to fix this problem. We can pass the email address through one string variable and other method is to call SharePoint 2010 workflow. We will see both these methods one by one.

Method 1: Using String Variable

Instead of adding email address directly in email setup, save it in one string variable. Here we have created one string variable named TestEmail.

create-string-variable

Now add this string variable in email setup as shown below. Make sure that you are using Return field as Login name.

send-email-via-variable

sharepoint-email

Now click on OK and thats it! Now SharePoint will not show any error message and it will also send email notification to the user.

Let us see another approach for solving this issue.

Method 2: By Calling SharePoint 2010 workflow

Create a separate SharePoint 2010 workflow on the same list so that you can utilise the fields for that list. SharePoint 2010 dont validate the user and you can use external users in it. Now create an action for sending email in 2010 workflow in the same way.

Once created, we can call this 2010 workflow through 2013 workflow using following action.

call-sharepoint-2010-workflow

In this way we can send an email to external users using SharePoint 2013 workflow. I hope you liked this article, please share it with your friends. Like our facebook page and subscribe to our newsletter for future updates. Have a nice day!

Load Different JavaScript for Different Browsers

Hi friends, in this article we are going to learn how we can load different JavaScript for different browsers. Few days ago I was trying to implement back button in one of my html page. The page on which I was trying to implement Back button was loading from one of the auto redirected page.

So this back button was working on Chrome browser but not on Internet Explorer. Chrome is enough intelligent browser and it can detect that the page is from one redirected page. So when we click on back button it will land you to 2 pages back. But Internet Explorer cant have this intelligence.

When I was trying to click on Back button in Internet Explorer, it was loading previous page. As previous page was having auto redirect code so it again goes to same page which was having Back button. So using Back button in Internet Explorer was producing never ending loop. So I thought to implement one trick which will load 2 page back button in IE. This can be implemented by loading Browser specific JavaScript. Using this method we can load different JavaScript for different browsers.

Browser Specific JavaScript

Here we are using Back button which will call goBack() onclick event.

 <input type="button" onclick="goBack()" value="BACK" />  

We all know that we use window.history.go(-1); for loading previous page. But we need window.history.go(-2); to load in Internet Explorer. We can use following code which will load these actions depending on which browsers you are using.

 <script>  
      function goBack() {  
       // Internet Explorer 6-11  
       var isIE = /*@cc_on!@*/false || !!document.documentMode;  
       if(isIE)  
       {  
         window.history.go(-2);  
       }  
       else  
       {  
         window.history.go(-1);  
       }  
      }  
 </script>  

This script can be used to load window.history.go(-2); for IE browser and window.history.go(-1); for browsers other than IE.

I hope you liked this article. If you have any queries feel free to ask in comment section. Please like our facebook page and subscribe to our news letter for future updates.

Customize Workflow Task Form to Add Extra Button

Hi friends, in this post we will see how to customize default SharePoint Workflow Task list in SharePoint 2013. In general there are only two options for SharePoint workflow task, which are Approved and Rejected. If we want some more extra buttons then we have to customise workflow task form. We can easily add new button by adding more options in Task Outcome column.

This is helpful when you need to route your SharePoint workflow based on action more than just Approve or Reject. Just follow below steps to customize workflow task form. These steps are for SharePoint 2013 version but same can be followed for SharePoint 2010.

Add Custom Button in SharePoint Workflow Task List

  1. Open Workflow Task List in web browser
  2. Go to List Settings
  3. Click on Create column
  4. Create a column of type Task Outcome (if you dont have already)Add New button in Workflow Task
  5. Enter options which you want as Task outcome
  6. Click on OK to save the column

Now you can see three buttons for your task, Approved, Rejected and Need more info. Here we have added extra button named Need More Info. See below screenshot of customized workflow task.

 

Customize Workflow Task List

You can add as many options as you want. So this is all about how to customize workflow task in SharePoint 2013. I hope you liked this article. Feel free to ask your doubts in comment section below. Like our facebook page and subscribe our newsleter for future updates.

How to Add New Item Button in Web Part in SharePoint 2013

Hi friends, in this short SharePoint 2013 tutorial we are going to learn how to create a Add New Item button and add it in web part. Actually its very easy to get a link of new item page and using basic html code we can add link of new item anywhere. But if you want an exact same New Item button to add in  a web part you can follow this tutorial.

In this example we are going to Add a New Item button of Employee Details List to a Home Page of Main Site.

Add New Item Button in a Web Part

  1. Open a list in a Chrome web browser
  2. Open Chrome DevTools (Shortcut: F12) or Right click anywhere and Select Inspect Element.
  3. Click on Cursor symbol representing select an element to Inspect it.Chrome DevTools
  4. Now move your cursor on New Item button
  5. Copy the Element HTML codeCopy Add New Item Link
  6. Add a Content Editor Web Part to page where you want to Add New Item Button
  7. Paste the New Item Button code into Web Part
  8. Click on Stop Editing, that’s it!

Note: When you add Web Part you may see the title of Web Part which is sometimes not needed. See Below screenshot.

Remove Content Editor title To Remove this text we have to change Web Part properties. So click on Edit Web Part and select Chrome type as None under Appearance.Edit Webpart

Click on OK to save the changes. See below screenshots.

Chrome Type None

Add New Item Button Link

I hope you liked this article. Please like our facebook page and subscribe to our newsletter for future updates. Thanks! Have a nice day!

 

All About Document Set in SharePoint 2013

Hi friends, In this article we are going to discuss all about Document Set in SharePoint 2013. In general we use Folders to to upload and manage files. We can not use these normal folders to manage a single deliverable, or work product, that can include multiple document or files. In such cases we can make use of Document Set.

What is Document Set in SharePoint 2013?

As discussed already, Document Set is a special feature available in SharePoint Server 2013 that enables organisation to manage work product which includes multiple documents. Document set is a content type that we can add to the library. It is little bit different than a folder and having some additional features than normal folder.

In short we can say, Document set is a collection of documents packed together.

What is the difference between Document Library and Document Set?

You might be confused about difference between Document Library and Document Set. We know that we can upload documents in document library, but do you know we can upload Document Set in Document library and it has the same column as the Document library.

You can use Document set as folder inside Document library. We can use some additional features of Document set which we cant use with normal folder. In short, Document library is a place where documents or document set can be stored.

How to enable and use Document Set in SharePoint 2013?

Step 1: Activate Document Set feature

  1. Open your site in web browser
  2. Click on Settings button (Gear icon) and go to Site Settings
  3. Under Site Collection Administration select Site collection features
  4. Click on Activate button corresponding to Document Set.Activate Document Set in Sharepoint 2013

Step 2: Enable Content Type

To enable the document set for a library we have to enable Document set content type. To enable Document set content type follow these steps.

  1. Open a library where you want to enable Document set
  2. Choose the library settings
  3. Go to advanced settings
  4. Enable “Allow management of content type”
  5. Save changes and go back to Library settings
  6. From content type section click on AddAdd Document Set Content Type
  7. Add the Document Set content type and then save the changesAdd Document Set Content Type 2

Step 3: Adding Documents to Document Set Content Type

  1. Open the Document Library and choose the Files Tab
  2. Select New Document Set Context typeDocument Set Context
  3. Enter the name of the Document SetDocument Set Name
  4. Now your Document Set is Ready for the use. You can add documents later too.Document Set in SharePoint 2013

Here you can see that multiple documents exist in the same document set. Also the Document Library columns are also available for child documents as well.

This concludes our usage of Document set tutorial. Hope you liked this article. Please like our facebook page and subscribe our newsletter for future updates. Thanks! Have a nice day!!!

SPServices Get Current User Name & Set to SharePoint Field Name

Hi friends, In this tutorial we are going to learn how to fetch the current user name and set its value to any SharePoint field. For getting current SharePoint user information we can use SPServices.

There is one utility function of SPServices called SPGetCurrentUser which has the functionality to return information about the current user.

How  $().SPServices.SPGetCurrentUser works?

The SPGetCurrentUser function does an AJAX call to grab /_layouts/userdisp.aspx?Force=True and “scrapes” the values from the page based on the internal field name (aka StaticName).

How to get Current User Name and Set it to SharePoint field?

  1. Open your list new item page.
  2. Click on Settings button (Gear icon) and click on Edit page.
  3. Add Content Editor Web Part.
  4. Copy the following code and paste it in above Web Part.
  5. Click on Stop Editing and its done!

In this example we are getting Name of Current User and setting its value to Full Name field.

<div> 
 <script src="http://code.jquery.com/jquery-1.10.1.min.js"></script> 
 <script src="http://www.myclassbook.org/wp-content/uploads/2016/07/jquery.SPServices-2014.02.min_.js"></script> 
 <div> 
 <script language="javascript" type="text/javascript"> 
 $(document).ready(function() { 
 // Set the "Full Name" input field to the current user's "Title" property 
 var userName = $().SPServices.SPGetCurrentUser({ 
 fieldName: "Title" 
 }); 
 $("input[Title='Full Name']").val(userName); 
 }); 
 </script> 
 </div> 
 </div>

Now whenever you open the page for adding new item in the SharePoint list, you can see the name of current user is auto populated in Full Name field. See screen shot below.

Get Current user name in SharePOint

I hope you have liked this article. Please like our facebook page and subscribe to our newsletter for future updates. Thanks! Have a nice day!

Delete Multiple SharePoint Subsites in Single Click

Hi friends, in this post we will see how to delete multiple SharePoint subsites in single click. We all know that site is collection of objects which includes list, libraries, etc. Similary we create SharePoint subsite to manage different sections of main site.

Sometimes we need to delete these subsites. So let us see how to delete SharePoint subsite.

Delete a SharePoint Subsite

      1. Open your SharePoint Subsite in web browser.Open SharePoint Subsite
      2. Click setting button (Gear Icon) and select Site Settings.SharePoint Site Settings
      3. Under Site Actions, Click Delete this site to delete SharePoint subsite.
        Delete a SharePoint Subsite
      4. Click Delete to confirm the deletion of subsite.Delete a SharePoint 2013 Subsite

Delete Multiple SharePoint Subsite in Single Click

      1. Open your SharePoint Site in Web Browser.
      2. Click setting button (Gear Icon) and select Site Settings.
      3. Under Site Administration click on Sites and workspaces.Sites and Workspaces
      4. Click on delete symbol in front of Subsite.Delete Multiple SharePoint Subsite in single click
      5. Click on delete button to confirm the deletion.

Effect of deleting SharePoint subsite

When we delete SharePoint subsite all the content related to that subsite will get deleted and get moved to Recycle Bin. Following are some of the effects of deleting SharePoint subsite. It will delete following content related to that subsite:

    1. Documents and document libraries
    2. Lists and list data, including surveys, discussions, announcements, calendar
    3. Web site settings and configurations
    4. Permission levels and security information relating to the Web site

Note: You can not delete SharePoint subsite which contain another subsite. If you try to delete such subsite you will get following error:

“There was a problem deleting Web site “/sites/XXXXXX/subsite”. Sites that have subsites or certain apps can’t be deleted. Please try again after deleting all subsites and removing the apps.”
So to delete a SharePoint subsite which contain another subsites, you have to first delete all child subsites.
I hope you liked this post. If you have any queries feel free to ask in comment section below. Please like our facebook page and subscribe to our news letter for future updates. Thanks! Have a nice day!

How to Edit SharePoint 2013 Custom List in SharePoint Designer

Do you want to customize your SharePoint 2013 list? Do you have big number of columns in your list? Do you want to create customize online form for it? If Yes, then this post is specially made for you! In this post we will edit custom list in SharePoint Designer 2013.

Let me explain you in brief about what exactly we are going to do in next half an hour. Suppose you have a list with 50 columns. Now when you create a new item in your list, it becomes a big form with scrollbar, which is not user friendly. So what if we make sections of those columns and make an online form like structure which has different sections to be filled by user? Sounds great, right?

Customize SharePoint List

For making step by step tutorial for this customization of list, I have created one list named TestList. In this list I have columns named Title, First Name, Last Name, Employee Number and Contact Number. Now when you try to create a new item in this list, you will see a form like this:

Customize SharePoint List

Now here we have only 5 columns so its looks good, but what if you have 50 columns? Does it looks great? Say you have 10 fields for Personal information, 10 fields for address and so on. So we can make section of these fields and can make online form with it. Just click on section to expand or collapse the fields. We can make it possible through SharePoint Designer. So let us start customizing SharePoint list step by step.

Step 1: Open you list in SharePoint Designer (SPD 2013). By default there are three forms: NewForm.aspx, EditForm.aspx, DispForm.aspx. So click on New button under Forms section to create New Custom Form.Now we want to create custom form for New Item, so enter name for your new form (NewCustomForm) and click on New Item Radio button. Keep other fields as it is and click OK. Similarly you can follow this step for Display form and Edit form.

New Form button

Create New Custom Form in SharePoint Designer

Step 2: You can now see NewCustomForm in Forms section. Click on it to customize our list. Now the coding part starts here!

NewCustomForm

We want to make two sections as Section A and Section B. We will put Title, First Name and Last name in Section A. Also Employee Number and Contact Number in Section B.

So find <tr> tag for Title field and paste the following code just above it.

 <div id="divSectionA" style="background-color:gray; cursor:pointer; height:26px; width:74%; background-color:orange; color:black; font-weight:bold; margin-bottom:3px">Section A</div>  
 <tbody id="bodySectionA" style="display:none; border:medium; border-color:orange" >  

 

Similarly find </tr> tag of last field of this section that is Last Name and end the <div>, <tbody> and one more tag of <table>. So our code will look like this:

    <table border="0" cellspacing="0" width="100%">
        <div id="SectionA" style="background-color:gray; cursor:pointer; height:26px; width:74%; background-color:orange; color:black; font-weight:bold; margin-bottom:3px"> Section A</div>  
        <tbody id="ASection" style="display:none; border:medium; border-color:orange" >  
               <tr>  
               ..........
               </tr>  
               <tr>  
               ..........
               </tr>  
               <tr>  
               ..........
               </tr>  
        </tbody>  
    </table>  

 

Now to add Section B for Employee Number and Contact Number fields copy same code after </table> tag of first section. Make sure that we have to add one more <table> tag for section B. So our code for Section B will look like this:

     <table>  
        <div id="divSectionB" style="background-color:gray; cursor:pointer; height:26px; width:74%; background-color:orange; color:black; font-weight:bold; margin-bottom:3px"> Section B</div>  
        <tbody id="bodySectionB" style="display:none">  
               <tr>  
                               
               </tr>  
               <tr>                                
                           
               </tr>  
        </tbody>  

 

Now here we don’t need to close <table> tag manually because there is </table> tag already available which was for first <table> tag.

Step 3: Now we have to include the jQuery in the page. So find the below code in your page

 <script>  
      var elm = document.getElementById(&quot;idAttachmentsTable&quot;);  
      if (elm == null || elm.rows.length == 0)  
      document.getElementById(&quot;idAttachmentsRow&quot;).style.display=&apos;none&apos;;  
 </script>  

 

and paste below code just after above code:

 <script src="//code.jquery.com/jquery-1.10.1.min.js" type="text/javascript"></script>  
 <script language="javascript" type="text/javascript">  
      $(document).ready(function() {  
        $(&quot;#divSectionA&quot;).click(function(){  
           $(&quot;#bodySectionA&quot;).toggle();  
        });  
        $(&quot;#divSectionB&quot;).click(function(){  
           $(&quot;#bodySectionB&quot;).toggle();  
        });  
      });  
 </script>  

 

That’s it! You are done! Now your form will look like this.

Customized SharePoint List

Finally make sure that you have selected NewCustomForm as default. To make this form as default, Select the form in Forms section of SharePoint Designer. See below screenshot.

Selecting default form in SharePoint 2013

If you have any queries, feel free to ask in comment section below. Subscribe to our newsletter and like our facebook page for future updates. Have a nice day!

How to Hide Column Fields in SharePoint 2013

Hi friends, today we are going to learn: How to hide column fields in SharePoint 2013. There are two methods by which we can hide a column field from new item form. One method is by using SharePoint OTB (out of box) settings and other is by using CEWP (Content Editor Web Part). We can also hide fields in Display item and Edit Item forms.Let us see these methods one by one.

In this example I have Employee Details list and having columns as shown in below screenshot. Here we are going to hide a column named Country.

Employee Details previous1) Using OTB settings for hiding column fields

a) Go to list settings

List settings

b) Go to Advanced settings and allow management of content type as Yes and click on OK.

List Advanced Settings

Allow management of content type

c) Now click on Content type which you have created or predefined. In my case it is Item, so click on Item.

Content type

d) Now click in column name which you want to hide from newitem.aspx.

Column fields

e) Now select “Hidden” option and click on OK.

Hide column fields

Thats it. Now you can see Country field is hidden from newitem.aspx page. See screenshot below.

Employee Details new2) Using CEWP to hide column fields in SharePoint 2013

Now we will see how to hide column fields using CEWP (Content Editor Web Part). I hope you are aware of adding CEWP into a sharepoint page. You can refer this article on adding CEWP.

Before proceeding further make sure that we are using javascript for making these changes. So you need to upload jquery.min.js and sputility.min.js files in your document library. I have used Shared Documents library for these files. You can read this article for your reference on how to upload and get the links of those files.

Copy the following script into CEWP and change the red colored links with your own one. You can use this script to hide fields in DispForm.aspx and EditForm.aspx also.

<script src="/examplesite/Shared%20Documents/jquery.min.js"></script> 
<script src="/examplesite/Shared%20Documents/sputility.min.js"></script> 
<script>
$(document).ready(function(){
{
 SPUtility.GetSPField('Country').Hide();
};
});
</script>

I hope you liked this article. please subscribe to our newsletter for future updates and like our facebook page. If you have any queries feel free to ask in comment section below.

Change the button text & button action in sharepoint 2013

Hi friends, in this short tutorial we are going to learn: How to change the button text in SharePoint 2013 by using content editor web part. We will also learn how to change the action performed by that button.

Change Button Text in SharePoint 2013

Let us take an example for changing the text of “Close” button to “Back”. We will also change the action of this button. Initially “Close” button action is closing the current item/task etc. So will change the button to “Back” and it will take user to previous page.

Before proceeding further make sure that we are using javascript for making these changes. So you need to upload jquery.min.js and sputility.min.js files in your document library. I have used Shared Documents library for these files. You can read this article for your reference on how to upload and get the links of those files.

Use the following script for changing the text of button in newitem.aspx or any other page.

<script src="/examplesite/Shared%20Documents/jquery.min.js"></script>
<script src="/examplesite/Shared%20Documents/sputility.min.js"></script>
<script>
 $(document).ready(function(){
 {
  $("input[value$='Close']").attr('value', "Back");
  $("input[value$='Back']").click(function(){
   window.location.href = 'javascript:javascript:history.go(-1)';
  });
 };
});
</script>

In this code,

$(“input[value$=’Close’]”).attr(‘value’, “Back”);

will change “Close” button text to “Back”.

$(“input[value$=’Back’]”).click(function(){

  window.location.href = ‘javascript:javascript:history.go(-1)’;

});

This function will change the action for “Back” button which will go to previous page.

I hope u liked this article. Subscribe to our newsletter for future post and like our facebook page. If you have any doubts feel free to ask in comment section below. Have a nice day!