Monthly Archives: December 2012

About PeopleEditor

PeopleEditor is a tool to select users from SharePoint or server. If you want to make your own custom form you can use this to select person or group.

Untitled

First you need to register in the source code of usercontrol.ascx of your webpart using this code

Untitled

Now add this code to where you would like the PeopleEditor to be

add this code to make the border available

More info on PeopleEditor you can visit Karine Bosch’s site

Start Workflow Using EventReceiver

This is how you can invoke workflow using EventReceiver. You can use this code if you have multiple workflows added and you want certain workflow to be invoked based on your selection in list. In this example i have 2 workflows, sequential and parallel. Based on my selection in list one of this workflow will be invoke. You can read more in this thread

Add Value To List From Workflow

Here is another option if you are looking on how to add value to list from workflow. In this example i put it in a method to seek for checker’s approval. When checker approves, the ‘Date Out’ will be fill automatically with dateTime.Now and will move on to the next task.

Good Programming Practice

Good programming practices will help you reduce the probability of introducing errors to your program as well as track them more easily. It will also greatly helps other programmers or developers to understand better what your program is all about.  This is some better approaches when you code something in your program.

  1. Comments
    It is very crucial to comment on what you are trying to do and what you are trying to achieve in modules. This will make it easier if other programmer trying to update or improve your code. Some information that you need to include in your comment

    • Name of the module.
    • Purpose of the Module.
    • Description of the Module (In brief).
    • Original Author
    • Modifications
    • Authors who modified code with a description on why it was modified.
  2. Naming Conventions
    Use descriptive string when you declare variables.
  3. Portability
    You need to make your code as dynamic as possible so it can be deploy in any environment. Make sure not to hardcode sitename, filepath, user, or any URLs.
  4. Indentations
    Indentations help to format your code to make it easy to read and understand. Poorly formatted code will introduce confusion.

For more infos on good programming practice, click here, articles from phusewiki.org.

Task Is Locked By A Running Workflow

Recently i uploaded my custom form in editform.aspx and when i try to edit it here is the error that i got.  
lalala
This happens because workflow that i created is just designed to create task and not update the task that has already been created. Thanks to this blog. Using this code in the custom web part will solve the problem. Use it before updating the task.

This is to make sure that the workflow version number is always equals to 1 before updated.