• Gracia Selina
  • NEWBIE
  • 0 Points
  • Member since 2017
  • Muscular Dystrophy Association of NSW

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies
Hi all,

We are a small charity that use nonprofitforce as our database.
We have a tab for creating household for a contact and it's suddenly not working recently.

I have asked salesforce support and she said it is a Custom S control which is a custom coding. We are only a standard customer and do not have any developer support.

Can anyone please help?

Please find below the code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title></title>
<script language="javascript" src="https://www.salesforce.com/services/lib/ajax/beta3.3/sforceclient.js?browser=true" type="text/javascript"></script>
<script id="clientEventHandlersJS" language="javascript">
<!--
function initPage() {
sforceClient.registerInitCallback(setup);
sforceClient.setLoginUrl("https://www.salesforce.com/services/Soap/u/7.0");
sforceClient.init("{!API.Session_ID}", "{!API.Partner_Server_URL_70}", true);
}

//Use this function as the entry point for your DHTML and JAVASCRIPT processing
function setup() {
//create household
var Household = new Sforce.Dynabean('ONEN_Household__c');
var HouseholdArray = new Array(1);
Household.set("Name","{!Contact.FirstName}" + " " + "{!Contact.LastName}" + " Household");    

var mailingstreet = document.getElementById('fixMailingStreet').innerText;
Household.set("MailingStreet__c", mailingstreet );


Household.set("MailingCity__c","{!Contact.MailingCity}");
Household.set("MailingState__c","{!Contact.MailingState}");
Household.set("MailingPostalCode__c","{!Contact.MailingPostalCode}");
Household.set("MailingCountry__c","{!Contact.MailingCountry}");
Household.set("Recognition_Name__c","{!Contact.FirstName}" + " " + "{!Contact.LastName}");
Household.set("Recognition_Name_Short__c","{!Contact.FirstName}");

HouseholdArray[0] = Household;    
//Call create on the Household
var HouseholdSaveResult = sforceClient.Create(HouseholdArray);
//if it worked, relate the Contacts to the household
if (HouseholdSaveResult[0].success == true) {

//get the object that was returned
CreatedHousehold = HouseholdSaveResult[0];
//create a Contact object for updating
var Contact = new Sforce.Dynabean('Contact');
var ContactArray = new Array(1);
//Set the Id
Contact.set("Id","{!Contact.Id}");    

//Set the Household Id    
Contact.set("ONEN_Household__c", CreatedHousehold.id);
ContactArray[0] = Contact;    
//Call create on the Opportunity.
var ContactSaveResult = sforceClient.Update(ContactArray);
//if it worked, redirect to the Household
if (ContactSaveResult[0].success == true) {    
top.location.replace("/" + CreatedHousehold.id);

} else {
alert("Error updating Contact! " + ContactSaveResult[0].message);
}

} else {
alert("Error in creating household!");
}    
}

//-->
</script>
</head>
<body onload="initPage()">
<div id="fixMailingStreet" style="display: none;">{!Contact.MailingStreet}</div>
</body>
</html>

Thank you.
Kind Regards
Gracia


 
Hi all,

We are a small charity that use nonprofitforce as our database.
We have a tab for creating household for a contact and it's suddenly not working recently.

I have asked salesforce support and she said it is a Custom S control which is a custom coding. We are only a standard customer and do not have any developer support.

Can anyone please help?

Please find below the code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title></title>
<script language="javascript" src="https://www.salesforce.com/services/lib/ajax/beta3.3/sforceclient.js?browser=true" type="text/javascript"></script>
<script id="clientEventHandlersJS" language="javascript">
<!--
function initPage() {
sforceClient.registerInitCallback(setup);
sforceClient.setLoginUrl("https://www.salesforce.com/services/Soap/u/7.0");
sforceClient.init("{!API.Session_ID}", "{!API.Partner_Server_URL_70}", true);
}

//Use this function as the entry point for your DHTML and JAVASCRIPT processing
function setup() {
//create household
var Household = new Sforce.Dynabean('ONEN_Household__c');
var HouseholdArray = new Array(1);
Household.set("Name","{!Contact.FirstName}" + " " + "{!Contact.LastName}" + " Household");    

var mailingstreet = document.getElementById('fixMailingStreet').innerText;
Household.set("MailingStreet__c", mailingstreet );


Household.set("MailingCity__c","{!Contact.MailingCity}");
Household.set("MailingState__c","{!Contact.MailingState}");
Household.set("MailingPostalCode__c","{!Contact.MailingPostalCode}");
Household.set("MailingCountry__c","{!Contact.MailingCountry}");
Household.set("Recognition_Name__c","{!Contact.FirstName}" + " " + "{!Contact.LastName}");
Household.set("Recognition_Name_Short__c","{!Contact.FirstName}");

HouseholdArray[0] = Household;    
//Call create on the Household
var HouseholdSaveResult = sforceClient.Create(HouseholdArray);
//if it worked, relate the Contacts to the household
if (HouseholdSaveResult[0].success == true) {

//get the object that was returned
CreatedHousehold = HouseholdSaveResult[0];
//create a Contact object for updating
var Contact = new Sforce.Dynabean('Contact');
var ContactArray = new Array(1);
//Set the Id
Contact.set("Id","{!Contact.Id}");    

//Set the Household Id    
Contact.set("ONEN_Household__c", CreatedHousehold.id);
ContactArray[0] = Contact;    
//Call create on the Opportunity.
var ContactSaveResult = sforceClient.Update(ContactArray);
//if it worked, redirect to the Household
if (ContactSaveResult[0].success == true) {    
top.location.replace("/" + CreatedHousehold.id);

} else {
alert("Error updating Contact! " + ContactSaveResult[0].message);
}

} else {
alert("Error in creating household!");
}    
}

//-->
</script>
</head>
<body onload="initPage()">
<div id="fixMailingStreet" style="display: none;">{!Contact.MailingStreet}</div>
</body>
</html>

Thank you.
Kind Regards
Gracia