Archive | May 2012

Hide Quick Launch and Ribbon using Content Editor Web Part

Add Content Editor Web part to the welcome page, where you need to hide the Quick Launch and Ribbon. Now Edit the CE Web part in HTML mode and add the styles to hide the same.

<stlye>

#s4-leftpanel{display:none }

#s4-ribbonrow { display:none }

</style>

This will Hide ribbon and the quicklaunch bar.

Advertisements

Saving Custom Task Form In Sharepoint Workflow

I have encountered a situation of saving the custom task form(Infopath) in workflow, the challenge here was to maintain the persistence of the data entered by the users, so that they can view the data saved when opened for the next time.

This is how i achieved it .

1. Add fields to be saved in ItemMetaData file .For eg if Comments is the field to be saved add this line in ItemMetaData file.

<z:row xmlns:z=”#RowsetSchema” ows_Comments_=””/>

2. Assign ows_Comments as the default value for the Comments fields. (check Secondary data source to assign).

3. Add Save Button .

4. Add rule to the button .(Add Submit connection and Submit data using the connection).

5. Add UpdateTask activity on completion of  OnTaskChanged in workflow.cs file.

6. Declare a variable called approverComments in workflow.cs source file .

7. Assign approverComments in onTaskChanged method,

if (On_Task_Changed_AfterProperties.ExtendedProperties[“Comments”] != null)
{
approverComments = On_Task_Changed_AfterProperties.ExtendedProperties[“Comments”].ToString();
}

This will get the Comments entered by the approver and assigns to a variable.

8. Add this line of code in UpdateTask activity.

this.Update_Task_TaskProperties = new SPWorkflowTaskProperties();
Update_Task_TaskProperties.ExtendedProperties[“ows_Comments”] = scpoShoppingCartNo;

This will assign the Comments entered by the approver to the Secondary Data Source we added in Step 1, that has been set the Default value for Comments field(Step 2). Now open the form to see the saved value .