(function () {
// define all merge fields to be used as variables for shorter reference
var accountType = {!Account.Account.Account Type};
var grclc = {!Gift Recognition Credit.Gift Recognition Credit.Legal Credit %};
// it is actually not accurate to assume that the GRC is given to the Primary and Secondary contacts of the account.
// it is actually possible to have the primary and secondary contact not set and still award the GRC records, in the off
// chance that this happens to be, the receipt will print blank names on salutaion.
var PLastName = {!Account.Primary Contact.Last Name} ? {!Account.Primary Contact.Last Name} : "";
var PFirstName = {!Account.Primary Contact.First Name} ? {!Account.Primary Contact.First Name} : "";
var SLastName = {!Account.Secondary Contact.Last Name} ? {!Account.Secondary Contact.Last Name} : "";
var SFirstName = {!Account.Secondary Contact.First Name} ? {!Account.Secondary Contact.First Name} : "";
var salutation1 = {!Account.Primary Contact.Salutation} ? {!Account.Primary Contact.Salutation} : "";
var salutation2 = {!Account.Secondary Contact.Salutation} ? {!Account.Secondary Contact.Salutation} : "";
var careof = {!Receipt.Account.Receipting Care of};
var method = 0;
var PstandaloneSal = {!Contact Primary.Salutation Link.Standalone Salutation};
var SstandaloneSal = {!Contact Secondary.Salutation Link.Standalone Salutation};
// if standalone salutation, don't print the names
if (PstandaloneSal) {
PLastName = "";
PFirstName = "";
}
// if standalone salutation, don't print the names
if (SstandaloneSal) {
SLastName = "";
SFirstName = "";
}
if (grclc == 100) {
// only one contact gets legal credit, we get the first GRC record and the credit contact of that GRC Record
PLastName = {!Gift Recognition Credit.Contact Credited.Last Name} ? {!Gift Recognition Credit.Contact Credited.Last Name} : "";
PFirstName = {!Gift Recognition Credit.Contact Credited.First Name} ? {!Gift Recognition Credit.Contact Credited.First Name} : "";
// if standalone salutation, don't print the names
if (PstandaloneSal) {
PLastName = "";
PFirstName = "";
}
salutation1 = {!Gift Recognition Credit.Contact Credited.Salutation} ? {!Gift Recognition Credit.Contact Credited.Salutation} : "";
// second contact is blank
salutation2 = "";
SLastName = "";
SFirstName = "";
}
// if no salutation to either of the two contacts, set the Method : use first name or Supporter
if ((PLastName != "" && salutation1 == "") || (SLastName != "" && salutation2 == "")){
if (PFirstName != "" && PFirstName.length > 1 && SFirstName == ""){ // one contact, first name is not one character,
method = 1; // use first name
} else if (PFirstName != "" && PFirstName.length > 1 && SFirstName != "" && SFirstName.length > 1){ // two contacts, first name is not one character
method = 1; // use first name for both contacts
} else {
method = 2; // no salutation and no first name, use Dear Supporter
}
}
// Household and two contact same surname - Dear Mr Ryan and Mrs Francesca Bryant
if ((accountType == 'Household') && (grclc < 100) && (PLastName == SLastName)) {
switch(method){
case 1: // Dear Ryan and Francesca Bryant
return (PFirstName + " " + "and" + " " + SFirstName + " " + SLastName);
break;
case 2: // Dear Supporter
return ("Supporter");
break;
default: // Dear Mr and Mrs Bryant or Dear Chancellor and Mrs Bryant
return (salutation1 + " " + "and" + " " + salutation2 + " " + SLastName);
}
// Household and two contact different surname - Dear Mr Ryan Bryant and Mrs Francesca Parkes
} else if ((accountType == 'Household') && (grclc < 100) && (PLastName != SLastName)) {
switch(method){
case 1: // Dear Ryan and Francesca
return (PFirstName + " " + "and" + " " + SFirstName);
break;
case 2: // Dear Supporter
return ("Supporter");
break;
default: // Dear Mr Bryant and Mrs Parkes or Dear Chancellor and Mrs Parkes
return (salutation1 + " " + PLastName + " " + "and" + " " + salutation2 + " " + SLastName);
}
// Not Household with careof
} else if ((accountType != 'Household') && (careof)){
return ({!Receipt.Account.Receipting Care of});
} else if ((accountType != 'Household')){
return ("Sir/ Madam");
} else if ((grclc == 100)){ // Household and only one LC
switch(method){
case 1: // Dear Ryan
return (PFirstName);
break;
case 2: // Dear Supporter
return ("Supporter");
break;
default: // Dear Mr Bryant or Dear Chancellor
return (salutation1 + " " + PLastName);
}
} else {
return "";
}
})()
Body
Thank you on behalf of the University of Sydney for your donation of «GiftAmount» to support «IF DFN2»«DFN1»«ELSE IF DFN1»«DFN1».«ENDIF»«IF DFN3», «DFN2»«ELSE IF DFN2» and «DFN2».«ENDIF»«IF DFN4», «DFN3»«ELSE IF DFN3», and «DFN3».«ENDIF» «IF DFN5», «DFN4»«ELSE IF DFN4», and «DFN4».«ENDIF»«IF DFN5», and «DFN5».«ENDIF»Please find below your official University tax receipt.
«IF SpecialWording»«SpecialWording»«ELSE»The University of Sydney is a vibrant teaching and research institution dedicated to solving real world problems. Your gift will help us to ignite the potential of our brightest minds. For generations we have recognised the power of education to lead change. With your help, we will continue this tradition of creating a community where individuals and their ideas can flourish.«ENDIF»
USYD_New Standard Receipt Template_Reprint - Edited - BP (3).docx
N/A
No
Consolidated Receipts - Email
Email Consolidated Receipts
a2P8v0000001UCeEAM
Code Block
language
json
"City":"Account____BillingCity",
"Country":"Account____BillingCountry",
"Different":"Calculate_Step____LC Both Different Last Name",
"Gift/Pledge Number":"Gifts_Pledges____Name",
"MailingLine1":"Account____BillingStreet",
"PFirstName":"Account____AQB__PrimaryContact__c___FirstName",
"PLastName":"Account____AQB__PrimaryContact__c___LastName",
"PSalutation":"Account____AQB__PrimaryContact__c___Salutation",
"PUSYDContactID":"Account____AQB__PrimaryContact__c___USyd_Contact_ID__c",
"PostCode":"Account____BillingPostalCode",
"Primary":"Calculate_Step____LC-P",
"SFirstName":"Account____AQB__SecondaryContact__c___FirstName",
"SLastName":"Account____AQB__SecondaryContact__c___LastName",
"SSalutation":"Account____AQB__SecondaryContact__c___Salutation",
"SUSYDContactID":"Account____AQB__SecondaryContact__c___USyd_Contact_ID__c",
"Same":"Calculate_Step____LC Both Same Last Name",
"Secondary":"Calculate_Step____LC-S",
"State":"Account____BillingState",
"TodaysDate":"systemFields::today"