Question

I have a list that is using several Content Types, and have the requirement that the Title be generated based on the content of other fields. I've used sputility.js to achieve most of this just fine, with one exception: Part of the desired Title includes the Content Type. I know that in the Edit Item form, there is a Content Type field if the List is using multiple Content Types, but this field does not exist in the New Item form.

Is there a way to know what Content Type the Item being created is? Presumably the system knows somewhere, since it knows what fields to use. I would prefer not to use a Workflow that changes the name after the fact.

Was it helpful?

Solution

In the newform.aspx, the content type id is passed in the querystring if it is other than the default content type chosen in the list. To find out with which content type the item is being created , then you can handle the querystring else you can find the default content type of the list to fill in your field. Remember , you still have to make a async query to find out the name of contenttype as only the id of the content type will be available in the querystring.

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top