Set Content Type

Home Forums Classic DFFS Set Content Type

Viewing 1 reply thread
  • Author
    Posts
    • #33353
      Paul Lynch
      Participant

        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/NAMEOFLIST

        Idea 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 C

        I’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

      • #33358
        Alexander Bautz
        Keymaster

          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

      Viewing 1 reply thread
      • You must be logged in to reply to this topic.