Вы находитесь на странице: 1из 55

Version 21.

0 for the Web Services API: Spring '11

AJAX Toolkit Developer's Guide

Copyright 20002011 salesforce.com, inc. All rights reserved. Last updated: February 20, 2011 Salesforce.com is a registered trademark of names and marks. Other marks appearing herein may be trademarks of their respective owners. salesforce.com, inc., as are other

Table of Contents

Table of Contents
Chapter 1: The AJAX Toolkit..................................................................................... When to Use the AJAX Toolkit....................................................................................................................................4 .................3 AJAX Toolkit Support
Policy........................................................................................................................................4 Other Resources.......................................................................................................................................................... AJAX Typographical ..4 Conventions................................................................................................................................4 Sample Visualforce Page Using the AJAX Toolkit........................................................................................................5

Chapter 2: Working with the AJAX Toolkit.................................................................. Connecting to the API..................................................................................................................................................8 ................7 Embedding API Calls in

Chapter 3: API Calls and the AJAX Toolkit................................................................ Synchronous and Asynchronous Calls with the AJAX Toolkit....................................................................................13 ................12 the AJAX API Call Syntax in

JavaScript..............................................................................................................................9 Processing Results........................................................................................................................................................10

Chapter 4: Using SOAP Header Options with the AJAX Chapter 5: Error Handling with Toolkit................................... the AJAX Toolkit....................................................... ..............27 Chapter 6: Advanced ...............29 Topics....................................................................................... QueryResultIterator............................................................................................................................................ .........31 ................31 Differences in Escaping Reserved
Characters.............................................................................................................31 Working with Base64 Binary Encoded Strings...........................................................................................................32 Using the Timeout Parameter with Asynchronous Calls.............................................................................................33 AJAX Proxy............................................................................................................................................................... remoteFunction Syntax and ..33 Parameters...........................................................................................................34 Downloading the Salesforce Client Certicate................................................................................................34

Toolkit.........................................................................................................................13 Object Functions......................................................................................................................................................... Data Types in AJAX 13 Toolkit........................................................................................................................................14 The source Context Variable........................................................................................................................................14 Debugging with the AJAX Toolkit..............................................................................................................................14 Using the Samples.......................................................................................................................................................15 Synchronous Examples................................................................................................................................................15 Asynchronous Examples..............................................................................................................................................24

Chapter 7: Migrating from the Beta AJAX Toolkit....................................................... ...............36 Glossary.............................................................................................................. .....................40 ............................................................................................................................................. Index 52 .........

Table of Contents

ii

Chapter 1
The AJAX Toolkit
In this chapter ...
The AJAX Toolkit is a JavaScript wrapper around the API:

When to Use the AJAX Toolkit The AJAX Toolkit is available for any organization that has API access. version AJAX Toolkit S upport Poli c y The AJAX Toolkit supports Microsoft Internet Explorer 6.0, 7.0, or 8.0 with the latest hot xes applied, and Mozilla Firefox version 2.x or 3.x. Other Resources T he AJAX Toolkit is based on the partner WSDL. Because there is no type AJAX Typographical Conventions checking in JavaScript, the type information available in the enterprise WSDL Sample Visualfo r ce Page Using the not needed. is AJAX Toolkit You can execute any call in the API, and access any API object that you
normally have access to. You can issue asynchronous calls, and use callback functions to handle the results. For more information, see API Calls and the AJAX Toolkit. Youcan use header options with a different syntax than in the API. For more information, see Using SOAP Header Options with the AJAX Toolkit. You can handle errors with the AJAX Toolkit. For more information, see Error Handling with the AJAX Toolkit. The AJAX Toolkit supports relationship queries. See Synchronous Examples for examples of relationship queries. Note: Before you use the AJAX Toolkit, you should be familiar with JavaScript and with the information about the API inServices Web the API Developer's Guide . This document explains how to use the AJAX Toolkit in JavaScript to embed API calls and processes, such as within a Visualforce page..

The AJAX Toolkit

When to Use the AJAX Toolkit

Because information approximately is delivered six elds with and via characters 50 a deconstruct greater. Also, browser, ofSOAP a data as more are not AJAX worksdata. each).The message, HTML nodes efcient, of amount best asthe data larger the and created are with careful The following are examples of appropriate uses: relatively set of an size the from consideration small the be modify a single record. returned,the individual or data, to needs Display amounts ofit more time recordto for or three elds from many records. potential two given gets Display data (up to will take larger, the poor browser Perform one or more simple calculations, then update a record. 200 construct impact on performance memory records, performance are examples of scenarios that require case-by-case analysis: increases. management The following becomes Because if you intend Update browsers a to display more than 200 records. Update records that are unusually large. For example, what happens if the user clicks the browser stop button? large Recalculate a complex value for more than 200 records. An example of browser rendering would be too slow. and inappropriate usage is providing a sortable grid AJAX Toolkit Support of many records.This Policy The current would require release of the is released, too much the previous version continues to be available, but is not supported. AJAX Toolkit processing is For a list of the only time, requirementsknown migration issues for any other releases. There are no version that to migrate receives bug from the Beta xes and version of the enhancements. AJAX Toolkit, When a Other new see Migrating version from the Beta Resources In addition AJAX Toolkit. to the Firebug extension to Firefox: Firebug for Firefox content of Eclipse plug-in: Force.com IDE this Message document, boards: Developer Force there are other resources available AJAX Typographical for you as you learn Conventions Topics the to use about the AJAX Toolkit use the following typographical conventions: AJAX Toolkit:

When to Use the AJAX Toolkit

The AJAX Toolkit

Sample Visualforce Page Using the AJAX Toolkit

Convention

Description

In an Yscript=src=?LsoapLajaxLONKMLconnectionKjs? example, Courier font indicates items that you should type the information as shown. This includes sample code, literals, type=?textLjavascript?[YLscript[ methods, calls, functions, and events from a variety of languages. You supply the actual value.
header_option_name=?value In an example or syntax statement, italics represent variables. sforceKconnectionK ?X

Sample Visualforce Page Using the AJAX Toolkit

To add JavaScript to an Visualforce page, use the following procedure: 1. Create the Visualforce page. For more information onVisualforce Developer's Guide this, see the . 2. Cut and paste the following sample code into your Visualforce page.

The JavaScript code queries your organization and returns every account ID, account name, and industry type, if any:
YapexWpage=[ Yscript=type=?textLjavascript?[ var=||sfdc ==D{>dbbffaEF}DX YLscript[ Yscript=src=?KKLKKLsoapLajaxLONKMLconnectionKjs? type=?textLjavascript?[YLscript[ Yscript=type=?textLjavascript?[ windowKonload===setup function=setup { LLfunction=contains=all=code=to=execute=after=page=is=rendered var=state==={=LLstate=that=you=need=when=the=callback=is=called output=W=documentKgetblement_yfdE?output?FI start W=new=aateEFKget var=callback==={ LLcall=layout on layout if=the=request=is=successful

LLcall=querycailed=if=the=api=request=fails oncailureW=querycailedI sourceW=state}X sforceKconnectionKqueryE ? fdI fndustry=crom=Account=order=by=fndustry?I callbackFX

function=querycailedEerrorI=sourceF={ sourceKoutputKinnere ==?An=error=has=occurredW=?=H=errorX } LGG G method=will=be=called=when=the=toolkit=receives=a=successful G response=from=the=serverK G ]query - result=that=server=returned G ]source=-=state=passed=into=the=query=method=callK GL function=layout sourceF={ if=Equery [=MF={ var=output===??X

The AJAX Toolkit

Sample Visualforce Page Using the AJAX Toolkit

LLget=the=records=array var=records===query LLloop=through=the=records=and=construct=html=string for=Evar=i===MX=i=Y=recordsKlengthX=iHHF={ var=account===recordsxizX output=H==accountKfd=H=?=?=H=accountK H ?=xfndustry=-=?=H=accountKfndustry=H=?zYbr[?X

} YLscript[

LLrender=the=generated=html=string sourceKoutputKinnere ==outputX }

Ydiv=id=?output?[=YLdiv[ YLapexWpage[

After creating and navigating to the aboveVisualforce page, you should see text similar to this image:

An easierNote: create this page is by using anApex controller. However, the sample is intended to show basic way to functionality with the AJAX Toolkit that contains API calls and processes Salesforce data.

Chapter 2
Working with the AJAX Toolkit
In this chapter ...
Most JavaScript that you add to Visualforce pages, buttons, or links has three sections: rst, connecting to the AJAX Toolkit, next, embedding the API methods Connecting to the API in JavaScript, and nally, processing the results. This section explains each of Embedding API Calls in JavaSc r these steps. ipt

Processing Result s

Working with the AJAX Toolkit

Connecting to the API

The rst portion of any JavaScript code that uses the AJAX Toolkit must make the toolkit available to the JavaScript code. The syntax for this is For Visualforce pages or any source other than a custom onclick JavaScript button, specify a Yscript[ tag that points different to the toolkit le: depending on whether you YapexWpage[ are Yscript=src=?KKLKKLsoapLajaxLONKMLconnectionKjs?=type=?textLjavascript?[YLscript[ embedding JavaScript KKK in a YLapexWpage[ Visualforce page, or custom call toJavaScript button, specify the For a a onclick log into the API: login button or link. Ybody[
{>require ONKMLconnectionKjs?F} sforceKconnectionKloginE?username?I=?password?FX KKK

Connecting to the API

The AJAX Toolkit picks up the endpoint and manages the session ID. You do not need to set them. The version of the AJAX Toolkit is in the URL. After this script executes, the toolkit is loaded and a sforceKconnection is created. This object contains all global object, , of the API calls and AJAX Toolkit methods, and manages the session ID. No other session management is needed. Salesforce checks the For a IP address blocked their password from whichlog login in order tois password mypasswor , and their security token is enter uuuuuuuuu , then the user must mypassworduuuuuuuuu theA security vialog in. d in. the u u to client application API, can token is an Users user is logging Salesfor automaticallyobtain interface. email in, and ce generated key their a When address password, blocksthis, the returns from security user on has or the avoid logins by information, see Security Token in the in the Web Services API Developer's Guide. a loginfrom For Salesforce. token changes user's their administrator For more unknown IP a fault. example, if changing their Salesforce password can make It is recommended that you obtain your security token via the Salesforce user interface from a trusted network addresses. Then, Tip: user's their the password record. reset. sure the password to attempting to access Salesforce from a new location. or resets The prior When the client's IP user or their security is address must is the resetting token to added If Single security (SSO) is enabled for your organization, users who access the API or a desktop client cannot log in to Sign-On add their token, invalid,their organization's Salesforce valid until IP address is included on your organization's list of trusted IP addresses or on their prole, if their unless their trusted security Salesforc a user the of has IP list user prole security a token via e sends resets must IP addresses. address for users with the Uses Single Sign-On permission. However, if the security token is enabled for your organization, then token the new their repeat restrictions your to the Salesforce security the login set. of organization's token before being locked out of Salesforce. For more information, see Setting Login Restrictions and Setting Password end toto token token, process Futhermore, login lockout online help. Policies in the the in. To changes log delegated the settings their authentication determine the authority number of usually user times a handles login can attempt lockout with to log in policies an invalid security 8

Working with the AJAX Toolkit

Embedding API Calls in JavaScript

After you havecontains your API calls and processing. Be sure to check the API Developer's Guide that made Web Services for information about the you wish to use. The syntax for calls is different in the AJAX Toolkit; for details see API Calls and the AJAX each call that toolkit available Toolkit. using the The following example shows a simple synchronized call that you can issue after connecting.This queryand returns the procedure fd for every and writes them to the log. in Connecting result===sforceKconnectionKqueryE? fd=from to the API, records===resultKgetArrayE?records?FX you can write the for=Evar=i=MX=iY=recordsKlengthX=iHHF={ JavaScript var=record===recordsxizX H ?=--=?=H=recordKfdFX code logErecordK
}

Embedding API Calls in JavaScript

We recommend avoid errors. For example: executes, to that you wrap your Ybody=onload=?setup Ydiv=id=?output?[YLdiv[ JavaScript YLbody[ code so that the entire When page in the setup body=onload, the browser initializes all HTML elements before it calls HTML you specify setup is rendered . by the For example, the following code could be added to a Visualforce page to retrieve data: browser before the Yscript=type=?textLjavascript[ code function=setup {
sforceKconnectionKqueryE? fdI fndustry=crom=Account order=by=fndustry?FI {on W=layout oncailure=W=querycailedI source=W={ output=W=documentKgetblement_yfdE?output?FI start W=new=aateEFKget } }FX

} YLscript[

The API interaction in the code above is accomplished in the rst line of the function. A SOQL statement setup species what data to return. For more information about context variable, see The source Context Variable. source the After fetching the data in this example, you should handle error conditions, for example:
function=querycailedEerrorI=sourceF={ sourceKoutputKinnere ==?Yfont=color=?red?[ An=error=has=occurredW=YLfont[=Yp[?=H=errorX }

For more about error handling, see Error Handling with the AJAX Toolkit.

Working with the AJAX Toolkit

Processing Results

Use a callback function to handle the results of this asynchronous call. A callback function is a function that is passed by reference to the AJAX Toolkit. The AJAX Toolkit calls the callback function under dened conditions, for example, upon completion. For more information about callback function syntax, see API Calls and the AJAX Toolkit. For example, the following code veries that at least one result was returned, and iterates through the result set if it exists:
LGG G method=will=be=called=when=the=toolkit=receives=a=successful G response=from=the=serverK G ]query - result=that=server=returned G ]source=-=state=passed=into=the=query=method=callK GL function=layout if=Equery var=output===??X [=MF={ sourceF={

LLget=the=records=array var=records===query LLloop=through=the=records=and=construct=html=string for=Evar=i===MX=i=Y=recordsKlengthX=iHHF={ var=account===recordsxizX output=H==accountKfd=H=?=?=H=accountK H ?=xfndustry=-=?=H=accountKfndustry=H=?zYbr[?X } LLrender=the=generated=html=string sourceKoutputKinnere ==outputX }

A suggested best practice is to use JavaScript as the callback function for failure conditions and JavaScript oncailure for processing results that are successfully returned. on For more information about embedding API calls in JavaScript with the AJAX Toolkit, especially the differences in syntax and availability of asynchronous calls, see API Calls and the AJAX Toolkit.

Processing Results

You can process the results of a query that returns enoughquery require rows to andqueryiocator, much as you do now, iterating across the results:
var=result===sforceKconnectionKqueryE?select=nameI=id=from=account?FX var=query ==trueX while=Equery { var=records===resultKgetArrayE?records?FX for=Evar=i===MX=i=Y=recordsKlengthX=iHHF={ LLprocess=recordsxiz } if=EresultKget_ooleanE?done?FF={ query ==falseX }=else={ result===sforceKconnectionKquery } }

10

Working with the AJAX Toolkit

Processing Results

However, the AJAX Toolkit provides the object so that you can easily iterate through results without invoking andqueryiocator.you are experienced with the API and JavaScript, see QueryResultIterator. If query For other calls,to batch call:for a how you les createEF must handle var=accounts===xzX the for=Evar=i=MX=iYNMX=iHHF={ batching var=account===new=sforceKbjectE?Account?FX of up accountK to ==?my=new=account=?=H=iX 200 accountsKpushEaccountFX records } at a time var=result===sforceKconnectionKcreateEaccountsFX yourself. For var=sb===??X example, for=Evar=i=MX=iYresultKlengthX=iHHF={ the if=EresultxizKget_ooleanE?success?FF={ following sb=H==?yn=new=account=created=with=id=?=H=resultxizKidX sample }=else={ shows sb=H==?yn=failed=to=create=account=?=H=resultxizX
} }

alertE?

W=?=H=sbFX

For more examples, see Synchronous Examples.

11

Chapter 3
API Calls and the AJAX Toolkit
In this chapter ...
Use the following sections to understand how API calls are used with the AJAX Toolkit. All calls described in the Web Services API Developer's Guide, plus Synchronous and Asynchronous therun call documented in the Force.com Apex Code Developer's Guide. Call s

with the AJAX Toolkit API Call Syntax in the A J AX Toolkit Object Functions Data Types in AJAX Toolkit The source Context Variabl e Debugging with the AJAX Toolkit Using the S amples Synchronous Examples Asynchronous Examples

12

API Calls and the AJAX Toolkit

Synchronous and Asynchronous Calls with the AJAX Toolkit

Synchronous and Asynchronous Calls with the AJAX Toolkit

The AJAX Toolkit allows continue, you APIissue referred to as a callback function. Once the result is ready, the server invokes the waiting call, the to for a synchronous call backmethod with the result. callback from or server.To the asynchronous issue an calls. asynchronous API you must Asynchronous call, Call Syntax in the AJAX Toolkit calls allow the include an API calls use client side slightly different syntax inAJAX Toolkit. additional process to parameter Synchronous syntax: with
sforceKconnectionKmethodE?argN?I?arg2?I=KKKFX

For example:
sforceKconnectionKloginE?ame]rgKcom?I?my

Asynchronous syntax:
methodE?argN?I?arg2?I=KKKI callback_methodFX

For example:
var=callback==={on handle oncailureW=handlecailure}X function=handle {} function=handlecailureEerrorF={} sforceKconnectionKqueryE? name=from=Account?I=callbackFX

In this example, on

is the callback function, which will return the results when they are ready.

See Core Calls in Web Services API Developer's Guidearguments, and best practices, but use the AJAX Toolkit the for call usage, syntax for methods you embed in JavaScript. Note: . Because delete is a JavaScript keyword, use deletefds instead of the API call delete

Object Functions

Property values can be accessed directly or by using or get method: set a generic function. This can be A get function for each eld in the object. For example, an Account object has a getE? object.cield (for example, used instead of ). accountK function.This can be used A set function for each eld in the object. For example, an Account object has a setE? object.cield = value. instead of For example, you can get the value of field from an Account using either of these methods: the

13

API Calls and the AJAX Toolkit

Data Types in AJAX Toolkit

accountKgetE? accountK accountx? You can set the value of the field from an Account using either of these methods: accountKsetE? accountK ==? accountx?
?

For information about processing results, see Processing Results.

The AJAX Toolkitfunctions supplied with the returned object: of the returns all getaate maps dates to JavaScript Date. data as maps dateTime values to JavaScript Date. getaate strings. If getfnt needed, maps integer values to JavaScript Int. you can getcloat maps oat values to JavaScript Float. convert the maps boolean values to JavaScript Boolean. get_oolean data into an getArray retrieves arrays of values. appropriate get_aseSQ_inary decoded value of a Base64 binary encoded string. This is typically used for working with datatypereturns the by documents and attachments. See Working with Base64 Binary Encoded Strings for information about working with using one Base64 binary encoded strings. If you request null or not, the value is not returned, and is therefore undened. value is a eld whose value is null in a The source Context query, the Variable The AJAX Toolkit provides a context variable, allows you to pass in any context and get it back in the callback , which source returned method. Foran error handling context, see Error Handling with the AJAX Toolkit. in an example of how to use source value will be null. If you do not Debugging with the AJAX Toolkit request a eld, The AJAX Toolkit provides a debugging window that pops up when certain errors are encountered. whether the can invoke logging explicitly using the For example, if you wanted to display the debugging window with You method. log

Data Types in AJAX Toolkit

the value of a variable at a certain point in your client application, you could add this line at the appropriate place:
sforceKdebugKlogEmy

You can open the debugging window at any point by using this command:
sforceKdebugKopenEFX

14

API Calls and the AJAX Toolkit

Using the Samples

Using the Samples


The next two sections contain examples of synchrononous and asynchronous calls. The AJAX Toolkit provides a debugging window that pops up when certain errors are encountered. You can invoke logging explicitly using the For example, if you wanted to display the debugging window with method. logEF the value of a variable at a certain point in your client application, you could add this line at the appropriate place:
sforceKdebugKlogEmy

The AJAX Toolkit samples in the following sections . use the samples in the following sections, add this simple To logEFuse version of the code before the rst use of : log log
function=logEmessageF={ alertEmessageFX }

You can make aslogEF sophisticated as you wish.

Synchronous Examples

The following examples are synchronous calls. No callback methods are required.

Data Call Examples


login Example:
try{ var=result===sforceKconnectionKloginE?myname@myemail.com?I=?password?FX logE?logged=in=with=session=id=?=H=resultKsessionfdFX }catchEerrorF={ if=EerrorKfaultcodeKindex >==-NF={ logE?check=your=username=and=passwdI=invalid=login?FX }=else={ logEerrorFX } }

query Example:
result===sforceKconnectionKqueryE? records===resultKgetArrayE?records?FX for=Evar=i=MX=iY=recordsKlengthX=iHHF={ var=record===recordsxizX logErecordK H ?=--=?=H=recordKfdFX } fd=from

query

Example:

var=result===sforceKconnectionKqueryE?select=nameI=id=from=account?FX

15

API Calls and the AJAX Toolkit

Synchronous Examples

var=query ==trueX while=Equery { var=records===resultKgetArrayE?records?FX var=sb===new=sforceK for=Evar=i===MX=i=Y=recordsKlengthX=iHHF={ sbKappendErecordsxizK } logErecordsKlengthFX logEsbKto if=EresultKget_ooleanE?done?FF={ query ==falseX }=else={ } result===sforceKconnectionKquery

queryAll Example:
var=result===sforceKconnectionKqueryAllE? var=records===resultKgetArrayE?records?FX for=Evar=i=MX=iYrecordsKlengthX=iHHF={ var=record===recordsxizX logErecordK H ?=--=?=H=recordKfdFX } fd=from=Account?FX

Relationship Query Example--Child to Parent:


var=result===sforceKconnectionKqueryE? cKfdI=cKfirstnameI=?=H ?cKlastnameI=cKleadsourceI=aKfdI=aKnameI=aKindustryI=cKaccountfd=?=H ?c Contact=cI=cKaccount=a="ab _v=leadsource=if NM?FX var=it===new=sforceK whileEitKhas { var=record===itKnextEFX var=account ==recordKAccount=\=recordKAccountK logE=recordKcirst H ?=?=H=recordKiast ?=in=account=?=H=account H

W=nullX

Note: Relationship name formats differ depending on the direction of the relationship (parent-to-child or child-to-parent), and also depending on whether the objects are standard or custom objects. For more information, see Relationship Queries in the Web Services API Developer's Guide . Relationship Query Example--Parent to Child:
var=result===sforceKconnectionKqueryE?select=aK aKfndustryI=?=H ?Eselect=cKiast cKiead from=aKContacts=cF=?=H ?from=account=a=order=by=industry=limit=NMM?FX var=ait===new=sforceK whileEaitKhas { var=account===aitKnextEFX var=contacts===xzX

16

API Calls and the AJAX Toolkit

Synchronous Examples

if=EaccountKContactsF={ var=cit===new=sforceK whileEcitKhas { var=contact===citKnextEFX contactsKpushEcontactKiast } } } logEaccountK H ?W=?=H=contactsKjoinE?I?FFX

create Example:
var=account===new=sforceKbjectE?Account?FX accountK ==?my=new=account?X var=result===sforceKconnectionKcreateExaccountzFX if=EresultxMzKget_ooleanE?success?FF={ logE?new=account=created=with=id=?=H=resultxMzKidFX }=else={ logE?failed=to=create=account=?=H=resultxMzFX }

Batch create Example:


var=accounts===xzX for=Evar=i=MX=iYNMX=iHHF={ var=account===new=sforceKbjectE?Account?FX accountK ==?my=new=account=?=H=iX accountsKpushEaccountFX } var=result===sforceKconnectionKcreateEaccountsFX for=Evar=i=MX=iYresultKlengthX=iHHF={ if=EresultxizKget_ooleanE?success?FF={ logE?new=account=created=with=id=?=H=resultxizKidFX }=else={ logE?failed=to=create=account=?=H=resultxizFX } }

delete Example:
LLcreate=an=example=account var=account===new=sforceKbjectE?Account?FX accountK ==?my=new=account?X var=result===sforceKconnectionKcreateExaccountzFX if=EresultxMzKget_ooleanE?success?FF={ logE?new=account=created=with=id=?=H=resultxMzKidFX accountKfd===resultxMzKidX }=else={ throw=E?failed=to=create=account=?=H=resultxMzFX } LLnow=delete=the=example=account var=del ==sforceKconnectionKdeletefdsExaccountKfdzFX if=Edel { logE?account=with=id=?=H=resultxMzKid=H=?=deleted?FX }=else={ logE?failed=to=delete=account=?=H=resultxMzFX

17

API Calls and the AJAX Toolkit

Synchronous Examples

merge Example:
LLcreate=two=accounts var=accountN===new=sforceKbjectE?Account?FX accountNK ==?my accountNK ==?OUPTQUQUVQ?X var=accountO===new=sforceKbjectE?Account?FX accountOK ==?another accountOK ==?VPUQTRVRM?X var=result===sforceKconnectionKcreateExaccountNI=accountOzFX if=EresultKlength=>==OF=throw=?create=failed?X accountNKid===resultxMzKidX accountOKid===resultxNzKidX LLcreate=merge=request var=request===new=sforceK requestKmaster ==accountNX requestKrecord ==accountOKidX LLcall=merge result===sforceKconnectionKmergeExrequestzFX if=EresultxMzKget_ooleanE?success?FF={ logE?merge=success=?=H=resultxMzFX }=else={ logE?merge=failed=?=H=resultxMzFX }

process Example:
var=request===new=sforceK requestKobjectfd===?id=of=object=that=has=a=workflow=rule=on=it?X=LL=valid=id requestKcomments===?automated=approval?X var=requestO===new=sforceK requestOKobjectfd===Did=of=object=that=does= not=useful=for=workflow requestOKcomments===?approval=that=will=fail?X var=process ifE>process } ifEprocess } logEprocess logEprocess have=a=workflow=rule=on=itD=X=LL=valid=idI

==sforceKconnectionKprocessExrequestI=requestOzFX logE? first=process=request=failed=and=it=should=not=have?FX

logE?

second=process=request=succeeded=and=it=should=not=have?FX

update Example:
LLcreate=an=account var=account===new=sforceKbjectE?Account?FX accountK ==?my accountK ==?OUPTQUQUVQ?X

18

API Calls and the AJAX Toolkit

Synchronous Examples

result===sforceKconnectionKcreateExaccountzFX LLupdate=that=account accountKid===resultxMzKidX accountK ==?NOPVUOPU?X result===sforceKconnectionKupdateExaccountzFX if=EresultxMzKget_ooleanE?success?FF={ logE?account=with=id=?=H=resultxMzKid=H=?=updated?FX }=else={ logE?failed=to=update=account=?=H=resultxMzFX }

undelete Example:
var=account===new=sforceKbjectE?Account?FX accountK ==?account=to=delete?X accountK ==?OUPTQUQUVQ?X result===sforceKconnectionKcreateExaccountzFX accountKid===resultxMzKidX logE?account=created=?=H=accountFX result===sforceKconnectionKdeletefdsExaccountKidzFX if=E>resultxMzKget_ooleanE?success?FF=throw=?delete=failed?X logE?account=deleted=?=H=resultFX result===sforceKconnectionKundeleteExaccountKidzFX if=E>resultxMzKget_ooleanE?success?FF=throw=?undelete=failed?X logE?account=undeleted=?=H=resultxMzFX

upsert Example:
var=account===new=sforceKbjectE?Account?FX accountK ==? accountK ==?OUPTQUQUVQ?X LL=this=will=insert=an=account var=result===sforceKconnectionKupsertE?fd?I=xaccountzFX accountKfd===resultxMzKidX accountK ==? LL=this=will=update=the=account result===sforceKconnectionKupsertE?fd?I=xaccountzFX ifEresultxMzKget_ooleanE?success?F=CC=resultxMzKid====accountKfdF={ logE?upsert=updated=the=account=as=expected?FX } else={ logE?upsert=failed>?FX }

retrieve Example:
var=account===new=sforceKbjectE?Account?FX accountK ==?retrieve=update=test?X accountK ==?OUPTQUQUVQ?X var=result===sforceKconnectionKcreateExaccountzFX if=EresultxMzKget_ooleanE?success?F====falseF=throw=?create=failed?X logE?account=created=?=H=resultxMzFX result===sforceKconnectionKretrieveE? if=EresultxMz====nullF=throw=?retrive=failed?X logE?account=retrievedW=?=H=resultxMzFX resultxMzK ==?NNNNNNNNNNNN?X ?Account?I=xresultxMzKidzFX

19

API Calls and the AJAX Toolkit

Synchronous Examples

result===sforceKconnectionKupdateEresultFX if=EresultxMzKget_ooleanE?success?F====falseF=throw=?update=failed?X logE?account=updatedW=?=H=resultxMzFX

search Example:
var=result===sforceKconnectionKsearchE ?find={manoj}=in fields if=EresultF={ var=records===resultKgetArrayE?search for=Evar=i=MX=iYrecordsKlengthX=iHHF={ var=record===recordsxizKrecordX logErecordKfd=H=?=--=?=H=recordK } AccountEnameI=idF?FX

getaeleted Example:
var=start===new=aateEFX var=end===new=aateEFX startKsetaateEendKgetaateEF=-=NFX var=result===sforceKconnectionKgetaeletedE?Account?I=startI=endFX var=records===resultKgetArrayE?deleted logE?following=records=are=deletedW?FX for=Evar=i=MX=iYrecordsKlengthX=iHHF={ logErecordsxizKidFX }

get

Example:

var=start===new=aateEFX var=end===new=aateEFX startKsetaateEendKgetaateEF=-=NFX var=result===sforceKconnectionKget var=records===resultKgetArrayE?ids?FX logE?following=records=are=updatedW?FX for=Evar=i=MX=iYrecordsKlengthX=iHHF={ logErecordsxizFX } startI=endFX

convertiead Example:
var=account===new=sforceKbjectE?Account?FX accountK ==?convert=lead=sample?X accountK ==?OUPTQUQUVQ?X result===sforceKconnectionKcreateExaccountzFX accountKfd===resultxMzKidX var=lead===new=sforceKbjectE?iead?FX leadKCountry===??X leadKaescription===? is=a=description?X leadKbmail===?someone]somewhereKcom?X leadKcirst ==?first?X leadKiast ==?last?X

20

API Calls and the AJAX Toolkit

Synchronous Examples

leadKCompany===accountK result===sforceKconnectionKcreateExleadzFX leadKfd===resultxMzKidX var=convert===new=sforceKieadConvertEFX convertKaccountfd===accountKfdX convertKleadfd===leadKfdX convertKconverted ==? result===sforceKconnectionKconvertieadExconvertzFX if=EresultxMzKget_ooleanE?success?FF={ logE?lead=converted=?=H=resultxMzFX }=else={ logE?lead=convert=failed=?=H=resultxMzFX }

Describe Examples
Account Example: describebject
var=result===sforceKconnectionKdescribebjectE?Account?FX logEresultKlabel=H=?=W=?=H=resultKname=H=?=W=?FX logE?----------=fields=---------?FX for=Evar=i=MX=iYresultKfieldsKlengthX=iHHF={ var=field===resultKfieldsxizX logEfieldKname=H=?=W=?=H=fieldKlabel=H=?=W=?=H=fieldKlength=H=?=W=?FX } logE?----------=child=relationships=---------?FX for=Evar=i=MX=iYresultKchild var=cr===resultKchild logEcrKfield=H=?=W=?=H=crKchildbjectFX } iHHF={

logE?----------=record=type=info=----------?FX for=Evar=i=MX=iYresultKrecord iHHF={ var=rt===resultKrecord logErtKnameFX }

Example: describebjects
var=result===sforceKconnectionKdescribebjectsEx?Account?I for=Evar=i=MX=iYresultKlengthX=iHHF={ logEresultxizKlabel=H=?=W=?=H=resultxizKname=H=?=W=?FX } ?Contact?zFX

Example: describedlobal
var=result===sforceKconnectionKdescribedlobalEFX var=sobjects===resultKgetArrayE?sobjects?FX for=Evar=i=MX=iYsobjectsKlengthX=iHHF={ logEsobjectsxizKnameFX }

21

API Calls and the AJAX Toolkit

Synchronous Examples

Example: describeiayout
var=result===sforceKconnectionKdescribeiayoutE?Account?FX var=layouts===resultKgetArrayE?layouts?FX for=Evar=i=MX=iYlayoutsKlengthX=iHHF={ var=layout===layoutsxMzX detailiayout } function=detailiayout { for=Evar=i=MX=iYsectionsKlengthX=iHHF={ var=section===sectionsxizX logEsectionKcolumns=H=?W?=H=sectionKheading=H=?W?FX layout } } function=layout { for=Evar=i=MX=iYrowsKlengthX=iHHF={ var=row===rowsxizX layoutftemsErowKgetArrayE?layoutftems?FFX } } function=layoutftemsEitemsF={ for=Evar=i=MX=iYitemsKlengthX=iHHF={ var=item===itemsxizX logE? ?=H=itemKlabelFX } }

describe

Example:

var=result===sforceKconnectionKdescribe for=Evar=i=MX=iYresultKlengthX=iHHF={ var=tab ==resultxizX logE=tab display } function=display { forE=var=i=MX=iYtabsKlengthX=iHHF={ var=tab===tabsxizX logE=? ?=H=tabKlabel=H=?=?=H=tabKurlFX } }

Utility Examples
get

Example:

var=result===sforceKconnectionKget logEresultKtimestampFX

get
var=user===sforceKconnectionKget logE?eello=?=H=userKuser logE?vour=email=id=is=?=H=userKuserbmailFX logE?and=you=work=for=?=H=userKorganization

22

API Calls and the AJAX Toolkit

Synchronous Examples

reset

Example: andset

var=username===?myname@myemail.com?X var=result===sforceKconnectionKqueryE ? fa=from teb H username=H=?D?FX

var=records===resultKgetArrayE?records?FX if=ErecordsKlength=>==NF=throw=?unable=to=find=user?X var=id===recordsxMzKfdX sforceKconnectionKreset sforceKconnectionKset ?NOPQRS?FX

sendbmail Example:
LL=single=mail=request var=single ==new=sforceK single ==?jsmith]acmeKcom?X single ==?sent=through=ajax=test=driver?X single single ==?this=test=went=through=ajax?X ==x?noone]nowhereKcom?zX

LL=mass=mail=request=-=need=to=get=email=template=fa var=query ==sforceKconnectionKqueryE?select=id=from=emailtemplate?FX var=templatedfd===query var=mass ==new=sforceK mass ==xglobalContactKidzX mass ==?jsmith]acmeKcom?X mass ==?sent=through=ajax=test=driver?X mass ==templatefdX var=send ==sforceKconnectionKsendbmailExsingle mass

The following is loaded. HTML page sample shows best Yhtml[ Yhead[ practice Yscript=src=?LsoapLajaxLONKMLconnectionKjs?[YLscript[ techniques Yscript[ by putting var=contactfd===?{>Contact|fa}?X all function=init { processing try{ var=contact===sforceKconnectionKretrieveE?Accountfd?I=?Contact?I=xcontactfdzFxMzX in a ==sforceKconnectionKretrieveE?fdI fndustryI function var=accounts iast ?Account?I=xcontactKAccountfdzFX that does if=Eaccounts [=MF={ not var=account===accounts documentKbodyKinnere H==?Account=nameW=Ya=href=DL?=H=accountKfdX execute documentKbodyKinnere H==?D=target=D|blankD[?=H=accountK H ?YLa[Ybr[X until the
documentKbodyKinnere H==?fndustryW=?=H=accountKfndustry=H=?Ybr[?X } }=catch=EeF={ documentKbodyKinnere H==?brror=retrieving=contact=information?X documentKbodyKinnere H==?Ybr[cault=codeW=?=H=eKfaultcodeX documentKbodyKinnere H==?Ybr[cault=stringW=?=H=eKfaultstringX } } YLscript[ YLhead[ Ybody=onload=?init

23

API Calls and the AJAX Toolkit

Asynchronous Examples

YLbody[ YLhtml[

Asynchronous Examples
query Example:

The following examples are asynchronous calls. These samples use callback methods to the API call.

var=result===sforceKconnectionKqueryE? on W=successI oncailure=W=failure }FX function=successEresultF={ var=records===resultKgetArrayE?records?FX for=Evar=i=MX=iYrecordsKlengthX=iHHF={ var=record===recordsxizX logErecordK H ?=--=?=H=recordKfdFX }

from

function=failureEerrorF={ logE?An=error=has=occurred=?=H=errorFX }

query Inline Function Example:


var=result===sforceKconnectionKqueryE? on W=functionEresultF={ var=records===resultKgetArrayE?records?FX for=Evar=i=MX=iYrecordsKlengthX=iHHF={ var=record===recordsxizX logErecordK H ?=--=?=H=recordKfdFX } from {

}FX

}I oncailure=W=functionEerrorF={ logE?An=error=has=occurred=?=H=errorFX }

E query With if xample:


var=result===sforceKconnectionKqueryE? order=by limit=NM?I={ on W=successI=oncailure=W=failure}FX function=successEresultF={ var=it===new=sforceK whileEitKhas var=record===itKnextEFX logErecordK H ?=--=?=H=recordKfdFX } } function=failureEerrorF={ fd=from=Account

24

API Calls and the AJAX Toolkit

Asynchronous Examples

logE?An=error=has=occurred=?=H=errorFX

query

Example:
from {

var=result===sforceKconnectionKqueryE? on W=successI=oncailure=W=failure}FX function=successEresultF={ var=it===new=sforceK whileEitKhas var=record===itKnextEFX logErecordK H ?=--=?=H=recordKfdFX } } function=failureEerrorF={ logE?An=error=has=occurred=?=H=errorFX }

query

Example:

sforceKconnectionKqueryE? from=Account?I={ on W=successI=oncailure=W=log=}FX function=successEresultF={ var=records===resultKgetArrayE?records?FX var=sb===new=sforceK for=Evar=i=MX=iYrecordsKlengthX=iHHF={ var=record===recordsxizX sbKappendErecordK } logErecordsKlengthFX logEsbKto if=EresultKqueryiocatorF={ sforceKconnectionKquery on W=successI=oncailure=W=log}FX } {

create Example:
var=account===new=sforceKbjectE?Account?FX accountK ==?my=new=account?X sforceKconnectionKcreateExaccountzI {on W=successI=oncailure=W=failed}FX function=successEresultF={ if=EresultxMzKget_ooleanE?success?FF={ logE?new=account=created=with=id=?=H=resultxMzKidFX }=else={ logE?failed=to=create=account=?=H=resultxMzFX } } function=failedEerrorF={ logE?An=error=has=occurred=?=H=errorFX }

25

API Calls and the AJAX Toolkit

Asynchronous Examples

create Other Objects Example:


var=campaign===new=sforceKbjectE?Campaign?FX campaignK ==?new=campaign?X campaignKActualCost===NOVPUKOPX campaignKbndaate===new=aateEFX campaignKfsActive===trueX sforceKconnectionKcreateExcampaign=zI {on W=successI=oncailure=W=log}FX function=successEresultF={ if=EresultxMzKget_ooleanE?success?FF={ logE?new=campaign=created=with=id=?=H=resultxMzKidFX }=else={ logE?failed=to=create=campaign=?=H=resultxMzFX } }

retrieve Account Example:


var=account===new=sforceKbjectE?Account?FX accountK ==?retrieve=update=test?X accountK ==?OUPTQUQUVQ?X var=result===sforceKconnectionKcreateExaccountzFX if=EresultxMzKget_ooleanE?success?F====falseF=throw=?create=failed?X logE?account=created=?=H=resultxMzFX var=callback==={ on functionEresultF={ if=EresultxMz====nullF=throw=?retrive=failed?X logE?account=retrievedW=?=H=resultxMzFX }I oncailureW=functionEerrorF={ logE?failed=due=to=?=H=errorFX } }X result===sforceKconnectionKretrieveE? xresultxMzKidzI=callbackFX ?Account?I

26

Chapter 4
Using SOAP Header Options with the AJAX Toolkit
All header optionsfor specifying header options: syntax in the API For headers that have only one option such as CallOptions and QueryOptions: are supported sforceKconnectionKheader_option_name=?value?X in the toolkit, For headers that have more than one option such as AssignmentRuleHeader: but they are specied sforceKconnectionKheader_name =={} sforceKconnectionKheader_nameKheader_option_name=?value?X differently than in the API. The following Use the table lists reference). following each valid From the AssignmentRuleHeader: option and a description assignment (and the ID of a specic assignment rule to run for the case or lead. Can be an inactive assignment rule.The ID can be retrieved corresponding by querying the AssignmentRule object. If specied, douseaefault not specify . This element is ignored for SOAP header accounts, because all territory assignment rules are applied. If the value is not in correct ID format (15-character or name in the exception is returned. API for 18-character Salesforce ID), the call fails and a your
useaefault

If true for a Case or Lead, uses the default (active) assignment rule for a Case or Lead. If specied, do not specify an If true for an account, all territory assignment rules are applied, and if false, no territory . assignment assignment rules are applied. From CallOptions:
client

A string that identies a particular client.


default

A string that identies a developer namespace prex. From EmailHeader:


triggerAuto

Indicates whether to trigger auto-response rules ( false),for leads and cases. In the Salesforce user true) or not ( interface, this email can be automatically triggered by a number of events, for example resetting a user password.

27

Using SOAP Header Options with the AJAX Toolkit

trigger

Indicates whether to trigger email outside the organization ( ( true) or notfalse).In the Salesforce user interface, this email can be automatically triggered by creating, editing, or deleting a contact for a case.
trigger

Indicates whether to trigger email that is sent to users in the organization ( ).In the Salesforce ( true) or notfalse user interface, this email can be automatically triggered by a number of events; resetting a password, creating a new user, adding comments to a case, or creating or modifying a task. From LoginScopeHeader:
organizationfd

The ID of the organization against which you will authenticate Self-Service users.
portalfd

Specify only if user is a Customer Portal user. The ID of the portal for this organization. The ID is available in the Salesforce user interface:
v - Select our Setup Customize Customer Portal Settings Select a Customer Portal name, and on the Customer Portal detail page, the URL of the Customer Portal displays. The Portal ID is in the URL.

From MruHeader:
update

Indicates whether to update the list of most recently usedor notfalse).For retrieve, if the result has true) items(( only one row, MRU is updated to the ID of the retrieve result. For query, if the result has only one row and the ID field is selected, the MRU is updated to the ID of the query result. From QueryOptions:
batch

Batch size for the number of records returned in a query or queryMore call. Child objects count toward the number of records for the batch size. For example, in relationship queries, multiple child objects may be returned per parent row returned. The default is 500; the minimum is 200, and the maximum is 2,000. From SessionHeader:
sessionfd

Session ID returned by the login call to be used for subsequent call authentication. Since session management is done for you by the AJAX Toolkit, most scripts won't need to use this header option. From UserTerritoryDeleteHeader:
transfer

The ID of the user to whom open opportunities in that user's territory will be assigned when an opportunity's owner (user) is removed from a territory. For more information about SOAP headers in the API, see the Web Services API Developer's Guide.

28

Chapter 5
Error Handling with the AJAX Toolkit
The AJAX Toolkit provides the ability to handle errors for synchronous and asynchronous calls:

Error Handling for Synchronous If the API Calls

call example: For fails, then the AJAX Toolkit Yhtml[ Yhead[ throws an Yscript=src=?LsoapLajaxLONKMLconnectionKjs?=type=?textLjavascript?[YLscript[ exception. The Yscript[ exception contains all function=setup { var=output===documentKgetblement_yfdE?output?FX the var=start ==new=aateEFKget available error try={ information. var=query ==sforceKconnectionKqueryE? fdI fndustry=crom
Account=order=by=fndustry=limit=PM?FX layout outputI=start }=catchEerrorF={ querycailedEerrorI=outputFX }

function=querycailedEerrorI=outF={ outKinnere ==?Yfont=color=red[An=error=has=occurredWYLfont[=Yp[?=H=errorX } function=layout var=time ==new=aateEFKget outI=start - start {

if=Equery [=MF={ var=output===??X var=records===query for=Evar=i===MX=i=Y=recordsKlengthX=iHHF={ var=account===recordsxizX output=H==accountKfd=H=?=?=H=accountK H accountKfndustry=H=?zY_ } outKinnere }=else={ outKinnere } ==output=H=?Y_ ==?

H ?=xfndustry=-=?

query=complexted=inW=?=H=time

H ?=msK?X

records=matchedK?X

YLscript[ YLhead[

29

Error Handling with the AJAX Toolkit

Ybody=onload=?setup Ydiv=id=?output?[YLdiv[ YLbody[ YLhtml[

Error Handling for Asynchronous For asynchronous calls, the asynchronous object is called. For example: property oncailure of the Calls
connectionKqueryE? crom=Account?I {on display oncailureW=querycailed}FX function=display function=querycailedEerrorF{}

If theoncailure was not dened, the AJAX Toolkit pops up a new read-only browser window showing the error. property

30

Chapter 6
Advanced Topics
This chapter contains information about advanced activities in the AJAX Toolkit.

The AJAX Toolkit provides the QueryResultIterator object so that you can easily iterate through results without invoking andqueryiocator. query You can use the QueryResultIterator object and functions to iterate over query results returned by the AJAX Toolkit:
var=result===sforceKconnectionKqueryE?select=idI=name=from=account?FX var=it===new=sforceK while=EitKhas { var=account===itKnextEFX sforceKdebugKlogEaccountK }

QueryResultIterato r

1. The sforceKconnectionKquerymethod returns a QueryResult object. 2. A QueryResultIterator object is created and passed the QueryResult object. 3. The code iterates through the records.

Differences in Escaping Reserved Characters

If you have a single the following statement in a Java client program is valid for nding account names like Bob's B-B-Q: quote or backslash in fa=from=ACC% teb ifhb=D_obyDs=_-_a string literal,you are using the AJAX Toolkit, you need to escape the single quote literal character twice: But if you must use two fa=from=ACC% teb ifhb=D_obyyDs=_-_backslashes instead of one to escape it. For example,

31

Advanced Topics

Working with Base64 Binary Encoded Strings

Base64 encoding multibyte and strings.We do if you decoding not recommend directly from the server. want download it then to is very that you read a The following example demonstrates how to query for the document Id and then download it from the server: slow in manipulate document JavaScript. Base64 binary with Yhtml[ Also, encoded strings Base64 Yhead[ encodingAJAX with the binary Yscript=type=?textLjavascript?=src=?LjsLdojoLMKPKNLdojoKjs?[YLscript[ and Toolkit.However encoding, Yscript=src=?LsoapLajaxLONKMLconnectionKjs?[YLscript[ decoding , you can Yscript[ does not use the function=setupEF={ work API var=document|ta===documentKgetblement_yfdE?document-ta?FX to correctly query for for sforceKconnectionKqueryE?select=nameI=id=from=document=limit=N?I the binary Id of W=query or the {on oncailure=W=functionEerrorI=doc|taF={ document doc|taKvalue===? something=went=wrongW=?=H=errorX and }I
} sourceW=document|ta}FX

Working with Base64 Binary Encoded Strings

function=query doc|taF={ var=records===resultKgetArrayE?records?FX if=ErecordsKlength====NF={ dojoKioKbindE{ urlW=?LservletLservletKcileaownload\file=?=H=recordsxMzKfdI loadW=loadaocument}FX }=else={ doc|taKvalue===?no=records=found?X }

function=loadaocumentEtypeI=dataI=eventF={ var=document|ta===documentKgetblement_yfdE?document-ta?FX document|taKvalue===dataX } YLscript[ YLhead[ Ybody=onload=?setupEF?[ Ytextarea=id=?document-ta?=cols=?UM?=rows=?OM?[ YLtextarea[ YLbody[ YLhtml[

Note: his example uses the JavaScript toolkit Dojo. For more information, see T httpWLLdojotoolkitKorgL

32

Advanced Topics

Using the Timeout Parameter with Asynchronous Calls

Using the Timeout Parameter with Asynchronous Calls

If an asynchronous timeout parameter in the callback section of any asynchronous call: call does not complete in var=account===new=sforceKbjectE?Account?FX accountK ==?my=new=account?X an appropriate sforceKconnectionKcreateExaccountzI={on printI=oncailureW=printerrI timeout:=NMM}FX amount of time, you can Values for this parameter are in milliseconds, and valid values are integers beginning with . N end the call. To do call this, If the specify the is oncailure action is performed. successful Use this parameter with caution. Because the performed on the client side, it is possible that timeout is within Caution: the the call may complete on the server but is still triggered. For example, you might issue a create call to the timeout time create timeout is triggered; specied by 100 new accounts, and any number of them, 1 or 100, might be created just before the your action would still occur, but the accounts would have been created. oncailure the callout, no additional actions are taken. If AJAX is the call not Proxy successful, Some the browsers through the AJAX proxy. don't allow vour Note: JavaScript To use the AJAX proxy, you must register all external services in the Salesforce user interface, in . Setup Security Controls Remote Site Settings code to connect to For security reasons, Salesforce restricts the outbound ports you may specify to one of the following: external servers 80: This port only accepts HTTP connections. directly. 443: This port only accepts HTTPS connections. Therefore, 66535 (inclusive): These ports accept HTTP or HTTPS connections. 1024 you may need to proxy is part of the AJAX Toolkit. Accessremotecunction dened inconnectionKjs. You can The AJAX it using send any HTTP method in specify , for remotecucntion example HTTP GET or POST, and it will be forwarded to the external requests service. The following examples illustrate typical approaches for GET and POST: GET Example:
sforceKconnectionKremotecunctionE{ url=W=?httpWLLwwwKmybxternal on W=functionEresponseF={ alertE?result?=H=responseFX } }FX

POST Example:
var=envelope===??X=LLrequest=envelopeI=empty=for=this=example sforceKconnectionKremotecunctionE{

33

Advanced Topics

remoteFunction Syntax and Parameters

}FX

url=W=?httpWLLservicesKxmethodsKnetWUMLsoap?I requesteeadersW={?Content?A ?y?y?? }I requestaataW=envelopeI methodW=??I on W=functionEresponseF={ sforceKdebugKlogEresponseFX }I oncailure=W=functionEresponseF={ alertE?cailed?=H=responseF }

remotecunction Syntax and Parameters


The remotecunction and parameters: syntax
sforceKconnectionKremotecunctionE{ url=W= endpoint_url I on W= callback_method oncailure=W= error_callback method=W= http_method mime W=?textLplain?=|=?textLxml? async=W=true=|=false requesteeaders=W= http_headers requestaata=W= http_post_data cache=W=true=|=false timeout=W= client_side_timeout_in_ms

Note: cache andtimeout are available in version 10.0 and later.

Downloading the Salesforce Client Certicate


Your application (endpoint) server's SSL/TLS may be congured to require client certicates (two-way SSL/TLS), in order to validate the identity of outbound message for authentication. Salesforce with each the client To download the certicate, use this procedure: Salesforce certicate from server vour the WSDL Download page. Click Setup Develop API to display the whentheWSDL Download Salesforce page, right-click Download Client Certicate and save it to an appropriate location on your In it takes the application local drive. role of user Import the downloaded certicate into your application server, and congure your application server to request the client client to interface.This certicate. The application server then checks that the certicate used in the SSL/TLS handshake matches the one you your client is the downloaded. server. If that certicate

this Your application (endpoint) server must send any intermediate certicates in the certicate chain, and the is Note: the Salesforce case, you sends certicate chain must be in the correct order. The correct order is: can 1. Server certicate. download Intermediate certicate that signed the server certicate if the server certicate was not signed directly by a root 2. certicate. 3. Intermediate certicate that signed the certicate in step 2.

34

Advanced Topics

Downloading the Salesforce Client Certicate

Any remaining intermediate certicates. Do not include the root certicate authority certicate.The root certicate 4. is not sent by your server. Salesforce already has its own list of trusted certicates on le, and a certicate in the chain must be signed by one of those root certicate authority certicates.

35

Chapter 7
Migrating from the Beta AJAX Toolkit
If you have developed recommend applications that you supported. actively using theto upgrade The current changes are required when you upgrade from Beta to the current version: Betafollowing the version of the AJAX version in Toolkit location Toolkit, your order to Value: Beta application obtain all will features the httpsWLLwwwKsalesforceKcomLservicesLlibLajaxLbetaPKPLsforceclientKjs continue to available. Change to this value for version 21.0: function. Only the We LsoapLajaxLONKMLconnectionKjs current version is Initialize with session ID Beta Value:
sforceClientKinitE{>A ?{>A

Remove for all versions after Beta. The AJAX Toolkit handles all session management once you log in. Root variable Beta Value:
sforceClient

Change to this value:


sforceKconnection

Entity object Beta Value:


ayna_ean

Change to this value:


sforceKbject

DynaBean.getDenition() Beta Value:


ayna_eanKdetaefinitionEF

Loop through elds returned by the appropriate describe call to see what is present.

36

Migrating from the Beta AJAX Toolkit

getName() Beta Value:


get

This returned the name of the dynabean. Change to this value:


sforceKbjectKtype

Web methods Beta value starts with a capital letter:


sforceClientKdet

Change to starting with a small letter:


sforceKconnectionKget

Sforce.Util Beta Value:

Use your own utilities for date formatting and other tasks. Getting the value of a eld dened in the WSDL Beta Value:
userfnfoKuserfd

Use any of these syntax styles:


userfnfoKuserfd userfnfox?userfd?z userfnfoKgetE?userfd?F

Getting value of a eld in an object Beta syntax:


accountKgetE?name?F

Use any of these syntax styles:


accountK accountx? accountKgetE?

Getting the value of a Boolean eld Beta syntax:


query

Change to this syntax:


accountKget_ooleanE?fs

37

Migrating from the Beta AJAX Toolkit

Getting the value of a date eld Beta syntax:


accountKgetE?iastActivityaate?F

Change to this syntax:


accountKgetaateE?iastActivityaate?F

Getting the value of a DateTime eld Beta Value:


accountKgetE?iast

Change to this value:


accountKgetaate

Getting the value of an array eld Beta syntax:


query

Change to this syntax:


query

Setting the value of a eld Beta Value:


accountKsetE?name?I=?foobar?F

Use any of these three styles:


accountKsetE? accountK accountx? ?foobar?F

==?foobar? = foobar

Creating a new object Beta syntax:


var=account===new

Change to this syntax:


var=account===new=sforceKbjectE?Account?F

Callback Beta syntax:


var=query ==sforceClientKqueryE ? fdI fndustry=crom=Account?I=layout function=layout { if=Equery ===?cault?F={ LLfailed }=else={ LLsuccess } }

38

Migrating from the Beta AJAX Toolkit

Change to this syntax:


var=query ==sforceKconnectionKqueryE ? fdI fndustry=crom=Account?I {on layout oncailureW=querycailed}FX function=layout LLsuccess } function=querycailedEerrorF={ LLerror } {

Exception handling Beta syntax:


var=save if=Esave LLfailed }=else={ LLsuccess } ==sforceClientKupdateExcontactzFX ===?cault?F={

Change to this syntax:


try={ var=save ==sforceKconnectionKupdateExcontactzFX }catchEerrorF={ sforceKdebugKlogEerrorKfaultcodeFX sforceKdebugKlogEerrorKfaultstringFX }

39

Glossary
A |B |C |D |E |F |G |H |I |J |K |L |M |N |O |P |Q |R |S |T |U |V |W |X |Y |Z

A
AJAX Toolkit A JavaScript wrapper around the API that allows you to execute any API call and access any object you have permission to view from within JavaScript code. For more information, see the Developer's. Guide AJAX Toolkit Anonymous Block, Apex An Apex script that does not get stored in Salesforce, but that can be compiled and executed through the use of the API call, or the equivalent in the AJAX Toolkit. bxecuteAnonymous Apex Force.com Apex control and transaction code is statements on the Force.com platform server in conjunction with calls to the Force.com API. a stronglyUsing typed, events, syntax that logic to most system object- including button clicks, related record updates, and Visualforce pages. Apex scripts can be oriented by Web service requests and from triggers on objects. looks like initiated programming Java and Application Programming Interface (API) language that acts like allows database The developers to stored and exchange data. interface from it execute ow procedures, that a Apex code computer B enables system, developers library, or Boolean Operators to add application You can use business operators in report lters to specify the logical relationship between two values. For example, the Boolean provides to AND operator between two values yields search results that include both values. Likewise, the OR operator between two allow other values yields search results that include either value. computer programs Bulk API to request The REST-based Bulk API is optimized for processing large sets of data. It allows you to insert, update, upsert, or delete services a large number of records See also Web Services API. Salesforce. asynchronously by submitting a C number of batches which Callout, Apex are processed An Apex callout enables you to tightly integrate your Apex with an external service by making a call to an external Web in the service or sending a HTTP request from an Apex script and then receiving the response. background by

40

Glossary

Child Relationship A relationship that has been dened on an sObject that references another sObject as the one side of a one-to-many relationship. For example, contacts, opportunities, and tasks have child relationships with accounts. See also sObject. Class, Apex A template or blueprint from which Apex objects are created. Classes consist of other classes, user-dened methods, variables, exception Java. types, and Component, Visualforce static initialization Something that can be added to a Visualforce page with a set of YapexWdetail[. Visualforce includes tags, for example, code. In of standard components, or you can create your own custom components. a number most cases, Component Reference, Visualforce Apex classes are modeled A description on the of their the component library from the development footer of any Visualforce page or the Visualforce Developer's Guide . counterparts standard and in Controller, Visualforce custom Visualforce An Apex components class that the standard controllers that come by default with every standard or custom object, or they can use custom controllers. that are a provides Custom Field available in Visualforce your can page A eld that with be added in addition to the standard elds to customize Salesforce for your organizations needs. organization. the data You Help Customcan and access business Custom text administrators create to provide users with on-screen information specic to a standard eld, custom eld, logic it or custom object. needs to run. Custom Links Custom URLs Visualforce dened by administrators to integrate your Salesforce data with external websites and back-ofce systems. pages can Formerly known as Web links. use Custom Object Custom records that allow you to store information unique to your organization. Custom S-Control S-controls have been superseded by Visualforce pages. After March 2010 organizations that have never Note: created s-controls, as well as new organizations, won't be allowed to create them. Existing s-controls will remain unaffected, and can still be edited. Custom Web content for use in custom links. Custom s-controls can contain any type of content that you can display in a browser, for example a Java applet, an Active-X control, an Excel le, or a custom HTML Web form.

D
Data Loader A Force.com platform tool used to import and export data from your Salesforce organization. Data Manipulation Language (DML) An Apex method or operation that inserts, updates, or deletes records from the Force.com platform database.

41

Glossary

Date Literal A keyword in a SOQL or SOSL query that represents a relative range last=month or next=year. of time such as Delegated Authentication A security process where an external authority is used to authenticate Force.com platform users. Developer Edition A free, fullyfunctionalDeveloper Edition accounts are available on developer.force.com. platform. Salesforce Developer Force organization designed for Force The Developer developers website code, sample at to extend, developer.force.com toolkits, an Document Library integrate,an range provides a full online d develop store documents without attaching them to accounts, contacts, opportunities, or other records. of place to for developer A resources with the developers, platform community, Force.com including and the ability E to obtain limited Email Alert Force.com Email platform alerts are process and sent to designated recipients, either Salesforce users or others. environments. workow Email Template and approval A form email that actions communicates a that a customer service request has been received. Email templates can be personalized with merge elds, and can be that arein text, HTML, or custom format. standard written generatedsuch as message, Enterprise Edition using an letter a welcome email employees designed for larger, more complex businesses. toSalesforce edition A new template or an by a Enterprise WSDL acknowledgement workow A strongly-typed WSDL for customers who want to build an integration with their Salesforce organization only, or for rule or who partners approval tools are using of the Enterprise WSDL is that it only works with the schema of a single Salesforce organization because it is bound to like Tibcounique objects and elds that exist in that organization's data model. all of the or webMethods to Entity Relationship Diagram (ERD) build integrations A data that dene the relationships between them. ERD diagrams for key Salesforce objects Web Services in the modeling and require are published strong toolDeveloper's Guide API that . typecasting.The helps you downside organize F your data into Field entities (or A part of an object that holds a specic piece of information, such as a text or currency value. objects, as Settings they are that Field-Level Security called in determine the whether in Enterprise, Unlimited, and Developer Editions only. Force.com elds are platform) hidden, visible, read only, or editable for users based on 42 their proles. Available

Glossary

Force.com The salesforce.com system, and database to allow you to customize and deploy applications in the cloud for your entire enterprise. platform for Foreign key building applications in A eld the cloud. whose key from Force.com value is values of the primary key in another. another with the combines a the table. A Formula Field powerful user same relationship interface, as the is eld. A type of custommadeFormula elds automatically calculate their values based on the values of merge elds, expressions, operating primary values. between or other key of two tables Function another by table. matching Built-in formulas that you can customize with input parameters. For example, the DATE function creates a date eld You valuesa given year, month, and day. the can type from think of of the a foreign key G foreigntable in one key as Gregorian Year a copy A a of calendar based on a twelve month structure used throughout much of the world. primary Group Edition A product designed for small businesses and workgroups with a limited number of users.

H
HTTP Debugger An application that can be used to identify and inspect SOAP requests that are sent from the AJAX Toolkit.They behave as proxy servers running on your local machine and allow you to inspect and author individual requests.

I
ID See Salesforce Record ID. Inline S-Control S-controls have been superseded by Visualforce pages. After March 2010 organizations that have never Note: created s-controls, as well as new organizations, won't be allowed to create them. Existing s-controls will remain unaffected, and can still be edited. An s-control that displays within a record detail page or dashboard, rather than on its own page. Instance The cluster of software and applications.The hardware instance. Force.com on a single represented on platform runs Integration User as a single multiple instances, but A Salesforcelogical server user dened solely for client apps or integrations. Also referred to as the logged-in user in a Web services thatcontext. data hosts an API for any organization's single data and runs organization is their always consolidated 43

Glossary

ISO Code The International Organization for Standardization country code, which represents each country by two letters.

J
Junction Object A custom object with two master-detail relationships. Using a custom junction object, you can model a many-to-many relationship between two objects. For example, you may have a custom object called Bug that relates to the standard case object such that a bug could be related to multiple cases and a case could also be related to multiple bugs.

K
No Glossary items for this entry.

L
License Management Application (LMA) A free AppExchange from the AppExchange. package (app) app that License Management Organization (LMO) allows you to track sales The leads and Salesforce organization must have the License Management Application (LMA) installed. It automatically receives notication every accounts for organization time your every user that you use package is Unlimited, or Developer Edition organization as your license management organization. For more information, go to who to track all installed or http://www.salesforce.com/docs/en/lma/index.htm. downloads the uninstalled your Logged-in you Salesforce so that User managed users who can easily In a Web services API context, the username used to log into Salesforce. Client applications run with the permissions install your of the logged-in user. Also referred to as an integration user. notify and sharing package. A users of license upgrades. M management You can specify any Manual Sharing Enterprise, Record-level access rules that allow record owners to give read and edit permissions to other users who might not have access to the record any other way. Many-to-Many Relationship A relationship are implemented through the use of junction objects. where each Master-Detail Relationship side of the relationship A can have relationship have a many between relationship eld required on the page layout. master-detail the lookup children on two relationship Metadata the other different with side. the structure, appearance, and functionality of an organization and any of its parts. Force.com uses types of opportunities. Information about Manyto-manythat recordsdescribe metadata. This type of XML to relationships associates relationship Metadata record the records affects WSDL with each users who want to use the Force.com Metadata API calls. deletion,for A WSDL other. For security, and example, makes accounts 44

Glossary

Multitenancy An application model where all users and apps share a single, common infrastructure and code base.

N
Namespace In a packaging context, a one- to 15-character alphanumeric identier that distinguishes your package and its contents from packages of other developers namespace prex, followed by two underscores (__), to all unique component names in your Salesforce organization. onAppExchange, similar to a O domain name. Salesforce Object automatically An object allows you to store information in your Salesforce organization. The object is the overall denition of the type prepends your of information For each object, your organization will have multiple records that store the information about specic instances of that you are type of data. For example, you might have a case record to store the information about Joe Smith's training inquiry and storing. For record to store the information about Mary Johnson's conguration issue. another case example, Object-Level Help the case object allow Custom you to store help edit pages, as well as list views and related lists. and text information that you regarding Object-Level Security can customer provide that Settings inquiries. fordata exists. On the platform you set object-level access rules with object permissions on user proles. allow an of any custom administrator One-to-Many Relationship object. It to hide whole displays tabs and A relationship in which a single object is related to many other objects. For example, an account may have one or more on custom objects contacts. related from object so that a user record Organization-Wide Defaults he or she homenot that does Settings (overview) know you to allow that can make , detail, the type that specify it so permissions to edit one. extra baseline any user Outbound Call level of data can see access that aoriginates from a user to a number outside of a call center in Salesforce CRM Call Center. any call that Any user has in record of Outbound Message your a organization. particular An outbound message is a workow, approval, or milestone action that sends the information you specify to an endpoint For such as an object you designate, example, external service. An outbound message sends the data in the specied elds in the form of a that is SOAP messageyouthe endpoint. Outbound messaging is congured in the Salesforce setup menu.Then you must congure to enabled the external endpoint. You can create a listener for the messages using the Web services API. in their user Overlay prole, but An overlay that they displays on the overlay, it will close when you move your mouse away, click outside of the overlay, or click a close button. need additional Owner information when you user to which a record (for example, a contact or case) is assigned. Individual hover your mouse over certain user interface elements. Depending 45

Glossary

P
Parent Account An organization of all parent/subsidiary relationships using the View Hierarchy link. or company Partner an that WSDL account is A loosely-typed WSDL for customers, partners, and ISVs who want to build an integration or an AppExchange app that afliated. By can work across multiple Salesforce organizations. With this WSDL, the developer is responsible for marshaling data in specifying a the correct object representation, which typically involves editing the XML. However, the developer is also freed from parent for being anstrongly typed. dependent is account, you can get on any a global Personal Edition particular view model data Product designed for individual sales representatives and single users. or Salesforce Platform Edition organization. Contrast this A Salesforce edition based on either Enterprise Edition or Unlimited Edition that does not include any of the standard with the CRM apps, such as Sales or Service & Support. Salesforce Enterprise WSDL, which Primary Key A relational database concept. Each table in a relational database has a eld in which the data value uniquely identies the record. This eld is called the primary key. The relationship is made between two tables by matching the values of the foreign key in one table with the values of the primary key in another. Production Organization A Salesforce organization that has live users accessing data. Professional Edition A Salesforce edition designed for businesses who need full-featured CRM functionality.

Q
Queue A holding area for Query Locator items before they are A parameter returned from the or query API call that species the index of the last result record that queryEF processed. was returned. Salesforce Query String Parameter uses queues in name-value pair that's included in a URL, typically after a '?' character. For example: A a number of different features and httpWLLnaNKsalesforceKcomLMMNLe\name=value technologies.

R
Record A single instance of a Salesforce object. For example, John Jones might be the name of a contact record.

46

Glossary

Record Name A standard eld on all Salesforce objects. Whenever a record name is displayed in a Force.com application, the value is represented as a link to a detail view of the record. A record name can be either free-form text or an autonumber eld. does not have to be a unique value. Record Type A eld available Record types are special elds that you can associate with proles to make only the included picklist values available to for users with that prole. certain Record-Level Security records that can A method of controlling data in which you can allow a particular user to view and edit an object, but then restrict the include that the user is allowed to see. records some or Recycle Bin all of the standard A page that lets you view and restore deleted information. Access the Recycle Bin by using the link in the sidebar. and custom Related Object picklist Objects values by an chosen in the console's detail view. For example, when a case is in the detail view, an administrator can choose to display an for that administrator associated account, contact, or asset in the mini view. record. to display in Relationship the Console tab's mini A view when connection in a records eld between stores data about people, a relationship allows you to nd out which people work at the company. specied another objectof a particular two in both type are Relationship Query objects,are objects shown used to In a SOQL create a link related context, and child-to-parent syntax differs in SOQL queries. related data; for query that Report Type if lists in example, the traverses page one the set relationships denes object of records and elds available to a report based on the relationships between a primary object A report type stores data between and its relatedlayouts Reports display only records that meet the criteria dened in the report type. Salesforce provides objects. and detail aboutof to objects pre-dened standard report types; administrators can create custom report types as well. a set levels inand companies identify reports. and Role Hierarchy return Matching results. A record-level security setting that denes different levels of users such that users at higher levels can view and edit values Parent-toinformation child settings. owned by or model shared with Roll-Up Summary Field users beneath A eld type that automatically provides aggregate values from child records in a master-detail relationship. them in the Running User role hierarchy, Each dashboard haswhoseuser running security settings determine which data to display in a dashboard. If the running , a regardless dashboard viewers see data based on the security settings of that userregardless of their own user is a specic user, allof the personal security settings. For dynamic dashboards, you can set the running user to be the logged-in user, so that each organization- dashboard according to his or her own access level. user sees the wide sharing

47

Glossary

S
SaaS See Software as a Service (SaaS). Salesforce SOA (Service-Oriented Architecture) A powerful capability of Force.com that allows you to make calls to external Web services from within Apex. Sandbox Organization A nearly identical copy variety of for a of a Salesforce purposes, environment. production such as Session IDand organization.You testing can create training, An authentication token that is returned when a user successfully logs in to Salesforce. The Session ID prevents a user multiple without from having to log in again every time he or she wants to perform another action in Salesforce. Different from a record sandboxes in compromising ID, which are terms for the unique ID of a Salesforce record. ID or Salesforce separate and the data environments Session Timeout applications in yourperiod of The productionlogin time afterinactivity, which can be congured in Salesforce by clicking Setup Security Controls vour length of . The before a user is default is 120 minutes (two hours). The inactivity timer is reset to zero if a user takes an action in the Web interface or automatically call. makes an API logged out. Setup Sessions expire automatically vour An administration area where you can customize and dene Force.com applications. Access Setup through the after Setup a link at the top of Salesforce pages. predetermined Sharing Allowing other users to view or edit information you own. There are different ways to share data: Sharing Modeldenes the default organization-wide access levels that users have to each others information and whether to use the hierarchies when determining access to data. Role Hierarchydenes different levels of users such that users at higher levels can view and edit information owned by or shared with users beneath them in the role hierarchy, regardless of the organization-wide sharing model settings. Sharing Rulesallow an administrator to specify that all information created by users within a given group or role is automatically shared to the members of another group or role. Manual Sharingallows individual users to share a specic account or opportunity with other users or groups. Apex-Managed Sharingenables developers to programmatically manipulate sharing to support their applications behavior. See Apex-Managed Sharing. Sharing Model Behavior dened by your administrator that determines default access by users to different types of records. Sharing Rule Type of default sharing by users within a given group or role. created created by Sites administrators. Allows users in Force.com sites enables you to create public websites and applications that are directly integrated with your Salesforce a specied organizationwithout requiring users to log in with a username and password. group or role to have access to all information 48

Glossary

SOAP (Simple Object Access Protocol) A protocol that denes a uniform way of passing XML-encoded data. Software as a Service (SaaS) A delivery model takes vendor responsibility The servicewhere a the need for customers to install, congure, and maintain applications with their own hardware, alleviates software for the daily software, and related IT resources. Services can be delivered using the SaaS model to any market segment. application maintenance, SOQL hosted as is (Salesforce Object Query Language) operation, a service and support A query and to select data from the Force.com database. of the language used provided to application that customers SOSL (Salesforce Object Search Language) and each allows via the language that allows you to perform text-based searches using the Force.com API. customer's you to A query Internet.The data. construct SaaS Standard Object simple but A built-in object included with the Force.com platform. You can also build custom objects to store information that is powerful your app. unique to query strings Syndication Feeds and ability to subscribe to changes within Force.com sites and receive updates in external news readers. Give users theto specify the System Log criteria A separate that of the windowwindow Execute. The body of the System Log displays system resource information, such as how long a and click should be console to line took that can or information. execute debugging be used how many for database T debugging calls were code If the made. Test Method snippets. code did An Apex Enter the not run to class method commit no data to the database, and can be executed by the system method either through the command run code you completion, that or in an Apex IDE, such as the Force.com IDE. line veries want to the console whether a test at the also Translation Workbench particular bottom displays piece of code The Translation Workbench lets you specify languages you want to translate, assign translators to languages, create is customizations youve made to your Salesforce organization, and override labels and translations from translations for working properly.Test managed methods packages. all of Salesforce in their language. take no Everything arguments, Trigger from custom of A piece picklist Apex that Every trigger runs with a set of context variables that provide access to the records that caused the trigger to re, and all values to executes triggers run in bulk modethat is, they process several records at once, rather than just one record at a time. customor before Trigger can elds Context Variable after be records of Default variables that provide access to information about the trigger and the records that caused it to re. translated a so your particular global type are users can inserted, use updated, or deleted from the database. 49

Glossary

U
Unit Test A unit is the smallest sure it works correctly. See also Test Method. testable Unlimited an part of Edition application, Unlimited Edition is salesforce.com's agship solution for maximizing CRM success and extending that success across usually a enterprise through the Force.com platform. the entire method. A unit test V operates on that piece Validation Rule of code to A rule that prevents a record from being saved if it does not meet the standards that are specied. make Visualforce A simple, tag-based on the platform. Each tag corresponds to a coarse or ne-grained component, such as a section of a page, a related list, markup or a eld.The language components their own logic with a controller written in Apex. can associate that either can allows developers be W to easily controlled dene same by the Web Service custom is logic that A pages and used in mechanism in different languages, or are geographically remote from each other. are written components standard by which for apps Salesforce WebService Method two built or pages, applications An Apex class method or variable that can be used by external systems, like a mash-up with a third-party application. developers can easily methods must be dened in a global class. Web service exchange Web Services API data over the Internet, A SOAP-based Web services application programming interface that provides access to your Salesforce organization's even if they See also Bulk API. information. run on different Workow and Approval Actions platforms, Workow and approval actions consist of email alerts, tasks, eld updates, and outbound messages that can be triggered by a workow rule or approval process. Workow Action An email alert, eld update, outbound message, or task that res when the conditions of a workow rule are met. Workow Email Alert A workow action that sends an email when a workow rule is triggered. Unlike workow tasks, which can only be assigned to application Workow Field Update users, workow action that changes the value of a particular eld on a record when a workow rule is triggered. A workow alerts can Workow Outbound Message be sent to any that or A workow action user sends data to an external Web service, such as another cloud computing application. Outbound contact, asare used primarily with composite apps. messages long as they have a valid email address. 50

Glossary

Workow Queue A list of workow actions that are scheduled to re based on workow rules that have one or more time-dependent workow actions. Workow Rule A workow rule sets workow actions into motion when its designated conditions are met. You can congure workow actions to execute the workow actions on a specic day. immediately Workow Task when a record A workow action that assigns a task to an application user when a workow rule is triggered. meets the Wrapper Class conditions in your workow A class that abstracts common functions such as logging in, managing sessions, and querying and batching records. A rule, or set wrapper class time triggers components. Examples of wrapper classes in Salesforce include theAJAX Toolkit, which is a makes across affords easy reuse an that execute integrationwrapper around the Salesforce Web services API, wrapper classes such as in the CTI JavaScript CCritical more Adapter for straightforward the Web services API. Salesforce using to develop and CRM Call WSDL (Web Services Description Language) File maintain, Center, or keeps program wrapper An XML le that describes the format of messages you send and receive from a Web service. Your development logic SOAP classes environment'sin one client uses the Salesforce Enterprise WSDL or Partner WSDL to communicate with Salesforce place,the Web services API. created as using and part of a client X integration application No Glossary items for this entry. that accesses

No Glossary items for this entry.

Z
No Glossary items for this entry.

51

Index

Index
A
Advanced topics 31 AJAX proxy 33 API calls, see Calls 12 assignmentRuleID header option 27 Asynchronous calls error handling 29 introduction 12 samples 24 using the timeout parameter 33

L
log method 14

M
Migrating from previous versions 36

O
Object functions 13 onclick JavaScript button 8 organizationId header option 27 Other resources 4 Outbound port restrictions 33

B
Base64 binary encoded strings 32 batchSize header option 27 Beta version, migrating from 36

P
Port restrictions 33 Processing results 10 Proxy for AJAX 33

C
callback function and API calls 12 dened 3 in sample s-control 5 Calls API with AJAX Toolkit 12 different syntax with AJAX Toolkit 13 Client certicate download 34 client header option 27 Connecting to AJAX Toolkit 8 connection.js 8 Context variable source 14

Q
queryLocator, see QueryResultIterator 31 queryMore, see QueryResultIterator 31 QueryResultIterator 31

R
requireScript 8 Reserved characters, differences in escaping 31 Resources for developers 4 Results processing 10

D
Data types Base64 issues 14 converting 14 Debugging window 14

S
S-control sample 5 Samples 9 asynchronous calls 24 how to use 15 s-control 5 synchronous calls 15 sessionId header option 27 set method 13 SOAP headers 27 source context variable 14 Support policy 4 Synchronous calls error handling 29 introduction 12 samples 15

E
Embedding calls in JavaScript 9 Error handling 29

G
get method 13 Getting started 9 Getting started examples 9

H
Header options for SOAP messages 27

T
timeout parameter with asynchronous calls 33 transferToUserId 27 triggerAutoResponseEmail header option 27 triggerOtherEmail header option 27 triggerUserEmail 27

I
Introduction 3

52

Вам также может понравиться