Home › Forums › Classic DFFS › Set Content Type
- This topic has 1 reply, 2 voices, and was last updated 3 years, 5 months ago by Alexander Bautz.
-
AuthorPosts
-
-
May 3, 2021 at 09:56 #33353
Hi Alexander,
I am not a fan of using Content Types when DFFS can effectively replace their necessity. But I have an old list that I am trying to implement it on that needs to keep their three content types.
The issue I have is that I want to use the Query URL parameter to create a new form, but also to set the content type at the same time.
Idea 1 – Somehow incorporate the Query URL parameter into the button url, so that it also sets content type?
Here is my custom link to add an item to the list:
https://xxx.sharepoint.com/teams/site/Lists/NAMEOFLIST/NewForm.aspx?Source=https://xxx.sharepoint.com/teams/site/Lists/NAMEOFLIST/View.aspx?PageView=Personal&ShowWebPart=%7B5B894272%2D5831%2D4A0B%2DB8C2%2D3184C94650DE%7D&ContentTypeId=0x010003D8415BFE122145BE9C8717F2580443003FAB0C9E7156E94DA988BEF82E06218E&RootFolder=/teams/site/Lists/NAMEOFLISTIdea 2 – After the normal “Item” content type is created, when user sets a field, it sets the content type.
Sets Field=A – rule or JS does nothing
Sets Field=B – rule or JS sets Content Type B
Sets Field=C – rule or JS sets Content Type CI’ve been trying to do this without success in the NewForm or EditForm using a rule (which I debug checked is running) but nothing changes in form (I have content type field visible in edit form).
{inline} setFieldValue("ContentTypeId", "0x010003D8415BFE122145BE9C8717F2580443003FAB0C9E7156E94DA988BEF82E06218E"); setFieldValue("ContentType", "Type B");
Kind Regards,
Paul -
May 3, 2021 at 15:34 #33358
Hi,
The first option (with ContentTypeId=0x010003D8415BFE122145BE9C8717F2580443003FAB0C9E7156E94DA988BEF82E06218E in the URL) is the one you want to use in NewForm as the content type selector is not visible.In EditForm the item will have it’s content type already set, but if you want to use custom js to change it you must use the fieldInternalName “ContentTypeChoice” like this:
setFieldValue("ContentTypeChoice", "Type B");
Alexander
-
-
AuthorPosts
- You must be logged in to reply to this topic.