0

Ok, so I want to use a sharepoint list as a ticketing system. One of the fields is priority. I want this field to automatically update if, for instance, I input a new item with a priority of 2 I would like the current ticket that is priority 2 to change to 3 and so on for all numbers greater than 2. I can kind of envision the logic but I can't find anywhere a function that will call the last edited item. There probably is an easier way than what I'm thinking of but I can't find it.

Any help is appreciated.

0

You can use ItemAdded event receiver.

public override void ItemAdded(SPItemEventProperties properties)
{
    base.ItemAdded(properties);

    SPListItem item = properties.ListItem;
    int priority = item["priority"];
    SPList li = properties.List;
    SPQuery query = new SPQuery();
    query.Query = '<Where><Geq><FieldRef Name = "Priority"/><Value Type="number">'+priority+'</Value></Geq></Where>'
    SPListItemCollection coll = li.GetItems(query);
    for(int i=0; i<coll.Count;i++)
    {
        \\update the required items here
    }
}        

P.S. The above code might not be completely accurate. It is just intended to provide some pointers. Hopefully it helps..:)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.