cancel
Showing results for 
Search instead for 
Did you mean: 
ignasitt
Nintex Newbie

I need to call a form from other form (Change content type)

Jump to solution

Hi,

I have a list with 10 different content types.

The customer asked me to have a "Generic" form. They want to be able to call a specific form linked to one of the available content types.

I tried with the "Change Content Type" control, but it's not working on "New" forms. It's only showing up in "Edit" forms, and this is completely useless for me.

The customer wants to select the Content Type BEFORE doing the request. What's the point to do it after? After submit I already did the job and I have no need to change it!!

Please, can you explain me how can I meet the requirement?

I will really appreciate it!

Best regards

Labels: (2)
0 Kudos
Reply
13 Replies
Automation Master
Automation Master

Re: I need to call a form from other form (Change content type)

Jump to solution

Hi Ignasi,

how about using the standard capabilities of SharePoint? When creating a list item via the ribbon one has the possibility to choose from the available content types.

Capture.JPG

Isn't that enough for your customer? If you need a "generic" form, I would start trying different views on your form, which the user can then switch to by pressing a button e.g.. But stick to the (useful) OOTB SharePoint features is normally the best you can do.

Cheers

Philipp

0 Kudos
Reply
ignasitt
Nintex Newbie

Re: I need to call a form from other form (Change content type)

Jump to solution

Hi Philipp,

Many Thanks, but the OOB functionality is not a User Friendly solution. Most of the users don't know about SharePoint or how use the Ribbon options. They basically wants to do a simple click on a link, then have a "Generic Form" and then select the type of form they want.

Managing 10 views on the same form is like a nightmare. The complexity of each form is really high and they are adding more a more complexity each time. In fact that's the current solution, and it's a really nightmare to maintain. That's the reason we want to split the form, keeping the same user friendly interface (possibility to change the form type from a dropdown list).

It would be nice to have the ability to switch the views without JavaScript code, just like InfoPath does, but handle so many JavaScript to do this kinds of things is forcing us to think in simpler solutions.

Kind regards,

0 Kudos
Reply
pwp08a
Nintex Newbie

Re: I need to call a form from other form (Change content type)

Jump to solution

I'm not familiar with content types, but I'm assuming the URLs  are different for each new form for each content type?

you could build URLs on the generic form to the different content type forms.  If you go to the new form for a content type in the url is something like this:  ContentTypeId=0x012002001587ED4S5SD4CD144340B74C1

Add it to the url after:  /NewForm.aspx?

so:    WebURL/NewForm.aspx?ContentTypeId=0x012002001587ED4S5SD4CD144340B74C1

Reply
Automation Master
Automation Master

Re: I need to call a form from other form (Change content type)

Jump to solution

Parker Petty​ is completely right. The URL for the new item form is different for each content type as it includes the content type id. So you can do what he suggested. If you want to use a dropdown for this, you can just create this control on your form, provide the content type names as choices and use some javascript when this dropdown is changed to redirect your user to the respective URL.

Of course you will need to do this on every of your content types forms, but since you can copy/paste most of the stuff, even doing this for like 10 content types shouldn't take forever. For the javascript logic i would recommend not to code it separately in every form, but to create one single script and just link it in all of your forms.

Cheers

Philipp

0 Kudos
Reply
ignasitt
Nintex Newbie

Re: I need to call a form from other form (Change content type)

Jump to solution

Thank you guys!

Yes, this is the correct answer, I can do it without too much effort. Thanks for the idea!

But I'm still confusing about the strong limitation with "Change Content Type" Nintex Form control.

Nintex is meant to be easy to manage, not so tricky! It's really so difficult to add a parameter to let decide the author of the form if he want to show the control on the "New" view or not?

I'm having doubts about if its simpler to manage forms directly with aspx code than Nintex Forms and then a lot of JavaScript inside.

Thanks again for your help.

Best regards.

0 Kudos
Reply
Not applicable

Re: I need to call a form from other form (Change content type)

Jump to solution

Hi Philipp Lucas

This is exactly the solution we are trying to implement and was wondering if you could offer some direction as to where to find the .js or if you had some sample code I can easily update and use in production (I'm familiar, but no expert in js)

Could you possibly expand on your answer? It would be greatly appreciated.

Thanks in advance

0 Kudos
Reply
ignasitt
Nintex Newbie

Re: I need to call a form from other form (Change content type)

Jump to solution

Hi Caitlin,

This is what I finally did (due to the limitations of this control OOB that I still not able to understand).

First, créate a dummy form, just with a dropdown control to let the user select the kind of request he want to perform.

Then name your dropdown control with a specific name.

Then add the next JavaScript code to your form.

Please, notice that in my case, all the requests (Content Types) are starting with a two-digit number, (01-..., 02-..., 03-...) so I'm taking this 2 digits to identificate the type of request, but you can do the same without any substring function and comparing directly the whole request name.

_spBodyOnLoadFunctionNames.push("startIt");

function startIt() {

   console.log("Page loaded");

   NWF$('#'+Reasonfortherequest).attr('onchange', 'redirect()'); //this is the event listener that calls the function redirect() each time someone change the value of the dropdown list

}

function redirect() {
   var reason=NWF$('#'+Reasonfortherequest).val().substring(0,2); //In my case, all the Content Types starts with a two-digit number, so I'm taking this 2 digits, but you can do the same without the substring and comparing the whole request name.
   var commonURLStart="/Lists/GenericRequest/NewForm.aspx?Source=https%3A%2F%2FYOUR_SP_SITEURL_HERE%2FLists%2FYOUR_LIST_NAMEt%2FAllItems%2Easpx&ContentTypeId=";
   var commonURLEnd="&RootFolder=%2Fsites%2Fworkflows%2Fgeneric%2FLists%2FGenericRequest";
   var CT_GUID_99 ="0x0100072FAB56042023449DB9236F64FD36B6070035600F47A039B34984B203BB7C95AD7B";
   var CT_GUID_01 ="0x0100072FAB56042023449DB9236F64FD36B60100BABAB3F8C9877A418A956F70A8536E2E";
   var CT_GUID_02 ="0x0100072FAB56042023449DB9236F64FD36B60200FE08D049C4E2E645A94D3386008373D3";
   var CT_GUID_03 ="0x0100072FAB56042023449DB9236F64FD36B60300E3246A761474B34E90B0D4677BFA3A63";
   var CT_GUID_04 ="0x0100072FAB56042023449DB9236F64FD36B6040054D34EB00A9E8B499E8755B4FDCFD47A";
   var CT_GUID_05 ="0x0100072FAB56042023449DB9236F64FD36B605001B45F89754D3224F867B09A0BD4FC472";
   var CT_GUID_06 ="0x0100072FAB56042023449DB9236F64FD36B60600B28D4A93D9C9674EBBC7038B01877E4B";
   var CT_GUID_09 ="0x0100072FAB56042023449DB9236F64FD36B6080020ECEDABF594AE45946C818318B9D71C";
  
   var redirectionURL ="";
   switch (reason) {
       case "01":
            window.location.assign( _spPageContextInfo.webAbsoluteUrl + commonURLStart + CT_GUID_01 + commonURLEnd);
       break;
       case "02":
            window.location.assign( _spPageContextInfo.webAbsoluteUrl + commonURLStart + CT_GUID_02 + commonURLEnd);
       break;
       case "03":
            window.location.assign( _spPageContextInfo.webAbsoluteUrl + commonURLStart + CT_GUID_03 + commonURLEnd);
       break;
       case "04":
            window.location.assign( _spPageContextInfo.webAbsoluteUrl + commonURLStart + CT_GUID_04 + commonURLEnd);
       break;
       case "05":
            window.location.assign( _spPageContextInfo.webAbsoluteUrl + commonURLStart + CT_GUID_05 + commonURLEnd);
       break;
       case "06":
            window.location.assign( _spPageContextInfo.webAbsoluteUrl + commonURLStart + CT_GUID_06 + commonURLEnd);
       break;
       case "09":
            window.location.assign( _spPageContextInfo.webAbsoluteUrl + commonURLStart + CT_GUID_09 + commonURLEnd);
       break;

       case "99":
            window.location.assign( _spPageContextInfo.webAbsoluteUrl + commonURLStart + CT_GUID_99 + commonURLEnd);
       break;
       default:
                 console.log(reason);
       }
}

I hope this helps!

Nintex Support​ Are you looking what kind of JavaScrip you are forcing us to add into forms? It's so difficult to let the "Change Content Type" control work also on "New" ones?

Best regards.

0 Kudos
Reply
Not applicable

Re: I need to call a form from other form (Change content type)

Jump to solution

Thank you for your reply- I'm hoping you can help one step further. I edited the code you graciously gave but am getting an error where nothing in the form loads so I think something is wrong witht he way I've done that. I've replaced the content id to match the content types I have in my list and have entered in the URL for the list. Do I need to add something after &ContentTypeId="  ? If so, what? Which content type ID would this be?2016-07-01_10-29-55.gif

0 Kudos
Reply
Not applicable

Re: I need to call a form from other form (Change content type)

Jump to solution

Do the CT_GUID_99 need to instead match the options I've added tot he choice control that references the JavaScript variable name?

0 Kudos
Reply