JavaScript SDK

The JavaScript SDK is a light-weight wrapper library for the REST API.



new CodeTableService(options)

Description
BLACKBAUD.api.CodeTableService provides methods for retrieving code table entries from the CRM using calls to the BBIS REST services.
Parameters
Name Type Description
options Object An object literal containing one or more of the following optional properties:
  • url : The URL of the BBIS site from which the data will be retrieved. This value is optional when accessed from a BBIS page. The default value will be the BBIS URL of the current page.
  • crossDomain : Indicates the BBIS url specified is from a separate domain than the current page. When True, the class will handle the complexities of making cross domain requests to retrieve data. The default value is False.

getEntries(successCallback, failureCallback)

Description
Returns the active code table entries for the specified code table Id ordered as configured in the CRM.
Parameters
Name Type Description
successCallback function The function to call if the request succeeds. The function will be passed an array of objects with the following properties:
  • Id : The Id of a code table entry.
  • Description : The description of a code table entry.
failureCallback function The function to call if the request fails.

new ConsentService(options)

Description
BLACKBAUD.api.ConsentOptionService provides methods for getting consent options from the CRM using calls to the BBIS REST services.
Parameters
Name Type Description
options Object An object literal containing one or more of the following optional properties:
  • url : The URL of the BBIS site from which the data will be retrieved. This value is optional when accessed from a BBIS page. The default value will be the BBIS URL of the current page.
  • crossDomain : Indicates the BBIS url specified is from a separate domain than the current page. When True, the class will handle the complexities of making cross domain requests to retrieve data. The default value is False.

getConsentOptions(consentPartId, successCallback, failureCallback)

Description
Returns the object of the consent with consent options associated with a specified consent partId.
Parameters
Name Type Description
consentPartId Integer The Id of a consent part whose consent options should be returned.
successCallback function The function to call if the request succeeds. The function will be passed an object with the following properties:
  • ConsentPartId : The id of the consent part.
  • Title : The title of the consent part.
  • ConsentStatement : The consentstatement of the consent part.
  • PrivacyPolicy : The privacypolicy that is set in the consent part.
  • SolicitCodes : Array of consent options configured in consent part.
  • PrivacyPolicyText : The privacypolicytext that is set in the consent part.
  • hdnCRMConsentSolicitCode : The consent solicit code that is selected under web in configure integration of CRM.
  • hdnCRMSolicitCode : The solicit code that is selected under web in configure integration of CRM.
failureCallback function The function to call if the request fails.

new CountryService(options)

Description
BLACKBAUD.api.CountryService provides methods for getting state and country information from the CRM using calls to the BBIS REST services.
Parameters
Name Type Description
options Object An object literal containing one or more of the following optional properties:
  • url : The URL of the BBIS site from which the data will be retrieved. This value is optional when accessed from a BBIS page. The default value will be the BBIS URL of the current page.
  • crossDomain : Indicates the BBIS url specified is from a separate domain than the current page. When True, the class will handle the complexities of making cross domain requests to retrieve data. The default value is False.

getAddressCaptions(countryId, successCallback, failureCallback)

Description
Returns the internationalized address captions associated with a specified country.
Parameters
Name Type Description
countryId String The Id of a country whose address captions should be returned.
successCallback function The function to call if the request succeeds. The function will be passed an object with the following properties:
  • AddressLines : The caption for the address lines.
  • City : The caption for the city.
  • State : The caption for the state.
  • PostCode : The caption for the postal code.
failureCallback function The function to call if the request fails.

getCountries(successCallback, failureCallback)

Description
Returns a list of all active countries alphabetized by their description.
Parameters
Name Type Description
successCallback function The function to call if the request succeeds. The function will be passed an array of objects with the following properties:
  • Id : The Id of a country.
  • Abbreviation : The abbreviation of a country.
  • Description : The description of a country.
  • ISO : The iso of a country.
  • AddressFormat : The addressformat of a country.
failureCallback function The function to call if the request fails.

getStates(countryId, successCallback, failureCallback)

Description
Returns a list of states associated with a specified country, alphabetized by their description.
Parameters
Name Type Description
countryId String The Id of a country whose states should be returned.
successCallback function The function to call if the request succeeds. The function will be passed an array of objects with the following properties:
  • Id : The Id of a state.
  • Abbreviation : The abbreviation of a state.
  • Description : The description of a state.
  • ISO : The iso of a state.
failureCallback function The function to call if the request fails.

new DonationService(partId, options)

Description
BLACKBAUD.api.DonationService provides methods that are use for the blackbaud checkout.
Parameters
Name Type Description
partId Integer The Id of an Advanced Donation Form part that will be used as a context for all method calls.
options Object An object literal containing one or more of the following optional properties:
  • url : The URL of the BBIS site from which the data will be retrieved. This value is optional when accessed from a BBIS page. The default value will be the BBIS URL of the current page.
  • crossDomain : Indicates the BBIS url specified is from a separate domain than the current page. When True, the class will handle the complexities of making cross domain requests to retrieve data. The default value is False.

getADFEditorContentInformation(id,successCallback, failureCallback)

Description
Return editor information that will be used in BBPSCheckout.
Parameters
Name Type Description
id Integer Part id.
successCallback function The function to call if the request succeeds.
failureCallback function The function to call if the request fails.

validateDonationRequest(data,successCallback, failureCallback)

Description
Validate the donation data and opens the checkout pop if it is successfully validated.
Parameters
Name Type Description
data Object An object describing the donation transaction to be created.
successCallback function The function to call if the request succeeds.
failureCallback function The function to call if the request fails.

new DonationService(partId, options)

Description
BLACKBAUD.api.DonationService provides methods needed for taking donations and retrieving confirmation information.
Parameters
Name Type Description
partId Integer The Id of an Advanced Donation Form part that will be used as a context for all method calls.
options Object An object literal containing one or more of the following optional properties:
  • url : The URL of the BBIS site from which the data will be retrieved. This value is optional when accessed from a BBIS page. The default value will be the BBIS URL of the current page.
  • crossDomain : Indicates the BBIS url specified is from a separate domain than the current page. When True, the class will handle the complexities of making cross domain requests to retrieve data. The default value is False.

completeBBSPDonation(id, successCallback, failureCallback)

Description
Signals the application to confirm that the credit card donation has been paid in Blackbaud secured payment and to complete the creation of the donation. Updates the donation status and sends the acknowledgment email.
Parameters
Name Type Description
id String The GUID id of the donation that should be completed.
successCallback function The function to call if the request succeeds. The function will be passed an object describing the donation with the specified Id after its status has been updated.
failureCallback function The function to call if the request fails.

getRecurringGiftInstallmentAmount(totalGiftAmount, numberOfInstallments)

Description
This calculates the price of each installment for a recurring gift based on the number of installments the website user wants to make.
Parameters
Name Type Description
totalGiftAmount Decimal The total amount to be donated.
numberOfInstallments Integer The total number of installments.

getRecurringGiftLastPaymentDate(numberOfInstallments, frequencyCode, installmentStartDate, installmentMonth, installmentDayOfMonth,installmentDayOfWeek)

Description
This calculates the end date of a recurring installment based on the number of installments the website user wants to make.
Parameters
Name Type Description
numberOfInstallments Integer The total number of installments
frequencyCode Integer Frequency code.
installmentStartDate date Date on which website user wants to start the installment.
installmentMonth Integer Installment month.
installmentDayofMonth Integer Day of the Month.
installmentDayofWeek Integer Day of the Week.

createDonation(donation, successCallback, failureCallback)

Description
Validates the specified donation parameter. If valid, creates a donation transaction and saves it to the database. Stores the Id of the new donation in session so the user has permissions for the donation transaction. If the payment type is credit card, communicates with Blackbaud secured payment to set up a check out URI and adds that URI to the return object. For credit card payment, the donation is saved in a Pending state. For payments not using a credit card, the donation is saved in a Completed state and an acknowledgement email is sent. For credit card payments, the page is redirected to the Blackbaud secured payment checkout page after calling the successCallback function.
Parameters
Name Type Description
donation Object An object describing the donation transaction to be created.
successCallback function The function to call if the request succeeds. The function will be passed an object describing the donation that was created.
failureCallback function The function to call if the request fails.

getDonation(id, successCallback, failureCallback)

Description
Ensures the user has access to this donation by finding the Id in their session. If so, returns information about the donation
Parameters
Name Type Description
id String The GUID id of the donation whose information should be returned.
successCallback function The function to call if the request succeeds. The function will be passed an object describing the donation with the specified Id.
failureCallback function The function to call if the request fails.

getDonationConfirmationHtml(id, successCallback, failureCallback)

Description
Gets HTML for a confirmation screen for the completed donation. Ensures the user has access to this donation by finding the Id in their session. If so, loads the donation and merges the fields into the part’s confirmation block
Parameters
Name Type Description
id String The GUID id of the donation that should be completed.
successCallback function The function to call if the request succeeds. The function will be passed a string containing the confirmation HTML from the part with details from the specified donation merged in.
failureCallback function The function to call if the request fails.

new DonationService(partId, options)

Description
BLACKBAUD.api.DonationService provides methods that are use for the direct debit.
Parameters
Name Type Description
partId Integer The Id of an Advanced Donation Form part that will be used as a context for all method calls.
options Object An object literal containing one or more of the following optional properties:
  • url : The URL of the BBIS site from which the data will be retrieved. This value is optional when accessed from a BBIS page. The default value will be the BBIS URL of the current page.
  • crossDomain : Indicates the BBIS url specified is from a separate domain than the current page. When True, the class will handle the complexities of making cross domain requests to retrieve data. The default value is False.

getBankingTypeData(successCallback, failureCallback)

Description
Get all banking types that is enabled in CRM.
Parameters
Name Type Description
successCallback function The function to call if the request succeeds.
failureCallback function The function to call if the request fails.

getAccountTypeData(successCallback, failureCallback)

Description
Get all supported account types.
Parameters
Name Type Description
successCallback function The function to call if the request succeeds.
failureCallback function The function to call if the request fails.

getOriginIdAndTime(successCallback, failureCallback)

Description
Get information about the client origin id and time.
Parameters
Name Type Description
successCallback function The function to call if the request succeeds.
failureCallback function The function to call if the request fails.

new ImageService(options)

Description
BLACKBAUD.api.ImageService provides methods for getting information about images in the image gallery
Parameters
Name Type Description
options Object An object literal containing one or more of the following optional properties:
  • url : The URL of the BBIS site from which the data will be retrieved. This value is optional when accessed from a BBIS page. The default value will be the BBIS URL of the current page.
  • crossDomain : Indicates the BBIS url specified is from a separate domain than the current page. When True, the class will handle the complexities of making cross domain requests to retrieve data. The default value is False.

getImagesByFolder(folderPath, successCallback, failureCallback)

Description
Returns a list of images in the specified folder. Only approved images that the user has rights to view will be returned.
Parameters
Name Type Description
folderPath String The path of an image folder whose images should be returned. Example: Folder1/SubFolder1/SubFolder2
successCallback function The function to call if the request succeeds. The function will be passed an array of objects with the following properties:
  • Url : The Url of the image.
  • Caption : The caption of the image.
failureCallback function The function to call if the request fails.

getImagesByFolderGUID(folderGUID, successCallback, failureCallback)

Description
Returns a list of images in the specified folder. Only approved images that the user has rights to view will be returned.
Parameters
Name Type Description
folderGUID String The GUID of an image folder whose images should be returned.
successCallback function The function to call if the request succeeds. The function will be passed an array of objects with the following properties:
  • Url : The Url of the image.
  • Caption : The caption of the image.
failureCallback function The function to call if the request fails.

getImagesByTag(tag, successCallback, failureCallback)

Description
Returns a list of images with the specified tag. Only approved images that the user has rights to view will be returned.
Parameters
Name Type Description
tag String The tag whose images should be returned.
successCallback function The function to call if the request succeeds. The function will be passed an array of objects with the following properties:
  • Url : The Url of the image.
  • Caption : The caption of the image.
failureCallback function The function to call if the request fails.

new QueryService(options)

Description
BLACKBAUD.api.QueryService provides methods for retrieving query execution results from the CRM using calls to the BBIS REST services.
Parameters
Name Type Description
options Object An object literal containing one or more of the following optional properties:
  • url : The URL of the BBIS site from which the data will be retrieved. This value is optional when accessed from a BBIS page. The default value will be the BBIS URL of the current page.
  • crossDomain : Indicates the BBIS url specified is from a separate domain than the current page. When True, the class will handle the complexities of making cross domain requests to retrieve data. The default value is False.

getResults(queryId, successCallback, failureCallback, filters)

Description
Returns the result of executing the specified, published query. The query is executed as the last user to save the query. The results are cached and may be up to 10 minutes old. The results are limited to 5000 rows.
Parameters
Name Type Description
queryId String The Id of a query whose results should be returned.
successCallback function The function to call if the request succeeds. The function will be passed an object with the following properties:
  • Fields : An array of objects describing the fields returned from the query. The objects have have the following properties:
    • Name : The name of the column in the query.
    • Caption : The caption of the column defined in the query.
  • Rows : An array of objects describing the rows returned from the query. The objects have have the following properties:
    • Values : An array of the values returned for the row. The values are in the same order as the array of fields.
failureCallback function The function to call if the request fails.
filters Array An array of the filters to filter the results to rows that contain the specified value in the specified column. When specifying a column, use the name that is found in the query response. Depending on the type of column being filtered, the results may filter to rows that exactly match the specified value instead of those that contain the specified value. Summary columns such as MAX, MIN, and COUNT cannot be used as filters and will be ignored. The array should contain objects with the following properties:
  • columnName : The name of the column that should be used to filter the results.
  • value : The value that the specified column should be filtered by.

new UserService(options)

Description
BLACKBAUD.api.UserService provides methods for retrieving information about the currently logged in BBIS user from the CRM using calls to the BBIS REST services.
Parameters
Name Type Description
options Object An object literal containing one or more of the following optional properties:
  • url : The URL of the BBIS site from which the data will be retrieved. This value is optional when accessed from a BBIS page. The default value will be the BBIS URL of the current page.
  • crossDomain : Indicates the BBIS url specified is from a separate domain than the current page. When True, the class will handle the complexities of making cross domain requests to retrieve data. The default value is False.

getProfile(successCallback, failureCallback)

Description
Returns profile information for the current user. If the user is not logged in, then it may be populated based on the current email-recipient information.
Parameters
Name Type Description
successCallback function The function to call if the request succeeds. The function will be passed an object with the following properties:
  • Addresses : An array of objects describing the addresses of the current user. The objects have have the following properties:
    • City : The address's city.
    • Country : The address's country.
    • Id : The Id of the address.
    • IsPrimary : Boolean indicating if the address is the user's primary address.
    • PostalCode : The address's postal code.
    • State : The address's state.
    • StreedAddress : The address's street address.
    • Type : The Id of the type of the address.
  • EmailAddresses : An array of objects describing the email addresses of the current user. The objects have have the following properties:
    • EmailAddress : The email address.
    • Id : The Id of the email address.
    • IsPrimary : Boolean indicating if the email address is the user's primary email address.
    • Type : The Id of the type of the email address.
  • FirstName : The first name of the current user.
  • LastName : The last name of the current user.
  • Phone : The phone number of the current user.
  • Title : The title of the current user.
failureCallback function The function to call if the request fails.