+ Start a Discussion
thenslerthensler 

Double Dropdown lists

The SFDC Blog had an article on Double Dropdown lists (options on one picklist dependant on the selection made in another picklist) found at http://crmsuccess.blogs.com/crmsuccess/2005/02/dependent_dropd.html
(see "Download double_drop_down_example.txt" for code)

I solved a couple of problems I had when a category had no sub category entries, but I'm having trouble solving a problem with the "Update Case Record" function. When I click the "Save" button, nothing happens. I am getting a status value back from the server of 500 rather than 200.

I understand the Summer release in June will have this functionality, but I need it yesterday.

Anyone have a solution?

Anyone have another version of this double dropdown for opportunities or leads (or a list of changes to make it work for opportunities or leads)?

DevAngelDevAngel

Hi thenslar,

Would you mind posting the bit of code that does the save (updateSFDC i think)?

thenslerthensler

Here is the code I believe has the problem.  It is the original code provided in the Blog (Double Dropdown) and referenced in my previous post above.

I know how these forums sometimes don't do well with code in the text, so if this doesn't come through, email me at tim.hensler@tig.com and I will send the code directly to you. 

Thanks for your help.


//Update Case record
try{xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");}
catch(e){return false;}

xmlhttp.Open("POST",url,false);
xmlhttp.setRequestHeader("Content-Type","text/xml");
xmlhttp.setRequestHeader("soapAction","update");

var xmlUpdateCase = "<?xml version='1.0' encoding='UTF-8' ?>" +
'<soapenv:Envelope ' +
'xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" ' +
'xmlns:xsd="http://www.w3.org/2001/XMLSchema" '+
'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">'+
'<soapenv:Header>'+
'<ns1:SessionHeader ' +
'soapenv:mustUnderstand="0" '+
'xmlns:ns1="SforceService">'+
'<ns2:sessionId' +
' xmlns:ns2="urn:enterprise.soap.sforce.com">{!API_Session_ID}'+
'</ns2:sessionId>'+
' </ns1:SessionHeader>'+
'</soapenv:Header>'+
'<soapenv:Body>' +
'<update xmlns="urn:enterprise.soap.sforce.com">'+
'<sObjects xsi:type="ns3:Case" '+
'xmlns:ns3="urn:sobject.enterprise.soap.sforce.com">'+
'<ns3:Id>{!Case_ID}' +
'</ns3:Id>'+
'<ns3:Category__c>'+Categorystr+
'</ns3:Category__c>'+
'<ns3:Sub_category__c>'+Subcategorystr+
'</ns3:Sub_category__c>'+
'</sObjects>' +
'</update>' +
'</soapenv:Body>'+
'</soapenv:Envelope>';

//alert(xmlUpdateCase);
document.write(xmlUpdateCase);

xmlhttp.Send(xmlUpdateCase);
var sq = xmlhttp.status;


if ( sq == 200){
return true;
}
else{
alert('='+sq);
return false;
}

}

DevAngelDevAngel

Hi thensler,

For the SoapAction header, just put "" instead of "update".  Not sure why, but I think the SoapAction will cause issues.  Also, what is the value of the url variable in the Open command?

thenslerthensler

The url value is set in the statement:

var url = "{!API_Enterprise_Server_URL_40}";

I changed the Open statement as you suggested and tried both the 4.0 and 5.0 enterprise servers in the "url" above and still get the same results as before.

SuperfellSuperfell
the content-type header value should be text/xml charset=utf-8
the soapAction header value should be "" (the actual string quote quote, not an empty string, xmlhttp.setRequestHeader("soapAction","\"\"")).

Typically an update call returns an array of SaveResult's not a fault, so the HTTP status code is going to be 200, you'll need to look at the response XML to work out what's going on.

Message Edited by SimonF on 05-03-2005 08:53 AM

Message Edited by SimonF on 05-03-2005 08:53 AM

The_FoxThe_Fox
I think it may be an issue with your api session id try to put it in a var beforehand and put your var in the string.

I don't know why but for me it works

Regards
thenslerthensler

I applied SimonF's and The_Fox's suggestions above and I got a new message: "URL No Longer Exists" so I will go back in and review all url references.  I thought this was a plug and play script from the CRM Success blog, but am finding it a bit challenging for my meager programming skills.

Thank you SimonF and The_Fox for your help.

 

 

The_FoxThe_Fox
Hi

Try putting your case id field in a variable. I have no explanation but I am not passing directly any merge fields, I always put them in a var due to some issues exposed with the session ID.

Regards.
RichardCarreyRichardCarrey
From the description this s-control is exactly what I need. However, when I copy the html from the triple drop down.txt referenced above I too get the error "Bad Link Definition". I tried the minor modification suggestions bu to no avail.

Does anyone have a version of this that I can just copy and paste that works?

Thanks

Richard Carrey
linshelllinshell
I am receiving the "Bad Link Definition" error message as well- Any ideas as to what is causing the error?
Linda
DevAngelDevAngel
This is usually due to a misuse or mispelling of a merge field.
linshelllinshell
Thanks for the response Dave. We have working s-control code, copied the code to create a new s-control (without making any changes) and received the error when we tried to save. Since it is working in one s-control shouldn't the copied code work in a new s-control?
linshelllinshell
I rec'd a reply from our Acct. Exec. that this is a s-control bug that returns the error message when there is too much code in the html body when saved the first time. They are working on fixing the bug, here is the work around:

1) Create a new scontrol and instead of putting the real text in the HTMLBody field just put short text like "test"
2) Click save
3) Click Edit, remove your short text and paste in the actual text for the HTMLBody field