Sunday, August 21, 2011

Delegation of Approval in SharePoint 2010 - No Code Solution

Here is the solution WhitePaper I have created for achieving Delegation of Approval as a No code solution using SharePoint Designer Features. Sorry for uploading as images but I did not find any way to upload PDF anywhere and Link it.

































Sunday, July 11, 2010

How to Get Oracle\SQL data on Button Click using BDC in Sharepoint 2007

Requirement - There are 2 textboxes. Part Number & Part Description.
There is a button called 'Get Description'. User enters part number and clicks
button. System should fetch description from oracle\sql database and display in description textbox.

Solution - No code deployment (Server side) solution. This can be done using Sharepoint Designer and no code deployment is required.

Create BDC application with oracle\sql. Use following code to call BDC web service to display data.

function PopulatePartDescription()
{

var partNumber = document.getElementById('ctl00_m_g_25cd57ee_3317_47f7_a082_f0d7a3f4a8f3_ff6_1');
var partDescription = document.getElementById('ctl00_m_g_25cd57ee_3317_47f7_a082_f0d7a3f4a8f3_ff16_1');
var partNumberVal = partNumber.value.toString();
//alert(partNumberVal);
if(partNumberVal =="")
{
alert("There is no valid Part number selected!");
}
else
{

var a = new ActiveXObject("Microsoft.XMLHTTP");

if(a == null) return null;
a.Open("POST", "http://testserver/_vti_bin/bdcfieldsresolver.asmx", false);
a.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
a.setRequestHeader("SOAPAction", "http://microsoft.com/webservices/SharePointPortalServer/BDCClientWS/Resolve");

var d = ''
+ " + "xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" "
+ "xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope\/\">"
+ ""
+ " +" xmlns=\"http://microsoft.com/webservices/SharePointPortalServer/BDCClientWS/\">"
+" OracleInstance"
+" ENTITYNAME"
+" "
+ partNumberVal
+ "
"
+" PART_DESC"
+" "
+ "
"
+ "
";
a.Send(d);
var rows = a.responseXML.getElementsByTagName("Status");
if(rows[0].text == "UniqueMatch" || rows[0].text == "MultipleMatch")
{
var data = a.responseXML.getElementsByTagName("Results");
partDescription.value = data[0].text;
}
}
}

OracleInstance is a instance in your BDC application file.
Replace ENTITYNAME with your entity name from BDC application.

Monday, May 24, 2010

Sharepoint 2010 Out of the Box features - Multi State Workflow

I had a requirement where in first step Item should be sent to Approvers for approval.
And if its approved subsequently item request should be forwarded to another group who
will be downloading related attachments and marks workflow complete.

If at step 1 approvers rejects the item request, workflow should be terminated.
Here is what I configured in 2010 Sharepoint...

Step 1 - Select Three State Workflow from available workflow list











Step 2 - Configure Various States of Workflow and Step 1 details









Step 3 - Configure Middle State of workflow and complete

Sharepoint 2010 Out of the Box features - Add Unique Key on List column

In Sharepoint 2010 now you can setup unique key constraint on column. While creating column
select "Enforce unique values" and Sharepoint will index the field.. Bingo...



Sharepoint 2010 Out of the Box features - Validate List field

Have you wrote code to validate a column in Sharepoint 2007? Well 2010 solves the problem. You can configure the validation out of the box at column level in Sharepoint 2010 List...

Here you Go..

Enter your validation and custom message and bingo....








and when you insert\edit item you will see validator message...

Monday, April 12, 2010

How to Populate Current Username in Sharepoint Designer

Question - How can I pre-populate current logged in Username in People picker in Sharepoint designer custom form?

Solution - Paste followng Javascript code in designer... This will work for first people picker control that it finds on the form...

_spBodyOnLoadFunctionNames.push("fillDefaultValues");
function fillDefaultValues() { fillPeoplePickerWithCurrentUser();}
function fillPeoplePickerWithCurrentUser(){ //get the current user from the welcome menu var currentUser = getCurrentUser();
//check to see that we've got it if(currentUser != null) { //get the people pickers input div var pp = getPickerInputElement(); //set it to the current user if we've found it if(pp != null) { //see if it's already set as we don't want to override when editing an item //if it's already set then the people picker element will contain a SPAN element for the resolved entity var spans = pp.getElementsByTagName('SPAN'); if(spans.length == 0) pp.innerHTML = currentUser; } }}
function getCurrentUser(){ var tags = document.getElementsByTagName('a'); for (var i=0; i < result = "" divs =" document.getElementsByTagName(" i="0;" id="=" innerdivs =" divs[i].getElementsByTagName(" k="0;"> 0) { result = innerDivs[k]; break; } } } } return result;}

Sunday, March 28, 2010

Multiple Value Lookups in Sharepoint Designer Workflow

Requirement
----------------------------------------------------------------------------------------------
I had a requirement where Lookup column has multiple value selection turned on. There is a field in Master list with person & groups as datatype. I need to send email to each user for the selected value in multiple lookup column.

Issue
----------------------------------------------------------------------------------------------
Sharepoint designer workflow lookup returns single value for the joined criteria.

Resolution
---------------------------------------------------------------------------------------------
Solution is to write a Custom Activity that can be used in Sharepoint Designer workflow.
Activity can return comma seperated string of email addresses Or any other field based on user
input.