Formatted Email in SharePoint


Let’s start with simple example where we need to frame a table in the body of an email as depicted below:

STEPS:

  • Go to the desired workflow in SharePoint Designer
  • Insert “Send an Email” Action and move the mouse over the action to find out the small inverted triangle. Click on Properties

Email Properties

  • Paste the below code in String builder(…) of BODY column and hit ok button.

string builder

Example 1:

<HTML>
<HEAD>
<STYLE>
table,th,td
{
border-collapse:collapse;
border:1px solid black;
padding:5px
}
th
{ background:lightblue; }
</STYLE>
</HEAD>
<BODY>
<FONT face=Calibri>Hi Admin, </FONT>
<FONT face=Calibri>An item has been created by with below details: </FONT>
<STRONG><U><FONT face=Calibri>DETAILS:</FONT></U></STRONG>
<TABLE>
<TBODY>
<TR>
<TH><FONT face=Calibri>Name</FONT></TH>
<TD><FONT face=Calibri></FONT></TD>
</TR>
<TR>
<TH><FONT face=Calibri>Designation</FONT></TH>
<TD><FONT face=Calibri></FONT></TD>
</TR>
</TBODY>
</TABLE>
&nbsp;
Thanks and Regards,
SharePoint Connect Team
</BODY>
</HTML>

NOTE: Add the lookup field at corresponding cells in the table..

RESULT:

Example 1.PNG

Example 2:

If we need to bring the entire message with in table, go with the below code:

<HTML>
<HEAD>
<STYLE>
table,td
{
border-collapse:collapse;
border:1px solid #e8eaec ;
}
</STYLE>
</HEAD>
<BODY>
<TABLE style="WIDTH: 100%" cellSpacing=0>
<TBODY>
<TR style="BACKGROUND-COLOR: #f8f8f9">
<TD style="PADDING-BOTTOM: 20px; BACKGROUND-COLOR: #f8f8f9; PADDING-LEFT: 20px; PADDING-RIGHT: 20px; FONT-FAMILY: Verdana; FONT-SIZE: 14pt; PADDING-TOP: 20px">
An Item has been created by <FONT color=#ff0000><STRONG style="FONT-VARIANT: small-caps; COLOR: red"></STRONG></FONT>
</TD>
</TR>
<TR>
<TD>
&nbsp;Dear Admin, &nbsp;&nbsp;
&nbsp;Please find the item details below:&nbsp;
<UL style="MARGIN-TOP: 5px; MARGIN-BOTTOM: 5px">
<LI style="MARGIN-BOTTOM: 1px">ID : <B></B>
<LI style="MARGIN-TOP: 1px; MARGIN-BOTTOM: 1px">Name: <B></B></LI>
</UL>
</TD>
</TR>
</TBODY>
</TABLE>
</BODY>
</HTML>

RESULT:

Example 2.PNG

If you are expert in HTML and CSS, you can play with the above code as per your need

Customization of default SharePoint forms


If you wish to change the look and feel of default SharePoint list forms without using SharePoint Designer or infopath, go with the below steps:

  • Save the below code in a notepad and upload it in Site Assets
  • Go to the desired list and click on Add New Item
  • In New Form Page, click on Edit icon or click on Site Actions->Edit Page
  • Click on “Add a Web Part” hyperlink and select Media and Content->Content Editor->Add
  • Edit the web part and provide the url of the uploaded file in Content Link
  • Click Apply and stop editing the page
  • Repeat from step 3 for Display and Edit Forms

ADVANTAGE:

  • Code does not require modification whenever field is added to or removed from the form.

CODING:


<style>
/*Hide Quick Launch*/
#s4-leftpanel
{
display:none;
}
/*Move the content part to extreme left*/
.s4-ca
{
margin-left: 0px;
}
/*Rest of the below code are with respect to the form*/
.ms-formlabel
{
background:#C2D69A; /*Change the color code as per your wish*/
}
.ms-standardheader
{
color:black;
font-weight:bolder;
}
.ms-formbody
{
background:white;
}
BODY
{
color:black;
}
input[type=&quot;button&quot;]
{
background:#C2D69A;
color:black;
font-weight:bolder;
}
.ms-formtable
{
border-spacing:1px;
}
</style>

RESULT:

form

Workflow got Cancelled?


Hi Friends…This time I would like to share one of the reason that workflow gets cancelled. Are you using SharePoint Designer for Workflows? Is the workflow Cancelled? No worries…Follow this article..

Scenario: Email triggered with information about Multiple choice field

To have better understanding, let’s assume we have SharePoint list with below fields:

Name(Title)-Single line of Text

Address- Multiple lines of text

Hobbies- Choice(Checkbox)

Now let’s create a workflow in SharePoint Designer to trigger email to the admin. In the workflow, insert “Send Email” Action with below message:

Hi Admin,
An Item has been created by [%Current Item:Created By%] with below details:
Name: [%Current Item:Name%]
Hobbies: [%Current Item:Hobbies%]

Save it and publish the workflow with required workflow settings(say, start workflow automatically when an item is created)

Now when the user opens the form to fill only Name and Address and leave the Hobbies without any selection, the workflow fails.

So, Always note that when a multi-select checkbox is used in the Email, follow any one of the below rules:

  • Make the multiple choice field as mandatory in InfoPath form
  • Remove Multiple Choice Field from Email Action in Workflow and publish it
  • Create a default choice for multiple choice field(here, hobbies) as “NONE” or “OTHER” as per your wish

 

Radio Button in Infopath browser forms


I heard many times my client saying that they need only radio buttons in infopath and not the drop down because when the fields are created in SharePoint site and customized using infopath, they are automatically converted in to drop down.

Are you too encountering the same problem? Don’t worry. Follow the below steps to convert it to radio button.

EXAMPLE:

To show you the steps, I have created a “Employee Info” list with below fields where Gender is selected as Radio button in choice type.

image001

If New item is to be added, the below form will be opened:

image002

This is the default form of SharePoint list. If you try to customize the look and feel of the list, using infopath, you will find that radio button is converted into drop down field as depicted below:

Gender

To make it as radio button, delete the field from the form view.

NOTE*: Do not delete the control permanently. Just delete it from the view.

In right corner of the infopath, you will see the list of fields with “Show advanced view” link. Click on the highlighted link. If you are not able to see the list of fields, click on the “DATA” menu -> Show Fields available under SharePoint Form Data section.

Fields.PNG

When you click on the field in advanced view, you will see a small inverted triangle. Click on the triangle and select Option button. Enter the number of choices to be inserted.

option button

image005

Type the labels for inserted radio buttons and edit the values in Properties. That is, right click on the radio button, select Properties and type the value in “Value when selected”.

properties.PNG

Alternative approach is to change the control to option button and perform a copy-paste for each choice. Finally, change the value of each choice as shown above in picture.

That’s it!!!

Make the form attractive and publish it.

 

SharePoint Access Denied Issue


We recently faced a SharePoint access issue in one of our SharePoint 2010 site being upgraded to Office 365 with 2010 look and feel. I would like to share the issue with the solution as it might help someone in the future.

Issue:

We added a client X to one of our SharePoint group with contribute permission. As the client was not able to access it, we removed the client from the group and added him again but still he faced the same issue. We tried with different levels of permission which was also a failure. We started to explore the issue much deeper.

What we did is, we just clicked on Site Actions -> Site Permissions -> SharePoint group(in which the user was added) and moved the mouse over the client’s name to open his contact card. There we found the problem! The email id in contact card was x@domain.com where as the current email id isx1@domain.com . We thought his email id was not updated in Active directory. To confirm it, we gave permission to another site and was shocked to see his email id as x1@domain.com. Now the issue was becoming more and more complicated

When we approached our support team, they asked us to remove the client and added him again. We started to do it again but when we removed the user and checked his permission as “None”, he was still existing in “All People” Page. OMG…This is the reason behind the  issue

Solution:

How to go to All People Page in SharePoint 2010? In MOSS 2007 site, when you click on Site Actions-> Site Settings-> People and groups under Users and Permissions, you will find “All People” in Quick Launch as shown below:

moss 2007

But in 2010 site, there is no such link. In order to go to All People Page, use the below url:

https://yoursite.com/_layouts/people.aspx?MembershipGroupId=0

If you are the primary or secondary site administrator, then select the user, remove the user permission and add him again. Now you have granted access to the user with current email id!