views:

246

answers:

4

hi,

i have a contact list that i use in a issue list(lookup). When i delete the contact in the contact list is also gone in my already created issue.

Someone?

thx

A: 

that's coding? Can you show me how to do that?

thx

idsis
Sorry I wasn't paying attention. I'm not really a sharepoint person.
Mark Dickinson
It sort of stands to reason that if you delete a contact, that it will cascade through a system. Is there not some sort of disable, that takes the contact of the list, but leaves it in the system.
Mark Dickinson
ammend your question, don't write answers!
tharkun
A: 

can someone tell me how to build a custom lookup field that get contacts from my contacts list?

thx

idsis
make a question out of that, not an answer!
tharkun
A: 

can someone tell me how to build a custom lookup field that get contacts from my contacts list?

thx

Inherit from SPField. Create a field control which inherits from BaseFieldControl. I think you can use the Microsoft.SharePoint.WebControls.LookupField to render a dropdown where you can select the value.

Another (maybe easier) approach would be to use an event receiver and copy the selected value to a text or calculated field.

I'm not sure if any of those are the preferable approach in your case. Why do you have to remove the contact from the contact list?

JMD
A: 

If I understand your initial question correctly you've got the following scenario:

Contact List - contact A - contact B - contact C

Issue List - issue A (lookup to contact A) - issue B (lookup to contact B) - issue C (lookup to contact C)

When you delete "contact A" from the the Contact List, issue A not contains a null value (or a blank selection in the drop down) where "contact A" used to be even though you haven't edited "issue A" after the deletion of "contact A".

So it now looks like:

Contact List - contact B - contact C

Issue List - issue A (lookup to ) - issue B (lookup to contact B) - issue C (lookup to contact C)

Assuming that's correct. You've described the default behaviour of lookup lists in SharePoint. The list dropdowns are build dynamically when required and store a reference to the original list as the value>

If you were to query the value of the lookup field in "issue A" you would get something like "1#;contact A" before the delete and "null" afterwards.

You can't adjust this behaviour w/the default lookup field.

The choice field may solve your issue depending on how often contacts are added/removed and how large the Contact List is.

The choice field is simply a text field w/predefined options for input. You could use event handlers to update the available choices for the field.

The alternative is to create your own lookup field (inheriting from the default). Add a string property to the field that copies the data from default lookup when selected. You would then change the rendering code to show the added property on view and a modified drop down (showing unavailable/deleted values) on create/edit.

IMO, this is a big drawback of the default lookup field.

Mark