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

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

Jump to solution

Hi Caitlin,

Yes, you need to replace the GUID of each Content Type. This code was only a sample, but each Content Type has its own GUID and you need to replace it by yours.

As I said, my Content Types are all of them starting with two-digit numbers, and that's the reason I'm getting these numbers to operate with them on the code, in your case, if your content type is more like a single string (let's say "bill" and "PurchaseOrder"), then you need to replace the code with something like this:

var redirectionURL ="";

   switch (reason) {

       case "Bill":

            window.location.assign( _spPageContextInfo.webAbsoluteUrl + commonURLStart + CT_GUID_01 + commonURLEnd);

       break;

       case "PurchaseOrder":

....

CT_GUID_01, CT_GUID_02, CT_GUID_03 are only variables name to store the GUID of each CT, you can rename it as you want. Please, ensure you have only the code for YOUR Content Types, in my sample I put height of them due I had 8 CT, but maybe you only have 4, then delete the rest of lines you don't need.

To figure out the GUID of your content Types, please, go to your list containing these CT and then go to list settings, on the CT section, you will see all the names of them.

You need to click one by one and take the Content Type GUID from the URL in your browser.

For instance, in my case, I have something like this:

var redirectionURL ="";

   switch (reason) {

       case "01":

            window.location.assign( _spPageContextInfo.webAbsoluteUrl + commonURLStart + CT_GUID_01 + commonURLEnd);

       break;

       case "02":

.../_layouts/15/ManageContentType.aspx?List=%7B6F777EFA%2DFF0F%2D49F9%2DB661%2D49DF12F7F311%7D&ctype=0x0100072FAB56042023449DB9236F64FD36B60100BABAB3F8C9877A418A956F70A8536E2E

Then the GUID for this CT is

0x0100072FAB56042023449DB9236F64FD36B60100BABAB3F8C9877A418A956F70A8536E2E

I hope this helps.

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 very much for your patience.

I think I'm almost there.

Could you possibly take a quick moment to verify that I've adapted the code correctly? In red is how I renamed the GUID to match the Content Types I have and have replaced with the GUID extracted from the URL of each.

In the blue, I'd just like to confirm that I've entered the List URL in the correct format. Where the green arrow is, am I supposed to insert any type of information here? Or leave as is.

2016-07-05_8-11-35.gif

What I'm confused about is that in the URL there's a part that's missing that I think might be the reason the code is not working for me. Here's my URL:

https://concierge1.sharepoint.com/sites/salesportal/coretechbrokers/_layouts/15/ManageContentType.as...

With the switch statement it kind of concatenates the pieces of the URL, but I don't see the addition of the 'Manage Content Type' portion that is present in each of the URLs

Apart from that, I have a choice control added to the top of the Nintex form that lists these Content Types as options, with the default set to 'All by Section'.  This is where I'd like for the user to be able to switch between the different Content Types [I have 7 total]

2016-07-05_8-21-46.gif

In the configurations there, I have named it as you instructed [and what I noticed is referenced in the code sample]- so that matches.

In the blue, is a list [choice] column I created to tie it to. This also might be where I'm making the mistake. What control should actually house the Content Type options? The list column I created, or the choice column control I just dragged onto the canvas? To clarify, 'Reasonfortherequest' is not a list column- it is only a choice control I added to the canvas while editing the form. 'Reason for the Request' is a list column that I've added the choices to, and then chose to use the connected fields [Reason for the Request] default value- that I've set to All by Section [a Content Type option]

2016-07-05_8-22-51.gif

And then of course, I've added the JavaScript to Form Settings. I don't think I've mentioned before, but I'm using Nintex for O365. From what I understand there's actually a sort of control built in for on premise Nintex environments for exactly this functionality- but it is not yet available for Nintex for O365.

Again, I appreciate all of you help & patience.

0 Kudos
Reply
ignasitt
Nintex Newbie

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

Jump to solution

Hi Catlin,

Please, try it replacing also the name of your list instead my list "GenericRequest" was on my side, not on yours:

var commonURLStart="/Lists/BrokerCommpanyProfile/NewForm.aspx?Source=..."

Sorry for not specify this also on the code, some times i forgot the most obvious things...

Best regards.

0 Kudos
Reply
Not applicable

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

Jump to solution

Unfortunately, this is still not working for me. When I click Preview after copying in the updated code, it is just a blank page. I thought maybe it was because the form wasn't published. So I published, tried to add a new item- and again the form does not load. I removed the code, tried again and it loads as expected. There is still something wrong with the code. I've copied below exactly what I've pasted in Form Settings.

_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/BrokerCompanyProfile/NewForm.aspx?Source=https://concierge1.sharepoint.com/sites/salesportal/coretechbrokers/Lists/BrokerCompanyProfile/AllIt...";
   var commonURLEnd="&RootFolder=%2Fsites%2Fworkflows%2Fgeneric%2FLists%2FBrokerCompanyProfile";
   var All_by_Section ="0x0100E48768417A78694384B89131F3E902D1";
   var Broker_Development ="0x010023C15219014B6E4D81FC25182B908A7F00A7B35C0D26583A45994FFF2B0D47F41E";
   var Finance ="0x01006E680995A7433443903A699542B40171006E4190034CD1F24182630EAC459025CA";
   var IT_Applications ="0x01007860B5CC145AAC468E7660E8BBE51B7D001CF75C4EC8C52343993E11BF394AC60D";
   var Legal ="0x0100167539CDBF5DC04DB3E08FF9395129CD00BFC48CB008D065428F14EB311BD2F3BB";
   var Marketing ="0x0100AC19C14423C62443B9428EE02CE2EBA900D2D786039A972A4986DF5A12E072EB10";
   var Sales_Support ="0x01001374B6346337F34FBF5287B92C378F24004E4E5DD9E2396F4CAD7F38F95A546207";
  
   var redirectionURL ="";
   switch (reason) {
       case "All_by_Section":
            window.location.assign( _spPageContextInfo.webAbsoluteUrl + commonURLStart + All_by_Section + commonURLEnd);
       break;
       case "Broker_Development":
            window.location.assign( _spPageContextInfo.webAbsoluteUrl + commonURLStart + Broker_Development + commonURLEnd);
       break;
       case "Finance":
            window.location.assign( _spPageContextInfo.webAbsoluteUrl + commonURLStart + Finance + commonURLEnd);
       break;
       case "IT_Applications":
            window.location.assign( _spPageContextInfo.webAbsoluteUrl + commonURLStart + IT_Applications + commonURLEnd);
       break;
       case "Legal":
            window.location.assign( _spPageContextInfo.webAbsoluteUrl + commonURLStart + Legal + commonURLEnd);
       break;
       case "Marketing":
            window.location.assign( _spPageContextInfo.webAbsoluteUrl + commonURLStart + Marketing + commonURLEnd);
       break;
       case "Sales_Support":
            window.location.assign( _spPageContextInfo.webAbsoluteUrl + commonURLStart + Sales_Support + commonURLEnd);
       break;

       default:
                 console.log(reason);
       }
}

0 Kudos
Reply