Skip to main content
Tweeted twitter.com/StackSharePoint/status/1330979527573573639
added 17 characters in body
Source Link
MikhailSP
  • 1.4k
  • 2
  • 13
  • 26

How can I set default value for a lookup column (when we adding new item)? For lists creating I am using site columns and site content types in elements.xml.

I can set default value for text or date field type, but I can't find any way to do it for lookup column. I've find this article, but I don't want to use custom InfoPath forms. Is there any possibility to do it?

My site column elements.xml:

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <Field
       ID="{a5a8622d-df8d-4988-acd4-4645081d16fe}"
       Type="Lookup"
       AllowDeletion="FALSE" 
       Description="Data Centre lookup" 
       List="Lists/DataCentres"
       ShowField="Title"
       FillInChoice="TRUE"
       Name="NewServer Datacentre"       
       DisplayName="Data Centre"       
       Group="Data centre">
    <Default>1;#FirstDataCenter</Default>
  </Field>
</Elements>

I've tried to play with but

<DefaultFormula> 

but I also have not got any results.

The "1;#FirstDataCenter" is the correct string, I am succesfully using the identical string for setting list item value.

Thank you in advance.

How can I set default value for a lookup column (when we adding new item)? For lists creating I am using site columns and site content types in elements.xml.

I can set default value for text or date field type, but I can't find any way to do it for lookup column. I've find this article, but I don't want to use custom InfoPath forms. Is there any possibility to do it?

My site column elements.xml:

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <Field
       ID="{a5a8622d-df8d-4988-acd4-4645081d16fe}"
       Type="Lookup"
       AllowDeletion="FALSE" 
       Description="Data Centre lookup" 
       List="Lists/DataCentres"
       ShowField="Title"
       FillInChoice="TRUE"
       Name="NewServer Datacentre"       
       DisplayName="Data Centre"       
       Group="Data centre">
    <Default>1;#FirstDataCenter</Default>
  </Field>
</Elements>

I've tried to play with but I also have not got any results.

The "1;#FirstDataCenter" is the correct string, I am succesfully using the identical string for setting list item value.

Thank you in advance.

How can I set default value for a lookup column (when we adding new item)? For lists creating I am using site columns and site content types in elements.xml.

I can set default value for text or date field type, but I can't find any way to do it for lookup column. I've find this article, but I don't want to use custom InfoPath forms. Is there any possibility to do it?

My site column elements.xml:

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <Field
       ID="{a5a8622d-df8d-4988-acd4-4645081d16fe}"
       Type="Lookup"
       AllowDeletion="FALSE" 
       Description="Data Centre lookup" 
       List="Lists/DataCentres"
       ShowField="Title"
       FillInChoice="TRUE"
       Name="NewServer Datacentre"       
       DisplayName="Data Centre"       
       Group="Data centre">
    <Default>1;#FirstDataCenter</Default>
  </Field>
</Elements>

I've tried to play with

<DefaultFormula> 

but I also have not got any results.

The "1;#FirstDataCenter" is the correct string, I am succesfully using the identical string for setting list item value.

Thank you in advance.

Source Link
MikhailSP
  • 1.4k
  • 2
  • 13
  • 26

Sharepoint 2010: How to set default value for a lookup column (without InfoPath forms)

How can I set default value for a lookup column (when we adding new item)? For lists creating I am using site columns and site content types in elements.xml.

I can set default value for text or date field type, but I can't find any way to do it for lookup column. I've find this article, but I don't want to use custom InfoPath forms. Is there any possibility to do it?

My site column elements.xml:

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <Field
       ID="{a5a8622d-df8d-4988-acd4-4645081d16fe}"
       Type="Lookup"
       AllowDeletion="FALSE" 
       Description="Data Centre lookup" 
       List="Lists/DataCentres"
       ShowField="Title"
       FillInChoice="TRUE"
       Name="NewServer Datacentre"       
       DisplayName="Data Centre"       
       Group="Data centre">
    <Default>1;#FirstDataCenter</Default>
  </Field>
</Elements>

I've tried to play with but I also have not got any results.

The "1;#FirstDataCenter" is the correct string, I am succesfully using the identical string for setting list item value.

Thank you in advance.