text "apex reference guide version 58.0, summer ’23 @salesforcedocs last updated: june 15, 2023© copyright 2000–2023 salesforce, inc. all rights reserved. salesforce is a registered trademark of salesforce, inc., as are other names and marks. other marks appearing herein may be trademarks of their respective owners.contents apex reference guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 release notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 apex dml operations. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 apex dml statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 apexpages namespace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 action class. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 component class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 ideastandardcontroller class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 ideastandardsetcontroller class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 knowledgearticleversionstandardcontroller class . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 message class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 standardcontroller class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 standardsetcontroller class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 applauncher namespace. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 appmenu class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 communitylogocontroller class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 employeeloginlinkcontroller class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 sociallogincontroller class. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 approval namespace . . . . . . . . . . . . ." . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 lockresult class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 processrequest class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 processresult class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 processsubmitrequest class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 processworkitemrequest class. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 unlockresult class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 auth namespace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61 authconfiguration class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 authprovidercallbackstate class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74 authproviderplugin interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 authproviderpluginclass class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 authprovidertokenresponse class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89 authtoken class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91 communitiesutil class. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96 configurableselfreghandler interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 confirmuserregistrationhandler interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102 connectedappplugin class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105 headlessselfregistrationhandler interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112 invocationcontext enum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114 jws class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115contents jwt class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118 jwtbearertokenexchange class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123 lightninglogineligibility enum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128 logindiscoveryhandler interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129 logindiscoverymethod enum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136 mydomainlogindiscoveryhandler interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137 oauthrefreshresult class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141 registrationhandler interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143 samljithandler interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148 sessionmanagement class. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152 sessionlevel enum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164 userdata class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165 verificationmethod enum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170 verificationpolicy enum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171 verificationresult class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171 auth exceptions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174 cache namespace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176 cachebuilder interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177 org class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178 orgpartition class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196 partition class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199 session class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214 sessionpartition class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230 cache exceptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233 visibility enum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234 canvas namespace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235 applicationcontext interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235 canvaslifecyclehandler interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238 contexttypeenum enum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241 environmentcontext interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241 rendercontext interface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248 test class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250 canvas exceptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253 chatteranswers namespace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254 accountcreator interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254 commercepayments namespace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256 abstractresponse class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259 addressrequest class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262 auditparamsrequest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 266 abstracttransactionresponse class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268 authapipaymentmethodrequest class. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273 authorizationreversalrequest class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274 authorizationreversalresponse class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278 authorizationrequest class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283contents authorizationresponse class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288 baseapipaymentmethodrequest class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295 basenotification class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 298 basepaymentmethodrequest class. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303 baserequest class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305 capturenotification class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 306 capturerequest class. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311 captureresponse class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 312 cardcategory enum. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317 cardpaymentmethodrequest class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 318 custommetadatatypeinfo class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 324 gatewayerrorresponse class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325 gatewaynotificationresponse class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327 gatewayresponse interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 329 notificationclient class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 330 notificationsaveresult class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 331 notificationstatus enum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 333 paymentgatewayadapter interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 333 paymentgatewayasyncadapter interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 334 paymentgatewaycontext class. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 337 paymentgatewaynotificationcontext class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 339 paymentmethodtokenizationrequest class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 340 paymentmethodtokenizationresponse class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 345 paymentgatewaynotificationrequest class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 351 paymentshttp class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 353 refundrequest class. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 354 referencedrefundnotification class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 356 referencedrefundrequest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 360 referencedrefundresponse class. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 362 requesttype enum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 367 saleapipaymentmethodrequest class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 367 salerequest class. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 370 saleresponse class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 374 salesforceresultcode enum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 379 salesforceresultcodeinfo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 380 connectapi namespace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 381 actionlinks class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 385 announcements class. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 394 botversionactivation class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 399 cdpcalculatedinsight class. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 401 cdpidentityresolution class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 407 cdpquery class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 410 cdpsegment class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 427 chatter class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 432contents chatterfavorites class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 437 chatterfeeds class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 459 chattergroups class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 862 chattermessages class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 907 chatterusers class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 931 clm class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 966 commercebuyerexperience class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 968 commercecart class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1022 commercecatalog class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1058 commercepromotions class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1075 commercesearch class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1078 commercesearchsettings class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1083 commercestorepricing class. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1086 commercewishlist class. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1090 communities class. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1108 communitymoderation class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1111 contenthub class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1140 conversationapplicationdefinition class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1214 datacloud class. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1215 emailmergefieldservice class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1220 employeeprofiles class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1221 externalemailservices class. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1230 externalmanagedaccount class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1231 fieldservice class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1234 fulfillmentorder class. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1237 knowledge class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1242 lightningscheduler class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1247 managedcontent class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1252 managedcontentdelivery class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1273 managedtopics class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1290 marketingintegration class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1305 mentions class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1307 missions class. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1313 namedcredentials class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1318 navigationmenu class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1329 nextbestaction class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1333 omnichannelinventoryservice class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1339 orchestration class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1346 orderpaymentsummary class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1347 ordersummary class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1349 ordersummarycreation class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1361 organization class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1362 pardotbusinessunitcontext class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1362 payments class. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1364contents personalization class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1369 pick ticket class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1382 questionandanswers class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1383 recommendations class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1386 records class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1448 repricing class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1450 returnorder class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1452 routing class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1454 salesforceinbox class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1459 sites class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1460 smartdatadiscovery class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1461 socialengagement class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1461 surveys class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1472 taxplatform class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1473 topics class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1474 userprofiles class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1511 zones class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1521 connectapi input classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1531 connectapi output classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1664 connectapi enums . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1999 connectapi exceptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2030 connectapi utilities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2030 connectapi release notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2031 database namespace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2031 batchable interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2032 batchablecontext interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2034 deletedrecord class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2035 deleteresult class. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2036 dmloptions class. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2038 dmloptions.assignmentruleheader class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2041 dmloptions.duplicateruleheader class. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2042 dmloptions.emailheader class. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2044 duplicateerror class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2047 emptyrecyclebinresult class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2049 error class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2050 getdeletedresult class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2052 getupdatedresult class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2053 leadconvert class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2054 leadconvertresult class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2064 mergeresult class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2067 querylocator class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2069 querylocatoriterator class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2070 saveresult class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2072 undeleteresult class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2074contents upsertresult class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2075 datacloud namespace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2077 additionalinformationmap class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2078 duplicateresult class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2079 fielddiff class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2084 findduplicates class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2085 findduplicatesbyids class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2086 findduplicatesresult class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2088 matchrecord class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2091 matchresult class. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2092 datasource namespace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2095 asyncdeletecallback class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2097 asyncsavecallback class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2098 authenticationcapability enum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2099 authenticationprotocol enum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2099 capability enum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2100 column class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2101 columnselection class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2117 connection class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2118 connectionparams class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2124 datasourceutil class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2127 datatype enum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2128 deletecontext class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2129 deleteresult class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2130 filter class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2133 filtertype enum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2135 identitytype enum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2136 order class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2137 orderdirection enum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2139 provider class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2139 queryaggregation enum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2141 querycontext class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2141 queryutils class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2143 readcontext class. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2146 searchcontext class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2147 searchutils class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2149 table class. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2150 tableresult class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2154 tableselection class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2160 upsertcontext class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2161 upsertresult class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2162 datasource exceptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2165 dataweave namespace (beta) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2166 result class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2166contents script class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2168 dom namespace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2171 document class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2171 xmlnode class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2174 eventbus namespace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2184 changeeventheader class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2185 eventpublishfailurecallback interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2190 eventpublishsuccesscallback interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2191 failureresult interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2192 successresult interface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2193 testbroker class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2194 triggercontext class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2196 externalservice namespace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2198 flow namespace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2199 interview class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2199 functions namespace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2203 function class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2204 functioncallback interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2208 functionerrortype enum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2210 functioninvocation interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2210 functioninvocationerror interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2213 functioninvocationstatus enum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2214 functioninvokemock interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2215 mockfunctioninvocationfactory class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2218 invocable namespace. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2219 action class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2220 action.error class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2225 action.result class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2226 kbmanagement namespace. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2228 publishingservice class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2229 lxscheduler namespace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2240 getappointmentcandidatesinput class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2241 getappointmentcandidatesinputbuilder class . . . . . . . . . . . . . . . . . . . . . . . . . . . 2243 getappointmentslotsinput class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2250 getappointmentslotsinputbuilder class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2253 schedulerresources class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2260 skillrequirement class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2265 skillrequirementbuilder class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2265 worktype class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2266 worktypebuilder class. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2267 serviceresourceschedulehandler interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2271 serviceappointmentrequestinfo class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2274 serviceresourceinfo class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2278 serviceresourceschedule class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2281contents unavailabletimeslot class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2282 messaging namespace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2284 attachmentretrievaloption enum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2285 email class (base email methods) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2286 emailfileattachment class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2289 inboundemail class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2291 inboundemail.authenticationresult class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2298 inboundemail.authenticationresultfield class . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2299 inboundemail.binaryattachment class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2301 inboundemail.textattachment class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2303 inboundemailresult class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2305 inboundenvelope class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2306 massemailmessage class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2307 inboundemail.header class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2310 pushnotification class. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2311 pushnotificationpayload class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2314 customnotification class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2316 renderemailtemplatebodyresult class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2323 renderemailtemplateerror class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2325 sendemailerror class. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2326 sendemailresult class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2328 singleemailmessage methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2329 metadata namespace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2341 analyticscloudcomponentlayoutitem class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2344 consolecomponent class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2348 container class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2350 customconsolecomponents class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2353 custommetadata class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2354 custommetadatavalue class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2357 deploycallback interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2359 deploycallbackcontext class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2360 deploycontainer class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2362 deploydetails class. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2364 deploymessage class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2366 deployproblemtype enum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2371 deployresult class. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2371 deploystatus enum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2379 feeditemtypeenum enum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2380 feedlayout class. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2381 feedlayoutcomponent class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2385 feedlayoutcomponenttype enum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2387 feedlayoutfilter class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2387 feedlayoutfilterposition enum. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2389 feedlayoutfiltertype enum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2390contents layout class. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2390 layoutcolumn class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2397 layoutheader enum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2399 layoutitem class. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2399 layoutsection class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2404 layoutsectionstyle enum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2407 metadata class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2407 metadatatype enum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2409 metadatavalue class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2409 minilayout class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2410 operations class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2411 platformactionlist class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2415 platformactionlistcontextenum enum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2417 platformactionlistitem class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2418 platformactiontypeenum enum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2420 primarytabcomponents class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2420 quickactionlist class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2422 quickactionlistitem class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2423 relatedcontent class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2424 relatedcontentitem class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2425 relatedlist class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2427 relatedlistitem class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2428 reportchartcomponentlayoutitem class. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2431 reportchartcomponentsize enum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2434 sidebarcomponent class. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2435 sortorder enum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2439 statuscode enum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2439 subtabcomponents class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2440 summarylayoutstyleenum enum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2441 summarylayout class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2442 summarylayoutitem class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2445 uibehavior enum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2447 pref_center namespace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2447 loadformdata class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2448 loadparameters class. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2454 preferencecenterapexhandler interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2455 submitformdata class. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2457 submitparameters class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2460 tokentype enum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2461 tokenutility class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2462 validationresult class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2464 process namespace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2465 plugin interface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2465 plugindescriberesult class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2467contents plugindescriberesult.inputparameter class. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2470 plugindescriberesult.outputparameter class . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2473 pluginrequest class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2476 pluginresult class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2476 quickaction namespace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2477 describeavailablequickactionresult class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2478 describelayoutcomponent class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2480 describelayoutitem class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2481 describelayoutrow class. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2483 describelayoutsection class. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2484 describequickactiondefaultvalue class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2488 describequickactionresult class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2489 quickactiondefaults class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2505 quickactiondefaultshandler interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2507 quickactionrequest class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2512 quickactionresult class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2515 sendemailquickactiondefaults class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2517 reports namespace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2519 aggregatecolumn class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2523 bucketfield class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2524 bucketfieldvalue class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2531 buckettype enum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2535 columndatatype enum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2535 columnsortorder enum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2536 crossfilter class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2537 csfgrouptype enum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2542 dategranularity enum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2542 detailcolumn class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2543 dimension class. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2544 evaluatedcondition class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2545 evaluatedconditionoperator enum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2548 filteroperator class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2549 filtervalue class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2550 formulatype enum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2551 groupingcolumn class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2551 groupinginfo class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2553 groupingvalue class. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2554 notificationaction interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2556 notificationactioncontext class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2558 reportcsf class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2559 reportcurrency class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2568 reportdatacell class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2569 reportdescriberesult class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2570 reportdetailrow class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2571contents reportdivisioninfo class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2572 reportextendedmetadata class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2573 reportfact class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2574 reportfactwithdetails class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2575 reportfactwithsummaries class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2576 reportfilter class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2578 reportformat enum. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2582 reportfiltertype enum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2583 reportinstance class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2583 reportmanager class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2586 reportmetadata class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2591 reportresults class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2611 reportscopeinfo class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2613 reportscopevalue class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2614 reporttype class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2615 reporttypecolumn class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2616 reporttypecolumncategory class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2618 reporttypemetadata class. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2620 sortcolumn class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2622 standarddatefilter class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2623 standarddatefilterduration class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2626 standarddatefilterdurationgroup class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2628 standardfilter class. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2629 standardfilterinfo class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2631 standardfilterinfopicklist class. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2632 standardfiltertype enum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2634 summaryvalue class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2634 thresholdinformation class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2635 toprows class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2636 reports exceptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2639 richmessaging namespace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2640 authrequesthandler interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2640 authrequestresponse class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2643 authrequestresult class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2645 authrequestresultstatus enum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2647 messagedefinitioninputparameter class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2647 timeslotoption class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2651 schema namespace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2653 childrelationship class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2654 datacategory class. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2657 datacategorygroupsobjecttypepair class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2658 describecolorresult class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2660 describedatacategorygroupresult class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2662 describedatacategorygroupstructureresult class . . . . . . . . . . . . . . . . . . . . . . . . . 2664contents describefieldresult class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2667 describeiconresult class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2684 describesobjectresult class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2686 describetabresult class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2699 describetabsetresult class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2702 displaytype enum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2705 fielddescribeoptions enum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2707 fieldset class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2707 fieldsetmember class. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2711 picklistentry class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2713 recordtypeinfo class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2715 soaptype enum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2718 sobjectdescribeoptions enum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2718 sobjectfield class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2719 sobjecttype class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2720 search namespace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2724 knowledgesuggestionfilter class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2725 questionsuggestionfilter class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2729 searchresult class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2733 searchresults class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2735 suggestionoption class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2736 suggestionresult class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2737 suggestionresults class. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2738 sfc namespace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2739 contentdownloadcontext enum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2739 contentdownloadhandler class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2740 contentdownloadhandlerfactory interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2741 sfdc_checkout namespace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2743 asynccartprocessor interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2743 b2 bcheckoutcontroller class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2744 integrationinfo class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2745 integrationstatus class. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2747 integrationstatus.status enum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2748 sfdc_surveys namespace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2748 surveyinvitationlinkshortener interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2748 example implementation to associate surveysubjects with surveyinvitation and surveyresponses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2750 site namespace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2751 urlrewriter interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2752 site exceptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2753 support namespace. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2754 emailtemplateselector interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2754 milestonetriggertimecalculator interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2756 system namespace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2758contents accesslevel class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2765 accesstype enum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2766 address class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2766 answers class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2772 apexpages class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2774 approval class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2776 assert class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2788 asyncinfo class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2801 asyncoptions class. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2802 blob class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2803 boolean class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2806 businesshours class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2807 callable interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2811 cases class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2813 comparable interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2817 continuation class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2820 cookie class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2824 crypto class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2830 custom metadata type methods. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2846 custom settings methods. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2849 database class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2860 date class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2951 datetime class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2961 decimal class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2985 domain class. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2998 domaincreator class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3001 domainparser class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3005 domaintype enum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3007 double class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3007 emailmessages class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3011 encodingutil class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3015 enum methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3018 eventbus class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3019 exception class and built-in exceptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3021 flexqueue class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3026 featuremanagement class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3029 formula class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3035 formularecalcfielderror class. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3036 formularecalcresult class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3037 http class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3038 httpcalloutmock interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3039 httprequest class. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3040 httpresponse class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3050 id class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3056contents ideas class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3063 installhandler interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3068 integer class. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3071 json class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3073 jsongenerator class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3080 jsonparser class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3094 jsontoken enum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3106 label class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3107 limits class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3110 list class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3123 location class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3138 logginglevel enum. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3141 long class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3142 map class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3144 matcher class. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3156 math class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3168 messaging class. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3194 multistaticresourcecalloutmock class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3202 network class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3205 orglimit class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3210 orglimits class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3213 pagereference class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3214 packaging class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3226 pattern class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3227 queueable interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3231 queueablecontext interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3233 quickaction class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3234 quiddity enum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3238 remoteobjectcontroller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3239 request class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3243 resetpasswordresult class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3245 restcontext class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3245 restrequest class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3247 restresponse class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3252 sandboxpostcopy interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3256 schedulable interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3259 schedulablecontext interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3259 schema class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3260 search class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3265 security class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3271 selectoption class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3274 set class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3279 site class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3291 sobject class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3312contents sobjectaccessdecision class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3338 staticresourcecalloutmock class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3340 string class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3343 stubprovider interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3418 system class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3420 test class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3444 time class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3462 timezone class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3467 trigger class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3470 triggeroperation enum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3473 type class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3473 uninstallhandler interface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3481 url class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3483 userinfo class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3493 usermanagement class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3502 version class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3521 webservicecallout class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3525 webservicemock interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3526 xmlstreamreader class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3528 xmlstreamwriter class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3542 territorymgmt namespace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3549 opportunityterritory2assignmentfilter global interface . . . . . . . . . . . . . . . . . . . . . . 3549 txnsecurity namespace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3553 event class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3553 eventcondition interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3557 asynccondition interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3559 policycondition interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3560 userprovisioning namespace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3562 connectortestutil class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3562 userprovisioninglog class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3564 userprovisioningplugin class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3566 visualeditor namespace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3570 datarow class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3571 designtimepagecontext class . . . . . . . . . . . . . . ". . . . . . . . . . . . . . . . . . . . . . . . 3574 dynamicpicklist class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3576 dynamicpicklistrows class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3579 wave namespace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3584 querybuilder class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3584 querynode class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3588 projectionnode class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3592 templates class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3595 templatessearchoptions class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3598 appendices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3600 shipping invoice example. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3600contents reserved keywords . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3612 documentation typographical conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3613 glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3614apex reference guide apex is a strongly typed, object-oriented programming language that allows developers to execute flow and transaction control statements on the salesforce platform server, in conjunction with calls to the api. this reference guide includes built-in apex classes, interfaces, enums, and exceptions, grouped by namespace. it also includes apex dml statements to insert, update, merge, delete, and restore data in salesforce. for information on the apex development process, see apex developer guide. note: in api version 51.0 and earlier, apex reference information was included in the apex developer guide in the apex language reference section. in this section: apex release notes use the salesforce release notes to learn about the most recent updates and changes to apex. apex dml operations you can perform dml operations using the apex dml statements or the methods of the database class. for lead conversion, use the convertlead method of the database class. there is no dml counterpart for it. apexpages namespace the apexpages namespace provides classes used in visualforce controllers. applauncher namespace the applauncher namespace provides methods for managing the appearance of apps in the app launcher, including their visibility and sort order. approval namespace the approval namespace provides classes and methods for approval processes. auth namespace the auth namespace provides an interface and classes for single sign-on into salesforce and session security management. cache namespace the" "cache namespace contains methods for managing the platform cache. canvas namespace the canvas namespace provides an interface and classes for canvas apps in salesforce. chatteranswers namespace the chatteranswers namespace provides an interface for creating account records. commercepayments namespace use the commercepayments namespace to provide a safe and customizable platform for managing customer payments and refunds. connectapi namespace the connectapi namespace (also called connect in apex) provides classes for accessing the same data available in connect rest api. use connect in apex to create custom experiences in salesforce. database namespace the database namespace provides classes used with dml operations. 1apex reference guide datacloud namespace the datacloud namespace provides classes and methods for retrieving information about duplicate rules. duplicate rules let you control whether and when users can save duplicate records within salesforce. datasource namespace the datasource namespace provides the classes for the apex connector framework. use the apex connector framework to develop a custom adapter for salesforce connect. then connect your salesforce organization to any data anywhere via the salesforce connect custom adapter. dataweave namespace (beta) the dataweave namespace provides classes and methods to support the invocation of dataweave scripts from apex. dom namespace the dom namespace provides classes and methods for parsing and creating xml content. eventbus namespace the eventbus namespace provides classes and methods for platform events and change data capture events. externalservice namespace the externalservice namespace provides dynamically generated apex service interfaces and apex classes for complex object data types. flow namespace the flow namespace provides a class for advanced visualforce controller access to flows. functions namespace the functions namespace provides classes and methods used to invoke and manage salesforce functions. invocable namespace the invocable namespace provides classes for calling invocable actions from apex. kbmanagement namespace the kbmanagement namespace provides a class for managing knowledge articles. lxscheduler namespace the lxscheduler namespace provides an interface and classes for integrating salesforce scheduler with external calendars. messaging namespace the messaging namespace provides classes and methods for salesforce outbound and inbound email functionality. metadata namespace the metadata namespace provides classes and methods for working with custom metadata in salesforce pref_center namespace the pref_center namespace provides an interface, classes, and methods to create and retrieve data in forms in preference manager. preference manager, previously called preference center, is a feature within the privacy center app. process namespace the process namespace provides an interface and classes for passing data between your organization and a flow. quickaction namespace the quickaction namespace provides classes and methods for quick actions. reports namespace the reports namespace provides classes for accessing the same data as is available in the salesforce reports and dashboards rest api. 2apex reference guide apex release notes richmessaging namespace provides objects and methods for handling rich messaging content. schema namespace the schema namespace provides classes and methods for schema metadata information. search namespace the search namespace provides classes for getting search results and suggestion results. sfc namespace the sfc namespace contains classes used in salesforce files. sfdc_checkout namespace the sfdc_checkout namespace provides an interface and classes for b2b commerce apps in salesforce. sfdc_surveys namespace the sfdc_surveys namespace provides an interface for shortening survey invitations. site namespace the site namespace provides an interface for rewriting sites urls. support namespace the support namespace provides an interface used for case feed. system namespace the system namespace provides classes and methods for core apex functionality. territorymgmt namespace the territorymgmt namespace provides an interface used for territory management. txnsecurity namespace the txnsecurity namespace provides an interface used for transaction security. userprovisioning namespace the userprovisioning namespace provides methods for monitoring outbound user provisioning requests. visualeditor namespace the visualeditor namespace provides classes and methods for interacting with the lightning app builder. the classes and methods in this namespace operate on lightning components, which include lightning web components and aura components. wave namespace the classes in the wave namespace are part of the crm analytics analytics sdk, designed to facilitate querying crm analytics data from apex code. appendices apex release notes use the salesforce release notes to learn about the most recent updates and changes to apex. for apex updates and changes that impact the salesforce platform, see the apex release" "notes. for new and changed apex classes, methods, exceptions and interfaces, see apex: new and changed items in the salesforce release notes. 3apex reference guide apex dml operations apex dml operations you can perform dml operations using the apex dml statements or the methods of the database class. for lead conversion, use the convertlead method of the database class. there is no dml counterpart for it. see also: apex developer guide: working with data in apex database class apex dml statements use data manipulation language (dml) statements to insert, update, merge, delete, and restore data in salesforce. the following apex dml statements are available: insert statement the insert dml operation adds one or more sobjects, such as individual accounts or contacts, to your organization’s data.insert is analogous to the insert statement in sql. syntax insert sobject insert sobject[] example the following example inserts an account named 'acme': account newacct = new account(name = 'acme'); try { insert newacct; } catch (dmlexception e) { // process exception here } note: for more information on processing dmlexceptions, see bulk dml exception handling. update statement the update dml operation modifies one or more existing sobject records, such as individual accounts or contacts, in your organization’s data. update is analogous to the update statement in sql. syntax update sobject update sobject[] 4apex reference guide apex dml statements example the following example updates the billingcity field on a single account named 'acme': account a = new account(name='acme2'); insert(a); account myacct = [select id, name, billingcity from account where id = :a.id]; myacct.billingcity = 'san francisco'; try { update myacct; } catch (dmlexception e) { // process exception here } note: for more information on processing dmlexceptions, see bulk dml exception handling. upsert statement the upsert dml operation creates new records and updates sobject records within a single statement,using a specified field to determine the presence of existing objects, or the id field if no field is specified. syntax upsert sobject [opt_field] upsert sobject[] [opt_field] the upsert statement matches the sobjects with existing records by comparing values of one field. if you don’t specify a field when calling this statement, the upsert statement uses the sobject’s id to match the sobject with existing records in salesforce. alternatively, you can specify a field to use for matching. for custom objects, specify a custom field marked as external id. for standard objects, you can specify any field that has the idlookup attribute set to true. for example, the email field of contact or user has the idlookup attribute set. to check a field’s attribute, see the object reference for salesforce. also, you can use foreign keys to upsert sobject records if they have been set as reference fields. for more information, see field types in the object reference for salesforce. the optional field parameter, opt_field, is a field token (of type schema.sobjectfield). for example, to specify the myexternalid custom field, the statement is: upsert sobjectlist account.fields.myexternalid__c; if the field used for matching doesn’t have the unique attribute set, the context user must have the “view all” object-level permission for the target object or the “view all data” permission so that upsert doesn’t accidentally insert a duplicate record. note: custom field matching is case-insensitive only if the custom field has the unique and treat ""abc"" and ""abc"" as duplicate values (case insensitive) attributes selected as part of the field definition. if so, “abc123” is matched with “abc123.” for more information, see “create custom fields” in the salesforce online help. how upsert chooses to insert or update upsert uses the sobject record's primary key (the id), an idlookup field, or an external id field to determine whether it should create a record or update an existing one: 5apex reference guide apex dml statements • if the key isn’t matched, a new object record is created. • if the key is" "matched once, the existing object record is updated. • if the key is matched multiple times, an error is generated and the object record isn’t inserted or updated. example this example performs an upsert of a list of accounts. list acctlist = new list(); // fill the accounts list with some accounts try { upsert acctlist; } catch (dmlexception e) { } this next example performs an upsert of a list of accounts using a foreign key for matching existing records, if any. list acctlist = new list(); // fill the accounts list with some accounts try { // upsert using an external id field upsert acctlist myextidfield__c; } catch (dmlexception e) { } delete statement the delete dml operation deletes one or more existing sobject records, such as individual accounts or contacts, from your organization’s data. delete is analogous to the delete() statement in the soap api. syntax delete sobject delete sobject[] example the following example deletes all accounts that are named 'dotcom': account[] doomedaccts = [select id, name from account where name = 'dotcom']; try { delete doomedaccts; } catch (dmlexception e) { // process exception here } note: for more information on processing dmlexceptions, see bulk dml exception handling. 6apex reference guide apex dml statements undelete statement the undelete dml operation restores one or more existing sobject records, such as individual accounts or contacts, from your organization’s recycle bin. undelete is analogous to the undelete statement in sql. syntax undelete sobject | id undelete sobject[] | id[] example the following example undeletes an account named 'universal containers’. the all rows keyword queries all rows for both top level and aggregate relationships, including deleted records and archived activities. account[] savedaccts = [select id, name from account where name = 'universal containers' all rows]; try { undelete savedaccts; } catch (dmlexception e) { // process exception here } note: for more information on processing dmlexceptions, see bulk dml exception handling. merge statement the merge statement merges up to three records of the same sobject type into one of the records, deleting the others, and re-parenting any related records. note: this dml operation does not have a matching database system method. syntax merge sobject sobject merge sobject sobject[] merge sobject id merge sobject id[] the first parameter represents the master record into which the other records are to be merged. the second parameter represents the one or two other records that should be merged and then deleted. you can pass these other records into the merge statement as a single sobject record or id, or as a list of two sobject records or ids. example the following example merges two accounts named 'acme inc.' and 'acme' into a single record: list ls = new list{new account(name='acme inc.'),new account(name='acme')}; insert ls; account masteracct = [select id, name from account where name = 'acme inc.' limit 1]; 7apex reference guide apexpages namespace account mergeacct = [select id, name from account where name = 'acme' limit 1]; try { merge masteracct mergeacct; } catch (dmlexception e) { // process exception here } note: for more information on processing dmlexceptions, see bulk dml exception handling. apexpages namespace the apexpages namespace provides classes used in visualforce controllers. the following are the classes in the apexpages namespace. in this section: action class you can use apexpages.action to create an action method that you can use in a visualforce custom controller or controller extension. component class represents a dynamic visualforce component in apex. ideastandardcontroller class ideastandardcontroller objects offer ideas-specific functionality in addition to what is provided by the standardcontroller. ideastandardsetcontroller class ideastandardsetcontroller objects offer ideas-specific functionality in addition to what is provided by the standardsetcontroller. knowledgearticleversionstandardcontroller class" "knowledgearticleversionstandardcontroller objects offer article-specific functionality in addition to what is provided by the standardcontroller. message class contains validation errors that occur when the user saves the page that uses a standard controller. standardcontroller class use a standardcontroller when defining an extension for a standard controller. standardsetcontroller class standardsetcontroller objects allow you to create list controllers similar to, or as extensions of, the pre-built visualforce list controllers provided by salesforce. action class you can use apexpages.action to create an action method that you can use in a visualforce custom controller or controller extension. 8apex reference guide action class namespace apexpages usage for example, you could create a saveover method on a controller extension that performs a custom save. instantiation the following code snippet illustrates how to instantiate a new apexpages.action object that uses the save action: apexpages.action saveaction = new apexpages.action('{!save}'); in this section: action constructors action methods action constructors the following are constructors for action. in this section: action(action) creates a new instance of the apexpages.action class using the specified action. action(action) creates a new instance of the apexpages.action class using the specified action. signature public action(string action) parameters action type: string the action. action methods the following are methods for action. all are instance methods. 9apex reference guide component class in this section: getexpression() returns the expression that is evaluated when the action is invoked. invoke() invokes the action. getexpression() returns the expression that is evaluated when the action is invoked. signature public string getexpression() return value type: string invoke() invokes the action. signature public system.pagereference invoke() return value type: system.pagereference component class represents a dynamic visualforce component in apex. namespace apexpages dynamic component properties the following are properties for component. in this section: childcomponents returns a reference to the child components for the component. 10apex reference guide component class expressions sets the content of an attribute using the expression language notation. the notation for this is expressions.name_of_attribute. facets sets the content of a facet to a dynamic component. the notation is facet.name_of_facet. childcomponents returns a reference to the child components for the component. signature public list childcomponents {get; set;} property value type: list example component.apex.pageblock pageblk = new component.apex.pageblock(); component.apex.pageblocksection pageblksection = new component.apex.pageblocksection(title='dummy header'); pageblk.childcomponents.add(pageblksection); expressions sets the content of an attribute using the expression language notation. the notation for this is expressions.name_of_attribute. signature public string expressions {get; set;} property value type: string example component.apex.inputfield inpfld = new component.apex.inputfield(); inpfield.expressions.value = '{!account.name}'; inpfield.expressions.id = '{!$user.firstname}'; facets sets the content of a facet to a dynamic component. the notation is facet.name_of_facet. 11apex reference guide ideastandardcontroller class signature public string facets {get; set;} property value type: string usage note: this property is only accessible by components that support facets. example component.apex.datatable mydt = new component.apex.datatable(); component.apex.outputtext footer = new component.apex.outputtext(value='footer copyright'); mydt.facets.footer = footer; ideastandardcontroller class ideastandardcontroller objects offer ideas-specific functionality in addition to what is provided by the standardcontroller. namespace apexpages usage a method in the ideastandardcontroller object is called by and operated on a particular instance of an ideastandardcontroller. note: the ideastandardsetcontroller and ideastandardcontroller classes are currently available through a limited release program. for information on enabling these classes for your organization" ", contact your salesforce representative. in addition to the methods listed in this class, the ideastandardcontroller class inherits all the methods associated with the standardcontroller class. instantiation an ideastandardcontroller object cannot be instantiated. an instance can be obtained through a constructor of a custom extension controller when using the standard ideas controller. 12apex reference guide ideastandardcontroller class example the following example shows how an ideastandardcontroller object can be used in the constructor for a custom list controller. this example provides the framework for manipulating the comment list data before displaying it on a visualforce page. public class myideaextension { private final apexpages.ideastandardcontroller ideacontroller; public myideaextension(apexpages.ideastandardcontroller controller) { ideacontroller = (apexpages.ideastandardcontroller)controller; } public list getmodifiedcomments() { ideacomment[] comments = ideacontroller.getcommentlist(); // modify comments here return comments; } } the following visualforce markup shows how the ideastandardcontroller example shown above can be used in a page. this page must be named detailpage for this example to work. note: for the visualforce page to display the idea and its comments, in the following example you need to specify the id of a specific idea (for example, /apex/detailpage?id=) whose comments you want to view. {!idea.title}

{!idea.body}
{!a.commentbody} prev | next
see also: standardcontroller class ideastandardcontroller methods the following are instance methods for ideastandardcontroller. 13apex reference guide ideastandardsetcontroller class in this section: getcommentlist() returns the list of read-only comments from the current page. getcommentlist() returns the list of read-only comments from the current page. signature public ideacomment[] getcommentlist() return value type: ideacomment[] this method returns the following comment properties: • id • commentbody • createddate • createdby.id • createdby.communitynickname ideastandardsetcontroller class ideastandardsetcontroller objects offer ideas-specific functionality in addition to what is provided by the standardsetcontroller. namespace apexpages usage note: the ideastandardsetcontroller and ideastandardcontroller classes are currently available through a limited release program. for information on enabling these classes for your organization, contact your salesforce representative. in addition to the method listed above, the ideastandardsetcontroller class inherits the methods associated with the standardsetcontroller. note: the methods inherited from the standardsetcontroller cannot be used to affect the list of ideas returned by the getidealist method. instantiation an ideastandardsetcontroller object cannot be instantiated. an instance can be obtained through a constructor of a custom extension controller when using the standard list controller for ideas. 14apex reference guide ideastandardsetcontroller class example: displaying a profile page the following example shows how an ideastandardsetcontroller object can be used in the constructor for a custom list controller: public class myideaprofileextension { private final apexpages.ideastandardsetcontroller ideasetcontroller; public myideaprofileextension(apexpages.ideastandardsetcontroller controller) { ideasetcontroller = (apexpages.ideastandardsetcontroller)controller; } public list getmodifiedideas() { idea[] ideas =" "ideasetcontroller.getidealist(); // modify ideas here return ideas; } } the following visualforce markup shows how the ideastandardsetcontroller example shown above and the component can display a profile page that lists the recent replies, submitted ideas, and votes associated with a user. because this example does not identify a specific user id, the page automatically shows the profile page for the current logged in user. this page must be named profilepage in order for this example to work: recent replies | ideas submitted | ideas voted {!ideadata.title} in the previous example, the component links to the following visualforce markup that displays the detail page for a specific idea. this page must be named viewpage in order for this example to work: {!idea.title}

15apex reference guide ideastandardsetcontroller class {!idea.body}
example: displaying a list of top, recent, and most popular ideas and comments the following example shows how an ideastandardsetcontroller object can be used in the constructor for a custom list controller: note: you must have created at least one idea for this example to return any ideas. public class myidealistextension { private final apexpages.ideastandardsetcontroller ideasetcontroller; public myidealistextension (apexpages.ideastandardsetcontroller controller) { ideasetcontroller = (apexpages.ideastandardsetcontroller)controller; } public list getmodifiedideas() { idea[] ideas = ideasetcontroller.getidealist(); // modify ideas here return ideas; } } the following visualforce markup shows how the ideastandardsetcontroller example shown above can be used with the component to display a list of recent, top, and most popular ideas and comments. this page must be named listpage in order for this example to work: recent ideas | top ideas | popular ideas | recent comments {!ideadata.title} 16apex reference guide ideastandardsetcontroller class in the previous example, the component links to the following visualforce markup that displays the detail page for a specific idea. this page must be named viewpage. {!idea.title}

{!idea.body}
see also: standardsetcontroller class ideastandardsetcontroller methods the following are instance methods for ideastandardsetcontroller. in this section: getidealist() returns the list of read-only ideas in the current page set. getidealist() returns the list of read-only ideas in the current page set. signature public idea[] getidealist() return value type: idea[] usage you can use the , , and components to display profile pages as well as idea list and detail pages (see the examples below). the following is a list of properties returned by this method: • body • categories • category • createdby.communitynickname • createdby.id • createddate 17apex reference guide knowledgearticleversionstandardcontroller class • id • lastcommentdate • lastcomment.id • lastcomment.commentbody • lastcomment.createdby.communitynickname • lastcomment.createdby.id • numcomments • status • title • votetotal knowledgearticleversionstandardcontroller class knowledgearticleversionstandardcontroller objects offer article-specific functionality in addition to what is provided by the standardcontroller. namespace apexpages usage in addition to the method listed above, the knowledgearticleversionstandardcontroller class inherits all the methods associated with standardcontroller. note: though inherited, the edit, delete, and save methods don't serve a function when used with the knowledgearticleversionstandardcontroller class. example the following example shows how a knowledgearticleversionstandardcontroller object can be used to create a custom extension controller. in this example, you create a class named agentcontributionarticlecontroller that allows customer-support agents to see pre-populated fields on the draft articles they create while closing cases. prerequisites: 1. create an article type called faq. for instructions, see “create article types” in the salesforce online help. 2. create a text custom field called details. for instructions, see “add custom fields to article types” in the salesforce online help. 3. create a category group called geography and assign it to a category called usa. for instructions, see “create and modify category groups” and “add data categories to category groups” in the salesforce online help. 4. create a category group called topics and assign it a category called maintenance. /** custom extension controller for the simplified article edit page that appears when an article is created on the close-case page. */ public class agentcontributionarticlecontroller { // the constructor must take a apexpages.knowledgearticleversionstandardcontroller as an argument 18apex reference guide knowledgearticleversionstandardcontroller class public agentcontributionarticlecontroller( apexpages.knowledgearticleversionstandardcontroller ctl) { // this is the sobject for the new article. //it can optionally be cast to the proper article type. // for example, faq__kav article = (faq__kav) ctl.getrecord(); sobject article = ctl.getrecord(); // this returns the id of the case that was closed. string sourceid = ctl.getsourceid(); case c = [select subject, description from case where id=:sourceid]; // this overrides the default behavior of pre-filling the // title of the article with the subject of the closed case. article.put('title', 'from case: '+c.subject); article.put('details__c',c.description); // only one category per category group can be specified. ctl.selectdatacategory('geography','usa'); ctl.selectdatacategory('topics','main" "tenance'); } } /** test class for the custom extension controller. */ @istest private class agentcontributionarticlecontrollertest { static testmethod void testagentcontributionarticlecontroller() { string casesubject = 'my test'; string casedesc = 'my test description'; case c = new case(); c.subject= casesubject; c.description = casedesc; insert c; string caseid = c.id; system.debug('created case: ' + caseid); apexpages.currentpage().getparameters().put('sourceid', caseid); apexpages.currentpage().getparameters().put('sfdc.override', '1'); apexpages.knowledgearticleversionstandardcontroller ctl = new apexpages.knowledgearticleversionstandardcontroller(new faq__kav()); new agentcontributionarticlecontroller(ctl); system.assertequals(caseid, ctl.getsourceid()); system.assertequals('from case: '+casesubject, ctl.getrecord().get('title')); system.assertequals(casedesc, ctl.getrecord().get('details__c')); } } if you created the custom extension controller for the purpose described in the previous example (that is, to modify submitted-via-case articles), complete the following steps after creating the class: 1. log into your salesforce organization and from setup, enter knowledge settings in the quick find box, then select knowledge settings. 19apex reference guide knowledgearticleversionstandardcontroller class 2. click edit. 3. assign the class to the use apex customization field. this associates the article type specified in the new class with the article type assigned to closed cases. 4. click save. in this section: knowledgearticleversionstandardcontroller constructors knowledgearticleversionstandardcontroller methods see also: standardcontroller class knowledgearticleversionstandardcontroller constructors the following are constructors for knowledgearticleversionstandardcontroller. in this section: knowledgearticleversionstandardcontroller(article) creates a new instance of the apexpages.knowledgearticleversionstandardcontroller class using the specified knowledge article. knowledgearticleversionstandardcontroller(article) creates a new instance of the apexpages.knowledgearticleversionstandardcontroller class using the specified knowledge article. signature public knowledgearticleversionstandardcontroller(sobject article) parameters article type: sobject the knowledge article, such as faq_kav. knowledgearticleversionstandardcontroller methods the following are instance methods for knowledgearticleversionstandardcontroller. in this section: getsourceid() returns the id for the source object record when creating a new article from another object. 20apex reference guide message class setdatacategory(categorygroup, category) specifies a default data category for the specified data category group when creating a new article. getsourceid() returns the id for the source object record when creating a new article from another object. signature public string getsourceid() return value type: string setdatacategory(categorygroup, category) specifies a default data category for the specified data category group when creating a new article. signature public void setdatacategory(string categorygroup, string category) parameters categorygroup type: string category type: string return value type: void message class contains validation errors that occur when the user saves the page that uses a standard controller. namespace apexpages usage when using a standard controller, all validation errors, both custom and standard, that occur when the user saves the page are automatically added to the page error collections. if an inputfield component is bound to the field with an error, the message is added to the component’s error collection. all messages are added to the page’s error collection. for more information, see validation rules and standard controllers in the visualforce developer's guide. if your application uses a custom controller or extension, you must use the message class for collecting errors. 21apex reference guide message class instantiation in a custom controller or controller extension, you can instantiate a message in one of these ways: • apexpages.message mymsg = new apexpages.message(apexpages.severity, summary); where apexpages.severity is the enum that determines how severe a message is, and summary is the string used to summarize the message. for example: apexpages.message mymsg = new apexpages.message(apexpages.severity.fatal, 'my error msg'); •" "apexpages.message mymsg = new apexpages.message(apexpages.severity, summary, detail); where apexpages. severity is the enum that determines how severe a message is, summary is the string used to summarize the message, and detail is the string used to provide more detailed information about the error. apexpages.severity enum to specify the severity of the message, use the apexpages.severity enum values. the following are the valid values: • confirm • error • fatal • info • warning all enums have access to standard methods, such as name and value. in this section: message constructors message methods message constructors the following are constructors for message. in this section: message(severity, summary) creates a new instance of the apexpages.message class using the specified message severity and summary. message(severity, summary, detail) creates a new instance of the apexpages.message class using the specified message severity, summary, and message detail. message(severity, summary, detail, id) creates a new instance of the apexpages.message class using the specified severity, summary, detail, and component id. message(severity, summary) creates a new instance of the apexpages.message class using the specified message severity and summary. 22apex reference guide message class signature public message(apexpages.severity severity, string summary) parameters severity type: apexpages.severity the severity of a visualforce message. summary type: string the summary visualforce message. message(severity, summary, detail) creates a new instance of the apexpages.message class using the specified message severity, summary, and message detail. signature public message(apexpages.severity severity, string summary, string detail) parameters severity type: apexpages.severity the severity of a visualforce message. summary type: string the summary visualforce message. detail type: string the detailed visualforce message. message(severity, summary, detail, id) creates a new instance of the apexpages.message class using the specified severity, summary, detail, and component id. signature public message(apexpages.severity severity, string summary, string detail, string id) parameters severity type: apexpages.severity the severity of a visualforce message. 23apex reference guide message class summary type: string the summary visualforce message. detail type: string the detailed visualforce message. id type: string the id of the visualforce component to associate with the message, for example, a form field with an error. message methods the following are methods for message. all are instance methods. in this section: getcomponentlabel() returns the label of the associated inputfield component. if no label is defined, this method returns null. getdetail() returns the value of the detail parameter used to create the message. if no detail string was specified, this method returns null. getseverity() returns the severity enum used to create the message. getsummary() returns the summary string used to create the message. getcomponentlabel() returns the label of the associated inputfield component. if no label is defined, this method returns null. signature public string getcomponentlabel() return value type: string getdetail() returns the value of the detail parameter used to create the message. if no detail string was specified, this method returns null. signature public string getdetail() 24apex reference guide standardcontroller class return value type: string getseverity() returns the severity enum used to create the message. signature public apexpages.severity getseverity() return value type: apexpages.severity getsummary() returns the summary string used to create the message. signature public string getsummary() return value type: string standardcontroller class use a standardcontroller when defining an extension for a standard controller. namespace apexpages usage standardcontroller objects reference the pre-built visualforce controllers provided by salesforce. the only time it is necessary to refer to a standardcontroller object is when defining an extension for a standard controller. standardcontroller is the data type of the single argument in the extension class constructor. instantiation you can instantiate a standardcontroller in the following way: apexpages.standardcontroller sc = new apexpages.standardcontroller" "(sobject); 25apex reference guide standardcontroller class example the following example shows how a standardcontroller object can be used in the constructor for a standard controller extension: public class mycontrollerextension { private final account acct; // the extension constructor initializes the private member // variable acct by using the getrecord method from the standard // controller. public mycontrollerextension(apexpages.standardcontroller stdcontroller) { this.acct = (account)stdcontroller.getrecord(); } public string getgreeting() { return 'hello ' + acct.name + ' (' + acct.id + ')'; } } the following visualforce markup shows how the controller extension from above can be used in a page: {!greeting}

in this section: standardcontroller constructors standardcontroller methods standardcontroller constructors the following are constructors for standardcontroller. in this section: standardcontroller(controllersobject) creates a new instance of the apexpages.standardcontroller class for the specified standard or custom object. standardcontroller(controllersobject) creates a new instance of the apexpages.standardcontroller class for the specified standard or custom object. signature public standardcontroller(sobject controllersobject) 26apex reference guide standardcontroller class parameters controllersobject type: sobject a standard or custom object. standardcontroller methods the following are methods for standardcontroller. all are instance methods. in this section: addfields(fieldnames) when a visualforce page is loaded, the fields accessible to the page are based on the fields referenced in the visualforce markup. this method adds a reference to each field specified in fieldnames so that the controller can explicitly access those fields as well. cancel() returns the pagereference of the cancel page. delete() deletes record and returns the pagereference of the delete page. edit() returns the pagereference of the standard edit page. getid() returns the id of the record that is currently in context, based on the value of the id query string parameter in the visualforce page url. getrecord() returns the record that is currently in context, based on the value of the id query string parameter in the visualforce page url. reset() forces the controller to reacquire access to newly referenced fields. any changes made to the record prior to this method call are discarded. save() saves changes and returns the updated pagereference. view() returns the pagereference object of the standard detail page. addfields(fieldnames) when a visualforce page is loaded, the fields accessible to the page are based on the fields referenced in the visualforce markup. this method adds a reference to each field specified in fieldnames so that the controller can explicitly access those fields as well. signature public void addfields(list fieldnames) 27apex reference guide standardcontroller class parameters fieldnames type: list return value type: void usage this method should be called before a record has been loaded—typically, it's called by the controller's constructor. if this method is called outside of the constructor, you must use the reset() method before calling addfields(). the strings in fieldnames can either be the api name of a field, such as accountid, or they can be explicit relationships to fields, such as something__r.myfield__c. this method is only for controllers used by dynamicvisualforce bindings. cancel() returns the pagereference of the cancel page. signature public system.pagereference cancel() return value type: system.pagereference delete() deletes record and returns the pagereference of the delete page. signature public system.pagereference delete() return value type: system.pagereference edit() returns the pagereference of the standard edit page. signature public system.pagereference edit() 28apex reference guide standardcontroller class return value type: system.pagereference getid() returns the id of the record that is currently in context, based on the value of the id query string parameter in the visualforce page url. signature public string getid() return value" "type: string getrecord() returns the record that is currently in context, based on the value of the id query string parameter in the visualforce page url. signature public sobject getrecord() return value type: sobject usage note that only the fields that are referenced in the associated visualforce markup are available for querying on this sobject. all other fields, including fields from any related objects, must be queried using a soql expression. tip: you can work around this restriction by including a hidden component that references any additional fields that you want to query. hide the component from display by setting the component's rendered attribute to false. example reset() forces the controller to reacquire access to newly referenced fields. any changes made to the record prior to this method call are discarded. 29apex reference guide standardsetcontroller class signature public void reset() return value type: void usage this method is only used if addfields is called outside the constructor, and it must be called directly before addfields. this method is only for controllers used by dynamicvisualforce bindings. save() saves changes and returns the updated pagereference. signature public system.pagereference save() return value type: system.pagereference view() returns the pagereference object of the standard detail page. signature public system.pagereference view() return value type: system.pagereference standardsetcontroller class standardsetcontroller objects allow you to create list controllers similar to, or as extensions of, the pre-built visualforce list controllers provided by salesforce. namespace apexpages usage the standardsetcontroller class also contains a prototype object. this is a single sobject contained within the visualforce standardsetcontroller class. if the prototype object's fields are set, those values are used during the save action, meaning that the values 30apex reference guide standardsetcontroller class are applied to every record in the set controller's collection. this is useful for writing pages that perform mass updates (applying identical changes to fields within a collection of objects). note: fields that are required in other salesforce objects will keep the same requiredness when used by the prototype object. instantiation you can instantiate a standardsetcontroller in either of the following ways: • from a list of sobjects: list accountlist = [select name from account limit 20]; apexpages.standardsetcontroller ssc = new apexpages.standardsetcontroller(accountlist); • from a query locator: apexpages.standardsetcontroller ssc = new apexpages.standardsetcontroller(database.getquerylocator([select name,closedate from opportunity])); note: the maximum record limit for standardsetcontroller is 10,000 records. instantiating standardsetcontroller using a query locator returning more than 10,000 records causes a limitexception to be thrown. however, instantiating standardsetcontroller with a list of more than 10,000 records doesn’t throw an exception, and instead truncates the records to the limit. example the following example shows how a standardsetcontroller object can be used in the constructor for a custom list controller: public class opportunitylist2con { // apexpages.standardsetcontroller must be instantiated // for standard list controllers public apexpages.standardsetcontroller setcon { get { if(setcon == null) { setcon = new apexpages.standardsetcontroller(database.getquerylocator( [select name, closedate from opportunity])); } return setcon; } set; } // initialize setcon and return a list of records public list getopportunities() { return (list) setcon.getrecords(); } } the following visualforce markup shows how the controller above can be used in a page: 31apex reference guide standardsetcontroller class in this section: standardsetcontroller constructors standardsetcontroller methods" standardsetcontroller constructors the following are constructors for standardsetcontroller. in this section: standardsetcontroller(querylocator) creates an instance of the apexpages.standardsetcontroller class for the list of objects returned by the query locator. standardsetcontroller(controllersobjects) creates an instance of the apexpages.standardsetcontroller class for the specified list of standard or custom objects. standardsetcontroller(querylocator) creates an instance of the apexpages.standardsetcontroller class for the list of objects returned by the query locator. signature public standardsetcontroller(database.querylocator querylocator) parameters querylocator type: database.querylocator a query locator representing a list of sobjects. standardsetcontroller(controllersobjects) creates an instance of the apexpages.standardsetcontroller class for the specified list of standard or custom objects. signature public standardsetcontroller(list controllersobjects) parameters controllersobjects type: list on page 3123 a list of standard or custom objects. 32 "apex reference guide standardsetcontroller class example list accountlist = [select name from account limit 20]; apexpages.standardsetcontroller ssc = new apexpages.standardsetcontroller(accountlist); standardsetcontroller methods the following are methods for standardsetcontroller. all are instance methods. in this section: cancel() returns the pagereference of the original page, if known, or the home page. first() returns the first page of records. getcompleteresult() indicates whether there are more records in the set than the maximum record limit. if this is false, there are more records than you can process using the list controller. the maximum record limit is 10,000 records. getfilterid() returns the id of the filter that is currently in context. gethasnext() indicates whether there are more records after the current page set. gethasprevious() indicates whether there are more records before the current page set. getlistviewoptions() returns a list of the listviews available to the current user. getpagenumber() returns the page number of the current page set. note that the first page returns 1. getpagesize() returns the number of records included in each page set. getrecord() returns the sobject that represents the changes to the selected records. this retrieves the prototype object contained within the class, and is used for performing mass updates. getrecords() returns the list of sobjects in the current page set. this list is immutable, i.e. you can't call clear() on it. getresultsize() returns the number of records in the set. getselected() returns the list of sobjects that have been selected. last() returns the last page of records. next() returns the next page of records. 33apex reference guide standardsetcontroller class previous() returns the previous page of records. save() inserts new records or updates existing records that have been changed. after this operation is finished, it returns a pagereference to the original page, if known, or the home page. setfilterid(filterid) sets the filter id of the controller. setpagenumber(pagenumber) sets the page number. setpagesize(pagesize) sets the number of records in each page set. setselected(selectedrecords) set the selected records. cancel() returns the pagereference of the original page, if known, or the home page. signature public system.pagereference cancel() return value type: system.pagereference first() returns the first page of records. signature public void first() return value type: void getcompleteresult() indicates whether there are more records in the set than the maximum record limit. if this is false, there are more records than you can process using the list controller. the maximum record limit is 10,000 records. signature public boolean getcompleteresult() 34apex reference guide standardsetcontroller class return value type: boolean getfilterid() returns the id of the filter that is currently in context. signature public string getfilterid() return value type: string gethasnext() indicates whether there are more records after the current page set. signature public boolean gethasnext() return value type: boolean gethasprevious() indicates whether there are more records before the current page set. signature public boolean gethasprevious() return value type: boolean getlistviewoptions() returns a list of the listviews available to the current user. signature public system.selectoption getlistviewoptions() return value type: system.selectoption[] 35apex reference guide standardsetcontroller class getpagenumber() returns the page number of the current page set. note that the first page returns 1. signature public integer getpagenumber() return value type: integer getpagesize() returns the number of records included in each page set. signature public integer getpagesize() return value type: integer getrecord() returns the sobject that represents the changes to the selected records. this retrieves the prototype object contained within the class, and is used for performing mass updates. signature public sobject getrecord() return value type: sobject getrecords() returns the list of sobjects in the current page set. this list is immutable, i.e. you can't call clear() on it. signature public sobject[] getrec" "ords() return value type: sobject[] 36apex reference guide standardsetcontroller class getresultsize() returns the number of records in the set. signature public integer getresultsize() return value type: integer getselected() returns the list of sobjects that have been selected. signature public sobject[] getselected() return value type: sobject[] last() returns the last page of records. signature public void last() return value type: void next() returns the next page of records. signature public void next() return value type: void previous() returns the previous page of records. 37apex reference guide standardsetcontroller class signature public void previous() return value type: void save() inserts new records or updates existing records that have been changed. after this operation is finished, it returns a pagereference to the original page, if known, or the home page. signature public system.pagereference save() return value type: system.pagereference setfilterid(filterid) sets the filter id of the controller. signature public void setfilterid(string filterid) parameters filterid type: string return value type: void setpagenumber(pagenumber) sets the page number. signature public void setpagenumber(integer pagenumber) parameters pagenumber type: integer 38apex reference guide applauncher namespace return value type: void setpagesize(pagesize) sets the number of records in each page set. signature public void setpagesize(integer pagesize) parameters pagesize type: integer return value type: void setselected(selectedrecords) set the selected records. signature public void setselected(sobject[] selectedrecords) parameters selectedrecords type: sobject[] return value type: void applauncher namespace the applauncher namespace provides methods for managing the appearance of apps in the app launcher, including their visibility and sort order. the following class is in the applauncher namespace. in this section: appmenu class contains methods to set the appearance of apps in the app launcher. 39apex reference guide appmenu class communitylogocontroller class represents the logo of the experience cloud site. for internal use only. employeeloginlinkcontroller class represents the link on the login form that employees can click to log in. for internal use only. sociallogincontroller class represents the social authentication providers configured for the experience cloud site. for internal use only. appmenu class contains methods to set the appearance of apps in the app launcher. namespace applauncher in this section: appmenu methods appmenu methods the following are methods for appmenu. in this section: setappvisibility(appmenuitemid, isvisible) shows or hides specific apps in the app launcher. setorgsortorder(appids) sets the organization-wide default sort order for the app launcher based on a list of app menu item ids in the desired order. setusersortorder(appids) sets an individual user’s default sort order for the app launcher based on a list of app menu item ids in the desired order. setappvisibility(appmenuitemid, isvisible) shows or hides specific apps in the app launcher. signature public static void setappvisibility(id appmenuitemid, boolean isvisible) parameters appmenuitemid type: id the 15-character application id value for an app. for more information, see the applicationid field for appmenuitem or the appmenuitemid field for userappmenuitem in the salesforce object reference 40apex reference guide communitylogocontroller class isvisible type: boolean if true, the app is visible. return value type: void setorgsortorder(appids) sets the organization-wide default sort order for the app launcher based on a list of app menu item ids in the desired order. signature public static void setorgsortorder(list appids) parameters appids type: list a list of application id values. for more information, see the applicationid field for appmenuitem in the salesforce object reference. return value type: void setusersortorder(appids) sets an individual user�" "�s default sort order for the app launcher based on a list of app menu item ids in the desired order. signature public static void setusersortorder(list appids) parameters appids type: list a list of application id values. for more information, see the appmenuitemid field for userappmenuitem in the salesforce object reference. return value type: void communitylogocontroller class represents the logo of the experience cloud site. for internal use only. 41apex reference guide employeeloginlinkcontroller class namespace applauncher in this section: communitylogocontroller methods communitylogocontroller methods the following are methods for communitylogocontroller. in this section: getcommunityname() returns the name of the experience cloud site. getlogourl() returns the path to the page containing the experience cloud site’s logo. getcommunityname() returns the name of the experience cloud site. signature public static string getcommunityname() return value type: string getlogourl() returns the path to the page containing the experience cloud site’s logo. signature public static string getlogourl() return value type: string employeeloginlinkcontroller class represents the link on the login form that employees can click to log in. for internal use only. namespace applauncher 42apex reference guide sociallogincontroller class in this section: employeeloginlinkcontroller methods employeeloginlinkcontroller methods the following are methods for employeeloginlinkcontroller. in this section: getemployeeloginurl(starturl) returns the path to the page that employees see after they log in. getisallowinternaluserloginenabled() indicates whether an internal user is allowed to log in to the experience cloud site. getemployeeloginurl(starturl) returns the path to the page that employees see after they log in. signature public static string getemployeeloginurl(string starturl) parameters starturl type: string path to the page that employees see after they log in. return value type: string getisallowinternaluserloginenabled() indicates whether an internal user is allowed to log in to the experience cloud site. signature public static boolean getisallowinternaluserloginenabled() return value type: boolean sociallogincontroller class represents the social authentication providers configured for the experience cloud site. for internal use only. 43apex reference guide sociallogincontroller class namespace applauncher in this section: sociallogincontroller methods sociallogincontroller methods the following are methods for sociallogincontroller. in this section: getcommunitydomainssourl(starturl, developername) returns the single sign-on url for an experience cloud site or salesforce my domain subdomain. getsamlssourl(starturl, samlid) returns the url to the saml provider for the experience cloud site. getsamlssourlnocache(starturl, samlid) returns the url to the saml provider for the experience cloud site, without caching the url. calling this method also initiates a backend call. getssourl(starturl, developername) returns the single sign-on url for the experience cloud site. getcommunitydomainssourl(starturl, developername) returns the single sign-on url for an experience cloud site or salesforce my domain subdomain. note: for better performance, we recommend using this method instead of getauthproviderssourl. if the authentication provider has use subdomain for callback enabled, changing the single sign-on url also changes the callback url to the experience cloud site subdomain. before switching to this method, update the callback url in your third-party applications to avoid getting an invalid callback url error during single sign-on. signature public static string getcommunitydomainssourl(string starturl, string developername) parameters starturl type: string the page that you see after successfully logging into the experience cloud site or my domain subdomain. developername type: string the unique name of the authentication provider. 44apex reference guide sociallogincontroller class return value type: string getsamlssourl(starturl, samlid) returns the url to the saml provider for the experience cloud site. signature public static string getsamlssourl(string starturl, string samlid) parameters starturl type: string path to the page that users see" "when they access the experience cloud site. samlid type: string unique identifier of the saml provider. return value type: string getsamlssourlnocache(starturl, samlid) returns the url to the saml provider for the experience cloud site, without caching the url. calling this method also initiates a backend call. signature public static string getsamlssourlnocache(string starturl, string samlid) parameters starturl type: string path to the page that users see when they access the experience cloud site. samlid type: string unique identifier of the saml provider. return value type: string the url to the site's saml provider. unlike the url returned by the getsamlssourl method, this url isn't cached. 45apex reference guide approval namespace getssourl(starturl, developername) returns the single sign-on url for the experience cloud site. signature public static string getssourl(string starturl, string developername) parameters starturl type: string path to the page that users see when they access the experience cloud site. developername type: string unique name of the authentication provider. return value type: string approval namespace the approval namespace provides classes and methods for approval processes. the following are the classes in the approval namespace. in this section: lockresult class the result of a record lock returned by a system.approval.lock() method. processrequest class the processrequest class is the parent class for the processsubmitrequest and processworkitemrequest classes. use the processrequest class to write generic apex that can process objects from either class. processresult class after you submit a record for approval, use the processresult class to process the results of an approval process. processsubmitrequest class use the processsubmitrequest class to submit a record for approval. processworkitemrequest class use the processworkitemrequest class for processing an approval request after it is submitted. unlockresult class the result of a record unlock, returned by a system.approval.unlock() method. lockresult class the result of a record lock returned by a system.approval.lock() method. 46apex reference guide lockresult class namespace approval usage the system.approval.lock() methods return approval.lockresult objects. each element in a lockresult array corresponds to an element in the id or sobject array passed as a parameter to a lock method. the first element in the lockresult array corresponds to the first element in the id or sobject array, the second element corresponds to the second element, and so on. if only one id or sobject is passed in, the lockresult array contains a single element. example the following example obtains and iterates through the returned approval.lockresult objects. it locks some queried accounts using approval.lock with a false second parameter to allow partial processing of records on failure. next, it iterates through the results to determine whether the operation was successful for each record. it writes the id of every record that was processed successfully to the debug log, or writes error messages and failed fields of the failed records. // query the accounts to lock account[] accts = [select id from account where name like 'acme%']; // lock the accounts approval.lockresult[] lrlist = approval.lock(accts, false); // iterate through each returned result for(approval.lockresult lr : lrlist) { if (lr.issuccess()) { // operation was successful, so get the id of the record that was processed system.debug('successfully locked account with id: ' + lr.getid()); } else { // operation failed, so get all errors for(database.error err : lr.geterrors()) { system.debug('the following error has occurred.'); system.debug(err.getstatuscode() + ': ' + err.getmessage()); system.debug('account fields that affected this error: ' + err.getfields()); } } } in this section: lockresult methods see also: approval class lockresult methods the following are methods for lockresult. 47apex reference guide lockresult class in this section: geterrors() if an error occurred, returns an array of one or more database error objects, providing the error code and description. getid()" "returns the id of the sobject you are trying to lock. issuccess() a boolean value that is set to true if the lock operation is successful for this object, or false otherwise. geterrors() if an error occurred, returns an array of one or more database error objects, providing the error code and description. signature public list geterrors() return value type: list getid() returns the id of the sobject you are trying to lock. signature public id getid() return value type: id usage if the field contains a value, the object was locked. if the field is empty, the operation was not successful. issuccess() a boolean value that is set to true if the lock operation is successful for this object, or false otherwise. signature public boolean issuccess() return value type: boolean 48apex reference guide processrequest class processrequest class the processrequest class is the parent class for the processsubmitrequest and processworkitemrequest classes. use the processrequest class to write generic apex that can process objects from either class. namespace approval usage the request must be instantiated via the child classes, processsubmitrequest and processworkitemrequest. processrequest methods the following are methods for processrequest. all are instance methods. in this section: getcomments() returns the comments that have been added previously to the approval request. getnextapproverids() returns the list of user ids of user specified as approvers. setcomments(comments) sets the comments to be added to the approval request. setnextapproverids(nextapproverids) if the next step in your approval process is another apex approval process, you specify exactly one user id as the next approver. if not, you cannot specify a user id and this method must be null. getcomments() returns the comments that have been added previously to the approval request. signature public string getcomments() return value type: string getnextapproverids() returns the list of user ids of user specified as approvers. signature public id[] getnextapproverids() 49apex reference guide processresult class return value type: id[] setcomments(comments) sets the comments to be added to the approval request. signature public void setcomments(string comments) parameters comments type: string return value type: void setnextapproverids(nextapproverids) if the next step in your approval process is another apex approval process, you specify exactly one user id as the next approver. if not, you cannot specify a user id and this method must be null. signature public void setnextapproverids(id[] nextapproverids) parameters nextapproverids type: id[] must be a single-entry list. return value type: void processresult class after you submit a record for approval, use the processresult class to process the results of an approval process. namespace approval 50apex reference guide processresult class usage a processresult object is returned by the process method. you must specify the approval namespace when creating an instance of this class. for example: approval.processresult result = approval.process(req1); processresult methods the following are methods for processresult. all are instance methods. in this section: getentityid() the id of the record being processed. geterrors() if an error occurred, returns an array of one or more database error objects including the error code and description. getinstanceid() the id of the approval process that has been submitted for approval. getinstancestatus() the status of the current approval process. valid values are: approved, rejected, removed or pending. getnewworkitemids() the ids of the new items submitted to the approval process. there can be 0 or 1 approval processes. issuccess() a boolean value that is set to true if the approval process completed successfully; otherwise, it is set to false. getentityid() the id of the record being processed. signature public string getentityid() return value type: string geterrors() if an error occurred, returns an array of one or more database error objects including the error code and description. signature public database.error[] geterrors() 51apex reference guide processresult class return value type" ": database.error[] getinstanceid() the id of the approval process that has been submitted for approval. signature public string getinstanceid() return value type: string getinstancestatus() the status of the current approval process. valid values are: approved, rejected, removed or pending. signature public string getinstancestatus() return value type: string getnewworkitemids() the ids of the new items submitted to the approval process. there can be 0 or 1 approval processes. signature public id[] getnewworkitemids() return value type: id[] issuccess() a boolean value that is set to true if the approval process completed successfully; otherwise, it is set to false. signature public boolean issuccess() return value type: boolean 52apex reference guide processsubmitrequest class processsubmitrequest class use the processsubmitrequest class to submit a record for approval. namespace approval usage you must specify the approval namespace when creating an instance of this class. the constructor for this class takes no arguments. for example: approval.processsubmitrequest psr = new approval.processsubmitrequest(); inherited methods in addition to the methods listed, the processsubmitrequest class has access to all the methods in its parent class, processrequest class. • getcomments() • getnextapproverids() • setcomments(comments) • setnextapproverids(nextapproverids) example to view sample code, refer to approval processing example. processsubmitrequest methods the following are methods for processsubmitrequest. all are instance methods. in this section: getobjectid() returns the id of the record that has been submitted for approval. for example, it can return an account, contact, or custom object record. getprocessdefinitionnameorid() returns the developer name or id of the process definition. getskipentrycriteria() if getprocessdefinitionnameorid() returns a value other than null, getskipentrycriteria() determines whether to evaluate the entry criteria for the process (true) or not (false). getsubmitterid() returns the user id of the submitter requesting the approval record. the user must be one of the allowed submitters in the process definition setup. 53apex reference guide processsubmitrequest class setobjectid(recordid) sets the id of the record to be submitted for approval. for example, it can specify an account, contact, or custom object record. setprocessdefinitionnameorid(nameorid) sets the developer name or id of the process definition to be evaluated. setskipentrycriteria(skipentrycriteria) if the process definition name or id is not null, setskipentrycriteria() determines whether to evaluate the entry criteria for the process (true) or not (false). setsubmitterid(userid) sets the user id of the submitter requesting the approval record. the user must be one of the allowed submitters in the process definition setup. if you don’t set a submitter id, the process uses the current user as the submitter. getobjectid() returns the id of the record that has been submitted for approval. for example, it can return an account, contact, or custom object record. signature public string getobjectid() return value type: string getprocessdefinitionnameorid() returns the developer name or id of the process definition. signature public string getprocessdefinitionnameorid() return value type: string usage the default is null. if the return value is null, when a user submits a record for approval salesforce evaluates the entry criteria for all processes applicable to the user. getskipentrycriteria() if getprocessdefinitionnameorid() returns a value other than null, getskipentrycriteria() determines whether to evaluate the entry criteria for the process (true) or not (false). signature public boolean getskipentrycriteria() 54apex reference guide processsubmitrequest class return value type: boolean getsubmitterid() returns the user id of the submitter requesting the approval record. the user must be one of the allowed submitters in the process definition setup. signature public string getsubmitterid() return value type: string setobjectid(recordid) sets the id of the record to be submitted for approval. for example, it can specify an account, contact, or custom object record. signature public void setobjectid" "(string recordid) parameters recordid type: string return value type: void setprocessdefinitionnameorid(nameorid) sets the developer name or id of the process definition to be evaluated. signature public void setprocessdefinitionnameorid(string nameorid) parameters nameorid type: string the process definition developer name or process definition id. the record is submitted to this specific process. if set to null, submission of a record approval follows standard evaluation; that is, every entry criteria of the process definition in the process order is evaluated and the one that satisfies is picked and submitted. 55apex reference guide processsubmitrequest class return value type: void usage if the process definition name or id is not set via this method, then by default it is null. if it is null, the submission of a record for approval evaluates entry criteria for all processes applicable to the submitter. the order of evaluation is based on the process order of the setup. setskipentrycriteria(skipentrycriteria) if the process definition name or id is not null, setskipentrycriteria() determines whether to evaluate the entry criteria for the process (true) or not (false). signature public void setskipentrycriteria(boolean skipentrycriteria) parameters skipentrycriteria type: boolean if set to true, request submission skips the evaluation of entry criteria for the process set in setprocessdefinitionnameorid(nameorid). if the process definition name or id is not specified, this parameter is ignored and standard evaluation is followed based on process order. if set to false, or if this method isn’t called, the entry criteria is not skipped. return value type: void setsubmitterid(userid) sets the user id of the submitter requesting the approval record. the user must be one of the allowed submitters in the process definition setup. if you don’t set a submitter id, the process uses the current user as the submitter. signature public void setsubmitterid(string userid) parameters userid type: string the user id on behalf of which the record is submitted. if set to null, the current user is the submitter. if the submitter is not set with this method, the default submitter is null (the current user). return value type: void 56apex reference guide processworkitemrequest class processworkitemrequest class use the processworkitemrequest class for processing an approval request after it is submitted. namespace approval usage you must specify the approval namespace when creating an instance of this class. the constructor for this class takes no arguments. for example: approval.processworkitemrequest pwr = new approval.processworkitemrequest(); inherited methods in addition to the methods listed, the processworkitemrequest class has access to all the methods in its parent class, processrequest class: • getcomments() • getnextapproverids() • setcomments(comments) • setnextapproverids(nextapproverids) processworkitemrequest methods the following are methods for processworkitemrequest. all are instance methods. in this section: getaction() returns the type of action already associated with the approval request. valid values are: approve, reject, or removed. getworkitemid() returns the id of the approval request that is in the process of being approved, rejected, or removed. setaction(actiontype) sets the type of action to take for processing an approval request. setworkitemid(id) sets the id of the approval request that is being approved, rejected, or removed. getaction() returns the type of action already associated with the approval request. valid values are: approve, reject, or removed. signature public string getaction() 57apex reference guide processworkitemrequest class return value type: string getworkitemid() returns the id of the approval request that is in the process of being approved, rejected, or removed. signature public string getworkitemid() return value type: string setaction(actiontype) sets the type of action to take for processing an approval request. signature public void setaction(string actiontype) parameters actiontype type: string valid values are: approve, reject, or removed. only system administrators can specify removed. return value type: void setworkitemid(id) sets the id of the" "approval request that is being approved, rejected, or removed. signature public void setworkitemid(string id) parameters id type: string return value type: void 58apex reference guide unlockresult class unlockresult class the result of a record unlock, returned by a system.approval.unlock() method. namespace approval usage the system.approval.unlock() methods return approval.unlockresult objects. each element in an unlockresult array corresponds to an element in the id or sobject array passed as a parameter to an unlock method. the first element in the unlockresult array corresponds to the first element in the id or sobject array, the second element corresponds to the second element, and so on. if only one id or sobject is passed in, the unlockresult array contains a single element. example the following example shows how to obtain and iterate through the returned approval.unlockresult objects. it locks some queried accounts using approval.unlock with a false second parameter to allow partial processing of records on failure. next, it iterates through the results to determine whether the operation was successful for each record. it writes the id of every record that was processed successfully to the debug log, or writes error messages and failed fields of the failed records. // query the accounts to unlock account[] accts = [select id from account where name like 'acme%']; for(account acct:accts) { // create an approval request for the account approval.processsubmitrequest req1 = new approval.processsubmitrequest(); req1.setcomments('submitting request for approval.'); req1.setobjectid(acct.id); // submit the record to specific process and skip the criteria evaluation req1.setprocessdefinitionnameorid('pto_request_process'); req1.setskipentrycriteria(true); // submit the approval request for the account approval.processresult result = approval.process(req1); // verify the result system.assert(result.issuccess()); } // unlock the accounts approval.unlockresult[] urlist = approval.unlock(accts, false); // iterate through each returned result for(approval.unlockresult ur : urlist) { if (ur.issuccess()) { // operation was successful, so get the id of the record that was processed system.debug('successfully unlocked account with id: ' + ur.getid()); } 59apex reference guide unlockresult class else { // operation failed, so get all errors for(database.error err : ur.geterrors()) { system.debug('the following error has occurred.'); system.debug(err.getstatuscode() + ': ' + err.getmessage()); system.debug('account fields that affected this error: ' + err.getfields()); } } } in this section: unlockresult methods see also: approval class unlockresult methods the following are methods for unlockresult. in this section: geterrors() if an error occurred, returns an array of one or more database error objects, providing the error code and description. getid() returns the id of the sobject you are trying to unlock. issuccess() a boolean value that is set to true if the unlock operation is successful for this object, or false otherwise. geterrors() if an error occurred, returns an array of one or more database error objects, providing the error code and description. signature public list geterrors() return value type: list getid() returns the id of the sobject you are trying to unlock. signature public id getid() 60apex reference guide auth namespace return value type: id usage if the field contains a value, the object was unlocked. if the field is empty, the operation was not successfult. issuccess() a boolean value that is set to true if the unlock operation is successful for this object, or false otherwise. signature public boolean issuccess() return value type: boolean auth namespace the auth namespace provides an interface and classes for single sign-on into salesforce and session security management. the following is the interface in the auth namespace. in this section: authconfiguration class contains methods for configuring settings for users to log in to a salesforce org using their authentication provider credentials" "instead of their salesforce credentials. the authentication provider can be any authentication provider that supports the openid connect protocol, such as google, facebook, or twitter. users log in to either an experience cloud site (https://mydomainname.my.site.com) or your my domain login url (https://mydomainname.my.salesforce.com). authprovidercallbackstate class provides request http headers, body, and query parameters to the authproviderplugin.handlecallback method for user authentication. this class allows you to group the information passed in rather than passing headers, body, and query parameters individually. authproviderplugin interface this interface is deprecated. for new development, use the abstract class auth.authproviderpluginclass to create a custom oauth-based authentication provider plug-in for single sign-on in to salesforce. authproviderpluginclass class contains methods to create a custom oauth-based authentication provider plug-in for single sign-on in to salesforce. use this class to create a custom authentication provider plug-in if you can’t use one of the authentication providers that salesforce provides. authprovidertokenresponse class stores the response from the authproviderplugin.handlecallback method. 61apex reference guide auth namespace authtoken class contains methods for providing the access token associated with an authentication provider for an authenticated user, except for the janrain provider. communitiesutil class contains methods for getting information about an experience cloud user. configurableselfreghandler interface gives you more control over how customers or partners self-register for your experience cloud site by creating a class that implements auth.configurableselfreghandler. you choose the user information to collect, and how users identify themselves—with their email address, phone number, or another identifier. when verified, you create a customer or partner user and log in the user to your experience cloud site. confirmuserregistrationhandler interface manages single sign-on (sso) user mappings between salesforce and a third-party identity provider. use this interface to confirm user mappings before updating them. connectedappplugin class contains methods for extending the behavior of a connected app, for example, customizing how a connected app is invoked depending on the protocol used. this class gives you more control over the interaction between salesforce and your connected app. headlessselfregistrationhandler interface creates customer and partner users during the headless registration flow. invocationcontext enum the context in which the connected app is invoked, such as the protocol flow used and the token type issued, if any. developers can use the context information to write code that is unique to the type of invocation. jws class contains methods that apply a digital signature to a json web token (jwt), using a json web signature (jws) data structure. this class creates the signed jwt bearer token, which can be used to request an oauth access token in the oauth 2.0 jwt bearer token flow. jwt class generates the json claims set in a json web token (jwt). the resulting base64-encoded payload can be passed as an argument to create an instance of the auth.jws class. jwtbearertokenexchange class contains methods that post the signed jwt bearer token to a token endpoint to request an access token, in the oauth 2.0 jwt bearer token flow. lightninglogineligibility enum contains a lightning login eligibility value used by the auth.sessionmanagement.getlightninglogineligibility method. logindiscoveryhandler interface salesforce gives you the ability to log in users based on other verification methods than username and password. for example, it can prompt users to log in with their email, phone number, or another identifier like a federation id or device identifier. login discovery is available to these licenses: customer community, customer community plus, external identity, partner community, and partner community plus. logindiscoverymethod enum contains methods used to verify the user’s identity when the my domain login process uses login discovery. 62apex reference guide authconfiguration class mydomainlogindiscoveryhandler interface the handler used to implement the my domain login discovery page, which is an interview-based (two-step) login process. first the user is prompted for a unique identifier such as an email address or phone number. then the handler determines (discovers) how to authenticate the user. either the user enters a password or is directed to an identity provider’s login page. oauthrefreshresult class stores the result of an authproviderpluginclass refresh method. oauth authentication" "flow provides a refresh token that can be used to get a new access token. access tokens have a limited lifetime as specified by the session timeout value. when an access token expires, use a refresh token to get a new access token. registrationhandler interface salesforce provides the ability to use an authentication provider, such as facebook© or janrain©, for single sign-on into salesforce. samljithandler interface use this interface to control and customize just-in-time user provisioning logic during saml single sign-on. sessionmanagement class contains methods for verifying users’ identity, creating custom login flows, customizing security levels, and defining trusted ip ranges for a current session. sessionlevel enum an auth.sessionlevel enum value is used by the sessionmanagement.setsessionlevel method. userdata class stores user information for auth.registrationhandler. verificationmethod enum contains the different ways users can identify themselves when logging in. you can use it to implement mobile-centric passwordless login pages and to self-register (and deregister) verification methods. verificationpolicy enum the auth.verificationpolicy enum contains an identity verification policy value used by the sessionmanagement.generateverificationurl method. verificationresult class contains the result of a verification challenge that you invoke when you create your own verify page. the challenge can be initiated by either the system.usermanagement.verifypasswordlesslogin or system.usermanagement.verifyselfregistration method. auth exceptions the auth namespace contains some exception classes. authconfiguration class contains methods for configuring settings for users to log in to a salesforce org using their authentication provider credentials instead of their salesforce credentials. the authentication provider can be any authentication provider that supports the openid connect protocol, such as google, facebook, or twitter. users log in to either an experience cloud site (https://mydomainname.my.site.com) or your my domain login url (https://mydomainname.my.salesforce.com). namespace auth 63apex reference guide authconfiguration class example this example shows how to call some methods on the auth.authconfiguration class. before you can run this sample, you must provide valid values for the urls and developer name. note: if you’re not using enhanced domains, your org’s my domain urls are different. for details, see my domain url formats in salesforce help. string communityurl = 'mydomainname.my.site.com'; string starturl = ''; auth.authconfiguration authconfig = new auth.authconfiguration(communityurl,starturl); list authprvs = authconfig.getauthproviders(); string bcolor = authconfig.getbackgroundcolor(); string ftext = authconfig.getfootertext(); string sso = auth.authconfiguration.getauthproviderssourl(communityurl, starturl, 'developername'); authconfiguration constructors the following are constructors for authconfiguration. note: the authconfiguration (networkid, starturl) constructor is deprecated in api version 56.0 and later. authconfiguration(communityorcustomurl, starturl) creates an instance of the authconfiguration class using the specified url for an experience cloud site or a my domain subdomain and the start url for authenticated users. signature public authconfiguration(string communityorcustomurl, string starturl) parameters communityorcustomurl type: string the url for the domain, which can be a salesforce subdomain created with my domain (my.salesforce.com) or a subdomain of an experience cloud site (force.com). starturl type: string the page users see after successfully logging in to the experience cloud site or my domain subdomain. authconfiguration methods the following are methods for authconfiguration. use these methods to manage and customize authentication for a salesforce community. 64apex reference guide authconfiguration class in this section: getallowinternaluserloginenabled() indicates whether the experience cloud site allows internal users to log in using the experience cloud site login page. to enable, admins configure the setting allow internal users to log in directly to the experience on the login & registration page in experience workspaces. it’s disabled by default. getauthconfig() returns the authconfig sobject, which represents the authentication options for an experience cloud site or salesforce my domain subdomain. getauthconfigproviders() returns the list of authentication providers configured for an experience cloud site or salesforce my domain subdomain. getauthproviders() returns" "the list of authentication providers available for an experience cloud site or salesforce my domain subdomain. getauthproviderssodomainurl(communityurl, starturl, developername) returns the single sign-on url for an experience cloud site subdomain. getauthproviderssourl(communityurl, starturl, developername) returns the single sign-on url for an experience cloud site or salesforce my domain subdomain. getbackgroundcolor() returns the color for the background of the login page for a community. getcertificateloginenabled(domainurl) returns true if certificate-based authentication is enabled for the my domain url. getcertificateloginurl(domainurl, starturl) returns the certificate-based authentication endpoint for the my domain url if the org has certificate-based authentication enabled. getdefaultprofileforregistration() returns the profile id assigned to new community users. getfootertext() returns the text at the bottom of the login page for a community. getforgotpasswordurl() returns the url for the standard or custom forgot password page that is specified for an experience cloud site or portal by the administrator. getheadlessforgotpasswordenabled() returns true if the headless forgot password flow is enabled. getheadlessfrgtpswenabled() this method will be deprecated in a future release. use the getheadlessforgotpasswordenabled() method in this class instead. getheadlessregistrationenabled() determines if the headless registration flow is enabled. getlogourl() returns the location of the icon image at the bottom of the login page for a community. getrightframeurl() returns the url for the right-frame content to display on the right side of the experience cloud site login page. the admin supplies the url. 65apex reference guide authconfiguration class getsamlproviders() returns the list of saml-based authentication providers available for an experience cloud site or salesforce my domain subdomain. getsamlssourl(communityurl, starturl, samlid) returns the single sign-on url for an experience cloud site or salesforce my domain subdomain. getselfregistrationenabled() indicates whether the current community allows new users to create their own account by filling out a registration form. getselfregistrationurl() returns the location of the self-registration page for new users to sign up for an account with a community. getstarturl() returns the start page of an experience cloud site or salesforce my domain subdomain. this url is the first page that users see when they log in. getusernamepasswordenabled() indicates whether the current community is set to display a login form asking for a username and password. you can configure the community not to request a username and password if it is for unauthenticated users or users logging in with a third-party authentication provider. iscommunityusingsiteascontainer() returns true if the experience cloud site uses site.com pages; otherwise, returns false. getallowinternaluserloginenabled() indicates whether the experience cloud site allows internal users to log in using the experience cloud site login page. to enable, admins configure the setting allow internal users to log in directly to the experience on the login & registration page in experience workspaces. it’s disabled by default. signature public boolean getallowinternaluserloginenabled() return value type: boolean usage if true, internal users log in to an experience cloud site from the site’s login page with their internal credentials. if they navigate to their internal org from the experience cloud site, they don't have to log in again. getauthconfig() returns the authconfig sobject, which represents the authentication options for an experience cloud site or salesforce my domain subdomain. signature public authconfig getauthconfig() 66apex reference guide authconfiguration class return value type: authconfig the authconfig sobject for the experience cloud site or salesforce my domain subdomain. getauthconfigproviders() returns the list of authentication providers configured for an experience cloud site or salesforce my domain subdomain. signature public list getauthconfigproviders() return value type: list a list of authentication providers (authconfigproviders sobjects), which are children of the authprovider sobject. getauthproviders() returns the list of authentication providers available for an experience cloud site or salesforce my domain subdomain. signature public list getauthproviders() return value type: list a list of authentication providers (authprovider sobject" "s) for the experience cloud site or my domain subdomain. getauthproviderssodomainurl(communityurl, starturl, developername) returns the single sign-on url for an experience cloud site subdomain. note: for better performance, we recommend using this method instead of getauthproviderssourl. if the authentication provider has user subdomain for callback enabled, changing the single sign-on url also changes the callback url to use the experience cloud site subdomain. before switching to this method, update the callback url in your third-party applications to avoid getting an invalid callback url error during single sign-on. signature public static string getauthproviderssodomainurl(string communityurl, string starturl, string developername) parameters communityurl type: string 67apex reference guide authconfiguration class the url for the experience cloud site subdomain. if null or specified as an empty string, you get the single sign-on url for the org’s my domain. starturl type: string the page that users see after logging in to the experience cloud site subdomain. developername type: string the unique name of the authentication provider. return value type: string the single sign-on initialization url for the experience cloud site subdomain. getauthproviderssourl(communityurl, starturl, developername) returns the single sign-on url for an experience cloud site or salesforce my domain subdomain. signature public static string getauthproviderssourl(string communityurl, string starturl, string developername) parameters communityurl type: string the url for the experience cloud site or my domain subdomain. if not null and not specified as an empty string, you get the url for the experience cloud site. if null or specified as an empty string, you get the url for a custom domain. starturl type: string the page that users see after logging in to the experience cloud site or my domain subdomain. developername type: string the unique name of the authentication provider. return value type: string the single sign-on initialization url for the experience cloud site or salesforce my domain subdomain. getbackgroundcolor() returns the color for the background of the login page for a community. 68apex reference guide authconfiguration class signature public string getbackgroundcolor() return value type: string getcertificateloginenabled(domainurl) returns true if certificate-based authentication is enabled for the my domain url. signature public boolean getcertificateloginenabled(string domainurl) parameters domainurl type: string the my domain url that is being checked for certificate-based authentication. return value type: boolean getcertificateloginurl(domainurl, starturl) returns the certificate-based authentication endpoint for the my domain url if the org has certificate-based authentication enabled. signature public static string getcertificateloginurl(string domainurl, string starturl) parameters domainurl type: string the my domain url being checked for its certificate-based authentication endpoint . starturl type: string the page that the user is directed to after logging in to the my domain with certificate-based authentication. return value type: string the certificate-based authentication endpoint for the my domain url: mydomainurl:8443/services/certauth?starturl=starturlparam 69apex reference guide authconfiguration class getdefaultprofileforregistration() returns the profile id assigned to new community users. signature public string getdefaultprofileforregistration() return value type: string the profile id. getfootertext() returns the text at the bottom of the login page for a community. signature public string getfootertext() return value type: string the text string displayed at the bottom of the login page, for example “log in with an existing account.” getforgotpasswordurl() returns the url for the standard or custom forgot password page that is specified for an experience cloud site or portal by the administrator. signature public string getforgotpasswordurl() return value type: string url for the standard or custom forgot password page. getheadlessforgotpasswordenabled() returns true if the headless forgot password flow is enabled. signature public boolean getheadlessforgotpasswordenabled() 70apex reference guide authconfiguration class return value type: boolean getheadlessfrgtpswenabled() this method will be deprecated in a future release. use the getheadlessforgotpasswordenabled() method in" "this class instead. signature public boolean getheadlessfrgtpswenabled() return value type: boolean getheadlessregistrationenabled() determines if the headless registration flow is enabled. signature public boolean getheadlessregistrationenabled() return value type: boolean returns true if headless registration is enabled. getlogourl() returns the location of the icon image at the bottom of the login page for a community. signature public string getlogourl() return value type: string the path to the icon image. getrightframeurl() returns the url for the right-frame content to display on the right side of the experience cloud site login page. the admin supplies the url. signature public string getloginrightframeurl() 71apex reference guide authconfiguration class return value type: string url for the right-frame content of the experience cloud site login page. salesforce creates an inline (iframe) on the right side of the login page to display the contents specified by the url. getsamlproviders() returns the list of saml-based authentication providers available for an experience cloud site or salesforce my domain subdomain. signature public list getsamlproviders() return value type: list a list of saml-based authentication providers, which are samlssoconfig sobjects. getsamlssourl(communityurl, starturl, samlid) returns the single sign-on url for an experience cloud site or salesforce my domain subdomain. signature public static string getsamlssourl(string communityurl, string starturl, string samlid) parameters communityurl type: string the url for the experience cloud site or my domain subdomain. if not null and not specified as an empty string, you get the url for the experience cloud site. if null or specified as an empty string, you get the url for a my domain subdomain. starturl type: string the page users see after successfully logging in to the experience cloud site or my domain subdomain samlid type: string the unique identifier of the samlssoconfig standard object for the experience cloud site or my domain subdomain return value type: string the single sign-on initialization url for the experience cloud site or salesforce my domain subdomain. getselfregistrationenabled() indicates whether the current community allows new users to create their own account by filling out a registration form. 72apex reference guide authconfiguration class signature public boolean getselfregistrationenabled() return value type: boolean getselfregistrationurl() returns the location of the self-registration page for new users to sign up for an account with a community. signature public string getselfregistrationurl() return value type: string the location of the self-registration page. getstarturl() returns the start page of an experience cloud site or salesforce my domain subdomain. this url is the first page that users see when they log in. signature public string getstarturl() return value type: string the location of the start page for the experience cloud site or my domain subdomain. getusernamepasswordenabled() indicates whether the current community is set to display a login form asking for a username and password. you can configure the community not to request a username and password if it is for unauthenticated users or users logging in with a third-party authentication provider. signature public boolean getusernamepasswordenabled() return value type: boolean 73apex reference guide authprovidercallbackstate class iscommunityusingsiteascontainer() returns true if the experience cloud site uses site.com pages; otherwise, returns false. signature public boolean iscommunityusingsiteascontainer() return value type: boolean authprovidercallbackstate class provides request http headers, body, and query parameters to the authproviderplugin.handlecallback method for user authentication. this class allows you to group the information passed in rather than passing headers, body, and query parameters individually. namespace auth in this section: authprovidercallbackstate constructors authprovidercallbackstate properties see also: handlecallback(authproviderconfiguration, callbackstate) authprovidercallbackstate constructors the following are constructors for authprovidercallbackstate. in this section: authprovidercallbackstate(headers, body, queryparameters) creates an instance of the authprovidercallbackstate class using the specified http headers, body, and query parameters of the authentication request" ". authprovidercallbackstate(headers, body, queryparameters) creates an instance of the authprovidercallbackstate class using the specified http headers, body, and query parameters of the authentication request. signature public authprovidercallbackstate(map headers, string body, map queryparameters) 74apex reference guide authprovidercallbackstate class parameters headers type: map the http headers of the authentication request. body type: string the http body of the authentication request. queryparameters type: map the http query parameters of the authentication request. authprovidercallbackstate properties the following are properties for authprovidercallbackstate. in this section: body the http body of the authentication request. headers the http headers of the authentication request. queryparameters the http query parameters of the authentication request. body the http body of the authentication request. signature public string body {get; set;} property value type: string headers the http headers of the authentication request. signature public map headers {get; set;} property value type: map 75apex reference guide authproviderplugin interface queryparameters the http query parameters of the authentication request. signature public map queryparameters {get; set;} property value type: map authproviderplugin interface this interface is deprecated. for new development, use the abstract class auth.authproviderpluginclass to create a custom oauth-based authentication provider plug-in for single sign-on in to salesforce. namespace auth usage deprecated. existing implementations that use auth.authproviderplugin still work. for new development, use auth.authproviderpluginclass. in this section: authproviderplugin methods authproviderplugin example implementation authproviderplugin methods the following methods are for authproviderplugin, which, as of api version 39.0, is deprecated. use themethods in authproviderpluginclass instead. in this section: getcustommetadatatype() deprecated as of api version 39.0. use the corresponding method in auth.authproviderpluginclass. getuserinfo(authproviderconfiguration, response) deprecated as of api version 39.0. use the corresponding method in auth.authproviderpluginclass. handlecallback(authproviderconfiguration, callbackstate) deprecated as of api version 39.0. use the corresponding method in auth.authproviderpluginclass. 76apex reference guide authproviderplugin interface initiate(authproviderconfiguration, statetopropagate) deprecated as of api version 39.0. use the corresponding method in auth.authproviderpluginclass. see also: salesforce help: create a custom external authentication provider getcustommetadatatype() deprecated as of api version 39.0. use the corresponding method in auth.authproviderpluginclass. signature public string getcustommetadatatype() return value type: string the custom metadata type api name for the authentication provider. usage returns the custom metadata type api name for a custom oauth-based authentication provider for single sign-on to salesforce. the getcustommetatadatype() method returns only custom metadata type names. it does not return custom metadata record names. getuserinfo(authproviderconfiguration, response) deprecated as of api version 39.0. use the corresponding method in auth.authproviderpluginclass. signature public auth.userdata getuserinfo(map authproviderconfiguration, auth.authprovidertokenresponse response) parameters authproviderconfiguration type: map the configuration for the custom authentication provider. when you create a custom metadata type in salesforce, the configuration populates with the custom metadata type default values. or you can set the configuration with values you enter when you create the custom provider in auth. providers in setup. response type: auth.authprovidertokenresponse the oauth access token, oauth secret or refresh token, and state provided by the authentication provider to authenticate the current user. 77apex reference guide authproviderplugin interface return value type: auth.userdata creates a new instance of the auth.userdata class. usage returns information from the custom authentication provider about the current user. the registration handler and other authentication provider flows use this information. handlecallback(authproviderconfiguration, callbackstate) deprecated as of api version 39.0. use the corresponding method in auth.authproviderpluginclass." "signature public auth.authprovidertokenresponse handlecallback(map authproviderconfiguration, auth.authprovidercallbackstate callbackstate) parameters authproviderconfiguration type: map the configuration for the custom authentication provider. when you create a custom metadata type in salesforce, the configuration populates with the custom metadata type default values. or you can set the configuration with values you enter when you create the custom provider in auth. providers in setup. callbackstate type: auth.authprovidercallbackstate the class that contains the http headers, body, and queryparams of the authentication request. return value type: auth.authprovidertokenresponse creates an instance of the authprovidertokenresponse class. usage uses the authentication provider’s supported authentication protocol to return an oauth access token, oauth secret or refresh token, and the state passed in when the request for the current user was initiated. initiate(authproviderconfiguration, statetopropagate) deprecated as of api version 39.0. use the corresponding method in auth.authproviderpluginclass. signature public system.pagereference initiate(map authproviderconfiguration, string statetopropagate) 78apex reference guide authproviderpluginclass class parameters authproviderconfiguration type: map the configuration for the custom authentication provider. when you create a custom metadata type in salesforce, the configuration populates with the custom metadata type default values. or you can set the configuration with values you enter when you create the custom provider in auth. providers in setup. statetopropagate type: string the state passed in to initiate the authentication request for the user. return value type: system.pagereference the url of the page where the user is redirected for authentication. usage returns the url where the user is redirected for authentication. authproviderplugin example implementation we’ve removed the example implementation for the auth.authproviderplugin interface because we’ve deprecated the interface and replaced it with an abstract class. see authproviderpluginclass class. authproviderpluginclass class contains methods to create a custom oauth-based authentication provider plug-in for single sign-on in to salesforce. use this class to create a custom authentication provider plug-in if you can’t use one of the authentication providers that salesforce provides. namespace auth usage to create a custom authentication provider for single sign-on, create a class that extends auth.authproviderpluginclass. this class allows you to store the custom configuration for your authentication provider and handle authentication protocols when users log in to salesforce with their login credentials for an external service provider. in salesforce, the class that implements this interface appears in the provider type drop-down list in auth. providers in setup. make sure that the user you specify to run the class has “customize application” and “manage auth. providers” permissions. as of api version 39.0, use the abstract class authproviderpluginclass to create a custom external authentication provider. this class replaces the authproviderplugin interface. if you’ve already implemented a custom authentication provider plug-in using the interface, it still works. however, use authproviderpluginclass to extend your plug-in. if you haven’t created an interface, create a custom authentication provider plug-in by extending this abstract class. for more information, see authproviderpluginclass code example. 79apex reference guide authproviderpluginclass class in this section: authproviderpluginclass methods authproviderpluginclass code example authproviderpluginclass methods the authproviderpluginclass methods don’t support dml options. in this section: getcustommetadatatype() returns the custom metadata type api name for a custom oauth-based authentication provider for single sign-on to salesforce. getuserinfo(authproviderconfiguration, response) returns information from the custom authentication provider about the current user. this information is used by the registration handler and in other authentication provider flows. handlecallback(authproviderconfiguration, callbackstate) uses the authentication provider’s supported authentication protocol to return an oauth access token, oauth secret or refresh token, and the state passed in when the request for the current user was initiated. initiate(authproviderconfiguration, statetopropagate) returns the url where the user is redirected for authentication. refresh(authproviderconfiguration, refreshtoken) returns a new access token, which is used to update an expired access token. getcustommetadatatype() returns the custom metadata type api name for a custom oauth" "-based authentication provider for single sign-on to salesforce. signature public string getcustommetadatatype() return value type: string the custom metadata type api name for the authentication provider. usage the getcustommetatadatype() method returns only custom metadata type names. it does not return custom metadata record names. as of api version 39.0, use this method when extending auth.authproviderpluginclass to create a custom external authentication provider. getuserinfo(authproviderconfiguration, response) returns information from the custom authentication provider about the current user. this information is used by the registration handler and in other authentication provider flows. 80apex reference guide authproviderpluginclass class signature public auth.userdata getuserinfo(map authproviderconfiguration, auth.authprovidertokenresponse response) parameters authproviderconfiguration type: map the configuration for the custom authentication provider. when you create a custom metadata type in salesforce, the configuration populates it with the custom metadata type default values. or you can set the configuration with values that you enter when you create the custom provider in auth. providers in setup. response type: auth.authprovidertokenresponse the oauth access token, oauth secret or refresh token, and state provided by the authentication provider to authenticate the current user. return value type: auth.userdata creates a new instance of the auth.userdata class. usage as of api version 39.0, use this method when extending auth.authproviderpluginclass to create a custom authentication provider. note: you might choose to get user information in the response from the handlecallback method or by another method. however, you must still call getuserinfo in the custom authentication handler to avoid getting errors about mixing objects. for example, if you don’t call getuserinfo, and then try to insert a contact in the auth.registrationhandler.createuser method, you get the error, “you cannot mix entityobjects with different uddinfos within one transaction.” to avoid this error, call getuserinfo with dummy user information as follows. httprequest req = new httprequest(); string url = 'https://login.salesforce.com/'; req.setendpoint(url); req.setmethod('get'); http http = new http(); httpresponse res = http.send(req); handlecallback(authproviderconfiguration, callbackstate) uses the authentication provider’s supported authentication protocol to return an oauth access token, oauth secret or refresh token, and the state passed in when the request for the current user was initiated. signature public auth.authprovidertokenresponse handlecallback(map authproviderconfiguration, auth.authprovidercallbackstate callbackstate) 81apex reference guide authproviderpluginclass class parameters authproviderconfiguration type: map the configuration for the custom authentication provider. when you create a custom metadata type in salesforce, the configuration populates with the custom metadata type default values. or you can set the configuration with values you enter when you create the custom provider in auth. providers in setup. callbackstate type: auth.authprovidercallbackstate the class that contains the http headers, body, and queryparams of the authentication request. return value type: auth.authprovidertokenresponse creates an instance of the authprovidertokenresponse class. usage as of api version 39.0, use this method when extending auth.authproviderpluginclass to create a custom authentication provider. initiate(authproviderconfiguration, statetopropagate) returns the url where the user is redirected for authentication. signature public system.pagereference initiate(map authproviderconfiguration, string statetopropagate) parameters authproviderconfiguration type: map the configuration for the custom authentication provider. when you create a custom metadata type in salesforce, the configuration populates with the custom metadata type default values. or you can set the configuration with values you enter when you create the custom provider in auth. providers in setup. statetopropagate type: string the state passed in to initiate the authentication request for the user. return value type: system.pagereference the url of the page where the user is redirected for authentication. 82" "apex reference guide authproviderpluginclass class usage as of api version 39.0, use this method when extending auth.authproviderpluginclass to create a custom authentication provider. refresh(authproviderconfiguration, refreshtoken) returns a new access token, which is used to update an expired access token. signature public auth.oauthrefreshresult refresh(map authproviderconfiguration, string refreshtoken) parameters authproviderconfiguration type: map the configuration for the custom authentication provider. when you create a custom metadata type in salesforce, the configuration populates with the custom metadata type default values. or you can set the configuration with values you enter when you create the custom provider in auth. providers in setup. refreshtoken type: string the refresh token for the user who is logged in. return value type: auth.oauthrefreshresult returns the new access token, or an error message if an error occurs. usage a successful request returns a auth.oauthrefreshresult with the access token and refresh token in the response. if you receive an error, make sure that you set the error string to the error message. a null error string indicates no error. the refresh method works only with named credentials; it doesn’t respect the standard oauth refresh flow. the refresh method with named credentials works only if the earlier request returns a 401. authproviderpluginclass code example the following example demonstrates how to implement a custom auth. provider plug-in using the abstract class, auth.authproviderpluginclass. global class concur extends auth.authproviderpluginclass { // use this url for the endpoint that the // authentication provider calls back to for configuration. public string redirecturl; private string key; private string secret; 83apex reference guide authproviderpluginclass class // application redirection to the concur website for // authentication and authorization. private string authurl; // uri to get the new access token from concur using the get verb. private string accesstokenurl; // api name for the custom metadata type created for this auth provider. private string custommetadatatypeapiname; // api url to access the user in concur private string userapiurl; // version of the user api url to access data from concur private string userapiversionurl; global string getcustommetadatatype() { return custommetadatatypeapiname; } global pagereference initiate(map authproviderconfiguration, string statetopropagate) { authurl = authproviderconfiguration.get('auth_url__c'); key = authproviderconfiguration.get('key__c'); // here the developer can build up a request of some sort. // ultimately, they return a url where we will redirect the user. string url = authurl + '?client_id='+ key +'&scope=user,exprpt,list&redirect_uri='+ redirecturl + '&state=' + statetopropagate; return new pagereference(url); } global auth.authprovidertokenresponse handlecallback(map authproviderconfiguration, auth.authprovidercallbackstate state ) { // here, the developer will get the callback with actual protocol. // their responsibility is to return a new object called // authprovidertokenresponse. // this will contain an optional accesstoken and refreshtoken key = authproviderconfiguration.get('key__c'); secret = authproviderconfiguration.get('secret__c'); accesstokenurl = authproviderconfiguration.get('access_token_url__c'); map queryparams = state.queryparameters; string code = queryparams.get('code'); string sfdcstate = queryparams.get('state'); httprequest req = new httprequest(); string url = accesstokenurl+'?code=' + code + '&client_id=' + key + '&client_secret=' + secret; req.setendpoint(url); req.setheader('content-type','application/xml'); 84apex reference guide authproviderpluginclass class req.setmethod('get'); http http = new http(); httpresponse res = http.send(req); string responsebody = res.getbody(); string token = gettokenvaluefromresponse(responsebody, 'token', null); return new auth.authprovidertokenresponse('concur', token, 'refreshtoken', sfdcstate); } global auth.userdata getuserinfo(" "map authproviderconfiguration, auth.authprovidertokenresponse response) { //here the developer is responsible for constructing an //auth.userdata object string token = response.oauthtoken; httprequest req = new httprequest(); userapiurl = authproviderconfiguration.get('api_user_url__c'); userapiversionurl = authproviderconfiguration.get ('api_user_version_url__c'); req.setheader('authorization', 'oauth ' + token); req.setendpoint(userapiurl); req.setheader('content-type','application/xml'); req.setmethod('get'); http http = new http(); httpresponse res = http.send(req); string responsebody = res.getbody(); string id = gettokenvaluefromresponse(responsebody, 'loginid',userapiversionurl); string fname = gettokenvaluefromresponse(responsebody, 'firstname', userapiversionurl); string lname = gettokenvaluefromresponse(responsebody, 'lastname', userapiversionurl); string flname = fname + ' ' + lname; string uname = gettokenvaluefromresponse(responsebody, 'emailaddress', userapiversionurl); string locale = gettokenvaluefromresponse(responsebody, 'localename', userapiversionurl); map provmap = new map(); provmap.put('what1', 'noidea1'); provmap.put('what2', 'noidea2'); return new auth.userdata(id, fname, lname, flname, uname, 'what', locale, null, 'concur', null, provmap); } private string gettokenvaluefromresponse(string response, string token, string ns) { dom.document docx = new dom.document(); docx.load(response); string ret = null; 85apex reference guide authproviderpluginclass class dom.xmlnode xroot = docx.getrootelement() ; if(xroot != null){ ret = xroot.getchildelement(token, ns).gettext(); } return ret; } } sample test classes the following example contains test classes for the concur class. @istest public class concurtestclass { private static final string oauth_token = 'testtoken'; private static final string state = 'mockteststate'; private static final string refresh_token = 'refreshtoken'; private static final string login_id = 'testloginid'; private static final string username = 'testusername'; private static final string first_name = 'testfirstname'; private static final string last_name = 'testlastname'; private static final string email_address = 'testemailaddress'; private static final string locale_name = 'testlocalname'; private static final string full_name = first_name + ' ' + last_name; private static final string provider = 'concur'; private static final string redirect_url = 'http://localhost/services/authcallback/orgid/concur'; private static final string key = 'testkey'; private static final string secret = 'testsecret'; private static final string state_to_propogate = 'teststate'; private static final string access_token_url = 'http://www.dummyhost.com/accesstokenuri'; private static final string api_user_version_url = 'http://www.dummyhost.com/user/20/1'; private static final string auth_url = 'http://www.dummy.com/authurl'; private static final string api_user_url = 'www.concursolutions.com/user/api'; // in the real world scenario, the key and value would be read // from the (custom fields in) custom metadata type record. private static map setupauthproviderconfig () { map authproviderconfiguration = new map(); authproviderconfiguration.put('key__c', key); authproviderconfiguration.put('auth_url__c', auth_url); authproviderconfiguration.put('secret__c', secret); authproviderconfiguration.put('access_token_url__c', access_token" "_url); authproviderconfiguration.put('api_user_url__c',api_user_url); authproviderconfiguration.put('api_user_version_url__c', 86apex reference guide authproviderpluginclass class api_user_version_url); authproviderconfiguration.put('redirect_url__c',redirect_url); return authproviderconfiguration; } static testmethod void testinitiatemethod() { string statetopropogate = 'mockteststate'; map authproviderconfiguration = setupauthproviderconfig(); concur concurcls = new concur(); concurcls.redirecturl = authproviderconfiguration.get('redirect_url__c'); pagereference expectedurl = new pagereference(authproviderconfiguration.get('auth_url__c') + '?client_id='+ authproviderconfiguration.get('key__c') +'&scope=user,exprpt,list&redirect_uri='+ authproviderconfiguration.get('redirect_url__c') + '&state=' + state_to_propogate); pagereference actualurl = concurcls.initiate(authproviderconfiguration, state_to_propogate); system.assertequals(expectedurl.geturl(), actualurl.geturl()); } static testmethod void testhandlecallback() { map authproviderconfiguration = setupauthproviderconfig(); concur concurcls = new concur(); concurcls.redirecturl = authproviderconfiguration.get ('redirect_url_c'); test.setmock(httpcalloutmock.class, new concurmockhttpresponsegenerator()); map queryparams = new map(); queryparams.put('code','code'); queryparams.put('state',authproviderconfiguration.get('state_c')); auth.authprovidercallbackstate cbstate = new auth.authprovidercallbackstate(null,null,queryparams); auth.authprovidertokenresponse actualauthprovresponse = concurcls.handlecallback(authproviderconfiguration, cbstate); auth.authprovidertokenresponse expectedauthprovresponse = new auth.authprovidertokenresponse( 'concur', oauth_token, refresh_token, null); system.assertequals(expectedauthprovresponse.provider, actualauthprovresponse.provider); system.assertequals(expectedauthprovresponse.oauthtoken, actualauthprovresponse.oauthtoken); system.assertequals(expectedauthprovresponse.oauthsecretorrefreshtoken, actualauthprovresponse.oauthsecretorrefreshtoken); system.assertequals(expectedauthprovresponse.state, 87apex reference guide authproviderpluginclass class actualauthprovresponse.state); } static testmethod void testgetuserinfo() { map authproviderconfiguration = setupauthproviderconfig(); concur concurcls = new concur(); test.setmock(httpcalloutmock.class, new concurmockhttpresponsegenerator()); auth.authprovidertokenresponse response = new auth.authprovidertokenresponse( provider, oauth_token ,'sampleoauthsecret', state); auth.userdata actualuserdata = concurcls.getuserinfo( authproviderconfiguration, response) ; map provmap = new map(); provmap.put('key1', 'value1'); provmap.put('key2', 'value2'); auth.userdata expecteduserdata = new auth.userdata(login_id, first_name, last_name, full_name, email_address, null, locale_name, null, provider, null, provmap); system.assertnotequals(expecteduserdata,null); system.assertequals(expecteduserdata.firstname, actualuserdata.firstname); system.assertequals(expecteduserdata.lastname, actualuserdata.lastname); system.assertequals(expecteduserdata.fullname, actualuserdata.fullname); system.assertequals(expecteduserdata.email, actualuserdata.email); system.assertequals(expecteduserdata.username, actualuserdata.username); system.assert" "equals(expecteduserdata.locale, actualuserdata.locale); system.assertequals(expecteduserdata.provider, actualuserdata.provider); system.assertequals(expecteduserdata.siteloginurl, actualuserdata.siteloginurl); } // implement a mock http response generator for concur. public class concurmockhttpresponsegenerator implements httpcalloutmock { public httpresponse respond(httprequest req) { string namespace = api_user_version_url; string prefix = 'mockprefix'; 88apex reference guide authprovidertokenresponse class dom.document doc = new dom.document(); dom.xmlnode xmlnode = doc.createrootelement( 'mockrootnodename', namespace, prefix); xmlnode.addchildelement('loginid', namespace, prefix) .addtextnode(login_id); xmlnode.addchildelement('firstname', namespace, prefix) .addtextnode(first_name); xmlnode.addchildelement('lastname', namespace, prefix) .addtextnode(last_name); xmlnode.addchildelement('emailaddress', namespace, prefix) .addtextnode(email_address); xmlnode.addchildelement('localename', namespace, prefix) .addtextnode(locale_name); xmlnode.addchildelement('token', null, null) .addtextnode(oauth_token); system.debug(doc.toxmlstring()); // create a fake response httpresponse res = new httpresponse(); res.setheader('content-type', 'application/xml'); res.setbody(doc.toxmlstring()); res.setstatuscode(200); return res; } } } authprovidertokenresponse class stores the response from the authproviderplugin.handlecallback method. namespace auth in this section: authprovidertokenresponse constructors authprovidertokenresponse properties authprovidertokenresponse constructors the following are constructors for authprovidertokenresponse. in this section: authprovidertokenresponse(provider, oauthtoken, oauthsecretorrefreshtoken, state) creates an instance of the authprovidertokenresponse class using the specified authentication provider, oauth access token, oauth secret or refresh token, and state for a custom authentication provider plug-in. 89apex reference guide authprovidertokenresponse class authprovidertokenresponse(provider, oauthtoken, oauthsecretorrefreshtoken, state) creates an instance of the authprovidertokenresponse class using the specified authentication provider, oauth access token, oauth secret or refresh token, and state for a custom authentication provider plug-in. signature public authprovidertokenresponse(string provider, string oauthtoken, string oauthsecretorrefreshtoken, string state) parameters provider type: string the custom authentication provider. oauthtoken type: string the oauth access token. oauthsecretorrefreshtoken type: string the oauth secret or refresh token for the currently logged-in user. state type: string the state passed in to initiate the authentication request for the user. authprovidertokenresponse properties the following are properties for authprovidertokenresponse. in this section: oauthsecretorrefreshtoken the oauth secret or refresh token for the currently logged-in user. oauthtoken the oauth access token. provider the authentication provider. state the state passed in to initiate the authentication request for the user. oauthsecretorrefreshtoken the oauth secret or refresh token for the currently logged-in user. 90apex reference guide authtoken class signature public string oauthsecretorrefreshtoken {get; set;} property value type: string oauthtoken the oauth access token. signature public string oauthtoken {get; set;} property value type: string provider the authentication provider. signature public string provider {get; set;} property value type: string state the state passed in to initiate the authentication request for the user. signature public string state {get; set;} property value type: string authtoken class contains methods for providing the access token associated with an authentication provider for an authenticated user, except for the janrain provider. 91apex reference guide authtoken class namespace auth authtoken methods the following are methods for" "authtoken. all methods are static. in this section: getaccesstoken(authproviderid, providername) returns an access token for the current user using the specified 18-character identifier of an authprovider definition in your org and the proper name of the third party, such as salesforce or facebook. note that querying the providertype field on the authprovider object sometimes returns a value that differs from the expected provider name value. for example, for open id connect providers, openidconnect is the providertype value for the authprovider object, but the expected providername is open id connect. getaccesstokenmap(authproviderid, providername) returns a map from the third-party identifier to the access token for the currently logged-in salesforce user. the identifier value depends on the third party. for example, for salesforce it would be the user id, while for facebook it would be the user number. note that querying the providertype field on the authprovider object sometimes returns a value that differs from the expected provider name value. for example, for open id connect providers, openidconnect is the providertype value for the authprovider object, but the expected providername is open id connect. refreshaccesstoken(authproviderid, providername, oldaccesstoken) returns a map from the third-party identifier containing a refreshed access token for the currently logged-in salesforce user. note that querying the providertype field on the authprovider object sometimes returns a value that differs from the expected provider name value. for example, for open id connect providers, openidconnect is the providertype value for the authprovider object, but the expected providername is open id connect. revokeaccess(authproviderid, providername, userid, remoteidentifier) revokes the access token for a specified social sign-on user from a third-party service such as facebook©. you can use this method only if the isnotssousable field on the associated thirdpartyaccountlink object is set to false. querying the providertype field on the authprovider object sometimes returns a value that differs from the expected provider name value. for example, for open id connect providers, openidconnect is the providertype value for the authprovider object, but the expected providername is open id connect. getaccesstoken(authproviderid, providername) returns an access token for the current user using the specified 18-character identifier of an authprovider definition in your org and the proper name of the third party, such as salesforce or facebook. note that querying the providertype field on the authprovider object sometimes returns a value that differs from the expected provider name value. for example, for open id connect providers, openidconnect is the providertype value for the authprovider object, but the expected providername is open id connect. signature public static string getaccesstoken(string authproviderid, string providername) 92apex reference guide authtoken class parameters authproviderid type: string providername type: string the proper name of the third party. for all providers except janrain, the expected values are • facebook • salesforce • open id connect • microsoft access control service • linkedin • twitter • google for janrain providers, the parameter value is the proper name of the third party used. yahoo! is an example of a janrain provider value. return value type: string getaccesstokenmap(authproviderid, providername) returns a map from the third-party identifier to the access token for the currently logged-in salesforce user. the identifier value depends on the third party. for example, for salesforce it would be the user id, while for facebook it would be the user number. note that querying the providertype field on the authprovider object sometimes returns a value that differs from the expected provider name value. for example, for open id connect providers, openidconnect is the providertype value for the authprovider object, but the expected providername is open id connect. signature public static map getaccesstokenmap(string authproviderid, string providername) parameters authproviderid type: string providername type: string the proper name of the third party. for all providers except janrain, the expected values are • facebook • salesforce • open id connect • microsoft access control service 93apex reference guide authtoken class • linkedin • twitter • google for janrain providers, the parameter value is the proper name of the third party used. yahoo! is an example of a janrain provider value. return value type: map<" "string, string> refreshaccesstoken(authproviderid, providername, oldaccesstoken) returns a map from the third-party identifier containing a refreshed access token for the currently logged-in salesforce user. note that querying the providertype field on the authprovider object sometimes returns a value that differs from the expected provider name value. for example, for open id connect providers, openidconnect is the providertype value for the authprovider object, but the expected providername is open id connect. signature public static map refreshaccesstoken(string authproviderid, string providername, string oldaccesstoken) parameters authproviderid type: string providername type: string the proper name of the third party. for all providers except janrain, the expected values are • facebook • salesforce • open id connect • microsoft access control service • linkedin • twitter • google for janrain providers, the parameter value is the proper name of the third party used. yahoo! is an example of a janrain provider value. oldaccesstoken type: string return value type: map 94apex reference guide authtoken class usage this method works when using salesforce or an openid connect provider, but not when using facebook or janrain. the returned map contains accesstoken and refresherror keys. evaluate the keys in the response to check if the request was successful. for a successful request, the refresherror value is null, and accesstoken is a token value. for an unsuccessful request, the refresherror value is an error message, and the accesstoken value is null. when successful, this method updates the token stored in the database, which you can get using auth.authtoken.getaccesstoken(). if you are using an openid connect authentication provider, an id_token is not required in the response from the provider. if a token issuer is specified in the auth. provider settings and an id_token is provided anyway, salesforce will verify it. example string accesstoken = auth.authtoken.getaccesstoken('0sod000000000deoai', 'open id connect'); map responsemap = auth.authtoken.refreshaccesstoken('0sod000000000deoai', 'open id connect', accesstoken); a successful request includes the access token in the response. (refresherror,null)(accesstoken,00dd00000007bhe!aqkaqfzj...) revokeaccess(authproviderid, providername, userid, remoteidentifier) revokes the access token for a specified social sign-on user from a third-party service such as facebook©. you can use this method only if the isnotssousable field on the associated thirdpartyaccountlink object is set to false. querying the providertype field on the authprovider object sometimes returns a value that differs from the expected provider name value. for example, for open id connect providers, openidconnect is the providertype value for the authprovider object, but the expected providername is open id connect. signature public static boolean revokeaccess(string authproviderid, string providername, string userid, string remoteidentifier) parameters authproviderid type: string the id of the auth. provider in the salesforce organization. providername type: string the proper name of the third party. for all providers except janrain, the expected values are • facebook • salesforce • open id connect • microsoft access control service • linkedin • twitter 95apex reference guide communitiesutil class • google for janrain providers, the parameter value is the proper name of the third party used. yahoo! is an example of a janrain provider value. userid type: string the 15-character id for the user whose access is being revoked. remoteidentifier type: string the unique id for the user in the third-party system (this value is in the associated thirdpartyaccountlink standard object). return value type: boolean the return value is true if the revokeaccess() operation is successful; otherwise false. example the following example revokes a facebook user's access token. auth.authtoken.revokeaccess('0soxx00000#####', 'facebook', '005xx00000#####', 'thirdpartyidentifier_exist214176560#####'); communitiesutil class contains methods for getting information about an experience cloud user. namespace auth example the following example directs a guest (unauthenticated) user to one page," "and authenticated users of the experience cloud site’s parent organization to another page. if (auth.communitiesutil.isguestuser()) // redirect to the login page if user is an unauthenticated user return new pagereference(login_url); if (auth.communitiesutil.isinternaluser()) // redirect to the home page if user is an internal user return new pagereference(home_url); communitiesutil methods the following are methods for communitiesutil. all methods are static. 96apex reference guide communitiesutil class in this section: getlogouturl() returns the page to display after the current experience cloud user logs out. getuserdisplayname() returns the current user’s experience cloud display name. isguestuser() indicates whether the current user isn’t logged in to the experience cloud site. redirect the user to log in, if necessary. isinternaluser() indicates whether the current user is logged in as a member of the parent salesforce organization, such as an employee. getlogouturl() returns the page to display after the current experience cloud user logs out. signature public static string getlogouturl() return value type: string getuserdisplayname() returns the current user’s experience cloud display name. signature public static string getuserdisplayname() return value type: string isguestuser() indicates whether the current user isn’t logged in to the experience cloud site. redirect the user to log in, if necessary. signature public static boolean isguestuser() return value type: boolean isinternaluser() indicates whether the current user is logged in as a member of the parent salesforce organization, such as an employee. 97apex reference guide configurableselfreghandler interface signature public static boolean isinternaluser() return value type: boolean configurableselfreghandler interface gives you more control over how customers or partners self-register for your experience cloud site by creating a class that implements auth.configurableselfreghandler. you choose the user information to collect, and how users identify themselves—with their email address, phone number, or another identifier. when verified, you create a customer or partner user and log in the user to your experience cloud site. namespace auth usage you set up site self-registration declaratively on the login & registration (l&r) page of the administration workspace. when combined with a configurable self-registration setup, the handler class can programmatically fill in user fields, including custom fields, and determine how to create a user and log them in. when you select the configurable self-reg page registration page, you choose the user fields to collect from the self-registration form, such as last name, first name, username, nickname, mobile, or email. you also determine the verification method that the user identifies themselves with, which can be email, mobile, or neither. salesforce generates the auth.configurableselfreghandler handler, which contains logic on how to create an experience cloud site member. modify the handler to change how users are created, and how collected user information is used. you can add custom logic to ensure that the email or phone number is unique to the customer or partner who's registering. for example, you can add a custom unique field, and write a copy of the email or phone number to it. you can also change how the user is created. by default, the user is created as a contact associated with the account that you select on the l&r page. the generated configurableselfreghandler is located on the setup apex classes page, and begins with autocreatedconfigselfreg, for example, autocreatedconfigselfreg1532475901849. for an example, see configurableselfreghandler example implementation. for more details, see salesforce customer identity in salesforce help. in this section: configurableselfreghandler method configurableselfreghandler example implementation this apex code implements the auth.configurableselfreghandler interface. after the customer or partner fills out the sign-up page and submits it, the handler is invoked to create an experience cloud member with the supplied information. if the registration process requires email or phone verification, the verification process finishes before the auth.configurableselfreghandler.createuser is invoked. if verification isn’t required, createuser is invoked when the customer or partner submits the page. 98apex reference guide configurableselfreghandler interface configurableselfreghandler method the following is the method for configurableself" "reghandler. in this section: createuser(accountid, profileid, registrationattributes, password) create a community member from the information that the visitor provided on your community’s self-registration page. createuser(accountid, profileid, registrationattributes, password) create a community member from the information that the visitor provided on your community’s self-registration page. signature public id createuser(id accountid, id profileid, map registrationattributes, string password) parameters accountid type: id default account with which the new user is associated. this value comes from the account field setting on login and registration (l&r) page under registration page configuration. profileid type: id profile to assign the new user. this value comes from the profile field setting on the l&r page under registration page configuration. registrationattributes type: map a map of attributes that the registering user entered on the self-registration page. the fields that appear on the self-registration page come from the user fields selected on the l&r page when the registration type is configurable self-reg page. password type: string the password entered by the user if “include password” is selected on the l&r page. (if a password isn’t entered, the handler must generate one because a password is required to create a user.) return value type: id returns an identifier for the created user object. auth.configurableselfreghandler inserts a user and then returns the id of that user. 99apex reference guide configurableselfreghandler interface configurableselfreghandler example implementation this apex code implements the auth.configurableselfreghandler interface. after the customer or partner fills out the sign-up page and submits it, the handler is invoked to create an experience cloud member with the supplied information. if the registration process requires email or phone verification, the verification process finishes before the auth.configurableselfreghandler.createuser is invoked. if verification isn’t required, createuser is invoked when the customer or partner submits the page. verification occurs by email if the admin chose email as the verification method when setting up the configurable self-reg handler on the login & registration (l&r) page. when a visitor clicks the sign-up link from the login page, salesforce prompts for an email address and then sends a one-time password to the specified email address. if the visitor enters the verification code successfully on the verify page, the user is created and logged in. likewise, if the admin chose text message as the verification method on the l&r page, the visitor is prompted to enter a phone number. salesforce sends a challenge (verification code) via sms to the user. if successful, the user is created and logged in. requiring verification before creating a user reduces the number of dummy users cluttering your org. the auth.configurableselfreghandler class contains logic for generating the user fields required to create a user in case the user doesn’t supply them. the handler generates default values, ensuring that the values are unique by appending a timestamp. you can modify the handler to make sure that the email address and phone number of the customer or partner are also unique. global class autocreatedconfigselfreg implements auth.configurableselfreghandler { private final long current_time = datetime.now().gettime(); private final string[] uppercase_chars = 'abcdefghijklmnopqrstuvwxyz'.split(''); private final string[] lowercase_chars = 'abcdefghijklmnopqrstuvwxyz'.split(''); private final string[] number_chars = '1234567890'.split(''); private final string[] special_chars = '!#$%-_=+<>'.split(''); // this method is called once after verification (if any was configured). // this method should create a user and insert it. // password can be null. // return null or throw an exception to fail creation. global id createuser(id accountid, id profileid, map registrationattributes, string password) { user u = new user(); u.profileid = profileid; for (sobjectfield field : registrationattributes.keyset()) { string value = registrationattributes.get(field); u.put(field, value); } u = handleunsetrequiredfields(" "u); generatecontact(u, accountid); if (string.isblank(password)) { password = generaterandompassword(); } site.validatepassword(u, password, password); if (u.contactid == null) { return site.createexternaluser(u, accountid, password); } u.languagelocalekey = userinfo.getlocale(); u.localesidkey = userinfo.getlocale(); u.emailencodingkey = 'utf-8'; u.timezonesidkey = userinfo.gettimezone().getid(); insert u; system.setpassword(u.id, password); 100apex reference guide configurableselfreghandler interface return u.id; } // method to autogenerate a password if one isn't passed in. // by setting a password for a user, we won't send a // welcome email to set the password. private string generaterandompassword() { string[] characters = new list(uppercase_chars); characters.addall(lowercase_chars); characters.addall(number_chars); characters.addall(special_chars); string newpassword = ''; boolean needsupper = true, needslower = true, needsnumber = true, needsspecial = true; while (newpassword.length() < 50) { integer randomint = generaterandomint(characters.size()); string c = characters[randomint]; if (needsupper && c.isalluppercase()) { needsupper = false; } else if (needslower && c.isalllowercase()) { needslower = false; } else if (needsnumber && c.isnumeric()) { needsnumber = false; } else if (needsspecial && !c.isalphanumeric()) { needsspecial = false; } newpassword += c; } newpassword = addmissingpasswordrequirements(newpassword, needslower, needsupper, needsnumber, needsspecial); return newpassword; } private string addmissingpasswordrequirements(string password, boolean addlowercase, boolean adduppercase, boolean addnumber, boolean addspecial) { if (addlowercase) { password += lowercase_chars[generaterandomint(lowercase_chars.size())]; } if (adduppercase) { password += uppercase_chars[generaterandomint(uppercase_chars.size())]; } if (addnumber) { password += number_chars[generaterandomint(number_chars.size())]; } if (addspecial) { password += special_chars[generaterandomint(special_chars.size())]; } return password; } // generates a random number from 0 up to, but not including, max. private integer generaterandomint(integer max) { return math.mod(math.abs(crypto.getrandominteger()), max); } // loops over required fields that were not passed in to 101apex reference guide confirmuserregistrationhandler interface // set to some default value. private user handleunsetrequiredfields(user u) { if (string.isblank(u.lastname)){ u.lastname = generatelastname(); } if (string.isblank(u.username)) { u.username = generateusername(); } if (string.isblank(u.email)) { u.email = generateemail(); } if (string.isblank(u.alias)) { u.alias = generatealias(); } if (string.isblank(u.communitynickname)) { u.communitynickname = generatecommunitynickname(); } return u; } // method to construct a contact for a user. private void generatecontact(user u, id accountid) { // add logic here if you want to build your own // contact for the use. } // default implementation to try to provide uniqueness. private string generatealias() { string timestring = string.valueof(current_time); return timestring.substring(timestring.length() - 8); } // default implementation to try to provide uniqueness. private string generatelastname() { return 'externaluser' + current_time; }" "// default implementation to try to provide uniqueness. private string generateusername() { return 'externaluser' + current_time + '@company.com'; } // default implementation to try to provide uniqueness. private string generateemail() { return 'externaluser' + current_time + '@company.com'; } // default implementation to try to provide uniqueness. private string generatecommunitynickname() { return 'externaluser' + current_time; } } confirmuserregistrationhandler interface manages single sign-on (sso) user mappings between salesforce and a third-party identity provider. use this interface to confirm user mappings before updating them. 102apex reference guide confirmuserregistrationhandler interface namespace auth usage when you set up sso with a third-party identity provider, you create a class that implements a registration handler using the auth.registrationhandler interface. this class manages the process of creating and updating users. for advanced use cases that require you to confirm user information during the update process, implement the auth.confirmuserregistrationhandler interface in your class. this interface must be implemented in addition to auth.registrationhandler. you can use the auth.confirmuserregistrationhandler interface to ensure that users are mapped correctly between salesforce and the third party. when a user who has previously logged in with an authentication provider logs in again, you can confirm that the incoming user data is consistent with the user's third-party identifier. if not, you can identify which user is supposed to be logged in. you can also use the auth.confirmuserregistrationhandler interface to switch context for users with multiple records. for example, a user has two records—an admin user and a standard user. when the user logs in, the third-party identity provider confirms the account used to log in and sends the response to salesforce via the userinfo endpoint. you can then use this information to determine whether to log in the user as an admin or standard user. in this section: confirmuserregistrationhandler methods confirmuserregistrationhandler example implementation confirmuserregistrationhandler methods the following are methods for confirmuserregistrationhandler. in this section: confirmuser(userid, tpalid, portalid, userdata) returns the id of the user to be logged in based on their mapping to a third-party identifier. this method is called before calling the updateuser() method. it's called only if the incoming user has previously logged in and has a third-party account link to a salesforce user. confirmuser(userid, tpalid, portalid, userdata) returns the id of the user to be logged in based on their mapping to a third-party identifier. this method is called before calling the updateuser() method. it's called only if the incoming user has previously logged in and has a third-party account link to a salesforce user. signature public id confirmuser(id userid, id tpalid, id portalid, auth.userdata userdata) 103apex reference guide confirmuserregistrationhandler interface parameters userid type: id the id of the user who is mapped to the third-party identifier via a third-party account link. tpalid type: id the third-party account link corresponding to the third-party identifier. portalid type: id the portal id the user is logging in to. if there's no portal configured, this value can be null. userdata type: auth.userdata contains user information from the third-party identity provider. return value type: id the id of the user to be logged in. if null, login fails. confirmuserregistrationhandler example implementation this example implements the auth.confirmuserregistrationhandler interface during the user update process to confirm that the correct user is logging in based on their email address and last name. global class standarduserregistrationhandler implements auth.registrationhandler, auth.confirmuserregistrationhandler { global user createuser(id portalid, auth.userdata data){ user u = new user(); profile p = [select id from profile where name='standard user']; u.username = data.username + '@salesforce.com'; u.email = data.email; u.lastname = data.lastname; u.firstname = data.firstname; string alias = data.username; if(alias.length() > 8) { alias = alias.substring(0, 8); } u.alias = alias; u.languagelocalekey" "= data.attributemap.get('language'); u.localesidkey = data.locale; u.emailencodingkey = 'utf-8'; u.timezonesidkey = 'america/los_angeles'; u.profileid = p.id; return u; } global void updateuser(id userid, id portalid, auth.userdata data) { user u = new user(id=userid); u.username = data.username + '@salesforce.com'; 104apex reference guide connectedappplugin class u.email = data.email; u.lastname = data.lastname; u.firstname = data.firstname; string alias = data.username; if(alias.length() > 8) { alias = alias.substring(0, 8); } u.alias = alias; u.languagelocalekey = data.attributemap.get('language'); u.localesidkey = data.locale; update(u); } global id confirmuser(id userid, id tpalid, id portalid, auth.userdata data) { if (data.email.contains(data.lastname)) { // looks genuine return userid; } else { // find the right user user confirmeduser = [select id from user where email=:data.email]; return confirmeduser.id; } } } the following example tests the implementation: @istest public class standarduserregistrationhandlertest { static testmethod void testconfirmuser() { standarduserregistrationhandler handler = new standarduserregistrationhandler(); auth.userdata sampledata = new auth.userdata('ida', 'firstname', 'a', 'firstname a', 'usera@example.org', null, 'usernamea', 'en_us', 'facebook', null, new map{'language' => 'en_us'}); user u = handler.createuser(null, sampledata); insert(u); string uid = u.id; sampledata = new auth.userdata('idb', 'firstname', 'b', 'firstname b', 'usera@example.org', null, 'usernameb', 'en_us', 'facebook', null, new map{}); // note that user b is using usera's email id confirmeduserid = handler.confirmuser(uid, '060xx0000004eh6', null, sampledata); system.assertequals(uid, confirmeduserid); // we should see usera's id } } connectedappplugin class contains methods for extending the behavior of a connected app, for example, customizing how a connected app is invoked depending on the protocol used. this class gives you more control over the interaction between salesforce and your connected app. namespace auth 105apex reference guide connectedappplugin class usage when you create a connected app, you specify general information about the app and settings for oauth, web apps, mobile apps, and canvas apps. to customize how the app is invoked, create a connected app handler with this connectedappplugin apex class. for example, use this class to support new authentication protocols or respond to user attributes in a way that benefits a business process. when you create a connected app handler, you also configure the connectedappplugin class to run as an execution user. the execution user authorizes access for the connected app. for example, when you use the authorize method, the execution user authorizes the connected app to access data. if you don't specify an execution user, the plug-in runs as an automated process user, which is a system user that executes tasks behind the scenes. most connectedappplugin methods require that you specify an execution user, with the exception of the customattributes method. for more information, see create a custom connected app handler. example this example authorizes the connected app user to use the connected app if the context is saml and the user has reached the quota tracked in a custom field. it returns the user’s permission set assignments. the example uses auth.invocationcontext to modify a saml assertion before it’s sent to the service provider. global class connectedapppluginexample extends auth.connectedappplugin { // authorize the app if the user has achieved quota tracked in a custom field global override boolean authorize(id userid, id connectedappid, boolean isadminapproved, auth.invocationcontext context" ") { // create a custom boolean field hasachievedquota__c on the user record // and then uncomment the block below // user u = [select id, hasachievedquota__c from user where id =: userid].get(0); // return u.hasachievedquota__c; return isadminapproved; } // call a flow during refresh global override void refresh(id userid, id connectedappid, auth.invocationcontext context) { try { map inputvariables = new map(); inputvariables.put('userid', userid); inputvariables.put('connectedappid', connectedappid); // create a custom trigger ready flow and uncomment the block below // flow.interview.mycustomflow interview = new flow.interview.mycustomflow(inputvariables); // interview.start(); } catch ( exception e ) { system.debug('flow exception:' + e); } } 106apex reference guide connectedappplugin class // return a user’s permission set assignments global override map customattributes(id userid, id connectedappid, map formuladefinedattributes, auth.invocationcontext context) { list psas = [select id, permissionset.name from permissionsetassignment where permissionset.isownedbyprofile = false and (assigneeid = :userid)]; string permsets = '['; for (permissionsetassignment psa :psas) { permsets += psa.permissionset.name + ';'; } permsets += ']'; formuladefinedattributes.put('permissionsets', permsets); return formuladefinedattributes; } } in this section: connectedappplugin methods connectedappplugin methods the following are methods for connectedappplugin. in this section: authorize(userid, connectedappid, isadminapproved) deprecated and available only in api versions 35.0 and 36.0. as of version 37.0, use authorize(userid, connectedappid, isadminapproved, context) instead. authorize(userid, connectedappid, isadminapproved, context) authorizes the specified user to access the connected app. if the connected app is set for users to self-authorize, this method isn’t invoked. customattributes(userid, connectedappid, formuladefinedattributes) deprecated and available only in api versions 35.0 and 36.0. as of version 37.0, use customattributes(userid, connectedappid, formuladefinedattributes, context) instead. customattributes(userid, connectedappid, formuladefinedattributes, context) sets new attributes for the specified user. when the connected app gets the user’s attributes from the userinfo endpoint or through a saml assertion, use this method to update the attribute values. modifysamlresponse(authsession, connectedappid, samlresponse) modifies the xml generated by the salesforce saml identity provider (idp) before it’s sent to the service provider. refresh(userid, connectedappid) deprecated and available only in api versions 35.0 and 36.0. as of version 37.0, use refresh(userid, connectedappid, context) instead. refresh(userid, connectedappid, context) salesforce calls this method during a refresh token exchange. 107apex reference guide connectedappplugin class authorize(userid, connectedappid, isadminapproved) deprecated and available only in api versions 35.0 and 36.0. as of version 37.0, use authorize(userid, connectedappid, isadminapproved, context) instead. signature public boolean authorize(id userid, id connectedappid, boolean isadminapproved) parameters userid type: id the 15-character id of the user attempting to use the connected app. connectedappid type: string the 15-character id of the connected app. isadminapproved type: boolean the approval state of the specified user when the connected app requires approval. return value type: boolean if the connected app requires admin approval, a returned value of true indicates that the current user is approved" ". authorize(userid, connectedappid, isadminapproved, context) authorizes the specified user to access the connected app. if the connected app is set for users to self-authorize, this method isn’t invoked. signature public boolean authorize(id userid, id connectedappid, boolean isadminapproved, auth.invocationcontext context) parameters userid type: id the 15-character id of the user attempting to use the connected app. connectedappid type: id the 15-character id of the connected app. isadminapproved type: boolean the approval state of the specified user when the connected app requires approval. 108apex reference guide connectedappplugin class context type: invocationcontext the context in which the connected app is invoked. return value type: boolean if the connected app requires admin approval, a returned value of true indicates that the user is approved. usage connectedappplugin runs on behalf of the current user. but the user must have permission to use the connected app for the plug-in to work. use this method to authorize the user. customattributes(userid, connectedappid, formuladefinedattributes) deprecated and available only in api versions 35.0 and 36.0. as of version 37.0, use customattributes(userid, connectedappid, formuladefinedattributes, context) instead. signature public map customattributes(id userid, id connectedappid, map formuladefinedattributes,) parameters userid type: id the 15-character id of the user attempting to use the connected app. connectedappid type: id the 15-character id of the connected app. formuladefinedattributes type: map a map of the new set of attributes from the userinfo endpoint (oauth) or from a saml assertion. for more information, see the userinfo endpoint in the online help. return value type: map a map of the updated set of attributes. customattributes(userid, connectedappid, formuladefinedattributes, context) sets new attributes for the specified user. when the connected app gets the user’s attributes from the userinfo endpoint or through a saml assertion, use this method to update the attribute values. 109apex reference guide connectedappplugin class signature public map customattributes(id userid, id connectedappid, map formuladefinedattributes, auth.invocationcontext context) parameters userid type: id the 15-character id of the user attempting to use the connected app. connectedappid type: id the 15-character id for the connected app. formuladefinedattributes type: map a map of the current set of attributes from the userinfo endpoint (oauth) or from a saml assertion. for more information, see the userinfo endpoint in the online help. type: invocationcontext the context in which the connected app is invoked. return value type: map a map of the updated set of attributes. modifysamlresponse(authsession, connectedappid, samlresponse) modifies the xml generated by the salesforce saml identity provider (idp) before it’s sent to the service provider. signature public dom.xmlnode modifysamlresponse(map authsession, id connectedappid, dom.xmlnode samlresponse) parameters authsession type: map the attributes for the authorized user’s session. the map includes the 15-character id of the authorized user who’s accessing the connected app. connectedappid type: id the 15-character id of the connected app. samlresponse type: dom.xmlnode contains the saml xml response generated by the idp. 110apex reference guide connectedappplugin class return value type: dom.xmlnode returns an instance of dom.xmlnode containing the modified saml xml response. usage use this method to modify the xml saml response to perform an action based on the context of the saml request before it’s verified, signed, and sent to the target service provider. this method enables developers to extend the connected app plug-in to meet their specific needs. the developer assumes full responsibility for changes made within the connected app plug-" "in. the plug-in must include validation and error handling. if the plug-in throws an exception, catch it, log it, and stop the process. don’t send anything to the target service provider. refresh(userid, connectedappid) deprecated and available only in api versions 35.0 and 36.0. as of version 37.0, use refresh(userid, connectedappid, context) instead. signature public void refresh(id userid, id connectedappid) parameters userid type: id the 15-character id of the user requesting the refresh token. connectedappid type: id the 15-character id of the connected app. return value type: void refresh(userid, connectedappid, context) salesforce calls this method during a refresh token exchange. signature public void refresh(id userid, id connectedappid, auth.invocationcontext context) parameters userid type: id the 15-character id of the user requesting the refresh token. 111apex reference guide headlessselfregistrationhandler interface connectedappid type: id the 15-character id of the connected app. context type: invocationcontext the context in which the connected app is invoked. return value type: void headlessselfregistrationhandler interface creates customer and partner users during the headless registration flow. namespace auth usage the headless registration flow allows you to control user registration experience in a third-party app while using salesforce to authenticate users and manage their data access. when you set up this flow, add users in the class that is implementing the auth.headlessselfregistrationhandler interface. this class runs after the user verifies their identity. for a detailed explanation of headless registration, see headless registration flow for private clients or headless registration flow for public clients, depending on your app type. in this section: headlessselfregistrationhandler methods the following are methods for headlessselfregistrationhandler. headlessselfregistrationhandler example implementation this example class implements the auth.headlessselfregistrationhandler interface. the class creates a user based on information that your app sends to headless registration api. it associates the user with the default profile for new users, which you configure in your experience cloud settings. it also creates a contact for the user and assigns it to an account. headlessselfregistrationhandler methods the following are methods for headlessselfregistrationhandler. in this section: createuser(profileid, data, customuserdatamap, experienceid, password) returns a user object using information submitted by your third-party app to headless registration api. 112apex reference guide headlessselfregistrationhandler interface createuser(profileid, data, customuserdatamap, experienceid, password) returns a user object using information submitted by your third-party app to headless registration api. signature public user createuser(id profileid, auth.userdata data, string customuserdatamap, string experienceid, string password) parameters profileid type: id the id of the profile that is assigned to new users. data type: auth.userdata a class that stores information about the user, such as their name and locale. customuserdatamap type: string a string representation of a json object containing custom user information passed in during registration. we recommend that you deserialize this string into the equivalent apex class structure. determine what custom information to collect when you build your app’s registration experience. experienceid type: string the experience cloud site id. password type: string the user password. return value type: user headlessselfregistrationhandler example implementation this example class implements the auth.headlessselfregistrationhandler interface. the class creates a user based on information that your app sends to headless registration api. it associates the user with the default profile for new users, which you configure in your experience cloud settings. it also creates a contact for the user and assigns it to an account. global class exampleheadlessreg implements auth.headlessselfregistrationhandler { global user createuser(id profileid, auth.userdata data, string customuserdatamap, string experienceid, string password){ user u = new user(); u.profileid = profileid; u = handleunsetrequiredfields(u); u.email = data.email; 113apex reference guide invocationcontext enum account a; list accounts = [select id from account where name=:social_account]; if(accounts" ".isempty()) { a = new account(name = social_account); insert(a); }else a = accounts[0]; generatecontact(u, a.id); u.languagelocalekey = userinfo.getlocale(); u.localesidkey = userinfo.getlocale(); u.emailencodingkey = 'utf-8'; u.timezonesidkey = userinfo.gettimezone().getid(); return u; } private user handleunsetrequiredfields(user u) { return u; } // method to construct a contact for a user private void generatecontact(user u, id accountid) { // add logic here to build your own contact for the user contact c = new contact(); c.accountid = accountid; c.firstname = u.firstname; c.lastname = u.lastname; insert(c); u.contactid = c.id; } // default implementation to try to provide uniqueness private string generatealias() { string timestring = string.valueof(current_time); return timestring.substring(timestring.length() - 8); } } invocationcontext enum the context in which the connected app is invoked, such as the protocol flow used and the token type issued, if any. developers can use the context information to write code that is unique to the type of invocation. enum values the following are the values of the auth.invocationcontext enum. value description asset_token reserved for future use. 114apex reference guide jws class value description oauth1 context used when authentication is through an oauth 1.0a flow. oauth2_jwt_bearer_token context used when authentication is through a json-based web token (jwt) bearer token flow. oauth2_saml_assertion context used when authentication is through an oauth 2.0 saml assertion flow. oauth2_saml_bearer_assertion context used when authentication is through an oauth 2.0 saml bearer assertion flow. oauth2_username_password context used when authentication is through an oauth 2.0 username-password flow. oauth2_user_agent_id_token context used when issuing an id token through an oauth 2.0 user-agent flow. oauth2_user_agent_token context used when authentication is through an oauth 2.0 user agent flow. oauth2_web_server context used when authentication is through a web server authentication flow. openidconnect context used when authentication is through an openid connect authentication flow. refresh_token context used when renewing tokens issued by a web server or user-agent flow. saml_assertion context used when authentication is through a saml assertion flow. unknown context is unknown. userid_endpoint context used when issuing an access token through a userinfo endpoint. see also: salesforce help: authenticating apps with oauth jws class contains methods that apply a digital signature to a json web token (jwt), using a json web signature (jws) data structure. this class creates the signed jwt bearer token, which can be used to request an oauth access token in the oauth 2.0 jwt bearer token flow. namespace auth usage use the methods in this class to sign the jwt bearer token with the x509 certificate. in this section: jws constructors jws methods 115apex reference guide jws class jws constructors the following are constructors for jws. in this section: jws(jwt, certdevname) creates an instance of the jws class using the specified auth.jwt payload and the certificate used for signing the jwt bearer token. jws(payload, certdevname) creates an instance of the jws class using the specified payload and certificate used for signing the jwt bearer token. jws(jwt, certdevname) creates an instance of the jws class using the specified auth.jwt payload and the certificate used for signing the jwt bearer token. signature public jws(auth.jwt jwt, string certdevname) parameters jwt type: auth.jwt the base64-encoded json claims set in the jwt bearer token generated by auth.jwt." "certdevname type: string the unique name for a certificate stored in the salesforce org’s certificate and key management page to use for signing the jwt bearer token. usage calls the tojsonstring() method in auth.jwt and sets the resulting string as the payload of the jwt bearer token. alternatively, you can specify the payload directly using jws(payload, certdevname). jws(payload, certdevname) creates an instance of the jws class using the specified payload and certificate used for signing the jwt bearer token. signature public jws(string payload, string certdevname) parameters payload type: string the base64-encoded json claims set in the jwt bearer token. 116apex reference guide jws class certdevname type: string the unique name for a certificate stored in the salesforce org’s certificate and key management page to use for signing the jwt bearer token. usage sets the payload string as the payload of the jwt bearer token. alternatively, if you generate the payload using auth.jwt, you can use jws(jwt, certdevname) instead. jws methods the following are methods for jws. all are instance methods. in this section: clone() makes a duplicate copy of the jws object. getcompactserialization() returns the compact serialization representation of the jws as a concatenated string, with the encoded jws header, encoded jws payload, and encoded jws signature strings separated by period ('.') characters. clone() makes a duplicate copy of the jws object. signature public object clone() return value type: jws getcompactserialization() returns the compact serialization representation of the jws as a concatenated string, with the encoded jws header, encoded jws payload, and encoded jws signature strings separated by period ('.') characters. signature public string getcompactserialization() return value type: string 117apex reference guide jwt class jwt class generates the json claims set in a json web token (jwt). the resulting base64-encoded payload can be passed as an argument to create an instance of the auth.jws class. namespace auth usage use the methods in this class to generate the payload in a jwt bearer token. in this section: jwt methods jwt methods the following are methods for jwt. all are instance methods. in this section: clone() makes a duplicate copy of the jwt object. getadditionalclaims() returns a map of additional claims in the jwt, where the key string contains the name of the claim, and the value contains the value of the claim. getaud() returns the audience claim that identifies the intended recipients of the jwt. getiss() returns the issuer claim that identifies the issuer of the jwt. getnbfclockskew() returns the not before claim that identifies the time before which the jwt must not be accepted for processing, while allowing some leeway for clock skew. getsub() returns the subject claim that identifies the current user of the jwt. getvaliditylength() returns the length of time (in seconds) that the jwt is valid, which affects the expiration claim. setadditionalclaims(additionalclaims) sets the additional claims in the jwt. returned by the getadditionalclaims() method. setaud(aud) sets the audience claim in the jwt. returned by the getaud() method. setiss(iss) sets the issuer claim in the jwt. returned by the getiss() method. 118apex reference guide jwt class setnbfclockskew(nbfclockskew) sets the not before claim in the jwt. returned by the getnbfclockskew() method. setsub(sub) sets the subject claim in the jwt. returned by the getsub() method. setvaliditylength(validitylength) sets the length of time (in seconds) that the jwt is valid, which affects the expiration claim. returned by the getvaliditylength() method. tojsonstring() generates the json object representation of the claims set as an encoded jwt payload. clone() makes a duplicate copy of the jwt object. signature public object clone() return value type: jwt getadditionalclaims() returns a map" "of additional claims in the jwt, where the key string contains the name of the claim, and the value contains the value of the claim. signature public map getadditionalclaims() return value type: map getaud() returns the audience claim that identifies the intended recipients of the jwt. signature public string getaud() return value type: string 119apex reference guide jwt class getiss() returns the issuer claim that identifies the issuer of the jwt. signature public string getiss() return value type: string getnbfclockskew() returns the not before claim that identifies the time before which the jwt must not be accepted for processing, while allowing some leeway for clock skew. signature public integer getnbfclockskew() return value type: integer getsub() returns the subject claim that identifies the current user of the jwt. signature public string getsub() return value type: string getvaliditylength() returns the length of time (in seconds) that the jwt is valid, which affects the expiration claim. signature public integer getvaliditylength() return value type: integer 120apex reference guide jwt class setadditionalclaims(additionalclaims) sets the additional claims in the jwt. returned by the getadditionalclaims() method. signature public void setadditionalclaims(map additionalclaims) parameters additionalclaims type: map return value type: void usage additional claims must not include any standard claims. setaud(aud) sets the audience claim in the jwt. returned by the getaud() method. signature public void setaud(string aud) parameters aud type: string return value type: void setiss(iss) sets the issuer claim in the jwt. returned by the getiss() method. signature public void setiss(string iss) parameters iss type: string 121apex reference guide jwt class return value type: void setnbfclockskew(nbfclockskew) sets the not before claim in the jwt. returned by the getnbfclockskew() method. signature public void setnbfclockskew(integer nbfclockskew) parameters nbfclockskew type: integer return value type: void setsub(sub) sets the subject claim in the jwt. returned by the getsub() method. signature public void setsub(string sub) parameters sub type: string return value type: void setvaliditylength(validitylength) sets the length of time (in seconds) that the jwt is valid, which affects the expiration claim. returned by the getvaliditylength() method. signature public void setvaliditylength(integer validitylength) parameters validitylength type: integer 122apex reference guide jwtbearertokenexchange class return value type: void tojsonstring() generates the json object representation of the claims set as an encoded jwt payload. signature public string tojsonstring() return value type: string jwtbearertokenexchange class contains methods that post the signed jwt bearer token to a token endpoint to request an access token, in the oauth 2.0 jwt bearer token flow. namespace auth usage use the methods in this class to post a signed jwt bearer token to the oauth token endpoint, in exchange for an access token. example in the following example application, the apex controller: 1. creates the json claims set. 2. specifies the scope of the request with additional claims. 3. creates the signed jwt. 4. specifies the token endpoint and posts to it. 5. gets the access token from the http response. public class mycontroller{ public mycontroller() { auth.jwt jwt = new auth.jwt(); jwt.setsub('user@salesforce.com'); jwt.setaud('https://login.salesforce.com'); jwt.setiss('3mvg99oxtyemcq3gnp2pjkqezkxnmaig1xv4ohh9akl_rsk.bosv" "pgzhq ukxnvjzrgsuqqgn75nl7yfkqcyy7'); //additional claims to set scope 123apex reference guide jwtbearertokenexchange class map claims = new map(); claims.put('scope', 'scope name'); jwt.setadditionalclaims(claims); //create the object that signs the jwt bearer token auth.jws jws = new auth.jws(jwt, 'certfromcertkeymanagement'); //get the resulting jws in case debugging is required string token = jws.getcompactserialization(); //set the token endpoint that the jwt bearer token is posted to string tokenendpoint = 'https://login.salesforce.com/services/oauth2/token'; //post the jwt bearer token auth.jwtbearertokenexchange bearer = new auth.jwtbearertokenexchange(tokenendpoint, jws); //get the access token string accesstoken = bearer.getaccesstoken(); } } in this section: jwtbearertokenexchange constructors jwtbearertokenexchange methods jwtbearertokenexchange constructors the following are constructors for jwtbearertokenexchange. in this section: jwtbearertokenexchange(tokenendpoint, jws) creates an instance of the jwtbearertokenexchange class using the specified token endpoint and the signed jwt bearer token. jwtbearertokenexchange() creates an instance of the auth.jwtbearertokenexchange class. jwtbearertokenexchange(tokenendpoint, jws) creates an instance of the jwtbearertokenexchange class using the specified token endpoint and the signed jwt bearer token. signature public jwtbearertokenexchange(string tokenendpoint, auth.jws jws) 124apex reference guide jwtbearertokenexchange class parameters tokenendpoint type: string the token endpoint that the signed jwt bearer token is posted to. jws type: auth.jws the signed jwt bearer token. jwtbearertokenexchange() creates an instance of the auth.jwtbearertokenexchange class. signature public jwtbearertokenexchange() jwtbearertokenexchange methods the following are methods for jwtbearertokenexchange. all are instance methods. in this section: clone() makes a duplicate copy of the jwtbearertokenexchange object. getaccesstoken() returns the access_token in the token response to the jwt bearer token request. getgranttype() returns the grant type specified in the jwt bearer token request. the grant type value defaults to urn:ietf:params:oauth:grant-type:jwt-bearer. gethttpresponse() returns the full system.httpresponse token response to the jwt bearer token request. getjws() returns the jws specified in the jwt bearer token request. gettokenendpoint() returns the token endpoint that the jwt bearer token request is posted to. setgranttype(granttype) sets the grant type in the jwt bearer token request. returned by the getgranttype() method. setjws(jws) sets the jws in the jwt bearer token request. returned by the getjws() method. settokenendpoint(tokenendpoint) sets the token endpoint that the jwt bearer token request is posted to. returned by the gettokenendpoint() method. 125apex reference guide jwtbearertokenexchange class clone() makes a duplicate copy of the jwtbearertokenexchange object. signature public object clone() return value type: jwtbearertokenexchange getaccesstoken() returns the access_token in the token response to the jwt bearer token request. signature public string getaccesstoken() return value type: string usage this method extracts the access_token from the token response. if the token response issues the access token in a different parameter, the request fails. if you want the full http token response returned, use gethttpresponse instead. getgranttype() returns the grant type specified in the jwt bearer token request. the grant type value defaults to urn:ietf:params:oauth:grant-type:j" "wt-bearer. signature public string getgranttype() return value type: string gethttpresponse() returns the full system.httpresponse token response to the jwt bearer token request. signature public system.httpresponse gethttpresponse() 126apex reference guide jwtbearertokenexchange class return value type: system.httpresponse usage you can get the access token from the full system.httpresponse. if you want only the access_token from the token response, you can use getaccesstoken instead. getjws() returns the jws specified in the jwt bearer token request. signature public auth.jws getjws() return value type: auth.jws gettokenendpoint() returns the token endpoint that the jwt bearer token request is posted to. signature public string gettokenendpoint() return value type: string setgranttype(granttype) sets the grant type in the jwt bearer token request. returned by the getgranttype() method. signature public void setgranttype(string granttype) parameters granttype type: string return value type: void 127apex reference guide lightninglogineligibility enum setjws(jws) sets the jws in the jwt bearer token request. returned by the getjws() method. signature public void setjws(auth.jws jws) parameters jws type: auth.jws return value type: void settokenendpoint(tokenendpoint) sets the token endpoint that the jwt bearer token request is posted to. returned by the gettokenendpoint() method. signature public void settokenendpoint(string tokenendpoint) parameters tokenendpoint type: string return value type: void lightninglogineligibility enum contains a lightning login eligibility value used by the auth.sessionmanagement.getlightninglogineligibility method. usage if you use the discovery page type, users can verify themselves with lightning login. lightning login lets internal users log in with salesforce authenticator instead of a password. certain conditions must be met for lightning login to succeed. call auth.sessionmanagement.getlightninglogineligibility before or after a login attempt to get the eligibility status. you can call after a login attempt to determine why the login attempt failed. enum values the following are the values of the auth.lightninglogineligibility enum. 128apex reference guide logindiscoveryhandler interface value description eligible all eligibility conditions are met. the admin has enabled salesforce authenticator and lightning login, assigned the user lightning login user permission, and selected allow only for users with the lightning login user permission from the session settings setup page. the user has set up salesforce authenticator and enrolled in lightning login. org_authenticator_not_enabled the admin hasn’t enabled salesforce authenticator. org_pref_not_enabled the admin hasn’t enabled lightning login. the admin must select allow lightning login from the session settings setup page. user_authenticator_not_connected the user hasn’t set up salesforce authenticator. user_not_allowed the admin hasn’t granted the user allowlightninglogin user permission. allowing lightning login to certain users requires the onlyllpermuserallowed org preference. admins must select allow only for users with the lightning login user permission from the session settings setup page. user_not_enrolled the user hasn’t enrolled in lightning login. user_perm_not_enabled the admin hasn’t granted the user the lightning login eligible user permission. logindiscoveryhandler interface salesforce gives you the ability to log in users based on other verification methods than username and password. for example, it can prompt users to log in with their email, phone number, or another identifier like a federation id or device identifier. login discovery is available to these licenses: customer community, customer community plus, external identity, partner community, and partner community plus. namespace auth usage implement a auth.logindiscoveryhandler for an interview-based log in. the handler looks up a user from the identifier entered, and can call site.passwordlesslogin to determine which credential to use, such as email or sms. or the handler can redirect a user to a third-party identity provider for login. with this" "handler, the login page doesn't show a password field. however, you can use site.passwordlesslogin to then prompt for a password. from the user perspective, the user enters an identifier at the log in prompt. then the user completes the login by entering a pin or password. or, if sso-enabled, the user bypasses login. for an example, see logindiscoveryhandler example implementation. for more details, see salesforce customer identity in salesforce help. in this section: logindiscoveryhandler method logindiscoveryhandler example implementation 129apex reference guide logindiscoveryhandler interface logindiscoveryhandler method here’s the method for logindiscoveryhandler. in this section: login(identifier, starturl, requestattributes) log in the customer or partner given the specified identifier, such as email or phone number. if successful, redirect the user to the experience cloud site page specified by the start url. login(identifier, starturl, requestattributes) log in the customer or partner given the specified identifier, such as email or phone number. if successful, redirect the user to the experience cloud site page specified by the start url. signature public system.pagereference login(string identifier, string starturl, maprequestattributes) parameters identifier type: string identifier the customer or partner entered at the login prompt, for example, an email address or phone number. starturl type: string path to the experience cloud site page requested by the customer or partner. the user is redirected to this location after successful login. requestattributes type: map information about the login request based on the user’s browser state when accessing the login page. requestattributes passes in the communityurl, ipaddress, useragent, platform, application, city, country, and subdivision values. the city, country, and subdivision values come from ip geolocation. return value type: system.pagereference the url of the page where the user is redirected. example here’s a sample requestattributes response. communityurl=http://my-developer-edition.mycompany.com:5555/discover ipaddress=55.555.0.0 useragent=mozilla/5.0 (macintosh; intel mac os x 10_13_4) applewebkit/605.1.15 (khtml, like gecko) version/11.1 safari/605.1.15 platform=mac osx 130apex reference guide logindiscoveryhandler interface application=browser city=san mateo country=united states subdivision=california logindiscoveryhandler example implementation this apex code example implements the auth.logindiscoveryhandler interface. it checks whether the user who is logging in has a verified email or phone number, depending on which identifier was supplied on the login page. if verified, with auth.verificationmethod.email or auth.verificationmethod.sms, we send a challenge to the identifier, either the user’s email address or mobile device. if the user enters the code correctly on the verify page, the user is redirected to the experience cloud site’s page specified by the start url. if the user isn’t verified, the user must enter a password to log in. the handler also checks that the email and phone number are unique with this code: users.size()==1. note: passwordless login works only with verified methods. you can check the verification status on the user object, for example, with user list view, a report, or the api. make sure that your solution handles the case where the user doesn’t have a verification method. this code example falls back to a password. the default discoverable login handler checks whether the user entered a valid email address or phone number before redirecting the user to the verification page. if an invalid entry is made, the handler returns an error. because this behavior is vulnerable to user enumeration attack, make sure that your solution prevents this attack. for example, you can create a dummy page similar to the verification page and redirect the user to the dummy page when invalid user identifier is entered. also, use generic error messages to avoid providing additional information. the discoveryresult function calls the site.passwordlesslogin method to log the user in with the specified verification method. the getssoredirect function looks up whether the user logs in with saml or an auth provider. add the implementation-specific logic to handle the lookup. global class autocreateddiscloginhandler1535377170343 implements auth.logindiscoveryhandler { global" "pagereference login(string identifier, string starturl, map requestattributes) { if (identifier != null && isvalidemail(identifier)) { // search for user by email. list users = [select id from user where email = :identifier and isactive = true]; if (!users.isempty() && users.size() == 1) { // user must have a verified email before using this verification method. // we cannot send messages to unverified emails. // you can check if the user's email verified bit set and add the // password verification method as fallback. list verifiedinfo = [select hasuserverifiedemailaddress from twofactormethodsinfo where userid = :users[0].id]; if (!verifiedinfo.isempty() && verifiedinfo[0].hasuserverifiedemailaddress == true) { // use email verification method if the user's email is verified. return discoveryresult(users[0], auth.verificationmethod.email, starturl, requestattributes); } else { // use password verification method as fallback // if the user's email is unverified. return discoveryresult(users[0], auth.verificationmethod.password, starturl, 131apex reference guide logindiscoveryhandler interface requestattributes); } } else { throw new auth.logindiscoveryexception('no unique user found. user count=' + users.size()); } } if (identifier != null) { string formattedsms = getformattedsms(identifier); if (formattedsms != null) { // search for user by sms. list users = [select id from user where mobilephone = :formattedsms and isactive = true]; if (!users.isempty() && users.size() == 1) { // user must have a verified sms before using this verification method. // we cannot send messages to unverified mobile numbers. // you can check if the user's mobile verified bit is set or add // the password verification method as fallback. list verifiedinfo = [select hasuserverifiedmobilenumber from twofactormethodsinfo where userid = :users[0].id]; if (!verifiedinfo.isempty() && verifiedinfo[0].hasuserverifiedmobilenumber == true) { // use sms verification method if the user's mobile number is verified. return discoveryresult(users[0], auth.verificationmethod.sms, starturl, requestattributes); } else { // use password verification method as fallback if the user's // mobile number is unverified. return discoveryresult(users[0], auth.verificationmethod.password, starturl, requestattributes); } } else { throw new auth.logindiscoveryexception('no unique user found. user count=' + users.size()); } } } if (identifier != null) { // you can customize the code to find user via other attributes, // such as ssn or federation id. } throw new auth.logindiscoveryexception('invalid identifier'); } private boolean isvalidemail(string identifier) { string emailregex = '^[a-za-z0-9._|\\\\%#~`=?&/$^*!}{+-]+@[a-za-z0-9.-]+\\.[a-za-z]{2,4}$'; // source: https://www.regular-expressions.info/email.html pattern emailpattern = pattern.compile(emailregex); matcher emailmatcher = emailpattern.matcher(identifier); if (emailmatcher.matches()) { return true; } else { return false; } } private string getformattedsms(string identifier) { 132" "apex reference guide logindiscoveryhandler interface // accept sms input formats with 1- or 2-digit country code, // 3-digit area code, and 7-digit number. // you can customize the sms regex to allow different formats. string smsregex = '^(\\+?\\d{1,2}?[\\s-])?(\\(?\\d{3}\\)?[\\s-]?\\d{3}[\\s-]?\\d{4})$'; pattern smspattern = pattern.compile(smsregex); matcher smsmatcher = smspattern.matcher(identifier); if (smsmatcher.matches()) { try { // format user input into the verified sms format '+xx xxxxxxxxxx' // before db lookup. if no country code is provided, append // us country code +1 for the default. string countrycode = smsmatcher.group(1) == null ? '+1' : smsmatcher.group(1); return system.usermanagement.formatphonenumber(countrycode, smsmatcher.group(2)); } catch(system.invalidparametervalueexception e) { return null; } } else { return null; } } private pagereference getssoredirect(user user, string starturl, map requestattributes) { // you can look up to check whether the user should log in with // saml or an auth provider and return the url to initialize sso. return null; } private pagereference discoveryresult(user user, auth.verificationmethod method, string starturl, map requestattributes) { // only users with an external identity or community license can log in // using site.passwordlesslogin. use getssoredirect to let your org employees // log in to an experience cloud site. pagereference ssoredirect = getssoredirect(user, starturl, requestattributes); if (ssoredirect != null) { return ssoredirect; } else { if (method != null) { list methods = new list(); methods.add(method); pagereference pwdlessredirect = site.passwordlesslogin(user.id, methods, starturl); if (pwdlessredirect != null) { return pwdlessredirect; } else { throw new auth.logindiscoveryexception('no passwordless login redirect url returned for verification method: ' + method); } } else { throw new auth.logindiscoveryexception('no method found'); } } } } 133apex reference guide logindiscoveryhandler interface code example: filter login discovery users by profile your production org can have multiple users with the same verified email address and mobile number. but your customers must have unique ones. to address this problem, you can add a few lines of code that filters users by profile to ensure uniqueness. this code example handles users with the external identity user profile, but can be adapted to support other use cases. for example, you can modify the first line of code to address users with other user licenses or criteria. login discovery is available with the following user licenses: customer community, customer community plus, external identity, partner community, and partner community plus. it depends on which profiles have access to your experience cloud site. global class autocreateddiscloginhandler1551301979709 implements auth.logindiscoveryhandler { global pagereference login(string identifier, string starturl, map requestattributes) { if (identifier != null && isvalidemail(identifier)) { // ensure uniqueness by profile profile p = [select id from profile where name = 'external identity user']; list users = [select id from user where email = :identifier and isactive = true and profileid=:p.id]; if (!users.isempty() && users.size() == 1) { // user must have verified email before using this verification method. we cannot send messages to unverified emails. // you can check if the user has email verified bit on and add the password verification method as fallback. list verifiedinfo = [select hasuserverifiedemailaddress from twofactormethodsinfo where userid = :users[0].id]; if (!verifiedinfo.isempty() && verifiedinfo[0].hasuserverifiedemailaddress == true) {" "// use email verification method if the user's email is verified. return discoveryresult(users[0], auth.verificationmethod.email, starturl, requestattributes); } else { // use password verification method as fallback if the user's email is unverified. return discoveryresult(users[0], auth.verificationmethod.password, starturl, requestattributes); } } else { throw new auth.logindiscoveryexception('no unique user found. user count=' + users.size()); } } if (identifier != null) { string formattedsms = getformattedsms(identifier); if (formattedsms != null) { // ensure uniqueness by profile profile p = [select id from profile where name = 'external identity user']; list users = [select id from user where mobilephone = :formattedsms and isactive = true and profileid=:p.id]; if (!users.isempty() && users.size() == 1) { // user must have verified sms before using this verification method. we cannot send messages to unverified mobile numbers. // you can check if the user has mobile verified bit on or add the password verification method as fallback. 134apex reference guide logindiscoveryhandler interface list verifiedinfo = [select hasuserverifiedmobilenumber from twofactormethodsinfo where userid = :users[0].id]; if (!verifiedinfo.isempty() && verifiedinfo[0].hasuserverifiedmobilenumber == true) { // use sms verification method if the user's mobile number is verified. return discoveryresult(users[0], auth.verificationmethod.sms, starturl, requestattributes); } else { // use password verification method as fallback if the user's mobile number is unverified. return discoveryresult(users[0], auth.verificationmethod.password, starturl, requestattributes); } } else { throw new auth.logindiscoveryexception('no unique user found. user count=' + users.size()); } } } if (identifier != null) { // you can customize the code to find user via other attributes, such as ssn or federation id } throw new auth.logindiscoveryexception('invalid identifier'); } private boolean isvalidemail(string identifier) { string emailregex = '^[a-za-z0-9._|\\\\%#~`=?&/$^*!}{+-]+@[a-za-z0-9.-]+\\.[a-za-z]{2,4}$'; // source: https://www.regular-expressions.info/email.html pattern emailpattern = pattern.compile(emailregex); matcher emailmatcher = emailpattern.matcher(identifier); if (emailmatcher.matches()) { return true; } else { return false; } } private string getformattedsms(string identifier) { // accept sms input formats with 1 or 2 digits country code, 3 digits area code and 7 digits number // you can customize the sms regex to allow different formats string smsregex = '^(\\+?\\d{1,2}?[\\s-])?(\\(?\\d{3}\\)?[\\s-]?\\d{3}[\\s-]?\\d{4})$'; pattern smspattern = pattern.compile(smsregex); matcher smsmatcher = smspattern.matcher(identifier); if (smsmatcher.matches()) { try { // format user input into the verified sms format '+xx xxxxxxxxxx' before db lookup // append us country code +1 by default if no country code is provided string countrycode = smsmatcher.group(1) == null ? '+1' : smsmatcher.group(1); return system.usermanagement.formatphonenumber(countrycode, smsmatcher.group(2)); 135apex reference guide logindiscoverymethod enum } catch(system.invalidparametervalueexception e) { return null; } } else { return null; } } private pagereference getssoredirect(user user, string starturl, map requestattributes) { // you can look up if the user should log in with saml or an auth provider" "and return the url to initialize sso. return null; } private pagereference discoveryresult(user user, auth.verificationmethod method, string starturl, map requestattributes) { //only users with an external identity or community license can login using site.passwordlesslogin //use getssoredirect to enable your org employees to log in to an experience cloud site pagereference ssoredirect = getssoredirect(user, starturl, requestattributes); if (ssoredirect != null) { return ssoredirect; } else { if (method != null) { list methods = new list(); methods.add(method); pagereference pwdlessredirect = site.passwordlesslogin(user.id, methods, starturl); if (pwdlessredirect != null) { return pwdlessredirect; } else { throw new auth.logindiscoveryexception('no passwordless login redirect url returned for verification method: ' + method); } } else { throw new auth.logindiscoveryexception('no method found'); } } } } logindiscoverymethod enum contains methods used to verify the user’s identity when the my domain login process uses login discovery. usage specifies the verification method used to authenticate internal users when my domain is set up for login discovery. enum values auth.logindiscoverymethod enum has the following values. 136apex reference guide mydomainlogindiscoveryhandler interface value description lightning_login verify identity by lightning login, which lets internal users log in with salesforce authenticator. password verify identity by entering a password. mydomainlogindiscoveryhandler interface the handler used to implement the my domain login discovery page, which is an interview-based (two-step) login process. first the user is prompted for a unique identifier such as an email address or phone number. then the handler determines (discovers) how to authenticate the user. either the user enters a password or is directed to an identity provider’s login page. namespace auth usage implement mydomainlogindiscoveryhandler to let my domain users log in with something other than their username and password. this handler contains the logic to look up the user based on the identifier value entered on the login page. the auth.mydomainlogindiscoveryhandler.login method is invoked when the identifier page is submitted and finds the user that corresponds to the submitted identifier. the auth.sessionmanagement.finishlogindiscovery method sends the user to the authentication mechanism and then logs in the user. register the handler from the my domain setup page. under authentication configuration, select the discovery login page type. for login discovery handler, select this handler from the list of apex classes. for an example, see mydomainlogindiscoveryhandler example implementation. for more details, search for my domain login discovery in salesforce help. in this section: mydomainlogindiscoveryhandler method mydomainlogindiscoveryhandler example implementation mydomainlogindiscoveryhandler method mydomainlogindiscoveryhandler has the following method. in this section: login(identifier, starturl, requestattributes) log in a salesforce user given the specified identifier, such as email or phone number. if successful, redirect the user to the page specified by the start url. 137apex reference guide mydomainlogindiscoveryhandler interface login(identifier, starturl, requestattributes) log in a salesforce user given the specified identifier, such as email or phone number. if successful, redirect the user to the page specified by the start url. signature public system.pagereference login(string identifier, string starturl, map requestattributes) parameters identifier type: string identifier the salesforce user entered at the login prompt, for example, an email address or phone number. starturl type: string the page users see after successfully logging in to the my domain subdomain. requestattributes type: map information about the login request based on the user’s browser state when accessing the login page. requestattributes passes in the mydomainurl, ipaddress, useragent, platform, application, city, country, and subdivision values. the city, country, and subdivision values come from ip address geolocation. return value type: system.pagereference the url of the page where the user is redirected to complete authentication. example here’s" "a sample requestattributes response. communityurl=http://my-dev-ed.my.salesforce.com:5555/discover ipaddress=55.255.0.0 useragent=mozilla/5.0 (macintosh; intel mac os x 10_13_4) applewebkit/605.1.15 (khtml, like gecko) version/11.1 safari/605.1.15 platform=mac osx application=browser city=san mateo country=united states subdivision=california mydomainlogindiscoveryhandler example implementation here's an example of the auth.mydomainlogindiscoveryhandler interface. this sample class contains the default logic for my domain login discovery using password authentication. you can customize the code to ensure it meets your needs. the requestattributes parameter provides additional information that you can use in the discovery logic. attributes include mydomainurl, 138apex reference guide mydomainlogindiscoveryhandler interface ipaddress, useragent, and location information (such as country and city). use auth.discoverycustomerrorexception to throw custom errors to display on the login page. to implement this interface, the my domain login page type must be set to discovery. // this sample class contains the default logic for my domain login discovery by password. // you can customize the code to ensure it meets your needs. the requestattributes parameter // provides additional information you can use in the discovery logic. attributes include mydomainurl, // ipaddress, useragent, and location information (such as country and city). // use auth.discoverycustomerrorexception to throw custom errors which will be shown on login page. global class mydomaindisclogindefaulthandler implements auth.mydomainlogindiscoveryhandler { global pagereference login(string identifier, string starturl, map requestattributes) { if (identifier != null) { // search for user by email list users = [select id from user where email = :identifier and isactive = true]; if (!users.isempty() && users.size() == 1) { return discoveryresult(users[0], starturl, requestattributes); } else { throw new auth.logindiscoveryexception('no unique user found. user count=' + users.size()); } } throw new auth.logindiscoveryexception('invalid identifier'); } private pagereference getssoredirect(user user, string starturl, map requestattributes) { //youcanlookupiftheusershouldloginwithsamloranauthproviderandreturntheurltoinitializesso.forexample: // samlssoconfig sso = [select id from samlssoconfig where developername='samltest' limit 1]; // to get the url for a my domain subdomain, you can pass null in the communityurl parameter. // string ssourl = auth.authconfiguration.getsamlssourl(null, starturl, sso.id); // return new pagereference(ssourl); return null; } private pagereference discoveryresult(user user, string starturl, map requestattributes) { pagereference ssoredirect = getssoredirect(user, starturl, requestattributes); if (ssoredirect != null) { return ssoredirect; } else { return auth.sessionmanagement.finishlogindiscovery(auth.logindiscoverymethod.password, user.id); } } } 139apex reference guide mydomainlogindiscoveryhandler interface test class for mydomaindisclogindefaulthandler class the following is the test class for mydomaindiscoveryloginhandler. for the test to work, your org must have the my domain login page type set to discovery. // test class for mydomaindisclogindefaulthandler @istest class mydomaindisclogindefaulthandlertest { /* test discoverable handler login. create a user with specific email identifier and invoke login. expected : user should be discovered and pagereference should be returned. */ @istest static void testlogin() { // create user string identifieremail = getuniquename() + '@test.org'; createtestuser(identifieremail); map requestattributes = new map(); string starturl = ''; mydomaindisclogindefaulthandlermydomaindisclogindefaulthandler=newmydomaindisclogindefaulthandler(); // invoke login method from handler with the email of user created pagereference pagereference=mydomaindisclogin" "defaulthandler.login(identifieremail,starturl,requestattributes); // asser page reference is returned system.assertnotequals(null, pagereference, 'page reference was not returned'); } /* test discoverable handler login with invalid (non-existing) user. expected : auth.logindiscoveryexception */ @istest static void testloginwithinvaliduser() { try { map requestattributes = new map(); string starturl = ''; string uniquename = getuniquename(); string email = uniquename + '@test.org'; mydomaindisclogindefaulthandlermydomaindisclogindefaulthandler=newmydomaindisclogindefaulthandler(); // invoke login method from handler with non-existing user mydomaindisclogindefaulthandler.login(email, starturl, requestattributes); }catch (auth.logindiscoveryexception logindiscoveryexception) { // assert exception message system.assert(logindiscoveryexception.getmessage().contains('nouniqueuserfound'),'message='+logindiscoveryexception.getmessage()); } } /* generate a random name */ private static string getuniquename() { string orgid = userinfo.getorganizationid(); string datestring = string.valueof(datetime.now()).replace(' ','').replace(':','').replace('-',''); integer randomint = integer.valueof(math.rint(math.random()*1000000)); string uniquename = orgid + datestring + randomint; return uniquename; } /* create user with given email. */ private static void createtestuser(string identifieremail) 140apex reference guide oauthrefreshresult class { string uniquename = getuniquename(); profile pf = [select id from profile where name='standard user']; string profileid = pf.id; string fname = 'fname'; string lname = uniquename + '-lname'; user tuser = new user( firstname = fname, lastname = lname, email = identifieremail, username = uniquename + '@test.org', emailencodingkey = 'iso-8859-1', alias = uniquename.substring(18, 23), timezonesidkey = 'america/los_angeles', localesidkey = 'en_us', languagelocalekey = 'en_us', profileid = profileid); insert tuser; } } oauthrefreshresult class stores the result of an authproviderpluginclass refresh method. oauth authentication flow provides a refresh token that can be used to get a new access token. access tokens have a limited lifetime as specified by the session timeout value. when an access token expires, use a refresh token to get a new access token. namespace auth usage the oauthrefreshresult class contains the parameters, accesstoken, refreshtoken, and error, all of which are of type string. for a code example, see . in this section: oauthrefreshresult constructors oauthrefreshresult properties oauthrefreshresult constructors the following are constructors for oauthrefreshresult. in this section: oauthrefreshresult(accesstoken, refreshtoken, error) creates an instance of the oauthrefreshresult class using the specified access token, refresh token, and error for a custom authentication provider plug-in. 141apex reference guide oauthrefreshresult class oauthrefreshresult(accesstoken, refreshtoken) creates an instance of the oauthrefreshresult class using the specified access token and refresh token for a custom authentication provider plug-in. use this method when you know that the refresh was successful. oauthrefreshresult(accesstoken, refreshtoken, error) creates an instance of the oauthrefreshresult class using the specified access token, refresh token, and error for a custom authentication provider plug-in. signature public oauthrefreshresult(string accesstoken, string refreshtoken, string error) parameters accesstoken type: string oauth access token for the user who is currently logged in. refreshtoken type: string oauth refresh token for the user who is currently logged in. error type: string error that occurred when a user attempted to authenticate with the custom authentication provider. oauthrefreshresult(accesstoken, refreshtoken) creates an instance of the oauthrefreshresult class using the specified" "access token and refresh token for a custom authentication provider plug-in. use this method when you know that the refresh was successful. signature public oauthrefreshresult(string accesstoken, string refreshtoken) parameters accesstoken type: string the oauth access token for the user who is logged in. refreshtoken type: string the oauth refresh token for the user who is logged in. oauthrefreshresult properties the following are properties for oauthrefreshresult. 142apex reference guide registrationhandler interface in this section: accesstoken the oauth access token for the user who is currently logged in. error error that occurs when a user unsuccessfully attempts to authenticate with the custom authentication provider. refreshtoken the oauth refresh token for the user who is currently logged in. accesstoken the oauth access token for the user who is currently logged in. signature public string accesstoken {get; set;} property value type: string error error that occurs when a user unsuccessfully attempts to authenticate with the custom authentication provider. signature public string error {get; set;} property value type: string refreshtoken the oauth refresh token for the user who is currently logged in. signature public string refreshtoken {get; set;} property value type: string registrationhandler interface salesforce provides the ability to use an authentication provider, such as facebook© or janrain©, for single sign-on into salesforce. 143apex reference guide registrationhandler interface namespace auth usage to set up single sign-on, you must create a class that implements auth.registrationhandler. classes implementing the auth.registrationhandler interface are specified as the registration handler in authentication provider definitions, and enable single sign-on into salesforce portals and organizations from third-party services such as facebook. using information from the authentication providers, your class must perform the logic of creating and updating user data as appropriate, including any associated account and contact records. note: during the user update process, you can use the confirmuser() method to ensure that users are correctly mapped between salesforce and the third party. for more information, see the confirmuserregistrationhandler interface. in this section: registrationhandler methods storing user information and getting access tokens auth.registrationhandler example implementation auth.registrationhandler error example this example implements the auth.registrationhandler interface and shows how to use a custom exception to display an error message in the url of the page. if you don’t use a custom exception, the error code and description appear in the url and the error description appears on the page. registrationhandler methods the following are methods for registrationhandler. in this section: createuser(portalid, userdata) returns a user object using the specified portal id and user information from the third party, such as the username and email address. the user object corresponds to the third party’s user information and may be a new user that hasn’t been inserted in the database or may represent an existing user record in the database. updateuser(userid, portalid, userdata) updates the specified user’s information. this method is called if the user has logged in before with the authentication provider and then logs in again. createuser(portalid, userdata) returns a user object using the specified portal id and user information from the third party, such as the username and email address. the user object corresponds to the third party’s user information and may be a new user that hasn’t been inserted in the database or may represent an existing user record in the database. signature public user createuser(id portalid, auth.userdata userdata) 144apex reference guide registrationhandler interface parameters portalid type: id userdata type: auth.userdata return value type: user usage the portalid value may be null or an empty key if there is no portal configured with this provider. updateuser(userid, portalid, userdata) updates the specified user’s information. this method is called if the user has logged in before with the authentication provider and then logs in again. signature public void updateuser(id userid, id portalid, auth.userdata userdata) parameters userid type: id portalid type: id userdata type: auth.userdata return value type: void usage the portalid value can be null or an empty key if there's no portal configured with this provider. storing user information and getting access tokens the" "auth.userdata class is used to store user information for auth.registrationhandler. the third-party authentication provider can send back a large collection of data about the user, including their username, email address, locale, and so on. frequently used data is converted into a common format with the auth.userdata class and sent to the registration handler. if the registration handler wants to use the rest of the data, the auth.userdata class has an attributemap variable. the attribute map is a map of strings (map) for the raw values of all the data from the third party. because the map is , values that the third party returns that aren't strings (like an array of urls or a map) are converted into an 145apex reference guide registrationhandler interface appropriate string representation. the map includes everything returned by the third-party authentication provider, including the items automatically converted into the common format. the constructor for auth.userdata has the following syntax: auth.userdata(string identifier, string firstname, string lastname, string fullname, string email, string link, string username, string locale, string provider, string siteloginurl, map attributemap) to learn about auth.userdata properties, see auth.userdata class. note: you can only perform dml operations on additional sobjects in the same transaction with user objects under certain circumstances. for more information, see sobjects that cannot be used together in dml operations. for all authentication providers except janrain, after a user is authenticated using a provider, the access token associated with that provider for this user can be obtained in apex using the auth.authtoken apex class. auth.authtoken provides two methods to retrieve access tokens. one is getaccesstoken, which obtains a single access token. use this method if the user id is mapped to a single third-party user. if the user id is mapped to multiple third-party users, use getaccesstokenmap, which returns a map of access tokens for each third-party user. for more information about authentication providers, see authentication providers in salesforce help. when using janrain as an authentication provider, you must use the janrain accesscredentials dictionary values to retrieve the access token or its equivalent. only some providers supported by janrain provide an access token, while other providers use other fields. the janrain accesscredentials fields are returned in the attributemap variable of the auth.userdata class. see the janrain auth_info documentation for more information on accesscredentials. note: not all janrain account types return accesscredentials. sometimes you must change your account type to receive the information. to learn about the auth.authtoken methods, see auth.authtoken class. auth.registrationhandler example implementation this example implements the auth.registrationhandler interface that creates as well as updates a standard user based on data provided by the authentication provider. error checking has been omitted to keep the example simple. global class standarduserregistrationhandler implements auth.registrationhandler{ global user createuser(id portalid, auth.userdata data){ user u = new user(); profile p = [select id from profile where name='standard user']; u.username = data.username + '@salesforce.com'; u.email = data.email; u.lastname = data.lastname; u.firstname = data.firstname; string alias = data.username; if(alias.length() > 8) { alias = alias.substring(0, 8); 146apex reference guide registrationhandler interface } u.alias = alias; u.languagelocalekey = data.attributemap.get('language'); u.localesidkey = data.locale; u.emailencodingkey = 'utf-8'; u.timezonesidkey = 'america/los_angeles'; u.profileid = p.id; return u; } global void updateuser(id userid, id portalid, auth.userdata data){ user u = new user(id=userid); u.username = data.username + '@salesforce.com'; u.email = data.email; u.lastname = data.lastname; u.firstname = data.firstname; string alias = data.username; if(alias.length() > 8) { alias = alias.substring(0, 8); } u.alias = alias; u.langu" "agelocalekey = data.attributemap.get('language'); u.localesidkey = data.locale; update(u); } } the following example tests the above code. @istest private class standarduserregistrationhandlertest { static testmethod void testcreateandupdateuser() { standarduserregistrationhandler handler = new standarduserregistrationhandler(); auth.userdata sampledata = new auth.userdata('testid', 'testfirst', 'testlast', 'testfirst testlast', 'testuser@example.org', null, 'testuserlong', 'en_us', 'facebook', null, new map{'language' => 'en_us'}); user u = handler.createuser(null, sampledata); system.assertequals('testuserlong@salesforce.com', u.username); system.assertequals('testuser@example.org', u.email); system.assertequals('testlast', u.lastname); system.assertequals('testfirst', u.firstname); system.assertequals('testuser', u.alias); insert(u); string uid = u.id; sampledata = new auth.userdata('testnewid', 'testnewfirst', 'testnewlast', 'testnewfirst testnewlast', 'testnewuser@example.org', null, 'testnewuserlong', 'en_us', 'facebook', null, new map{}); handler.updateuser(uid, null, sampledata); user updateduser = [select username, email, firstname, lastname, alias from user where id=:uid]; system.assertequals('testnewuserlong@salesforce.com', updateduser.username); 147apex reference guide samljithandler interface system.assertequals('testnewuser@example.org', updateduser.email); system.assertequals('testnewlast', updateduser.lastname); system.assertequals('testnewfirst', updateduser.firstname); system.assertequals('testnewu', updateduser.alias); } } auth.registrationhandler error example this example implements the auth.registrationhandler interface and shows how to use a custom exception to display an error message in the url of the page. if you don’t use a custom exception, the error code and description appear in the url and the error description appears on the page. to limit this example to the custom exception, some code was omitted. global class reghandler implements auth.registrationhandler { class reghandlerexception extends exception {} global user createuser(id portalid, auth.userdata data){ list profiles = [select id, name, usertype from profile where name = 'power user']; profile profile = profiles.isempty() ? null : profiles[0]; if(profile==null) throw new reghandlerexception('cannot find the profile. for help, contact your administrator.'); ... } global void updateuser(id userid, id portalid, auth.userdata data){ user u = new user(id=userid); u.lastname = data.lastname; u.firstname = data.firstname; update(u); } } samljithandler interface use this interface to control and customize just-in-time user provisioning logic during saml single sign-on. namespace auth usage to use custom logic for user provisioning during saml single sign-on, you must create a class that implements auth.samljithandler. this allows you to incorporate organization-specific logic (such as populating custom fields) when users log in to salesforce with single sign-on. keep in mind that your class must perform the logic of creating and updating user data as appropriate, including any associated account and contact records. 148apex reference guide samljithandler interface in salesforce, you specify your class that implements this interface in the saml jit handler field in saml single sign-on settings. make sure that the user you specify to run the class has “manage users” permission. in this section: samljithandler methods samljithandler example implementation samljithandler methods the following are methods for samljithandler. in this section: createuser(samlssoproviderid, communityid, portalid, federationid, attributes, assertion) returns a user object using the specified federation id" ". the user object corresponds to the user information. this object can be a new user that hasn’t been inserted in the database or an existing user record in the database. updateuser(userid, samlssoproviderid, communityid, portalid, federationid, attributes, assertion) updates the specified user’s information. this method is called if the user has logged in before with saml single sign-on and then logs in again, or if your application is using the existing user linking url. createuser(samlssoproviderid, communityid, portalid, federationid, attributes, assertion) returns a user object using the specified federation id. the user object corresponds to the user information. this object can be a new user that hasn’t been inserted in the database or an existing user record in the database. signature public user createuser(id samlssoproviderid, id communityid, id portalid, string federationid, map attributes, string assertion) parameters samlssoproviderid type: id the id of the samlssoconfig standard object. communityid type: id the id of the experience cloud site. this parameter can be null if you’re not creating an experience cloud user. portalid type: id the id of the portal. this parameter can be null if you’re not creating a portal user. federationid type: string the id salesforce expects to be used for this user. 149apex reference guide samljithandler interface attributes type: map all attributes in the saml assertion that were added to the default assertion; for example, custom attributes. attributes are case-sensitive. if the assertion is encrypted, the attribute map contains a decrypted assertion stored as a value with the key sfdc.samlassertion. assertion type: string the default saml assertion, base-64 encoded. if the assertion is encrypted, this parameter is also encrypted. to access the decrypted assertion, see the sfdc.samlassertion key in the attribute map. return value type: user a user sobject. usage the communityid and portalid parameter values can be null or the associated keys can be empty if there’s no experience cloud site or portal configured with this organization. updateuser(userid, samlssoproviderid, communityid, portalid, federationid, attributes, assertion) updates the specified user’s information. this method is called if the user has logged in before with saml single sign-on and then logs in again, or if your application is using the existing user linking url. signature public void updateuser(id userid, id samlssoproviderid, id communityid, id portalid, string federationid, map attributes, string assertion) parameters userid type: id the id of the salesforce user. samlssoproviderid type: id the id of the samlssoconfig object. communityid type: id the id of the experience cloud site. this type can be null if you’re not updating an experience cloud user. 150apex reference guide samljithandler interface portalid type: id the id of the portal. this type can be null if you’re not updating a portal user. federationid type: string the id salesforce expects to be used for this user. attributes type: map all attributes in the saml assertion that were added to the default assertion; for example, custom attributes. attributes are case-sensitive. if the assertion is encrypted, the attribute map also contains a decrypted assertion stored as a value with the key sfdc.samlassertion. assertion type: string the default saml assertion, base-64 encoded. if the assertion is encrypted, this parameter is also encrypted. to access the decrypted assertion, see the sfdc.samlassertion key in the attribute map. return value type: void samljithandler example implementation this is an example implementation of the auth.samljithandler interface. this code uses private methods to handle accounts and contacts (handlecontact() and handleaccount()), which aren’t included in this example. global class standarduserhandler implements auth.samljithandler { private class jitexception extends exception{} private void handleuser(boolean" "create, user u, map attributes, string federationidentifier, boolean isstandard) { if(create && attributes.containskey('user.username')) { u.username = attributes.get('user.username'); } if(create) { if(attributes.containskey('user.federationidentifier')) { u.federationidentifier = attributes.get('user.federationidentifier'); } else { u.federationidentifier = federationidentifier; } } if(attributes.containskey('user.profileid')) { string profileid = attributes.get('user.profileid'); profile p = [select id from profile where id=:profileid]; u.profileid = p.id; } if(attributes.containskey('user.userroleid')) { string userrole = attributes.get('user.userroleid'); 151apex reference guide sessionmanagement class userrole r = [select id from userrole where id=:userrole]; u.userroleid = r.id; } if(attributes.containskey('user.phone')) { u.phone = attributes.get('user.phone'); } if(attributes.containskey('user.email')) { u.email = attributes.get('user.email'); } //more attributes here - removed for length //handle custom fields here if(!create) { update(u); } } private void handlejit(boolean create, user u, id samlssoproviderid, id communityid, id portalid, string federationidentifier, map attributes, string assertion) { if(communityid != null || portalid != null) { string account = handleaccount(create, u, attributes); handlecontact(create, account, u, attributes); handleuser(create, u, attributes, federationidentifier, false); } else { handleuser(create, u, attributes, federationidentifier, true); } } global user createuser(id samlssoproviderid, id communityid, id portalid, string federationidentifier, map attributes, string assertion) { user u = new user(); handlejit(true, u, samlssoproviderid, communityid, portalid, federationidentifier, attributes, assertion); return u; } global void updateuser(id userid, id samlssoproviderid, id communityid, id portalid, string federationidentifier, map attributes, string assertion) { user u = [select id from user where id=:userid]; handlejit(false, u, samlssoproviderid, communityid, portalid, federationidentifier, attributes, assertion); } } sessionmanagement class contains methods for verifying users’ identity, creating custom login flows, customizing security levels, and defining trusted ip ranges for a current session. 152apex reference guide sessionmanagement class namespace auth in this section: sessionmanagement methods sessionmanagement methods the following are methods for sessionmanagement. all methods are static. use these methods to customize your user identity verification flows, manage the use of time-based one-time password (totp) apps like google authenticator, or create custom login flows. other methods validate a user’s incoming ip address against trusted ip range settings for an organization or profile. in this section: finishlogindiscovery(method, userid) finishes the my domain login discovery login process. finishloginflow() finish the visualforce page login flow process, and redirect the user to the default home page. finishloginflow(starturl) finish the visualforce page login flow process, and redirect the user to the specified start url. generateverificationurl(policy, description, destinationurl) initiates a user identity verification flow with the verification method that the user registered with, and returns a url to the identity verification screen. for example, if you have a custom visualforce page that displays sensitive account details, you can prompt the user to verify identity before viewing it. getcurrentsession() returns a map of attributes for the current session. getlightninglogineligibility(userid) returns the eligibility status for a user who’s logging in with lightning login when you set up your org with my domain and use the login discovery page type. use this method to redirect" "the user to a custom login flow. for example, use after a login attempt to redirect the user to password flow if the user is ineligible for lightning login. getqrcode() returns a map containing a url to a quick response (qr) code and a time-based one-time password (totp) shared secret to configure authenticator apps or devices for multi-factor authentication (mfa). getrequiredsessionlevelforprofile(profileid) indicates the required login security session level for the given profile. ignoreforconcurrentsessionlimit(sessions) this method is reserved for internal salesforce use. inorgnetworkrange(ipaddress) indicates whether the given ip address is within the organization's trusted ip range according to the organization's network access settings. isipallowedforprofile(profileid, ipaddress) indicates whether the given ip address is within the trusted ip range for the given profile. 153apex reference guide sessionmanagement class setsessionlevel(level) sets the user's current session security level. validatetotptokenforkey(sharedkey, totpcode) deprecated. use validatetotptokenforkey(totpsharedkey, totpcode, description) instead. validatetotptokenforkey(totpsharedkey, totpcode, description) indicates whether a time-based one-time password (totp) code (token) is valid for the given shared key. validatetotptokenforuser(totpcode) deprecated. use validatetotptokenforuser(totpcode, description) instead. validatetotptokenforuser(totpcode, description) indicates whether a time-based one-time password (totp) code (token) is valid for the current user. verifydeviceflow(usercode, starturl) verifies the user code entered during the device authentication flow and redirects users to the oauth approval page. if users aren’t logged in, they must log in. after successful login, users are prompted to allow the device to access salesforce data. finishlogindiscovery(method, userid) finishes the my domain login discovery login process. signature public static system.pagereference finishlogindiscovery(auth.logindiscoverymethod method, id userid) parameters method type: auth.logindiscoverymethod logindiscoverymethod enum verification method used with my domain login discovery. userid type: id id used to log in the user. the user must be active. return value type: system.pagereference usage include this method when implementing the mydomainlogindiscoveryhandler interface to direct users to an authentication mechanism, and then log them in. if users enter a username in the login page, they are sent to the password page for authentication. if users are enrolled in lightning login, they are directed to the salesforce authenticator to authenticate. if users are sso-enabled, they are sent to the suitable identity provider (idp) to authenticate. the calling user requires manage users permission. if the user passed in is frozen or inactive, the method throws an exception. after implementing the mydomainlogindiscoveryhandler interface, register the login discovery handler from the my domain setup page. under authentication configuration, select this handler from the list of apex classes. 154apex reference guide sessionmanagement class finishloginflow() finish the visualforce page login flow process, and redirect the user to the default home page. signature public static system.pagereference finishloginflow() return value type: system.pagereference usage include this method in the apex controller of the visualforce page login flow when creating login flows programmatically. this method indicates that the login flow is finished and redirects the user to the experience cloud site’s default home page. the login process runs in a restricted session until users complete the process. calling this method indicates that the login flow is complete, lifts the restriction, and gives users full access to the experience cloud site. finishloginflow(starturl) finish the visualforce page login flow process, and redirect the user to the specified start url. signature public static system.pagereference finishloginflow(string starturl) parameters starturl type: string path to the page that users see when they access the experience cloud site. return value type: system.pagereference usage include this method in the apex controller of the visualforce page login flow when creating login flows programmatically. this method indicates that" "the login flow is finished and redirects the user to the specified location in the experience cloud site. the login process runs in a restricted session until users complete the process. calling this method indicates that the login flow is complete, lifts the restriction, and gives users full access to the experience cloud site. generateverificationurl(policy, description, destinationurl) initiates a user identity verification flow with the verification method that the user registered with, and returns a url to the identity verification screen. for example, if you have a custom visualforce page that displays sensitive account details, you can prompt the user to verify identity before viewing it. 155apex reference guide sessionmanagement class signature public static string generateverificationurl(auth.verificationpolicy policy, string description, string destinationurl) parameters policy type: auth.verificationpolicy the session security policy required to initiate identity verification for the user’s session. for example, if the policy is set to high assurance level of session security, and the user’s current session has the standard level of session security, the user’s session is raised to high assurance after successful verification of identity. in the setup user interface, this value is shown in the triggered by column of identity verification history. description type: string the custom description that describes the activity requiring identity verification; for example, “complete purchase and check out”. this text appears to users when they verify their identity in salesforce and, if they use salesforce authenticator version 2 or later, in the salesforce authenticator mobile app. in addition, in the setup user interface, this text is shown in the activity message column of identity verification history. destinationurl type: string the relative or absolute salesforce url that you want to redirect the user to after identity verification—for example, /apex/mypage. the user is redirected to destinationurl when the identity verification flow is complete, regardless of success. for example, if a user chooses to not respond to the identity challenge and cancels it, the user is still redirected to destinationurl. as a best practice, ensure that your code for this page manually checks that the security policy was satisfied (and the user didn’t just manually type the url in the browser). for example, if the policy is high assurance, the target page checks that the user's session is high assurance before allowing access. return value type: string the url where the user is redirected to verify identity. usage • if the user is already registered to confirm identity using a time-based one-time password (totp), then the user is redirected to the one-time password identity verification flow and asked to provide a code. • if the user isn’t registered with any verification method (such as one-time password or salesforce authenticator version 2 or later), the user is prompted to download and verify identity using salesforce authenticator. the user can also choose a different verification method. getcurrentsession() returns a map of attributes for the current session. signature public static map getcurrentsession() 156apex reference guide sessionmanagement class return value type: map usage the map includes a parentid value, which is the 18-character id for the parent session, if one exists (for example, if the current session is for a canvas app). if the current session doesn’t have a parent, this value is null. the map also includes the logouturl assigned to the current session. if you create an apex test method that calls this method, the test fails with an error such as, “unexpected exception: current session unavailable."" an error occurs because there isn’t a session in the context through which the test is being run. when a session is reused, salesforce updates the loginhistoryid with the value from the most recent login. example the following example shows the name-value pairs in a map returned by getcurrentsession(). note that usersid includes an “s” in the name to match the name of the corresponding field in the authsession object. { sessionid=0ak###############, usertype=standard, parentid=0ak###############, numsecondsvalid=7200, logintype=saml idp initiated sso, logindomain=null, loginhistoryid=0ya###############, username=user@domain.com, createddate=wed jul 30 19:09:29 gmt 2014, sessiontype=visualforce, lastmodifieddate=wed jul 30 19:09:" "16 gmt 2014, logouturl=https://google.com, sessionsecuritylevel=standard, usersid=005###############, sourceip=1.1.1.1 } getlightninglogineligibility(userid) returns the eligibility status for a user who’s logging in with lightning login when you set up your org with my domain and use the login discovery page type. use this method to redirect the user to a custom login flow. for example, use after a login attempt to redirect the user to password flow if the user is ineligible for lightning login. signature public static auth.lightninglogineligibility getlightninglogineligibility(id userid) parameters userid type: id id of the user who is logging in. 157apex reference guide sessionmanagement class return value type: auth.lightninglogineligibility returns the current eligibility status. example auth.lightninglogineligibility eligibility = auth.sessionmanagement.getlightninglogineligibility(id); if (eligibility == auth.lightninglogineligibility.eligible) { // success } getqrcode() returns a map containing a url to a quick response (qr) code and a time-based one-time password (totp) shared secret to configure authenticator apps or devices for multi-factor authentication (mfa). signature public static map getqrcode() return value type: map usage the qr code encodes the returned secret as well as the current user's username. the keys are qrcodeurl and secret. calling this method does not change any state for the user, nor does it read any state from the user. this method returns a brand new secret every time it is called, does not save that secret anywhere, and does not validate the totp token. the admin must explicitly save the values for the user after verifying a totp token with the secret. the secret is a base32-encoded string of a 20-byte shared key. example the following is an example of how to request the qr code. public string getgetqrcode() { return getqrcode(); } public string getqrcode() { map coderesult = auth.sessionmanagement.getqrcode(); string result = 'url: '+coderesult.get('qrcodeurl') + ' secret: ' + coderesult.get('secret'); return result; } 158apex reference guide sessionmanagement class the following is an example of a returned map. {qrcodeurl=https://www.salesforce.com/secur/qrcode?w=200&h=200&t=tf&u=user%0000000000.com&s=aaaaa7b5bbbb5aaaaaaa66bbbb, secret=aaaaa7b5aaaaaa5bbbbbbbbb66aaa} getrequiredsessionlevelforprofile(profileid) indicates the required login security session level for the given profile. signature public static auth.sessionlevel getrequiredsessionlevelforprofile(string profileid) parameters profileid type: string the 15-character profile id. return value type: auth.sessionlevel the session security level required at login for the profile with the id profileid. you can customize the assignment of each level in session settings. for example, you can set the high assurance level to apply only to users who authenticated with multi-factor authentication (mfa) or through a specific identity provider. ignoreforconcurrentsessionlimit(sessions) this method is reserved for internal salesforce use. signature public static map ignoreforconcurrentsessionlimit(object sessions) parameters sessions type: object return value type: map inorgnetworkrange(ipaddress) indicates whether the given ip address is within the organization's trusted ip range according to the organization's network access settings. 159apex reference guide sessionmanagement class signature public static boolean inorgnetworkrange(string ipaddress) parameters ipaddress type: string the ip address to validate. return value type: boolean usage if a trusted ip range is not defined, this returns false, and throws an exception if the ip address is not valid. trusted ip range exists? user is in the trusted ip range? return value yes yes true yes no false no n/a false" "isipallowedforprofile(profileid, ipaddress) indicates whether the given ip address is within the trusted ip range for the given profile. signature public static boolean isipallowedforprofile(string profileid, string ipaddress) parameters profileid type: string the 15-character alphanumeric string for the current user’s profile id. ipaddress type: string the ip address to validate. return value type: boolean usage if a trusted ip range is not defined, this returns true, and throws an exception if the ip address is not valid or if the profile id is not valid. 160apex reference guide sessionmanagement class trusted ip range exists? user is in the trusted ip range? return value yes yes true yes no false no n/a true setsessionlevel(level) sets the user's current session security level. signature public static void setsessionlevel(auth.sessionlevel level) parameters level type: auth.sessionlevel the session security level to assign to the user. the meaning of each level can be customized in the session settings for each organization, such as setting the high assurance level to apply only to users who authenticated with multi-factor authentication (mfa) or through a specific identity provider. return value type: void usage this setting affects the session level of all sessions associated with the current session, such as visualforce or ui access. if you create an apex test method that calls this method, the test fails with an error such as, “unexpected exception: current session unavailable."" an error occurs because there isn’t a session in the context through which the test is being run. example the following is an example class for setting the session level. public class raisesessionlevel{ public void setlevelhigh() { auth.sessionmanagement.setsessionlevel(auth.sessionlevel.high_assurance); } public void setlevelstandard() { auth.sessionmanagement.setsessionlevel(auth.sessionlevel.standard); } } validatetotptokenforkey(sharedkey, totpcode) deprecated. use validatetotptokenforkey(totpsharedkey, totpcode, description) instead. 161apex reference guide sessionmanagement class signature public static boolean validatetotptokenforkey(string sharedkey, string totpcode) parameters sharedkey type: string the shared (secret) key. the sharedkey must be a base32-encoded string of a 20-byte shared key. totpcode type: string the time-based one-time password (totp) code to validate. return value type: boolean usage if the key is invalid or doesn’t exist, this method throws an invalid parameter value exception or a no data found exception, respectively. if the current user exceeds the maximum of 10 token validation attempts, this method throws a security exception. validatetotptokenforkey(totpsharedkey, totpcode, description) indicates whether a time-based one-time password (totp) code (token) is valid for the given shared key. signature public static boolean validatetotptokenforkey(string totpsharedkey, string totpcode, string description) parameters totpsharedkey type: string the shared (secret) key. the totpsharedkey must be a base32-encoded string of a 20-byte shared key. totpcode type: string the time-based one-time password (totp) code to validate. description type: string the custom description that describes the activity requiring identity verification; for example, “complete purchase and check out”. in the setup user interface, this text is shown in the activity message column of identity verification history. the description must be 128 characters or fewer. if you provide a value that’s longer, it’s truncated to 128 characters. return value type: boolean 162apex reference guide sessionmanagement class usage if the key is invalid or doesn’t exist, this method throws an invalid parameter value exception or a no data found exception, respectively. if the current user exceeds the maximum of 10 token validation attempts, this method throws a security exception. validatetotptokenforuser(totpcode) deprecated. use validatetotptokenforuser(totpcode, description) instead. signature public static boolean validatetotptokenforuser" "(string totpcode) parameters totpcode type: string the time-based one-time password (totp) code to validate. return value type: boolean usage if the current user does not have a totp code, this method throws an exception. if the current user has attempted too many validations, this method throws an exception. validatetotptokenforuser(totpcode, description) indicates whether a time-based one-time password (totp) code (token) is valid for the current user. signature public static boolean validatetotptokenforuser(string totpcode, string description) parameters totpcode type: string the time-based one-time password (totp) code to validate. description type: string the custom description that describes the activity requiring identity verification; for example, “complete purchase and check out”. this text appears to users when they verify their identity in salesforce and, if they use salesforce authenticator version 2 or later, in the salesforce authenticator mobile app. in addition, in the setup user interface, this text is shown in the activity message column of identity verification history. the description must be 128 characters or fewer. if you provide a value that’s longer, it’s truncated to 128 characters. 163apex reference guide sessionlevel enum return value type: boolean usage if the current user does not have a totp code, or if the current user has attempted too many validations, this method throws an exception. verifydeviceflow(usercode, starturl) verifies the user code entered during the device authentication flow and redirects users to the oauth approval page. if users aren’t logged in, they must log in. after successful login, users are prompted to allow the device to access salesforce data. signature public static system.pagereference verifydeviceflow(string usercode, string starturl) parameters usercode type: string human-readable user code provided to the user by salesforce. the user must enter this code at the verification url to approve device access to salesforce data. starturl type: string the url for the page that the user is redirected to after successful login and approval of the device to access salesforce data. if you don’t specify a start url, the user is redirected to the home page. return value type:system.pagereference usage include this method in the apex controller when creating a custom visualforce user code verification page for the oauth 2.0 device authentication flow. this method verifies the user code, prompts the user to log in as needed, and prompts the user to allow the device access to salesforce data. upon successful verification and authentication, the user is redirected to the page defined by the start url. sessionlevel enum an auth.sessionlevel enum value is used by the sessionmanagement.setsessionlevel method. namespace auth 164apex reference guide userdata class enum values value description low the user’s security level for the current session meets the lowest requirements. note: this low level is not available, nor used, in the salesforce ui. user sessions through the salesforce ui are either standard or high assurance. you can set this level using the api, but users assigned this level will experience unpredictable and reduced functionality in their salesforce organization. standard the user’s security level for the current session meets the standard requirements set in the current organization session security levels. high_assurance the user’s security level for the current session meets the high assurance requirements set in the current organization session security levels. usage with session-level security, you control user access to features that support it, such as connected apps and reporting. for example, you can customize an organization’s session settings to require users to log in with multi-factor authentication (mfa) to get a high assurance session. then, you can restrict access to a specific connected app by requiring a high assurance session level in the settings for the connected app. userdata class stores user information for auth.registrationhandler. namespace auth in this section: userdata constructors userdata properties userdata constructors the following are constructors for userdata. in this section: userdata(identifier, firstname, lastname, fullname, email, link, username, locale, provider, siteloginurl, attributemap) creates a new instance of the auth" ".userdata class using the specified arguments. 165apex reference guide userdata class userdata(identifier, firstname, lastname, fullname, email, link, username, locale, provider, siteloginurl, attributemap) creates a new instance of the auth.userdata class using the specified arguments. signature public userdata(string identifier, string firstname, string lastname, string fullname, string email, string link, string username, string locale, string provider, string siteloginurl, map attributemap) parameters identifier type: string an identifier from the third party for the authenticated user, such as the facebook user number or the salesforce user id. firstname type: string the first name of the authenticated user, according to the third party. lastname type: string the last name of the authenticated user, according to the third party. fullname type: string the full name of the authenticated user, according to the third party. email type: string the email address of the authenticated user, according to the third party. link type: string a stable link for the authenticated user such as https://www.facebook.com/myusername. username type: string the username of the authenticated user in the third party. locale type: string the standard locale string for the authenticated user. provider type: string the service used to log in, such as facebook or janrain. siteloginurl type: string the site login page url passed in if used with a site; null otherwise. 166apex reference guide userdata class attributemap type: map a map of data from the third party, in case the handler has to access non-standard values. for example, when using janrain as a provider, the fields janrain returns in its accesscredentials dictionary are placed into the attributemap. these fields vary by provider. userdata properties the following are properties for userdata. in this section: identifier an identifier from the third party for the authenticated user, such as the facebook user number or the salesforce user id. firstname the first name of the authenticated user, according to the third party. lastname the last name of the authenticated user, according to the third party. fullname the full name of the authenticated user, according to the third party. email the email address of the authenticated user, according to the third party. link a stable link for the authenticated user such as https://www.facebook.com/myusername. username the username of the authenticated user in the third party. locale the standard locale string for the authenticated user. provider the service used to log in, such as facebook or janrain. siteloginurl the site login page url passed in if used with a site; null otherwise. attributemap a map of data from the third party, in case the handler has to access non-standard values. for example, when using janrain as a provider, the fields janrain returns in its accesscredentials dictionary are placed into the attributemap. these fields vary by provider. identifier an identifier from the third party for the authenticated user, such as the facebook user number or the salesforce user id. signature public string identifier {get; set;} 167apex reference guide userdata class property value type: string firstname the first name of the authenticated user, according to the third party. signature public string firstname {get; set;} property value type: string lastname the last name of the authenticated user, according to the third party. signature public string lastname {get; set;} property value type: string fullname the full name of the authenticated user, according to the third party. signature public string fullname {get; set;} property value type: string email the email address of the authenticated user, according to the third party. signature public string email {get; set;} property value type: string 168apex reference guide userdata class link a stable link for the authenticated user such as https://www.facebook.com/myusername. signature public string link {get; set;} property value type: string username the username of the authenticated user in the third party. signature public string username {get; set;} property value type: string locale the standard locale string for the authenticated user. signature public string" "locale {get; set;} property value type: string provider the service used to log in, such as facebook or janrain. signature public string provider {get; set;} property value type: string siteloginurl the site login page url passed in if used with a site; null otherwise. 169apex reference guide verificationmethod enum signature public string siteloginurl {get; set;} property value type: string attributemap a map of data from the third party, in case the handler has to access non-standard values. for example, when using janrain as a provider, the fields janrain returns in its accesscredentials dictionary are placed into the attributemap. these fields vary by provider. signature public map attributemap {get; set;} property value type: map verificationmethod enum contains the different ways users can identify themselves when logging in. you can use it to implement mobile-centric passwordless login pages and to self-register (and deregister) verification methods. usage the enum value is an argument in system.site.passwordlesslogin, system.usermanagement.registerverificationmethod, and system.usermanagement.deregisterverificationmethod on page 3504 methods. the value indicates the method used to verify a user’s identity. enum values the following are the values of the auth.verificationmethod enum. value description built_in_authenticator identity verified with a built-in authenticator. email identity verified with a verification code sent in an email message. password identity verified with a password. salesforce_authenticator identity verified by salesforce authenticator. security_key identity verified by a webauthn-compatible physical security key. includes all security keys registered or used after summer ’22. sms identity verified with a verification code sent via sms message. totp identity verified with a time-based one-time password (totp). 170apex reference guide verificationpolicy enum value description u2f identity verified by a u2f physical security key, such as a yubikey. note: for u2f security keys registered or used after summer ’22, use security_key instead. verificationpolicy enum the auth.verificationpolicy enum contains an identity verification policy value used by the sessionmanagement.generateverificationurl method. usage the enum value is an argument in the sessionmanagement.generateverificationurl method. the value indicates the session security policy required to initiate identity verification for the user’s session. enum values the auth.verificationpolicy enum has this value. value description high_assurance the security level for the user’s current session must be high assurance. verificationresult class contains the result of a verification challenge that you invoke when you create your own verify page. the challenge can be initiated by either the system.usermanagement.verifypasswordlesslogin or system.usermanagement.verifyselfregistration method. namespace auth usage when users sign up for or log in to your experience cloud site with an email address or phone number, salesforce sends them a verification code. at the same time, salesforce generates the verify page for users to enter the code to verify their identity. you can replace the salesforce-generated verify page with one that you create with visualforce. then invoke the verification challenge and, if the verification code is entered correctly, log in the user. for sign-up, you use the system.usermanagement.verifyselfregistration method. for passwordless login, you use the system.usermanagement.verifypasswordlesslogin method. the methods return the verification result, which contains the message displayed as a result of the challenge. this message also indicates whether the challenge is successful and where to direct the user when the verification code is entered correctly. 171apex reference guide verificationresult class example this code contains the result of a verification challenge that registers a new user. string id = system.usermanagement.initselfregistration (auth.verificationmethod.sms, user); auth.verificationresult res = system.usermanagement.verifyselfregistration (auth.verificationmethod.sms, id, ‘123456’, null); if(res.success == true){ //redirect } in this section: verificationresult constructor verificationresult properties verificationresult method verificationresult constructor" "verificationresult has the following constructor. in this section: verificationresult(redirect, success, message) creates an instance of the verificationresult class that contains the verification result from system.usermanagement.verifyselfregistration. verificationresult(redirect, success, message) creates an instance of the verificationresult class that contains the verification result from system.usermanagement.verifyselfregistration. signature public verificationresult(system.pagereference redirect, boolean success, string message) parameters redirect type: system.pagereferencesystem.pagereference where user is directed upon successful verification. success type: boolean indicates whether verification succeeded. message type: string message that displays as a result of a verification challenge. 172apex reference guide verificationresult class verificationresult properties the following are properties for verificationresult. in this section: message message that displays as a result of a verification challenge. success if the identity verification is successful. other values are failure, pending, rate_limited, or failure_report. redirect where the user is directed after entering the verification code successfully, for example, the experience cloud site’s home page or location specified by the start url. success the verification challenge is successful. message message that displays as a result of a verification challenge. success if the identity verification is successful. other values are failure, pending, rate_limited, or failure_report. signature public string message {get; set;} property value type: string redirect where the user is directed after entering the verification code successfully, for example, the experience cloud site’s home page or location specified by the start url. signature public system.pagereference redirect {get; set;} property value type: system.pagereferencesystem.pagereference success the verification challenge is successful. signature public boolean success {get; set;} 173apex reference guide auth exceptions property value type: boolean verificationresult method verificationresult has the following method. in this section: clone() duplicates the auth.verificationresult object. clone() duplicates the auth.verificationresult object. signature public object clone() return value type: verificationresult auth exceptions the auth namespace contains some exception classes. all exception classes support built-in methods for returning the error message and exception type. see exception class and built-in exceptions. the auth namespace contains the following exception. exception description auth. throw this exception to indicate that an error occurred when using the auth provider plug-in. authproviderpluginexception use to display a custom error message to the user. to get the error message and write it to debug log, use the string getmessage(). auth.connectedappplugin throw this exception to indicate that an error occurred while running the custom behavior for exception a connected app. to get the error message and write it to debug log, use the string getmessage(). auth.discoverycustomerrorexception throw this exception to customize error messages that appear on discovery logins and configurable self-registration pages. an error message can have up to 200 characters. use custom error exceptions to localize error messages. include this exception in: • auth.mydomainlogindiscoveryhandler to show a custom error message on the my domain login page 174apex reference guide auth exceptions exception description • auth.logindiscoveryhandler to show an error message on the experience cloud site login page • auth.configurableselfreghandler to show an error message on the experience cloud site self-registration verify page the verify page shows up if you configured self-registration with either an email or text message verification method. if you didn’t set up sign-up with a verification method, the error message appears on the self-registration page. to get the error message and write it to debug log, use the string getmessage(). auth.jwtbearertokenexchange. throw this exception to indicate a problem with the response from the token endpoint in the jwtbearertokenexchangeexception jwtbearertokenexchange class. this exception occurs during the oauth 2.0 jwt bearer token flow when the http response: • fails to return an access token • isn’t in json format • returns a response code other than a 200 “ok” success code to get the error message and write it to debug log, use the string getmessage" "(). auth.logindiscoveryexception throw this exception to indicate that an error occurred when executing the login discovery handler. for an example, see logindiscoveryhandler example implementation. to get the error message and write it to debug log, use the string getmessage(). auth.verificationexception throw this exception to trigger verification based on the passed-in policy. you can throw this exception in an apex trigger or visualforce controller. the system automatically sends you to the verification endpoint, if possible. note: you can’t catch this exception. the exception immediately triggers the verification. examples this example uses authproviderpluginexception to throw a custom exception in a custom authentication provider implementation. use this exception if you want the end user to see a specific message, passing in the error message as a parameter. if you use another exception, users see a standard salesforce error message. global override auth.oauthrefreshresult refresh(map authproviderconfiguration,string refreshtoken){ httprequest req = new httprequest(); string accesstoken = null; string error = null; try { // developer todo: make a refresh token flow using refreshtoken passed // in as an argument to get the new access token // accesstoken = ... } catch (system.calloutexception e) { error = e.getmessage(); } 175apex reference guide cache namespace catch(exception e) { error = e.getmessage(); throw new auth.authproviderpluginexception('my custom error'); } return new auth.oauthrefreshresult(accesstoken,refreshtoken, error); } this example uses auth.verificationexception to trigger verification if a user attempts to create an account without a high assurance session. trigger testtrigger on account (before insert) { map sessionmap = auth.sessionmanagement.getcurrentsession(); if(!sessionmap.get('sessionsecuritylevel').equals('high_assurance')) { throw new auth.verificationexception( auth.verificationpolicy.high_assurance, 'insert account'); } } cache namespace the cache namespace contains methods for managing the platform cache. the following are the classes in the cache namespace. in this section: cachebuilder interface an interface for safely retrieving and removing values from a session or org cache. use the interface to generate a value that you want to store in the cache. the interface checks for cache misses, which means you no longer need to check for null cache values yourself. org class use the cache.org class to add, retrieve, and manage values in the org cache. unlike the session cache, the org cache is not tied to any session and is available to the organization across requests and to all users. orgpartition class contains methods to manage cache values in the org cache of a specific partition. unlike the session cache, the org cache is not tied to any session. it’s available to the organization across requests and to all users. partition class base class of cache.orgpartition and cache.sessionpartition. use the subclasses to manage the cache partition for org caches and session caches. session class use the cache.session class to add, retrieve, and manage values in the session cache. the session cache is active as long as the user’s salesforce session is valid (the user is logged in, and the session is not expired). sessionpartition class contains methods to manage cache values in the session cache of a specific partition. cache exceptions the cache namespace contains exception classes. 176apex reference guide cachebuilder interface visibility enum use the cache.visibility enumeration in the cache.session or cache.org methods to indicate whether a cached value is visible only in the value’s namespace or in all namespaces. see also: apex developer guide: platform cache cachebuilder interface an interface for safely retrieving and removing values from a session or org cache. use the interface to generate a value that you want to store in the cache. the interface checks for cache misses, which means you no longer need to check for null cache values yourself. namespace cache in this section: cachebuilder methods cachebuilder example implementation see also: apex developer guide: safely cache values with the cachebuilder interface cachebuilder methods the following are methods for cachebuilder. in this section: doload(var) contains the logic that builds a cached value. you don’t call this method directly. instead, it’s called indirectly when you reference the class that implements" "the cachebuilder interface. doload(var) contains the logic that builds a cached value. you don’t call this method directly. instead, it’s called indirectly when you reference the class that implements the cachebuilder interface. signature public object doload(string var) parameters var type: string 177apex reference guide org class a case-sensitive string value used to build a cached value. this parameter is also used as part of the unique key that identifies the cached value. return value type: object the value that was cached. cast the return value to the appropriate type. cachebuilder example implementation this example creates a class called userinfocache that implements the cachebuilder interface. the class caches the results of a soql query run against the user object. class userinfocache implements cache.cachebuilder { public object doload(string userid) { user u = (user)[select id, isactive, username from user where id =: userid]; return u; } } this example gets a cached user record based on a user id. if the value exists in the org cache, it is returned. if the value doesn’t exist, the doload(string var) method is re-executed, and the new value is cached and returned. user batman = (user) cache.org.get(userinfocache.class, ‘00541000000ek4c'); org class use the cache.org class to add, retrieve, and manage values in the org cache. unlike the session cache, the org cache is not tied to any session and is available to the organization across requests and to all users. namespace cache usage cache key format this table lists the format of the key parameter that some methods in this class take, such as put, get, and contains. key format description namespace.partition.key fully qualified key name. key refers to a partition marked as default when the namespace.partition prefix is omitted. local.partition.key use the local prefix to refer to the org’s namespace when the org doesn’t have a namespace defined. if the org has a namespace defined, the local prefix also refers to that org’s namespace. 178apex reference guide org class note: • if no default partition is specified in the org, calling a cache method without fully qualifying the key name causes a cache.org.orgcacheexception to be thrown. • the local prefix in an installed managed package refers to the namespace of the subscriber org and not the package’s namespace. the cache put calls aren’t allowed in a partition that the invoking class doesn’t own. example this class is the controller for a sample visualforce page (shown in the subsequent code sample). the cached values are initially added to the cache by the init() method, which the visualforce page invokes when it loads through the action attribute. the cache keys don’t contain the namespace.partition prefix. they all refer to the default partition in your org. to run this sample, create a partition and mark it as default. the visualforce page contains four output components. these components call get methods on the controller that returns the following values from the cache: a date, data based on the mydata inner class, a counter, a text value, and a list. the size of the list is also returned. the visualforce page also contains two buttons. the rerender button invokes the go() method on the controller. this method increases the values of the counter and the custom data in the cache. when you click rerender, the two counters increase by one each time. the go() method retrieves the values of these counters from the cache, increments their values by one, and stores them again in the cache. the remove datetime key button deletes the date-time value (with key datetime) from the cache. as a result, the value next to cached datetime: is cleared on the page. note: if another user logs in and runs this sample, this user gets the cache values that were last added or updated by the previous user. for example, if the counter value was five, the next user sees the counter value as increased to six. public class orgcachecontroller { // inner class. // used as the data type of a cache value. class mydata { public string value { get; set; } public integer counter { get; set; } public mydata(string value) { this.value = value; this.counter = 0; } public void inc() {" "counter++; } override public string tostring() { return this.value + ':' + this.counter; } } // apex list. // used as the data type of a cached value. private list numbers = new list { 'one', 'two', 'three', 'four', 'five' }; 179apex reference guide org class // constructor of the controller for the visualforce page. public orgcachecontroller() { } // adds various values to the cache. // this method is called when the visualforce page loads. public void init() { // all key values are not qualified by the namespace.partition // prefix because they use the default partition. // add counter to the cache with initial value of 0 // or increment it if it's already there. if (!cache.org.contains('counter')) { cache.org.put('counter', 0); } else { cache.org.put('counter', getcounter() + 1); } // add the datetime value to the cache only if it's not already there. if (!cache.org.contains('datetime')) { datetime dt = datetime.now(); cache.org.put('datetime', dt); } // add the custom data to the cache only if it's not already there. if (!cache.org.contains('data')) { cache.org.put('data', new mydata('some custom value')); } // add a list of number to the cache if not already there. if (!cache.org.contains('list')) { cache.org.put('list', numbers); } // add a string value to the cache if not already there. if (!cache.org.contains('output')) { cache.org.put('output', 'cached text value'); } } // return counter from the cache. public integer getcounter() { return (integer)cache.org.get('counter'); } // return datetime value from the cache. public string getcacheddatetime() { datetime dt = (datetime)cache.org.get('datetime'); return dt != null ? dt.format() : null; } // return cached value whose type is the inner class mydata. public string getcacheddata() { 180apex reference guide org class mydata mydata = (mydata)cache.org.get('data'); return mydata != null ? mydata.tostring() : null; } // return output from the cache. public string getoutput() { return (string)cache.org.get('output'); } // return list from the cache. public list getlist() { return (list)cache.org.get('list'); } // method invoked by the rerender button on the visualforce page. // updates the values of various cached values. // increases the values of counter and the mydata counter if those // cache values are still in the cache. public pagereference go() { // increase the cached counter value or set it to 0 // if it's not cached. if (cache.org.contains('counter')) { cache.org.put('counter', getcounter() + 1); } else { cache.org.put('counter', 0); } // get the custom data value from the cache. mydata d = (mydata)cache.org.get('data'); // only if the data is already in the cache, update it. if (cache.org.contains('data')) { d.inc(); cache.org.put('data', d); } return null; } // method invoked by the remove button on the visualforce page. // removes the datetime cached value from the org cache. public pagereference remove() { cache.org.remove('datetime'); return null; } } this is the visualforce page that corresponds to the orgcachecontroller class.
cached datetime:
cached data:
cached counter: 181apex reference guide org class
output:
repeat:  
list size:


this is the output of the page after clicking the rerender button twice. the counter value could differ in your case if a key named counter was already in the cache before running this sample. cached datetime:8/11/2015 1:58 pm cached data:some custom value:2 cached counter:2 output:cached text value repeat:one two three four five list size:5 in this section: org constants the org class provides a constant that you can use when setting the time-to-live (ttl) value. org methods see also: apex developer guide: platform cache org constants the org class provides a constant that you can use when setting the time-to-live (ttl) value. constant description max_ttl_secs represents the maximum amount of time, in seconds, to keep the cached value in the org cache. org methods the following are methods for org. all methods are static. 182" "apex reference guide org class in this section: contains(key) returns true if the org cache contains a cached value corresponding to the specified key. contains(keys) returns true if the org cache contains values for the specified key entries. contains(setofkeys) returns true if the org cache contains values for a specified set of keys. get(key) returns the cached value corresponding to the specified key from the org cache. get(cachebuilder, key) returns the cached value corresponding to the specified key from the org cache. use this method if your cached value is a class that implements the cachebuilder interface. get(keys) returns the cached values corresponding to the specified set of keys from the org cache. getavggetsize() returns the average item size of all the keys fetched from the org cache, in bytes. getavggettime() returns the average time taken to get a key from the org cache, in nanoseconds. getavgvaluesize() deprecated and available only in api versions 49.0 and earlier. returns the average item size for keys in the org cache, in bytes. getcapacity() returns the percentage of org cache capacity that has been used. getkeys() returns a set of all keys that are stored in the org cache and visible to the invoking namespace. getmaxgetsize() returns the maximum item size of all the keys fetched from the org cache, in bytes. getmaxgettime() returns the maximum time taken to get a key from the org cache, in nanoseconds. getmaxvaluesize() deprecated and available only in api versions 49.0 and earlier. returns the maximum item size for keys in the org cache, in bytes. getmissrate() returns the miss rate in the org cache. getname() returns the name of the default cache partition. getnumkeys() returns the total number of keys in the org cache. getpartition(partitionname) returns a partition from the org cache that corresponds to the specified partition name. 183apex reference guide org class put(key, value) stores the specified key/value pair as a cached entry in the org cache. the put method can write only to the cache in your org’s namespace. put(key, value, visibility) stores the specified key/value pair as a cached entry in the org cache and sets the cached value’s visibility. put(key, value, ttlsecs) stores the specified key/value pair as a cached entry in the org cache and sets the cached value’s lifetime. put(key, value, ttlsecs, visibility, immutable) stores the specified key/value pair as a cached entry in the org cache. this method also sets the cached value’s lifetime, visibility, and whether it can be overwritten by another namespace. remove(key) deletes the cached value corresponding to the specified key from the org cache. remove(cachebuilder, key) deletes the cached value corresponding to the specified key from the org cache. use this method if your cached value is a class that implements the cachebuilder interface. contains(key) returns true if the org cache contains a cached value corresponding to the specified key. signature public static boolean contains(string key) parameters key type: string a case-sensitive string value that uniquely identifies a cached value. for information about the format of the key name, see usage. return value type: boolean true if a cache entry is found. othewise, false. contains(keys) returns true if the org cache contains values for the specified key entries. signature public static list contains(list keys) parameters keys type: list 184apex reference guide org class a list of keys that identifies cached values. for information about the format of the key name, see usage. return value type: list true if the key entries are found. othewise, false. contains(setofkeys) returns true if the org cache contains values for a specified set of keys. signature public static map contains (set keys) parameters setofkeys type: set a set of keys that uniquely identifies cached values. for information about the format of the key name, see usage return value type: map returns the cache key and corresponding boolean value indicating that the key entry exists. the boolean value is" "false if the key entry doesn't exist. usage the number of input keys cannot exceed the maximum limit of 10. example in this example, the code checks for the presence of multiple keys on the default partition. it fetches the cache key and the corresponding boolean value for the key entry from the org cache of the default partition. set keys = new set{'key1','key2','key3','key4','key5'}; map result = cache.org.contains(keys); for(string key : result.keyset()) { system.debug('key: ' + key); system.debug('is key present in the cache : ' + result.get(key)); } in this example, the code checks for the presence of multiple keys on different partitions. it fetches the cache key and the corresponding boolean value for the key entry from the org cache of different partitions. // assuming there are three partitions p1, p2, p3 with default 'local' namespace set keys = new set{'local.p1.key','local.p2.key', 'local.p3.key'}; map result = cache.org.contains(keys); for(string key : result.keyset()) { 185apex reference guide org class system.debug('key: ' + key); system.debug('is key present in the cache : + result.get(key)); } get(key) returns the cached value corresponding to the specified key from the org cache. signature public static object get(string key) parameters key type: string a case-sensitive string value that uniquely identifies a cached value. for information about the format of the key name, see usage. return value type: object the cached value as a generic object type. cast the returned value to the appropriate type. usage because cache.org.get() returns an object, cast the returned value to a specific type to facilitate use of the returned value. // get a cached value object obj = cache.org.get('ns1.partition1.orderdate'); // cast return value to a specific data type datetime dt2 = (datetime)obj; if a cache.org.get() call doesn’t find the referenced key, it returns null. get(cachebuilder, key) returns the cached value corresponding to the specified key from the org cache. use this method if your cached value is a class that implements the cachebuilder interface. signature public static object get(system.type cachebuilder, string key) parameters cachebuilder type: system.type the apex class that implements the cachebuilder interface. 186apex reference guide org class key type: string a case-sensitive string value that, combined with the class name corresponding to the cachebuilder parameter, uniquely identifies a cached value. return value type: object the cached value as a generic object type. cast the returned value to the appropriate type. usage because cache.org.get(cachebuilder, key) returns an object, cast the returned value to a specific type to facilitate use of the returned value. return ((datetime)cache.org.get(datecache.class, 'datetime')).format(); get(keys) returns the cached values corresponding to the specified set of keys from the org cache. signature public static map get (set keys) parameters keys type: set a set of keys that uniquely identify cached values. for information about the format of the key name, see usage. return value type: map returns the cache key and corresponding value. returns null when no corresponding value is found for an input key. usage the number of input keys cannot exceed the maximum limit of 10. examples fetch multiple keys from the org cache of the default partition. set keys = new set{'key1','key2','key3','key4','key5'}; map result = cache.org.get(keys); for(string key : result.keyset()) { system.debug('key: ' + key); system.debug('value: ' + result.get(key)); } 187apex reference guide org class fetch multiple keys from the org cache of different partitions. // assuming there are three partitions p1, p2, p3 with default 'local' namespace set<" "string> keys = new set{'local.p1.key','local.p2.key', 'local.p3.key'}; map result = cache.org.get(keys); for(string key : result.keyset()) { system.debug('key: ' + key); system.debug('value: ' + result.get(key)); } getavggetsize() returns the average item size of all the keys fetched from the org cache, in bytes. signature public static long getavggetsize() return value type: long example in this example the following keys and their corresponding value sizes are inserted. the code then fetches the keys: key 1, key 2, key 3 and key 4 and returns the average item size of the fetched keys. key key value size key 1 42 key 2 42 key 3 58 key 4 36 key 5 36 // inserting keys key1, key2, key3, key4, key5 cache.org.put('key1', 'value1'); cache.org.put('key2', 'value2'); cache.org.put('key3', 'this is a big value !!!'); cache.org.put('key4', 4); cache.org.put('key5', 5); // fetching keys - key1, key2, key3, key4 object v1 = cache.org.get('key1'); object v2 = cache.org.get('key2'); object v3 = cache.org.get('key3'); object v4 = cache.org.get('key4'); 188apex reference guide org class // fetching average get size long val = cache.org.getavggetsize(); // avg item size returned is 44 ( average of 42(key1), 42(key2), 58(key3) and 36(key4) keys that were fetched ) system.debug('avg get size :' + val); getavggettime() returns the average time taken to get a key from the org cache, in nanoseconds. signature public static long getavggettime() return value type: long getavgvaluesize() deprecated and available only in api versions 49.0 and earlier. returns the average item size for keys in the org cache, in bytes. signature public static long getavgvaluesize() return value type: long getcapacity() returns the percentage of org cache capacity that has been used. signature public static double getcapacity() return value type: double used cache as a percentage number. getkeys() returns a set of all keys that are stored in the org cache and visible to the invoking namespace. 189apex reference guide org class signature public static set getkeys() return value type: set a set containing all cache keys. getmaxgetsize() returns the maximum item size of all the keys fetched from the org cache, in bytes. signature public static long getmaxgetsize() return value type: long example in this example the following keys and their corresponding value sizes are inserted. the code fetches the keys: key 1, key 2 and key 4 and returns the maximum key value size from the fetched keys. key key value size key 1 42 key 2 42 key 3 58 key 4 36 key 5 36 // inserting keys key1, key2, key3, key4, key5 cache.org.put('key1', 'value1'); cache.org.put('key2', 'value2'); cache.org.put('key3', 'this is a big value !!!'); cache.org.put('key4', 4); cache.org.put('key5', 5); // fetching keys - key1, key2, key4 object v1 = cache.org.get('key1'); object v2 = cache.org.get('key2'); object v4 = cache.org.get('key4'); // fetching max get size 190apex reference guide org class long val = cache.org.getmaxgetsize(); // max item size returned is 42 ( max of 42(key1), 42(key2), and 36(key4) keys that were fetched ) system.debug('max get size :' + val); getmaxgettime() returns the maximum time taken to get a key from the org" "cache, in nanoseconds. signature public static long getmaxgettime() return value type: long getmaxvaluesize() deprecated and available only in api versions 49.0 and earlier. returns the maximum item size for keys in the org cache, in bytes. signature public static long getmaxvaluesize() return value type: long getmissrate() returns the miss rate in the org cache. signature public static double getmissrate() return value type: double getname() returns the name of the default cache partition. signature public string getname() 191apex reference guide org class return value type: string the name of the default cache partition. getnumkeys() returns the total number of keys in the org cache. signature public static long getnumkeys() return value type: long getpartition(partitionname) returns a partition from the org cache that corresponds to the specified partition name. signature public static cache.orgpartition getpartition(string partitionname) parameters partitionname type: string a partition name that is qualified by the namespace, for example, namespace.partition. return value type: cache.orgpartition example after you get the org partition, you can add and retrieve the partition’s cache values. // get partition cache.orgpartition orgpart = cache.org.getpartition('myns.mypartition'); // retrieve cache value from the partition if (orgpart.contains('booktitle')) { string cachedtitle = (string)orgpart.get('booktitle'); } // add cache value to the partition orgpart.put('orderdate', date.today()); // or use dot notation to call partition methods string cachedauthor = (string)cache.org.getpartition('myns.mypartition').get('bookauthor'); 192apex reference guide org class put(key, value) stores the specified key/value pair as a cached entry in the org cache. the put method can write only to the cache in your org’s namespace. signature public static void put(string key, object value) parameters key type: string a case-sensitive string value that uniquely identifies a cached value. for information about the format of the key name, see usage. value type: object the value to store in the cache. the cached value must be serializable. return value type: void put(key, value, visibility) stores the specified key/value pair as a cached entry in the org cache and sets the cached value’s visibility. signature public static void put(string key, object value, cache.visibility visibility) parameters key type: string a case-sensitive string value that uniquely identifies a cached value. for information about the format of the key name, see usage. value type: object the value to store in the cache. the cached value must be serializable. visibility type: cache.visibility indicates whether the cached value is available only to apex code that is executing in the same namespace or to apex code executing from any namespace. return value type: void 193apex reference guide org class put(key, value, ttlsecs) stores the specified key/value pair as a cached entry in the org cache and sets the cached value’s lifetime. signature public static void put(string key, object value, integer ttlsecs) parameters key type: string a case-sensitive string value that uniquely identifies a cached value. for information about the format of the key name, see usage. value type: object the value to store in the cache. the cached value must be serializable. ttlsecs type: integer the amount of time, in seconds, to keep the cached value in the org cache. the maximum is 172,800 seconds (48 hours). the minimum value is 300 seconds or 5 minutes. the default value is 86,400 seconds (24 hours). return value type: void put(key, value, ttlsecs, visibility, immutable) stores the specified key/value pair as a cached entry in the org cache. this method also sets the cached value’s lifetime, visibility, and whether it can be overwritten by another namespace. signature public static void put(string key, object value, integer ttlsecs, cache.visibility visibility, boolean immutable) parameters key type: string" "a case-sensitive string value that uniquely identifies a cached value. for information about the format of the key name, see usage. value type: object the value to store in the cache. the cached value must be serializable. ttlsecs type: integer the amount of time, in seconds, to keep the cached value in the org cache. the maximum is 172,800 seconds (48 hours). the minimum value is 300 seconds or 5 minutes. the default value is 86,400 seconds (24 hours). 194apex reference guide org class visibility type: cache.visibility indicates whether the cached value is available only to apex code that is executing in the same namespace or to apex code executing from any namespace. immutable type: boolean indicates whether the cached value can be overwritten by another namespace (false) or not (true). return value type: void remove(key) deletes the cached value corresponding to the specified key from the org cache. signature public static boolean remove(string key) parameters key type: string a case-sensitive string value that uniquely identifies a cached value. for information about the format of the key name, see usage. return value type: boolean true if the cache value was successfully removed. otherwise, false. remove(cachebuilder, key) deletes the cached value corresponding to the specified key from the org cache. use this method if your cached value is a class that implements the cachebuilder interface. signature public static boolean remove(system.type cachebuilder, string key) parameters cachebuilder type: system.type the apex class that implements the cachebuilder interface. key type: string 195apex reference guide orgpartition class a case-sensitive string value that, combined with the class name corresponding to the cachebuilder parameter, uniquely identifies a cached value. return value type: boolean true if the cache value was successfully removed. otherwise, false. orgpartition class contains methods to manage cache values in the org cache of a specific partition. unlike the session cache, the org cache is not tied to any session. it’s available to the organization across requests and to all users. namespace cache usage this class extends cache.partition and inherits all its non-static methods. utility methods for creating and validating keys aren’t supported and can be called only from the cache.partition parent class. for a list of cache.partition methods, see partition methods. to get an org partition, call cache.org.getpartition and pass in a fully qualified partition name, as follows. cache.orgpartition orgpartition = cache.org.getpartition('namespace.mypartition'); see cache key format for partition methods. example this class is the controller for a sample visualforce page (shown in the subsequent code sample). the controller shows how to use the methods of cache.orgpartition to manage a cache value on a particular partition. the controller takes inputs from the visualforce page for the partition name, key name for a counter, and initial counter value. the controller contains default values for these inputs. when you click rerender on the visualforce page, the go() method is invoked and increases the counter by one. when you click remove key, the counter key is removed from the cache. the counter value gets reset to its initial value when it’s re-added to the cache. note: if another user logs in and runs this sample, the user gets the cache values that were last added or updated by the previous user. for example, if the counter value was five, the next user sees the counter value as increased to six. public class orgpartitioncontroller { // name of a partition string partitioninput = 'local.mypartition'; // name of the key string counterkeyinput = 'counter'; // key initial value integer counterinitvalue = 0; // org partition object cache.orgpartition orgpartition; // constructor of the controller for the visualforce page. public orgpartitioncontroller() { 196apex reference guide orgpartition class } // adds counter value to the cache. // this method is called when the visualforce page loads. public void init() { // create the partition instance based on the partition name orgpartition = getpartition(); // create the partition instance based on the partition name // given in the visualforce page or the default value. orgpartition = cache.org.getpartition(partitioninput); // add counter to the cache with an" "initial value // or increment it if it's already there. if (!orgpartition.contains(counterkeyinput)) { orgpartition.put(counterkeyinput, counterinitvalue); } else { orgpartition.put(counterkeyinput, getcounter() + 1); } } // returns the org partition based on the partition name // given in the visualforce page or the default value. private cache.orgpartition getpartition() { if (orgpartition == null) { orgpartition = cache.org.getpartition(partitioninput); } return orgpartition; } // return counter from the cache. public integer getcounter() { return (integer)getpartition().get(counterkeyinput); } // invoked by the submit button to save input values // supplied by the user. public pagereference save() { // reset the initial key value in the cache getpartition().put(counterkeyinput, counterinitvalue); return null; } // method invoked by the rerender button on the visualforce page. // updates the values of various cached values. // increases the values of counter and the mydata counter if those // cache values are still in the cache. public pagereference go() { // get the org partition object orgpartition = getpartition(); // increase the cached counter value or set it to 0 197apex reference guide orgpartition class // if it's not cached. if (orgpartition.contains(counterkeyinput)) { orgpartition.put(counterkeyinput, getcounter() + 1); } else { orgpartition.put(counterkeyinput, counterinitvalue); } return null; } // method invoked by the remove button on the visualforce page. // removes the datetime cached value from the org cache. public pagereference remove() { getpartition().remove(counterkeyinput); return null; } // get and set methods for accessing variables // that correspond to the input text fields on // the visualforce page. public string getpartitioninput() { return partitioninput; } public string getcounterkeyinput() { return counterkeyinput; } public integer getcounterinitvalue() { return counterinitvalue; } public void setpartitioninput(string partition) { this.partitioninput = partition; } public void setcounterkeyinput(string keyname) { this.counterkeyinput = keyname; } public void setcounterinitvalue(integer countervalue) { this.counterinitvalue = countervalue; } } this is the visualforce page that corresponds to the orgpartitioncontroller class.
partition with namespace prefix:
counter key name:
counter initial value: 198apex reference guide partition class

cached counter:

see also: apex developer guide: platform cache partition class base class of cache.orgpartition and cache.sessionpartition. use the subclasses to manage the cache partition for org caches and session caches. namespace cache cache key format for partition methods after you obtain the partition object (an instance of cache.orgpartition or cache.sessionpartition), the methods to add, retrieve, and manage the cache values in a partition take the key name. the key name that you supply to these methods (get(), put(), remove(), and contains()) doesn’t include the namespace.partition prefix. in this section: partition methods see also: org" "partition class sessionpartition class apex developer guide: platform cache partition methods the following are methods for partition. 199apex reference guide partition class in this section: contains(key) returns true if the cache partition contains a cached value corresponding to the specified key. contains(setofkeys) returns true if the cache partition contains values for a specified set of keys. createfullyqualifiedkey(namespace, partition, key) generates a fully qualified key from the passed-in key components. the format of the generated key string is namespace.partition.key. createfullyqualifiedpartition(namespace, partition) generates a fully qualified partition name from the passed-in namespace and partition. the format of the generated partition string is namespace.partition. get(key) returns the cached value corresponding to the specified key from the cache partition. get(keys) returns the cached values corresponding to the specified set of keys from the cache partition. get(cachebuilder, key) returns the cached value corresponding to the specified key from the partition cache. use this method if your cached value is a class that implements the cachebuilder interface. getavggetsize() returns the average item size of all the keys fetched from the partition, in bytes. getavggettime() returns the average time taken to get a key from the partition, in nanoseconds. getavgvaluesize() deprecated and available only in api versions 49.0 and earlier. returns the average item size for keys in the partition, in bytes. getcapacity() returns the percentage of cache used of the total capacity for this partition. getkeys() returns a set of all keys that are stored in the cache partition and visible to the invoking namespace. getmaxgetsize() returns the maximum item size of all the keys fetched from the partition, in bytes. getmaxgettime() returns the maximum time taken to get a key from the partition, in nanoseconds. getmaxvaluesize() deprecated and available only in api versions 49.0 and earlier. returns the maximum item size for keys in the partition, in bytes. getmissrate() returns the miss rate in the partition. getname() returns the name of this cache partition. getnumkeys() returns the total number of keys in the partition. 200apex reference guide partition class isavailable() returns true if the salesforce session is available. only applies to cache.sessionpartition. the session cache isn’t available when an active session isn’t present, such as in asynchronous apex or code called by asynchronous apex. for example, if batch apex causes an apex trigger to execute, the session cache isn’t available in the trigger because the trigger runs in asynchronous context. put(key, value) stores the specified key/value pair as a cached entry in the cache partition. the put method can write only to the cache in your org’s namespace. put(key, value, visibility) stores the specified key/value pair as a cached entry in the cache partition and sets the cached value’s visibility. put(key, value, ttlsecs) stores the specified key/value pair as a cached entry in the cache partition and sets the cached value’s lifetime. put(key, value, ttlsecs, visibility, immutable) stores the specified key/value pair as a cached entry in the cache partition. this method also sets the cached value’s lifetime, visibility, and whether it can be overwritten by another namespace. remove(key) deletes the cached value corresponding to the specified key from this cache partition. remove(cachebuilder, key) deletes the cached value corresponding to the specified key from the partition cache. use this method if your cached value is a class that implements the cachebuilder interface. validatecachebuilder(cachebuilder) validates that the specified class implements the cachebuilder interface. validatekey(isdefault, key) validates a cache key. this method throws a cache.invalidparamexception if the key is not valid. a valid key is not null and contains alphanumeric characters. validatekeyvalue(isdefault, key, value) validates a cache key and ensures that the cache value is non-null. this method throws a cache.invalidparamexception if the key or value is not valid. a valid key is not null and contains alphanumeric characters. validatekeys(isdefault, keys) validates the specified cache keys. this method throws a cache.invalidparamexception if" "the key is not valid. a valid key is not null and contains alphanumeric characters. validatepartitionname(name) validates the partition name — for example, that it is not null. contains(key) returns true if the cache partition contains a cached value corresponding to the specified key. signature public boolean contains(string key) 201apex reference guide partition class parameters key type: string a case-sensitive string value that uniquely identifies a cached value. return value type: boolean true if a cache entry is found. othewise, false. contains(setofkeys) returns true if the cache partition contains values for a specified set of keys. signature public map contains (set keys) parameters setofkeys type: set a set of keys that uniquely identifies cached values. for information about the format of the key name, see usage. return value type: map returns the cache key and corresponding boolean value indicating that the key entry exists. the boolean value is false if the key entry doesn't exist. usage the number of input keys cannot exceed the maximum limit of 10. example in this example, the code checks for the presence of multiple keys on a partition. it fetches the cache key and the corresponding boolean value for the key entry from the org cache of the partition. // assuming there is a partition p1 in the default 'local' namespace set keys = new set{'key1','key2','key3','key4','key5'}; cache.orgpartition orgpart = cache.org.getpartition('local.p1'); map result = orgpart.contains(keys); for(string key : result.keyset()) { system.debug('key: ' + key); system.debug('is key present in the cache:' + result.get(key)); } 202apex reference guide partition class in this example, the code checks for the presence of multiple keys on a partition. it fetches the cache key and the corresponding boolean value for the key entry from the session cache of the partition. // assuming there are three partitions p1, p2, p3 with default 'local' namespace set keys = new set{'key1','key2','key3','key4','key5'}; cache.sessionpartition sessionpart = cache.session.getpartition('local.p1'); map result = sessionpart.contains(keys); for(string key : result.keyset()) { system.debug('key: ' + key); system.debug('value: ' + result.get(key)); } createfullyqualifiedkey(namespace, partition, key) generates a fully qualified key from the passed-in key components. the format of the generated key string is namespace.partition.key. signature public static string createfullyqualifiedkey(string namespace, string partition, string key) parameters namespace type: string the namespace of the cache key. partition type: string the partition of the cache key. key type: string the name of the cache key. return value type: string createfullyqualifiedpartition(namespace, partition) generates a fully qualified partition name from the passed-in namespace and partition. the format of the generated partition string is namespace.partition. signature public static string createfullyqualifiedpartition(string namespace, string partition) 203apex reference guide partition class parameters namespace type: string the namespace of the cache key. partition type: string the partition of the cache key. return value type: string get(key) returns the cached value corresponding to the specified key from the cache partition. signature public object get(string key) parameters key type: string a case-sensitive string value that uniquely identifies a cached value. return value type: object the cached value as a generic object type. cast the returned value to the appropriate type. get(keys) returns the cached values corresponding to the specified set of keys from the cache partition. signature public map get (set keys) parameters keys type: set a set of keys that uniquely identify cached values. for information about the format of the key name, see usage. return value" "type: map 204apex reference guide partition class returns the cache key and corresponding value. returns null when no corresponding value is found for an input key. usage the number of input keys cannot exceed the maximum limit of 10. examples fetch multiple keys from the org cache of a partition. // assuming there is a partition p1 in the default 'local' namespace set keys = new set{'key1','key2','key3','key4','key5'}; cache.orgpartition orgpart = cache.org.getpartition('local.p1'); map result = orgpart.get(keys); for(string key : result.keyset()) { system.debug('key: ' + key); system.debug('value: ' + result.get(key)); } fetch multiple keys from the session cache of a partition. // assuming there is a partition p1 in the default 'local' namespace set keys = new set{'key1','key2','key3','key4','key5'}; cache.sessionpartition sessionpart = cache.session.getpartition('local.p1'); map result = sessionpart.get(keys); for(string key : result.keyset()) { system.debug('key: ' + key); system.debug('value: ' + result.get(key)); } get(cachebuilder, key) returns the cached value corresponding to the specified key from the partition cache. use this method if your cached value is a class that implements the cachebuilder interface. signature public object get(system.type cachebuilder, string key) parameters cachebuilder type: system.type the apex class that implements the cachebuilder interface. key type: string a case-sensitive string value that, combined with the class name corresponding to the cachebuilder parameter, uniquely identifies a cached value. 205apex reference guide partition class return value type: object the cached value as a generic object type. cast the returned value to the appropriate type. getavggetsize() returns the average item size of all the keys fetched from the partition, in bytes. signature public long getavggetsize() return value type: long getavggettime() returns the average time taken to get a key from the partition, in nanoseconds. signature public long getavggettime() return value type: long getavgvaluesize() deprecated and available only in api versions 49.0 and earlier. returns the average item size for keys in the partition, in bytes. signature public long getavgvaluesize() return value type: long getcapacity() returns the percentage of cache used of the total capacity for this partition. signature public double getcapacity() 206apex reference guide partition class return value type: double used partition cache as a percentage number. getkeys() returns a set of all keys that are stored in the cache partition and visible to the invoking namespace. signature public set getkeys() return value type: set a set containing all cache keys. getmaxgetsize() returns the maximum item size of all the keys fetched from the partition, in bytes. signature public long getmaxgetsize() return value type: long getmaxgettime() returns the maximum time taken to get a key from the partition, in nanoseconds. signature public long getmaxgettime() return value type: long getmaxvaluesize() deprecated and available only in api versions 49.0 and earlier. returns the maximum item size for keys in the partition, in bytes. signature public long getmaxvaluesize() 207apex reference guide partition class return value type: long getmissrate() returns the miss rate in the partition. signature public double getmissrate() return value type: double getname() returns the name of this cache partition. signature public string getname() return value type: string the name of this cache partition. getnumkeys() returns the total number of keys in the partition. signature public long getnumkeys() return value type: long isavailable() returns true if the salesforce session is available. only applies to cache.sessionpartition. the session cache isn’t available when an active session isn’t present," "such as in asynchronous apex or code called by asynchronous apex. for example, if batch apex causes an apex trigger to execute, the session cache isn’t available in the trigger because the trigger runs in asynchronous context. signature public boolean isavailable() 208apex reference guide partition class return value type: boolean put(key, value) stores the specified key/value pair as a cached entry in the cache partition. the put method can write only to the cache in your org’s namespace. signature public void put(string key, object value) parameters key type: string a case-sensitive string value that uniquely identifies a cached value. value type: object the value to store in the cache. the cached value must be serializable. return value type: void put(key, value, visibility) stores the specified key/value pair as a cached entry in the cache partition and sets the cached value’s visibility. signature public void put(string key, object value, cache.visibility visibility) parameters key type: string a case-sensitive string value that uniquely identifies a cached value. value type: object the value to store in the cache. the cached value must be serializable. visibility type: cache.visibility indicates whether the cached value is available only to apex code that is executing in the same namespace or to apex code executing from any namespace. 209apex reference guide partition class return value type: void put(key, value, ttlsecs) stores the specified key/value pair as a cached entry in the cache partition and sets the cached value’s lifetime. signature public void put(string key, object value, integer ttlsecs) parameters key type: string a case-sensitive string value that uniquely identifies a cached value. value type: object the value to store in the cache. the cached value must be serializable. ttlsecs type: integer the amount of time, in seconds, to keep the cached value in the cache. return value type: void put(key, value, ttlsecs, visibility, immutable) stores the specified key/value pair as a cached entry in the cache partition. this method also sets the cached value’s lifetime, visibility, and whether it can be overwritten by another namespace. signature public void put(string key, object value, integer ttlsecs, cache.visibility visibility, boolean immutable) parameters key type: string a case-sensitive string value that uniquely identifies a cached value. value type: object the value to store in the cache. the cached value must be serializable. ttlsecs type: integer 210apex reference guide partition class the amount of time, in seconds, to keep the cached value in the cache. visibility type: cache.visibility indicates whether the cached value is available only to apex code that is executing in the same namespace or to apex code executing from any namespace. immutable type: boolean indicates whether the cached value can be overwritten by another namespace (false) or not (true). return value type: void remove(key) deletes the cached value corresponding to the specified key from this cache partition. signature public boolean remove(string key) parameters key type: string a case-sensitive string value that uniquely identifies a cached value. return value type: boolean true if the cache value was successfully removed. otherwise, false. remove(cachebuilder, key) deletes the cached value corresponding to the specified key from the partition cache. use this method if your cached value is a class that implements the cachebuilder interface. signature public boolean remove(system.type cachebuilder, string key) parameters cachebuilder type: system.type the apex class that implements the cachebuilder interface. key type: string 211apex reference guide partition class a case-sensitive string value that, combined with the class name corresponding to the cachebuilder parameter, uniquely identifies a cached value. return value type: boolean true if the cache value was successfully removed. otherwise, false. validatecachebuilder(cachebuilder) validates that the specified class implements the cachebuilder interface. signature public static void validatecachebuilder(system.type cachebuilder) parameters cachebuilder type: system.type the class to validate. return value type: void validatekey(isdefault, key) validates a cache key" ". this method throws a cache.invalidparamexception if the key is not valid. a valid key is not null and contains alphanumeric characters. signature public static void validatekey(boolean isdefault, string key) parameters isdefault type: boolean set to true if the key references a default partition. otherwise, set to false. key type: string the key to validate. return value type: void 212apex reference guide partition class validatekeyvalue(isdefault, key, value) validates a cache key and ensures that the cache value is non-null. this method throws a cache.invalidparamexception if the key or value is not valid. a valid key is not null and contains alphanumeric characters. signature public static void validatekeyvalue(boolean isdefault, string key, object value) parameters isdefault type: boolean set to true if the key references a default partition. otherwise, set to false. key type: string the key to validate. value type: object the cache value to validate. return value type: void validatekeys(isdefault, keys) validates the specified cache keys. this method throws a cache.invalidparamexception if the key is not valid. a valid key is not null and contains alphanumeric characters. signature public static void validatekeys(boolean isdefault, set keys) parameters isdefault type: boolean set to true if the key references a default partition. otherwise, set to false. keys type: set a set of key string values to validate. return value type: void 213apex reference guide session class validatepartitionname(name) validates the partition name — for example, that it is not null. signature public static void validatepartitionname(string name) parameters name type: string the name of the partition to validate. return value type: void session class use the cache.session class to add, retrieve, and manage values in the session cache. the session cache is active as long as the user’s salesforce session is valid (the user is logged in, and the session is not expired). namespace cache usage cache key format this table lists the format of the key parameter that some methods in this class take, such as put, get, and contains. key format description namespace.partition.key fully qualified key name. key refers to a partition marked as default when the namespace.partition prefix is omitted. local.partition.key use the local prefix to refer to the org’s namespace when the org doesn’t have a namespace defined. if the org has a namespace defined, the local prefix also refers to that org’s namespace. note: • if no default partition is specified in the org, calling a cache method without fully qualifying the key name causes a cache.session.sessioncacheexception to be thrown. • the local prefix in an installed managed package refers to the namespace of the subscriber org and not the package’s namespace. the cache put calls are not allowed in a partition that the invoking class doesn’t own. 214apex reference guide session class example this class is the controller for a sample visualforce page (shown in the subsequent code sample). the cached values are initially added to the cache by the init() method, which the visualforce page invokes when it loads through the action attribute. the cache keys don’t contain the namespace.partition prefix. they all refer to a default partition in your org. the visualforce page expects a partition named mypartition. to run this sample, create a default partition in your org with the name mypartition. the visualforce page contains four output components. the first three components call get methods on the controller that return the following values from the cache: a date, data based on the mydata inner class, and a counter. the next output component uses the $cache.session global variable to get the cached string value for the key named output. next, the $cache.session global variable is used again in the visualforce page to iterate over the elements of a cached value of type list. the size of the list is also returned. the visualforce page also contains two buttons. the rerender button invokes the go() method on the controller. this method increases the values of the counter and the custom data in the cache. if you click rerender, the two counters increase by one each time. the go() method retrieves the values of these counters from the" "cache, increments their values by one, and stores them again in the cache. the remove button deletes the date-time value (with key datetime) from the cache. as a result, the value next to cached datetime: is cleared on the page. public class sessioncachecontroller { // inner class. // used as the data type of a cache value. class mydata { public string value { get; set; } public integer counter { get; set; } public mydata(string value) { this.value = value; this.counter = 0; } public void inc() { counter++; } override public string tostring() { return this.value + ':' + this.counter; } } // apex list. // used as the data type of a cached value. private list numbers = new list { 'one', 'two', 'three', 'four', 'five' }; // constructor of the controller for the visualforce page. public sessioncachecontroller() { } // adds various values to the cache. // this method is called when the visualforce page loads. public void init() { 215apex reference guide session class // all key values are not qualified by the namespace.partition // prefix because they use the default partition. // add counter to the cache with initial value of 0 // or increment it if it's already there. if (!cache.session.contains('counter')) { cache.session.put('counter', 0); } else { cache.session.put('counter', getcounter() + 1); } // add the datetime value to the cache only if it's not already there. if (!cache.session.contains('datetime')) { datetime dt = datetime.now(); cache.session.put('datetime', dt); } // add the custom data to the cache only if it's not already there. if (!cache.session.contains('data')) { cache.session.put('data', new mydata('some custom value')); } // add a list of number to the cache if not already there. if (!cache.session.contains('list')) { cache.session.put('list', numbers); } // add a string value to the cache if not already there. if (!cache.session.contains('output')) { cache.session.put('output', 'cached text value'); } } // return counter from the cache. public integer getcounter() { return (integer)cache.session.get('counter'); } // return datetime value from the cache. public string getcacheddatetime() { datetime dt = (datetime)cache.session.get('datetime'); return dt != null ? dt.format() : null; } // return cached value whose type is the inner class mydata. public string getcacheddata() { mydata mydata = (mydata)cache.session.get('data'); return mydata != null ? mydata.tostring() : null; } // method invoked by the rerender button on the visualforce page. // updates the values of various cached values. // increases the values of counter and the mydata counter if those // cache values are still in the cache. 216apex reference guide session class public pagereference go() { // increase the cached counter value or set it to 0 // if it's not cached. if (cache.session.contains('counter')) { cache.session.put('counter', getcounter() + 1); } else { cache.session.put('counter', 0); } // get the custom data value from the cache. mydata d = (mydata)cache.session.get('data'); // only if the data is already in the cache, update it. if (cache.session.contains('data')) { d.inc(); cache.session.put('data', d); } return null; } // method invoked by the remove button on the visualforce page. // removes the datetime cached value from the session cache. public pagereference remove() { cache.session.remove('datetime'); return null; } } this is the visualforce page that corresponds to the sessioncachecontroller class.
cached datetime:
cached data:
cached counter:
output:
repeat:  
list size:


217apex reference guide session class this is the output of the page after clicking the rerender button twice. the counter value could differ in your case if a key named counter was already in the cache before running this sample. cached datetime:8/11/2015 1:58 pm cached data:some custom value:2 cached counter:2 output:cached text value repeat:one two three four five list size:5 in this section: session constants the session class provides a constant that you can use when setting the time-to-live (ttl) value. session methods see also: apex developer guide: platform cache session constants the session class provides a constant that you can use when setting the time-to-live (ttl) value. constant description max_ttl_secs represents the maximum amount of time, in seconds, to keep the cached value in the session cache. session methods the following are methods for session. all methods are static. in this section: contains(key) returns true if the session cache contains a cached value corresponding to the specified key. contains(setofkeys) returns true if the cache contains values for a specified set of keys. get(key) returns the cached value corresponding to the specified key from the session cache. get(keys) returns the cached values corresponding to the specified set of keys from the session cache. get(cachebuilder, key) returns the cached value corresponding to the specified key from the session cache. use this method if your cached value is a class that implements the cachebuilder interface. 218apex reference guide session class getavggetsize() returns the average item size of all the keys fetched from the session cache, in bytes. getavggettime() returns the average time taken to get a key from the session cache, in nanoseconds. getavgvaluesize() deprecated and available only in api versions 49.0 and earlier. returns the average item size for keys in the session cache, in bytes. getcapacity() returns the percentage of session cache capacity that has been used. getkeys() returns all keys that are stored in the session cache and visible to the invoking namespace. getmaxgetsize() returns the maximum item size of all the keys fetched from the session cache, in bytes. getmaxgettime() returns the maximum time taken to get a key from the session cache, in nanoseconds. getmaxvaluesize() deprecated and available only in api versions 49.0 and earlier. returns the maximum item size for keys in the session cache, in bytes. getmissrate() returns the miss rate in the session cache. getname() returns the name of the default cache partition. getnumkeys() returns the total number of keys in the session cache. getpartition(partitionname) returns a partition from the session cache that corresponds to the specified partition name. isavailable() returns true if the session cache is available for use. the session cache isn’t available when an active session isn’t present, such as in asynchronous apex or code called by asynchronous apex. for example, if batch apex causes an apex trigger to execute, the session cache isn’t available in the trigger" "because the trigger runs in asynchronous context. put(key, value) stores the specified key/value pair as a cached entry in the session cache. the put method can write only to the cache in your org’s namespace. put(key, value, visibility) stores the specified key/value pair as a cached entry in the session cache and sets the cached value’s visibility. put(key, value, ttlsecs) stores the specified key/value pair as a cached entry in the session cache and sets the cached value’s lifetime. put(key, value, ttlsecs, visibility, immutable) stores the specified key/value pair as a cached entry in the session cache. this method also sets the cached value’s lifetime, visibility, and whether it can be overwritten by another namespace. 219apex reference guide session class remove(key) deletes the cached value corresponding to the specified key from the session cache. remove(cachebuilder, key) deletes the cached value corresponding to the specified key from the session cache. use this method if your cached value is a class that implements the cachebuilder interface. contains(key) returns true if the session cache contains a cached value corresponding to the specified key. signature public static boolean contains(string key) parameters key type: string a case-sensitive string value that uniquely identifies a cached value. for information about the format of the key name, see usage. return value type: boolean true if a cache entry is found. othewise, false. contains(setofkeys) returns true if the cache contains values for a specified set of keys. signature public static map contains (set keys) parameters setofkeys type: set a set of keys that uniquely identifies cached values. for information about the format of the key name, see usage. return value type: map returns the cache key and corresponding boolean value indicating that the key entry exists. the boolean value is false if the key entry doesn't exist. usage the number of input keys cannot exceed the maximum limit of 10. 220apex reference guide session class example in this example, the code checks for the presence of multiple keys on the default partition. it fetches the cache key and the corresponding boolean value for the key entry from the session cache of the default partition. set keys = new set{'key1','key2','key3','key4','key5'}; map result = cache.session.contains(keys); for(string key : result.keyset()) { system.debug('key: ' + key); system.debug('is key present in the cache : ' + result.get(key)); } in this example, the code checks for the presence of multiple keys on different partitions. it fetches the cache key and the corresponding boolean value for the key entry from the session cache of different partitions. // assuming there are three partitions p1, p2, p3 with default 'local' namespace set keys = new set{'local.p1.key','local.p2.key', 'local.p3.key'}; map result = cache.session.contains(keys); for(string key : result.keyset()) { system.debug('key: ' + key); system.debug('is key present in the cache : + result.get(key)); } get(key) returns the cached value corresponding to the specified key from the session cache. signature public static object get(string key) parameters key type: string a case-sensitive string value that uniquely identifies a cached value. for information about the format of the key name, see usage. return value type: object the cached value as a generic object type. cast the returned value to the appropriate type. usage because cache.session.get() returns an object, we recommend that you cast the returned value to a specific type to facilitate use of the returned value. // get a cached value object obj = cache.session.get('ns1.partition1.orderdate'); // cast return value to a specific data type datetime dt2 = (datetime)obj; 221apex reference guide session class if a cache.session.get() call doesn’t find the referenced key, it returns null. get(keys) returns the cached values corresponding to the specified set" "of keys from the session cache. signature public static map get (set keys) parameters keys type: set a set of keys that uniquely identify cached values. for information about the format of the key name, see usage. return value type: map returns the cache key and corresponding value. returns null when no corresponding value is found for an input key. usage the number of input keys cannot exceed the maximum limit of 10. example fetch multiple keys from the session cache of the default partition. set keys = new set{'key1','key2','key3','key4','key5'}; map result = cache.session.get(keys); for(string key : result.keyset()) { system.debug('key: ' + key); system.debug('value: ' + result.get(key)); } fetch multiple keys from the session cache of different partitions. // assuming there are three partitions p1, p2, p3 with default 'local' namespace set keys = new set{'local.p1.key','local.p2.key', 'local.p3.key'}; map result = cache.session.get(keys); for(string key : result.keyset()) { system.debug('key: ' + key); system.debug('value: ' + result.get(key)); } get(cachebuilder, key) returns the cached value corresponding to the specified key from the session cache. use this method if your cached value is a class that implements the cachebuilder interface. 222apex reference guide session class signature public static object get(system.type cachebuilder, string key) parameters cachebuilder type: system.type the apex class that implements the cachebuilder interface. key type: string a case-sensitive string value that, combined with the class name corresponding to the cachebuilder parameter, uniquely identifies a cached value. return value type: object the cached value as a generic object type. cast the returned value to the appropriate type. usage because cache.session.get(cachebuilder, key) returns an object, cast the returned value to a specific type to facilitate use of the returned value. return ((datetime)cache.session.get(datecache.class, 'datetime')).format(); getavggetsize() returns the average item size of all the keys fetched from the session cache, in bytes. signature public static long getavggetsize() return value type: long getavggettime() returns the average time taken to get a key from the session cache, in nanoseconds. signature public static long getavggettime() return value type: long 223apex reference guide session class getavgvaluesize() deprecated and available only in api versions 49.0 and earlier. returns the average item size for keys in the session cache, in bytes. signature public static long getavgvaluesize() return value type: long getcapacity() returns the percentage of session cache capacity that has been used. signature public static double getcapacity() return value type: double used cache as a percentage number. getkeys() returns all keys that are stored in the session cache and visible to the invoking namespace. signature public static set getkeys() return value type: set a set containing all cache keys. getmaxgetsize() returns the maximum item size of all the keys fetched from the session cache, in bytes. signature public static long getmaxgetsize() return value type: long 224apex reference guide session class getmaxgettime() returns the maximum time taken to get a key from the session cache, in nanoseconds. signature public static long getmaxgettime() return value type: long getmaxvaluesize() deprecated and available only in api versions 49.0 and earlier. returns the maximum item size for keys in the session cache, in bytes. signature public static long getmaxvaluesize() return value type: long getmissrate() returns the miss rate in the session cache. signature public static double getmissrate() return value type: double getname() returns the name of the default cache partition. signature public string getname() return value type: string" "the name of the default cache partition. 225apex reference guide session class getnumkeys() returns the total number of keys in the session cache. signature public static long getnumkeys() return value type: long getpartition(partitionname) returns a partition from the session cache that corresponds to the specified partition name. signature public static cache.sessionpartition getpartition(string partitionname) parameters partitionname type: string a partition name that is qualified by the namespace, for example, namespace.partition. return value type: cache.sessionpartition example after you get the session partition, you can add and retrieve the partition’s cache values. // get partition cache.sessionpartition sessionpart = cache.session.getpartition('myns.mypartition'); // retrieve cache value from the partition if (sessionpart.contains('booktitle')) { string cachedtitle = (string)sessionpart.get('booktitle'); } // add cache value to the partition sessionpart.put('orderdate', date.today()); // or use dot notation to call partition methods string cachedauthor = (string)cache.session.getpartition('myns.mypartition').get('bookauthor'); 226apex reference guide session class isavailable() returns true if the session cache is available for use. the session cache isn’t available when an active session isn’t present, such as in asynchronous apex or code called by asynchronous apex. for example, if batch apex causes an apex trigger to execute, the session cache isn’t available in the trigger because the trigger runs in asynchronous context. signature public static boolean isavailable() return value type: boolean true if the session cache is available. otherwise, false. put(key, value) stores the specified key/value pair as a cached entry in the session cache. the put method can write only to the cache in your org’s namespace. signature public static void put(string key, object value) parameters key type: string a string that uniquely identifies the value to be cached. for information about the format of the key name, see usage. value type: object the value to store in the cache. the cached value must be serializable. return value type: void put(key, value, visibility) stores the specified key/value pair as a cached entry in the session cache and sets the cached value’s visibility. signature public static void put(string key, object value, cache.visibility visibility) parameters key type: string 227apex reference guide session class a string that uniquely identifies the value to be cached. for information about the format of the key name, see usage. value type: object the value to store in the cache. the cached value must be serializable. visibility type: cache.visibility indicates whether the cached value is available only to apex code that is executing in the same namespace or to apex code executing from any namespace. return value type: void put(key, value, ttlsecs) stores the specified key/value pair as a cached entry in the session cache and sets the cached value’s lifetime. signature public static void put(string key, object value, integer ttlsecs) parameters key type: string a string that uniquely identifies the value to be cached. for information about the format of the key name, see usage. value type: object the value to store in the cache. the cached value must be serializable. ttlsecs type: integer the amount of time, in seconds, to keep the cached value in the session cache. the cached values remain in the cache as long as the salesforce session hasn’t expired. the maximum value is 28,800 seconds or eight hours. the minimum value is 300 seconds or five minutes. return value type: void put(key, value, ttlsecs, visibility, immutable) stores the specified key/value pair as a cached entry in the session cache. this method also sets the cached value’s lifetime, visibility, and whether it can be overwritten by another namespace. 228apex reference guide session class signature public static void put(string key, object value, integer ttlsecs, cache.visibility visibility, boolean immutable) parameters key type: string a string that uniquely identifies the value to be cached. for information about the format of the key name, see usage" ". value type: object the value to store in the cache. the cached value must be serializable. ttlsecs type: integer the amount of time, in seconds, to keep the cached value in the session cache. the cached values remain in the cache as long as the salesforce session hasn’t expired. the maximum value is 28,800 seconds or eight hours. the minimum value is 300 seconds or five minutes. visibility type: cache.visibility indicates whether the cached value is available only to apex code that is executing in the same namespace or to apex code executing from any namespace. immutable type: boolean indicates whether the cached value can be overwritten by another namespace (false) or not (true). return value type: void remove(key) deletes the cached value corresponding to the specified key from the session cache. signature public static boolean remove(string key) parameters key type: string a case-sensitive string value that uniquely identifies a cached value. for information about the format of the key name, see usage. return value type: boolean 229apex reference guide sessionpartition class true if the cache value was successfully removed. otherwise, false. remove(cachebuilder, key) deletes the cached value corresponding to the specified key from the session cache. use this method if your cached value is a class that implements the cachebuilder interface. signature public static boolean remove(system.type cachebuilder, string key) parameters cachebuilder type: system.type the apex class that implements the cachebuilder interface. key type: string a case-sensitive string value that, combined with the class name corresponding to the cachebuilder parameter, uniquely identifies a cached value. return value type: boolean true if the cache value was successfully removed. otherwise, false. sessionpartition class contains methods to manage cache values in the session cache of a specific partition. namespace cache usage this class extends cache.partition and inherits all of its non-static methods. utility methods for creating and validating keys are not supported and can be called only from the cache.partition parent class. for a list of cache.partition methods, see partition methods. to get a session partition, call cache.session.getpartition and pass in a fully qualified partition name, as follows. cache.sessionpartition sessionpartition = cache.session.getpartition('namespace.mypartition'); see cache key format for partition methods. 230apex reference guide sessionpartition class example this class is the controller for a sample visualforce page (shown in the subsequent code sample). the controller shows how to use the methods of cache.sessionpartition to manage a cache value on a particular partition. the controller takes inputs from the visualforce page for the partition name, key name for a counter, and initial counter value. the controller contains default values for these inputs. when you click rerender on the visualforce page, the go() method is invoked and increases the counter by one. when you click remove key, the counter key is removed from the cache. the counter value gets reset to its initial value when it’s re-added to the cache. public class sessionpartitioncontroller { // name of a partition in the local namespace string partitioninput = 'local.mypartition'; // name of the key string counterkeyinput = 'counter'; // key initial value integer counterinitvalue = 0; // session partition object cache.sessionpartition sessionpartition; // constructor of the controller for the visualforce page. public sessionpartitioncontroller() { } // adds counter value to the cache. // this method is called when the visualforce page loads. public void init() { // create the partition instance based on the partition name sessionpartition = getpartition(); // add counter to the cache with an initial value // or increment it if it's already there. if (!sessionpartition.contains(counterkeyinput)) { sessionpartition.put(counterkeyinput, counterinitvalue); } else { sessionpartition.put(counterkeyinput, getcounter() + 1); } } // returns the session partition based on the partition name // given in the visualforce page or the default value. private cache.sessionpartition getpartition() { if (sessionpartition == null) { sessionpartition = cache.session.getpartition(partitioninput); } return sessionpartition; } // return counter from the cache." "public integer getcounter() { return (integer)getpartition().get(counterkeyinput); } 231apex reference guide sessionpartition class // invoked by the submit button to save input values // supplied by the user. public pagereference save() { // reset the initial key value in the cache getpartition().put(counterkeyinput, counterinitvalue); return null; } // method invoked by the rerender button on the visualforce page. // updates the values of various cached values. // increases the values of counter and the mydata counter if those // cache values are still in the cache. public pagereference go() { // get the partition object sessionpartition = getpartition(); // increase the cached counter value or set it to 0 // if it's not cached. if (sessionpartition.contains(counterkeyinput)) { sessionpartition.put(counterkeyinput, getcounter() + 1); } else { sessionpartition.put(counterkeyinput, counterinitvalue); } return null; } // method invoked by the remove button on the visualforce page. // removes the datetime cached value from the session cache. public pagereference remove() { getpartition().remove(counterkeyinput); return null; } // get and set methods for accessing variables // that correspond to the input text fields on // the visualforce page. public string getpartitioninput() { return partitioninput; } public string getcounterkeyinput() { return counterkeyinput; } public integer getcounterinitvalue() { return counterinitvalue; } public void setpartitioninput(string partition) { this.partitioninput = partition; } 232" "apex reference guide cache exceptions public void setcounterkeyinput(string keyname) { this.counterkeyinput = keyname; } public void setcounterinitvalue(integer countervalue) { this.counterinitvalue = countervalue; } } this is the visualforce page that corresponds to the sessionpartitioncontroller class.
partition with namespace prefix:
counter key name:
counter initial value:

cached counter:

see also: apex developer guide: platform cache cache exceptions the cache namespace contains exception classes. all exception classes support built-in methods for returning the error message and exception type. see exception class and built-in exceptions on page 3021 in the apex developer guide. the cache namespace contains these exceptions. exception thrown when cache.session.sessioncacheexception an error occurred while adding or retrieving a value in the session cache. cache.session.sessioncachenosessionexception an attempt is made to access the cache when the session cache isn’t available. 233apex reference guide visibility enum exception thrown when cache.org.orgcacheexception an attempt is made to access a partition that doesn’t exist or whose name is invalid. cache.invalidparamexception an invalid parameter value is passed into a method of cache.session or cache.org. this error occurs when: • the key referenced is null or empty or is not alphanumeric. • the key isn’t qualified with the namespace and partition in the format ... • the key isn’t qualified in the format for the default partition, or for a key inserted through the partition object. • the namespace referenced is null or empty. • the partition name is null or empty or is not alphanumeric. • another referenced value is null. cache.itemsizelimitexceededexception a cache put call is made with an item that exceeds the maximum size limit. to fix this error, break the item into multiple, smaller items. cache.bulkapikeyslimitexceededexception the number of key parameters passed into a bulk method - get(keys) or contains(setofkeys) exceeds the maximum limit of 10. cache.platformcacheinvalidoperationexception a cache put or remove call is made that is not allowed. for example, when calling put or remove inside a visualforce constructor. cache.cachebuilderexecutionexception this error occurs when the execution of the cachebuilder fails; this could be due to an error in parsing, a permissions error while accessing records, or an issue with apex callouts. cache.invalidcachebuilderexception a get(cachebuilder cb, string key), remove(cachebuilder cb, string key), or validatecachebuilder(cachebuilder cb) method is called but the cb parameter is a class that does not implement the cache.cachebuilder interface. visibility enum use the cache.visibility enumeration in the cache.session or cache.org methods to indicate whether a cached value is visible only in the value’s namespace or in all namespaces. enum values the following are the values of the cache.visibility enum. 234apex reference guide canvas namespace value description all the cached value is available to apex code executing from any namespace. this is the default state. namespace the cached value is available to apex code executing from the same namespace. if a key has the visibility.namespace attribute, a get method initiated from a different namespace returns null." "canvas namespace the canvas namespace provides an interface and classes for canvas apps in salesforce. the following are the interfaces and classes in the canvas namespace. in this section: applicationcontext interface use this interface to retrieve application context information, such as the application version or url. canvaslifecyclehandler interface implement this interface to control context information and add custom behavior during the application render phase. contexttypeenum enum describes context data that can be excluded from canvas app context data. you specify which context types to exclude in the excludecontexttypes() method in your canvaslifecyclehandler implementation. environmentcontext interface use this interface to retrieve environment context information, such as the app display location or the configuration parameters. rendercontext interface a wrapper interface that is used to retrieve application and environment context information. test class contains methods for automated testing of your canvas classes. canvas exceptions the canvas namespace contains exception classes. applicationcontext interface use this interface to retrieve application context information, such as the application version or url. namespace canvas 235apex reference guide applicationcontext interface usage the applicationcontext interface provides methods to retrieve application information about the canvas app that’s being rendered. most of the methods are read-only. for this interface, you don’t need to create an implementation. use the default implementation that salesforce provides. in this section: applicationcontext methods applicationcontext methods the following are methods for applicationcontext. in this section: getcanvasurl() retrieves the fully qualified url of the canvas app. getdevelopername() retrieves the internal api name of the canvas app. getname() retrieves the name of the canvas app. getnamespace() retrieves the namespace prefix of the canvas app. getversion() retrieves the current version of the canvas app. setcanvasurlpath(newpath) overrides the url of the canvas app for the current request. getcanvasurl() retrieves the fully qualified url of the canvas app. signature public string getcanvasurl() return value type: string usage use this method to get the url of the canvas app, for example: http://instance.salesforce.com:8080/canvas_app_path/canvas_app.jsp. 236apex reference guide applicationcontext interface getdevelopername() retrieves the internal api name of the canvas app. signature public string getdevelopername() return value type: string usage use this method to get the api name of the canvas app. you specify this value in the api name field when you expose the canvas app by creating a connected app. getname() retrieves the name of the canvas app. signature public string getname() return value type: string usage use this method to get the name of the canvas app. getnamespace() retrieves the namespace prefix of the canvas app. signature public string getnamespace() return value type: string usage use this method to get the salesforce namespace prefix that’s associated with the canvas app. 237apex reference guide canvaslifecyclehandler interface getversion() retrieves the current version of the canvas app. signature public string getversion() return value type: string usage use this method to get the current version of the canvas app. this value changes after you update and republish a canvas app in an organization. if you are in a developer edition organization, using this method always returns the latest version. setcanvasurlpath(newpath) overrides the url of the canvas app for the current request. signature public void setcanvasurlpath(string newpath) parameters newpath type: string the url (not including domain) that you need to use to override the canvas app url. return value type: void usage use this method to override the url path and query string of the canvas app. do not provide a fully qualified url, because the provided url string will be appended to the original canvas url domain. for example, if the current canvas app url is https://myserver.com:6000/myapppath and you call setcanvasurlpath('/alternatepath/args?arg1=1&arg2=2'), the adjusted canvas app url will be https://myserver.com:6000/alternatepath/args?arg1=1&arg2=2. if the provided path results in a" "malformed url, or a url that exceeds 2,048 characters, a system.canvasexception will be thrown. this method overrides the canvas app url for the current request and does not permanently change the canvas app url as configured in the ui for the salesforce canvas app settings. canvaslifecyclehandler interface implement this interface to control context information and add custom behavior during the application render phase. 238apex reference guide canvaslifecyclehandler interface namespace canvas usage use this interface to specify what canvas context information is provided to your app by implementing the excludecontexttypes() method. use this interface to call custom code when the app is rendered by implementing the onrender() method. if you provide an implementation of this interface, you must implement excludecontexttypes() and onrender(). example implementation the following example shows a simple implementation of canvaslifecyclehandler that specifies that organization context information will be excluded and prints a debug message when the app is rendered. public class mycanvaslistener implements canvas.canvaslifecyclehandler{ public set excludecontexttypes(){ set excluded = new set(); excluded.add(canvas.contexttypeenum.organization); return excluded; } public void onrender(canvas.rendercontext rendercontext){ system.debug('canvas lifecycle called.'); } } in this section: canvaslifecyclehandler methods canvaslifecyclehandler methods the following are methods for canvaslifecyclehandler. in this section: excludecontexttypes() lets the implementation exclude parts of the canvasrequest context, if the application does not need it. onrender(rendercontext) invoked when a canvas app is rendered. provides the ability to set and retrieve canvas application and environment context information during the application render phase. excludecontexttypes() lets the implementation exclude parts of the canvasrequest context, if the application does not need it. 239apex reference guide canvaslifecyclehandler interface signature public set excludecontexttypes() return value type: set this method must return null or a set of zero or more contexttypeenum values. returning null enables all attributes by default. contexttypeenum values that can be set are: • canvas.contexttypeenum.organization • canvas.contexttypeenum.record_detail • canvas.contexttypeenum.user see contexttypeenum on page 241 for more details on these values. usage implement this method to specify which attributes to disable in the context of the canvas app. a disabled attribute will set the associated canvas context information to null. disabling attributes can help improve performance by reducing the size of the signed request and canvas context. also, disabled attributes do not need to be retrieved by salesforce, which further improves performance. see the canvas developer guide for more information on context information in the context object that’s provided in the canvasrequest. example this example implementation specifies that the organization information will be disabled in the canvas context. public set excludecontexttypes() { set excluded = new set(); excluded.add(canvas.contexttypeenum.organization); return excluded; } onrender(rendercontext) invoked when a canvas app is rendered. provides the ability to set and retrieve canvas application and environment context information during the application render phase. signature public void onrender(canvas.rendercontext rendercontext) parameters rendercontext type: canvas.rendercontext return value type: void 240apex reference guide contexttypeenum enum usage if implemented, this method is called whenever the canvas app is rendered. the implementation can set and retrieve context information by using the provided canvas.rendercontext. this method is called whenever signed request or context information is retrieved by the client. see the canvas developer guide for more information on signed request authentication. example this example implementation prints ‘canvas lifecycle called.’ to the debug log when the canvas app is rendered. public void onrender(canvas.rendercontext rendercontext) { system.debug('canvas lifecycle called.'); } contexttypeenum enum describes context data that can be excluded from" "canvas app context data. you specify which context types to exclude in the excludecontexttypes() method in your canvaslifecyclehandler implementation. namespace canvas enum values value description organization exclude context information about the organization in which the canvas app is running. record_detail exclude context information about the object record on which the canvas app appears. user exclude context information about the current user. environmentcontext interface use this interface to retrieve environment context information, such as the app display location or the configuration parameters. namespace canvas usage the environmentcontext interface provides methods to retrieve environment information about the current canvas app. for this interface, you don’t need to create an implementation. use the default implementation that salesforce provides. 241apex reference guide environmentcontext interface in this section: environmentcontext methods environmentcontext methods the following are methods for environmentcontext. in this section: addentityfield(fieldname) adds a field to the list of object fields that are returned in the signed request record object when the component appears on a visualforce page that’s placed on an object. addentityfields(fieldnames) adds a set of fields to the list of object fields that are returned in the signed request record object when the component appears on a visualforce page that’s placed on an object. getdisplaylocation() retrieves the display location where the canvas app is being called from. for example, a value of visualforce page. getentityfields() retrieves the list of object fields that are returned in the signed request record object when the component appears on a visualforce page that’s placed on an object. getlocationurl() retrieves the location url of the canvas app. getparametersasjson() retrieves the current custom parameters for the canvas app. parameters are returned as a json string. getsublocation() retrieves the display sublocation where the canvas app is being called from. setparametersasjson(jsonstring) sets the custom parameters for the canvas app. addentityfield(fieldname) adds a field to the list of object fields that are returned in the signed request record object when the component appears on a visualforce page that’s placed on an object. signature public void addentityfield(string fieldname) parameters fieldname type: string the object field name that you need to add to the list of returned fields., using ‘*’ adds all fields that the user has permission to view. 242apex reference guide environmentcontext interface return value type: void usage when you use the component to display a canvas app on a visualforce page, and that page is associated with an object (placed on the page layout, for example), you can specify fields to be returned from the related object. see the canvas developer guide for more information on the record object. use addentityfield() to add a field to the list of object fields that are returned in the signed request record object. by default the list of fields includes id. you can add fields by name or add all fields that the user has permission to view by calling addentityfield('*'). you can inspect the configured list of fields by using canvas.environmentcontext.getentityfields(). example this example adds the name and billingaddress fields to the list of object fields. this example assumes the canvas app will appear in a visualforce page that's associated with the account page layout. canvas.environmentcontext env = rendercontext.getenvironmentcontext(); // add name and billingaddress to fields (assumes we'll run from the account detail page) env.addentityfield('name'); env.addentityfield('billingaddress'); addentityfields(fieldnames) adds a set of fields to the list of object fields that are returned in the signed request record object when the component appears on a visualforce page that’s placed on an object. signature public void addentityfields(set fieldnames) parameters fieldnames type: set the set of object field names that you need to add to the list of returned fields. if an item in the set is ‘*’, all fields that the user has permission to view are added. return value type: void usage when you use the component to display a canvas app on a visualforce page, and that page is associated with an object (placed on the page layout, for example), you can specify fields" "to be returned from the related object. see the canvas developer guide for more information on the record object. 243apex reference guide environmentcontext interface use addentityfields() to add a set of one or more fields to the list of object fields that are returned in the signed request record object. by default the list of fields includes id. you can add fields by name or add all fields that the user has permission to view by adding a set that includes ‘*’ as one of the strings. you can inspect the configured list of fields by using canvas.environmentcontext.getentityfields(). example this example adds the name, billingaddress, and yearstarted fields to the list of object fields. this example assumes that the canvas app will appear in a visualforce page that’s associated with the account page layout. canvas.environmentcontext env = rendercontext.getenvironmentcontext(); // add name, billingaddress and yearstarted to fields (assumes we'll run from the account detail page) set fields = new set{'name','billingaddress','yearstarted'}; env.addentityfields(fields); getdisplaylocation() retrieves the display location where the canvas app is being called from. for example, a value of visualforce page. signature public string getdisplaylocation() return value type: string the return value can be one of the following strings: • chatter—the canvas app was called from the chatter tab. • chatterfeed—the canvas app was called from a chatter canvas feed item. • mobilenav—the canvas app was called from the navigation menu. • opencti—the canvas app was called from an open cti component. • pagelayout—the canvas app was called from an element within a page layout. if the displaylocation is pagelayout, one of the sublocation values might be returned. • publisher—the canvas app was called from a canvas custom quick action. • servicedesk—the canvas app was called from a salesforce console component. • visualforce—the canvas app was called from a visualforce page. • none—the canvas app was called from the canvas app previewer. usage use this method to obtain the display location for the canvas app. getentityfields() retrieves the list of object fields that are returned in the signed request record object when the component appears on a visualforce page that’s placed on an object. 244apex reference guide environmentcontext interface signature public list getentityfields() return value type: list usage when you use the component to display a canvas app on a visualforce page, and that page is associated with an object (placed on the page layout, for example), you can specify fields to be returned from the related object. see the canvas developer guide for more information on the record object. use getentityfields() to retrieve the list of object fields that are returned in the signed request record object. by default the list of fields includes id. the list of fields can be configured by using the canvas.environmentcontext.addentityfield(fieldname) or canvas.environmentcontext.addentityfields(fieldnames) methods. example this example gets the current list of object fields and retrieves each item in the list, printing each field name to the debug log. canvas.environmentcontext env = rendercontext.getenvironmentcontext(); list entityfields = env.getentityfields(); for (string fieldval : entityfields) { system.debug('environment context entityfield: ' + fieldval); } if the canvas app that’s using this lifecycle code was run from the detail page of an account, the debug log output might look like: environment context entityfield: id getlocationurl() retrieves the location url of the canvas app. signature public string getlocationurl() return value type: string usage use this method to obtain the url of the page where the user accessed the canvas app. for example, if the user accessed your app by clicking a link on the chatter tab, this method returns the url of the chatter tab, which would be similar to ‘https://mydomainname.my.salesforce.com/_ui/core/chatter/ui/chatterpage’. 245apex reference guide environmentcontext interface getparametersasjson() retrieves the current custom parameters for the canvas app. parameters are returned as a json string. signature public" "string getparametersasjson() return value type: string usage use this method to get the current custom parameters for the canvas app. the parameters are returned in a json string that can be de-serialized by using the system.json.deserializeuntyped(jsonstring) method. custom parameters can be modified by using the canvas.environmentcontext.setparametersasjson(jsonstring) string. example this example gets the current custom parameters, de-serializes them into a map, and prints the results to the debug log. canvas.environmentcontext env = rendercontext.getenvironmentcontext(); // get current custom params map currentparams = (map) json.deserializeuntyped(env.getparametersasjson()); system.debug('environment context custom paramters: ' + currentparams); getsublocation() retrieves the display sublocation where the canvas app is being called from. signature public string getsublocation() return value type: string the return value can be one of the following strings: • s1mobilecardfullview—the canvas app was called from a mobile card. • s1mobilecardpreview—the canvas app was called from a mobile card preview. the user must click the preview to open the app. • s1recordhomepreview—the canvas app was called from a record detail page preview. the user must click the preview to open the app. • s1recordhomefullview—the canvas app was called from a page layout. 246apex reference guide environmentcontext interface usage use this method to obtain the display sublocation for the canvas app. use only if the primary display location can be displayed on mobile devices. setparametersasjson(jsonstring) sets the custom parameters for the canvas app. signature public void setparametersasjson(string jsonstring) parameters jsonstring type: string the custom parameters that you need to set, serialized into a json format string. return value type: void usage use this method to set the current custom parameters for the canvas app. the parameters must be provided in a json string. you can use the system.json.serialize(objecttoserialize) method to serialize a map into a json string. setting the custom parameters will overwrite the custom parameters that are set for the current request. if you need to modify the current custom parameters, first get the current set of custom parameters by using getparametersasjson(), modify the retrieved parameter set as needed, and then use this modified set in your call to setparametersasjson(). if the provided json string exceeds 32kb, a system.canvasexception will be thrown. example this example gets the current custom parameters, adds a new newcustomparam parameter with a value of ‘testvalue’, and sets the current custom parameters. canvas.environmentcontext env = rendercontext.getenvironmentcontext(); // get current custom params map previousparams = (map) json.deserializeuntyped(env.getparametersasjson()); // add a new custom param previousparams.put('newcustomparam','testvalue'); // now replace the parameters with the current parameters plus our new custom param env.setparametersasjson(json.serialize(previousparams)); 247apex reference guide rendercontext interface rendercontext interface a wrapper interface that is used to retrieve application and environment context information. namespace canvas usage use this interface to retrieve application and environment context information for your canvas app. for this interface, you don’t need to create an implementation. use the default implementation that salesforce provides. in this section: rendercontext methods rendercontext methods the following are methods for rendercontext. in this section: getapplicationcontext() retrieves the application context information. getenvironmentcontext() retrieves the environment context information. getapplicationcontext() retrieves the application context information. signature public canvas.applicationcontext getapplicationcontext() return value type: canvas.applicationcontext usage use this method to get the application context information for your canvas app. 248apex reference guide rendercontext interface example the following example implementation of the canvaslifecyclehandler onrender() method uses the provided rendercontext to retrieve the application context information and then checks the namespace, version, and app url. public void onrender(canvas.rendercontext rendercontext){ canvas.applicationcontext app = rendercontext.getapplicationcontext(); if (!'mynamespace" "'.equals(app.getnamespace())){ // this application is installed, add code as needed ... } // check the application version double currentversion = double.valueof(app.getversion()); if (currentversion <= 5){ // add version specific code as needed ... // tell the canvas application to operate in deprecated mode app.setcanvasurlpath('/canvas?deprecated=true'); } } getenvironmentcontext() retrieves the environment context information. signature public canvas.environmentcontext getenvironmentcontext() return value type: canvas.environmentcontext usage use this method to get the environment context information for your canvas app. example the following example implementation of the canvaslifecyclehandler onrender() method uses the provided rendercontext to retrieve the environment context information and then modifies the custom parameters. public void onrender(canvas.rendercontext rendercontext) { canvas.environmentcontext env = rendercontext.getenvironmentcontext(); // retrieve the custom params map previousparams = (map) json.deserializeuntyped(env.getparametersasjson()); previousparams.put('param1',1); previousparams.put('param2',3.14159); 249apex reference guide test class ... // now, add in some opportunity record ids opportunity[] o = [select id, name from opportunity]; previousparams.put('opportunities',o); // now, replace the parameters env.setparametersasjson(json.serialize(previousparams)); } test class contains methods for automated testing of your canvas classes. namespace canvas usage use this class to test your implementation of canvas.canvaslifecyclehandler with mock test data. you can create a test canvas.rendercontext with mock application and environment context data and use this data to verify that your canvaslifecyclehandler is being invoked correctly. in this section: test constants the test class provides constants that are used as keys when you set mock application and environment context data. test methods the test class provides methods for creating test contexts and invoking your canvaslifecyclehandler with mock data. test constants the test class provides constants that are used as keys when you set mock application and environment context data. when you call canvas.test.mockrendercontext(applicationcontexttestvalues, environmentcontexttestvalues), you need to provide maps of key-value pairs to represent your mock application and environment context data. the test class provides static constant strings that you can use as keys for various parts of the application and environment context. constant description key_canvas_url represents the canvas app url key in the applicationcontext. key_developer_name represents the canvas app developer or api name key in the applicationcontext. key_display_location represents the canvas app display location key in the environmentcontext. key_location_url represents the canvas app location url key in the environmentcontext. 250apex reference guide test class constant description key_name represents the canvas app name key in the applicationcontext. key_namespace represents the canvas app namespace key in the applicationcontext. key_sub_location represents the canvas app sublocation key in the environmentcontext. key_version represents the canvas app version key in the applicationcontext. test methods the test class provides methods for creating test contexts and invoking your canvaslifecyclehandler with mock data. the following are methods for test. all are static methods. in this section: mockrendercontext(applicationcontexttestvalues, environmentcontexttestvalues) creates and returns a test canvas.rendercontext based on the provided application and environment context parameters. testcanvaslifecycle(lifecyclehandler, mockrendercontext) calls the canvas test framework to invoke a canvaslifecyclehandler with the provided rendercontext. mockrendercontext(applicationcontexttestvalues, environmentcontexttestvalues) creates and returns a test canvas.rendercontext based on the provided application and environment context parameters. signature public static canvas.rendercontext mockrendercontext(map applicationcontexttestvalues, map environmentcontexttestvalues) parameters applicationcontexttestvalues type: map specifies a map of key-value pairs that provide mock application context data. use constants that are provided by canvas.test as keys. if" "null is provided for this parameter, the canvas framework generates some default mock application context values. environmentcontexttestvalues type: map specifies a map of key-value pairs that provide mock environment context data. use constants provided by canvas.test as keys. if null is provided for this parameter, the canvas framework generates some default mock environment context values. return value type: canvas.rendercontext 251apex reference guide test class usage use this method to create a mock canvas.rendercontext. use the returned rendercontext in calls to canvas.test.testcanvaslifecycle(lifecyclehandler, mockrendercontext) for testing canvas.canvaslifecyclehandler implementations. example the following example creates maps to represent mock application and environment context data and generates a test canvas.rendercontext. this test rendercontext can be used in a call to canvas.test.testcanvaslifecycle(lifecyclehandler, mockrendercontext). map appvalues = new map(); appvalues.put(canvas.test.key_namespace,'alternatenamespace'); appvalues.put(canvas.test.key_version,'3.0'); map envvalues = new map(); envvalues.put(canvas.test.key_display_location,'chatter'); envvalues.put(canvas.test.key_location_url,'https://mydomainname.my.salesforce.com/_ui/core/chatter/ui/chatterpage'); canvas.rendercontext mock = canvas.test.mockrendercontext(appvalues,envvalues); testcanvaslifecycle(lifecyclehandler, mockrendercontext) calls the canvas test framework to invoke a canvaslifecyclehandler with the provided rendercontext. signature public static void testcanvaslifecycle(canvas.canvaslifecyclehandler lifecyclehandler,canvas.rendercontext mockrendercontext) parameters lifecyclehandler type: canvas.canvaslifecyclehandler specifies the canvaslifecyclehandler implementation that you need to invoke. mockrendercontext type: canvas.rendercontext specifies the rendercontext information that you need to provide to the invoked canvaslifecyclehandler. if null is provided for this parameter, the canvas framework generates and uses a default mock rendercontext. return value type: void usage use this method to invoke an implementation of canvas.canvaslifecyclehandler.onrender(rendercontext) with a mock canvas.rendercontext that you provide. 252apex reference guide canvas exceptions example the following example creates maps to represent mock application and environment context data and generates a test canvas.rendercontext. this test rendercontext is then used to invoke a canvas.canvaslifecyclehandler. // set some application context data in a map map appvalues = new map(); appvalues.put(canvas.test.key_namespace,'alternatenamespace'); appvalues.put(canvas.test.key_version,'3.0'); // set some environment context data in a map map envvalues = new map(); envvalues.put(canvas.test.key_display_location,'chatter'); envvalues.put(canvas.test.key_location_url,'https://mydomainname.my.salesforce.com/_ui/core/chatter/ui/chatterpage'); // create a mock rendercontext using the test application and environment context data maps canvas.rendercontext mock = canvas.test.mockrendercontext(appvalues,envvalues); // set some custom params on the mock rendercontext mock.getenvironmentcontext().setparametersasjson('{\""param1\"":1,\""boolparam\"":true,\""stringparam\"":\""test string\""}'); // use the mock rendercontext to invoke a canvaslifecyclehandler canvas.test.testcanvaslifecycle(handler,mock) canvas exceptions the canvas namespace contains exception classes. all exception classes support built-in methods for returning the error message and exception type. see exception class and built-in exceptions. the canvas namespace contains this exception: exception description canvas.canvasrenderexception use this class in your implementation of canvas.canvaslifecycle" "handler.onrender(rendercontext). to show an error to the user in your onrender() implementation, throw a canvas.canvasrenderexception, and the canvas framework will render the error message to the user. this exception will be managed only within the onrender() method. example the following example implementation of onrender() catches a canvasexception that was thrown because a canvas url was set with a string that exceeded the maximum length. a canvasrenderexception is created and thrown to display the error to the user. public class mycanvaslistener implements canvas.canvaslifecyclehandler { public void onrender(canvas.rendercontext rendercontext) { 253apex reference guide chatteranswers namespace canvas.applicationcontext app = rendercontext.getapplicationcontext(); // code to generate a url string that is too long // ... // try to set the canvas app url using the invalid url string try { app.setcanvasurlpath(aurlpaththatistoolong); } catch (canvasexception e) { // display error to user by throwing a new canvasrenderexception throw new canvas.canvasrenderexception(e.getmessage()); } } } see the canvas developer guide for additional examples that use canvasrenderexception. chatteranswers namespace the chatteranswers namespace provides an interface for creating account records. the following is the interface in the chatteranswers namespace. in this section: accountcreator interface creates account records that will be associated with chatter answers users. accountcreator interface creates account records that will be associated with chatter answers users. namespace chatteranswers usage the chatteranswers.accountcreator is specified in the registrationclassname attribute of a chatteranswers:registration visualforce component. this interface is called by chatter answers and allows for custom creation of account records used for portal users. to implement the chatteranswers.accountcreator interface, you must first declare a class with the implements keyword as follows: public class chatteranswersregistration implements chatteranswers.accountcreator { 254apex reference guide accountcreator interface next, your class must provide an implementation for the following method: public string createaccount(string firstname, string lastname, id siteadminid) { // your code here } the implemented method must be declared as global or public. in this section: accountcreator methods accountcreator example implementation accountcreator methods the following are methods for accountcreator. in this section: createaccount(firstname, lastname, siteadminid) accepts basic user information and creates an account record. the implementation of this method returns the account id. createaccount(firstname, lastname, siteadminid) accepts basic user information and creates an account record. the implementation of this method returns the account id. signature public string createaccount(string firstname, string lastname, id siteadminid) parameters firstname type: string the first name of the user who is registering. lastname type: string the last name of the user who is registering. siteadminid type: id the user id of the site administrator, used for notification if any exceptions occur. return value type: string 255apex reference guide commercepayments namespace accountcreator example implementation this is an example implementation of the chatteranswers.accountcreator interface. the createaccount method implementation accepts user information and creates an account record. the method returns a string value for the account id. public class chatteranswersregistration implements chatteranswers.accountcreator { public string createaccount(string firstname, string lastname, id siteadminid) { account a = new account(name = firstname + ' ' + lastname, ownerid = siteadminid); insert a; return a.id; } } this example tests the code above. @istest private class chatteranswerscreateaccounttest { static testmethod void validateaccountcreation() { user[] user = [select id, firstname, lastname from user where usertype='standard']; if (user.size() == 0) { return; } string firstname = user[0].firstname; string lastname = user[0].lastname; string userid = user[0].id; string accountid = new chatteranswersregistration().createaccount(firstname, lastname, userid); account acct = [select name" ", ownerid from account where id =: accountid]; system.assertequals(firstname + ' ' + lastname, acct.name); system.assertequals(userid, acct.ownerid); } } commercepayments namespace use the commercepayments namespace to provide a safe and customizable platform for managing customer payments and refunds. to review commercepayments use cases and walkthroughs, go to use cases for the commercepayments namespace. the following are the classes in the commercepayments namespace. in this section: abstractresponse class contains the normalized response fields from payment gateways that are common to all the other gateway responses. addressrequest class contains address request data that is sent to a gateway adapter during a service call. auditparamsrequest auditparamsrequest is used for audit parameters in a transaction request. this is an abstract request class that is extended by the baserequest class. 256apex reference guide commercepayments namespace abstracttransactionresponse class abstract class for storing normalized information sent from payment gateways about a payment transaction. holds the common response fields sent from payment gateways for authorization, sale, capture, and refund transactions. authapipaymentmethodrequest class sends information about a payment method to a gateway adapter during an authorization service call. authorizationreversalrequest class sends information about an authorization reversal request to a gateway adapter during a service call. authorizationreversalresponse class response sent by the payment gateway following a payment authorization reversal service. authorizationrequest class sends information about an authorization request to a gateway adapter during a service call. authorizationresponse class response sent by the payment gateway adapter for an authorization service. baseapipaymentmethodrequest class abstract class used to send information about a payment method to a gateway adapter during a service call. basenotification class abstract class for storing notification information sent from payment gateways. basepaymentmethodrequest class abstract class for storing information about payment methods. baserequest class baserequest is extended by all the request classes. capturenotification class when a payment gateway sends a notification for a capture transaction, the payment gateway adapter creates the capturenotification object to store information about the notification. capturerequest class represents a capture request. this class extends the baserequest class and inherits all its methods. captureresponse class the payment gateway adapter sends this response for the capture request type. this class extends abstractresponse and inherits its methods. cardcategory enum defines whether the payment method represents a credit card or a debit card. cardpaymentmethodrequest class sends data related to a card payment method to a gateway adapter during a service call. custommetadatatypeinfo class access information about custom metadata. the paymentgatewayadapter can send custommetadatatypeinfo to transaction requests through the response object’s salesforceresultcodeinfo. gatewayerrorresponse class use to respond with an error indication following errors from the paymentgateway adapter, such as request-forbidden responses, custom validation errors, or expired api tokens. 257apex reference guide commercepayments namespace gatewaynotificationresponse class when the payment gateway sends a notification to the payments platform, the platform responds with a gatewaynotificationresponse indicating whether the platform succeeded or failed at receiving the notification. gatewayresponse interface generic payment gateway response interface. this class extends the captureresponse on page 312, abstracttransactionresponse on page 268, and abstractresponse on page 259 classes and inherits all their properties. it has no unique methods or parameters. notificationclient class communicates with the payment platform regarding the gateway’s notification. notificationsaveresult class contains the result of the payment platform’s attempt to record data from the gateway’s notification. notificationstatus enum shows whether the payments platform successfully received the notification from the gateway. paymentgatewayadapter interface paymentgatewayadapters can implement this interface in order to process requests. paymentgatewayasyncadapter interface implement the interface to allow customers to process payments asynchronously. paymentgatewaycontext class wraps the information related to a payment request. paymentgatewaynotificationcontext class wraps the information related to a gateway notification. paymentmethodtokenizationrequest class stores data about a request to tokenize a card payment method. the tokenization process occurs in the payment gateway. this process replaces sensitive customer data, such as a card number or cvv, with unique identification symbols. the symbols are used while the data is handled by salesforce, the payment gateway, and the customer" "bank, allowing salesforce to store the token without storing sensitive customer data. paymentmethodtokenizationresponse class gateway response sent by payment gateway adapters for the payment method tokenization request. the response includes the payment method’s token id value. paymentgatewaynotificationrequest class contains the notification request data from the gateway. paymentshttp class makes an http request to start the interaction with the payment gateway. refundrequest class sends data related to a refund to the payment gateway adapter. referencedrefundnotification class when a payment gateway sends a notification for a refund transaction, the payment gateway adapter creates the referencedrefundnotification object to store information about notification. referencedrefundrequest access information about the referenced refund requests. extends the refundrequest class. referencedrefundresponse class the payment gateway adapter sends this response for the referencedrefund request type. 258apex reference guide abstractresponse class requesttype enum defines the type of payment transaction request made to the payment gateway. saleapipaymentmethodrequest class sends data related to a card payment method to a gateway adapter during a sale service call. salerequest class stores information about a sales request. saleresponse class response sent by payment gateway adapters for a sales service. salesforceresultcode enum defines the gateway call status values in salesforce based on the call status values that the payment gateway returned. salesforceresultcodeinfo stores salesforce result code information from payment gateway adapters. abstractresponse class contains the normalized response fields from payment gateways that are common to all the other gateway responses. namespace commercepayments usage you must specify the commercepayments namespace when creating an instance of this class. the constructor of this class takes no arguments. for example: commercepayments.abstractresponse abr = new commercepayments.abstractresponse(); this class can’t be instantiated on its own. this class implements the gatewayresponse class. other gatewayresponse classes extend this class to inherit common properties. in this section: abstractresponse methods abstractresponse methods the following are methods for abstractresponse. in this section: setgatewayavscode(gatewayavscode) sets the avs (address verification system) result code information that the gateway returned. maximum length of 64 characters. setgatewaydate(gatewaydate) sets the date that the transaction occurred. some gateways don’t send this value. setgatewaymessage(gatewaymessage) sets error messages that the gateway returned for the payment request. maximum length of 255 characters. 259apex reference guide abstractresponse class setgatewayresultcode(gatewayresultcode) sets a gateway-specific result code. the code may be mapped to a salesforce-specific result code. maximum length of 64 characters. setgatewayresultcodedescription(gatewayresultcodedescription) sets a description of the gateway-specific result code that a payment gateway returned. maximum length of 1000 characters. setsalesforceresultcodeinfo(salesforceresultcodeinfo) sets the salesforce-specific result code information. payment gateways have many response codes for payment calls. salesforce uses the result code information to map payment gateway codes to a predefined set of standard salesforce result codes. setgatewayavscode(gatewayavscode) sets the avs (address verification system) result code information that the gateway returned. maximum length of 64 characters. signature global void setgatewayavscode(string gatewayavscode) parameters gatewayavscode type: string code sent by gateways that use an address verification system. return value type: void setgatewaydate(gatewaydate) sets the date that the transaction occurred. some gateways don’t send this value. signature global void setgatewaydate(datetime gatewaydate) parameters gatewaydate type: datetime date and time of the gateway communication. return value type: void setgatewaymessage(gatewaymessage) sets error messages that the gateway returned for the payment request. maximum length of 255 characters. 260apex reference guide abstractresponse class signature global void setgatewaymessage(string gatewaymessage) parameters gatewaymessage type: string information on error messages sent from the gateway. return value type: void setgatewayresultcode(gatewayresultcode) sets a gateway-specific result code. the code may be mapped to a salesforce-specific result code." "maximum length of 64 characters. signature global void setgatewayresultcode(string gatewayresultcode) parameters gatewayresultcode type: string gateway-specific result code. must be used to map a salesforce-specific result code. return value type: void setgatewayresultcodedescription(gatewayresultcodedescription) sets a description of the gateway-specific result code that a payment gateway returned. maximum length of 1000 characters. signature global void setgatewayresultcodedescription(string gatewayresultcodedescription) parameters gatewayresultcodedescription type: string description of the gateway’s result code. use this field to learn more about why the gateway returned a certain result code. return value type: void 261apex reference guide addressrequest class setsalesforceresultcodeinfo(salesforceresultcodeinfo) sets the salesforce-specific result code information. payment gateways have many response codes for payment calls. salesforce uses the result code information to map payment gateway codes to a predefined set of standard salesforce result codes. signature global void setsalesforceresultcodeinfo(commercepayments.salesforceresultcodeinfo salesforceresultcodeinfo) parameters salesforceresultcodeinfo type: commercepayments.salesforceresultcodeinfo on page 380 description of the salesforce result code value. return value type: void addressrequest class contains address request data that is sent to a gateway adapter during a service call. namespace commercepayments usage contains information about the payment method’s address. use this information in authorization, sale, and tokenization requests. the payment gateway adapter uses information in an addressrequest object to construct a json request to send to the payment gateway. the constructor of this class takes no arguments. for example: commercepayments.addressrequest adr = new commercepayments.addressrequest(); in this section: addressrequest constructors addressrequest properties addressrequest methods addressrequest constructors the following are constructors for addressrequest. 262apex reference guide addressrequest class in this section: addressrequest(street, city, state, country, postalcode) constructs a sample address. this constructor is intended for test usage and throws an exception if used outside of the apex test context. addressrequest(street, city, state, country, postalcode) constructs a sample address. this constructor is intended for test usage and throws an exception if used outside of the apex test context. signature global addressrequest(string street, string city, string state, string country, string postalcode) parameters street type: string street for the payment method's address. city type: string city for the payment method's address. state type: string state for the payment method's address. country type: string country for the payment method's address. postalcode type: string postal code for the payment method's address. addressrequest properties the following are properties for addressrequest. in this section: city city of the payment method address. companyname company name of the payment method address. country country for the payment method address. 263apex reference guide addressrequest class postalcode postal code for the payment method address. state state for the payment method address. street street for the payment method address. city city of the payment method address. signature global string city {get; set;} property value type: string companyname company name of the payment method address. signature global string companyname {get; set;} property value type: string country country for the payment method address. signature global string country {get; set;} property value type: string postalcode postal code for the payment method address. signature global string postalcode {get; set;} 264apex reference guide addressrequest class property value type: string state state for the payment method address. signature global string state {get; set;} property value type: string street street for the payment method address. signature global string street {get; set;} property value type: string addressrequest methods the following are methods for addressrequest. in this section: equals(obj) maintains the integrity of lists of type addressrequest by determining the equality of external objects in a list. this method is dynamic and is based on the equals method in java. hashcode() maintains the integrity of lists of type addressrequest. to" "string() converts a date to a string. equals(obj) maintains the integrity of lists of type addressrequest by determining the equality of external objects in a list. this method is dynamic and is based on the equals method in java. signature global boolean equals(object obj) 265apex reference guide auditparamsrequest parameters obj type: object external object whose key is to be validated. return value type: boolean hashcode() maintains the integrity of lists of type addressrequest. signature global integer hashcode() return value type: integer tostring() converts a date to a string. signature global string tostring() return value type: string auditparamsrequest auditparamsrequest is used for audit parameters in a transaction request. this is an abstract request class that is extended by the baserequest class. namespace commercepayments usage auditparamsrequest is an abstract class that holds attributes related to audit parameters such as email, ip address, mac address, and phone number. this class can't be instantiated on its own. all commercepayments request classes extend this class. 266apex reference guide auditparamsrequest in this section: auditparamsrequest constructors auditparamsrequest properties auditparamsrequest constructors the following are constructors for auditparamsrequest. in this section: auditparamsrequest(email, macaddress, ipaddress, phone) this constructor is intended for test usage and throws an exception if used outside of the apex test context. auditparamsrequest(email, macaddress, ipaddress, phone) this constructor is intended for test usage and throws an exception if used outside of the apex test context. signature auditparamsrequest(string email, string macaddress, string ipaddress, string phone) parameters email type: string email of the client that initiated the request. macaddress type: string mac address of the customer’s device. gateways often use this data in risk checks. ipaddress type: string the customer’s ip address. gateways often use this data in risk checks. phone type: string phone number of the client that initiated the request. auditparamsrequest properties the following are properties for auditparamsrequest. in this section: email email of the client that initiated the request. ipaddress the customer’s ip address. gateways often use this data in risk checks. 267apex reference guide abstracttransactionresponse class macaddress mac address of the customer’s device. gateways often use this data in risk checks. phone phone number of the client that initiated the request. email email of the client that initiated the request. property value type: string ipaddress the customer’s ip address. gateways often use this data in risk checks. property value type: string macaddress mac address of the customer’s device. gateways often use this data in risk checks. property value type: string phone phone number of the client that initiated the request. property value type: string abstracttransactionresponse class abstract class for storing normalized information sent from payment gateways about a payment transaction. holds the common response fields sent from payment gateways for authorization, sale, capture, and refund transactions. namespace commercepayments 268apex reference guide abstracttransactionresponse class usage specify the commercepayments namespace when creating an instance of this class. the constructor of this class takes no arguments. for example: commercepayments.abstracttransactionresponse atr = new commercepayments.abstracttransactionresponse(); in this section: abstracttransactionresponse methods abstracttransactionresponse methods the following are methods for abstracttransactionresponse. in this section: setamount(amount) sets the transaction amount. must be a non-negative value. setgatewayavscode(gatewayavscode) sets the avs (address verification system) result code that the gateway returned. maximum length of 64 characters. setgatewaydate(gatewaydate) sets the date that the notification occurred. some gateways don’t send this value. setgatewaymessage(gatewaymessage) sets error messages that the gateway returned for the notification request. maximum length of 255 characters. setgatewayreferencedetails(gatewayreferencedetails) sets the payment gateway’s reference details. setgatewayreferencenumber(gatewayreferencenumber) sets the payment gateway’s reference number." "setgatewayresultcode(gatewayresultcode) sets a gateway-specific result code. you can map the result code to a salesforce-specific result code. maximum length of 64 characters. setgatewayresultcodedescription(gatewayresultcodedescription) sets a description of the gateway-specific result code that a payment gateway returned. maximum length of 1000 characters. setsalesforceresultcodeinfo(salesforceresultcodeinfo) sets the salesforce-specific result code information. setamount(amount) sets the transaction amount. must be a non-negative value. signature global void setamount(double amount) 269apex reference guide abstracttransactionresponse class parameters amount type: double the amount of the transaction. return value type: void setgatewayavscode(gatewayavscode) sets the avs (address verification system) result code that the gateway returned. maximum length of 64 characters. signature global void setgatewayavscode(string gatewayavscode) parameters gatewayavscode type: string used to verify the address mapped to a payment method when the payments platform requests tokenization from the payment gateway. return value type: void setgatewaydate(gatewaydate) sets the date that the notification occurred. some gateways don’t send this value. signature global void setgatewaydate(datetime gatewaydate) parameters gatewaydate type: datetime the date that the transaction occurred. return value type: void setgatewaymessage(gatewaymessage) sets error messages that the gateway returned for the notification request. maximum length of 255 characters. 270apex reference guide abstracttransactionresponse class signature global void setgatewaymessage(string gatewaymessage) parameters gatewaymessage type: string the message that the gateway returned with the transaction request. contains additional information about the transaction. return value type: void setgatewayreferencedetails(gatewayreferencedetails) sets the payment gateway’s reference details. signature global void setgatewayreferencedetails(string gatewayreferencedetails) parameters gatewayreferencedetails type: string provides information about the gateway communication. return value type: void setgatewayreferencenumber(gatewayreferencenumber) sets the payment gateway’s reference number. signature global void setgatewayreferencenumber(string gatewayreferencenumber) parameters gatewayreferencenumber type: string unique transaction id created by the payment gateway. return value type: void 271apex reference guide abstracttransactionresponse class setgatewayresultcode(gatewayresultcode) sets a gateway-specific result code. you can map the result code to a salesforce-specific result code. maximum length of 64 characters. signature global void setgatewayresultcode(string gatewayresultcode) parameters gatewayresultcode type: string gateway-specific result code. must be mapped to a salesforce-specific result code. return value type: void setgatewayresultcodedescription(gatewayresultcodedescription) sets a description of the gateway-specific result code that a payment gateway returned. maximum length of 1000 characters. signature global void setgatewayresultcodedescription(string gatewayresultcodedescription) parameters gatewayresultcodedescription type: string provides additional information about the result code and why the gateway returned the specific code. descriptions vary between different gateways. return value type: void setsalesforceresultcodeinfo(salesforceresultcodeinfo) sets the salesforce-specific result code information. signature global void setsalesforceresultcodeinfo(commercepayments.salesforceresultcodeinfo salesforceresultcodeinfo) parameters salesforceresultcodeinfo type: commercepayments.salesforceresultcodeinfo on page 380 272apex reference guide authapipaymentmethodrequest class payment gateways have many response codes for payment calls. salesforce uses the result code information to map payment gateway codes to a predefined set of standard salesforce result codes. return value type: void authapipaymentmethodrequest class sends information about a payment method to a gateway adapter during an authorization service call. namespace commercepayments usage contains information about the payment method that is used for an authorization request. it contains all available payment methods as fields, but populates only one field for each request. the gateway adapter uses this class when constructing an authorization request. an object of this class is available through the paymentmethod field on" "the authorizationrequest class object. in this section: authapipaymentmethodrequest constructors authapipaymentmethodrequest properties authapipaymentmethodrequest constructors the following are constructors for authapipaymentmethodrequest. in this section: authapipaymentmethodrequest(cardpaymentmethodrequest) constructs a sample cardpaymentmethodrequest. this constructor is intended for test usage and throws an exception if used outside of the apex test context. authapipaymentmethodrequest() constructor for authapipaymentmethodrequest. authapipaymentmethodrequest(cardpaymentmethodrequest) constructs a sample cardpaymentmethodrequest. this constructor is intended for test usage and throws an exception if used outside of the apex test context. signature global authapipaymentmethodrequest(commercepayments.cardpaymentmethodrequest cardpaymentmethodrequest) 273apex reference guide authorizationreversalrequest class parameters cardpaymentmethodrequest type: commercepayments.cardpaymentmethodrequest on page 318 contains information about the card payment method. used to send information to a gateway adapter during a service call. authapipaymentmethodrequest() constructor for authapipaymentmethodrequest. signature global authapipaymentmethodrequest() authapipaymentmethodrequest properties the following are properties for authapipaymentmethodrequest. in this section: cardpaymentmethod the card payment method object used in a payment method request. cardpaymentmethod the card payment method object used in a payment method request. signature global commercepayments.cardpaymentmethodrequest cardpaymentmethod {get; set;} property value type: commercepayments.cardpaymentmethodrequest on page 318 authorizationreversalrequest class sends information about an authorization reversal request to a gateway adapter during a service call. namespace commercepayments on page 256 example add your reversal classes to your payment gateway adapter. we recommend adding authorizationreversal as a possible requesttype value when calling processrequest on the gateway’s response. global commercepayments.gatewayresponse processrequest(commercepayments.paymentgatewaycontext gatewaycontext) { 274apex reference guide authorizationreversalrequest class commercepayments.requesttype requesttype = gatewaycontext.getpaymentrequesttype(); commercepayments.gatewayresponse response; try { //add other requesttype values here //.. else if (requesttype == commercepayments.requesttype.authorizationreversal) { response = createauthreversalresponse((commercepayments.authorizationreversalrequest)gatewaycontext.getpaymentrequest());} return response; then, add a class that sets the amount of the authorization reversal request, as well as gateway information and the salesforce result code. global commercepayments.gatewayresponse createauthreversalresponse(commercepayments.authorizationreversalrequest authreversalrequest) { commercepayments.authorizationreversalresponse authreversalresponse = new commercepayments.authorizationreversalresponse(); if(authreversalrequest.amount!=null ) { authreversalresponse.setamount(authreversalrequest.amount); } else { throw new salesforcevalidationexception('required field missing : amount'); } system.debug('response - success'); authreversalresponse.setgatewaydate(system.now()); authreversalresponse.setgatewayresultcode('00'); authreversalresponse.setgatewayresultcodedescription('transaction normal'); authreversalresponse.setgatewayreferencenumber('sf'+getrandomnumber(6)); authreversalresponse.setsalesforceresultcodeinfo(success_salesforce_result_code_info); return authreversalresponse; } in this section: authorizationreversalrequest constructors authorizationreversalrequest properties authorizationreversalrequest methods authorizationreversalrequest constructors the following are constructors for authorizationreversalrequest. 275apex reference guide authorizationreversalrequest class in this section: authorizationreversalrequest(amount, authorizationid) constructor for building the amount in an authorization reversal request. this constructor is intended for test usage and throws an exception if used outside of the apex test context. authorizationreversalrequest(amount, authorizationid) constructor for building the amount in" "an authorization reversal request. this constructor is intended for test usage and throws an exception if used outside of the apex test context. signature global authorizationreversalrequest(double amount, string authorizationid) parameters amount type: double the amount of the authorization reversal request. authorizationid type: string the authorization request to be reversed. authorizationreversalrequest properties the following are properties for authorizationreversalrequest. in this section: accountid references the customer account for the transaction where the authorization reversal was performed. amount the total amount of the authorization reversal request. can be positive or negative. paymentauthorizationid references the payment authorization to be reversed. accountid references the customer account for the transaction where the authorization reversal was performed. signature global string accountid {get; set;} property value type: string 276apex reference guide authorizationreversalrequest class amount the total amount of the authorization reversal request. can be positive or negative. signature global double amount {get; set;} property value type: double paymentauthorizationid references the payment authorization to be reversed. signature global string paymentauthorizationid {get; set;} property value type: string authorizationreversalrequest methods the following are methods for authorizationreversalrequest. in this section: equals(obj) maintains the integrity of lists of type authorizationreversalrequest by determining the equality of external objects in a list. this method is dynamic and based on the equals method in java. hashcode() maintains the integrity of lists of type authorizationreversalrequest by determining the uniqueness of the external object in a list. tostring() converts a date to a string. equals(obj) maintains the integrity of lists of type authorizationreversalrequest by determining the equality of external objects in a list. this method is dynamic and based on the equals method in java. signature global boolean equals(object obj) 277apex reference guide authorizationreversalresponse class parameters obj type: object external object whose key is to be validated. return value type: boolean hashcode() maintains the integrity of lists of type authorizationreversalrequest by determining the uniqueness of the external object in a list. signature global integer hashcode() return value type: integer tostring() converts a date to a string. signature global string tostring() return value type: string authorizationreversalresponse class response sent by the payment gateway following a payment authorization reversal service. namespace commercepayments usage the constructor of this class takes no arguments. for example: commercepayments.authorizationreversalresponse authrevres = new commercepayments.authorizationresponse(); 278apex reference guide authorizationreversalresponse class contains information about the payment gateway’s response following an authorization reversal transaction. the gateway adapter uses the payment gateway’s response to populate the authorizationreversalresponse fields. the payments platform uses the information from this class to construct the authorization gateway response shown to the user. example this class builds an authorization reversal response that contains the amount of the original reversal request, gateway information, and the salesforce result code. global commercepayments.gatewayresponse createauthreversalresponse(commercepayments.authorizationreversalrequest authreversalrequest) { commercepayments.authorizationreversalresponse authreversalresponse = new commercepayments.authorizationreversalresponse(); if(authreversalrequest.amount!=null ) { authreversalresponse.setamount(authreversalrequest.amount); } else { throw new salesforcevalidationexception('required field missing : amount'); } system.debug('response - success'); authreversalresponse.setgatewaydate(system.now()); authreversalresponse.setgatewayresultcode('00'); authreversalresponse.setgatewayresultcodedescription('transaction normal'); authreversalresponse.setgatewayreferencenumber('sf'+getrandomnumber(6)); authreversalresponse.setsalesforceresultcodeinfo(success_salesforce_result_code_info); return authreversalresponse; } in this section: authorizationreversalresponse methods authorizationreversalresponse methods the following are methods for authorizationreversalresponse. in this section: setamount(amount)" contains the amount of the authorization reversal. must be a non-zero value. setgatewayavscode(gatewayavscode) sets the avs (address verification system) result code that the gateway returned. maximum length of 64 characters. setgatewaydate(gatewaydate) sets the date that the authorization reversal request occurred in the payment gateway. some gateways don't send this value. 279apex reference guide authorizationreversalresponse class setgatewaymessage(gatewaymessage) sets error messages that the gateway returned for the authorization reversal request. maximum length of 255 characters. setgatewayreferencedetails(gatewayreferencedetails) stores data that you can use for subsequent authorizations. you can use any data that isn’t normalized in financial entities. this field has a maximum length of 1000 characters and can store data as json or xml. setgatewayreferencenumber(gatewayreferencenumber) sets a unique gateway reference number for the transaction that the gateway returned. maximum length of 255 characters. setgatewayresultcode(gatewayresultcode) sets a gateway-specific result code. the code can be mapped to a salesforce-specific result code. maximum length of 64 characters. setgatewayresultcodedescription(gatewayresultcodedescription) sets a description of the gateway-specific result code that a payment gateway returned. maximum length of 1000 characters. setsalesforceresultcodeinfo(salesforceresultcodeinfo) sets the salesforce-specific result code information. payment gateways have many response codes for payment calls. salesforce uses the result code information to map payment gateway codes to a predefined set of standard salesforce result codes. setamount(amount) contains the amount of the authorization reversal. must be a non-zero value. signature global void setamount(double amount) parameters amount type: double return value type: void setgatewayavscode(gatewayavscode) sets the avs (address verification system) result code that the gateway returned. maximum length of 64 characters. signature global void setgatewayavscode(string gatewayavscode) parameters gatewayavscode type: string used to verify the address mapped to a payment method when the payments platform requests tokenization from the payment gateway. 280apex reference guide authorizationreversalresponse class return value type: void setgatewaydate(gatewaydate) sets the date that the authorization reversal request occurred in the payment gateway. some gateways don't send this value. signature global void setgatewaydate(datetime gatewaydate) parameters gatewaydate type: datetime return value type: void setgatewaymessage(gatewaymessage) sets error messages that the gateway returned for the authorization reversal request. maximum length of 255 characters. signature global void setgatewaymessage(string gatewaymessage) parameters gatewaymessage type: string return value type: void setgatewayreferencedetails(gatewayreferencedetails) stores data that you can use for subsequent authorizations. you can use any data that isn’t normalized in financial entities. this field has a maximum length of 1000 characters and can store data as json or xml. signature global void setgatewayreferencedetails(string gatewayreferencedetails) parameters gatewayreferencedetails type: string 281apex reference guide authorizationreversalresponse class return value type: void setgatewayreferencenumber(gatewayreferencenumber) sets a unique gateway reference number for the transaction that the gateway returned. maximum length of 255 characters. signature global void setgatewayreferencenumber(string gatewayreferencenumber) parameters gatewayreferencenumber type: string unique reference id created by the payment gateway. return value type: void setgatewayresultcode(gatewayresultcode) sets a gateway-specific result code. the code can be mapped to a salesforce-specific result code. maximum length of 64 characters. signature global void setgatewayresultcode(string gatewayresultcode) parameters gatewayresultcode type: string gateway-specific result code. must be used to map a salesforce-specific result code. return value type: void setgatewayresultcodedescription(gatewayresultcodedescription) sets a description of the gateway-specific result code that a payment gateway returned. maximum length of 1000 characters. signature global void setgatewayresultcodedescription(string gatewayresultcodedescription) 282 "apex reference guide authorizationrequest class parameters gatewayresultcodedescription type: string description of the gateway’s result code. use this field to learn more about why the gateway returned a certain result code. return value type: void setsalesforceresultcodeinfo(salesforceresultcodeinfo) sets the salesforce-specific result code information. payment gateways have many response codes for payment calls. salesforce uses the result code information to map payment gateway codes to a predefined set of standard salesforce result codes. signature global void setsalesforceresultcodeinfo(commercepayments.salesforceresultcodeinfo salesforceresultcodeinfo) parameters salesforceresultcodeinfo type: salesforceresultcodeinfo description of the salesforce result code value. return value type: void authorizationrequest class sends information about an authorization request to a gateway adapter during a service call. namespace commercepayments usage this class contains information about a transaction authorization request. the gateway adapter reads fields from this class while constructing an authorization json request to send to the payment gateway. an object of this class is available by calling getpaymentrequest() in the paymentgatewaycontext class. 283apex reference guide authorizationrequest class example creating a buildauthrequest class to store information about the authorization request. private string buildauthrequest(commercepayments.authorizationrequest authrequest) { // multiply amount by 100.0 to convert to cents string requestbody = createrequestbody(string.valueof((authrequest.amount*100.0).intvalue()), authrequest); return requestbody; private string createrequestbody(string amount, commercepayments.authorizationrequest authrequest) { jsongenerator jsongeneratorinstance = json.creategenerator(true); string currencyiso = authrequest.currencyisocode; commercepayments.authapipaymentmethodrequest paymentmethod = authrequest.paymentmethod; commercepayments.gatewayerrorresponse error; // write data to the json string. jsongeneratorinstance.writestartobject(); jsongeneratorinstance.writestringfield('merchantaccount', '{!$credential.username}'); jsongeneratorinstance.writestringfield('reference', authrequest.comments == null ? 'randomstring' : authrequest.comments); if(currencyiso == null) { currencyiso = userinfo.getdefaultcurrency(); } jsongeneratorinstance.writefieldname('amount'); jsongeneratorinstance.writestartobject(); jsongeneratorinstance.writestringfield('value', amount); jsongeneratorinstance.writestringfield('currency', currencyiso); jsongeneratorinstance.writeendobject(); commercepayments.cardpaymentmethodrequest cardpaymentmethod; if(paymentmethod != null) { cardpaymentmethod = paymentmethod.cardpaymentmethod; if (cardpaymentmethod != null) { if (cardpaymentmethod.cardcategory != null) { if (commercepayments.cardcategory.creditcard == cardpaymentmethod.cardcategory) { jsongeneratorinstance.writefieldname('card'); jsongeneratorinstance.writestartobject(); if (cardpaymentmethod.cvv != null) jsongeneratorinstance.writestringfield('cvc', string.valueof(cardpaymentmethod.cvv)); if (cardpaymentmethod.cardholdername != null) jsongeneratorinstance.writestringfield('holdername', cardpaymentmethod.cardholdername); if (cardpaymentmethod.cardnumber != null) jsongeneratorinstance.writestringfield('number', cardpaymentmethod.cardnumber); if (cardpaymentmethod.expirymonth != null && cardpaymentmethod.expiryyear != null ) { string expmonth = 284apex reference guide authorizationrequest class ((string.valueof(cardpaymentmethod.expirymonth)).length() == 1 ? '0' : '') + string.valueof(cardpaymentmethod.expirymonth); jsongeneratorinstance.writestringfield('expirymonth', expmonth); jsongeneratorinstance.writestringfield('expiryyear', string.valueof(cardpaymentmethod.expiryyear)); } jsongeneratorinstance.writeendobject(); } else { //support for other card type } } else { throw new samplevalidationexception('required field missing : cardcategory'); } } else { throw new samplevalidationexception" "('required field missing : cardpaymentmethod'); } } else { throw new samplevalidationexception('required field missing : paymentmethod'); } jsongeneratorinstance.writeendobject(); return jsongeneratorinstance.getasstring(); } in this section: authorizationrequest constructors authorizationrequest properties authorizationrequest methods authorizationrequest constructors the following are constructors for authorizationrequest. in this section: authorizationrequest(amount) constructor for building the amount in an authorization request. this constructor is intended for test usage and throws an exception if used outside of the apex test context. authorizationrequest(amount) constructor for building the amount in an authorization request. this constructor is intended for test usage and throws an exception if used outside of the apex test context. signature global authorizationrequest(double amount) 285apex reference guide authorizationrequest class parameters amount type: double the amount of the authorization. authorizationrequest properties the following are properties for authorizationrequest. in this section: accountid the customer account where the authorization is performed. amount the total amount of the authorization. can be positive or negative. comments comments about the authorization. users can enter comments to provide additional information. currencyisocode the iso currency code for the authorization request. paymentmethod the payment method used to process the authorization in the authorization request. accountid the customer account where the authorization is performed. signature global string accountid {get; set;} property value type: string amount the total amount of the authorization. can be positive or negative. signature global double amount {get; set;} property value type: double 286apex reference guide authorizationrequest class comments comments about the authorization. users can enter comments to provide additional information. signature global string comments {get; set;} property value type: string currencyisocode the iso currency code for the authorization request. signature global string currencyisocode {get; set;} property value type: string paymentmethod the payment method used to process the authorization in the authorization request. signature global authapipaymentmethodrequest paymentmethod {get; set;} property value type: authapipaymentmethodrequest on page 273 authorizationrequest methods the following are methods for authorizationrequest. in this section: equals(obj) maintains the integrity of lists of type authorizationrequest by determining the equality of external objects in a list. this method is dynamic and based on the equals method in java. hashcode() maintains the integrity of lists of type authorizationrequest by determining the uniqueness of the external object in a list. tostring() converts a date to a string. 287apex reference guide authorizationresponse class equals(obj) maintains the integrity of lists of type authorizationrequest by determining the equality of external objects in a list. this method is dynamic and based on the equals method in java. signature global boolean equals(object obj) parameters obj type: object external object whose key is to be validated. return value type: boolean hashcode() maintains the integrity of lists of type authorizationrequest by determining the uniqueness of the external object in a list. signature global integer hashcode() return value type: integer tostring() converts a date to a string. signature global string tostring() return value type: string authorizationresponse class response sent by the payment gateway adapter for an authorization service. namespace commercepayments 288apex reference guide authorizationresponse class usage the constructor of this class takes no arguments. for example: commercepayments.authorizationresponse authr = new commercepayments.authorizationresponse(); contains information about the payment gateway’s response following an authorization transaction. the gateway adapter uses the payment gateway’s response to populate the authorizationresponse fields. the payments platform uses the information from this class to construct the authorization gateway response shown to the user. example private commercepayments.gatewayresponse createauthresponse(httpresponse response, double amount) { map mapofresponsevalues = (map ) json.deserializeuntyped(response.getbody()); commercepayments.authorizationresponse authresponse = new commercepayments.authorizationresponse(); string resultcode = (string)mapofresponsevalues.get('resultcode'); if(resultcode != null){ system.debug('response - success'); if(resultcode." "equals('authorised')){ system.debug('status - authorised'); authresponse.setgatewayauthcode((string)mapofresponsevalues.get('authcode')); authresponse.setsalesforceresultcodeinfo(new commercepayments.salesforceresultcodeinfo(commercepayments.salesforceresultcode.success)); } else { //sample returns 200 with refused status in some cases system.debug('status - refused'); authresponse.setgatewayresultcodedescription((string)mapofresponsevalues.get('refusalreason')); authresponse.setsalesforceresultcodeinfo(new commercepayments.salesforceresultcodeinfo(commercepayments.salesforceresultcode.decline)); } authresponse.setgatewayreferencenumber((string)mapofresponsevalues.get('pspreference')); authresponse.setamount(amount); authresponse.setgatewaydate(system.now()); return authresponse; } else { system.debug('response - failed'); system.debug('validation error'); string statuscode = (string)mapofresponsevalues.get('errortype'); string message = (string)mapofresponsevalues.get('message'); commercepayments.gatewayerrorresponse error = new 289apex reference guide authorizationresponse class commercepayments.gatewayerrorresponse(statuscode, message); return error; } } in this section: authorizationresponse methods authorizationresponse methods the following are methods for authorizationresponse. in this section: setamount(amount) sets the amount of the authorization. must be a non-zero value. setauthorizationexpirationdate(authexpdate) sets the expiration date of the authorization request. setgatewayauthcode(gatewayauthcode) sets the authorization code that the gateway returned. maximum length of 64 characters. setgatewayavscode(gatewayavscode) sets the avs (address verification system) result code information that the gateway returned. maximum length of 64 characters. setgatewaydate(gatewaydate) sets the date that the authorization occurred. some gateways don’t send this value. setgatewaymessage(gatewaymessage) sets error messages that the gateway returned for the authorization request. maximum length of 255 characters. setgatewayreferencedetails(gatewayreferencedetails) stores data that you can use for subsequent authorizations. you can use any data that isn’t normalized in financial entities. this field has a maximum length of 1000 characters and can store data as json or xml. setgatewayreferencenumber(gatewayreferencenumber) sets the unique gateway reference number for the transaction that the gateway returned. maximum length of 255 characters. setgatewayresultcode(gatewayresultcode) sets a gateway-specific result code. the code can be mapped to a salesforce-specific result code. maximum length of 64 characters. setgatewayresultcodedescription(gatewayresultcodedescription) sets a description of the gateway-specific result code that a payment gateway returned. maximum length of 1000 characters. setpaymentmethodtokenizationresponse(paymentmethodtokenizationresponse) sets information from the gateway about the tokenized payment method. setsalesforceresultcodeinfo(salesforceresultcodeinfo) sets the salesforce-specific result code information. payment gateways have many response codes for payment calls. salesforce uses the result code information to map payment gateway codes to a predefined set of standard salesforce result codes. 290apex reference guide authorizationresponse class setamount(amount) sets the amount of the authorization. must be a non-zero value. signature global void setamount(double amount) parameters amount type: double return value type: void setauthorizationexpirationdate(authexpdate) sets the expiration date of the authorization request. signature global void setauthorizationexpirationdate(datetime authexpdate) parameters authexpdate type: datetime return value type: void setgatewayauthcode(gatewayauthcode) sets the authorization code that the gateway returned. maximum length of 64 characters. signature global void setgatewayauthcode(string gatewayauthcode) parameters gatewayauthcode type: string the authorization code returned by the gateway. return value type: void 291apex reference guide authorizationresponse class setgatewayavscode(gatewayavscode) sets the avs (address verification system) result code information that the gateway returned. maximum length of 64 characters. signature" "global void setgatewayavscode(string gatewayavscode) parameters gatewayavscode type: string used to verify the address mapped to a payment method when the payments platform requests tokenization from the payment gateway. return value type: void setgatewaydate(gatewaydate) sets the date that the authorization occurred. some gateways don’t send this value. signature global void setgatewaydate(datetime gatewaydate) parameters gatewaydate type: datetime return value type: void setgatewaymessage(gatewaymessage) sets error messages that the gateway returned for the authorization request. maximum length of 255 characters. signature global void setgatewaymessage(string gatewaymessage) parameters gatewaymessage type: string 292apex reference guide authorizationresponse class return value type: void setgatewayreferencedetails(gatewayreferencedetails) stores data that you can use for subsequent authorizations. you can use any data that isn’t normalized in financial entities. this field has a maximum length of 1000 characters and can store data as json or xml. signature global void setgatewayreferencedetails(string gatewayreferencedetails) parameters gatewayreferencedetails type: string return value type: void setgatewayreferencenumber(gatewayreferencenumber) sets the unique gateway reference number for the transaction that the gateway returned. maximum length of 255 characters. signature global void setgatewayreferencenumber(string gatewayreferencenumber) parameters gatewayreferencenumber type: string unique authorization id created by the payment gateway. return value type: void setgatewayresultcode(gatewayresultcode) sets a gateway-specific result code. the code can be mapped to a salesforce-specific result code. maximum length of 64 characters. signature global void setgatewayresultcode(string gatewayresultcode) 293apex reference guide authorizationresponse class parameters gatewayresultcode type: string gateway-specific result code. must be used to map a salesforce-specific result code. return value type: void setgatewayresultcodedescription(gatewayresultcodedescription) sets a description of the gateway-specific result code that a payment gateway returned. maximum length of 1000 characters. signature global void setgatewayresultcodedescription(string gatewayresultcodedescription) parameters gatewayresultcodedescription type: string description of the gateway’s result code. use this field to learn more about why the gateway returned a certain result code. return value type: void setpaymentmethodtokenizationresponse(paymentmethodtokenizationresponse) sets information from the gateway about the tokenized payment method. signature global void setpaymentmethodtokenizationresponse(commercepayments.paymentmethodtokenizationresponse paymentmethodtokenizationresponse) parameters paymentmethodtokenizationresponse paymentmethodtokenizationresponse on page 345 gateway response sent by payment gateway adapters for the payment method tokenization request. return value type: void 294apex reference guide baseapipaymentmethodrequest class setsalesforceresultcodeinfo(salesforceresultcodeinfo) sets the salesforce-specific result code information. payment gateways have many response codes for payment calls. salesforce uses the result code information to map payment gateway codes to a predefined set of standard salesforce result codes. signature global void setsalesforceresultcodeinfo(commercepayments.salesforceresultcodeinfo salesforceresultcodeinfo) parameters salesforceresultcodeinfo type: salesforceresultcodeinfo on page 380 description of the salesforce result code value. return value type: void baseapipaymentmethodrequest class abstract class used to send information about a payment method to a gateway adapter during a service call. namespace commercepayments usage baseapipaymentmethodrequest is the base class for saleapipaymentmethodrequest and authapipaymentmethodrequest. in this section: baseapipaymentmethodrequest constructors baseapipaymentmethodrequest properties baseapipaymentmethodrequest methods baseapipaymentmethodrequest constructors the following are constructors for baseapipaymentmethodrequest. in this section: baseapipaymentmethodrequest(address, id, saveforfuture) constructs a payment method. this constructor is intended for test usage and throws an exception if used outside of the apex test context. 295apex reference guide baseapipaymentmethodrequest class baseapipaymentmethodrequest(" "address, id, saveforfuture) constructs a payment method. this constructor is intended for test usage and throws an exception if used outside of the apex test context. signature global baseapipaymentmethodrequest(commercepayments.addressrequest address, string id, boolean saveforfuture) parameters address type: commercepayments.addressrequest on page 262 sends data related on address request to a gateway adapter during a service call. id type: string saveforfuture type: boolean indicates whether salesforce saves the payment method for future use. baseapipaymentmethodrequest properties the following are properties for baseapipaymentmethodrequest. in this section: address the payment method’s address. id id of the payment method request. saveforfuture indicates whether the payment method is saved as a record in salesforce for future use. address the payment method’s address. signature global commercepayments.addressrequest address {get; set;} property value type: addressrequest on page 262 296apex reference guide baseapipaymentmethodrequest class id id of the payment method request. signature global string id {get; set;} property value type: string saveforfuture indicates whether the payment method is saved as a record in salesforce for future use. signature global boolean saveforfuture {get; set;} property value type: boolean baseapipaymentmethodrequest methods the following are methods for baseapipaymentmethodrequest. in this section: equals(obj) maintains the integrity of lists of type baseapipaymentmethodrequest by determining the equality of external objects in a list. this method is dynamic and is based on the equals method in java. hashcode() maintains the integrity of lists of type baseapipaymentmethodrequest by determining the uniqueness of the external object records in a list. tostring() converts a date to a string. equals(obj) maintains the integrity of lists of type baseapipaymentmethodrequest by determining the equality of external objects in a list. this method is dynamic and is based on the equals method in java. signature global boolean equals(object obj) 297apex reference guide basenotification class parameters obj type: object external object whose key is to be validated. return value type: boolean hashcode() maintains the integrity of lists of type baseapipaymentmethodrequest by determining the uniqueness of the external object records in a list. signature global integer hashcode() return value type: integer tostring() converts a date to a string. signature global string tostring() return value type: string basenotification class abstract class for storing notification information sent from payment gateways. namespace commercepayments usage an abstract class that contains the common fields from payment gateways. basenotification can’t be instantiated on its own. the constructor of this class takes no arguments. for example: commercepayments.basenotification bnt = new commercepayments.basenotification(); 298apex reference guide basenotification class example commercepayments.basenotification notification = null; if ('capture'.equals(eventcode)) { notification = new commercepayments.capturenotification(); } else if ('refund'.equals(eventcode)) { notification = new commercepayments.referencedrefundnotification(); } in this section: basenotification methods basenotification methods the following are methods for basenotification. in this section: setamount(amount) sets the transaction amount. must be a non-negative value. setgatewaydate(gatewaydate) sets the date that the notification occurred. some gateways don’t send this value. setgatewaymessage(gatewaymessage) sets error messages that the gateway returned for the notification request. maximum length of 255 characters. setgatewayreferencedetails(gatewayreferencedetails) sets the payment gateway’s reference details. setgatewayreferencenumber(gatewayreferencenumber) sets the payment gateway’s reference number. setgatewayresultcode(gatewayresultcode) sets a gateway-specific result code. the code can be mapped to a salesforce-specific result code. maximum length of 64 characters. setgatewayresultcodedescription(gatewayresultcodedescription) sets a description of the" gateway-specific result code that a payment gateway returned. maximum length of 1000 characters. setid(id) sets the id of the notification sent by the gateway. setsalesforceresultcodeinfo(salesforceresultcodeinfo) sets the information about the salesforce-specific result code used to match a result code from a payment gateway. setstatus(status) sets the status of the notification sent by the gateway. setamount(amount) sets the transaction amount. must be a non-negative value. 299apex reference guide basenotification class signature global void setamount(double amount) parameters amount type: double the amount of the transaction. return value type: void setgatewaydate(gatewaydate) sets the date that the notification occurred. some gateways don’t send this value. signature global void setgatewaydate(datetime gatewaydate) parameters gatewaydate type: datetime the date that the notification occurred. return value type: void setgatewaymessage(gatewaymessage) sets error messages that the gateway returned for the notification request. maximum length of 255 characters. signature global void setgatewaymessage(string gatewaymessage) parameters gatewaymessage type: string the message that the gateway returned with the notification request. contains additional information about the notification. return value type: void 300apex reference guide basenotification class setgatewayreferencedetails(gatewayreferencedetails) sets the payment gateway’s reference details. signature global void setgatewayreferencedetails(string gatewayreferencedetails) parameters gatewayreferencedetails type: string provides information about the gateway communication. return value type: void setgatewayreferencenumber(gatewayreferencenumber) sets the payment gateway’s reference number. signature global void setgatewayreferencenumber(string gatewayreferencenumber) parameters gatewayreferencenumber type: string unique transaction id created by the payment gateway. return value type: void setgatewayresultcode(gatewayresultcode) sets a gateway-specific result code. the code can be mapped to a salesforce-specific result code. maximum length of 64 characters. signature global void setgatewayresultcode(string gatewayresultcode) parameters gatewayresultcode type: string gateway-specific result code. must be used to map a salesforce-specific result code. 301apex reference guide basenotification class return value type: void setgatewayresultcodedescription(gatewayresultcodedescription) sets a description of the gateway-specific result code that a payment gateway returned. maximum length of 1000 characters. signature global void setgatewayresultcodedescription(string gatewayresultcodedescription) parameters gatewayresultcodedescription type: string provides additional information about the result code and why the gateway returned the code. descriptions vary between different gateways. return value type: void setid(id) sets the id of the notification sent by the gateway. signature global void setid(string id) parameters id type: string return value type: void setsalesforceresultcodeinfo(salesforceresultcodeinfo) sets the information about the salesforce-specific result code used to match a result code from a payment gateway. signature global void setsalesforceresultcodeinfo(commercepayments.salesforceresultcodeinfo salesforceresultcodeinfo) 302apex reference guide basepaymentmethodrequest class parameters salesforceresultcodeinfo type: commercepayments.salesforceresultcodeinfo on page 380 payment gateways have many response codes for payment calls. salesforce uses the result code information to map payment gateway codes to a predefined set of standard salesforce result codes. return value type: void setstatus(status) sets the status of the notification sent by the gateway. signature global void setstatus(commercepayments.notificationstatus status) parameters status type: commercepayments.notificationstatus on page 333 shows whether the payments platform successfully received the notification from the gateway. return value type: void basepaymentmethodrequest class abstract class for storing information about payment methods. namespace commercepayments usage the basepaymentmethodrequest class contains fields common to cardpaymentmethodrequest on page 318 . in this section: basepaymentmethodrequest methods basepaymentmethodrequest methods the following are methods for basepaymentmethodrequest. 303 "apex reference guide basepaymentmethodrequest class in this section: equals(obj) maintains the integrity of lists of type basepaymentmethodrequest by determining the equality of external objects in a list. this method is dynamic and based on the equals method in java. hashcode() maintains the integrity of lists of type basepaymentmethodrequest by determining the uniqueness of the external object records in a list. tostring() converts a date to a string. equals(obj) maintains the integrity of lists of type basepaymentmethodrequest by determining the equality of external objects in a list. this method is dynamic and based on the equals method in java. signature global boolean equals(object obj) parameters obj type: object external object whose key is to be validated. return value type: boolean hashcode() maintains the integrity of lists of type basepaymentmethodrequest by determining the uniqueness of the external object records in a list. signature global integer hashcode() return value type: integer tostring() converts a date to a string. signature global string tostring() 304apex reference guide baserequest class return value type: string baserequest class baserequest is extended by all the request classes. namespace commercepayments in this section: baserequest methods baserequest methods the following are methods for baserequest. in this section: baserequest(additionaldata, idempotencykey) used for testing. baserequest(additionaldata, idempotencykey) used for testing. signature global void baserequest(string additionaldata, map idempotencykey) parameters additionaldata type: string contains additional data that may be required for a payment request. the additionaldata object consists of key-value pairs. you can retrieve the additionaldata object from the request object: map additionaldata=request.additionaldata idempotencykey type: map unique value that's generated by a client and sent to the server in the request. the server stores the value and uses the it to keep track of the request status. return value type: void 305apex reference guide capturenotification class capturenotification class when a payment gateway sends a notification for a capture transaction, the payment gateway adapter creates the capturenotification object to store information about the notification. namespace commercepayments usage capturenotification is used in asynchronous payment gateway adapters. specify the commercepayments namespace when creating an instance of this class. the constructor of this class takes no arguments. for example: commercepayments.capturenotification crn = new commercepayments.capturenotification(); example commercepayments.basenotification notification = null; if ('capture'.equals(eventcode)) { notification = new commercepayments.capturenotification(); } else if ('refund'.equals(eventcode)) { notification = new commercepayments.referencedrefundnotification(); } in this section: capturenotification methods capturenotification methods the following are methods for capturenotification. in this section: setamount(amount) sets the transaction amount. must be a non-negative value. setgatewaydate(gatewaydate) sets the date that the transaction occurred. some gateways don’t send this value. setgatewaymessage(gatewaymessage) sets error messages that the gateway returned for the payment request. maximum length of 255 characters. setgatewayreferencedetails(gatewayreferencedetails) sets additional data that you can use for subsequent transactions. you can use any data that isn’t normalized in financial entities. this field has a maximum length of 1000 characters and can store data as json or xml. setgatewayreferencenumber(gatewayreferencenumber) sets the unique gateway reference number for the transaction that the gateway returned. maximum length of 255 characters. 306apex reference guide capturenotification class setgatewayresultcode(gatewayresultcode) sets a gateway-specific result code. the code can be mapped to a salesforce-specific result code. maximum length of 64 characters. setgatewayresultcodedescription(gatewayresultcodedescription) sets a description of the gateway-specific result code that a gateway returned. maximum length of 1000 characters. setid(id) sets the id of a notification sent by the payment gateway. setsalesforceresultcodeinfo(s" alesforceresultcodeinfo) sets the salesforce-specific result code information. payment gateways have many response codes for payment calls. salesforce uses the result code information to map payment gateway codes to a predefined set of standard salesforce result codes. setstatus(status) sets the notification status to the same value that was sent by the gateway. setamount(amount) sets the transaction amount. must be a non-negative value. signature global void setamount(double amount) parameters amount type: double the amount to be debited or captured. return value type: void setgatewaydate(gatewaydate) sets the date that the transaction occurred. some gateways don’t send this value. signature global void setgatewaydate(datetime gatewaydate) parameters gatewaydate type: datetime date and time of the gateway communication. return value type: void 307apex reference guide capturenotification class setgatewaymessage(gatewaymessage) sets error messages that the gateway returned for the payment request. maximum length of 255 characters. signature global void setgatewaymessage(string gatewaymessage) parameters gatewaymessage type: string information on error messages sent from the gateway. return value type: void setgatewayreferencedetails(gatewayreferencedetails) sets additional data that you can use for subsequent transactions. you can use any data that isn’t normalized in financial entities. this field has a maximum length of 1000 characters and can store data as json or xml. signature global void setgatewayreferencedetails(string gatewayreferencedetails) parameters gatewayreferencedetails type: string return value type: void setgatewayreferencenumber(gatewayreferencenumber) sets the unique gateway reference number for the transaction that the gateway returned. maximum length of 255 characters. signature global void setgatewayreferencenumber(string gatewayreferencenumber) parameters gatewayreferencenumber type: string unique transaction id created by the payment gateway. 308apex reference guide capturenotification class return value type: void setgatewayresultcode(gatewayresultcode) sets a gateway-specific result code. the code can be mapped to a salesforce-specific result code. maximum length of 64 characters. signature global void setgatewayresultcode(string gatewayresultcode) parameters gatewayresultcode type: string gateway-specific result code. map this value to a salesforce-specific result code. return value type: void setgatewayresultcodedescription(gatewayresultcodedescription) sets a description of the gateway-specific result code that a gateway returned. maximum length of 1000 characters. signature global void setgatewayresultcodedescription(string gatewayresultcodedescription) parameters gatewayresultcodedescription type: string description of the gateway’s result code. use this field to learn more about why the gateway returned a certain result code. return value type: void setid(id) sets the id of a notification sent by the payment gateway. signature global void setid(string id) 309apex reference guide capturenotification class parameters id type: string return value type: void setsalesforceresultcodeinfo(salesforceresultcodeinfo) sets the salesforce-specific result code information. payment gateways have many response codes for payment calls. salesforce uses the result code information to map payment gateway codes to a predefined set of standard salesforce result codes. signature global void setsalesforceresultcodeinfo(commercepayments.salesforceresultcodeinfo salesforceresultcodeinfo) parameters salesforceresultcodeinfo type: commercepayments.salesforceresultcodeinfo on page 380 description of the salesforce result code value. return value type: void setstatus(status) sets the notification status to the same value that was sent by the gateway. signature global void setstatus(commercepayments.notificationstatus status) parameters status type: notificationstatus on page 333 sets the salesforce-specific result code information. payment gateways have many response codes for payment calls. salesforce uses the result code information to map payment gateway codes to a predefined set of standard salesforce result codes. return value type: void 310apex reference guide capturerequest class capturerequest class represents a capture request. this class extends the baserequest class and inherits all its methods. namespace commercepayments on page 256 usage the capturerequest class� "�s buildcapturerequest method creates a capturerequest object to store payment information, such as value and currency, as json strings. example builds a capturerequest object for a multicurrency org. private string buildcapturerequest(commercepayments.capturerequest capturerequest) { boolean is_multicurrency_org = userinfo.ismulticurrencyorganization(); queryutils qbuilderforauth = new queryutils(paymentauthorization.sobjecttype); // add required fields qbuilderforauth.getselectclause().addfield('gatewayrefnumber', false); if (is_multicurrency_org) { // addfield also takes a boolean to enable translation (uses label instead of actual value) qbuilderforauth.getselectclause().addfield('currencyisocode', false); } in this section: capturerequest constructors capturerequest properties capturerequest constructors the following are constructors for capturerequest. in this section: capturerequest(amount, authorizationid) this constructor is intended for test usage and throws an exception if used outside of the apex test context. capturerequest(amount, authorizationid) this constructor is intended for test usage and throws an exception if used outside of the apex test context. parameters amount type: double 311apex reference guide captureresponse class the amount to be debited or captured. authorizationid type: string represents a payment authorization record. capturerequest properties the following are properties for capturerequest. in this section: accountid account id value. references an account record. amount amount of currency that needs to be captured. paymentauthorizationid id value that references a paymentauthorization. accountid account id value. references an account record. property value type: string amount amount of currency that needs to be captured. property value type: double paymentauthorizationid id value that references a paymentauthorization. property value type: string captureresponse class the payment gateway adapter sends this response for the capture request type. this class extends abstractresponse and inherits its methods. 312apex reference guide captureresponse class namespace commercepayments on page 256 usage you must specify the commercepayments namespace when creating an instance of this class. the constructor of this class takes no arguments. for example: commercepayments.capture response ctr = new commercepayments.captureresponse(); in this section: captureresponse methods captureresponse methods the following are methods for captureresponse. in this section: setamount(amount) sets the transaction amount. setasync(async) indicates whether the payment gateway adapter used in the payment capture was asynchronous (true) or synchronous (false). setgatewayavscode(gatewayavscode) sets the payment gateway’s avs (address verification system) code. setgatewaydate(gatewaydate) sets the payment gateway’s date. setgatewaymessage(gatewaymessage) sets information or messages that the gateway returned. setgatewayreferencedetails(gatewayreferencedetails) sets the payment gateway’s reference details. setgatewayreferencenumber(gatewayreferencenumber) sets the payment gateway’s reference number. setgatewayresultcode(gatewayresultcode) sets the payment gateway’s result code. setgatewayresultcodedescription(gatewayresultcodedescription) sets the payment gateway’s result code description. setsalesforceresultcodeinfo(salesforceresultcodeinfo) sets salesforce result code information. setamount(amount) sets the transaction amount. 313apex reference guide captureresponse class signature global void setamount(double amount) parameters amount type: double the amount to be debited or captured. return value type: void setasync(async) indicates whether the payment gateway adapter used in the payment capture was asynchronous (true) or synchronous (false). signature global void setasync(boolean async) parameters async type: boolean return value type: void setgatewayavscode(gatewayavscode) sets the payment gateway’s avs (address verification system) code. signature global void setgatewayavscode(string gatewayavscode) parameters gatewayavscode type: string payment gateways that use an avs system return this code. return value type: void 314apex reference guide" "captureresponse class setgatewaydate(gatewaydate) sets the payment gateway’s date. signature global void setgatewaydate(datetime gatewaydate) parameters gatewaydate type: datetime the date that communication happened with the gateway. return value type: void setgatewaymessage(gatewaymessage) sets information or messages that the gateway returned. signature global void setgatewaymessage(string gatewaymessage) parameters gatewaymessage type: string information or error messages returned by the gateway. return value type: void setgatewayreferencedetails(gatewayreferencedetails) sets the payment gateway’s reference details. signature global void setgatewayreferencedetails(string gatewayreferencedetails) parameters gatewayreferencedetails type: string provides information about the gateway communication. 315apex reference guide captureresponse class return value type: void setgatewayreferencenumber(gatewayreferencenumber) sets the payment gateway’s reference number. signature global void setgatewayreferencenumber(string gatewayreferencenumber) parameters gatewayreferencenumber type: string unique transaction id created by the payment gateway. return value type: void setgatewayresultcode(gatewayresultcode) sets the payment gateway’s result code. signature global void setgatewayresultcode(string gatewayresultcode) parameters gatewayresultcode type: string the gateway result code. you must map this to a salesforce result code. return value type: void setgatewayresultcodedescription(gatewayresultcodedescription) sets the payment gateway’s result code description. signature global void setgatewayresultcodedescription(string gatewayresultcodedescription) 316apex reference guide cardcategory enum parameters gatewayresultcodedescription type: string description of the gatewayresultcode. provides additional context about the result code that the gateway returned. return value type: void setsalesforceresultcodeinfo(salesforceresultcodeinfo) sets salesforce result code information. signature global void setsalesforceresultcodeinfo(commercepayments.salesforceresultcodeinfo salesforceresultcodeinfo) parameters salesforceresultcodeinfo salesforceresultcodeinfotype: commercepayments.salesforceresultcodeinfo description of the salesforce result code value. return value type: void cardcategory enum defines whether the payment method represents a credit card or a debit card. namespace commercepayments on page 256 enum values the following are the values of the commercepayments.cardcategory enum. value description creditcard shows that the payment method is a credit card. debitcard shows that the payment method is a debit card. 317apex reference guide cardpaymentmethodrequest class cardpaymentmethodrequest class sends data related to a card payment method to a gateway adapter during a service call. namespace commercepayments on page 256 usage this class contains details about the card used as a payment method for authorization, sale, or tokenization transaction requests. the gateway adapter reads the fields of this class object while constructing a transaction json request to send to the payment gateway. the object of this class is available as the cardpaymentmethod field in the saleapipaymentmethodrequest class, authapipaymentmethodrequest class, and paymentmethodtokenizationrequest class. example: this code sample retrieves the cardpaymentmethodrequest object from the paymentmethod class. commercepayments.cardpaymentmethodrequest cardpaymentmethod = paymentmethod.cardpaymentmethod; in this section: cardpaymentmethodrequest constructors cardpaymentmethodrequest properties cardpaymentmethodrequest methods cardpaymentmethodrequest constructors the following are constructors for cardpaymentmethodrequest. in this section: cardpaymentmethodrequest(cardcategory) sets the cardcategory value for the card payment method request. cardpaymentmethodrequest(cardcategory) sets the cardcategory value for the card payment method request. signature global cardpaymentmethodrequest(commercepayments.cardcategory cardcategory) parameters cardcategory type: cardcategory on page 317 defines whether the card payment method is a credit card or a debit card. 318apex reference guide cardpaymentmethodrequest class cardpaymentmethodrequest properties the following are properties for cardpaymentmethodrequest. in this section: accountid customer account for this payment method. autopay indicates whether a token is being requested" "so that the payment method can be used for recurring payments. cardcategory indicates whether a card payment method is for a credit card or debit card. cardholderfirstname the first name of the cardholder for the card payment method. cardholderlastname the last name of the cardholder for the card payment method. cardholdername full name of the cardholder on the card payment method. cardnumber system-defined unique id for the card payment method. cardtype defines the credit card bank. possible values are americanexpress, dinersclub, jcb, maestro, mastercard, andvisa. cvv the card security code for the credit or debit card on a card payment method. email email address of the cardholder for the credit or debit card on a card payment method. expirymonth expiration month for the credit or debit card on a card payment method. expiryyear expiration year of the credit or debit card for the card payment method. inputcardtype input field for the card type. this field doesn’t store the card type directly, but instead populates cardbin, lastfour, and displaycardnumber based on the value entered in inputcardtype. startmonth the credit or debit card becomes valid on the first day of the startmonth in the startyear startyear year during which the credit or debit card becomes valid. accountid customer account for this payment method. 319apex reference guide cardpaymentmethodrequest class signature global string accountid {get; set;} property value type: string autopay indicates whether a token is being requested so that the payment method can be used for recurring payments. signature global boolean autopay {get; set;} property value type: boolean cardcategory indicates whether a card payment method is for a credit card or debit card. signature global commercepayments.cardcategory cardcategory {get; set;} property value type: cardcategory on page 317 cardholderfirstname the first name of the cardholder for the card payment method. signature global string cardholderfirstname {get; set;} property value type: string cardholderlastname the last name of the cardholder for the card payment method. signature global string cardholderlastname {get; set;} 320apex reference guide cardpaymentmethodrequest class property value type: string cardholdername full name of the cardholder on the card payment method. signature global string cardholdername {get; set;} property value type: string cardnumber system-defined unique id for the card payment method. signature global string cardnumber {get; set;} property value type: string cardtype defines the credit card bank. possible values are americanexpress, dinersclub, jcb, maestro, mastercard, andvisa. signature global commercepayments.cardtype cardtype {get; set;} property value type: cardtype cvv the card security code for the credit or debit card on a card payment method. signature global string cvv {get; set;} property value type: string 321apex reference guide cardpaymentmethodrequest class email email address of the cardholder for the credit or debit card on a card payment method. signature global string email {get; set;} property value type: string expirymonth expiration month for the credit or debit card on a card payment method. signature global integer expirymonth {get; set;} property value type: integer expiryyear expiration year of the credit or debit card for the card payment method. signature global integer expiryyear {get; set;} property value type: integer inputcardtype input field for the card type. this field doesn’t store the card type directly, but instead populates cardbin, lastfour, and displaycardnumber based on the value entered in inputcardtype. signature global string inputcardtype {get; set;} property value type: string 322apex reference guide cardpaymentmethodrequest class startmonth the credit or debit card becomes valid on the first day of the startmonth in the startyear signature global integer startmonth {get; set;} property value type: integer startyear year during which the credit or debit card becomes valid. signature global integer startyear {get; set;} property value type: integer cardpaymentmethodrequest methods" "the following are methods for cardpaymentmethodrequest. in this section: equals(obj) maintains the integrity of lists of type cardpaymentmethodrequest by determining the equality of external objects in a list. this method is dynamic and based on the equals method in java. hashcode() maintains the integrity of lists of type cardpaymentmethodrequest. tostring() converts a date to a string. equals(obj) maintains the integrity of lists of type cardpaymentmethodrequest by determining the equality of external objects in a list. this method is dynamic and based on the equals method in java. signature global boolean equals(object obj) 323apex reference guide custommetadatatypeinfo class parameters obj type: object external object whose key is to be validated. return value type: boolean hashcode() maintains the integrity of lists of type cardpaymentmethodrequest. signature global integer hashcode() return value type: integer tostring() converts a date to a string. signature global string tostring() return value type: string custommetadatatypeinfo class access information about custom metadata. the paymentgatewayadapter can send custommetadatatypeinfo to transaction requests through the response object’s salesforceresultcodeinfo. namespace commercepayments on page 256 in this section: custommetadatatypeinfo constructors custommetadatatypeinfo methods 324apex reference guide gatewayerrorresponse class custommetadatatypeinfo constructors the following are constructors for custommetadatatypeinfo. in this section: custommetadatatypeinfo(cmtrecordid, cmtsfresultcodefieldname) constructor for providing custom metadata type information. custommetadatatypeinfo(cmtrecordid, cmtsfresultcodefieldname) constructor for providing custom metadata type information. signature global custommetadatatypeinfo(string cmtrecordid, string cmtsfresultcodefieldname) parameters cmtrecordid type: string id of the matchedcustom metadata type record cmtsfresultcodefieldname type: string field that contains the salesforce result code values. belongs to the custom metadata type. custommetadatatypeinfo methods the following are methods for custommetadatatypeinfo. gatewayerrorresponse class use to respond with an error indication following errors from the paymentgateway adapter, such as request-forbidden responses, custom validation errors, or expired api tokens. namespace commercepayments on page 256 usage use gatewayerrorresponse to create an object that stores information about error responses sent by the payment gateway adapter. 325apex reference guide gatewayerrorresponse class example if gatewayresponse receives an exception rather than a valid request, it calls gatewayerrorresponse to create an error object with information about the exception. global commercepayments.gatewayresponse processrequest(commercepayments.paymentgatewaycontext gatewaycontext) { commercepayments.requesttype requesttype = gatewaycontext.getpaymentrequesttype(); commercepayments.gatewayresponse response; try { if (requesttype == commercepayments.requesttype.authorize) { response = createauthresponse((commercepayments.authorizationrequest)gatewaycontext.getpaymentrequest()); } else if (requesttype == commercepayments.requesttype.capture) { response = createcaptureresponse((commercepayments.capturerequest)gatewaycontext.getpaymentrequest()) ; } else if (requesttype == commercepayments.requesttype.referencedrefund) { response = createrefundresponse((commercepayments.referencedrefundrequest)gatewaycontext.getpaymentrequest()); } return response; } catch(salesforcevalidationexception e) { commercepayments.gatewayerrorresponse error = new commercepayments.gatewayerrorresponse('400', e.getmessage()); return error; } } in this section: gatewayerrorresponse constructors gatewayerrorresponse constructors the following are constructors for gatewayerrorresponse. in this section: gatewayerrorresponse(errorcode, errormessage) constructor to create a gatewayerrorresponse object that accepts errorcode and errormessage. gatewayerrorresponse(errorcode, errormessage) constructor to create a gatewayerrorresponse object that accepts errorcode and errormessage. signature global gatewayerrorresponse(string errorcode, string errormessage) 326apex reference guide gatewaynotificationresponse class parameters errorcode type" ": string should match with the http status code to be returned to the user. here are a few examples. • if the status code is for a bad request, the errorcode should be 400. • if the status code is for a forbidden request, errorcode should be 403. • if errorcode isn’t a valid http status code, a 500 internal server error is returned. note: errorcode must have a value, otherwise the platform throws an error. errormessage type: string the message response to users following an error. note: errormessage must have a value, otherwise the platform throws an error. gatewaynotificationresponse class when the payment gateway sends a notification to the payments platform, the platform responds with a gatewaynotificationresponse indicating whether the platform succeeded or failed at receiving the notification. namespace commercepayments on page 256 usage you must specify the commercepayments namespace when creating an instance of this class. the constructor of this class takes no arguments. for example: commercepayments.gatewaynotificationresponse gnr = new commercepayments.gatewaynotificationresponse(); when an asynchronous payment gateway sends a notification, the gateway requires the platform to acknowledge that it has either succeeded or failed in receiving the notification. payment gateway adapters use this class to construct the acknowledgment response, which gateways expect for a notification. gatewaynotificationresponse is the return type of the processnotification method. example commercepayments.gatewaynotificationresponse gnr = new commercepayments.gatewaynotificationresponse(); if (saveresult.issuccess()) { system.debug('notification accepted by platform'); } else { system.debug('errors in the result '+ blob.valueof(saveresult.geterrormessage())); } gnr.setstatuscode(200); 327apex reference guide gatewaynotificationresponse class gnr.setresponsebody(blob.valueof('[accepted]')); return gnr; in this section: gatewaynotificationresponse methods gatewaynotificationresponse methods the following are methods for gatewaynotificationresponse. in this section: setresponsebody(responsebody) sets the body of the response to the gateway. some gateways expect the payments platform to acknowledge the notification with a response regardless of whether the notification was accepted. setstatuscode(statuscode) sets the http status code sent to the gateway as part of the payments platform’s response notification. setresponsebody(responsebody) sets the body of the response to the gateway. some gateways expect the payments platform to acknowledge the notification with a response regardless of whether the notification was accepted. signature global void setresponsebody(blob responsebody) parameters responsebody type: blob common response values include accepted for successfully receiving the response. for example: commercepayments.gatewaynotificationresponse gnr = new commercepayments.gatewaynotificationresponse(); if (saveresult.issuccess()) { system.debug('notification accepted by platform'); } else { system.debug('errors in the result '+ blob.valueof(saveresult.geterrormessage())); } gnr.setstatuscode(200); gnr.setresponsebody(blob.valueof('[accepted]')); return gnr; return value type: void 328apex reference guide gatewayresponse interface setstatuscode(statuscode) sets the http status code sent to the gateway as part of the payments platform’s response notification. signature global void setstatuscode(integer statuscode) parameters statuscode type: integer the status code will vary based on the type of payments platform response. users should configure their gatewaynotificationresponse class to account for all values that their payments platform can possibly return. for example: commercepayments.gatewaynotificationresponse gnr = new commercepayments.gatewaynotificationresponse(); if (saveresult.issuccess()) { system.debug('notification accepted by platform'); } else { system.debug('errors in the result '+ blob.valueof(saveresult.geterrormessage())); } gnr.setstatuscode(200); gnr.setresponsebody(blob.valueof('[accepted]')); return gnr; return value type: void gatewayresponse interface generic payment gateway response interface. this class extends the captureresponse on page 312, abstracttransactionresponse on page 268, and abstractresponse on page 259 classes and inherits all their properties. it" "has no unique methods or parameters. namespace commercepayments on page 256 in this section: gatewayresponse example implementation gatewayresponse example implementation this is an example implementation of the commercepayments.gatewayresponse interface. /** * abstract function to build gateway response for a transaction 329apex reference guide notificationclient class * the input is the response from gateway * it creates and returns gatewayresponse from the httpresponse */ public abstract commercepayments.gatewayresponse buildresponse(httpresponse response); /** * function to process transaction requests * steps involved are: * 1. build httprequest with the input request from gateway context * 2. send request and get the response from gateway * 3. parse the response from gateway and return gatewayresponse */ public commercepayments.gatewayresponse execute(){ httprequest req; try{ //building a new request req = buildrequest(); } catch(payeezevalidationexception e) { return getvalidationexceptionerror(e); } commercepayments.paymentshttp http = new commercepayments.paymentshttp(); httpresponse res = null; try{ //sending the request res = http.send(req); } catch(calloutexception ce) { return getcalloutexceptionerror(ce); } try{ //parsing the response from gateway return buildresponse(res); } catch(exception e) { return getparseexceptionerror(e); } } for additional context, review the complete sample gateway adapter in the commercepayments gateway reference implementation. notificationclient class communicates with the payment platform regarding the gateway’s notification. namespace commercepayments on page 256 usage specify the commercepayments namespace when creating an instance of this class. the constructor of this class takes no arguments. for example: commercepayments.notificationclient ntc = new commercepayments.notificationclient(); 330apex reference guide notificationsaveresult class this class is used in asynchronous payment gateway adapters. the notification client contains api for communicating with the payments platform regarding the gateway’s notification. when the gateway sends a notification, the gateway adapter invokes the record method in notificationclient to request that the platform updates notification details. example the notificationsaveresult class creates a saveresult object to store the result of the save request made to the payment gateway. commercepayments.notificationsaveresult saveresult = commercepayments.notificationclient.record(notification); in this section: notificationclient methods notificationclient methods the following are methods for notificationclient. in this section: record(notification) stores the results of a notification request. record(notification) stores the results of a notification request. signature global static commercepayments.notificationsaveresult record(commercepayments.basenotification notification) parameters notification type: basenotification on page 298 return value type: notificationsaveresult on page 331 notificationsaveresult class contains the result of the payment platform’s attempt to record data from the gateway’s notification. namespace commercepayments on page 256 331apex reference guide notificationsaveresult class usage this class is used with asynchronous payments. it is the return type of the notificiationclient.record operation and contains the result of the payment platform’s attempt to save notification details. the constructor of this class takes no arguments. for example: commercepayments.notificationsaveresult nsr = new commercepayments.notificationsaveresult(); example commercepayments.notificationsaveresult saveresult = commercepayments.notificationclient.record(notification); in this section: notificationsaveresult methods notificationsaveresult methods the following are methods for notificationsaveresult. in this section: geterrormessage() gets the error message, if any, from the payment platform regarding its attempt to save the notification sent from the payment gateway. getstatuscode() gets the status code from the payment platform’s attempt to save the notification sent from the payment gateway. issuccess() gets the status of whether the payment platform successfully saved the notification sent from the payment gateway. geterrormessage() gets the error message, if any, from the payment platform regarding its attempt to save the notification sent from the payment gateway. signature global string geterrormessage() return value type: string getstatuscode() gets the status code from the payment platform’s attempt to save the notification sent from" the payment gateway. 332 "apex reference guide notificationstatus enum signature global integer getstatuscode() return value type: integer issuccess() gets the status of whether the payment platform successfully saved the notification sent from the payment gateway. signature global boolean issuccess() return value type: boolean notificationstatus enum shows whether the payments platform successfully received the notification from the gateway. usage when the gateway sends a notification for a payment request, the payments platform delegates the notification request to the gateway adapter. first, the adapter evaluates the signature from the notification request. if the signature is valid, the adapter builds a notification object to store information about the notification. during this process, the adapter sets the notificationstatus to failed or success based on information from the notification request. enum values the following are the values of the commercepayments.notificationstatus enum. value description failed the payments platform couldn’t receive the notification due to an error. success the payments platform received the notification. paymentgatewayadapter interface paymentgatewayadapters can implement this interface in order to process requests. namespace commercepayments on page 256 333apex reference guide paymentgatewayasyncadapter interface in this section: paymentgatewayadapter methods paymentgatewayadapter methods the following are methods for paymentgatewayadapter. in this section: processrequest(var1) the entry point for processing payment requests. returns the response from the payment gateway. processrequest(var1) the entry point for processing payment requests. returns the response from the payment gateway. signature global commercepayments.gatewayresponse processrequest(commercepayments.paymentgatewaycontext var1) parameters var1 type: commercepayments.paymentgatewaycontext you can retrieve the request type and the request from the context object. return value type: commercepayments.gatewayresponse the response from the payment gateway. paymentgatewayasyncadapter interface implement the interface to allow customers to process payments asynchronously. namespace commercepayments on page 256 usage implementing an asynchronous adapter also requires the processnotification method from the gatewaynotificationresponse on page 327 class. 334apex reference guide paymentgatewayasyncadapter interface example global with sharing class sampleasyncadapter implements commercepayments.paymentgatewayasyncadapter, commercepayments.paymentgatewayadapter { global sampleasyncadapter() {} global commercepayments.gatewayresponse processrequest(commercepayments.paymentgatewaycontext gatewaycontext) { } global commercepayments.gatewaynotificationresponse processnotification(commercepayments.paymentgatewaynotificationcontext gatewaynotificationcontext) { } } in this section: paymentgatewayasyncadapter methods paymentgatewayasyncadapter example implementation paymentgatewayasyncadapter methods the following are methods for paymentgatewayasyncadapter. in this section: processnotification(paymentgatewaynotificationcontext) entry point for processing notifications from payment gateways. processnotification(paymentgatewaynotificationcontext) entry point for processing notifications from payment gateways. signature global commercepayments.gatewaynotificationresponse processnotification(commercepayments.paymentgatewaynotificationcontext var1) parameters paymentgatewaynotificationcontext type: paymentgatewaynotificationcontext on page 339 the paymentgatewaynotificationcontext object wraps all the information related to a gateway notification. return value type: gatewaynotificationresponse on page 327 when the payment gateway sends a notification to the payments platform, the platform responds with a gatewaynotificationresponse indicating whether the platform succeeded or failed at receiving the notification. 335apex reference guide paymentgatewayasyncadapter interface paymentgatewayasyncadapter example implementation this is a sample implementation of the commercepayments.paymentgatewayasyncadapter interface. global with sharing class adyenadapter implements commercepayments.paymentgatewayasyncadapter, commercepayments.paymentgatewayadapter { global adyenadapter() {} global commercepayments.gatewayresponse processrequest(commercepayments.paymentgatewaycontext gatewaycontext) { } global commercepayments.gatewaynotificationresponse processnotification(commercepayments.paymentgatewaynotificationcontext gatewaynotificationcontext) { } } commercepayments.requesttype requesttype = gatewaycontext.getpaymentrequesttype(); if (requesttype == commercepayments.requesttype.capture) { req.setendpoint('/pal/servlet/payment/v52" "/capture'); // refer to the end of this doc for sample buildcapturerequest implementation body = buildcapturerequest((commercepayments.capturerequest)gatewaycontext.getpaymentrequest()); } else if (requesttype == commercepayments.requesttype.referencedrefund) { req.setendpoint('/pal/servlet/payment/v52/refund'); body = buildrefundrequest((commercepayments.referencedrefundrequest)gatewaycontext.getpaymentrequest()); } req.setbody(body); req.setmethod('post'); commercepayments.paymentshttp http = new commercepayments.paymentshttp(); httpresponse res = null; try { res = http.send(req); } catch(calloutexception ce) { commercepayments.gatewayerrorresponse error = new commercepayments.gatewayerrorresponse('500', ce.getmessage()); return error; } if ( requesttype == commercepayments.requesttype.capture) { // refer to the end of this doc for sample createcaptureresponse implementation response = createcaptureresponse(res); } else if ( requesttype == commercepayments.requesttype.referencedrefund) { response = createrefundresponse(res); } return response; commercepayments.paymentgatewaynotificationrequest notificationrequest = gatewaynotificationcontext.getpaymentgatewaynotificationrequest(); blob request = notificationrequest.getrequestbody(); map jsonreq = (map)json.deserializeuntyped(request.tostring()); 336apex reference guide paymentgatewaycontext class list notificationitems = (list)jsonreq.get('notificationitems'); map notificationrequestitem = (map)((map)notificationitems[0]).get('notificationrequestitem'); boolean success = boolean.valueof(notificationrequestitem.get('success')); string pspreference = (string)notificationrequestitem.get('pspreference'); string eventcode = (string)notificationrequestitem.get('eventcode'); double amount = (double)((map)notificationrequestitem.get('amount')).get('value'); commercepayments.notificationstatus notificationstatus = null; if (success) { notificationstatus = commercepayments.notificationstatus.success; } else { notificationstatus = commercepayments.notificationstatus.failed; } commercepayments.basenotification notification = null; if ('capture'.equals(eventcode)) { notification = new commercepayments.capturenotification(); } else if ('refund'.equals(eventcode)) { notification = new commercepayments.referencedrefundnotification(); } notification.setstatus(notificationstatus); notification.setgatewayreferencenumber(pspreference); notification.setamount(amount); commercepayments.notificationsaveresult saveresult = commercepayments.notificationclient.record(notification); commercepayments.gatewaynotificationresponse gnr = new commercepayments.gatewaynotificationresponse(); if (saveresult.issuccess()) { system.debug('notification accepted by platform'); } else { system.debug('errors in the result '+ blob.valueof(saveresult.geterrormessage())); } gnr.setstatuscode(200); gnr.setresponsebody(blob.valueof('[accepted]')); return gnr; paymentgatewaycontext class wraps the information related to a payment request. namespace commercepayments on page 256 usage the constructor of this class takes no arguments. for example: 337apex reference guide paymentgatewaycontext class commercepayments.paymentgatewaycontext pgc = new commercepayments.paymentgatewaycontext(); example global commercepayments.gatewayresponse processrequest(commercepayments.paymentgatewaycontext gatewaycontext) { commercepayments.requesttype requesttype = gatewaycontext.getpaymentrequesttype(); if (requesttype == commercepayments.requesttype.capture) { commercepayments.capturerequest capturerequest = (commercepayments.capturerequest) gatewaycontext.getpaymentrequest(); } } in this section: paymentgatewaycontext constructors" "paymentgatewaycontext methods paymentgatewaycontext constructors the following are constructors for paymentgatewaycontext. in this section: paymentgatewaycontext(request, requesttype) constructor to enable instance creation. this constructor is intended for test usage and throws an exception if used outside of the apex test context. paymentgatewaycontext(request, requesttype) constructor to enable instance creation. this constructor is intended for test usage and throws an exception if used outside of the apex test context. signature global paymentgatewaycontext(commercepayments.paymentgatewayrequest request, string requesttype) parameters request type: commercepayments.paymentgatewayrequest raw payload. sensitive attributes are masked to ensure pci compliance. requesttype type: string defines the type of request made to the gateway 338apex reference guide paymentgatewaynotificationcontext class paymentgatewaycontext methods the following are methods for paymentgatewaycontext. in this section: getpaymentrequest() returns the payment request object. getpaymentrequesttype() returns the payment request type. getpaymentrequest() returns the payment request object. signature global commercepayments.paymentgatewayrequest getpaymentrequest() return value type: paymentgatewayrequest getpaymentrequesttype() returns the payment request type. signature global string getpaymentrequesttype() return value type: string paymentgatewaynotificationcontext class wraps the information related to a gateway notification. namespace commercepayments on page 256 usage this class is used with asynchronous payments. it wraps all of the information related to a notification from the payment gateway. the payments platform provides its context to the payment gateway adapters. the constructor of this class takes no arguments. for example: 339apex reference guide paymentmethodtokenizationrequest class commercepayments.paymentgatewaynotificationcontext pgnc = new commercepayments.paymentgatewaynotificationcontext(); example global commercepayments.gatewaynotificationresponse processnotification(commercepayments.paymentgatewaynotificationcontext gatewaynotificationcontext) { commercepayments.paymentgatewaynotificationrequest notificationrequest = gatewaynotificationcontext.getpaymentgatewaynotificationrequest(); } in this section: paymentgatewaynotificationcontext methods paymentgatewaynotificationcontext methods the following are methods for paymentgatewaynotificationcontext. in this section: getpaymentgatewaynotificationrequest() returns the payment gateway’s notification request. getpaymentgatewaynotificationrequest() returns the payment gateway’s notification request. signature global commercepayments.paymentgatewaynotificationrequest getpaymentgatewaynotificationrequest() return value type: paymentgatewaynotificationrequest on page 351 paymentmethodtokenizationrequest class stores data about a request to tokenize a card payment method. the tokenization process occurs in the payment gateway. this process replaces sensitive customer data, such as a card number or cvv, with unique identification symbols. the symbols are used while the data is handled by salesforce, the payment gateway, and the customer bank, allowing salesforce to store the token without storing sensitive customer data. namespace commercepayments on page 256 340apex reference guide paymentmethodtokenizationrequest class usage the constructor of this class takes no arguments. for example: commercepayments.paymentmethodtokenizationrequest pmtr = new commercepayments.paymentmethodtokenizationrequest(); this class holds all the required details about the tokenize request. gateway adapters read the information in this class while constructing a tokenization json request, which is sent to the payment gateway. example the following code is used within your payment gateway adapter apex class. use the gatewayresponse class's processrequest method to build responses based on the request type that it receives from an instance of paymentgatewaycontext on page 337. if the request type is tokenize, gatewayresponse on page 329 calls the createtokenizeresponse method and passes an instance of the paymentmethodtokenizationrequest class. the passed paymentmethodtokenizationrequest object contains the address and cardpaymentmethod information that the payment gateway needs to manage the tokenization process. for example: global commercepayments.gatewayresponse processrequest(commercepayments.paymentgatewaycontext gatewaycontext) { commercepayments.requesttype requesttype = gatewaycontext.getpaymentrequesttype(); commercepayments.gatewayresponse response; try { if (request" "type == commercepayments.requesttype.tokenize) { response = createtokenizeresponse((commercepayments.paymentmethodtokenizationrequest)gatewaycontext.getpaymentrequest()); } //add other else if statements for different request types as needed. return response; } catch(salesforcevalidationexception e) { commercepayments.gatewayerrorresponse error = new commercepayments.gatewayerrorresponse('400', e.getmessage()); return error; } } configure the createtokenizeresponse method to accept an instance of paymentmethodtokenizationrequest. then, build an instance of paymentmethodtokenizationresponse based on the values received from the payment gateway. public commercepayments.gatewayresponse createtokenizeresponse(commercepayments.paymentmethodtokenizationrequest tokenizerequest) { commercepayments.paymentmethodtokenizationresponse tokenizeresponse = new commercepayments.paymentmethodtokenizationresponse(); tokenizeresponse.setgatewaytokenencrypted(encryptedvalue); tokenizeresponse.setgatewaytokendetails(tokendetails); tokenizeresponse.setgatewayavscode(avscode); 341apex reference guide paymentmethodtokenizationrequest class tokenizeresponse.setgatewaymessage(gatewaymessage); tokenizeresponse.setgatewayresultcode(resultcode); tokenizeresponse.setgatewayresultcodedescription(resultcodedescription); tokenizeresponse.setsalesforceresultcodeinfo(resultcodeinfo); tokenizeresponse.setgatewaydate(system.now()); return tokenizeresponse; } the tokenizeresponse contains the results of the gateway's tokenization process, and if successful, the tokenized value. in this section: paymentmethodtokenizationrequest constructors paymentmethodtokenizationrequest properties paymentmethodtokenizationrequest methods paymentmethodtokenizationrequest constructors the following are constructors for paymentmethodtokenizationrequest. in this section: paymentmethodtokenizationrequest(paymentgatewayid) payment gateway id constructor used with paymentmethodtokenizationrequest. this constructor is intended for test usage and throws an exception if used outside of the apex test context. paymentmethodtokenizationrequest() the following are constructors for paymentmethodtokenizationrequest. paymentmethodtokenizationrequest(paymentgatewayid) payment gateway id constructor used with paymentmethodtokenizationrequest. this constructor is intended for test usage and throws an exception if used outside of the apex test context. signature global paymentmethodtokenizationrequest(string paymentgatewayid) parameters paymentgatewayid type: string the payment method’s payment gateway id that will be tokenized. paymentmethodtokenizationrequest() the following are constructors for paymentmethodtokenizationrequest. 342apex reference guide paymentmethodtokenizationrequest class signature global paymentmethodtokenizationrequest() paymentmethodtokenizationrequest properties the following are properties for paymentmethodtokenizationrequest. in this section: address the card payment method address to be tokenized. cardpaymentmethod the card payment method containing data to be tokenized. address the card payment method address to be tokenized. signature global commercepayments.addressrequest address {get; set;} property value type: addressrequest on page 262 cardpaymentmethod the card payment method containing data to be tokenized. signature global commercepayments.cardpaymentmethodrequest cardpaymentmethod {get; set;} property value type: cardpaymentmethodrequest on page 318 paymentmethodtokenizationrequest methods the following are methods for paymentmethodtokenizationrequest. in this section: equals(obj) maintains the integrity of lists of type paymentmethodtokenizationrequest by determining the equality of external objects in a list. this method is dynamic and is based on the equals method in java. 343apex reference guide paymentmethodtokenizationrequest class hashcode() maintains the integrity of lists of type paymentmethodtokenizationrequest by determining the uniquness of the external object records in a list. tostring() converts a date to a string. equals(obj) maintains the integrity of lists of type paymentmethodtokenizationrequest by determining the equality of external objects in a list. this method is dynamic and is based on the equals method in java. signature global boolean equals(object obj) parameters obj type: object external object whose key is to be validated. return value type: boolean hashcode() maintains the integrity of lists of type paymentmethodtokenization" "request by determining the uniquness of the external object records in a list. signature global integer hashcode() return value type: integer tostring() converts a date to a string. signature global string tostring() return value type: string 344apex reference guide paymentmethodtokenizationresponse class paymentmethodtokenizationresponse class gateway response sent by payment gateway adapters for the payment method tokenization request. the response includes the payment method’s token id value. namespace commercepayments on page 256 usage the constructor of this class takes no arguments. for example: commercepayments.paymentmethodtokenizationresponse pmtr = new commercepayments.paymentmethodtokenizationresponse(); after the payment gateway processes a tokenization request, the fields of paymentmethodtokenizationresponse receive and store information from the gateway's response. the gateway's response shows whether the tokenization request was successful, the token value, and any additional messages or information about the tokenization process. you can then pass an instance of paymentmethodtokenizationresponse to an authorization response or a sale response. this class is mapped to a response class in the java layer. example this constructor builds a new instance of the paymentmethodtokenizationresponse class. commercepayments.paymentmethodtokenizationresponse tokenizeresponse = new commercepayments.paymentmethodtokenizationresponse(); paymentmethodtokenizationresponse contains only setter methods. each setter accepts a value from the payment gateway and use it to set an attribute of paymentmethodtokenizationresponse. the most important method in paymentmethodtokenizationresponse is setgatewaytokenencrypted, which uses salesforce encryption to set an encrypted token value for a payment method. the setgatewaytokenencrypted method is available in salesforce api v52.0 and later. we recommend using it to ensure your tokenized payment method values are encrypted and secure. while the setgatewaytoken method (available in earlier api versions) also returns a payment method token, the tokenized value isn't encrypted. if the instantiated class already has a gateway token, setgatewaytokenencrypted throws an error. /** @description method to set gateway token to persist in encrypted text */ global void setgatewaytokenencrypted(string gatewaytokenencrypted) { if (gatewaytokenset) { throwtokenerror(); } this.delegate.setgatewaytokenencrypted(gatewaytokenencrypted); gatewaytokenencryptedset = true; } a typical instantiation of paymentmethodtokenizationresponse sets the encrypted gateway token alongside the other tokenization response values sent by the gateway. public commercepayments.gatewayresponse createtokenizeresponse(commercepayments.paymentmethodtokenizationrequest tokenizerequest) 345apex reference guide paymentmethodtokenizationresponse class { commercepayments.paymentmethodtokenizationresponse tokenizeresponse = new commercepayments.paymentmethodtokenizationresponse(); tokenizeresponse.setgatewaytokenencrypted(gatewaytokenencrypted); tokenizeresponse.setgatewaytokendetails(gatewaytokendetails); tokenizeresponse.setgatewayavscode(gatewayavscode); tokenizeresponse.setgatewaymessage(gatewaymessage); tokenizeresponse.setgatewayresultcode(gatewayresultcode); tokenizeresponse.setgatewayresultcodedescription(gatewayresultcodedescription); tokenizeresponse.setsalesforceresultcodeinfo(success_salesforce_result_code_info); tokenizeresponse.setgatewaydate(system.now()); return tokenizeresponse; } after you've built a paymentmethodtokenizationresponse object and set the encrypted gateway token, pass the object to the setpaymentmethodtokenizationresponse method of an authorization response or a sale response. authorization response public commercepayments.gatewayresponse createauthresponse(commercepayments.authorizationrequest authrequest) { commercepayments.authorizationresponse authresponse = new commercepayments.authorizationresponse(); commercepayments.paymentmethodtokenizationresponse paymentmethodtokenizationresponse = new commercepayments.paymentmethodtokenizationresponse(); if(authrequest.amount!=null ) { authresponse.setamount(authrequest.amount); } else { throw new salesforcevalidationexception('required field missing : amount'); } authresponse.setgatewayresultcode('00'); authresponse.setgatewayresultcodedescription('transaction normal'); authresponse.setgatewayauthcode('sf'+getrandomnumber(6));" authresponse.setgatewayreferencenumber(getrandomnumber(10)); authresponse.setsalesforceresultcodeinfo(success_salesforce_result_code_info); authresponse.setgatewaydate(system.now()); paymentmethodtokenizationresponse.setgatewaytokenencrypted(gatewaytokenencrypted); authresponse.setpaymentmethodtokenizationresponse(paymentmethodtokenizationresponse); return authresponse; } sale response public commercepayments.gatewayresponse createsaleresponse(commercepayments.salerequest salerequest) { commercepayments.saleresponse saleresponse = new commercepayments.saleresponse(); 346apex reference guide paymentmethodtokenizationresponse class commercepayments.paymentmethodtokenizationresponse paymentmethodtokenizationresponse = new commercepayments.paymentmethodtokenizationresponse(); if(salerequest.amount!=null ) { saleresponse.setamount(salerequest.amount); } else { throw new salesforcevalidationexception('required field missing : amount'); } system.debug('response - success'); saleresponse.setgatewaydate(system.now()); saleresponse.setgatewayresultcode('00'); saleresponse.setgatewayresultcodedescription('transaction normal'); saleresponse.setgatewayreferencenumber('sf'+getrandomnumber(6)); saleresponse.setsalesforceresultcodeinfo(success_salesforce_result_code_info); paymentmethodtokenizationresponse.setgatewaytokenencrypted(gatewaytokenencrypted); saleresponse.setpaymentmethodtokenizationresponse(paymentmethodtokenizationresponse); return saleresponse; } in this section: paymentmethodtokenizationresponse methods paymentmethodtokenizationresponse methods the following are methods for paymentmethodtokenizationresponse. in this section: setgatewayavscode(gatewayavscode) sets the avs (address verification system) result code information that the gateway returned. maximum length of 64 characters. setgatewaydate(gatewaydate) sets the date that the tokenization occurred. some gateways don’t send this value. setgatewaymessage(gatewaymessage) sets error messages that the gateway returned for the tokenization request. maximum length of 255 characters. setgatewayresultcode(gatewayresultcode) sets a gateway-specific result code. the code may be mapped to a salesforce-specific result code. maximum length of 64 characters. setgatewayresultcodedescription(gatewayresultcodedescription) sets a description of the gateway-specific result code that a payment gateway returned. maximum length of 1000 characters. 347apex reference guide paymentmethodtokenizationresponse class setgatewaytoken(gatewaytoken) sets the gateway token value that the gateway returned. setgatewaytokendetails(gatewaytokendetails) sets any additional information that the gateway returned about the payment token. setgatewaytokenencrypted(gatewaytokenencrypted) sets the value of the gatewaytokenencrypted field on a cardpaymentmethod or digitalwallet object. setsalesforceresultcodeinfo(salesforceresultcodeinfo) sets the salesforce-specific result code information. payment gateways have many response codes for payment calls. salesforce uses the result code information to map payment gateway codes to a predefined set of standard salesforce result codes. setgatewayavscode(gatewayavscode) sets the avs (address verification system) result code information that the gateway returned. maximum length of 64 characters. signature global void setgatewayavscode(string gatewayavscode) parameters gatewayavscode type: string used to verify the address mapped to a payment method when the payments platform requests tokenization from the payment gateway. return value type: void setgatewaydate(gatewaydate) sets the date that the tokenization occurred. some gateways don’t send this value. signature global void setgatewaydate(datetime gatewaydate) parameters gatewaydate type: datetime return value type: void setgatewaymessage(gatewaymessage) sets error messages that the gateway returned for the tokenization request. maximum length of 255 characters. 348apex reference guide paymentmethodtokenizationresponse class signature global void setgatewaymessage(string gatewaymessage) parameters gatewaymessage type: string return value type: void setgatewayresultcode(gatewayresultcode) sets a "gateway-specific result code. the code may be mapped to a salesforce-specific result code. maximum length of 64 characters. signature global void setgatewayresultcode(string gatewayresultcode) parameters gatewayresultcode type: string gateway-specific result code. must be used to map a salesforce-specific result code. return value type: void setgatewayresultcodedescription(gatewayresultcodedescription) sets a description of the gateway-specific result code that a payment gateway returned. maximum length of 1000 characters. signature global void setgatewayresultcodedescription(string gatewayresultcodedescription) parameters gatewayresultcodedescription type: string provides additional information about the result code and why the gateway returned the specific code. descriptions will vary between different gateways. return value type: void 349apex reference guide paymentmethodtokenizationresponse class setgatewaytoken(gatewaytoken) sets the gateway token value that the gateway returned. signature global void setgatewaytoken(string gatewaytoken) parameters gatewaytoken type: string the gateway token that the payment gateway sends following a tokenization request. for the cardpaymentmethod and digitalwallet objects, use the gatewytokenencrypted parameter, which encrypts the token value. return value type: void setgatewaytokendetails(gatewaytokendetails) sets any additional information that the gateway returned about the payment token. signature global void setgatewaytokendetails(string gatewaytokendetails) parameters gatewaytokendetails type: string return value type: void setgatewaytokenencrypted(gatewaytokenencrypted) sets the value of the gatewaytokenencrypted field on a cardpaymentmethod or digitalwallet object. signature global void setgatewaytokenencrypted(string gatewaytokenencrypted) parameters gatewaytokenencrypted type: string 350apex reference guide paymentgatewaynotificationrequest class the gateway token that the payment gateway sends following a tokenization request. salesforce payments uses salesforce encryption to encrypt the token value. return value type: void setsalesforceresultcodeinfo(salesforceresultcodeinfo) sets the salesforce-specific result code information. payment gateways have many response codes for payment calls. salesforce uses the result code information to map payment gateway codes to a predefined set of standard salesforce result codes. signature global void setsalesforceresultcodeinfo(commercepayments.salesforceresultcodeinfo salesforceresultcodeinfo) parameters salesforceresultcodeinfo type: salesforceresultcodeinfo on page 380 description of the salesforce result code value. return value type: void paymentgatewaynotificationrequest class contains the notification request data from the gateway. namespace commercepayments on page 256 usage when the payment gateway sends a notification for a payment request, the payments platform sends the notification request to the gateway adapter. if the notification payload contains an eventcode of capture, the adapter constructs a capturenotification. if the notification payload contains an eventcode of refund, the adapter constructs a referencedrefundnotification. if the notification payload contains eventcode of authorisation, the adapter constructs a gatewaynotificationresponse. you can obtain a notification request from paymentgatewaynotificationcontext on page 339 by invoking its getpaymentgatewaynotificationrequest method. 351apex reference guide paymentgatewaynotificationrequest class example global commercepayments.gatewaynotificationresponse processnotification(commercepayments.paymentgatewaynotificationcontext gatewaynotificationcontext) { commercepayments.paymentgatewaynotificationrequest notificationrequest = gatewaynotificationcontext.getpaymentgatewaynotificationrequest(); } in this section: paymentgatewaynotificationrequest properties paymentgatewaynotificationrequest methods paymentgatewaynotificationrequest properties the following are properties for paymentgatewaynotificationrequest. in this section: requestbody body of the notification request sent by the payment gateway. requestbody body of the notification request sent by the payment gateway. signature global blob requestbody {get; set;} property value type: blob paymentgatewaynotificationrequest methods the following are methods for paymentgatewaynotificationrequest. in this section: getheaders() gets http headers from the notification request sent by the payment gateway. getrequestbody() stores the notification request body information from the payment gateway’s notification request. gethead" "ers() gets http headers from the notification request sent by the payment gateway. 352apex reference guide paymentshttp class signature global map getheaders() return value type: map getrequestbody() stores the notification request body information from the payment gateway’s notification request. signature global blob getrequestbody() return value type: blob paymentshttp class makes an http request to start the interaction with the payment gateway. namespace commercepayments on page 256 usage you must specify the commercepayments namespace when creating an instance of this class. the constructor of this class takes no arguments. for example: commercepayments.paymentshttp payhttp = new commercepayments.paymentshttp(); in this section: paymentshttp methods paymentshttp constructors paymentshttp methods the following are methods for paymentshttp. all methods are instance methods. in this section: send(request) sends an httprequest and returns the response. 353apex reference guide refundrequest class send(request) sends an httprequest and returns the response. signature global httpresponse send(httprequest request) parameters request type: system.httprequest return value type: system.httpresponse paymentshttp constructors the following are constructors for paymentshttp. in this section: paymentshttp() initiates an http request and response. paymentshttp() initiates an http request and response. signature global paymentshttp() refundrequest class sends data related to a refund to the payment gateway adapter. namespace commercepayments on page 354 usage the constructor of this class takes no arguments. for example: commercepayments.refundrequest rrq = new commercepayments.refundrequest(); 354apex reference guide refundrequest class example commercepayments.referencedrefundrequest refundrequest = new commercepayments.referencedrefundrequest(80, pmt.id); in this section: refundrequest methods refundrequest methods the following are methods for refundrequest. in this section: equals(obj) maintains the integrity of lists of type refundrequest by determining the equality of external objects in a list. this method is dynamic and is based on the equals method in java. hashcode() maintains the integrity of lists of type refundrequest by determining the uniqueness of the external object records in a list. equals(obj) maintains the integrity of lists of type refundrequest by determining the equality of external objects in a list. this method is dynamic and is based on the equals method in java. signature global boolean equals(object obj) parameters obj type: object return value type: boolean hashcode() maintains the integrity of lists of type refundrequest by determining the uniqueness of the external object records in a list. signature global integer hashcode() return value type: integer 355apex reference guide referencedrefundnotification class referencedrefundnotification class when a payment gateway sends a notification for a refund transaction, the payment gateway adapter creates the referencedrefundnotification object to store information about notification. namespace commercepayments on page 256 usage this class is used with asynchronous payments. when a payment gateway sends a notification for a refund transcation, the gateway adapter creates an object of type referencedrefundnotification to populate the respective values. the constructor of this class takes no arguments. for example: commercepayments.referencedrefundnotification rrn = new commercepayments.referencedrefundnotification(); example commercepayments.notificationstatus notificationstatus = null; if (success) { notificationstatus = commercepayments.notificationstatus.success; } else { notificationstatus = commercepayments.notificationstatus.failed; } commercepayments.basenotification notification = null; if ('capture'.equals(eventcode)) { notification = new commercepayments.capturenotification(); } else if ('refund'.equals(eventcode)) { notification = new commercepayments.referencedrefundnotification(); } in this section: referencedrefundnotification methods referencedrefundnotification methods the following are methods for referencedrefundnotification. in this section: setamount" "(amount) sets the transaction amount. can be positive, negative, or zero. setgatewaydate(gatewaydate) sets the date that communication for the refund notification occurred with the payment gateway. setgatewaymessage(gatewaymessage) sets information or messages that the gateway returned. 356apex reference guide referencedrefundnotification class setgatewayreferencedetails(gatewayreferencedetails) sets the payment gateway’s reference details. setgatewayreferencenumber(gatewayreferencenumber) sets the payment gateway’s reference number. setgatewayresultcode(gatewayresultcode) sets the payment gateway’s result code. setgatewayresultcodedescription(gatewayresultcodedescription) sets the payment gateway’s result code description. setid(id) sets the id of a notification sent by the payment gateway. setsalesforceresultcodeinfo(salesforceresultcodeinfo) sets salesforce result code information. setstatus(status) sets the notification status value on the notification object. setamount(amount) sets the transaction amount. can be positive, negative, or zero. signature global void setamount(double amount) parameters amount type: double the amount to be debited or captured. return value type: void setgatewaydate(gatewaydate) sets the date that communication for the refund notification occurred with the payment gateway. signature global void setgatewaydate(datetime gatewaydate) parameters gatewaydate type: datetime the date that communication happened with the gateway. 357apex reference guide referencedrefundnotification class return value type: void setgatewaymessage(gatewaymessage) sets information or messages that the gateway returned. signature global void setgatewaymessage(string gatewaymessage) parameters gatewaymessage type: string return value type: void setgatewayreferencedetails(gatewayreferencedetails) sets the payment gateway’s reference details. signature global void setgatewayreferencedetails(string gatewayreferencedetails) parameters gatewayreferencedetails type: string provides information about the gateway communication. return value type: void setgatewayreferencenumber(gatewayreferencenumber) sets the payment gateway’s reference number. signature global void setgatewayreferencenumber(string gatewayreferencenumber) parameters gatewayreferencenumber type: string 358apex reference guide referencedrefundnotification class unique transaction id created by the payment gateway. return value type: void setgatewayresultcode(gatewayresultcode) sets the payment gateway’s result code. signature global void setgatewayresultcode(string gatewayresultcode) parameters gatewayresultcode type: string the gateway result code. you must map this to a salesforce-specific result code. return value type: void setgatewayresultcodedescription(gatewayresultcodedescription) sets the payment gateway’s result code description. signature global void setgatewayresultcodedescription(string gatewayresultcodedescription) parameters gatewayresultcodedescription type: string description of the gateway result code. provides additional context about the result code . return value type: void setid(id) sets the id of a notification sent by the payment gateway. signature global void setid(string id) 359apex reference guide referencedrefundrequest parameters id type: string return value type: void setsalesforceresultcodeinfo(salesforceresultcodeinfo) sets salesforce result code information. signature global void setsalesforceresultcodeinfo(commercepayments.salesforceresultcodeinfo salesforceresultcodeinfo) parameters salesforceresultcodeinfo type: salesforceresultcodeinfo on page 380 description of the salesforce result code value. return value type: void setstatus(status) sets the notification status value on the notification object. signature global void setstatus(commercepayments.notificationstatus status) parameters status type: notificationstatus on page 333 indicates whether the payments platform successfully received the notification from the payment gateway. return value type: void referencedrefundrequest access information about the referenced refund requests. extends the refundrequest class. 360apex reference guide referencedrefundrequest namespace commercepayments on page 256 example global commercepayments." "gatewayresponse processrequest(commercepayments.paymentgatewaycontext gatewaycontext) { commercepayments.requesttype requesttype = gatewaycontext.getpaymentrequesttype(); if (requesttype == commercepayments.requesttype.referencedrefund) { commercepayments.*referencedrefundrequest* refundrequest = (commercepayments.*referencedrefundrequest*) gatewaycontext.getpaymentrequest(); } } in this section: referencedrefundrequest constructors referencedrefundrequest properties referencedrefundrequest methods referencedrefundrequest constructors the following are constructors for referencedrefundrequest. in this section: referencedrefundrequest(amount, paymentid) this constructor is intended for test usage and throws an exception if used outside of the apex test context. referencedrefundrequest(amount, paymentid) this constructor is intended for test usage and throws an exception if used outside of the apex test context. parameters amount type: double the amount to be debited or captured. paymentid type: string the payment record. referencedrefundrequest properties the following are properties for referencedrefundrequest. 361apex reference guide referencedrefundresponse class in this section: paymentid references a payment object. accountid references an account. amount references an amount. paymentid references a payment object. property value type: string accountid references an account. property value type: string amount references an amount. property value type: double referencedrefundrequest methods the following are methods for referencedrefundrequest. referencedrefundresponse class the payment gateway adapter sends this response for the referencedrefund request type. namespace commercepayments on page 256 usage the constructor of this class takes no arguments. for example: 362apex reference guide referencedrefundresponse class commercepayments.referencedrefundresponse refr = new commercepayments.referencedrefundresponse(); in this section: referencedrefundresponse methods referencedrefundresponse methods the following are methods for referencedrefundresponse. in this section: setamount(amount) sets the transaction amount. the value must be a postive number. setgatewayavscode(gatewayavscode) sets the payment gateway’s address verification system (avs) code. setgatewaydate(gatewaydate) sets the payment gateway’s date. setgatewaymessage(gatewaymessage) sets information or messages that the gateway returned. setgatewayreferencedetails(gatewayreferencedetails) sets the payment gateway’s reference details. setgatewayreferencenumber(gatewayreferencenumber) sets the payment gateway’s reference number. setgatewayresultcode(gatewayresultcode) sets the payment gateway’s result code. setgatewayresultcodedescription(gatewayresultcodedescription) sets the payment gateway’s result code description. setsalesforceresultcodeinfo(salesforceresultcodeinfo) set the salesforce result code info. setamount(amount) sets the transaction amount. the value must be a postive number. signature global void setamount(double amount) parameters amount type: double the amount to be debited or captured. 363apex reference guide referencedrefundresponse class return value type: void setgatewayavscode(gatewayavscode) sets the payment gateway’s address verification system (avs) code. signature global void setgatewayavscode(string gatewayavscode) parameters gatewayavscode type: string code sent by gateways that use an address verification system. return value type: void setgatewaydate(gatewaydate) sets the payment gateway’s date. signature global void setgatewaydate(datetime gatewaydate) parameters gatewaydate type: datetime date and time of the gateway communication. return value type: void setgatewaymessage(gatewaymessage) sets information or messages that the gateway returned. signature global void setgatewaymessage(string gatewaymessage) 364apex reference guide referencedrefundresponse class parameters gatewaymessage type: string information or error messages returned by the gateway." "return value type: void setgatewayreferencedetails(gatewayreferencedetails) sets the payment gateway’s reference details. signature global void setgatewayreferencedetails(string gatewayreferencedetails) parameters gatewayreferencedetails type: string information about the gateway communication. return value type: void setgatewayreferencenumber(gatewayreferencenumber) sets the payment gateway’s reference number. signature global void setgatewayreferencenumber(string gatewayreferencenumber) parameters gatewayreferencenumber type: string unique transaction id created by the payment gateway. return value type: void setgatewayresultcode(gatewayresultcode) sets the payment gateway’s result code. 365apex reference guide referencedrefundresponse class signature global void setgatewayresultcode(string gatewayresultcode) parameters gatewayresultcode type: string the gateway result code. must be mapped to a salesforce result code. return value type: void setgatewayresultcodedescription(gatewayresultcodedescription) sets the payment gateway’s result code description. signature global void setgatewayresultcodedescription(string gatewayresultcodedescription) parameters gatewayresultcodedescription type: string description of the gatewayresultcode. provides more information about the result code returned by the gateway. return value type: void setsalesforceresultcodeinfo(salesforceresultcodeinfo) set the salesforce result code info. signature global void setsalesforceresultcodeinfo(commercepayments.salesforceresultcodeinfo salesforceresultcodeinfo) parameters salesforceresultcodeinfo type: commercepayments.salesforceresultcodeinfo on page 380 describes the salesforce result code value. return value type: void 366apex reference guide requesttype enum requesttype enum defines the type of payment transaction request made to the payment gateway. enum values the following are the values of the commercepayments.requesttype enum. value description authorize payment authorization request capture payment capture request referencedrefund payment refund request sale sale request commercepayments.requesttype, sale tokenization payment tokenization request commercepayments.requesttype, tokenization saleapipaymentmethodrequest class sends data related to a card payment method to a gateway adapter during a sale service call. namespace commercepayments on page 256 usage this class holds information about a payment method that was used for a sale request. saleapipaymentmethodrequest contains all the possible payment methods as fields, but only one value is populated for a given request. gateway adapters use this class when constructing a sale request. the object of this class is obtained through the paymentmethod field on the salerequest object. example: this code sample retrieves the saleapipaymentmethodrequest object from the salerequest class. commercepayments.saleapipaymentmethodrequest paymentmethod = salerequest.paymentmethod; in this section: saleapipaymentmethodrequest constructors saleapipaymentmethodrequest properties saleapipaymentmethodrequest methods 367apex reference guide saleapipaymentmethodrequest class saleapipaymentmethodrequest constructors the following are constructors for saleapipaymentmethodrequest. in this section: saleapipaymentmethodrequest(cardpaymentmethodrequest) sends data related to a card payment method to a gateway adapter during a sale service call. saleapipaymentmethodrequest() constructor for building a sale payment method request. this constructor is intended for test usage and throws an exception if used outside of the apex test context. saleapipaymentmethodrequest(cardpaymentmethodrequest) sends data related to a card payment method to a gateway adapter during a sale service call. signature global saleapipaymentmethodrequest(commercepayments.cardpaymentmethodrequest cardpaymentmethodrequest) parameters cardpaymentmethodrequest type: cardpaymentmethodrequest on page 318 saleapipaymentmethodrequest() constructor for building a sale payment method request. this constructor is intended for test usage and throws an exception if used outside of the apex test context. signature global saleapipaymentmethodrequest() saleapipaymentmethodrequest properties the following are properties for saleapipaymentmethodrequest. in this section: cardpaymentmethod contains details of the card used in a" "payment method. cardpaymentmethod contains details of the card used in a payment method. 368apex reference guide saleapipaymentmethodrequest class signature global commercepayments.cardpaymentmethodrequest cardpaymentmethod {get; set;} property value type: cardpaymentmethodrequest on page 318 saleapipaymentmethodrequest methods the following are methods for saleapipaymentmethodrequest. in this section: equals(obj) maintains the integrity of lists of type saleapipaymentmethodrequest by determining the equality of external objects in a list. this method is dynamic and is based on the equals method in java. hashcode() maintains the integrity of lists of type saleapipaymentmethodrequest by determining the uniqueness of the external object records in a list. tostring() converts a date to a string. equals(obj) maintains the integrity of lists of type saleapipaymentmethodrequest by determining the equality of external objects in a list. this method is dynamic and is based on the equals method in java. signature global boolean equals(object obj) parameters obj type: object return value type: boolean hashcode() maintains the integrity of lists of type saleapipaymentmethodrequest by determining the uniqueness of the external object records in a list. signature global integer hashcode() 369apex reference guide salerequest class return value type: integer tostring() converts a date to a string. signature global string tostring() return value type: string salerequest class stores information about a sales request. namespace commercepayments on page 256 usage this class holds all the required details about a sale request. gateway adapters read the fields of this class object while constructing a sale json request thatis sent to the payment gateway. the object of this class is made available through commercepayments.paymentgatewaycontext by calling getpaymentrequest(). example this code sample retrieves the salerequest object from the paymentgatewaycontext class. commercepayments.salerequest = (commercepayments.salerequest)gatewaycontext.getpaymentrequest() in this section: salerequest constructors salerequest properties salerequest methods salerequest constructors the following are constructors for salerequest. 370apex reference guide salerequest class in this section: salerequest(amount) constructor for defining an amount for the sale request. this constructor is intended for test usage and throws an exception if used outside of the apex test context. salerequest(amount) constructor for defining an amount for the sale request. this constructor is intended for test usage and throws an exception if used outside of the apex test context. signature global salerequest(double amount) parameters amount type: double amount of the sale request. salerequest properties the following are properties for salerequest. in this section: accountid customer account id for the sale request. amount amount of the sale request. can be positive only. comments additional information about the sale request. currencyisocode currency code for the sale request. paymentmethod payment method used in the sale request. accountid customer account id for the sale request. signature global string accountid {get; set;} 371apex reference guide salerequest class property value type: string amount amount of the sale request. can be positive only. signature global double amount {get; set;} property value type: double comments additional information about the sale request. signature global string comments {get; set;} property value type: string currencyisocode currency code for the sale request. signature global string currencyisocode {get; set;} property value type: string paymentmethod payment method used in the sale request. signature global commercepayments.saleapipaymentmethodrequest paymentmethod {get; set;} property value type: saleapipaymentmethodrequest on page 367 372apex reference guide salerequest class salerequest methods the following are methods for salerequest. in this section: equals(obj) compares this object with the specified object and returns true if both objects are equal; otherwise, returns false. hashcode() maintains the integrity of lists of type salerequest by determining the uniqueness of the external object records in a list. tostring() converts a" "date to a string. equals(obj) compares this object with the specified object and returns true if both objects are equal; otherwise, returns false. signature global boolean equals(object obj) parameters obj type: object return value type: boolean hashcode() maintains the integrity of lists of type salerequest by determining the uniqueness of the external object records in a list. signature global integer hashcode() return value type: integer tostring() converts a date to a string. signature global string tostring() 373apex reference guide saleresponse class return value type: string saleresponse class response sent by payment gateway adapters for a sales service. namespace commercepayments on page 256 usage the constructor of this class takes no arguments. for example: commercepayments.saleresponse slr commercepayments.saleresponse(); this class contains details about a customer card that was used as a payment method for authorization, sale, or tokenization request. the gateway adapter reads the fields of this class while constructing a transaction json request, which it then sends to the payment gateway. the object of this class is made available by the cardpaymentmethod field in saleapipaymentmethodrequest on page 367 and authapipaymentmethodrequest on page 273. example this code sample builds a saleresponse object. commercepayments.saleresponse saleresponse = new commercepayments.saleresponse(); saleresponse.setgatewayreferencedetails(""refdetailstring""); saleresponse.setgatewayresultcode(""res_code""); saleresponse.setgatewayresultcodedescription(""""); saleresponse.setgatewayreferencenumber(""""); saleresponse.setsalesforceresultcodeinfo(getsalesforceresultcodeinfo(commercepayments.salesforceresultcode.success.name())); in this section: saleresponse methods saleresponse methods the following are methods for saleresponse. in this section: setamount(amount) sets the transaction amount. must be a non-negative value. setgatewayavscode(gatewayavscode) sets the avs (address verification system) result code information that the gateway returned. maximum length of 64 characters. setgatewaydate(gatewaydate) sets the date that the sale occurred. some gateways don’t send this value. 374apex reference guide saleresponse class setgatewaymessage(gatewaymessage) sets error messages that the gateway returned for the sale request. maximum length of 255 characters. setgatewayreferencedetails(gatewayreferencedetails) sets additional data that you can use for subsequent sales. you can use any data that isn’t normalized in financial entities. this field has a maximum length of 1000 characters and can store data as json or xml. setgatewayreferencenumber(gatewayreferencenumber) sets the unique gateway reference number for the transaction that the gateway returned. maximum length of 255 characters. setgatewayresultcode(gatewayresultcode) sets a gateway-specific result code. the code may be mapped to a salesforce-specific result code. maximum length of 64 characters. setgatewayresultcodedescription(gatewayresultcodedescription) sets a description of the gateway-specific result code that a payment gateway returned. maximum length of 1000 characters. setpaymentmethodtokenizationresponse(paymentmethodtokenizationresponse) sets information from the gateway about the tokenized payment method. setsalesforceresultcodeinfo(salesforceresultcodeinfo) sets the salesforce-specific result code information. payment gateways have many response codes for payment calls. salesforce uses the result code information to map payment gateway codes to a predefined set of standard salesforce result codes. setamount(amount) sets the transaction amount. must be a non-negative value. signature global void setamount(double amount) parameters amount type: double the amount of the transaction. return value type: void setgatewayavscode(gatewayavscode) sets the avs (address verification system) result code information that the gateway returned. maximum length of 64 characters. signature global void setgatewayavscode(string gatewayavscode) parameters gatewayavscode type: string 375apex reference guide saleresponse class used to verify the address mapped to a payment method when the payments platform requests tokenization from the payment gateway. return value type: void setgatewaydate(gatewaydate) sets the date that the sale occurred." "some gateways don’t send this value. signature global void setgatewaydate(datetime gatewaydate) parameters gatewaydate type: datetime return value type: void setgatewaymessage(gatewaymessage) sets error messages that the gateway returned for the sale request. maximum length of 255 characters. signature global void setgatewaymessage(string gatewaymessage) parameters gatewaymessage type: string return value type: void setgatewayreferencedetails(gatewayreferencedetails) sets additional data that you can use for subsequent sales. you can use any data that isn’t normalized in financial entities. this field has a maximum length of 1000 characters and can store data as json or xml. signature global void setgatewayreferencedetails(string gatewayreferencedetails) 376apex reference guide saleresponse class parameters gatewayreferencedetails type: string return value type: void setgatewayreferencenumber(gatewayreferencenumber) sets the unique gateway reference number for the transaction that the gateway returned. maximum length of 255 characters. signature global void setgatewayreferencenumber(string gatewayreferencenumber) parameters gatewayreferencenumber type: string unique authorization id created by the payment gateway. return value type: void setgatewayresultcode(gatewayresultcode) sets a gateway-specific result code. the code may be mapped to a salesforce-specific result code. maximum length of 64 characters. signature global void setgatewayresultcode(string gatewayresultcode) parameters gatewayresultcode type: string gateway-specific result code. must be used to map a salesforce-specific result code. return value type: void setgatewayresultcodedescription(gatewayresultcodedescription) sets a description of the gateway-specific result code that a payment gateway returned. maximum length of 1000 characters. 377apex reference guide saleresponse class signature global void setgatewayresultcodedescription(string gatewayresultcodedescription) parameters gatewayresultcodedescription type: string description of the gateway’s result code. use this field to learn more about why the gateway returned a certain result code. return value type: void setpaymentmethodtokenizationresponse(paymentmethodtokenizationresponse) sets information from the gateway about the tokenized payment method. signature global void setpaymentmethodtokenizationresponse(commercepayments.paymentmethodtokenizationresponse paymentmethodtokenizationresponse) parameters paymentmethodtokenizationresponse type: paymentmethodtokenizationresponse on page 345 gateway response sent by payment gateway adapters for the payment method tokenization request. the response includes the payment method’s token id value. return value type: void setsalesforceresultcodeinfo(salesforceresultcodeinfo) sets the salesforce-specific result code information. payment gateways have many response codes for payment calls. salesforce uses the result code information to map payment gateway codes to a predefined set of standard salesforce result codes. signature global void setsalesforceresultcodeinfo(commercepayments.salesforceresultcodeinfo salesforceresultcodeinfo) parameters salesforceresultcodeinfo type: salesforceresultcodeinfo on page 380 378apex reference guide salesforceresultcode enum sets the salesforce-specific result code information. payment gateways have many response codes for payment calls. salesforce uses the result code information to map payment gateway codes to a predefined set of standard salesforce result codes. return value type: void salesforceresultcode enum defines the gateway call status values in salesforce based on the call status values that the payment gateway returned. usage payment gateways can return many different responses. salesforce maps these responses into one of seven possible salesforce response values. enum values the following are the values of the commercepayments.salesforceresultcode enum. value description decline the gateway call failed, but it may still work if you try again. for example, the customer had insufficient funds or briefly lost their connection to the internet. this is also known as a “soft decline.” indeterminate the gateway didn't respond to the call and the user has to check the transaction request’s status. indeterminate responses often occur following server timeouts, system failure, or any action that interrupts the gateway’s ability to process the payment. permanentfail the customer’s bank recognized the payment account as closed, terminated, or fraudulent. the gateway won’t further calls" "from the payment method associate with the transaction. after a permanent fail response, the transaction changes its gateway status to permanent fail. requiresreview the gateway call initially failed, but the payment method may still work after further evaluation. this response often happens when the customer bank requires more information about the payment request. in this case, the bank provides an authorization code manually when the payment manager calls the processor. success the gateway processed the transaction successfully. systemerror salesforce ended the payment request call before receiving a gateway response. system error responses often occur due to gateway server errors, invalid customer credentials, or anytime the request times out before receiving a gateway response. the failure occurs before the request reaches the gateway, so there’s no risk of an unaccounted payment remaining in the gateway. you can continue with the transaction by manually creating a payment. validationerror the gateway received incorrect customer payment information, such as misspelled credit card names or a cvv with missing numbers. 379apex reference guide salesforceresultcodeinfo salesforceresultcodeinfo stores salesforce result code information from payment gateway adapters. namespace commercepayments on page 256 usage the constructor of this class takes no arguments. for example: commercepayments.salesforceresultcodeinfo srci = new commercepayments.salesforceresultcodeinfo(); gateways can return the transaction result as either custommetadata or salesforceresultcode. in this section: salesforceresultcodeinfo constructors salesforceresultcodeinfo constructors the following are constructors for salesforceresultcodeinfo. in this section: salesforceresultcodeinfo(custommetadatatypeinfo) constructor for providing the custommetadatatypeinfo for the result of the transaction. salesforceresultcodeinfo(salesforceresultcode) constructor that provides the salesforceresultcode for the transaction result. salesforceresultcodeinfo(custommetadatatypeinfo) constructor for providing the custommetadatatypeinfo for the result of the transaction. signature global salesforceresultcodeinfo(commercepayments.custommetadatatypeinfo custommetadatatypeinfo) parameters custommetadatatypeinfo type: custommetadatatypeinfo on page 324 information about the metadata type. salesforceresultcodeinfo(salesforceresultcode) constructor that provides the salesforceresultcode for the transaction result. 380apex reference guide connectapi namespace signature global salesforceresultcodeinfo(commercepayments.salesforceresultcode salesforceresultcode) parameters salesforceresultcode type: salesforceresultcode on page 379 the enum value for the result code. connectapi namespace the connectapi namespace (also called connect in apex) provides classes for accessing the same data available in connect rest api. use connect in apex to create custom experiences in salesforce. for information about working with the connectapi classes, see connect in apex. in this section: actionlinks class create, delete, and get information about an action link group definition; get information about an action link group; get action link diagnostic information. announcements class access information about announcements and post announcements. botversionactivation class access and update activation information of a bot version. cdpcalculatedinsight class create, delete, get, run, and update data cloud calculated insights. cdpidentityresolution class create, delete, get, run, and update data cloud identity resolution rulesets. cdpquery class get data cloud metadata and query data. cdpsegment class create, delete, get, publish, and update data cloud segments. chatter class access information about followers and subscriptions for records. chatterfavorites class chatter favorites give you easy access to topics, list views, and feed searches. chatterfeeds class get, post, and delete feed elements, likes, comments, and bookmarks. you can also search feed elements, share feed elements, and vote on polls. chattergroups class information about groups, such as the group’s members, photo, and the groups the specified user is a member of. add members to a group, remove members, and change the group photo. 381apex reference guide connectapi namespace chattermessages class get, send, search, and reply to private messages. you can also get and search private conversations, mark conversations as read, and get a count of unread private messages. chatterusers class access information about users, such as activity, followers, subscriptions, files, and groups. clm class create and update contract" "lifecycle management (clm) contracts using object id. commercebuyerexperience class create, delete, or get commerce addresses. get order delivery group, order item, order shipments, shipment items, and order summaries. get adjustments for order items and order summaries. commercecart class get, create, update, and delete carts. get cart items, add items to carts, update and delete cart items. commercecatalog class get products, product categories, and product category paths. commercepromotions class evaluate promotions for commerce orders. get coupon code redemption usage. commercesearch class get sort rules for the live search index. get product search suggestions. search products. commercesearchsettings class get indexes. get index logs. create an index of a product catalog. commercestorepricing class get product prices. commercewishlist class get, create, update, and delete wishlists. add wishlists to carts. get wishlist items, add items to wishlists, and delete wishlist items. communities class get information about experience cloud sites in your org. communitymoderation class get information about flagged feed items and comments in an experience cloud site. add and remove flags from comments and feed items. contenthub class access files connect repositories and their files and folders. conversationapplicationdefinition class access information about a conversation application definition. datacloud class purchase data.com contact or company records, and retrieve purchase information. emailmergefieldservice class extract a list of merge fields for an object. a merge field is a field you can put in an email template, mail merge template, custom link, or formula to incorporate values from a record. employeeprofiles class get, set and crop, and delete employee banner photos and photos. 382" "apex reference guide connectapi namespace externalemailservices class access information about integration with external email services, such as sending email within salesforce through an external email account. externalmanagedaccount class get externally managed accounts. fieldservice class preview and create shifts from a pattern or filter fields on recordset filter criteria. fulfillmentorder class fulfill orders in order management. knowledge class get information about trending articles in experience cloud sites. lightningscheduler class create and update service appointments. managedcontent class get managed content versions. get a managed content space. managedcontentdelivery class get collection items. get collection metadata. get a managed content channel. get managed content. managedtopics class get managed topics in an experience cloud site. create, delete, and reorder managed topics. marketingintegration class get, save, and submit a microsites marketing integration form for an experience cloud site. mentions class access information about mentions. a mention is an “@” character followed by a user or group name. when a user or group is mentioned, they receive a notification. missions class export and purge mission activity for users. get a user’s mission progress. update mission activity counts for users. namedcredentials class create, refresh, get, delete, and update credentials. create, get, delete, and update external credentials. create, get, delete, and update named credentials. get the url for the oauth token flow for an external credential. navigationmenu class get navigation menu items for an experience cloud site. nextbestaction class execute recommendation strategies, get recommendations, manage recommendation reactions. omnichannelinventoryservice class route orders to inventory locations in order management. orchestration class get orchestration instances. orderpaymentsummary class work with payments in order management. ordersummary class work with orders in order management. 383apex reference guide connectapi namespace ordersummarycreation class create order summaries in order management. organization class access information about an org. pardotbusinessunitcontext class get the pardot business units the context user has access to. payments class authorize a payment, capture an authorized payment, and refund an authorized payment. personalization class get assigned personalization audiences that match the user context. create, get, update, and delete an audience. get personalization targets that match the user context, based on the assigned audiences that include the user. create and update targets. get and delete a target. pick ticket class create tickets to fulfill orders. questionandanswers class access question and answers suggestions. recommendations class get and reject chatter, custom, and static recommendations. create, get, update, and delete custom recommendation audiences, custom recommendation definitions, and scheduled custom recommendations. records class access information about record motifs, which are small icons used to distinguish record types in the salesforce ui. repricing class perform functions related to repricing orders in order management. returnorder class process returnorders in order management. routing class route orders to inventory locations in order management. salesforceinbox class access information about automated activity capture, which is available in einstein and salesforce inbox. sites class search an experience cloud site. smartdatadiscovery class get predictions on salesforce objects. socialengagement class manage information about social accounts or fan pages for social networks. surveys class send survey invitations by email. taxplatform class apply or cancel tax. 384apex reference guide actionlinks class topics class access information about topics, such as their descriptions, the number of people talking about them, related topics, and information about groups contributing to the topic. update a topic’s name or description, merge topics, and add and remove topics from records and feed items. userprofiles class access user profile data. the user profile data populates the profile page (also called the chatter profile page). this data includes user information (such as address, manager, and phone number), some user capabilities (permissions), and a set of subtab apps, which are custom tabs on the profile page. zones class access information about chatter answers zones in your organization. zones organize questions into logical groups, with each zone having its own focus and unique questions. connectapi input classes some connectapi methods take arguments that are instances of connectapi input classes. connectapi output classes most connectapi methods return instances of connectapi output classes. connectapi en" "ums enums specific to the connectapi namespace. connectapi exceptions the connectapi namespace contains exception classes. connectapi utilities the connectapi namespace contains a utility class. connectapi release notes use the salesforce release notes to learn about the most recent updates and changes to the connectapi namespace in apex. actionlinks class create, delete, and get information about an action link group definition; get information about an action link group; get action link diagnostic information. namespace connectapi usage an action link is a button on a feed element. clicking an action link can take a user to a web page, initiate a file download, or invoke an api call to salesforce or to an external server. an action link includes a url and an http method, and can include a request body and header information, such as an oauth token for authentication. use action links to integrate salesforce and third-party services into the feed so that users can drive productivity and accelerate innovation. there are two views of an action link and an action link group: the definition, and the context user’s view. the definition includes potentially sensitive information, such as authentication information. the context user’s view is filtered by visibility options and the values reflect the state of the context user. action link definition can be sensitive to a third party (for example, oauth bearer token headers). for this reason, only calls made from the apex namespace that created the action link definition can read, modify, or delete the definition. in addition, the user making the 385apex reference guide actionlinks class call must have created the definition or have view all data permission. use these methods to operate on action link group definitions (which contain action link definitions). • createactionlinkgroupdefinition(communityid, actionlinkgroup) • deleteactionlinkgroupdefinition(communityid, actionlinkgroupid) • getactionlinkgroupdefinition(communityid, actionlinkgroupid) use these methods to operate on a context user’s view of an action link or an action link group. • getactionlink(communityid, actionlinkid) • getactionlinkgroup(communityid, actionlinkgroupid) • getactionlinkdiagnosticinfo(communityid, actionlinkid) for information about how to use action links, see working with action links. actionlinks methods these are methods for actionlinks. all methods are static. in this section: createactionlinkgroupdefinition(communityid, actionlinkgroup) create an action link group definition. to associate an action link group with a feed element, first create an action link group definition. then post a feed element with an associated actions capability. deleteactionlinkgroupdefinition(communityid, actionlinkgroupid) delete an action link group definition. deleting an action link group definition removes all references to it from feed elements. getactionlink(communityid, actionlinkid) get information about an action link, including state for the context user. getactionlinkdiagnosticinfo(communityid, actionlinkid) get diagnostic information returned when an action link executes. diagnostic information is given only for users who can access the action link. getactionlinkgroup(communityid, actionlinkgroupid) get information about an action link group including state for the context user. getactionlinkgroupdefinition(communityid, actionlinkgroupid) get information about an action link group definition. createactionlinkgroupdefinition(communityid, actionlinkgroup) create an action link group definition. to associate an action link group with a feed element, first create an action link group definition. then post a feed element with an associated actions capability. api version 33.0 requires chatter no 386apex reference guide actionlinks class signature public static connectapi.actionlinkgroupdefinition createactionlinkgroupdefinition(string communityid, connectapi.actionlinkgroupdefinitioninput actionlinkgroup) parameters communityid type: string id for an experience cloud site, internal, or null. actionlinkgroup type: connectapi.actionlinkgroupdefinitioninput a connectapi.actionlinkgroupdefinitioninput object that defines the action link group. return value type: connectapi.actionlinkgroupdefinition usage an action link is a button on a feed element. clicking an action link can take a user to a web page, initiate a file download, or invoke an api call to salesforce or to an external server. an action link includes a url and an http method, and can include a request body and header information, such as an oauth token for authentication. use action links to integrate salesforce and" "third-party services into the feed so that users can drive productivity and accelerate innovation. all action links must belong to a group. action links in a group are mutually exclusive and share some properties. define standalone actions in their own action group. information in the action link group definition can be sensitive to a third party (for example, oauth bearer token headers). for this reason, only calls made from the apex namespace that created the action link group definition can read, modify, or delete the definition. in addition, the user making the call must have created the definition or have view all data permission. note: invoking apiasync action links from an app requires a call to set the status. however, there isn’t currently a way to set the status of an action link using apex. to set the status, use connect rest api. see the action link resource in the connect rest api developer guide for more information. example for defining an action link and posting with a feed element for more information about this example, see define an action link and post with a feed element. connectapi.actionlinkgroupdefinitioninput actionlinkgroupdefinitioninput = new connectapi.actionlinkgroupdefinitioninput(); connectapi.actionlinkdefinitioninput actionlinkdefinitioninput = new connectapi.actionlinkdefinitioninput(); connectapi.requestheaderinput requestheaderinput1 = new connectapi.requestheaderinput(); connectapi.requestheaderinput requestheaderinput2 = new connectapi.requestheaderinput(); // create the action link group definition. actionlinkgroupdefinitioninput.actionlinks = new list(); actionlinkgroupdefinitioninput.executionsallowed = connectapi.actionlinkexecutionsallowed.onceperuser; actionlinkgroupdefinitioninput.category = connectapi.platformactiongroupcategory.primary; 387apex reference guide actionlinks class // to do: verify that the date is in the future. // action link groups are removed from feed elements on the expiration date. datetime mydate = datetime.newinstance(2016, 3, 1); actionlinkgroupdefinitioninput.expirationdate = mydate; // create the action link definition. actionlinkdefinitioninput.actiontype = connectapi.actionlinktype.api; actionlinkdefinitioninput.actionurl = '/services/data/v33.0/chatter/feed-elements'; actionlinkdefinitioninput.headers = new list(); actionlinkdefinitioninput.labelkey = 'post'; actionlinkdefinitioninput.method = connectapi.httprequestmethod.httppost; actionlinkdefinitioninput.requestbody = '{\""subjectid\"": \""me\"",\""feedelementtype\"": \""feeditem\"",\""body\"": {\""messagesegments\"": [{\""type\"": \""text\"",\""text\"": \""this is a test post created via an api action link.\""}]}}'; actionlinkdefinitioninput.requiresconfirmation = true; // to do: substitute an oauth value for your salesforce org. requestheaderinput1.name = 'authorization'; requestheaderinput1.value = 'oauth 00dd00000007wnp!arsaqcwoev0zzav847ftl4zf.85w.ewspbugxr4sajsp'; actionlinkdefinitioninput.headers.add(requestheaderinput1); requestheaderinput2.name = 'content-type'; requestheaderinput2.value = 'application/json'; actionlinkdefinitioninput.headers.add(requestheaderinput2); // add the action link definition to the action link group definition. actionlinkgroupdefinitioninput.actionlinks.add(actionlinkdefinitioninput); // instantiate the action link group definition. connectapi.actionlinkgroupdefinition actionlinkgroupdefinition = connectapi.actionlinks.createactionlinkgroupdefinition(network.getnetworkid(), actionlinkgroupdefinitioninput); connectapi.feediteminput feediteminput = new connectapi.feediteminput(); connectapi.feedelementcapabilitiesinput feedelementcapabilitiesinput = new connectapi.feedelementcapabilitiesinput(); connectapi.associatedactionscapabilityinput associatedactionscapabilityinput = new connectapi.associatedactionscapabilityinput(); connectapi.messagebodyinput messagebodyinput = new connectapi.messagebodyinput(); connectapi.textsegmentinput textsegmentinput = new connectapi.textsegmentinput(); // set the properties of the feediteminput" "object. feediteminput.body = messagebodyinput; feediteminput.capabilities = feedelementcapabilitiesinput; feediteminput.subjectid = 'me'; // create the text for the post. messagebodyinput.messagesegments = new list(); textsegmentinput.text = 'click to post a feed item.'; messagebodyinput.messagesegments.add(textsegmentinput); // the feedelementcapabilitiesinput object holds the capabilities of the feed item. 388apex reference guide actionlinks class // define an associated actions capability to hold the action link group. // the action link group id is returned from the call to create the action link group definition. feedelementcapabilitiesinput.associatedactions = associatedactionscapabilityinput; associatedactionscapabilityinput.actionlinkgroupids = new list(); associatedactionscapabilityinput.actionlinkgroupids.add(actionlinkgroupdefinition.id); // post the feed item. connectapi.feedelement feedelement = connectapi.chatterfeeds.postfeedelement(network.getnetworkid(), feediteminput); example for defining an action link in a template and posting with a feed element for more information about this example, see define an action link in a template and post with a feed element. // get the action link group template id. actionlinkgrouptemplate template = [select id from actionlinkgrouptemplate where developername='doc_example']; // add binding name-value pairs to a map. // the names are defined in the action link template(s) associated with the action link group template. // get them from setup ui or soql. map bindingmap = new map(); bindingmap.put('apiversion', 'v33.0'); bindingmap.put('text', 'this post was created by an api action link.'); bindingmap.put('subjectid', 'me'); // create actionlinktemplatebindinginput objects from the map elements. list bindinginputs = new list(); for (string key : bindingmap.keyset()) { connectapi.actionlinktemplatebindinginput bindinginput = new connectapi.actionlinktemplatebindinginput(); bindinginput.key = key; bindinginput.value = bindingmap.get(key); bindinginputs.add(bindinginput); } // set the template id and template binding values in the action link group definition. connectapi.actionlinkgroupdefinitioninput actionlinkgroupdefinitioninput = new connectapi.actionlinkgroupdefinitioninput(); actionlinkgroupdefinitioninput.templateid = template.id; actionlinkgroupdefinitioninput.templatebindings = bindinginputs; // instantiate the action link group definition. connectapi.actionlinkgroupdefinition actionlinkgroupdefinition = connectapi.actionlinks.createactionlinkgroupdefinition(network.getnetworkid(), actionlinkgroupdefinitioninput); connectapi.feediteminput feediteminput = new connectapi.feediteminput(); connectapi.feedelementcapabilitiesinput feedelementcapabilitiesinput = new connectapi.feedelementcapabilitiesinput(); 389apex reference guide actionlinks class connectapi.associatedactionscapabilityinput associatedactionscapabilityinput = new connectapi.associatedactionscapabilityinput(); connectapi.messagebodyinput messagebodyinput = new connectapi.messagebodyinput(); connectapi.textsegmentinput textsegmentinput = new connectapi.textsegmentinput(); // define the feediteminput object to pass to postfeedelement feediteminput.body = messagebodyinput; feediteminput.capabilities = feedelementcapabilitiesinput; feediteminput.subjectid = 'me'; // the messagebodyinput object holds the text in the post messagebodyinput.messagesegments = new list(); textsegmentinput.text = 'click to post a feed item.'; messagebodyinput.messagesegments.add(textsegmentinput); // the feedelementcapabilitiesinput object holds the capabilities of the feed item. // for this feed item, we define an associated actions capability to hold the action link group. // the action link group id is returned from the call to create the action link group definition. feedelementcapabilitiesinput.associatedactions" "= associatedactionscapabilityinput; associatedactionscapabilityinput.actionlinkgroupids = new list(); associatedactionscapabilityinput.actionlinkgroupids.add(actionlinkgroupdefinition.id); // post the feed item. connectapi.feedelement feedelement = connectapi.chatterfeeds.postfeedelement(network.getnetworkid(), feediteminput); deleteactionlinkgroupdefinition(communityid, actionlinkgroupid) delete an action link group definition. deleting an action link group definition removes all references to it from feed elements. api version 33.0 requires chatter no signature public static void deleteactionlinkgroupdefinition(string communityid, string actionlinkgroupid) parameters communityid type: string id for an experience cloud site, internal, or null. 390apex reference guide actionlinks class actionlinkgroupid type: string the id of the action link group. return value type: void usage information in the action link group definition can be sensitive to a third party (for example, oauth bearer token headers). for this reason, only calls made from the apex namespace that created the action link group definition can read, modify, or delete the definition. in addition, the user making the call must have created the definition or have view all data permission. getactionlink(communityid, actionlinkid) get information about an action link, including state for the context user. api version 33.0 requires chatter no signature public static connectapi.platformaction getactionlink(string communityid, string actionlinkid) parameters communityid type: string id for an experience cloud site, internal, or null. actionlinkid type: string the id of the action link. return value type: connectapi.platformaction getactionlinkdiagnosticinfo(communityid, actionlinkid) get diagnostic information returned when an action link executes. diagnostic information is given only for users who can access the action link. 391apex reference guide actionlinks class api version 33.0 requires chatter no signature public static connectapi.actionlinkdiagnosticinfo getactionlinkdiagnosticinfo(string communityid, string actionlinkid) parameters communityid type: string id for an experience cloud site, internal, or null. actionlinkid type: string the id of the action link. return value type: connectapi.actionlinkdiagnosticinfo getactionlinkgroup(communityid, actionlinkgroupid) get information about an action link group including state for the context user. api version 33.0 requires chatter no signature public static connectapi.platformactiongroup getactionlinkgroup(string communityid, string actionlinkgroupid) parameters communityid type: string id for an experience cloud site, internal, or null. 392apex reference guide actionlinks class actionlinkgroupid type: string the id of the action link group. return value type: connectapi.platformactiongroup usage all action links must belong to a group. action links in a group are mutually exclusive and share some properties. action link groups are accessible by clients, unlike action link group definitions. getactionlinkgroupdefinition(communityid, actionlinkgroupid) get information about an action link group definition. api version 33.0 requires chatter no signature public static connectapi.actionlinkgroupdefinition getactionlinkgroupdefinition(string communityid, string actionlinkgroupid) parameters communityid type: string id for an experience cloud site, internal, or null. actionlinkgroupid type: string the id of the action link group. return value type: connectapi.actionlinkgroupdefinition usage information in the action link group definition can be sensitive to a third party (for example, oauth bearer token headers). for this reason, only calls made from the apex namespace that created the action link group definition can read, modify, or delete the definition. in addition, the user making the call must have created the definition or have view all data permission. 393apex reference guide announcements class announcements class access information about announcements and post announcements. namespace connectapi usage use the connectapi.announcements class to get, create, update, and delete announcements. use an announcement to highlight information. users can discuss, like, and post comments on announcements. deleting the feed" "post deletes the announcement. this image shows an announcement displayed in a group. creating an announcement also creates a feed item with the announcement text. an announcement displays in a designated location in the salesforce ui until 11:59 p.m. on its expiration date, unless it’s deleted or replaced by another announcement. announcements methods the following are methods for announcements. all methods are static. in this section: deleteannouncement(communityid, announcementid) delete an announcement. getannouncement(communityid, announcementid) get an announcement. 394apex reference guide announcements class getannouncements(communityid, parentid) get the first page of announcements. getannouncements(communityid, parentid, pageparam, pagesize) get a page of announcements. postannouncement(communityid, announcement) post an announcement. updateannouncement(communityid, announcementid, expirationdate) update the expiration date of an announcement. deleteannouncement(communityid, announcementid) delete an announcement. api version 31.0 requires chatter yes signature public static void deleteannouncement(string communityid, string announcementid) parameters communityid type: string id for an experience cloud site, internal, or null. announcementid type: string an announcement id, which has a prefix of 0bt. return value type: void usage to get a list of announcements in a group, call getannouncements(communityid, parentid) or getannouncements(communityid, parentid, pageparam, pagesize). to post an announcement to a group, call postannouncement(communityid, announcement) . getannouncement(communityid, announcementid) get an announcement. 395apex reference guide announcements class api version 31.0 requires chatter yes signature public static connectapi.announcement getannouncement(string communityid, string announcementid) parameters communityid type: string id for an experience cloud site, internal, or null. announcementid type: string an announcement id, which has a prefix of 0bt. return value type: connectapi.announcement usage to get a list of announcements in a group, call getannouncements(communityid, parentid) or getannouncements(communityid, parentid, pageparam, pagesize). to post an announcement to a group, call postannouncement(communityid, announcement) . getannouncements(communityid, parentid) get the first page of announcements. api version 36.0 available to guest users 38.0 requires chatter yes 396apex reference guide announcements class signature public static connectapi.announcementpage getannouncements(string communityid, string parentid) parameters communityid type: string id for an experience cloud site, internal, or null. parentid type: string id of the parent entity for the announcement, that is, a group id when the announcement appears in a group. return value type: connectapi.announcementpage getannouncements(communityid, parentid, pageparam, pagesize) get a page of announcements. api version 36.0 available to guest users 38.0 requires chatter yes signature public static connectapi.announcementpage getannouncements(string communityid, string parentid, integer pageparam, integer pagesize) parameters communityid type: string id for an experience cloud site, internal, or null. parentid type: string id of the parent entity for the announcement, that is, a group id when the announcement appears in a group. pageparam type: integer 397apex reference guide announcements class number of the page you want returned. starts at 0. if you pass in null or 0, the first page is returned. pagesize type: integer specifies the number of announcements per page. return value type: connectapi.announcementpage postannouncement(communityid, announcement) post an announcement. api version 36.0 requires chatter yes signature public static connectapi.announcement postannouncement(string communityid, connectapi.announcementinput announcement) parameters communityid type: string id for an experience cloud site, internal, or null. announcement" "type: connectapi.announcementinput a connectapi.announcementinput object. return value type: connectapi.announcement updateannouncement(communityid, announcementid, expirationdate) update the expiration date of an announcement. api version 31.0 398apex reference guide botversionactivation class requires chatter yes signature public static connectapi.announcement updateannouncement(string communityid, string announcementid, datetime expirationdate) parameters communityid type: string id for an experience cloud site, internal, or null. announcementid type: string an announcement id, which has a prefix of 0bt. expirationdate type: datetime the salesforce ui displays an announcement until 11:59 p.m. on this date unless another announcement is posted first. the salesforce ui ignores the time value in the expirationdate. however, you can use the time value to create your own display logic in your own ui. return value type: connectapi.announcement usage to get a list of announcements in a group, call getannouncements(communityid, parentid) or getannouncements(communityid, parentid, pageparam, pagesize). to post an announcement to a group, call postannouncement(communityid, announcement) . botversionactivation class access and update activation information of a bot version. namespace connectapi botversionactivation methods the following are methods for botversionactivation. all methods are static. 399apex reference guide botversionactivation class in this section: getversionactivationinfo(botversionid) get the active or inactive status of the bot version. updateversionstatus(botversionid, status, postbody) update the status of the specified bot version. getversionactivationinfo(botversionid) get the active or inactive status of the bot version. api version 50.0 requires chatter no signature public static connectapi.botversionactivationinfo getversionactivationinfo(string botversionid) parameters botversionid type: string id of the bot version. return value type: connectapi.botversionactivationinfo usage to access this method, enable the bot feature, and the user must be an admin or have the manage bots or manage bots training data user permissions. updateversionstatus(botversionid, status, postbody) update the status of the specified bot version. api version 50.0 requires chatter no 400apex reference guide cdpcalculatedinsight class signature public static connectapi.botversionactivationinfo updateversionstatus(string botversionid, connectapi.botversionactivationstatus status, connectapi.botversionactivationinput postbody) parameters botversionid type: string id of the bot version. status type: connectapi.botversionactivationstatus activation status of the bot version. values are: • active • inactive activation status must be specified in the status or postbody parameter. postbody type: connectapi.botversionactivationinput parameters to update for the bot version. activation status must be specified in the status or postbody parameter. return value type: connectapi.botversionactivationinfo usage to access this method, enable the bot feature, and the user must be an admin or have the manage bots or manage bots training data user permissions. cdpcalculatedinsight class create, delete, get, run, and update data cloud calculated insights. namespace connectapi cdpcalculatedinsight methods the following are methods for cdpcalculatedinsight. all methods are static. in this section: createcalculatedinsight(input) create a calculated insight. 401apex reference guide cdpcalculatedinsight class deletecalculatedinsight(apiname) delete a calculated insight. getcalculatedinsight(apiname) get a calculated insight. getcalculatedinsights(definitiontype, batchsize, offset, orderby, dataspace) get calculated insights. getcalculatedinsights(definitiontype, batchsize, offset, orderby, dataspace, pagetoken) get a page of calculated insights. runcalculatedinsight(apiname) run a calculated insight. updatecalculatedinsight(apiname, input) update a calculated insight. createcalculatedinsight(" "input) create a calculated insight. api version 57.0 requires chatter no signature public static connectapi.cdpcalculatedinsightoutput createcalculatedinsight(connectapi.cdpcalculatedinsightinput input) parameters input type: connectapi.cdpcalculatedinsightinput input representation for a calculated insight. return value type: connectapi.cdpcalculatedinsightoutput deletecalculatedinsight(apiname) delete a calculated insight. api version 57.0 402apex reference guide cdpcalculatedinsight class requires chatter no signature public static void deletecalculatedinsight(string apiname) parameters apiname type: string api name of the calculated insight to delete. return value type: void getcalculatedinsight(apiname) get a calculated insight. api version 57.0 requires chatter no signature public static connectapi.cdpcalculatedinsightoutput getcalculatedinsight(string apiname) parameters apiname type: string api name of the calculated insight to get. return value type: connectapi.cdpcalculatedinsightoutput getcalculatedinsights(definitiontype, batchsize, offset, orderby, dataspace) get calculated insights. api version 56.0 403apex reference guide cdpcalculatedinsight class requires chatter no signature public static connectapi.cdpcalculatedinsightpage getcalculatedinsights(string definitiontype, integer batchsize, integer offset, string orderby, string dataspace) parameters definitiontype type: string definition type of the calculated insight. values are: • calculatedmetric • externalmetric • streamingmetric batchsize type: integer number of items to return. values are from 1–300. if unspecified, the default value is 25. offset type: integer number of rows to skip before returning results. if unspecified, no rows are skipped. orderby type: string sort order for the result set, such as genderid__c asc,occupation__c desc. if unspecified, items are returned in the order they are retrieved. dataspace type: string name of the data space. return value type: connectapi.cdpcalculatedinsightpage getcalculatedinsights(definitiontype, batchsize, offset, orderby, dataspace, pagetoken) get a page of calculated insights. api version 57.0 requires chatter no 404apex reference guide cdpcalculatedinsight class signature public static connectapi.cdpcalculatedinsightpage getcalculatedinsights(string definitiontype, integer batchsize, integer offset, string orderby, string dataspace, string pagetoken) parameters definitiontype type: string definition type of the calculated insight. values are: • calculatedmetric • externalmetric • streamingmetric batchsize type: integer number of items to return. values are from 1–300. if unspecified, the default value is 25. offset type: integer number of rows to skip before returning results. if unspecified, no rows are skipped. orderby type: string sort order for the result set, such as genderid__c asc,occupation__c desc. if unspecified, items are returned in the order they are retrieved. dataspace type: string name of the data space. pagetoken type: string specifies the page token to use to view a page of information. page tokens are returned as part of the response class, such as currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. return value type: connectapi.cdpcalculatedinsightpage runcalculatedinsight(apiname) run a calculated insight. api version 57.0 405apex reference guide cdpcalculatedinsight class requires chatter no signature public static connectapi.cdpcalculatedinsightstandardactionesponserepresentation runcalculatedinsight(string apiname) parameters apiname type: string api name of the calculated insight to run. return value type: connectapi.cdpcalculatedinsightstandardactionresponserepresentation updatecalculatedinsight(apiname, input) update a calculated insight. api version 57.0 requires chatter no signature public static" "connectapi.cdpcalculatedinsightoutput updatecalculatedinsight(string apiname, connectapi.cdpcalculatedinsightinput input) parameters apiname type: string api name of the calculated insight to update. input type: connectapi.cdpcalculatedinsightinput input representation for a calculated insight. return value type: connectapi.cdpcalculatedinsightoutput 406apex reference guide cdpidentityresolution class cdpidentityresolution class create, delete, get, run, and update data cloud identity resolution rulesets. namespace connectapi cdpidentityresolution methods the following are methods for cdpidentityresolution. all methods are static. in this section: createidentityresolution(input) create an identity resolution ruleset. deleteidentityresolution(identityresolution) delete an identity resolution ruleset. getidentityresolution(identityresolution) get an identity resolution ruleset. getidentityresolutions() get identity resolution rulesets. runidentityresolutionnow(identityresolution, input) trigger an immediate identity resolution ruleset job run. updateidentityresolution(identityresolution, input) update an identity resolution ruleset. createidentityresolution(input) create an identity resolution ruleset. api version 57.0 requires chatter no signature public static connectapi.cdpidentityresolutionoutput createidentityresolution(connectapi.cdpidentityresolutionconfiginput input) parameters input type: connectapi.cdpidentityresolutionconfiginput 407apex reference guide cdpidentityresolution class input representation for creating an identity resolution ruleset. return value type: connectapi.cdpidentityresolutionoutput deleteidentityresolution(identityresolution) delete an identity resolution ruleset. api version 57.0 requires chatter no signature public static void deleteidentityresolution(string identityresolution) parameters identityresolution type: string developer name or id of the ruleset. return value type: void getidentityresolution(identityresolution) get an identity resolution ruleset. api version 57.0 requires chatter no signature public static connectapi.cdpidentityresolutionoutput getidentityresolution(string identityresolution) 408apex reference guide cdpidentityresolution class parameters identityresolution type: string developer name or id of the ruleset. return value type: connectapi.cdpidentityresolutionoutput getidentityresolutions() get identity resolution rulesets. api version 57.0 requires chatter no signature public static connectapi.cdpidentityresolutionsoutput getidentityresolutions() return value type: connectapi.cdpidentityresolutionsoutput runidentityresolutionnow(identityresolution, input) trigger an immediate identity resolution ruleset job run. api version 57.0 requires chatter no signature public static connectapi.cdpidentityresolutionrunnowoutput runidentityresolutionnow(string identityresolution, connectapi.cdpidentityresolutionrunnowinput input) 409apex reference guide cdpquery class parameters identityresolution type: string developer name of the ruleset. input type: connectapi.cdpidentityresolutionrunnowinput input representation for running an identity resolution ruleset job on demand. return value type: connectapi.cdpidentityresolutionrunnowoutput updateidentityresolution(identityresolution, input) update an identity resolution ruleset. api version 57.0 requires chatter no signature public static connectapi.cdpidentityresolutionoutput updateidentityresolution(string identityresolution, connectapi.cdpidentityresolutionconfigpatchinput input) parameters identityresolution type: string developer name or id of the ruleset. input type: connectapi.cdpidentityresolutionconfigpatchinput input representation for updating an identity resolution ruleset. return value type: connectapi.cdpidentityresolutionoutput cdpquery class get data cloud metadata and query data. 410apex reference guide cdpquery class namespace connectapi" "cdpquery methods the following are methods for cdpquery. all methods are static. in this section: getallmetadata() get all metadata, including calculated insights, engagement, profile, and other objects, as well as their relationships to other objects. getallmetadata(entitytype, entitycategory, entityname) get all metadata, filtering for entity type, category, and name. getinsightsmetadata() get insight metadata, including calculated insight objects, their dimensions and measures. getinsightsmetadata(ciname) get metadata for a calculated insight object. metadata includes dimensions and measures. getprofilemetadata() get metadata for data model objects in the profile category, including individual, contact point email, unified individual, and contact point address objects. metadata includes the objects, their fields, and category. getprofilemetadata(datamodelname) get metadata for a data model object in the profile category, such as individual, contact point email, unified individual, and contact point address. metadata includes the list of fields, data types, and indexes available for lookup. nextbatchansisqlv2(nextbatchid) get the next batch of data across data model, lake, unified, and linked objects. queryansisql(input) synchronously query data across data model, lake, unified, and linked objects.this query returns up to 4,999 rows. queryansisql(input, batchsize, offset, orderby) synchronously query data across data model, lake, unified, and linked objects. specify batch size, offset, and order of the results. this query returns up to 4,999 rows. queryansisqlv2(input) query up to 8 mb of data across data model, lake, unified, and linked objects. querycalculatedinsights(ciname, dimensions, measures, orderby, filters, batchsize, offset) query a calculated insight object. querycalculatedinsights(ciname, dimensions, measures, orderby, filters, batchsize, offset, timegranularity) query a calculated insight object within a specified time range. queryprofileapi(datamodelname, filters, fields, batchsize, offset, orderby) query a profile data model object using filters. queryprofileapi(datamodelname, id, searchkey, filters, fields, batchsize, offset, orderby) query a profile data model object using filters and a search key. queryprofileapi(datamodelname, id, childdatamodelname, searchkey, filters, fields, batchsize, offset, orderby) query a profile data model object and a child object using filters and a search key. 411apex reference guide cdpquery class queryprofileapi(datamodelname, id, ciname, searchkey, dimensions, measures, filters, fields, batchsize, offset, orderby) query a profile data model object and a calculated insight object using filters and a search key. queryprofileapi(datamodelname, id, ciname, searchkey, dimensions, measures, filters, fields, batchsize, offset, orderby, timegranularity) query a profile data model object and a calculated insight object using filters, a search key, and a time range. universalidlookupbysourceid(entityname, datasourceid, datasourceobjectid, sourcerecordid) look up objects by source id. getallmetadata() get all metadata, including calculated insights, engagement, profile, and other objects, as well as their relationships to other objects. api version 52.0 requires chatter no signature public static connectapi.cdpquerymetadataoutput getallmetadata() return value type: connectapi.cdpquerymetadataoutput getallmetadata(entitytype, entitycategory, entityname) get all metadata, filtering for entity type, category, and name. api version 54.0 requires chatter no signature public static connectapi.cdpquerymetadataoutput getallmetadata(string entitytype, string entitycategory, string entityname) parameters entitytype type: string 412apex reference guide cdpquery class type of metadata entity requested. valid values are datalakeobject, datamodelobject, and calculatedinsight. if unspecified, all types are returned. entitycategory type: string category of the metadata entity. valid values are profile, engagement, and related. if unspecified, all category entities are returned. entityname type: string metadata name" "of the entity, for example unifiedindividual__dlm. if unspecified, a complete list of entities is returned. return value type: connectapi.cdpquerymetadataoutput getinsightsmetadata() get insight metadata, including calculated insight objects, their dimensions and measures. api version 52.0 requires chatter no signature public static connectapi.cdpquerymetadataoutput getinsightsmetadata() return value type: connectapi.cdpquerymetadataoutput getinsightsmetadata(ciname) get metadata for a calculated insight object. metadata includes dimensions and measures. api version 52.0 requires chatter no signature public static connectapi.cdpquerymetadataoutput getinsightsmetadata(string ciname) 413apex reference guide cdpquery class parameters ciname type: string name of the calculated insight object, for example, individualchildrencount__cio. return value type: connectapi.cdpquerymetadataoutput getprofilemetadata() get metadata for data model objects in the profile category, including individual, contact point email, unified individual, and contact point address objects. metadata includes the objects, their fields, and category. api version 52.0 requires chatter no signature public static connectapi.cdpquerymetadataoutput getprofilemetadata() return value type: connectapi.cdpquerymetadataoutput getprofilemetadata(datamodelname) get metadata for a data model object in the profile category, such as individual, contact point email, unified individual, and contact point address. metadata includes the list of fields, data types, and indexes available for lookup. api version 52.0 requires chatter no signature public static connectapi.cdpquerymetadataoutput getprofilemetadata(string datamodelname) 414apex reference guide cdpquery class parameters datamodelname type: string name of the data model object, for example, unifiedindividual__dlm. return value type: connectapi.cdpquerymetadataoutput nextbatchansisqlv2(nextbatchid) get the next batch of data across data model, lake, unified, and linked objects. api version 54.0 requires chatter no signature public static connectapi.cdpqueryoutputv2 nextbatchansisqlv2(string nextbatchid) parameters nextbatchid type: string id of the next batch. see the usage section for more information. return value type: connectapi.cdpqueryoutputv2 usage initially, use the queryansisqlv2(input) method to query up to 8 mb of data. use the nextbatchid from the connectapi.cdpqueryoutputv2 output class as the nextbatchid parameter in this method to get the next batch of data. you can continue using subsequent next batch ids for up to an hour. queryansisql(input) synchronously query data across data model, lake, unified, and linked objects.this query returns up to 4,999 rows. note: a newer version of the query api is available. we recommend using queryansisqlv2(input) and nextbatchansisqlv2(nextbatchid) to take advantage of subsequent requests and larger response sizes. 415apex reference guide cdpquery class api version 52.0 requires chatter no signature public static connectapi.cdpqueryoutput queryansisql(connectapi.cdpqueryinput input) parameters input type: connectapi.cdpqueryinput a connectapi.cdpqueryinput body with the sql query. return value type: connectapi.cdpqueryoutput queryansisql(input, batchsize, offset, orderby) synchronously query data across data model, lake, unified, and linked objects. specify batch size, offset, and order of the results. this query returns up to 4,999 rows. note: a newer version of the query api is available. we recommend using queryansisqlv2(input) and nextbatchansisqlv2(nextbatchid) to take advantage of subsequent requests and larger response sizes. api version 53.0 requires chatter no signature public static connectapi.cdpqueryoutput queryansisql(connectapi.cdpqueryinput" "input, integer batchsize, integer offset, string orderby) parameters input type: connectapi.cdpqueryinput a connectapi.cdpqueryinput body with the sql query. batchsize type: integer 416apex reference guide cdpquery class number of records to return. values are from 1–4999. the default value is 4999. offset type: integer number of rows to skip before returning results. the sum of offset and batchsize must be less than 2147483647. the default value is 0. orderby type: string comma-separated values to sort the results in ascending or descending order, for example, genderid__c asc,occupation__c desc. return value type: connectapi.cdpqueryoutput queryansisqlv2(input) query up to 8 mb of data across data model, lake, unified, and linked objects. api version 54.0 requires chatter no signature public static connectapi.cdpqueryoutputv2 queryansisqlv2(connectapi.cdpqueryinput input) parameters input type: connectapi.cdpqueryinput a connectapi.cdpqueryinput body with the sql query. return value type: connectapi.cdpqueryoutputv2 usage use the nextbatchid in the connectapi.cdpqueryoutputv2 output class as the nextbatchid parameter in the nextbatchansisqlv2(nextbatchid) method to continue getting batches of data for up to an hour. querycalculatedinsights(ciname, dimensions, measures, orderby, filters, batchsize, offset) query a calculated insight object. 417apex reference guide cdpquery class api version 52.0 requires chatter no signature public static connectapi.cdpqueryoutput querycalculatedinsights(string ciname, string dimensions, string measures, string orderby, string filters, integer batchsize, integer offset) parameters ciname type: string name of the calculated insight object, for example, individualchildrencount__cio. dimensions type: string comma-separated list of up to 10 dimensions, such as genderid__c, to project. if unspecified, this parameter includes all of the available dimensions. measures type: string comma-separated list of up to 5 measures, such as totalsales__c, to project. if unspecified, this parameter includes all of the available measures. orderby type: string sort order for the result set, such as genderid__c asc,occupation__c desc. if unspecified, items are returned in the order they are retrieved. filters type: string filter the result set to a more narrow scope or specific type, such as [genderid__c=male,firstname__c=angel]. batchsize type: integer number of items to return. values are from 1–4,999. if unspecified, the default value is 4999. offset type: integer number of rows to skip before returning results. if unspecified, no rows are skipped. return value type: connectapi.cdpqueryoutput 418apex reference guide cdpquery class querycalculatedinsights(ciname, dimensions, measures, orderby, filters, batchsize, offset, timegranularity) query a calculated insight object within a specified time range. api version 54.0 requires chatter no signature public static connectapi.cdpqueryoutput querycalculatedinsights(string ciname, string dimensions, string measures, string orderby, string filters, integer batchsize, integer offset, string timegranularity) parameters ciname type: string name of the calculated insight object, for example, individualchildrencount__cio. dimensions type: string comma-separated list of up to 10 dimensions, such as genderid__c, to project. if unspecified, this parameter includes all of the available dimensions. measures type: string comma-separated list of up to 5 measures, such as totalsales__c, to project. if unspecified, this parameter includes all of the available measures. orderby type: string sort order for the result set, such as genderid__c asc,occupation__c desc. if unspecified, items are returned in the order they are retrieved. filters type: string filter the result set" "to a more narrow scope or specific type, such as [genderid__c=male,firstname__c=angel]. batchsize type: integer number of items to return. values are from 1–4,999. if unspecified, the default value is 4999. offset type: integer number of rows to skip before returning results. if unspecified, no rows are skipped. 419apex reference guide cdpquery class timegranularity type: string time range for the measures. values are: • hour • day • month • quarter • year if unspecified, no time range is applied. return value type: connectapi.cdpqueryoutput queryprofileapi(datamodelname, filters, fields, batchsize, offset, orderby) query a profile data model object using filters. api version 52.0 requires chatter no signature public static connectapi.cdpqueryoutput queryprofileapi(string datamodelname, string filters, string fields, integer batchsize, integer offset, string orderby) parameters datamodelname type: string name of the data model object, for example, unifiedindividual__dlm. filters type: string comma-separated list of equality expressions within square brackets, for example, [firstname__c=don]. fields type: string comma-separated list of up to 50 field names that you want to include in the result, for example, id__c,firstname__c, genderid__c,occupation__c. if unspecified, an arbitrary set of fields is returned. batchsize type: integer 420apex reference guide cdpquery class number of items to return. values are from 1–4,999. if unspecified, the default value is 100. offset type: integer number of rows to skip before returning results. if unspecified, no rows are skipped. orderby type: string sort order for the result set, such as genderid__c asc,occupation__c desc. if unspecified, items are returned in the order they are retrieved. return value type: connectapi.cdpqueryoutput queryprofileapi(datamodelname, id, searchkey, filters, fields, batchsize, offset, orderby) query a profile data model object using filters and a search key. api version 52.0 requires chatter no signature public static connectapi.cdpqueryoutput queryprofileapi(string datamodelname, string id, string searchkey, string filters, string fields, integer batchsize, integer offset, string orderby) parameters datamodelname type: string name of the data model object, for example, unifiedindividual__dlm. id type: string value of the primary or secondary key field, for example, john. if unspecified, defaults to the value of the primary key field. searchkey type: string if a field other than the primary key is used, name of the key field, for example, firstname__c. filters type: string comma-separated list of equality expressions within square brackets, for example, [firstname__c=don]. 421apex reference guide cdpquery class fields type: string comma-separated list of up to 50 field names that you want to include in the result, for example, id__c,firstname__c, genderid__c,occupation__c. if unspecified, an arbitrary set of fields is returned. batchsize type: integer number of items to return. values are from 1–4,999. if unspecified, the default value is 100. offset type: integer number of rows to skip before returning results. if unspecified, no rows are skipped. orderby type: string sort order for the result set, such as genderid__c asc,occupation__c desc. if unspecified, items are returned in the order they are retrieved. return value type: connectapi.cdpqueryoutput queryprofileapi(datamodelname, id, childdatamodelname, searchkey, filters, fields, batchsize, offset, orderby) query a profile data model object and a child object using filters and a search key. api version 52.0 requires chatter no signature public static connectapi.cdpqueryoutput queryprofileapi(string datamodelname, string id, string childdatamodelname, string searchkey, string filters, string fields, integer batchsize, integer offset, string orderby" ") parameters datamodelname type: string name of the data model object, for example, unifiedindividual__dlm. id type: string value of the primary or secondary key field, for example, john. if unspecified, defaults to the value of the primary key field. 422apex reference guide cdpquery class childdatamodelname type: string name of the child data model object, for example, unifiedcontactpointemail__dlm. searchkey type: string if a field other than the primary key is used, name of the key field, for example, firstname__c. filters type: string comma-separated list of equality expressions within square brackets, for example, [firstname__c=don]. filters are applied to the parent object only. fields type: string comma-separated list of child object field names that you want to include in the result, for example, id__c,emailaddress__c. if unspecified, the first 10 alphabetically sorted fields are returned. batchsize type: integer number of items to return. values are from 1–4,999. if unspecified, the default value is 100. offset type: integer number of rows to skip before returning results. if unspecified, no rows are skipped. orderby type: string sort order for the result set, such as genderid__c asc,occupation__c desc. if unspecified, items are returned in the order they are retrieved. return value type: connectapi.cdpqueryoutput queryprofileapi(datamodelname, id, ciname, searchkey, dimensions, measures, filters, fields, batchsize, offset, orderby) query a profile data model object and a calculated insight object using filters and a search key. api version 52.0 requires chatter no 423apex reference guide cdpquery class signature public static connectapi.cdpqueryoutput queryprofileapi(string datamodelname, string id, string ciname, string searchkey, string dimensions, string measures, string filters, string fields, integer batchsize, integer offset, string orderby) parameters datamodelname type: string name of the data model object, for example, unifiedindividual__dlm. id type: string value of the primary or secondary key field, for example, john. if unspecified, defaults to the value of the primary key field. ciname type: string name of the calculated insight object, for example, individualchildrencount__cio. searchkey type: string if a field other than the primary key is used, name of the key field, for example, firstname__c. dimensions type: string comma-separated list of up to 10 dimensions, such as genderid__c, to project. if unspecified, this parameter includes all of the available dimensions. measures type: string comma-separated list of up to 5 measures, such as totalsales__c, to project. if unspecified, this parameter includes all of the available measures. filters type: string comma-separated list of equality expressions within square brackets, for example, [firstname__c=don]. fields type: string comma-separated list of up to 50 field names that you want to include in the result, for example, id__c,firstname__c, genderid__c,occupation__c. if unspecified, an arbitrary set of fields is returned. batchsize type: integer number of items to return. values are from 1–4,999. if unspecified, the default value is 100. offset type: integer number of rows to skip before returning results. if unspecified, no rows are skipped. orderby type: string 424apex reference guide cdpquery class sort order for the result set, such as genderid__c asc,occupation__c desc. if unspecified, items are returned in the order they are retrieved. return value type: connectapi.cdpqueryoutput queryprofileapi(datamodelname, id, ciname, searchkey, dimensions, measures, filters, fields, batchsize, offset, orderby, timegranularity) query a profile data model object and a calculated insight object using filters, a search key, and a time range. api version 54.0 requires chatter no signature public static connectapi.cdpqueryoutput queryprofileapi(string datamodelname, string id, string ciname, string searchkey" ", string dimensions, string measures, string filters, string fields, integer batchsize, integer offset, string orderby, string timegranularity) parameters datamodelname type: string name of the data model object, for example, unifiedindividual__dlm. id type: string value of the primary or secondary key field, for example, john. if unspecified, defaults to the value of the primary key field. ciname type: string name of the calculated insight object, for example, individualchildrencount__cio. searchkey type: string if a field other than the primary key is used, name of the key field, for example, firstname__c. dimensions type: string comma-separated list of up to 10 dimensions, such as genderid__c, to project. if unspecified, this parameter includes all of the available dimensions. measures type: string 425apex reference guide cdpquery class comma-separated list of up to 5 measures, such as totalsales__c, to project. if unspecified, this parameter includes all of the available measures. filters type: string comma-separated list of equality expressions within square brackets, for example, [firstname__c=don]. fields type: string comma-separated list of up to 50 field names that you want to include in the result, for example, id__c,firstname__c, genderid__c,occupation__c. if unspecified, an arbitrary set of fields is returned. batchsize type: integer number of items to return. values are from 1–4,999. if unspecified, the default value is 100. offset type: integer number of rows to skip before returning results. if unspecified, no rows are skipped. orderby type: string sort order for the result set, such as genderid__c asc,occupation__c desc. if unspecified, items are returned in the order they are retrieved. timegranularity type: string time range for the measures. values are: • hour • day • month • quarter • year if unspecified, no time range is applied. return value type: connectapi.cdpqueryoutput universalidlookupbysourceid(entityname, datasourceid, datasourceobjectid, sourcerecordid) look up objects by source id. api version 54.0 426apex reference guide cdpsegment class requires chatter no signature public static connectapi.cdpquerydataoutput universalidlookupbysourceid(string entityname, string datasourceid, string datasourceobjectid, string sourcerecordid) parameters entityname type: string entity name. datasourceid type: string data source id. datasourceobjectid type: string data source object id. sourcerecordid type: string source record id. return value type: connectapi.cdpquerydataoutput cdpsegment class create, delete, get, publish, and update data cloud segments. namespace connectapi cdpsegment methods the following are methods for cdpsegment. all methods are static. in this section: createsegment(input) create a segment. deletesegment(segmentapiname) delete a segment. 427apex reference guide cdpsegment class executepublishadhoc(segmentid) publish a segment. getsegment(segmentapiname) get a segment. getsegments() get segments. getsegmentspaginated(batchsize, offset, orderby) get an ordered batch of segments. updatesegment(segmentapiname, input) update a segment. createsegment(input) create a segment. api version 55.0 requires chatter no signature public static connectapi.cdpsegmentoutput createsegment(connectapi.cdpsegmentinput input) parameters input type: connectapi.cdpsegmentinput a connectapi.cdpsegmentinput class. return value type: connectapi.cdpsegmentoutput deletesegment(segmentapiname) delete a segment. api version 56.0 428apex reference guide cdpsegment class requires chatter no signature public static void deletesegment(string segmentapiname) parameters segmentapiname type: string api name" "of the segment. return value type: void executepublishadhoc(segmentid) publish a segment. api version 56.0 requires chatter no signature public static connectapi.cdpsegmentactionoutput executepublishadhoc(string segmentid) parameters segmentid type: string id of the segment to publish. return value type: connectapi.cdpsegmentactionoutput getsegment(segmentapiname) get a segment. api version 56.0 429apex reference guide cdpsegment class requires chatter no signature public static connectapi.cdpsegmentcontaineroutput getsegment(string segmentapiname) parameters segmentapiname type: string api name of the segment. return value type: connectapi.cdpsegmentcontaineroutput getsegments() get segments. api version 55.0 requires chatter no signature public static connectapi.cdpsegmentcontaineroutput getsegments() return value type: connectapi.cdpsegmentcontaineroutput getsegmentspaginated(batchsize, offset, orderby) get an ordered batch of segments. api version 56.0 requires chatter no 430apex reference guide cdpsegment class signature public static connectapi.cdpsegmentcontaineroutput getsegmentspaginated(integer batchsize, integer offset, string orderby) parameters batchsize type: integer number of items to return. values are from 1–200. if unspecified, the default value is 20. offset type: integer number of rows to skip before returning results. if unspecified, no rows are skipped. orderby type: string sort order for the result set, such as name asc or marketsegmenttype desc. if unspecified, items are returned by name in ascending order. return value type: connectapi.cdpsegmentcontaineroutput updatesegment(segmentapiname, input) update a segment. api version 56.0 requires chatter no signature public static connectapi.cdpsegmentoutput updatesegment(string segmentapiname, connectapi.cdpsegmentinput input) parameters segmentapiname type: string api name of the segment. input type: connectapi.cdpsegmentinput a connectapi.cdpsegmentinput class with the updates. 431apex reference guide chatter class return value type: connectapi.cdpsegmentoutput chatter class access information about followers and subscriptions for records. namespace connectapi chatter methods the following are methods for chatter. all methods are static. in this section: deletesubscription(communityid, subscriptionid) delete a subscription. use this method to stop following a record, a user, or a file. getfollowers(communityid, recordid) get the first page of followers for a record. getfollowers(communityid, recordid, pageparam, pagesize) get a page of followers for a record. getsubscription(communityid, subscriptionid) get information about a subscription. submitdigestjob(period) submit a daily or weekly chatter email digest job. deletesubscription(communityid, subscriptionid) delete a subscription. use this method to stop following a record, a user, or a file. api version 28.0 requires chatter yes signature public static void deletesubscription(string communityid, string subscriptionid) 432" "apex reference guide chatter class parameters communityid type: string id for an experience cloud site, internal, or null. subscriptionid type: string the id for a subscription. return value type: void usage “following” a user, group, or record is the same as “subscribing” to a user, group, or record. a “follower” is the user who followed the user, group, or record. a “subscription” is an object describing the relationship between the follower and the user, group, or record they followed. to leave a group, call deletemember(communityid, membershipid). example when you follow a user, the call to connectapi.chatterusers.follow returns a connectapi.subscription object. to stop following the user, pass the id property of that object to this method. connectapi.chatter.deletesubscription(null, '0e8rr0000004cnk0au'); see also: follow a record follow(communityid, userid, subjectid) getfollowers(communityid, recordid) get the first page of followers for a record. api version 28.0 requires chatter yes signature public static connectapi.followerpage getfollowers(string communityid, string recordid) 433apex reference guide chatter class parameters communityid type: string id for an experience cloud site, internal, or null. recordid type: string id for a record or the keyword me. return value type: connectapi.followerpage usage “following” a user, group, or record is the same as “subscribing” to a user, group, or record. a “follower” is the user who followed the user, group, or record. a “subscription” is an object describing the relationship between the follower and the user, group, or record they followed. see also: follow a record getfollowers(communityid, recordid, pageparam, pagesize) get a page of followers for a record. api version 28.0 requires chatter yes signature public static connectapi.followerpage getfollowers(string communityid, string recordid, integer pageparam, integer pagesize) parameters communityid type: string id for an experience cloud site, internal, or null. recordid type: string id for a record or the keyword me. 434apex reference guide chatter class pageparam type: integer number of the page you want returned. starts at 0. if you pass in null or 0, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. return value type: connectapi.followerpage usage “following” a user, group, or record is the same as “subscribing” to a user, group, or record. a “follower” is the user who followed the user, group, or record. a “subscription” is an object describing the relationship between the follower and the user, group, or record they followed. see also: follow a record getsubscription(communityid, subscriptionid) get information about a subscription. api version 28.0 requires chatter yes signature public static connectapi.subscription getsubscription(string communityid, string subscriptionid) parameters communityid type: string id for an experience cloud site, internal, or null. subscriptionid type: string the id for a subscription. 435apex reference guide chatter class return value type: connectapi.subscription usage “following” a user, group, or record is the same as “subscribing” to a user, group, or record. a “follower” is the user who followed the user, group, or record. a “subscription” is an object describing the relationship between the follower and the user, group, or record they followed. see also: follow a record submitdigestjob(period) submit a daily or weekly chatter email digest job. api version 37.0 requires chatter yes signature public static connectapi.digestjobrepresentation submitdigestjob(connecta" "pi.digestperiod period) parameters period type: connectapi.digestperiod time period that’s included in a chatter email digest. values are: • dailydigest—the email includes up to the 50 latest posts from the previous day. • weeklydigest—the email includes up to the 50 latest posts from the previous week. return value type: connectapi.digestjob usage the times when chatter sends email digests are not configurable in the ui. to control when email digests are sent and to use this method, contact salesforce to enable api-only chatter digests. warning: enabling api-only chatter digests disables the scheduled digests for your org. you must call the api for your users to receive their digests. 436apex reference guide chatterfavorites class we recommend scheduling digest jobs by implementing the apex schedulable interface with this method. to monitor your digest jobs from setup, enter background jobs in the quick find box, then select background jobs. example schedule daily digests: global class exampledigestjob1 implements schedulable { global void execute(schedulablecontext context) { connectapi.chatter.submitdigestjob(connectapi.digestperiod.dailydigest); } } schedule weekly digests: global class exampledigestjob2 implements schedulable { global void execute(schedulablecontext context) { connectapi.chatter.submitdigestjob(connectapi.digestperiod.weeklydigest); } } see also: apex scheduler chatterfavorites class chatter favorites give you easy access to topics, list views, and feed searches. namespace connectapi usage use connect in apex to get and delete topics, list views, and feed searches that have been added as favorites. add topics and feed searches as favorites, and update the last view date of a feed search or list view feed to the current system time. in this image of salesforce, “build issues” is a topic, “all accounts” is a list view, and “united” is a feed search. 437apex reference guide chatterfavorites class chatterfavorites methods the following are methods for chatterfavorites. all methods are static. in this section: addfavorite(communityid, subjectid, searchtext) add a feed search favorite for a user. addrecordfavorite(communityid, subjectid, targetid) add a topic as a favorite. deletefavorite(communityid, subjectid, favoriteid) delete a favorite. getfavorite(communityid, subjectid, favoriteid) get information about a favorite. getfavorites(communityid, subjectid) get a list of favorites for a user. getfeedelements(communityid, subjectid, favoriteid) get the first page of feed elements for a favorite. getfeedelements(communityid, subjectid, favoriteid, pageparam, pagesize, sortparam) get a page of sorted feed elements for a favorite. getfeedelements(communityid, subjectid, favoriteid, recentcommentcount, elementsperbundle, pageparam, pagesize, sortparam) get a page of sorted feed elements for a favorite. include no more than the specified number of comments per feed element. updatefavorite(communityid, subjectid, favoriteid, updatelastviewdate) update the last view date of the saved search or list view feed to the current system time. 438apex reference guide chatterfavorites class addfavorite(communityid, subjectid, searchtext) add a feed search favorite for a user. api version 28.0 requires chatter yes signature public static connectapi.feedfavorite addfavorite(string communityid, string subjectid, string searchtext) parameters communityid type: string id for an experience cloud site, internal, or null. subjectid type: string id of the context user or the alias me. searchtext type: string specify the text of the search to be saved as a favorite. this method can only create a feed search favorite, not a list view favorite or a topic. return value type: connectapi.feedfavorite addrecordfavorite(communityid, subjectid, targetid) add a topic as a favorite. api version 28.0 requires chatter yes 439apex reference guide chatterfavorites class" "signature public static connectapi.feedfavorite addrecordfavorite(string communityid, string subjectid, string targetid) parameters communityid type: string id for an experience cloud site, internal, or null. subjectid type: string id of the context user or the alias me. targetid type: string the id of the topic to add as a favorite. return value type: connectapi.feedfavorite deletefavorite(communityid, subjectid, favoriteid) delete a favorite. api version 28.0 requires chatter yes signature public static void deletefavorite(string communityid, string subjectid, string favoriteid) parameters communityid type: string id for an experience cloud site, internal, or null. subjectid type: string id of the context user or the alias me. favoriteid type: string 440apex reference guide chatterfavorites class id of a favorite. return value type: void getfavorite(communityid, subjectid, favoriteid) get information about a favorite. api version 28.0 requires chatter yes signature public static connectapi.feedfavorite getfavorite(string communityid, string subjectid, string favoriteid) parameters communityid type: string id for an experience cloud site, internal, or null. subjectid type: string id of the context user or the alias me. favoriteid type: string id of a favorite. return value type: connectapi.feedfavorite getfavorites(communityid, subjectid) get a list of favorites for a user. api version 28.0 441apex reference guide chatterfavorites class requires chatter yes signature public static connectapi.feedfavorites getfavorites(string communityid, string subjectid) parameters communityid type: string id for an experience cloud site, internal, or null. subjectid type: string id of the context user or the alias me. return value type: connectapi.feedfavorites getfeedelements(communityid, subjectid, favoriteid) get the first page of feed elements for a favorite. api version 31.0 requires chatter yes signature public static connectapi.feedelementpage getfeedelements(string communityid, string subjectid, string favoriteid) parameters communityid type: string id for an experience cloud site, internal, or null. subjectid type: string id of the context user or the alias me. favoriteid type: string 442apex reference guide chatterfavorites class id of a favorite. return value type: connectapi.feedelementpage usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestgetfeedelements(communityid, subjectid, favoriteid, result) apex developer guide: testing connectapi code getfeedelements(communityid, subjectid, favoriteid, pageparam, pagesize, sortparam) get a page of sorted feed elements for a favorite. api version 31.0 requires chatter yes signature public static connectapi.feedelementpage getfeedelements(string communityid, string subjectid, string favoriteid, string pageparam, integer pagesize, connectapi.feedsortorder sortparam) parameters communityid type: string id for an experience cloud site, internal, or null. subjectid type: string id of the context user or the alias me. favoriteid type: string id of a favorite. pageparam type: string 443apex reference guide chatterfavorites class page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of feed elements per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.feedsortorder values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—s" "orts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. if you pass in null, the default value createddatedesc is used. return value type: connectapi.feedelementpage usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestgetfeedelements(communityid, subjectid, favoriteid, pageparam, pagesize, sortparam, result) apex developer guide: testing connectapi code getfeedelements(communityid, subjectid, favoriteid, recentcommentcount, elementsperbundle, pageparam, pagesize, sortparam) get a page of sorted feed elements for a favorite. include no more than the specified number of comments per feed element. api version 31.0 requires chatter yes 444apex reference guide chatterfavorites class signature public static connectapi.feedelementpage getfeedelements(string communityid, string subjectid, string favoriteid, integer recentcommentcount, integer elementsperbundle, string pageparam, integer pagesize, connectapi.feedsortorder sortparam) parameters communityid type: string id for an experience cloud site, internal, or null. subjectid type: string id of the context user or the alias me. favoriteid type: string id of a favorite. recentcommentcount type: integer maximum number of comments to return with each feed element. the default value is 3. elementsperbundle type: integer maximum number of feed elements per bundle. the default and maximum value is 10. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of feed elements per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.feedsortorder values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. if you pass in null, the default value createddatedesc is used. 445apex reference guide chatterfavorites class return value type: connectapi.feedelementpage usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestgetfeedelements(communityid, subjectid, favoriteid, recentcommentcount, elementsperbundle, pageparam, pagesize, sortparam, result) apex developer guide: testing connectapi code updatefavorite(communityid, subjectid, favoriteid, updatelastviewdate) update the last view date of the saved search or list view feed to the current system time. api version 28.0 requires chatter yes signature public static connectapi.feedfavorite updatefavorite(string communityid, string subjectid, string favoriteid, boolean updatelastviewdate) parameters communityid type: string id for an experience cloud site, internal, or null. subjectid type: string id of the context user or the alias me. favoriteid type: string id of a favorite. updatelastviewdate type: boolean specify whether to update the last view date of the specified favorite to the current system time (true) or not (false). 446apex reference guide chatterfavorites class return value type: connectapi" ".feedfavorite chatterfavorites test methods the following are the test methods for chatterfavorites. all methods are static. for information about using these methods to test your connectapi code, see testing connectapi code. in this section: settestgetfeedelements(communityid, subjectid, favoriteid, result) register a connectapi.feedelementpage object to be returned when getfeedelements is called with matching parameters in a test context. use the method with the same parameters or the code throws an exception. settestgetfeedelements(communityid, subjectid, favoriteid, pageparam, pagesize, sortparam, result) register a connectapi.feedelementpage object to be returned when getfeedelements is called with matching parameters in a test context. use the method with the same parameters or the code throws an exception. settestgetfeedelements(communityid, subjectid, favoriteid, recentcommentcount, elementsperbundle, pageparam, pagesize, sortparam, result) register a connectapi.feedelementpage object to be returned when getfeedelements is called with matching parameters in a test context. use the method with the same parameters or the code throws an exception. settestgetfeedelements(communityid, subjectid, favoriteid, result) register a connectapi.feedelementpage object to be returned when getfeedelements is called with matching parameters in a test context. use the method with the same parameters or the code throws an exception. api version 31.0 signature public static void settestgetfeedelements(string communityid, string subjectid, string favoriteid, connectapi.feedelementpage result) parameters communityid type: string id for an experience cloud site, internal, or null. subjectid type: string id of the context user or the alias me. favoriteid type: string id of a favorite. 447apex reference guide chatterfavorites class result type: connectapi.feedelementpage object containing test data. return value type: void see also: getfeedelements(communityid, subjectid, favoriteid) apex developer guide: testing connectapi code settestgetfeedelements(communityid, subjectid, favoriteid, pageparam, pagesize, sortparam, result) register a connectapi.feedelementpage object to be returned when getfeedelements is called with matching parameters in a test context. use the method with the same parameters or the code throws an exception. api version 31.0 signature public static void settestgetfeedelements(string communityid, string subjectid, string favoriteid, string pageparam, integer pagesize, connectapi.feedsortorder sortparam, connectapi.feedelementpage result) parameters communityid type: string id for an experience cloud site, internal, or null. subjectid type: string id of the context user or the alias me. favoriteid type: string id of a favorite. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer 448apex reference guide chatterfavorites class specifies the number of feed elements per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.feedsortorder values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. if you pass in null, the default value createddatedesc is used. result type: connectapi.feedelementpage object containing test data. return value type: void see also: getfeedelements(communityid, subjectid, favoriteid, pageparam, pagesize, sortparam) apex developer guide: testing connectapi code" "settestgetfeedelements(communityid, subjectid, favoriteid, recentcommentcount, elementsperbundle, pageparam, pagesize, sortparam, result) register a connectapi.feedelementpage object to be returned when getfeedelements is called with matching parameters in a test context. use the method with the same parameters or the code throws an exception. api version 31.0 signature public static void settestgetfeedelements(string communityid, string subjectid, string favoriteid, integer recentcommentcount, integer elementsperbundle, string pageparam, integer pagesize, connectapi.feedsortorder sortparam, connectapi.feedelementpage result) parameters communityid type: string id for an experience cloud site, internal, or null. 449apex reference guide chatterfavorites class subjectid type: string id of the context user or the alias me. favoriteid type: string id of a favorite. recentcommentcount type: integer maximum number of comments to return with each feed element. the default value is 3. elementsperbundle type: integer maximum number of feed elements per bundle. the default and maximum value is 10. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of feed elements per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.feedsortorder values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. if you pass in null, the default value createddatedesc is used. result type: connectapi.feedelementpage object containing test data. return value type: void see also: getfeedelements(communityid, subjectid, favoriteid, recentcommentcount, elementsperbundle, pageparam, pagesize, sortparam) apex developer guide: testing connectapi code 450apex reference guide chatterfavorites class retired chatterfavorites methods the following methods for chatterfavorites are retired. in this section: getfeeditems(communityid, subjectid, favoriteid) get the first page of feed items for a favorite. getfeeditems(communityid, subjectid, favoriteid, pageparam, pagesize, sortparam) get a page of sorted feed items for a favorite. getfeeditems(communityid, subjectid, favoriteid, recentcommentcount, pageparam, pagesize, sortparam) get a page of sorted feed items for a favorite. include no more than the specified number of comments per feed item. settestgetfeeditems(communityid, subjectid, favoriteid, result) register a connectapi.feeditempage object to be returned when getfeeditems is called with matching parameters in a test context. use the method with the same parameters or the code throws an exception. settestgetfeeditems(communityid, subjectid, favoriteid, pageparam, pagesize, sortparam, result) register a connectapi.feeditempage object to be returned when getfeeditems is called with matching parameters in a test context. use the method with the same parameters or the code throws an exception. settestgetfeeditems(communityid, subjectid, favoriteid, recentcommentcount, pageparam, pagesize, sortparam, result) register a connectapi.feeditempage object to be returned when getfeeditems is called with matching parameters in a test context. use the method with the same parameters or the code throws an exception. getfeeditems(communityid, subjectid, favoriteid) get the first page of feed items for a favorite. api version 28.0–31.0 important: in version 32.0 and later, use getfeedelements(communityid, subjectid, favoriteid)." "requires chatter yes signature public static connectapi.feeditempage getfeeditems(string communityid, string subjectid, string favoriteid) parameters communityid type: string id for an experience cloud site, internal, or null. 451apex reference guide chatterfavorites class subjectid type: string id of the context user or the alias me. favoriteid type: string id of a favorite. return value type: connectapi.feeditempage usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestgetfeeditems(communityid, subjectid, favoriteid, result) apex developer guide: testing connectapi code getfeeditems(communityid, subjectid, favoriteid, pageparam, pagesize, sortparam) get a page of sorted feed items for a favorite. api version 28.0–31.0 important: in version 32.0 and later, use getfeedelements(communityid, subjectid, favoriteid, pageparam, pagesize, sortparam). requires chatter yes signature public static connectapi.feeditempage getfeeditems(string communityid, string subjectid, string favoriteid, string pageparam, integer pagesize, connectapi.feedsortorder sortparam) parameters communityid type: string id for an experience cloud site, internal, or null. 452apex reference guide chatterfavorites class subjectid type: string id of the context user or the alias me. favoriteid type: string id of a favorite. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer number of feed items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.feedsortorder values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. sorts the returned feed by the most recently created feed item, or by the most recently modified feed item. if you pass in null, the default value createddatedesc is used. return value type: connectapi.feeditempage usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestgetfeeditems(communityid, subjectid, favoriteid, pageparam, pagesize, sortparam, result) apex developer guide: testing connectapi code getfeeditems(communityid, subjectid, favoriteid, recentcommentcount, pageparam, pagesize, sortparam) get a page of sorted feed items for a favorite. include no more than the specified number of comments per feed item. 453apex reference guide chatterfavorites class api version 29.0–31.0 important: in version 32.0 and later, use getfeedelements(communityid, subjectid, favoriteid, recentcommentcount, elementsperbundle, pageparam, pagesize, sortparam). requires chatter yes signature public static connectapi.feeditempage getfeeditems(string communityid, string subjectid, string favoriteid, integer recentcommentcount, string pageparam, integer pagesize, feedsortorder sortparam) parameters communityid type: string id for an experience cloud site, internal, or null. subjectid type: string id of the context user or the alias me. favoriteid type: string id of a favorite. recentcommentcount type: integer maximum number of comments to return with each feed item. the default value is 3." "pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer number of feed items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.feedsortorder values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. 454apex reference guide chatterfavorites class • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. sorts the returned feed by the most recently created feed item, or by the most recently modified feed item. if you pass in null, the default value createddatedesc is used. return value type: connectapi.feeditempage usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestgetfeeditems(communityid, subjectid, favoriteid, recentcommentcount, pageparam, pagesize, sortparam, result) apex developer guide: testing connectapi code settestgetfeeditems(communityid, subjectid, favoriteid, result) register a connectapi.feeditempage object to be returned when getfeeditems is called with matching parameters in a test context. use the method with the same parameters or the code throws an exception. api version 28.0–31.0 signature public static void settestgetfeeditems(string communityid, string subjectid, string favoriteid, connectapi.feeditempage result) parameters communityid type: string id for an experience cloud site, internal, or null. subjectid type: string id of the context user or the alias me. favoriteid type: string id of a favorite. result type: connectapi.feeditempage 455apex reference guide chatterfavorites class object containing test data. return value type: void see also: getfeeditems(communityid, subjectid, favoriteid) apex developer guide: testing connectapi code settestgetfeeditems(communityid, subjectid, favoriteid, pageparam, pagesize, sortparam, result) register a connectapi.feeditempage object to be returned when getfeeditems is called with matching parameters in a test context. use the method with the same parameters or the code throws an exception. api version 28.0–31.0 signature public static void settestgetfeeditems(string communityid, string subjectid, string favoriteid, string pageparam, integer pagesize, feedsortorder sortparam, connectapi.feeditempage result) parameters communityid type: string id for an experience cloud site, internal, or null. subjectid type: string id of the context user or the alias me. favoriteid type: string id of a favorite. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer number of feed items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. 456apex reference guide chatterfavorites class sortparam type: connectapi.feedsortorder values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relev" "ance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. sorts the returned feed by the most recently created feed item, or by the most recently modified feed item. if you pass in null, the default value createddatedesc is used. result type: connectapi.feeditempage object containing test data. return value type: void see also: getfeeditems(communityid, subjectid, favoriteid, pageparam, pagesize, sortparam) apex developer guide: testing connectapi code settestgetfeeditems(communityid, subjectid, favoriteid, recentcommentcount, pageparam, pagesize, sortparam, result) register a connectapi.feeditempage object to be returned when getfeeditems is called with matching parameters in a test context. use the method with the same parameters or the code throws an exception. api version 29.0–31.0 signature public static void settestgetfeeditems(string communityid, string subjectid, string favoriteid, integer recentcommentcount, string pageparam, integer pagesize, feedsortorder sortparam, connectapi.feeditempage result) parameters communityid type: string id for an experience cloud site, internal, or null. 457apex reference guide chatterfavorites class subjectid type: string id of the context user or the alias me. favoriteid type: string id of a favorite. recentcommentcount type: integer maximum number of comments to return with each feed item. the default value is 3. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer number of feed items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.feedsortorder values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. sorts the returned feed by the most recently created feed item, or by the most recently modified feed item. if you pass in null, the default value createddatedesc is used. result type: connectapi.feeditempage object containing test data. return value type: void see also: getfeeditems(communityid, subjectid, favoriteid, recentcommentcount, pageparam, pagesize, sortparam) apex developer guide: testing connectapi code 458apex reference guide chatterfeeds class chatterfeeds class get, post, and delete feed elements, likes, comments, and bookmarks. you can also search feed elements, share feed elements, and vote on polls. namespace connectapi usage the chatter feed is a container of feed elements. the abstract class connectapi.feedelement is a parent class to the connectapi.feeditem class, representing feed posts, and the connectapi.genericfeedelement class, representing bundles and recommendations in the feed. for detailed information, see working with feeds and feed elements. important: feed item methods aren’t available in version 32.0. in version 32.0 and later, use feed element methods. message segments in a feed item are typed as connectapi.messagesegment. feed item capabilities are typed as connectapi.feeditemcapability. record fields are typed as connectapi.abstractrecordfield. these classes are all abstract and have several concrete subclasses. at runtime you can use instanceof to check the concrete types of these objects and then safely proceed with the corresponding downcast. when you downcast, you must have a default case that handles unknown subclasses. important: the composition of a feed can change between releases. write your code to handle instances of unknown subclasses. chatterfeeds methods the following are methods for chatterfeeds. all methods are static. in this section:" "createstream(communityid, streaminput) create a chatter feed stream. deletecomment(communityid, commentid) delete a comment. deletefeedelement(communityid, feedelementid) delete a feed element. deletelike(communityid, likeid) delete a like on a comment or post. deletestream(communityid, streamid) delete a chatter feed stream. getcomment(communityid, commentid) get a comment. getcommentbatch(communityid, commentids) get a list of comments. getcommentincontext(communityid, commentid, pagesize) get a threaded comment in the context of its parent comments and post. 459apex reference guide chatterfeeds class getcommentsforfeedelement(communityid, feedelementid) get comments for a feed element. getcommentsforfeedelement(communityid, feedelementid, threadedcommentscollapsed) get comments in a threaded style for a feed element. getcommentsforfeedelement(communityid, feedelementid, pageparam, pagesize) get a page of comments for a feed element. getcommentsforfeedelement(communityid, feedelementid, pageparam, pagesize, threadedcommentscollapsed) get a page of comments in a threaded style for a feed element. getcommentsforfeedelement(communityid, feedelementid, threadedcommentscollapsed, sortparam) get sorted comments in a threaded style for a feed element. getcommentsforfeedelement(communityid, feedelementid, pageparam, pagesize, threadedcommentscollapsed, sortparam) get a page of sorted comments in a threaded style for a feed element. getcommentsforfeedelement(communityid, feedelementid, sortparam) get sorted comments for a feed element. getcommentsforfeedelement(communityid, feedelementid, sortparam, threadedcommentscollapsed) get sorted comments in a threaded style for a feed element. getextensions(communityid, pageparam, pagesize) get extensions. getfeed(communityid, feedtype) get a feed. getfeed(communityid, feedtype, sortparam) get a sorted feed. getfeed(communityid, feedtype, subjectid) get a feed for a record or user. getfeed(communityid, feedtype, subjectid, sortparam) get a sorted feed for a record or user. getfeeddirectory(string) get a list of all feeds available to the context user. getfeedelement(communityid, feedelementid) get a feed element. getfeedelement(communityid, feedelementid, commentsort) get a feed element with sorted comments. getfeedelement(communityid, feedelementid, threadedcommentscollapsed) get a feed element and its comments in a threaded style. getfeedelement(communityid, feedelementid, threadedcommentscollapsed, commentsort) get a feed element and its sorted comments in a threaded style. getfeedelement(communityid, feedelementid, recentcommentcount, elementsperbundle) get a feed element with the specified number of elements per bundle including no more than the specified number of comments per feed element. 460apex reference guide chatterfeeds class getfeedelement(communityid, feedelementid, recentcommentcount, elementsperbundle, threadedcommentscollapsed) get a feed element with its comments in a threaded style with the specified number of elements per bundle and comments per feed element. getfeedelement(communityid, feedelementid, recentcommentcount, elementsperbundle, threadedcommentscollapsed, commentsort) get a feed element with its sorted comments in a threaded style with the specified number of elements per bundle and comments per feed element. getfeedelement(communityid, feedelementid, recentcommentcount, elementsperbundle, commentsort) get a feed element with the specified number of elements per bundle including no more than the specified number of sorted comments per feed element. getfeedelementbatch(communityid, feedelementids) get a list of feed elements. getfeedelementpoll(communityid, feedelementid) get the poll associated with a feed element. getfeedelementsfrombundle(communityid, feedelementid) get feed elements from a bundle. getfeedelementsfrombundle(communityid, feedelementid, pageparam, pagesize, elementsperbundle, recentcommentcount) get a page of feed elements from a bundle. specify the number of elements per bundle and include no more than the specified number of comments per feed element. getfeedelementsfromfeed(communityid," "feedtype) get feed elements from the company, directmessagemoderation, directmessages, home, moderation, and pendingreview feeds. getfeedelementsfromfeed(communityid, feedtype, pageparam, pagesize, sortparam) get a page of sorted feed elements from the company, directmessagemoderation, directmessages, home, moderation, and pendingreview feeds. getfeedelementsfromfeed(communityid, feedtype, recentcommentcount, density, pageparam, pagesize, sortparam) get a page of sorted feed elements from the company, directmessagemoderation, directmessages, home, moderation, and pendingreview feeds. each feed element contains no more than the specified number of comments. getfeedelementsfromfeed(communityid, feedtype, recentcommentcount, density, pageparam, pagesize, sortparam, filter) get a page of sorted and filtered feed elements from the home feed. each feed element contains no more than the specified number of comments. getfeedelementsfromfeed(communityid, feedtype, recentcommentcount, density, pageparam, pagesize, sortparam, filter, threadedcommentscollapsed) get a page of filtered and sorted feed elements with comments in a threaded style from the home feed. each feed element contains no more than the specified number of comments. getfeedelementsfromfeed(communityid, feedtype, subjectid) get feed elements from any feed other than company, directmessagemoderation, directmessages, filter, home, landing, moderation, and pendingreview for a user or record. getfeedelementsfromfeed(communityid, feedtype, subjectid, pageparam, pagesize, sortparam) get a page of sorted feed elements from any feed other than company, directmessagemoderation, directmessages, filter, home, landing, moderation, and pendingreview. 461apex reference guide chatterfeeds class getfeedelementsfromfeed(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, sortparam) get a page of sorted feed elements from any feed other than company, directmessagemoderation, directmessages, filter, home, landing, moderation, and pendingreview. each feed element includes no more than the specified number of comments. getfeedelementsfromfeed(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, sortparam, showinternalonly) get a page of sorted feed elements from a record feed. each feed element includes no more than the specified number of comments. specify whether to return feed elements posted by internal (non-experience cloud site) users only. getfeedelementsfromfeed(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, sortparam, filter) get a page of sorted and filtered feed elements from the userprofile feed. getfeedelementsfromfeed(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, sortparam, filter, threadedcommentscollapsed) get a page of feed elements with comments in a threaded style from the userprofile feed. getfeedelementsfromfeed(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, sortparam, customfilter) get a page of sorted and filtered feed elements from the case feed. getfeedelementsfromfeed(communityid, feedtype, subjectid, recentcommentcount, elementsperbundle, density, pageparam, pagesize, sortparam, showinternalonly) get a page of sorted feed elements from a record feed. specify the number of elements per bundle and include no more than the specified number of comments per feed element. specify whether to return feed elements posted by internal (non-experience cloud site) users only. getfeedelementsfromfeed(communityid, feedtype, subjectid, recentcommentcount, elementsperbundle, density, pageparam, pagesize, sortparam, showinternalonly, filter) get a page of sorted and filtered feed elements from a record feed. specify the number of elements per bundle and include no more than the specified number of comments per feed element. specify whether to return feed elements posted by internal (non-experience cloud site) users only. getfeedelementsfromfeed(communityid, feedtype, subjectid, recentcommentcount, elementsperbundle, density, pageparam, pagesize, sortparam, showinternalonly, filter, threadedcommentscollapsed) get a page of sorted" "and filtered feed elements with comments in a threaded style for a record feed. specify the number of elements per bundle and include no more than the specified number of comments per feed element. specify whether to return feed elements posted by internal (non-experience cloud site) users only. getfeedelementsfromfeed(communityid, feedtype, subjectid, recentcommentcount, elementsperbundle, density, pageparam, pagesize, sortparam, showinternalonly, customfilter) get a page of sorted and filtered feed elements from a case feed. getfeedelementsfromfeed(communityid, feedtype, subjectid, recentcommentcount, elementsperbundle, density, pageparam, pagesize, sortparam, showinternalonly, customfilter, threadedcommentscollapsed) get a page of filtered and sorted feed elements with comments in a threaded style from a case feed. getfeedelementsfromfilterfeed(communityid, subjectid, keyprefix) get feed elements from a feed filtered by a key prefix for a user. getfeedelementsfromfilterfeed(communityid, subjectid, keyprefix, pageparam, pagesize, sortparam) get a page of sorted feed elements from a feed filtered by a key prefix for a user. 462apex reference guide chatterfeeds class getfeedelementsfromfilterfeed(communityid, subjectid, keyprefix, recentcommentcount, elementsperbundle, density, pageparam, pagesize, sortparam) get a page of sorted feed elements from a feed filtered by a key prefix for a user. each feed element contains no more than the specified number of comments. getfeedelementsfromfilterfeedupdatedsince(communityid, subjectid, keyprefix, recentcommentcount, elementsperbundle, density, pageparam, pagesize, updatedsince) get a page of feed elements from a feed filtered by a key prefix for a user. include only feed elements that have been updated since the time specified in the updatedsince parameter. getfeedelementsupdatedsince(communityid, feedtype, recentcommentcount, density, pageparam, pagesize, updatedsince) get a page of feed elements from the company, directmessagemoderation, home, and moderation feeds. include only feed elements that have been updated since the time specified in the updatedsince parameter. each feed element contains no more than the specified number of comments. getfeedelementsupdatedsince(communityid, feedtype, recentcommentcount, density, pageparam, pagesize, updatedsince, filter) get a page of filtered feed elements from the home feed. include only feed elements that have been updated since the time specified in the updatedsince parameter. each feed element contains no more than the specified number of comments. getfeedelementsupdatedsince(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, updatedsince) get a page of feed elements from the files, groups, news, people, and record feeds. include only feed elements that have been updated since the time specified in the updatedsince parameter. each feed element contains no more than the specified number of comments. getfeedelementsupdatedsince(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, updatedsince, showinternalonly) get a page of feed elements from a record feed. include only feed elements that have been updated since the time specified in the updatedsince parameter. specify whether to return feed elements posted by internal (non-experience cloud site) users only. getfeedelementsupdatedsince(communityid, feedtype, subjectid, recentcommentcount, elementsperbundle, density, pageparam, pagesize, updatedsince, filter) get a page of filtered feed elements from a userprofile feed. include only feed elements that have been updated since the time specified in the updatedsince parameter. getfeedelementsupdatedsince(communityid, feedtype, subjectid, recentcommentcount, elementsperbundle, density, pageparam, pagesize, updatedsince, customfilter) get a page of filtered feed elements from a case feed. include only feed elements that have been updated since the time specified in the updatedsince parameter. getfeedelementsupdatedsince(communityid, feedtype, subjectid, recentcommentcount, elementsperbundle, density, pageparam, pagesize, updatedsince, showinternalonly) get a page of feed elements from a record feed. include only feed elements that have been updated since the time specified in the updatedsince parameter. specify the maximum number of feed elements in a bundle and whether to return feed elements posted by internal (non-experience cloud site) users only" ". getfeedelementsupdatedsince(communityid, feedtype, subjectid, recentcommentcount, elementsperbundle, density, pageparam, pagesize, updatedsince, showinternalonly, filter) get a page of filtered feed elements from a record feed. include only feed elements that have been updated since the time specified in the updatedsince parameter. specify the maximum number of feed elements in a bundle and whether to return feed elements posted by internal (non-experience cloud site) users only. 463apex reference guide chatterfeeds class getfeedelementsupdatedsince(communityid, feedtype, subjectid, recentcommentcount, elementsperbundle, density, pageparam, pagesize, updatedsince, showinternalonly, customfilter) get a page of filtered feed elements from a case feed. include only feed elements that have been updated since the time specified in the updatedsince parameter. getfeedwithfeedelements(communityid, feedtype, pagesize) get information about a feed and a page of feed elements from the feed. getfeedwithfeedelements(communityid, feedtype, pagesize, recentcommentcount) get a page of information about the feed and the feed elements with the specified number of comments per feed element from the feed. getfilterfeed(communityid, subjectid, keyprefix) get a feed filtered by a key prefix for a user. getfilterfeed(communityid, subjectid, keyprefix, sortparam) get a sorted feed filtered by a key prefix for a user. getfilterfeeddirectory(communityid, subjectid) get a feed directory of filter feeds available to the context user. getlike(communityid, likeid) get a like on a post or comment. getlikesforcomment(communityid, commentid) get likes for a comment. getlikesforcomment(communityid, commentid, pageparam, pagesize) get a page of likes for a comment. getlikesforfeedelement(communityid, feedelementid) get likes for a feed element. getlikesforfeedelement(communityid, feedelementid, pageparam, pagesize) get a page of likes for a feed element. getlinkmetadata(communityid, urls) get link metadata for urls. getpinnedfeedelementsfromfeed(communityid, feedtype, subjectid) get pinned feed elements from a group or topic feed. getreadbyforfeedelement(communityid, feedelementid) get information about who read a feed element and when. getreadbyforfeedelement(communityid, feedelementid, pageparam, pagesize) get a page of information about who read a feed element and when. getrelatedposts(communityid, feedelementid, filter, maxresults) get posts related to the context feed element. getstream(communityid, streamid) get information about a chatter feed stream. getstream(communityid, streamid, globalscope) get information about a chatter feed stream, regardless of experience cloud site. getstreams(communityid) get the chatter feed streams for the context user. 464apex reference guide chatterfeeds class getstreams(communityid, sortparam) get and sort the chatter feed streams for the context user. getstreams(communityid, pageparam, pagesize) get a page of chatter feed streams for the context user. getstreams(communityid, pageparam, pagesize, sortparam) get a sorted page of chatter feed streams for the context user. getstreams(communityid, pageparam, pagesize, sortparam, globalscope) get a sorted page of chatter feed streams from all enterprise cloud sites for the context user. getsupportedemojis() get supported emojis for the org. getthreadsforfeedcomment(communityid, commentid) get threaded comments for a comment. getthreadsforfeedcomment(communityid, commentid, pageparam, pagesize) get a page of threaded comments for a comment. getthreadsforfeedcomment(communityid, commentid, threadedcommentscollapsed) access the comments capability for a comment. gettopunansweredquestions(communityid) (pilot) get top unanswered questions for the context user in aexperience cloud site. gettopunansweredquestions(communityid, filter) (pilot) get filtered top unanswered questions for the context user in an experience cloud site. gettopunansweredquestions(communityid, pagesize) (pilot) get a page of top unanswered questions for the context user in an" "experience cloud site. gettopunansweredquestions(communityid, filter, pagesize) (pilot) get a page of filtered top unanswered questions for the context user in an experience cloud site. getvotesforcomment(communityid, commentid, vote) get the first page of users who upvoted or downvoted a comment. getvotesforcomment(communityid, commentid, vote, pageparam, pagesize) get a page of users who upvoted or downvoted a comment. getvotesforfeedelement(communityid, feedelementid, vote) get the first page of users who upvoted or downvoted a feed element. getvotesforfeedelement(communityid, feedelementid, vote, pageparam, pagesize) get a page of users who upvoted or downvoted a feed element. iscommenteditablebyme(communityid, commentid) discover whether the context user can edit a comment. isfeedelementeditablebyme(communityid, feedelementid) discover whether the context user can edit a feed element. ismodified(communityid, feedtype, subjectid, since) discover whether a news feed has been updated or changed. use this method to poll a news feed for updates. likecomment(communityid, commentid) like a comment for the context user. 465apex reference guide chatterfeeds class likefeedelement(communityid, feedelementid) like a feed element. postcommenttofeedelement(communityid, feedelementid, text) post a plain-text comment to a feed element. postcommenttofeedelement(communityid, feedelementid, comment, feedelementfileupload) post a rich-text comment to a feed element. use this method to include mentions and to attach a file. postfeedelement(communityid, subjectid, feedelementtype, text) post a plain-text feed element. postfeedelement(communityid, feedelement) post a rich-text feed element. include mentions and hashtag topics, attach already uploaded files to a feed element, and associate action link groups with a feed element. you can also use this method to share a feed element and add a comment. postfeedelementbatch(communityid, feedelements) post a list of feed elements. publishdraftfeedelement(communityid, feedelementid, feedelement) publish a draft feed element. searchfeedelements(communityid, q) get the first page of feed elements that match the search criteria. searchfeedelements(communityid, q, sortparam) get the first page of sorted feed elements that match the search criteria. searchfeedelements(communityid, q, threadedcommentscollapsed) get the feed elements and comments that match the search criteria. searchfeedelements(communityid, q, pageparam, pagesize) get a page of feed elements that match the search criteria. searchfeedelements(communityid, q, pageparam, pagesize, sortparam) get a page of sorted feed elements that match the search criteria. searchfeedelements(communityid, q, pageparam, pagesize, threadedcommentscollapsed) get a page of feed elements with comments in a threaded style that match the search criteria. searchfeedelements(communityid, q, recentcommentcount, pageparam, pagesize, sortparam) get a page of sorted feed elements that match the search criteria. each feed element includes no more than the specified number of comments. searchfeedelementsinfeed(communityid, feedtype, q) get the feed elements from the company, directmessagemoderation, home, moderation, and pendingreview feeds that match the search criteria. searchfeedelementsinfeed(communityid, feedtype, pageparam, pagesize, sortparam, q) get a page of sorted feed elements from the company, directmessagemoderation, home, moderation, and pendingreview feeds that match the search criteria. searchfeedelementsinfeed(communityid, feedtype, recentcommentcount, density, pageparam, pagesize, sortparam, q) get a page of sorted feed elements from the company, directmessagemoderation, home, moderation, and pendingreview feeds that match the search criteria. each feed element includes no more than the specified number of comments. 466apex reference guide chatterfeeds class searchfeedelementsinfeed(communityid, feedtype, recentcommentcount, density, pageparam, pagesize, sortparam, q, filter) get a page of sorted and filtered feed elements from the home" "feed that match the search criteria. each feed element includes no more than the specified number of comments. searchfeedelementsinfeed(communityid, feedtype, subjectid, q) search up to 5,000 of the most recent feed elements in a feed for a subject id that match the search string. feed elements are returned in order of most recent activity. searchfeedelementsinfeed(communityid, feedtype, subjectid, pageparam, pagesize, sortparam, q) get a page of sorted feed elements from a feed for a record or user that match the search criteria. searchfeedelementsinfeed(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, sortparam, q) get a page of sorted feed elements from a feed that match the search criteria. each feed element includes no more than the specified number of comments. searchfeedelementsinfeed(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, sortparam, q, filter) get a page of sorted and filtered feed elements from a userprofile feed that match the search criteria. searchfeedelementsinfeed(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, sortparam, q, customfilter) get a page of sorted and filtered feed elements from a case feed that match the search criteria. searchfeedelementsinfeed(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, sortparam, q, showinternalonly) get a page of sorted feed elements from a feed for a record or user that match the search criteria. each feed element includes no more than the specified number of comments. specify whether to return feed elements posted by internal (non-experience cloud site) users only. searchfeedelementsinfeed(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, sortparam, q, showinternalonly, filter) get a page of sorted and filtered feed elements from a feed for a record or user that match the search criteria. each feed element includes no more than the specified number of comments. specify whether to return feed elements posted by internal (non-experience cloud site) users only. searchfeedelementsinfeed(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, sortparam, q, showinternalonly, customfilter) get a page of sorted and filtered feed elements from a case feed that match the search criteria. searchfeedelementsinfilterfeed(communityid, subjectid, keyprefix, q) get the feed elements from a feed filtered by a key prefix that match the search criteria. searchfeedelementsinfilterfeed(communityid, subjectid, keyprefix, pageparam, pagesize, sortparam, q) get a page of sorted feed elements from a feed filtered by a key prefix that match the search criteria. searchfeedelementsinfilterfeed(communityid, subjectid, keyprefix, recentcommentcount, density, pageparam, pagesize, sortparam, q) get a page of sorted feed elements from a feed filtered by a key prefix that match the search criteria. each feed element includes no more than the specified number of comments. searchstreams(communityid, q) search the chatter feed streams for the context user. searchstreams(communityid, q, sortparam) search and sort the chatter feed streams for the context user. 467apex reference guide chatterfeeds class searchstreams(communityid, q, pageparam, pagesize) search the chatter feed streams for the context user and return a page of results. searchstreams(communityid, q, pageparam, pagesize, sortparam) search the chatter feed streams for the context user and return a sorted page of results. searchstreams(communityid, q, pageparam, pagesize, sortparam, globalscope) search the chatter feed streams from all experience cloud sites for the context user and return a sorted page of results. setcommentisverified(communityid, commentid, isverified) mark a comment as verified or unverified. setcommentisverifiedbyanonymized(communityid, commentid, isverified, isverifiedbyanonymized) mark a comment as verified by an anonymous user. setcommentvote(communityid, commentid, updownvote) upvote or downvote a comment. setfeedcommentstatus(communityid, commentid, status) set the status of a comment" ". setfeedelementisclosed(communityid, feedelementid, isclosed) set a feed element to closed. setfeedelementvote(communityid, feedelementid, updownvote) upvote or downvote a feed element. setfeedentitystatus(communityid, feedelementid, status) set the status of a feed post. setismutedbyme(communityid, feedelementid, ismutedbyme) mute or unmute a feed element. setisreadbyme(communityid, feedelementid, readby) mark a feed element as read for the context user using an input class. setisreadbyme(communityid, feedelementid, isreadbyme) mark a feed element as read for the context user. updatecomment(communityid, commentid, comment) edit a comment. updatedirectmessage(communityid, feedelementid, directmessage) update the members of a direct message. updatefeedelement(communityid, feedelementid, feedelement) edit a feed element. updatefeedelementbookmarks(communityid, feedelementid, bookmarks) bookmark a feed element or remove a bookmark from a feed element using an input class. updatefeedelementbookmarks(communityid, feedelementid, isbookmarkedbycurrentuser) bookmark a feed element or remove a bookmark from a feed element. updatefeedelementreadbycapabilitybatch(communityid, feedelementids, readby) mark multiple feed elements as read by the context user at the same time using an input class. updatefeedelementreadbycapabilitybatch(communityid, feedelementids, isreadbyme) mark multiple feed elements as read by the context user at the same time. 468apex reference guide chatterfeeds class updatelikeforcomment(communityid, commentid, islikedbycurrentuser) like or unlike a comment. updatelikeforfeedelement(communityid, feedelementid, islikedbycurrentuser) like or unlike a feed element. updatepinnedfeedelements(communityid, feedtype, subjectid, pin) pin or unpin feed elements to a group or topic feed. updatestream(communityid, streamid, streaminput) update a chatter feed stream. voteonfeedelementpoll(communityid, feedelementid, mychoiceid) vote on a poll or change your vote on a poll. createstream(communityid, streaminput) create a chatter feed stream. api version 39.0 requires chatter yes signature public static connectapi.chatterstream createstream(string communityid, connectapi.chatterstreaminput streaminput) parameters communityid type: string id for an experience cloud site, internal, or null. streaminput type: connectapi.chatterstreaminput a connectapi.chatterstreaminput body. return value type: connectapi.chatterstream deletecomment(communityid, commentid) delete a comment. 469apex reference guide chatterfeeds class api version 28.0 requires chatter yes signature public static void deletecomment(string communityid, string commentid) parameters communityid type: string id for an experience cloud site, internal, or null. commentid type: string id for a comment. return value type: void deletefeedelement(communityid, feedelementid) delete a feed element. api version 31.0 requires chatter yes signature public static deletefeedelement(string communityid, string feedelementid) parameters communityid type: string id for an experience cloud site, internal, or null. feedelementid type: string id of the feed element. 470apex reference guide chatterfeeds class return value type: void deletelike(communityid, likeid) delete a like on a comment or post. api version 28.0 requires chatter yes signature public static void deletelike(string communityid, string likeid) parameters communityid type: string id for an experience cloud site, internal, or null. likeid type: string id for a like. return value type: void deletestream(communityid, streamid) delete a chatter feed stream. api version 39.0 requires chatter yes signature public static void deletestream(string communityid, string streamid) 471apex reference guide chatterfeeds class parameters" "communityid type: string id for an experience cloud site, internal, or null. streamid type: string id of the chatter feed stream. return value type: void getcomment(communityid, commentid) get a comment. api version 28.0 available to guest users 31.0 requires chatter yes signature public static connectapi.comment getcomment(string communityid, string commentid) parameters communityid type: string id for an experience cloud site, internal, or null. commentid type: string id for a comment. return value type: connectapi.comment getcommentbatch(communityid, commentids) get a list of comments. 472apex reference guide chatterfeeds class api version 42.0 requires chatter yes signature public static connectapi.batchresult[] getcommentbatch(string communityid, list commentids) parameters communityid type: string id for an experience cloud site, internal, or null. commentids type: list a list of up to 100 comment ids. return value type: connectapi.batchresult[] the connectapi.batchresult.getresult() method returns a connectapi.comment object and errors for comments that didn’t load. getcommentincontext(communityid, commentid, pagesize) get a threaded comment in the context of its parent comments and post. api version 44.0 available to guest users 44.0 requires chatter yes signature public static connectapi.feedelement getcommentincontext(string communityid, string commentid, integer pagesize) 473apex reference guide chatterfeeds class parameters communityid type: string id for an experience cloud site, internal, or null. commentid type: string id of the comment. pagesize type: integer specifies the number of items per page. valid values are from 1 through 100. if you don’t specify a value, the default size is 25. return value type: connectapi.feedelement if the comment doesn’t support the comments capability, the return value is connectapi.notfoundexception. getcommentsforfeedelement(communityid, feedelementid) get comments for a feed element. api version 32.0 available to guest users 32.0 requires chatter yes signature public static connectapi.commentpage getcommentsforfeedelement(string communityid, string feedelementid) parameters communityid type: string id for an experience cloud site, internal, or null. feedelementid type: string id of the feed element. 474apex reference guide chatterfeeds class return value type: connectapi.commentpage if the feed element doesn’t support the comments capability, the return value is connectapi.notfoundexception. getcommentsforfeedelement(communityid, feedelementid, threadedcommentscollapsed) get comments in a threaded style for a feed element. api version 44.0 available to guest users 44.0 requires chatter yes signature public static connectapi.commentpage getcommentsforfeedelement(string communityid, string feedelementid, boolean threadedcommentscollapsed) parameters communityid type: string id for an experience cloud site, internal, or null. feedelementid type: string id of the feed element. threadedcommentscollapsed type: boolean specifies whether to return threaded comments in a collapsed style (true) or not (false). if you pass in null, the default is false. return value type: connectapi.commentpage if the feed element doesn’t support the comments capability, the return value is connectapi.notfoundexception. getcommentsforfeedelement(communityid, feedelementid, pageparam, pagesize) get a page of comments for a feed element. 475apex reference guide chatterfeeds class api version 32.0 available to guest users 32.0 requires chatter yes signature public static connectapi.commentpage getcommentsforfeedelement(string communityid, string feedelementid, string pageparam, integer pagesize) parameters communityid type: string id for an experience cloud site, internal, or null. feedelementid type: string id of the feed element. page" "param type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of comments per page. valid values are from 1 through 100. if you pass null, the default size is 25. return value type: connectapi.commentpage if the feed element doesn’t support the comments capability, the return value is connectapi.notfoundexception. getcommentsforfeedelement(communityid, feedelementid, pageparam, pagesize, threadedcommentscollapsed) get a page of comments in a threaded style for a feed element. api version 44.0 476apex reference guide chatterfeeds class available to guest users 44.0 requires chatter yes signature public static connectapi.commentpage getcommentsforfeedelement(string communityid, string feedelementid, string pageparam, integer pagesize, boolean threadedcommentscollapsed) parameters communityid type: string id for an experience cloud site, internal, or null. feedelementid type: string id of the feed element. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of comments per page. valid values are from 1 through 100. if you pass null, the default size is 25. threadedcommentscollapsed type: boolean specifies whether to return threaded comments in a collapsed style (true) or not (false). if you pass in null, the default is false. return value type: connectapi.commentpage if the feed element doesn’t support the comments capability, the return value is connectapi.notfoundexception. getcommentsforfeedelement(communityid, feedelementid, threadedcommentscollapsed, sortparam) get sorted comments in a threaded style for a feed element. api version 44.0 477apex reference guide chatterfeeds class available to guest users 44.0 requires chatter yes signature public static connectapi.commentscapability getcommentsforfeedelement(string communityid, string feedelementid, boolean threadedcommentscollapsed, connectapi.feedcommentsortorder sortparam) parameters communityid type: string id for an experience cloud site, internal, or null. feedelementid type: string id of the feed element. threadedcommentscollapsed type: boolean specifies whether to return threaded comments in a collapsed style (true) or not (false). if you pass in null, the default is false. sortparam type: connectapi.feedcommentsortorder order of comments. values are: • createddatelatestasc—sorts by most recently created comments in ascending order. • createddateoldestasc—sorts by oldest comments in ascending order. • relevance—sorts by most relevant content. sorting in descending order isn’t supported. return value type: connectapi.commentpage if the feed element doesn’t support the comments capability, the return value is connectapi.notfoundexception. getcommentsforfeedelement(communityid, feedelementid, pageparam, pagesize, threadedcommentscollapsed, sortparam) get a page of sorted comments in a threaded style for a feed element. 478apex reference guide chatterfeeds class api version 44.0 available to guest users 44.0 requires chatter yes signature public static connectapi.commentpage getcommentsforfeedelement(string communityid, string feedelementid, string pageparam, integer pagesize, boolean threadedcommentscollapsed, connectapi.feedcommentsortorder sortparam) parameters communityid type: string id for an experience cloud site, internal, or null. feedelementid type: string id of the feed element. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of comments per page. valid values are from 1 through 100. if you pass null, the default size is 25" ". threadedcommentscollapsed type: boolean specifies whether to return threaded comments in a collapsed style (true) or not (false). if you pass in null, the default is false. sortparam type: connectapi.feedcommentsortorder order of comments. values are: • createddatelatestasc—sorts by most recently created comments in ascending order. • createddateoldestasc—sorts by oldest comments in ascending order. • relevance—sorts by most relevant content. sorting in descending order isn’t supported. 479apex reference guide chatterfeeds class return value type: connectapi.commentpage if the feed element doesn’t support the comments capability, the return value is connectapi.notfoundexception. getcommentsforfeedelement(communityid, feedelementid, sortparam) get sorted comments for a feed element. api version 41.0 available to guest users 41.0 requires chatter yes signature public static connectapi.commentscapability getcommentsforfeedelement(string communityid, string feedelementid, connectapi.feedcommentsortorder sortparam) parameters communityid type: string id for an experience cloud site, internal, or null. feedelementid type: string id of the feed element. sortparam type: connectapi.feedcommentsortorder order of comments. values are: • createddatelatestasc—sorts by most recently created comments in ascending order. • createddateoldestasc—sorts by oldest comments in ascending order. • relevance—sorts by most relevant content. sorting in descending order isn’t supported. return value type: connectapi.commentscapability if the feed element doesn’t support the comments capability, the return value is connectapi.notfoundexception. 480apex reference guide chatterfeeds class getcommentsforfeedelement(communityid, feedelementid, sortparam, threadedcommentscollapsed) get sorted comments in a threaded style for a feed element. api version 44.0 available to guest users 44.0 requires chatter yes signature public static connectapi.commentscapability getcommentsforfeedelement(string communityid, string feedelementid, connectapi.feedcommentsortorder sortparam, boolean threadedcommentscollapsed) parameters communityid type: string id for an experience cloud site, internal, or null. feedelementid type: string id of the feed element. sortparam type: connectapi.feedcommentsortorder order of comments. values are: • createddatelatestasc—sorts by most recently created comments in ascending order. • createddateoldestasc—sorts by oldest comments in ascending order. • relevance—sorts by most relevant content. sorting in descending order isn’t supported. threadedcommentscollapsed type: boolean specifies whether to return threaded comments in a collapsed style (true) or not (false). if you pass in null, the default is false. return value type: connectapi.commentscapability 481apex reference guide chatterfeeds class if the feed element doesn’t support the comments capability, the return value is connectapi.notfoundexception. getextensions(communityid, pageparam, pagesize) get extensions. api version 40.0 available to guest users 40.0 requires chatter yes signature public static connectapi.extensiondefinitions getextensions(string communityid, string pageparam, integer pagesize) parameters communityid type: string id for an experience cloud site, internal, or null. pageparam type: string specifies the page token to use to view a page of information. page tokens are returned as part of the response class, such as currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 through 100. the default size is 15. return value type: connectapi.extensiondefinitions getfeed(communityid, feedtype) get a feed. api version 28.0 482" "apex reference guide chatterfeeds class available to guest users 32.0 requires chatter yes signature public static connectapi.feed getfeed(string communityid, connectapi.feedtype feedtype) parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype type of feed. valid values are company, directmessagemoderation, directmessages, home, moderation, and pendingreview. return value type: connectapi.feed getfeed(communityid, feedtype, sortparam) get a sorted feed. api version 28.0 available to guest users 32.0 requires chatter yes signature public static connectapi.feed getfeed(string communityid, connectapi.feedtype feedtype, connectapi.feedsortorder sortparam) 483apex reference guide chatterfeeds class parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype type of feed. valid values are company, directmessagemoderation, directmessages, home, moderation, and pendingreview. sortparam type: connectapi.feedsortorder values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. if you pass in null, the default value createddatedesc is used. if feedtype is directmessages, sortparam must be lastmodifieddatedesc. return value type: connectapi.feed getfeed(communityid, feedtype, subjectid) get a feed for a record or user. api version 28.0 available to guest users 32.0 requires chatter yes signature public static connectapi.feed getfeed(string communityid, connectapi.feedtype feedtype, string subjectid) 484apex reference guide chatterfeeds class parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype type of feed. valid values include every connectapi.feedtype except company, directmessagemoderation, directmessages, filter, home, landing, moderation, and pendingreview. subjectid type: string if feedtype is record, subjectid can be any record id, including a group id. if feedtype is streams, subjectid must be a stream id. if feedtype is topics, subjectid must be a topic id. if feedtype is userprofile, subjectid can be any user id. if the feedtype is any other value, subjectid must be the id of the context user or the alias me. return value type: connectapi.feed getfeed(communityid, feedtype, subjectid, sortparam) get a sorted feed for a record or user. api version 28.0 available to guest users 32.0 requires chatter yes signature public static connectapi.feed getfeed(string communityid, connectapi.feedtype feedtype, string subjectid, connectapi.feedsortorder sortparam) parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype 485apex reference guide chatterfeeds class type of feed. valid values include every connectapi.feedtype except company, directmessagemoderation, directmessages, filter, home, landing, moderation, and pendingreview. subjectid type: string if feedtype is record, subjectid can be any record id, including a group id. if feedtype is streams, subjectid must be a stream id. if feedtype is topics, subjectid must be a topic id. if feedtype is userprofile, subjectid can be any user id. if the feedtype is any other value, subjectid must be the id of the context user or the alias" "me. sortparam type: connectapi.feedsortorder values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. if you pass in null, the default value createddatedesc is used. return value type: connectapi.feed getfeeddirectory(string) get a list of all feeds available to the context user. api version 30.0 requires chatter yes signature public static connectapi.feeddirectory getfeeddirectory(string communityid) parameters communityid type: string id for an experience cloud site, internal, or null. 486apex reference guide chatterfeeds class return value type: connectapi.feeddirectory getfeedelement(communityid, feedelementid) get a feed element. api version 31.0 available to guest users 31.0 requires chatter yes signature public static connectapi.feedelement getfeedelement(string communityid, string feedelementid) parameters communityid type: string id for an experience cloud site, internal, or null. feedelementid type: string id of the feed element. return value type: connectapi.feedelement getfeedelement(communityid, feedelementid, commentsort) get a feed element with sorted comments. api version 41.0 available to guest users 41.0 487apex reference guide chatterfeeds class requires chatter yes signature public static connectapi.feedelement getfeedelement(string communityid, string feedelementid, connectapi.feedcommentsortorder commentsort) parameters communityid type: string id for an experience cloud site, internal, or null. feedelementid type: string id of the feed element. commentsort type: connectapi.feedcommentsortorder order of comments. • createddatelatestasc—sorts by most recently created comments in ascending order. • createddateoldestasc—sorts by oldest comments in ascending order. • relevance—sorts by most relevant content. the default value is createddatelatestasc. sorting in descending order isn’t supported. return value type: connectapi.feedelement getfeedelement(communityid, feedelementid, threadedcommentscollapsed) get a feed element and its comments in a threaded style. api version 44.0 available to guest users 44.0 requires chatter yes 488apex reference guide chatterfeeds class signature public static connectapi.feedelement getfeedelement(string communityid, string feedelementid, boolean threadedcommentscollapsed) parameters communityid type: string id for an experience cloud site, internal, or null. feedelementid type: string id of the feed element. threadedcommentscollapsed type: boolean specifies whether to return threaded comments in a collapsed style (true) or not (false). if you pass in null, the default is false. return value type: connectapi.feedelement getfeedelement(communityid, feedelementid, threadedcommentscollapsed, commentsort) get a feed element and its sorted comments in a threaded style. api version 44.0 available to guest users 44.0 requires chatter yes signature public static connectapi.feedelement getfeedelement(string communityid, string feedelementid, boolean threadedcommentscollapsed, connectapi.feedcommentsortorder commentsort) parameters communityid type: string 489apex reference guide chatterfeeds class id for an experience cloud site, internal, or null. feedelementid type: string id of the feed element. threadedcommentscollapsed type: boolean specifies whether to return threaded comments in a collapsed style (true) or not (false). if you pass in null, the default is false. commentsort type: connectapi.feedcommentsortorder order of comments. •" "createddatelatestasc—sorts by most recently created comments in ascending order. • createddateoldestasc—sorts by oldest comments in ascending order. • relevance—sorts by most relevant content. sorting in descending order isn’t supported. return value type: connectapi.feedelement getfeedelement(communityid, feedelementid, recentcommentcount, elementsperbundle) get a feed element with the specified number of elements per bundle including no more than the specified number of comments per feed element. api version 31.0 available to guest users 31.0 requires chatter yes signature public static connectapi.feedelement getfeedelement(string communityid, string feedelementid, integer recentcommentcount, integer elementsperbundle) parameters communityid type: string 490apex reference guide chatterfeeds class id for an experience cloud site, internal, or null. feedelementid type: string id of the feed element. recentcommentcount type: integer maximum number of comments to return with each feed element. the default value is 3. elementsperbundle type: integer maximum number of feed elements per bundle. the default and maximum value is 10. return value type: connectapi.feedelement getfeedelement(communityid, feedelementid, recentcommentcount, elementsperbundle, threadedcommentscollapsed) get a feed element with its comments in a threaded style with the specified number of elements per bundle and comments per feed element. api version 44.0 available to guest users 44.0 requires chatter yes signature public static connectapi.feedelement getfeedelement(string communityid, string feedelementid, integer recentcommentcount, integer elementsperbundle, boolean threadedcommentscollapsed) parameters communityid type: string id for an experience cloud site, internal, or null. feedelementid type: string id of the feed element. 491apex reference guide chatterfeeds class recentcommentcount type: integer maximum number of comments to return with each feed element. the default value is 3. elementsperbundle type: integer maximum number of feed elements per bundle. the default and maximum value is 10. threadedcommentscollapsed type: boolean specifies whether to return threaded comments in a collapsed style (true) or not (false). if you pass in null, the default is false. return value type: connectapi.feedelement getfeedelement(communityid, feedelementid, recentcommentcount, elementsperbundle, threadedcommentscollapsed, commentsort) get a feed element with its sorted comments in a threaded style with the specified number of elements per bundle and comments per feed element. api version 44.0 available to guest users 44.0 requires chatter yes signature public static connectapi.feedelement getfeedelement(string communityid, string feedelementid, integer recentcommentcount, integer elementsperbundle, boolean threadedcommentscollapsed, connectapi.feedcommentsortorder commentsort) parameters communityid type: string id for an experience cloud site, internal, or null. feedelementid type: string id of the feed element. 492apex reference guide chatterfeeds class recentcommentcount type: integer maximum number of comments to return with each feed element. the default value is 3. elementsperbundle type: integer maximum number of feed elements per bundle. the default and maximum value is 10. threadedcommentscollapsed type: boolean specifies whether to return threaded comments in a collapsed style (true) or not (false). if you pass in null, the default is false. commentsort type: connectapi.feedcommentsortorder order of comments. • createddatelatestasc—sorts by most recently created comments in ascending order. • createddateoldestasc—sorts by oldest comments in ascending order. • relevance—sorts by most relevant content. sorting in descending order isn’t supported. return value type: connectapi.feedelement getfeedelement(communityid, feedelementid, recentcommentcount, elementsperbundle, commentsort) get a feed element with the specified number of elements per bundle including no more than the specified number of sorted comments per feed element. api version 41.0 available to guest users 41.0 requires chatter yes signature" "public static connectapi.feedelement getfeedelement(string communityid, string feedelementid, integer recentcommentcount, integer elementsperbundle, connectapi.feedcommentsortorder commentsort) 493apex reference guide chatterfeeds class parameters communityid type: string id for an experience cloud site, internal, or null. feedelementid type: string id of the feed element. recentcommentcount type: integer maximum number of comments to return with each feed element. the default value is 3. elementsperbundle type: integer maximum number of feed elements per bundle. the default and maximum value is 10. commentsort type: connectapi.feedcommentsortorder order of comments. • createddatelatestasc—sorts by most recently created comments in ascending order. • createddateoldestasc—sorts by oldest comments in ascending order. • relevance—sorts by most relevant content. the default value is createddatelatestasc. sorting in descending order isn’t supported. return value type: connectapi.feedelement getfeedelementbatch(communityid, feedelementids) get a list of feed elements. api version 31.0 available to guest users 32.0 requires chatter yes 494apex reference guide chatterfeeds class signature public static connectapi.batchresult[] getfeedelementbatch(string communityid, list feedelementids) parameters communityid type: string id for an experience cloud site, internal, or null. feedelementids type: list a list of up to 500 feed element ids. return value type: connectapi.batchresult[] the connectapi.batchresult.getresult() method returns a connectapi.feedelement object and errors for feed elements that didn’t load. getfeedelementpoll(communityid, feedelementid) get the poll associated with a feed element. api version 32.0 available to guest users 32.0 requires chatter yes signature public static connectapi.pollcapability getfeedelementpoll(string communityid, string feedelementid) parameters communityid type: string id for an experience cloud site, internal, or null. feedelementid type: string id of the feed element. 495apex reference guide chatterfeeds class return value type: connectapi.pollcapability if the feed element doesn’t support this capability, the return value is connectapi.notfoundexception. note: triggers on feeditem objects run before their attachment and capabilities information is saved, which means that connectapi.feeditem.attachment information and connectapi.feedelement.capabilities information may not be available in the trigger. getfeedelementsfrombundle(communityid, feedelementid) get feed elements from a bundle. api version 31.0 requires chatter yes signature public static connectapi.feedelementpage getfeedelementsfrombundle(string communityid, string feedelementid) parameters communityid type: string id for an experience cloud site, internal, or null. feedelementid type: string id of the feed element. return value type: connectapi.feedelementpage getfeedelementsfrombundle(communityid, feedelementid, pageparam, pagesize, elementsperbundle, recentcommentcount) get a page of feed elements from a bundle. specify the number of elements per bundle and include no more than the specified number of comments per feed element. api version 31.0 496apex reference guide chatterfeeds class requires chatter yes signature public static connectapi.feedelementpage getfeedelementsfrombundle(string communityid, string feedelementid, string pageparam, integer pagesize, integer elementsperbundle, integer recentcommentcount) parameters communityid type: string id for an experience cloud site, internal, or null. feedelementid type: string id of the feed element. pageparam type: string specifies the page token to use to view a page of information. page tokens are returned as part of the response class, such as currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of feed elements per page. valid values are from 1" "through 100. if you pass in null, the default size is 25. elementsperbundle type: integer maximum number of feed elements per bundle. the default and maximum value is 10. recentcommentcount type: integer maximum number of comments to return with each feed element. the default value is 3. return value type: connectapi.feedelementpage getfeedelementsfromfeed(communityid, feedtype) get feed elements from the company, directmessagemoderation, directmessages, home, moderation, and pendingreview feeds. api version 31.0 497apex reference guide chatterfeeds class available to guest users 31.0 requires chatter yes signature public static connectapi.feedelementpage getfeedelementsfromfeed(string communityid, connectapi.feedtype feedtype) parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype type of feed. valid values are company, directmessagemoderation, directmessages, home, moderation, and pendingreview. return value type: connectapi.feedelementpage usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestgetfeedelementsfromfeed(communityid, feedtype, result) apex developer guide: testing connectapi code getfeedelementsfromfeed(communityid, feedtype, pageparam, pagesize, sortparam) get a page of sorted feed elements from the company, directmessagemoderation, directmessages, home, moderation, and pendingreview feeds. api version 31.0 available to guest users 31.0 498apex reference guide chatterfeeds class requires chatter yes signature public static connectapi.feedelementpage getfeedelementsfromfeed(string communityid, connectapi.feedtype feedtype, string pageparam, integer pagesize, connectapi.feedsortorder sortparam) parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype type of feed. valid values are company, directmessagemoderation, directmessages, home, moderation, and pendingreview. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of feed elements per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.feedsortorder values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. if you pass in null, the default value createddatedesc is used. if feedtype is directmessages, sortparam must be lastmodifieddatedesc. return value type: connectapi.feedelementpage 499apex reference guide chatterfeeds class usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestgetfeedelementsfromfeed(communityid, feedtype, pageparam, pagesize, sortparam, result) apex developer guide: testing connectapi code getfeedelementsfromfeed(communityid, feedtype, recentcommentcount, density, pageparam, pagesize, sortparam) get a page of sorted feed elements from the company, directmessagemoderation, directmessages, home, moderation, and pendingreview feeds. each feed element contains no more than the specified number of comments. api version 31.0" "available to guest users 31.0 requires chatter yes signature public static connectapi.feedelementpage getfeedelementsfromfeed(string communityid, connectapi.feedtype feedtype, integer recentcommentcount, connectapi.feeddensity density, string pageparam, integer pagesize, connectapi.feedsortorder sortparam) parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype type of feed. valid values are company, directmessagemoderation, directmessages, home, moderation, and pendingreview. recentcommentcount type: integer maximum number of comments to return with each feed item. the default value is 3. density type: connectapi.feeddensity 500apex reference guide chatterfeeds class specify the amount of content in a feed. • allupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations. • fewerupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations, but hides some system-generated updates from records. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of feed elements per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.feedsortorder values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. if you pass in null, the default value createddatedesc is used. if feedtype is directmessages, sortparam must be lastmodifieddatedesc. return value type: connectapi.feedelementpage usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestgetfeedelementsfromfeed(communityid, feedtype, recentcommentcount, density, pageparam, pagesize, sortparam, result) apex developer guide: testing connectapi code getfeedelementsfromfeed(communityid, feedtype, recentcommentcount, density, pageparam, pagesize, sortparam, filter) get a page of sorted and filtered feed elements from the home feed. each feed element contains no more than the specified number of comments. 501apex reference guide chatterfeeds class api version 32.0 available to guest users 32.0 requires chatter yes signature public static connectapi.feedelementpage getfeedelementsfromfeed(string communityid, connectapi.feedtype feedtype, integer recentcommentcount, connectapi.feeddensity density, string pageparam, integer pagesize, connectapi.feedsortorder sortparam, connectapi.feedfilter filter) parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype the type of feed. the only valid value is home. recentcommentcount type: integer maximum number of comments to return with each feed item. the default value is 3. density type: connectapi.feeddensity specify the amount of content in a feed. • allupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations. • fewerupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations, but hides some system-generated updates from records. pageparam type: string page token to use to view the page. page tokens are returned as" "part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. when the sortparam is mostviewed, you must pass in null for the pageparam. pagesize type: integer specifies the number of feed elements per page. valid values are from 1 through 100. if you pass in null, the default size is 25. 502apex reference guide chatterfeeds class when the sortparam is mostviewed, the pagesize must be a value from 1 to 25. sortparam type: connectapi.feedsortorder values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. if you pass in null, the default value createddatedesc is used. filter type: connectapi.feedfilter specifies the feed filters. • allquestions—feed elements that are questions. • authoredby—feed elements authored by the user profile owner. this value is valid only for the userprofile feed. • communityscoped—feed elements that are scoped to experience cloud sites. currently, these feed elements have a user or a group parent record. however, other parent record types could be scoped to sites in the future. feed elements that are always visible in all sites are filtered out. this value is valid only for the userprofile feed. • questionswithcandidateanswers—feed elements that are questions that have candidate answers associated with them.this value is valid only for users with the access einstein-generated answers permission. • questionswithcandidateanswersreviewedpublished—feed elements that are questions that have candidate answers that have been reviewed or published. this value is valid only for users with the access einstein-generated answers permission. • read—feed elements that are older than 30 days or are marked as read for the context user. includes existing feed elements when the context user joined the group. this value is valid only for the record feed of a group. • solvedquestions—feed elements that are questions and that have a best answer. • unansweredquestions—feed elements that are questions and that don’t have any answers. • unansweredquestionswithcandidateanswers—feed elements that are questions that don’t have answers but have candidate answers associated with them. this value is valid only for users with the access einstein-generated answers permission. • unread—feed elements that are created in the past 30 days and aren’t marked as read for the context user. this value is valid only for the record feed of a group. • unsolvedquestions—feed elements that are questions and that don’t have a best answer. return value type: connectapi.feedelementpage 503apex reference guide chatterfeeds class usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestgetfeedelementsfromfeed(communityid, feedtype, recentcommentcount, density, pageparam, pagesize, sortparam, filter, result) apex developer guide: testing connectapi code getfeedelementsfromfeed(communityid, feedtype, recentcommentcount, density, pageparam, pagesize, sortparam, filter, threadedcommentscollapsed) get a page of filtered and sorted feed elements with comments in a threaded style from the home feed. each feed element contains no more than the specified number of comments. api version 44.0 available to guest users 44.0 requires chatter yes signature public static connectapi.feedelementpage getfeedelementsfromfeed(string communityid, connectapi.feedtype feedtype, integer recentcommentcount, connectapi.feeddensity density, string pageparam, integer pagesize, connectapi.feedsortorder sortparam, connectapi.feedfilter filter, boolean threadedcommentscollapsed) parameters communityid type: string id for an experience cloud site, internal, or null. feed" "type type: connectapi.feedtype the type of feed. the only valid value is home. recentcommentcount type: integer maximum number of comments to return with each feed item. the default value is 3. 504apex reference guide chatterfeeds class density type: connectapi.feeddensity specify the amount of content in a feed. • allupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations. • fewerupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations, but hides some system-generated updates from records. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. when the sortparam is mostviewed, you must pass in null for the pageparam. pagesize type: integer specifies the number of feed elements per page. valid values are from 1 through 100. if you pass in null, the default size is 25. when the sortparam is mostviewed, the pagesize must be a value from 1 to 25. sortparam type: connectapi.feedsortorder values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. if you pass in null, the default value createddatedesc is used. filter type: connectapi.feedfilter specifies the feed filters. • allquestions—feed elements that are questions. • authoredby—feed elements authored by the user profile owner. this value is valid only for the userprofile feed. • communityscoped—feed elements that are scoped to experience cloud sites. currently, these feed elements have a user or a group parent record. however, other parent record types could be scoped to sites in the future. feed elements that are always visible in all sites are filtered out. this value is valid only for the userprofile feed. • questionswithcandidateanswers—feed elements that are questions that have candidate answers associated with them.this value is valid only for users with the access einstein-generated answers permission. • questionswithcandidateanswersreviewedpublished—feed elements that are questions that have candidate answers that have been reviewed or published. this value is valid only for users with the access einstein-generated answers permission. 505apex reference guide chatterfeeds class • read—feed elements that are older than 30 days or are marked as read for the context user. includes existing feed elements when the context user joined the group. this value is valid only for the record feed of a group. • solvedquestions—feed elements that are questions and that have a best answer. • unansweredquestions—feed elements that are questions and that don’t have any answers. • unansweredquestionswithcandidateanswers—feed elements that are questions that don’t have answers but have candidate answers associated with them. this value is valid only for users with the access einstein-generated answers permission. • unread—feed elements that are created in the past 30 days and aren’t marked as read for the context user. this value is valid only for the record feed of a group. • unsolvedquestions—feed elements that are questions and that don’t have a best answer. threadedcommentscollapsed type: boolean specifies whether to return threaded comments in a collapsed style (true) or not (false). if you pass in null, the default is false. return value type: connectapi.feedelementpage usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestgetfeedelementsfromfeed(communityid, feedtype, recentcommentcount, density, pageparam, pagesize, sortparam, filter, thread" "edcommentscollapsed, result) apex developer guide: testing connectapi code getfeedelementsfromfeed(communityid, feedtype, subjectid) get feed elements from any feed other than company, directmessagemoderation, directmessages, filter, home, landing, moderation, and pendingreview for a user or record. api version 31.0 available to guest users 31.0 requires chatter yes 506apex reference guide chatterfeeds class signature public static connectapi.feedelementpage getfeedelementsfromfeed(string communityid, connectapi.feedtype feedtype, string subjectid) parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype type of feed. valid values include every connectapi.feedtype except company, directmessagemoderation, directmessages, filter, home, landing, moderation, and pendingreview. subjectid type: string if feedtype is record, subjectid can be any record id, including a group id. if feedtype is streams, subjectid must be a stream id. if feedtype is topics, subjectid must be a topic id. if feedtype is userprofile, subjectid can be any user id. if the feedtype is any other value, subjectid must be the id of the context user or the alias me. return value type: connectapi.feedelementpage usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. example for getting the context user’s news feed connectapi.feedelementpage fep = connectapi.chatterfeeds.getfeedelementsfromfeed(network.getnetworkid(), connectapi.feedtype.news, 'me'); example for getting another user’s profile feed connectapi.feedelementpage fep = connectapi.chatterfeeds.getfeedelementsfromfeed(network.getnetworkid(), connectapi.feedtype.userprofile, '005r0000000hwma'); 507apex reference guide chatterfeeds class example for getting another user’s record feed connectapi.feedelementpage fep = connectapi.chatterfeeds.getfeedelementsfromfeed(network.getnetworkid(), connectapi.feedtype.record, '005r0000000hwma'); see also: settestgetfeedelementsfromfeed(communityid, feedtype, subjectid, result) apex developer guide: testing connectapi code getfeedelementsfromfeed(communityid, feedtype, subjectid, pageparam, pagesize, sortparam) get a page of sorted feed elements from any feed other than company, directmessagemoderation, directmessages, filter, home, landing, moderation, and pendingreview. api version 31.0 available to guest users 31.0 requires chatter yes signature public static connectapi.feedelementpage getfeedelementsfromfeed(string communityid, connectapi.feedtype feedtype, string subjectid, string pageparam, integer pagesize, connectapi.feedsortorder sortparam) parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype type of feed. valid values include every connectapi.feedtype except company, directmessagemoderation, directmessages, filter, home, landing, moderation, and pendingreview. subjectid type: string if feedtype is record, subjectid can be any record id, including a group id. if feedtype is streams, subjectid must be a stream id. if feedtype is topics, subjectid must be a topic id. if feedtype is userprofile, subjectid can be any user id. if the feedtype is any other value, subjectid must be the id of the context user or the alias me. 508apex reference guide chatterfeeds class pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer the number of feed elements per page. sortparam type: connectapi.feedsortorder" "values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. if you pass in null, the default value createddatedesc is used. return value type: connectapi.feedelementpage usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestgetfeedelementsfromfeed(communityid, feedtype, subjectid, pageparam, pagesize, sortparam, result) apex developer guide: testing connectapi code getfeedelementsfromfeed(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, sortparam) get a page of sorted feed elements from any feed other than company, directmessagemoderation, directmessages, filter, home, landing, moderation, and pendingreview. each feed element includes no more than the specified number of comments. api version 31.0 509apex reference guide chatterfeeds class available to guest users 31.0 requires chatter yes signature public static connectapi.feedelementpage getfeedelementsfromfeed(string communityid, connectapi.feedtype feedtype, string subjectid, integer recentcommentcount, connectapi.feeddensity density, string pageparam, integer pagesize, connectapi.feedsortorder sortparam) parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype type of feed. valid values include every connectapi.feedtype except company, directmessagemoderation, directmessages, filter, home, landing, moderation, and pendingreview. subjectid type: string if feedtype is record, subjectid can be any record id, including a group id. if feedtype is streams, subjectid must be a stream id. if feedtype is topics, subjectid must be a topic id. if feedtype is userprofile, subjectid can be any user id. if the feedtype is any other value, subjectid must be the id of the context user or the alias me. recentcommentcount type: integer maximum number of comments to return with each feed element. the default value is 3. density type: connectapi.feeddensity specify the amount of content in a feed. • allupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations. • fewerupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations, but hides some system-generated updates from records. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer 510apex reference guide chatterfeeds class specifies the number of feed elements per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.feedsortorder values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. if you pass in null, the default value createddatedesc is used. return value type: connectapi.feedelementpage usage" "to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestgetfeedelementsfromfeed(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, sortparam, result) apex developer guide: testing connectapi code getfeedelementsfromfeed(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, sortparam, showinternalonly) get a page of sorted feed elements from a record feed. each feed element includes no more than the specified number of comments. specify whether to return feed elements posted by internal (non-experience cloud site) users only. api version 31.0 available to guest users 31.0 requires chatter yes 511apex reference guide chatterfeeds class signature public static connectapi.feedelementpage getfeedelementsfromfeed(string communityid, connectapi.feedtype feedtype, string subjectid, integer recentcommentcount, connectapi.feeddensity density, string pageparam, integer pagesize, connectapi.feedsortorder sortparam, boolean showinternalonly) parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype value must be connectapi.feedtype.record. subjectid type: string any record id, including a group id. recentcommentcount type: integer maximum number of comments to return with each feed item. the default value is 3. density type: connectapi.feeddensity specify the amount of content in a feed. • allupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations. • fewerupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations, but hides some system-generated updates from records. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of feed elements per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.feedsortorder values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. 512apex reference guide chatterfeeds class • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. if you pass in null, the default value createddatedesc is used. showinternalonly type: boolean specifies whether to show only feed items from internal (non-experience cloud site) users (true), or not (false). the default value is false. return value type: connectapi.feedelementpage usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestgetfeedelementsfromfeed(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, sortparam, showinternalonly, result) apex developer guide: testing connectapi code getfeedelementsfromfeed(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, sortparam, filter) get a page of sorted and filtered feed elements from the userprofile feed. api version 35.0 available to guest users 35.0 requires chatter yes signature public static connectapi.feedelementpage getfeedelementsfromfeed(string communityid, connectapi.feedtype feedtype, string subjectid, integer recentcommentcount, connectapi.feeddensity density, string page" "param, integer pagesize, connectapi.feedsortorder sortparam, connectapi.feedfilter filter) 513apex reference guide chatterfeeds class parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype value must be connectapi.feedtype.userprofile. subjectid type: string id of any user. to specify the context user, use the user id or the alias me. recentcommentcount type: integer maximum number of comments to return with each feed element. the default value is 3. density type: connectapi.feeddensity specify the amount of content in a feed. • allupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations. • fewerupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations, but hides some system-generated updates from records. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of feed elements per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.feedsortorder values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. if you pass in null, the default value createddatedesc is used. filter type: connectapi.feedfilter 514apex reference guide chatterfeeds class value must be connectapi.feedfilter.communityscoped or connectapi.feedfilter.authoredby. return value type: connectapi.feedelementpage usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. example this example gets only community-specific feed elements. connectapi.feedelementpage fep = connectapi.chatterfeeds.getfeedelementsfromfeed(network.getnetworkid(), connectapi.feedtype.userprofile, 'me', 3, connectapi.feeddensity.fewerupdates, null, null, connectapi.feedsortorder.lastmodifieddatedesc, connectapi.feedfilter.communityscoped); see also: settestgetfeedelementsfromfeed(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, sortparam, filter, result) apex developer guide: testing connectapi code getfeedelementsfromfeed(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, sortparam, filter, threadedcommentscollapsed) get a page of feed elements with comments in a threaded style from the userprofile feed. api version 44.0 available to guest users 44.0 requires chatter yes signature public static connectapi.feedelementpage getfeedelementsfromfeed(string communityid, connectapi.feedtype feedtype, string subjectid, integer recentcommentcount, connectapi.feeddensity density, string pageparam, integer pagesize, connectapi.feedsortorder sortparam, connectapi.feedfilter filter, boolean threadedcommentscollapsed) 515apex reference guide chatterfeeds class parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype value must be connectapi.feedtype.userprofile. subjectid type: string id of any user. to specify the context user, use the user id or the alias me. recentcommentcount type: integer maximum number of" "comments to return with each feed element. the default value is 3. density type: connectapi.feeddensity specify the amount of content in a feed. • allupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations. • fewerupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations, but hides some system-generated updates from records. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of feed elements per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.feedsortorder values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. if you pass in null, the default value createddatedesc is used. filter type: connectapi.feedfilter 516apex reference guide chatterfeeds class value must be connectapi.feedfilter.communityscoped or connectapi.feedfilter.authoredby. threadedcommentscollapsed type: boolean specifies whether to return threaded comments in a collapsed style (true) or not (false). if you pass in null, the default is false. return value type: connectapi.feedelementpage usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestgetfeedelementsfromfeed(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, sortparam, filter, threadedcommentscollapsed, result) apex developer guide: testing connectapi code getfeedelementsfromfeed(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, sortparam, customfilter) get a page of sorted and filtered feed elements from the case feed. api version 40.0 available to guest users 40.0 requires chatter yes signature public static connectapi.feedelementpage getfeedelementsfromfeed(string communityid, connectapi.feedtype feedtype, string subjectid, integer recentcommentcount, connectapi.feeddensity density, string pageparam, integer pagesize, connectapi.feedsortorder sortparam, string customfilter) parameters communityid type: string 517apex reference guide chatterfeeds class id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype value must be connectapi.feedtype.record. subjectid type: string the id of a case. recentcommentcount type: integer maximum number of comments to return with each feed element. the default value is 3. density type: connectapi.feeddensity specify the amount of content in a feed. • allupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations. • fewerupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations, but hides some system-generated updates from records. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of feed elements per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.feedsortorder values" "are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. if you pass in null, the default value createddatedesc is used. customfilter type: string custom filter that applies only to the case feed. see customfeedfilter in the metadata api developer guide for supported values. 518apex reference guide chatterfeeds class return value type: connectapi.feedelementpage usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestgetfeedelementsfromfeed(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, sortparam, customfilter, result) apex developer guide: testing connectapi code getfeedelementsfromfeed(communityid, feedtype, subjectid, recentcommentcount, elementsperbundle, density, pageparam, pagesize, sortparam, showinternalonly) get a page of sorted feed elements from a record feed. specify the number of elements per bundle and include no more than the specified number of comments per feed element. specify whether to return feed elements posted by internal (non-experience cloud site) users only. api version 31.0 available to guest users 31.0 requires chatter yes signature public static connectapi.feedelementpage getfeedelementsfromfeed(string communityid, connectapi.feedtype feedtype, string subjectid, integer recentcommentcount, integer elementsperbundle, connectapi.feeddensity density, string pageparam, integer pagesize, connectapi.feedsortorder sortparam, boolean showinternalonly) parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype value must be connectapi.feedtype.record. 519apex reference guide chatterfeeds class subjectid type: string any record id, including a group id. recentcommentcount type: integer maximum number of comments to return with each feed item. the default value is 3. elementsperbundle type: integer maximum number of feed elements per bundle. the default and maximum value is 10. density type: connectapi.feeddensity specify the amount of content in a feed. • allupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations. • fewerupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations, but hides some system-generated updates from records. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of feed elements per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.feedsortorder values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. if you pass in null, the default value createddatedesc is used. showinternalonly type: boolean specifies whether to show only feed items from internal (non-experience cloud site) users (true), or" "not (false). the default value is false. 520apex reference guide chatterfeeds class return value type: connectapi.feedelementpage usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestgetfeedelementsfromfeed(communityid, feedtype, subjectid, recentcommentcount, elementsperbundle, density, pageparam, pagesize, sortparam, showinternalonly, result) apex developer guide: testing connectapi code getfeedelementsfromfeed(communityid, feedtype, subjectid, recentcommentcount, elementsperbundle, density, pageparam, pagesize, sortparam, showinternalonly, filter) get a page of sorted and filtered feed elements from a record feed. specify the number of elements per bundle and include no more than the specified number of comments per feed element. specify whether to return feed elements posted by internal (non-experience cloud site) users only. api version 32.0 available to guest users 32.0 requires chatter yes signature public static connectapi.feedelementpage getfeedelementsfromfeed(string communityid, connectapi.feedtype feedtype, string subjectid, integer recentcommentcount, integer elementsperbundle, connectapi.feeddensity density, string pageparam, integer pagesize, connectapi.feedsortorder sortparam, boolean showinternalonly, connectapi.feedfilter filter) parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype 521apex reference guide chatterfeeds class value must be connectapi.feedtype.record. subjectid type: string any record id, including a group id. recentcommentcount type: integer maximum number of comments to return with each feed item. the default value is 3. elementsperbundle type: integer maximum number of feed elements per bundle. the default and maximum value is 10. density type: connectapi.feeddensity specify the amount of content in a feed. • allupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations. • fewerupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations, but hides some system-generated updates from records. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of feed elements per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.feedsortorder values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. if you pass in null, the default value createddatedesc is used. showinternalonly type: boolean specifies whether to show only feed items from internal (non-experience cloud site) users (true), or not (false). the default value is false. filter type: connectapi.feedfilter 522apex reference guide chatterfeeds class specifies the feed filters. • allquestions—feed elements that are questions. • authoredby—feed elements authored by the user profile owner. this value is valid only for the userprofile feed. • communityscoped—feed elements that are scoped to experience cloud sites. currently, these feed elements have a user or a group parent record. however, other parent record types could be scoped to sites in the future. feed elements that are always visible in all sites are filtered out. this value is valid only for the userprofile feed." "• questionswithcandidateanswers—feed elements that are questions that have candidate answers associated with them.this value is valid only for users with the access einstein-generated answers permission. • questionswithcandidateanswersreviewedpublished—feed elements that are questions that have candidate answers that have been reviewed or published. this value is valid only for users with the access einstein-generated answers permission. • read—feed elements that are older than 30 days or are marked as read for the context user. includes existing feed elements when the context user joined the group. this value is valid only for the record feed of a group. • solvedquestions—feed elements that are questions and that have a best answer. • unansweredquestions—feed elements that are questions and that don’t have any answers. • unansweredquestionswithcandidateanswers—feed elements that are questions that don’t have answers but have candidate answers associated with them. this value is valid only for users with the access einstein-generated answers permission. • unread—feed elements that are created in the past 30 days and aren’t marked as read for the context user. this value is valid only for the record feed of a group. • unsolvedquestions—feed elements that are questions and that don’t have a best answer. return value type: connectapi.feedelementpage usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestgetfeedelementsfromfeed(communityid, feedtype, subjectid, recentcommentcount, elementsperbundle, density, pageparam, pagesize, sortparam, showinternalonly, filter, result) apex developer guide: testing connectapi code getfeedelementsfromfeed(communityid, feedtype, subjectid, recentcommentcount, elementsperbundle, density, pageparam, pagesize, sortparam, showinternalonly, filter, threadedcommentscollapsed) get a page of sorted and filtered feed elements with comments in a threaded style for a record feed. specify the number of elements per bundle and include no more than the specified number of comments per feed element. specify whether to return feed elements posted by internal (non-experience cloud site) users only. 523apex reference guide chatterfeeds class api version 44.0 available to guest users 44.0 requires chatter yes signature public static connectapi.feedelementpage getfeedelementsfromfeed(string communityid, connectapi.feedtype feedtype, string subjectid, integer recentcommentcount, integer elementsperbundle, connectapi.feeddensity density, string pageparam, integer pagesize, connectapi.feedsortorder sortparam, boolean showinternalonly, connectapi.feedfilter filter, boolean threadedcommentscollapsed) parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype value must be connectapi.feedtype.record. subjectid type: string any record id, including a group id. recentcommentcount type: integer maximum number of comments to return with each feed item. the default value is 3. elementsperbundle type: integer maximum number of feed elements per bundle. the default and maximum value is 10. density type: connectapi.feeddensity specify the amount of content in a feed. • allupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations. • fewerupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations, but hides some system-generated updates from records. pageparam type: string 524apex reference guide chatterfeeds class page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of feed elements per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.feedsortorder values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation" ", and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. if you pass in null, the default value createddatedesc is used. showinternalonly type: boolean specifies whether to show only feed items from internal (non-experience cloud site) users (true), or not (false). the default value is false. filter type: connectapi.feedfilter specifies the feed filters. • allquestions—feed elements that are questions. • authoredby—feed elements authored by the user profile owner. this value is valid only for the userprofile feed. • communityscoped—feed elements that are scoped to experience cloud sites. currently, these feed elements have a user or a group parent record. however, other parent record types could be scoped to sites in the future. feed elements that are always visible in all sites are filtered out. this value is valid only for the userprofile feed. • questionswithcandidateanswers—feed elements that are questions that have candidate answers associated with them.this value is valid only for users with the access einstein-generated answers permission. • questionswithcandidateanswersreviewedpublished—feed elements that are questions that have candidate answers that have been reviewed or published. this value is valid only for users with the access einstein-generated answers permission. • read—feed elements that are older than 30 days or are marked as read for the context user. includes existing feed elements when the context user joined the group. this value is valid only for the record feed of a group. • solvedquestions—feed elements that are questions and that have a best answer. • unansweredquestions—feed elements that are questions and that don’t have any answers. • unansweredquestionswithcandidateanswers—feed elements that are questions that don’t have answers but have candidate answers associated with them. this value is valid only for users with the access einstein-generated answers permission. • unread—feed elements that are created in the past 30 days and aren’t marked as read for the context user. this value is valid only for the record feed of a group. 525apex reference guide chatterfeeds class • unsolvedquestions—feed elements that are questions and that don’t have a best answer. threadedcommentscollapsed type: boolean specifies whether to return threaded comments in a collapsed style (true) or not (false). if you pass in null, the default is false. return value type: connectapi.feedelementpage usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestgetfeedelementsfromfeed(communityid, feedtype, subjectid, recentcommentcount, elementsperbundle, density, pageparam, pagesize, sortparam, showinternalonly, filter, threadedcommentscollapsed, result) apex developer guide: testing connectapi code getfeedelementsfromfeed(communityid, feedtype, subjectid, recentcommentcount, elementsperbundle, density, pageparam, pagesize, sortparam, showinternalonly, customfilter) get a page of sorted and filtered feed elements from a case feed. api version 40.0 available to guest users 40.0 requires chatter yes signature public static connectapi.feedelementpage getfeedelementsfromfeed(string communityid, connectapi.feedtype feedtype, string subjectid, integer recentcommentcount, integer elementsperbundle, connectapi.feeddensity density, string pageparam, integer pagesize, connectapi.feedsortorder sortparam, boolean showinternalonly, string customfilter) 526apex reference guide chatterfeeds class parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype value must be connectapi.feedtype.record. subjectid type: string the id of a case. recentcommentcount type: integer maximum number of comments to return with each feed item. the default value is 3" ". elementsperbundle type: integer maximum number of feed elements per bundle. the default and maximum value is 10. density type: connectapi.feeddensity specify the amount of content in a feed. • allupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations. • fewerupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations, but hides some system-generated updates from records. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of feed elements per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.feedsortorder values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. 527apex reference guide chatterfeeds class if you pass in null, the default value createddatedesc is used. showinternalonly type: boolean specifies whether to show only feed items from internal (non-experience cloud site) users (true), or not (false). the default value is false. customfilter type: string custom filter that applies only to the case feed. see customfeedfilter in the metadata api developer guide for supported values. return value type: connectapi.feedelementpage usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestgetfeedelementsfromfeed(communityid, feedtype, subjectid, recentcommentcount, elementsperbundle, density, pageparam, pagesize, sortparam, showinternalonly, customfilter, result) apex developer guide: testing connectapi code getfeedelementsfromfeed(communityid, feedtype, subjectid, recentcommentcount, elementsperbundle, density, pageparam, pagesize, sortparam, showinternalonly, customfilter, threadedcommentscollapsed) get a page of filtered and sorted feed elements with comments in a threaded style from a case feed. api version 44.0 available to guest users 44.0 requires chatter yes signature public static connectapi.feedelementpage getfeedelementsfromfeed(string communityid, connectapi.feedtype feedtype, string subjectid, integer recentcommentcount, integer elementsperbundle, connectapi.feeddensity density, string pageparam, integer pagesize, connectapi.feedsortorder sortparam, boolean showinternalonly, string customfilter, boolean threadedcommentscollapsed) 528apex reference guide chatterfeeds class parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype value must be connectapi.feedtype.record. subjectid type: string the id of a case. recentcommentcount type: integer maximum number of comments to return with each feed item. the default value is 3. elementsperbundle type: integer maximum number of feed elements per bundle. the default and maximum value is 10. density type: connectapi.feeddensity specify the amount of content in a feed. • allupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations. • fewerupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations, but hides some system-generated updates from records. pageparam type: string page token to use to view the page. page tokens are" "returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of feed elements per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.feedsortorder values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. 529apex reference guide chatterfeeds class if you pass in null, the default value createddatedesc is used. showinternalonly type: boolean specifies whether to show only feed items from internal (non-experience cloud site) users (true), or not (false). the default value is false. customfilter type: string custom filter that applies only to the case feed. see customfeedfilter in the metadata api developer guide for supported values. threadedcommentscollapsed type: boolean specifies whether to return threaded comments in a collapsed style (true) or not (false). if you pass in null, the default is false. return value type: connectapi.feedelementpage usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestgetfeedelementsfromfeed(communityid, feedtype, subjectid, recentcommentcount, elementsperbundle, density, pageparam, pagesize, sortparam, showinternalonly, customfilter, threadedcommentscollapsed, result) apex developer guide: testing connectapi code getfeedelementsfromfilterfeed(communityid, subjectid, keyprefix) get feed elements from a feed filtered by a key prefix for a user. api version 31.0 requires chatter yes signature public static connectapi.feedelementpage getfeedelementsfromfilterfeed(string communityid, string subjectid, string keyprefix) 530apex reference guide chatterfeeds class parameters communityid type: string id for an experience cloud site, internal, or null. subjectid type: string id of the context user or the alias me. keyprefix type: string a key prefix that specifies record type. a key prefix is the first three characters in the object id, which specifies the object type. for example, user objects have a prefix of 005 and group objects have a prefix of 0f9. return value type: connectapi.feedelementpage usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestgetfeedelementsfromfilterfeed(communityid, subjectid, keyprefix, result) apex developer guide: testing connectapi code getfeedelementsfromfilterfeed(communityid, subjectid, keyprefix, pageparam, pagesize, sortparam) get a page of sorted feed elements from a feed filtered by a key prefix for a user. api version 31.0 requires chatter yes signature public static connectapi.feedelementpage getfeedelementsfromfilterfeed(string communityid, string subjectid, string keyprefix, string pageparam, integer pagesize, connectapi.feedsortorder sortparam) 531apex reference guide chatterfeeds class parameters communityid type: string id for an experience cloud site, internal, or null. subjectid type: string id of the context user or the alias me. keyprefix type: string a key prefix that specifies record type. a key prefix is the first three characters in the object id, which specifies the object type. for example, user objects have a prefix of 005 and group objects have a prefix of 0f9. pageparam type: string page token to use to view the page. page tokens are returned as" "part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of feed elements per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.feedsortorder values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. if you pass in null, the default value createddatedesc is used. return value type: connectapi.feedelementpage usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestgetfeedelementsfromfilterfeed(communityid, subjectid, keyprefix, pageparam, pagesize, sortparam, result) apex developer guide: testing connectapi code 532" "apex reference guide chatterfeeds class getfeedelementsfromfilterfeed(communityid, subjectid, keyprefix, recentcommentcount, elementsperbundle, density, pageparam, pagesize, sortparam) get a page of sorted feed elements from a feed filtered by a key prefix for a user. each feed element contains no more than the specified number of comments. api version 31.0 requires chatter yes signature public static connectapi.feedelementpage getfeedelementsfromfilterfeed(string communityid, string subjectid, string keyprefix, integer recentcommentcount, integer elementsperbundle, connectapi.feeddensity density, string pageparam, integer pagesize, connectapi.feedsortorder sortparam) parameters communityid type: string id for an experience cloud site, internal, or null. subjectid type: string id of the context user or the alias me. keyprefix type: string a key prefix that specifies record type. a key prefix is the first three characters in the object id, which specifies the object type. for example, user objects have a prefix of 005 and group objects have a prefix of 0f9. recentcommentcount type: integer maximum number of comments to return with each feed element. the default value is 3. elementsperbundle type: integer maximum number of feed elements per bundle. the default and maximum value is 10. density type: connectapi.feeddensity specify the amount of content in a feed. • allupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations. 533apex reference guide chatterfeeds class • fewerupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations, but hides some system-generated updates from records. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of feed elements per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.feedsortorder values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. if you pass in null, the default value createddatedesc is used. return value type: connectapi.feedelementpage usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestgetfeedelementsfromfilterfeed(communityid, subjectid, keyprefix, recentcommentcount, elementsperbundle, density, pageparam, pagesize, sortparam, result) apex developer guide: testing connectapi code getfeedelementsfromfilterfeedupdatedsince(communityid, subjectid, keyprefix, recentcommentcount, elementsperbundle, density, pageparam, pagesize, updatedsince) get a page of feed elements from a feed filtered by a key prefix for a user. include only feed elements that have been updated since the time specified in the updatedsince parameter. api version 31.0 534apex reference guide chatterfeeds class requires chatter yes signature public static connectapi.feedelementpage getfeedelementsfromfilterfeedupdatedsince(string communityid, string subjectid, string keyprefix, integer recentcommentcount, integer elementsperbundle, connectapi.feeddensity density, string pageparam, integer pagesize, string updatedsince) parameters communityid type: string id for an experience cloud site, internal, or null. subjectid type: string id of the context user or the alias me." "keyprefix type: string a key prefix that specifies record type. a key prefix is the first three characters in the object id, which specifies the object type. for example, user objects have a prefix of 005 and group objects have a prefix of 0f9. recentcommentcount type: integer maximum number of comments to return with each feed element. the default value is 3. elementsperbundle type: integer maximum number of feed elements per bundle. the default and maximum value is 10. density type: connectapi.feeddensity specify the amount of content in a feed. • allupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations. • fewerupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations, but hides some system-generated updates from records. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of feed elements per page. valid values are from 1 through 100. if you pass in null, the default size is 25. 535apex reference guide chatterfeeds class updatedsince type: string opaque token defining the modification timestamp of the feed and the sort order. the updatedsince parameter doesn’t return feed elements that are created in the same second as the call. return value type: connectapi.feedelementpage usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestgetfeedelementsfromfilterfeedupdatedsince(communityid, subjectid, keyprefix, recentcommentcount, elementsperbundle, density, pageparam, pagesize, updatedsince, result) apex developer guide: testing connectapi code getfeedelementsupdatedsince(communityid, feedtype, recentcommentcount, density, pageparam, pagesize, updatedsince) get a page of feed elements from the company, directmessagemoderation, home, and moderation feeds. include only feed elements that have been updated since the time specified in the updatedsince parameter. each feed element contains no more than the specified number of comments. api version 31.0 available to guest users 31.0 requires chatter yes signature public static connectapi.feedelementpage getfeedelementsupdatedsince(string communityid, connectapi.feedtype feedtype, integer recentcommentcount, connectapi.feeddensity density, string pageparam, integer pagesize, string updatedsince) parameters communityid type: string 536apex reference guide chatterfeeds class id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype type of feed. valid values are company, directmessagemoderation, home, and moderation. recentcommentcount type: integer maximum number of comments to return with each feed element. the default value is 3. density type: connectapi.feeddensity specify the amount of content in a feed. • allupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations. • fewerupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations, but hides some system-generated updates from records. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of feed elements per page. valid values are from 1 through 100. if you pass in null, the default size is 25. updatedsince type: string an opaque token containing information about the last modified date of the feed. do not construct this token. retrieve this token from the updatestoken property of the connectapi.feedelementpage response body. the updatedsince parameter doesn’t return feed elements that are created in the same second as the call. return value type: connectapi.feedelementpage usage to test code that uses this method," "use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestgetfeedelementsupdatedsince(communityid, feedtype, recentcommentcount, density, pageparam, pagesize, updatedsince, result) apex developer guide: testing connectapi code 537apex reference guide chatterfeeds class getfeedelementsupdatedsince(communityid, feedtype, recentcommentcount, density, pageparam, pagesize, updatedsince, filter) get a page of filtered feed elements from the home feed. include only feed elements that have been updated since the time specified in the updatedsince parameter. each feed element contains no more than the specified number of comments. api version 32.0 available to guest users 32.0 requires chatter yes signature public static connectapi.feedelementpage getfeedelementsupdatedsince(string communityid, connectapi.feedtype feedtype, integer recentcommentcount, connectapi.feeddensity density, string pageparam, integer pagesize, string updatedsince, connectapi.feedfilter filter) parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype the type of feed. the only valid value is home. recentcommentcount type: integer maximum number of comments to return with each feed element. the default value is 3. density type: connectapi.feeddensity specify the amount of content in a feed. • allupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations. • fewerupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations, but hides some system-generated updates from records. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. 538apex reference guide chatterfeeds class pagesize type: integer specifies the number of feed elements per page. valid values are from 1 through 100. if you pass in null, the default size is 25. updatedsince type: string an opaque token containing information about the last modified date of the feed. do not construct this token. retrieve this token from the updatestoken property of the connectapi.feedelementpage response body. the updatedsince parameter doesn’t return feed elements that are created in the same second as the call. filter type: connectapi.feedfilter specifies the feed filters. • allquestions—feed elements that are questions. • authoredby—feed elements authored by the user profile owner. this value is valid only for the userprofile feed. • communityscoped—feed elements that are scoped to experience cloud sites. currently, these feed elements have a user or a group parent record. however, other parent record types could be scoped to sites in the future. feed elements that are always visible in all sites are filtered out. this value is valid only for the userprofile feed. • questionswithcandidateanswers—feed elements that are questions that have candidate answers associated with them.this value is valid only for users with the access einstein-generated answers permission. • questionswithcandidateanswersreviewedpublished—feed elements that are questions that have candidate answers that have been reviewed or published. this value is valid only for users with the access einstein-generated answers permission. • read—feed elements that are older than 30 days or are marked as read for the context user. includes existing feed elements when the context user joined the group. this value is valid only for the record feed of a group. • solvedquestions—feed elements that are questions and that have a best answer. • unansweredquestions—feed elements that are questions and that don’t have any answers. • unansweredquestionswithcandidateanswers—feed elements that are questions that don’t have answers but have candidate answers associated with them. this value is valid only for users with the access einstein-generated answers permission. • unread—feed elements that are created in the past 30 days and aren’t marked as read for the context user. this value is valid only for the record feed of a group. • unsolvedquestions—feed elements that are questions and that don’t have a best" "answer. return value type: connectapi.feedelementpage 539apex reference guide chatterfeeds class usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestgetfeedelementsupdatedsince(communityid, feedtype, recentcommentcount, density, pageparam, pagesize, updatedsince, filter, result) apex developer guide: testing connectapi code getfeedelementsupdatedsince(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, updatedsince) get a page of feed elements from the files, groups, news, people, and record feeds. include only feed elements that have been updated since the time specified in the updatedsince parameter. each feed element contains no more than the specified number of comments. api version 31.0 available to guest users 31.0 requires chatter yes signature public static connectapi.feedelementpage getfeedelementsupdatedsince(string communityid, connectapi.feedtype feedtype, string subjectid, integer recentcommentcount, connectapi.feeddensity density, string pageparam, integer pagesize, string updatedsince) parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype one of these values: • files • groups • news • people 540apex reference guide chatterfeeds class • record subjectid type: string if feedtype is connectapi.record, subjectid can be any record id, including a group id. otherwise, it must be the context user or the alias me. recentcommentcount type: integer maximum number of comments to return with each feed item. the default value is 3. density type: connectapi.feeddensity specify the amount of content in a feed. • allupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations. • fewerupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations, but hides some system-generated updates from records. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of feed elements per page. valid values are from 1 through 100. if you pass in null, the default size is 25. updatedsince type: string an opaque token containing information about the last modified date of the feed. do not construct this token. retrieve this token from the updatestoken property of the connectapi.feedelementpage response body. the updatedsince parameter doesn’t return feed elements that are created in the same second as the call. return value type: connectapi.feedelementpage usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestgetfeedelementsupdatedsince(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, updatedsince, result) apex developer guide: testing connectapi code 541apex reference guide chatterfeeds class getfeedelementsupdatedsince(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, updatedsince, showinternalonly) get a page of feed elements from a record feed. include only feed elements that have been updated since the time specified in the updatedsince parameter. specify whether to return feed elements posted by internal (non-experience cloud site) users only. api version 31.0 available to guest users 31.0 requires chatter yes signature public static connectapi.feedelementpage getfeedelementsupdatedsince(string communityid, connectapi.feedtype feedtype, string subjectid, integer recentcommentcount, connectapi.feeddensity density, string pageparam, integer pagesize, string updatedsince, boolean showinternalonly) parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type" ": connectapi.feedtype value must be connectapi.feedtype.record. subjectid type: string any record id, including a group id. recentcommentcount type: integer maximum number of comments to return with each feed element. the default value is 3. density type: connectapi.feeddensity specify the amount of content in a feed. • allupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations. 542apex reference guide chatterfeeds class • fewerupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations, but hides some system-generated updates from records. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of feed elements per page. valid values are from 1 through 100. if you pass in null, the default size is 25. updatedsince type: string an opaque token containing information about the last modified date of the feed. do not construct this token. retrieve this token from the updatestoken property of the connectapi.feedelementpage response body. the updatedsince parameter doesn’t return feed elements that are created in the same second as the call. showinternalonly type: boolean specifies whether to show only feed elements from internal (non-experience cloud site) users (true), or not (false). the default value is false. return value type: connectapi.feedelementpage usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestgetfeedelementsupdatedsince(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, updatedsince, showinternalonly, result) apex developer guide: testing connectapi code getfeedelementsupdatedsince(communityid, feedtype, subjectid, recentcommentcount, elementsperbundle, density, pageparam, pagesize, updatedsince, filter) get a page of filtered feed elements from a userprofile feed. include only feed elements that have been updated since the time specified in the updatedsince parameter. api version 35.0 543apex reference guide chatterfeeds class available to guest users 35.0 requires chatter yes signature public static connectapi.feedelementpage getfeedelementsupdatedsince(string communityid, connectapi.feedtype feedtype, string subjectid, integer recentcommentcount, integer elementsperbundle, connectapi.feeddensity density, string pageparam, integer pagesize, string updatedsince, connectapi.feedfilter filter) parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype value must be connectapi.feedtype.userprofile. subjectid type: string id of any user. to specify the context user, use the user id or the alias me. recentcommentcount type: integer maximum number of comments to return with each feed element. the default value is 3. elementsperbundle type: integer maximum number of feed elements per bundle. the default and maximum value is 10. density type: connectapi.feeddensity specify the amount of content in a feed. • allupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations. • fewerupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations, but hides some system-generated updates from records. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer 544apex reference guide chatterfeeds class specifies the number of feed elements per page. valid values are from 1 through 100. if you pass in null, the default size is 25. updatedsince type: string opaque token defining the modification" "timestamp of the feed and the sort order. the updatedsince parameter doesn’t return feed elements that are created in the same second as the call. filter type: connectapi.feedfilter value must be connectapi.feedfilter.communityscoped. filters the feed to include only feed elements that are scoped to experience cloud sites. feed elements that are always visible in all sites are filtered out. return value type: connectapi.feedelementpage usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestgetfeedelementsupdatedsince(communityid, feedtype, subjectid, recentcommentcount, elementsperbundle, density, pageparam, pagesize, updatedsince, filter, result) apex developer guide: testing connectapi code getfeedelementsupdatedsince(communityid, feedtype, subjectid, recentcommentcount, elementsperbundle, density, pageparam, pagesize, updatedsince, customfilter) get a page of filtered feed elements from a case feed. include only feed elements that have been updated since the time specified in the updatedsince parameter. api version 40.0 available to guest users 40.0 requires chatter yes signature public static connectapi.feedelementpage getfeedelementsupdatedsince(string communityid, connectapi.feedtype feedtype, string subjectid, integer recentcommentcount, integer 545apex reference guide chatterfeeds class elementsperbundle, connectapi.feeddensity density, string pageparam, integer pagesize, string updatedsince, string customfilter) parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype value must be connectapi.feedtype.record. subjectid type: string the id of a case. recentcommentcount type: integer maximum number of comments to return with each feed element. the default value is 3. elementsperbundle type: integer maximum number of feed elements per bundle. the default and maximum value is 10. density type: connectapi.feeddensity specify the amount of content in a feed. • allupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations. • fewerupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations, but hides some system-generated updates from records. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of feed elements per page. valid values are from 1 through 100. if you pass in null, the default size is 25. updatedsince type: string opaque token defining the modification timestamp of the feed and the sort order. the updatedsince parameter doesn’t return feed elements that are created in the same second as the call. customfilter type: string custom filter that applies only to the case feed. see customfeedfilter in the metadata api developer guide for supported values. 546apex reference guide chatterfeeds class return value type: connectapi.feedelementpage usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestgetfeedelementsupdatedsince(communityid, feedtype, subjectid, recentcommentcount, elementsperbundle, density, pageparam, pagesize, updatedsince, customfilter, result) apex developer guide: testing connectapi code getfeedelementsupdatedsince(communityid, feedtype, subjectid, recentcommentcount, elementsperbundle, density, pageparam, pagesize, updatedsince, showinternalonly) get a page of feed elements from a record feed. include only feed elements that have been updated since the time specified in the updatedsince parameter. specify the maximum number of feed elements in a bundle and whether to return feed elements posted by internal (non-experience cloud site) users only. api version 31.0 available to guest users 31.0 requires chatter" "yes signature public static connectapi.feedelementpage getfeedelementsupdatedsince(string communityid, connectapi.feedtype feedtype, string subjectid, integer recentcommentcount, integer elementsperbundle, connectapi.feeddensity density, string pageparam, integer pagesize, string updatedsince, boolean showinternalonly) parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype value must be connectapi.feedtype.record. 547apex reference guide chatterfeeds class subjectid type: string any record id, including a group id. recentcommentcount type: integer maximum number of comments to return with each feed element. the default value is 3. elementsperbundle type: integer maximum number of feed elements per bundle. the default and maximum value is 10. density type: connectapi.feeddensity specify the amount of content in a feed. • allupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations. • fewerupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations, but hides some system-generated updates from records. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of feed elements per page. valid values are from 1 through 100. if you pass in null, the default size is 25. updatedsince type: string an opaque token containing information about the last modified date of the feed. do not construct this token. retrieve this token from the updatestoken property of the connectapi.feedelementpage response body. the updatedsince parameter doesn’t return feed elements that are created in the same second as the call. showinternalonly type: boolean specifies whether to show only feed elements from internal (non-experience cloud site) users (true), or not (false). the default value is false. return value type: connectapi.feedelementpage 548apex reference guide chatterfeeds class usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestgetfeedelementsupdatedsince(communityid, feedtype, subjectid, recentcommentcount, elementsperbundle, density, pageparam, pagesize, updatedsince, showinternalonly, result) apex developer guide: testing connectapi code getfeedelementsupdatedsince(communityid, feedtype, subjectid, recentcommentcount, elementsperbundle, density, pageparam, pagesize, updatedsince, showinternalonly, filter) get a page of filtered feed elements from a record feed. include only feed elements that have been updated since the time specified in the updatedsince parameter. specify the maximum number of feed elements in a bundle and whether to return feed elements posted by internal (non-experience cloud site) users only. api version 32.0 available to guest users 32.0 requires chatter yes signature public static connectapi.feedelementpage getfeedelementsupdatedsince(string communityid, connectapi.feedtype feedtype, string subjectid, integer recentcommentcount, integer elementsperbundle, connectapi.feeddensity density, string pageparam, integer pagesize, string updatedsince, boolean showinternalonly, connectapi.feedfilter filter) parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype value must be connectapi.feedtype.record. subjectid type: string any record id, including a group id. 549apex reference guide chatterfeeds class recentcommentcount type: integer maximum number of comments to return with each feed element. the default value is 3. elementsperbundle type: integer maximum number of feed elements per bundle. the default and maximum value is 10. density type: connectapi.feeddensity specify the amount of content in a feed. • allupdates—displays all updates from people and records the user" "follows and groups the user is a member of. also displays custom recommendations. • fewerupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations, but hides some system-generated updates from records. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of feed elements per page. valid values are from 1 through 100. if you pass in null, the default size is 25. updatedsince type: string an opaque token containing information about the last modified date of the feed. do not construct this token. retrieve this token from the updatestoken property of the connectapi.feedelementpage response body. the updatedsince parameter doesn’t return feed elements that are created in the same second as the call. showinternalonly type: boolean specifies whether to show only feed elements from internal (non-experience cloud site) users (true), or not (false). the default value is false. filter type: connectapi.feedfilter specifies the feed filters. • allquestions—feed elements that are questions. • authoredby—feed elements authored by the user profile owner. this value is valid only for the userprofile feed. • communityscoped—feed elements that are scoped to experience cloud sites. currently, these feed elements have a user or a group parent record. however, other parent record types could be scoped to sites in the future. feed elements that are always visible in all sites are filtered out. this value is valid only for the userprofile feed. • questionswithcandidateanswers—feed elements that are questions that have candidate answers associated with them.this value is valid only for users with the access einstein-generated answers permission. 550apex reference guide chatterfeeds class • questionswithcandidateanswersreviewedpublished—feed elements that are questions that have candidate answers that have been reviewed or published. this value is valid only for users with the access einstein-generated answers permission. • read—feed elements that are older than 30 days or are marked as read for the context user. includes existing feed elements when the context user joined the group. this value is valid only for the record feed of a group. • solvedquestions—feed elements that are questions and that have a best answer. • unansweredquestions—feed elements that are questions and that don’t have any answers. • unansweredquestionswithcandidateanswers—feed elements that are questions that don’t have answers but have candidate answers associated with them. this value is valid only for users with the access einstein-generated answers permission. • unread—feed elements that are created in the past 30 days and aren’t marked as read for the context user. this value is valid only for the record feed of a group. • unsolvedquestions—feed elements that are questions and that don’t have a best answer. return value type: connectapi.feedelementpage usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestgetfeedelementsupdatedsince(communityid, feedtype, subjectid, recentcommentcount, elementsperbundle, density, pageparam, pagesize, updatedsince, showinternalonly, filter, result) apex developer guide: testing connectapi code getfeedelementsupdatedsince(communityid, feedtype, subjectid, recentcommentcount, elementsperbundle, density, pageparam, pagesize, updatedsince, showinternalonly, customfilter) get a page of filtered feed elements from a case feed. include only feed elements that have been updated since the time specified in the updatedsince parameter. api version 40.0 available to guest users 40.0 requires chatter yes 551apex reference guide chatterfeeds class signature public static connectapi.feedelementpage getfeedelementsupdatedsince(string communityid, connectapi.feedtype feedtype, string subjectid, integer recentcommentcount, integer elementsperbundle, connectapi.feeddensity density, string pageparam, integer pagesize, string updatedsince, boolean showinternalonly, string customfilter) parameters communityid type: string id for an experience cloud site" ", internal, or null. feedtype type: connectapi.feedtype value must be connectapi.feedtype.record. subjectid type: string the id of a case. recentcommentcount type: integer maximum number of comments to return with each feed element. the default value is 3. elementsperbundle type: integer maximum number of feed elements per bundle. the default and maximum value is 10. density type: connectapi.feeddensity specify the amount of content in a feed. • allupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations. • fewerupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations, but hides some system-generated updates from records. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of feed elements per page. valid values are from 1 through 100. if you pass in null, the default size is 25. updatedsince type: string an opaque token containing information about the last modified date of the feed. do not construct this token. retrieve this token from the updatestoken property of the connectapi.feedelementpage response body. the updatedsince parameter doesn’t return feed elements that are created in the same second as the call. 552apex reference guide chatterfeeds class showinternalonly type: boolean specifies whether to show only feed elements from internal (non-experience cloud site) users (true), or not (false). the default value is false. customfilter type: string custom filter that applies only to the case feed. see customfeedfilter in the metadata api developer guide for supported values. return value type: connectapi.feedelementpage usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestgetfeedelementsupdatedsince(communityid, feedtype, subjectid, recentcommentcount, elementsperbundle, density, pageparam, pagesize, updatedsince, showinternalonly, customfilter, result) apex developer guide: testing connectapi code getfeedwithfeedelements(communityid, feedtype, pagesize) get information about a feed and a page of feed elements from the feed. api version 40.0 available to guest users 40.0 requires chatter yes signature public static connectapi.feed getfeedwithfeedelements(string communityid, connectapi.feedtype feedtype, integer pagesize) parameters communityid type: string id for an experience cloud site, internal, or null. 553apex reference guide chatterfeeds class feedtype type: connectapi.feedtype the type of feed. valid values are company, directmessagemoderation, directmessages, home, landing, moderation, and pendingreview. landing is valid only when communityid is internal. pagesize type: integer specifies the number of feed elements per page. valid values are from 1 through 100. if you pass in 0, feed elements aren’t returned with the feed. return value type: connectapi.feed getfeedwithfeedelements(communityid, feedtype, pagesize, recentcommentcount) get a page of information about the feed and the feed elements with the specified number of comments per feed element from the feed. api version 40.0 available to guest users 40.0 requires chatter yes signature public static connectapi.feed getfeedwithfeedelements(string communityid, connectapi.feedtype feedtype, integer pagesize, integer recentcommentcount) parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype the type of feed. valid values are company, directmessagemoderation, directmessages, home, landing, moderation, and pendingreview. landing is valid only when communityid is internal. pagesize type: integer 554apex reference guide chatterfeeds class specifies the number of feed elements per page. valid values are" "from 1 through 100. if you pass in 0, feed elements aren’t returned with the feed. recentcommentcount type: integer maximum number of comments to return with each feed element. the default value is 3. return value type: connectapi.feed getfilterfeed(communityid, subjectid, keyprefix) get a feed filtered by a key prefix for a user. api version 28.0 requires chatter yes signature public static connectapi.feed getfilterfeed(string communityid, string subjectid, string keyprefix) parameters communityid type: string id for an experience cloud site, internal, or null. subjectid type: string id of the context user or the alias me. keyprefix type: string a key prefix is the first three characters of a record id, which specifies the object type. return value type: connectapi.feed getfilterfeed(communityid, subjectid, keyprefix, sortparam) get a sorted feed filtered by a key prefix for a user. 555apex reference guide chatterfeeds class api version 28.0 requires chatter yes signature public static connectapi.feed getfilterfeed(string communityid, string subjectid, string keyprefix, connectapi.feedtype sortparam) parameters communityid type: string id for an experience cloud site, internal, or null. subjectid type: string id of the context user or the alias me. keyprefix type: string a key prefix that specifies record type. a key prefix is the first three characters in the object id, which specifies the object type. for example, user objects have a prefix of 005 and group objects have a prefix of 0f9. sortparam type: connectapi.feedtype values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. if you pass in null, the default value createddatedesc is used. return value type: connectapi.feed getfilterfeeddirectory(communityid, subjectid) get a feed directory of filter feeds available to the context user. 556apex reference guide chatterfeeds class api version 30.0 requires chatter yes signature public static connectapi.feeddirectory getfilterfeeddirectory(string communityid, string subjectid) parameters communityid type: string id for an experience cloud site, internal, or null. subjectid type: string id of the context user or the alias me. return value type: connectapi.feeddirectory this feed directory contains a list of filter feeds, which are the news feed filtered to include feed items whose parent is a specific entity type. usage call this method to return a directory containing a list of connectapi.feeddirectoryitem objects. each object contains a key prefix associated with an entity type the context user is following. a key prefix is the first three characters of a record id, which specifies the object type. use key prefixes to filter the news feed so that it contains only feed items whose parent is the entity type associated with the key prefix. for example, get all the feed items whose parent is an account. to get the feed items, pass a key prefix to the connectapi.getfeeditemsfromfilterfeed method. the information about filter feeds never contains the key prefixes for users (005) or groups (0f9), but all users can use those key prefixes as filters. the connectapi.feeddirectory.favorites property is always empty when returned by a call to getfilterfeeddirectory because you can’t filter a news feed by favorites. example this example calls getfilterfeeddirectory and loops through the returned feeddirectoryitem objects to find the key prefixes the context user can use to filter their news feed. it then copies each keyprefix value to a list. finally, it passes one of 557apex reference guide chatterfeeds class the key prefixes from the list to the getfeeditemsfromfilterfeed" "method. the returned feed items include every feed item from the news feed whose parent is the entity type specified by the passed key prefix. string communityid = null; string subjectid = 'me'; // create a list to populate with key prefixes. list keyprefixlist = new list(); // prepopulate with user and group record types // which are available to all users. keyprefixlist.add('005'); keyprefixlist.add('0f9'); system.debug(keyprefixlist); // get the key prefixes available to the context user. connectapi.feeddirectory myfeeddirectory = connectapi.chatterfeeds.getfilterfeeddirectory(null, 'me'); // loop through the returned feeds list. for (connectapi.feeddirectoryitem i : myfeeddirectory.feeds) { // grab each key prefix and add it to the list. keyprefixlist.add(i.keyprefix); } system.debug(keyprefixlist); // use a key prefix from the list to filter the feed items in the news feed. connectapi.feeditempage myfeeditempage = connectapi.chatterfeeds.getfeeditemsfromfilterfeed(communityid, subjectid, keyprefixlist[0]); system.debug(myfeeditempage); getlike(communityid, likeid) get a like on a post or comment. api version 28.0 available to guest users 32.0 requires chatter yes signature public static connectapi.chatterlike getlike(string communityid, string likeid) 558apex reference guide chatterfeeds class parameters communityid type: string id for an experience cloud site, internal, or null. likeid type: string id for a like. return value type: connectapi.chatterlike getlikesforcomment(communityid, commentid) get likes for a comment. api version 28.0 available to guest users 31.0 requires chatter yes signature public static connectapi.chatterlikepage getlikesforcomment(string communityid, string commentid) parameters communityid type: string id for an experience cloud site, internal, or null. commentid type: string id for a comment. return value type: connectapi.chatterlikepage 559apex reference guide chatterfeeds class getlikesforcomment(communityid, commentid, pageparam, pagesize) get a page of likes for a comment. api version 28.0 available to guest users 31.0 requires chatter yes signature public static connectapi.chatterlikepage getlikesforcomment(string communityid, string commentid, integer pageparam, integer pagesize) parameters communityid type: string id for an experience cloud site, internal, or null. commentid type: string id for a comment. pageparam type: integer number of the page you want returned. starts at 0. if you pass in null or 0, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. return value type: connectapi.chatterlikepage getlikesforfeedelement(communityid, feedelementid) get likes for a feed element. api version 32.0 560apex reference guide chatterfeeds class available to guest users 32.0 requires chatter yes signature public static connectapi.chatterlikepage getlikesforfeedelement(string communityid, string feedelementid) parameters communityid type: string id for an experience cloud site, internal, or null. feedelementid type: string id of the feed element. return value type: connectapi.chatterlikepage if the feed element doesn’t support the chatterlikes capability, the return value is connectapi.notfoundexception. getlikesforfeedelement(communityid, feedelementid, pageparam, pagesize) get a page of likes for a feed element. api version 32.0 available to guest users 32.0 requires chatter yes signature public static connectapi.chatterlikepage getlikesforfeedelement(string communityid, string feedelementid," "integer pageparam, integer pagesize) 561apex reference guide chatterfeeds class parameters communityid type: string id for an experience cloud site, internal, or null. feedelementid type: string id of the feed element. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. return value type: connectapi.chatterlikepage if the feed element doesn’t support the chatterlikes capability, the return value is connectapi.notfoundexception. getlinkmetadata(communityid, urls) get link metadata for urls. api version 42.0 available to guest users 42.0 requires chatter no signature public static connectapi.linkmetadatacollection getlinkmetadata(string communityid, string urls) parameters communityid type: string id for an experience cloud site, internal, or null. 562apex reference guide chatterfeeds class urls type: string comma-separated list of url-encoded urls. return value type: connectapi.linkmetadatacollection getpinnedfeedelementsfromfeed(communityid, feedtype, subjectid) get pinned feed elements from a group or topic feed. api version 41.0 available to guest users 41.0 requires chatter yes signature public static connectapi.pinnedfeedelements getpinnedfeedelementsfromfeed(string communityid, connectapi.feedtype feedtype, string subjectid) parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype the type of feed. valid values are record and topics. subjectid type: string if feedtype is record, subjectid must be a group id. if feedtype is topics, subjectid must be a topic id. return value type: connectapi.pinnedfeedelements if the feed doesn’t support this capability, the return value is connectapi.notfoundexception. 563apex reference guide chatterfeeds class usage in the ui, pinned feed elements don’t show all auxiliary information, such as comments, likes, interaction counts, or read by information. as a result, the connectapi.pinnedfeedelements output class doesn’t include all the information for these capabilities. getreadbyforfeedelement(communityid, feedelementid) get information about who read a feed element and when. api version 40.0 requires chatter yes signature public static connectapi.readbypage getreadbyforfeedelement(string communityid, string feedelementid) parameters communityid type: string id for an experience cloud site, internal, or null. feedelementid type: string id of the feed element. return value type: connectapi.readbypage if the feed element doesn’t support this capability, the return value is connectapi.notfoundexception. getreadbyforfeedelement(communityid, feedelementid, pageparam, pagesize) get a page of information about who read a feed element and when. api version 40.0 requires chatter yes 564apex reference guide chatterfeeds class signature public static connectapi.readbypage getreadbyforfeedelement(string communityid, string feedelementid, integer pageparam, integer pagesize) parameters communityid type: string id for an experience cloud site, internal, or null. feedelementid type: string id of the feed element. pageparam type: string specifies the page token to use to view a page of information. page tokens are returned as part of the response class, such as currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. return value type: connectapi.readbypage if the feed element doesn’t support this capability, the return value is connectapi.not" "foundexception. getrelatedposts(communityid, feedelementid, filter, maxresults) get posts related to the context feed element. api version 37.0 available to guest users 37.0 requires chatter yes signature public static connectapi.relatedfeedposts getrelatedposts(string communityid, string feedelementid, connectapi.relatedfeedposttype filter, integer maxresults) 565apex reference guide chatterfeeds class parameters communityid type: string id for an experience cloud site, internal, or null. feedelementid type: string id of the feed element. the feed element must be a question. filter type: connectapi.relatedfeedposttype specifies the type of related post. values are: • answered—related questions that have at least one answer. • bestanswer—related questions that have a best answer. • generic—all types of related questions, including answered, with a best answer, and unanswered. • unanswered—related questions that don’t have answers. generic is the default value. maxresults type: integer the maximum number of results to return. you can return up to 25 results; 5 is the default. return value type: connectapi.relatedfeedposts in version 37.0 and later, related feed posts are questions. each related feed post has a score indicating how closely it’s related to the context feed post. we return related feed posts sorted by score, with the highest score first. usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. getstream(communityid, streamid) get information about a chatter feed stream. api version 39.0 requires chatter yes 566apex reference guide chatterfeeds class signature public static connectapi.chatterstream getstream(string communityid, string streamid) parameters communityid type: string id for an experience cloud site, internal, or null. streamid type: string id of the chatter feed stream. return value type: connectapi.chatterstream getstream(communityid, streamid, globalscope) get information about a chatter feed stream, regardless of experience cloud site. api version 41.0 requires chatter yes signature public static connectapi.chatterstream getstream(string communityid, string streamid, boolean globalscope) parameters communityid type: string id for an experience cloud site, internal, or null. streamid type: string id of the chatter feed stream. globalscope type: boolean specifies whether to get streams from all the context user’s experience cloud sites, regardless of the communityid value. tip: if you know the communityid for the stream, we recommend setting globalscope to false. 567apex reference guide chatterfeeds class return value type: connectapi.chatterstream getstreams(communityid) get the chatter feed streams for the context user. api version 39.0 requires chatter yes signature public static connectapi.chatterstreampage getstreams(string communityid) parameters communityid type: string id for an experience cloud site, internal, or null. return value type: connectapi.chatterstreampage getstreams(communityid, sortparam) get and sort the chatter feed streams for the context user. api version 40.0 requires chatter yes signature public static connectapi.chatterstreampage getstreams(string communityid, connectapi.sortorder sortparam) parameters communityid type: string 568apex reference guide chatterfeeds class id for an experience cloud site, internal, or null. sortparam type: connectapi.sortorder specifies the sort order. values are: • ascending—items are in ascending alphabetical order (a-z). • descending—items are in descending alphabetical order (z-a). • mostrecentlyviewed—items are in descending chronological order by view. this sort order is valid only for chatter feed streams. if not specified, default value is ascending. return value type: connectapi.chatterstreampage getstreams(communityid, pageparam, pagesize) get a page of chatter feed streams for the context user" ". api version 39.0 requires chatter yes signature public static connectapi.chatterstreampage getstreams(string communityid, integer pageparam, integer pagesize) parameters communityid type: string id for an experience cloud site, internal, or null. pageparam type: integer number of the page you want returned. starts at 0. if you pass in null or 0, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 to 250. the default size is 25. return value type: connectapi.chatterstreampage 569apex reference guide chatterfeeds class getstreams(communityid, pageparam, pagesize, sortparam) get a sorted page of chatter feed streams for the context user. api version 40.0 requires chatter yes signature public static connectapi.chatterstreampage getstreams(string communityid, integer pageparam, integer pagesize, connectapi.sortorder sortparam) parameters communityid type: string id for an experience cloud site, internal, or null. pageparam type: integer number of the page you want returned. starts at 0. if you pass in null or 0, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 to 250. the default size is 25. sortparam type: connectapi.sortorder specifies the sort order. values are: • ascending—items are in ascending alphabetical order (a-z). • descending—items are in descending alphabetical order (z-a). • mostrecentlyviewed—items are in descending chronological order by view. this sort order is valid only for chatter feed streams. if not specified, default value is ascending. return value type: connectapi.chatterstreampage getstreams(communityid, pageparam, pagesize, sortparam, globalscope) get a sorted page of chatter feed streams from all enterprise cloud sites for the context user. 570apex reference guide chatterfeeds class api version 41.0 requires chatter yes signature public static connectapi.chatterstreampage getstreams(string communityid, integer pageparam, integer pagesize, connectapi.sortorder sortparam, boolean globalscope) parameters communityid type: string id for an experience cloud site, internal, or null. pageparam type: integer number of the page you want returned. starts at 0. if you pass in null or 0, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 to 250. the default size is 25. sortparam type: connectapi.sortorder specifies the sort order. values are: • ascending—items are in ascending alphabetical order (a-z). • descending—items are in descending alphabetical order (z-a). • mostrecentlyviewed—items are in descending chronological order by view. this sort order is valid only for chatter feed streams. if not specified, default value is ascending. globalscope type: boolean specifies whether to get streams from all the context user’s experience cloud sites, regardless of the communityid value. tip: if you know the communityid for the streams, we recommend setting globalscope to false. return value type: connectapi.chatterstreampage getsupportedemojis() get supported emojis for the org. 571apex reference guide chatterfeeds class api version 39.0 requires chatter yes signature public static connectapi.supportedemojis getsupportedemojis() return value type: connectapi.supportedemojis usage to get the list, emojis must be enabled in your org. getthreadsforfeedcomment(communityid, commentid) get threaded comments for a comment. api version 44.0 available to guest users 44.0 requires chatter yes signature public static connectapi.commentpage getthreadsforfeedcomment(string communityid, string commentid) parameters communityid type: string id for an experience cloud site, internal, or null. commentid type: string id of the comment. 572apex reference guide chatterfeeds class return value type: connect" "api.commentpage if the comment doesn’t support the comments capability, the return value is connectapi.notfoundexception. getthreadsforfeedcomment(communityid, commentid, pageparam, pagesize) get a page of threaded comments for a comment. api version 44.0 available to guest users 44.0 requires chatter yes signature public static connectapi.commentpage getthreadsforfeedcomment(string communityid, string commentid, string pageparam, integer pagesize) parameters communityid type: string id for an experience cloud site, internal, or null. commentid type: string id of the comment. pageparam type: string specifies the page token to use to view a page of information. page tokens are returned as part of the response class, such as currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. return value type: connectapi.commentpage if the comment doesn’t support the comments capability, the return value is connectapi.notfoundexception. 573apex reference guide chatterfeeds class getthreadsforfeedcomment(communityid, commentid, threadedcommentscollapsed) access the comments capability for a comment. api version 44.0 available to guest users 44.0 requires chatter yes signature public static connectapi.commentscapability getthreadsforfeedcomment(string communityid, string commentid, boolean threadedcommentscollapsed) parameters communityid type: string id for an experience cloud site, internal, or null. commentid type: string id of the comment. threadedcommentscollapsed type: boolean specifies whether to return threaded comments in a collapsed style (true) or not (false). if you pass in null, the default is false. return value type: connectapi.commentscapability if the comment doesn’t support the comments capability, the return value is connectapi.notfoundexception. gettopunansweredquestions(communityid) (pilot) get top unanswered questions for the context user in aexperience cloud site. note: we provided top-five unanswered questions to selected customers through a pilot program that required agreement to specific terms and conditions. this pilot program is closed and not accepting new participants. api version 42.0 574apex reference guide chatterfeeds class requires chatter yes signature public static connectapi.feedelementpage gettopunansweredquestions(string communityid) parameters communityid type: string id of the experience cloud site. return value type: connectapi.feedelementpage usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestgettopunansweredquestions(communityid, result) (pilot) apex developer guide: testing connectapi code gettopunansweredquestions(communityid, filter) (pilot) get filtered top unanswered questions for the context user in an experience cloud site. note: we provided top-five unanswered questions to selected customers through a pilot program that required agreement to specific terms and conditions. this pilot program is closed and not accepting new participants. api version 42.0 requires chatter yes signature public static connectapi.feedelementpage gettopunansweredquestions(string communityid, connectapi.topunansweredquestionsfiltertype filter) 575apex reference guide chatterfeeds class parameters communityid type: string id of the experience cloud site. filter type: connectapi.feedfilter specifies the filter for the feed. unansweredquestionswithcandidateanswers is the only valid value. return value type: connectapi.feedelementpage usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestgettopunansweredquestions(communityid, filter, result) (pilot) apex developer guide: testing connectapi code gettopunansweredquestions(communityid, pagesize) (pilot) get a page of top unanswered questions for the context user in an experience cloud site." "note: we provided top-five unanswered questions to selected customers through a pilot program that required agreement to specific terms and conditions. this pilot program is closed and not accepting new participants. api version 42.0 requires chatter yes signature public static connectapi.feedelementpage gettopunansweredquestions(string communityid, integer pagesize) parameters communityid type: string id of the experience cloud site. pagesize type: integer 576apex reference guide chatterfeeds class specifies the number of items per page. valid values are from 0 through 10. if you pass in null, the default size is 5. return value type: connectapi.feedelementpage usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestgettopunansweredquestions(communityid, pagesize, result) (pilot) apex developer guide: testing connectapi code gettopunansweredquestions(communityid, filter, pagesize) (pilot) get a page of filtered top unanswered questions for the context user in an experience cloud site. note: we provided top-five unanswered questions to selected customers through a pilot program that required agreement to specific terms and conditions. this pilot program is closed and not accepting new participants. api version 42.0 requires chatter yes signature public static connectapi.feedelementpage gettopunansweredquestions(string communityid, connectapi.feedfilter filter, integer pagesize) parameters communityid type: string id of the experience cloud site. filter type: connectapi.feedfilter specifies the filter for the feed. unansweredquestionswithcandidateanswers is the only valid value. pagesize type: integer specifies the number of items per page. valid values are from 0 through 10. if you pass in null, the default size is 5. 577apex reference guide chatterfeeds class return value type: connectapi.feedelementpage usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestgettopunansweredquestions(communityid, filter, pagesize, result) (pilot) apex developer guide: testing connectapi code getvotesforcomment(communityid, commentid, vote) get the first page of users who upvoted or downvoted a comment. api version 42.0 available to guest users 42.0 requires chatter yes signature public static connectapi.votepage getvotesforcomment(string communityid, string commentid, connectapi.updownvotevalue vote) parameters communityid type: string id for an experience cloud site, internal, or null. commentid type: string id of the comment. vote type: connectapi.updownvotevalue specifies the value of the vote for the feed element. values are: • down • up 578apex reference guide chatterfeeds class you can’t specify none. return value type: connectapi.votepage if the comment doesn’t support this capability, the return value is connectapi.notfoundexception. getvotesforcomment(communityid, commentid, vote, pageparam, pagesize) get a page of users who upvoted or downvoted a comment. api version 42.0 available to guest users 42.0 requires chatter yes signature public static connectapi.votepage getvotesforcomment(string communityid, string commentid, connectapi.updownvotevalue vote, integer pageparam, integer pagesize) parameters communityid type: string id for an experience cloud site, internal, or null. commentid type: string id of the comment. vote type: connectapi.updownvotevalue specifies the value of the vote for the feed element. values are: • down • up you can’t specify none. pageparam type: integer number of the page you want returned. starts at 0. if you pass in null or 0, the first page is returned. 579apex reference guide chatterfeeds class pagesize type: integer specifies the number of items per page. valid values are from" "1 through 100. if you pass in null, the default size is 25. return value type: connectapi.votepage if the comment doesn’t support this capability, the return value is connectapi.notfoundexception. getvotesforfeedelement(communityid, feedelementid, vote) get the first page of users who upvoted or downvoted a feed element. api version 42.0 available to guest users 42.0 requires chatter yes signature public static connectapi.votepage getvotesforfeedelement(string communityid, string feedelementid, connectapi.updownvotevalue vote) parameters communityid type: string id for an experience cloud site, internal, or null. feedelementid type: string id of the feed element. vote type: connectapi.updownvotevalue specifies the value of the vote for the feed element. values are: • down • up you can’t specify none. 580apex reference guide chatterfeeds class return value type: connectapi.votepage if the feed element doesn’t support this capability, the return value is connectapi.notfoundexception. getvotesforfeedelement(communityid, feedelementid, vote, pageparam, pagesize) get a page of users who upvoted or downvoted a feed element. api version 42.0 available to guest users 42.0 requires chatter yes signature public static connectapi.votepage getvotesforfeedelement(string communityid, string feedelementid, connectapi.updownvotevalue vote, integer pageparam, integer pagesize) parameters communityid type: string id for an experience cloud site, internal, or null. feedelementid type: string id of the feed element. vote type: connectapi.updownvotevalue specifies the value of the vote for the feed element. values are: • down • up you can’t specify none. pageparam type: integer number of the page you want returned. starts at 0. if you pass in null or 0, the first page is returned. pagesize type: integer specifies the number of feed elements per page. valid values are from 1 through 100. if you pass in null, the default size is 25. 581apex reference guide chatterfeeds class return value type: connectapi.votepage if the feed element doesn’t support this capability, the return value is connectapi.notfoundexception. iscommenteditablebyme(communityid, commentid) discover whether the context user can edit a comment. api version 34.0 requires chatter yes signature public static connectapi.feedentityiseditable iscommenteditablebyme(string communityid, string commentid) parameters communityid type: string id for an experience cloud site, internal, or null. commentid type: string id of the comment. return value type: connectapi.feedentityiseditable if the comment doesn’t support the edit capability, the return value is connectapi.notfoundexception. see also: edit a comment isfeedelementeditablebyme(communityid, feedelementid) discover whether the context user can edit a feed element. api version 34.0 582" "apex reference guide chatterfeeds class requires chatter yes signature public static connectapi.feedentityiseditable isfeedelementeditablebyme(string communityid, string feedelementid) parameters communityid type: string id for an experience cloud site, internal, or null. feedelementid type: string id of the feed element. feed items are the only type of feed element that can be edited. return value type: connectapi.feedentityiseditable if the feed element doesn’t support the edit capability, the return value is connectapi.notfoundexception. see also: edit a feed element edit a question title and post ismodified(communityid, feedtype, subjectid, since) discover whether a news feed has been updated or changed. use this method to poll a news feed for updates. important: this feature is available through a feed polling pilot program. this pilot program is closed and not accepting new participants. api version 28.0 requires chatter yes signature public static connectapi.feedmodifiedinfo ismodified(string communityid, connectapi.feedtype feedtype, string subjectid, string since) 583apex reference guide chatterfeeds class parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype specifies the type of feed. the only supported type is news subjectid type: string id of the context user or the alias me. since type: string an opaque token containing information about the last modified date of the feed. retrieve this token from the feedelementpage.ismodifiedtoken property. return value type: connectapi.feedmodifiedinfo likecomment(communityid, commentid) like a comment for the context user. api version 28.0 requires chatter yes signature public static connectapi.chatterlike likecomment(string communityid, string commentid) parameters communityid type: string id for an experience cloud site, internal, or null. commentid type: string id for a comment. 584apex reference guide chatterfeeds class return value type: connectapi.chatterlike if the context user has already liked the comment, this method is a non-operation and returns the existing like. likefeedelement(communityid, feedelementid) like a feed element. api version 32.0 requires chatter yes signature public static connectapi.chatterlike likefeedelement(string communityid, string feedelementid) parameters communityid type: string id for an experience cloud site, internal, or null. feedelementid type: string id of the feed element. return value type: connectapi.chatterlike if the feed element doesn’t support the chatterlikes capability, the return value is connectapi.notfoundexception. example connectapi.chatterlike chatterlike = connectapi.chatterfeeds.likefeedelement(null, '0d5d0000000kugh'); postcommenttofeedelement(communityid, feedelementid, text) post a plain-text comment to a feed element. api version 32.0 585apex reference guide chatterfeeds class requires chatter yes signature public static connectapi.comment postcommenttofeedelement(string communityid, string feedelementid, string text) parameters communityid type: string id for an experience cloud site, internal, or null. feedelementid type: string id of the feed element. text type: string text of the comment. a comment can contain up to 10,000 characters. return value type: connectapi.comment if the feed element doesn’t support the comments capability, the return value is connectapi.notfoundexception. example connectapi.comment comment = connectapi.chatterfeeds.postcommenttofeedelement(null, '0d5d0000000kugh', 'i agree with the proposal.' ); postcommenttofeedelement(communityid, feedelementid, comment, feedelementfileupload) post a rich-text comment to a feed element. use this method to include mentions and to attach a file. api version 32.0 requires chatter yes 586apex reference guide chatterfeeds class signature public static connectapi.comment post" "commenttofeedelement(string communityid, string feedelementid, connectapi.commentinput comment, connectapi.binaryinput feedelementfileupload) parameters communityid type: string id for an experience cloud site, internal, or null. feedelementid type: string id of the feed element. comment type: connectapi.commentinput the comment body, including text and mentions, and capabilities, such as information about an attached file. a comment can contain up to 10,000 characters. feedelementfileupload type: connectapi.binaryinput a new binary file to attach to the comment, or null. if you specify a binary file, specify the title and description of the file in the comment parameter. return value type: connectapi.comment if the feed element doesn’t support the comments capability, the return value is connectapi.notfoundexception. example for posting a comment with mentions you can post comments with mentions two ways. use the connectapihelper repository on github to write a single line of code, or use this method example. string communityid = null; string feedelementid = '0d5d0000000ktw3'; connectapi.commentinput commentinput = new connectapi.commentinput(); connectapi.mentionsegmentinput mentionsegmentinput = new connectapi.mentionsegmentinput(); connectapi.messagebodyinput messagebodyinput = new connectapi.messagebodyinput(); connectapi.textsegmentinput textsegmentinput = new connectapi.textsegmentinput(); messagebodyinput.messagesegments = new list(); textsegmentinput.text = 'does anyone in this group have an idea? '; messagebodyinput.messagesegments.add(textsegmentinput); mentionsegmentinput.id = '005d00000000oot'; messagebodyinput.messagesegments.add(mentionsegmentinput); 587apex reference guide chatterfeeds class commentinput.body = messagebodyinput; connectapi.comment commentrep = connectapi.chatterfeeds.postcommenttofeedelement(communityid, feedelementid, commentinput, null); example for posting a comment with an existing file string feedelementid = '0d5d0000000ktw3'; connectapi.commentinput commentinput = new connectapi.commentinput(); connectapi.messagebodyinput messagebodyinput = new connectapi.messagebodyinput(); connectapi.textsegmentinput textsegmentinput = new connectapi.textsegmentinput(); textsegmentinput.text = 'i attached this file from salesforce files.'; messagebodyinput.messagesegments = new list(); messagebodyinput.messagesegments.add(textsegmentinput); commentinput.body = messagebodyinput; connectapi.commentcapabilitiesinput commentcapabilitiesinput = new connectapi.commentcapabilitiesinput(); connectapi.contentcapabilityinput contentcapabilityinput = new connectapi.contentcapabilityinput(); commentcapabilitiesinput.content = contentcapabilityinput; contentcapabilityinput.contentdocumentid = '069d00000001rnj'; commentinput.capabilities = commentcapabilitiesinput; connectapi.comment commentrep = connectapi.chatterfeeds.postcommenttofeedelement(network.getnetworkid(), feedelementid, commentinput, null); example for posting a comment with a new file string feedelementid = '0d5d0000000ktw3'; connectapi.commentinput commentinput = new connectapi.commentinput(); connectapi.messagebodyinput messagebodyinput = new connectapi.messagebodyinput(); connectapi.textsegmentinput textsegmentinput = new connectapi.textsegmentinput(); textsegmentinput.text = 'enjoy this new file.'; messagebodyinput.messagesegments = new list(); messagebodyinput.messagesegments.add(textsegmentinput); commentinput.body = messagebodyinput; connectapi.commentcapabilitiesinput commentcapabilitiesinput = new connectapi.commentcapabilitiesinput(); connectapi.contentcapabilityinput contentcapabilityinput = new 588apex reference guide chatterfeeds class connectapi.contentcapabilityinput(); commentcapabilities" "input.content = contentcapabilityinput; contentcapabilityinput.title = 'title'; commentinput.capabilities = commentcapabilitiesinput; string text = 'these are the contents of the new file.'; blob myblob = blob.valueof(text); connectapi.binaryinput bininput = new connectapi.binaryinput(myblob, 'text/plain', 'filename'); connectapi.comment commentrep = connectapi.chatterfeeds.postcommenttofeedelement(network.getnetworkid(), feedelementid, commentinput, bininput); example for posting a rich-text comment with an inline image you can post rich-text comments with inline images and mentions two ways. use the connectapihelper repository on github to write a single line of code, or use this method example. in this example, the image file is existing content that has already been uploaded to salesforce. string communityid = null; string feedelementid = '0d5r0000000sber'; string imageid = '069r00000000igq'; string mentioneduserid = '005r0000000dimz'; connectapi.commentinput input = new connectapi.commentinput(); connectapi.messagebodyinput messageinput = new connectapi.messagebodyinput(); connectapi.textsegmentinput textsegment; connectapi.mentionsegmentinput mentionsegment; connectapi.markupbeginsegmentinput markupbeginsegment; connectapi.markupendsegmentinput markupendsegment; connectapi.inlineimagesegmentinput inlineimagesegment; messageinput.messagesegments = new list(); markupbeginsegment = new connectapi.markupbeginsegmentinput(); markupbeginsegment.markuptype = connectapi.markuptype.bold; messageinput.messagesegments.add(markupbeginsegment); textsegment = new connectapi.textsegmentinput(); textsegment.text = 'hello '; messageinput.messagesegments.add(textsegment); mentionsegment = new connectapi.mentionsegmentinput(); mentionsegment.id = mentioneduserid; messageinput.messagesegments.add(mentionsegment); textsegment = new connectapi.textsegmentinput(); textsegment.text = '!'; messageinput.messagesegments.add(textsegment); 589apex reference guide chatterfeeds class markupendsegment = new connectapi.markupendsegmentinput(); markupendsegment.markuptype = connectapi.markuptype.bold; messageinput.messagesegments.add(markupendsegment); inlineimagesegment = new connectapi.inlineimagesegmentinput(); inlineimagesegment.alttext = 'image one'; inlineimagesegment.fileid = imageid; messageinput.messagesegments.add(inlineimagesegment); input.body = messageinput; connectapi.chatterfeeds.postcommenttofeedelement(communityid, feedelementid, input, null); example for posting a rich-text comment with a code block string communityid = null; string feedelementid = '0d5r0000000sber'; string codesnippet = '\n\t\n\t\thello, world!\n\t\n'; connectapi.commentinput input = new connectapi.commentinput(); connectapi.messagebodyinput messageinput = new connectapi.messagebodyinput(); connectapi.textsegmentinput textsegment; connectapi.markupbeginsegmentinput markupbeginsegment; connectapi.markupendsegmentinput markupendsegment; messageinput.messagesegments = new list(); markupbeginsegment = new connectapi.markupbeginsegmentinput(); markupbeginsegment.markuptype = connectapi.markuptype.code; messageinput.messagesegments.add(markupbeginsegment); textsegment = new connectapi.textsegmentinput(); textsegment.text = codesnippet; messageinput.messagesegments.add(textsegment); markupendsegment = new connecta" "pi.markupendsegmentinput(); markupendsegment.markuptype = connectapi.markuptype.code; messageinput.messagesegments.add(markupendsegment); input.body = messageinput; connectapi.chatterfeeds.postcommenttofeedelement(communityid, feedelementid, input, null); postfeedelement(communityid, subjectid, feedelementtype, text) post a plain-text feed element. api version 31.0 590apex reference guide chatterfeeds class requires chatter yes signature public static connectapi.feedelement postfeedelement(string communityid, string subjectid, connectapi.feedelementtype feedelementtype, string text) parameters communityid type: string id for an experience cloud site, internal, or null. subjectid type: string the id of the parent this feed element is being posted to. this value can be the id of a user, group, or record, or the string me to indicate the context user. feedelementtype type: connectapi.feedelementtype the only possible value is feeditem. text type: string the text of the feed element. a feed element can contain up to 10,000 characters. return value type: connectapi.feedelement example connectapi.feedelement feedelement = connectapi.chatterfeeds.postfeedelement(network.getnetworkid(), '0f9d0000000treh', connectapi.feedelementtype.feeditem, 'on vacation this week.'); postfeedelement(communityid, feedelement) post a rich-text feed element. include mentions and hashtag topics, attach already uploaded files to a feed element, and associate action link groups with a feed element. you can also use this method to share a feed element and add a comment. api version 36.0 requires chatter yes 591apex reference guide chatterfeeds class signature public static connectapi.feedelement postfeedelement(string communityid, connectapi.feedelementinput feedelement) parameters communityid type: string id for an experience cloud site, internal, or null. feedelement type: connectapi.feedelementinput specify rich text, including mentions. optionally, specify a link, a poll, or up to 10 existing files. return value type: connectapi.feedelement example for posting a feed element with a mention you can post feed elements with mentions two ways. use the connectapihelper repository on github to write a single line of code, or use this method example. connectapi.feediteminput feediteminput = new connectapi.feediteminput(); connectapi.mentionsegmentinput mentionsegmentinput = new connectapi.mentionsegmentinput(); connectapi.messagebodyinput messagebodyinput = new connectapi.messagebodyinput(); connectapi.textsegmentinput textsegmentinput = new connectapi.textsegmentinput(); messagebodyinput.messagesegments = new list(); mentionsegmentinput.id = '005rr000000dme9'; messagebodyinput.messagesegments.add(mentionsegmentinput); textsegmentinput.text = 'could you take a look?'; messagebodyinput.messagesegments.add(textsegmentinput); feediteminput.body = messagebodyinput; feediteminput.feedelementtype = connectapi.feedelementtype.feeditem; feediteminput.subjectid = '0f9rr0000004cpw'; connectapi.feedelement feedelement = connectapi.chatterfeeds.postfeedelement(network.getnetworkid(), feediteminput); example for posting a feed element with existing content // define the feediteminput object to pass to postfeedelement connectapi.feediteminput feediteminput = new connectapi.feediteminput(); feediteminput.subjectid = 'me'; connectapi.textsegmentinput textsegmentinput = new connectapi.textsegmentinput(); textsegmentinput.text = 'would you please review these docs?'; 592apex reference guide chatterfeeds class // the messagebodyinput object holds the text in the post connectapi.messagebodyinput messagebodyinput = new connectapi.messagebodyinput(); messagebodyinput.messagesegments = new list(); messagebodyinput.messagesegments.add(textsegmentinput); feediteminput.body = messagebodyinput; // the feedelementcapabilitiesinput object holds the capabilities of the feed item. // for this feed item, we define a files capability to hold the file(s). list fileids = new list(); fileids.add('069xx00000000qo'); fileids.add('069xx00000000qt'); fileids.add('069xx00000000qn'); fileids.add('069xx00000000qi'); fileids.add('069xx00000000qd'); connectapi.filescapabilityinput filesinput = new connectapi.filescapabilityinput(); filesinput.items = new list(); for (string fileid : fileids) { connectapi.fileidinput idinput = new connectapi.fileidinput(); idinput.id = fileid; filesinput.items.add(idinput); } connectapi.feedelementcapabilitiesinput feedelementcapabilitiesinput = new connectapi.feedelementcapabilitiesinput(); feedelementcapabilitiesinput.files = filesinput; feediteminput.capabilities = feedelementcapabilitiesinput; // post the feed item. connectapi.feedelement feedelement = connectapi.chatterfeeds.postfeedelement(network.getnetworkid(), feediteminput); example for posting a rich-text feed element with an inline image you can post rich-text feed elements with inline images and mentions two ways. use the connectapihelper repository on github to write a single line of code, or use this method example. in this example, the image file is existing content that has already been uploaded to salesforce. the post also includes text and a mention. string communityid = null; string imageid = '069d00000001ina'; string mentioneduserid = '005d0000001qnpr'; string targetuserorgrouporrecordid = '005d0000001gif0'; connectapi.feediteminput input = new connectapi.feediteminput(); input.subjectid = targetuserorgrouporrecordid; input.feedelementtype = connectapi.feedelementtype.feeditem; connectapi.messagebodyinput messageinput = new connectapi.messagebodyinput(); connectapi.textsegmentinput textsegment; connectapi.mentionsegmentinput mentionsegment; connectapi.markupbeginsegmentinput markupbeginsegment; connectapi.markupendsegmentinput markupendsegment; 593apex reference guide chatterfeeds class connectapi.inlineimagesegmentinput inlineimagesegment; messageinput.messagesegments = new list(); markupbeginsegment = new connectapi.markupbeginsegmentinput(); markupbeginsegment.markuptype = connectapi.markuptype.bold; messageinput.messagesegments.add(markupbeginsegment); textsegment = new connectapi.textsegmentinput(); textsegment.text = 'hello '; messageinput.messagesegments.add(textsegment); mentionsegment = new connectapi.mentionsegmentinput(); mentionsegment.id = mentioneduserid; messageinput.messagesegments.add(mentionsegment); textsegment = new connectapi.textsegmentinput(); textsegment.text = '!'; messageinput.messagesegments.add(textsegment); markupendsegment = new connectapi.markupendsegmentinput(); markupendsegment.markuptype = connectapi.markuptype.bold; messageinput.messagesegments.add(markupendsegment); inlineimagesegment = new connectapi.inlineimagesegmentinput(); inlineimagesegment.alttext = 'image one'; inlineimagesegment.fileid = imageid; messageinput.messagesegments.add(inlineimagesegment); input.body = messageinput; connectapi.chatterfeeds.postfeedelement(communityid, input); example for posting a rich-text feed element with a code block string communityid = null; string targetuserorgrouporrecordid = 'me'; string codesnippet = '" "\n\t\n\t\thello, world!\n\t\n'; connectapi.feediteminput input = new connectapi.feediteminput(); input.subjectid = targetuserorgrouporrecordid; input.feedelementtype = connectapi.feedelementtype.feeditem; connectapi.messagebodyinput messageinput = new connectapi.messagebodyinput(); connectapi.textsegmentinput textsegment; connectapi.markupbeginsegmentinput markupbeginsegment; connectapi.markupendsegmentinput markupendsegment; messageinput.messagesegments = new list(); markupbeginsegment = new connectapi.markupbeginsegmentinput(); markupbeginsegment.markuptype = connectapi.markuptype.code; messageinput.messagesegments.add(markupbeginsegment); textsegment = new connectapi.textsegmentinput(); 594apex reference guide chatterfeeds class textsegment.text = codesnippet; messageinput.messagesegments.add(textsegment); markupendsegment = new connectapi.markupendsegmentinput(); markupendsegment.markuptype = connectapi.markuptype.code; messageinput.messagesegments.add(markupendsegment); input.body = messageinput; connectapi.chatterfeeds.postfeedelement(communityid, input); example for sharing a feed element (in version 39.0 and later) // define the feediteminput object to pass to postfeedelement connectapi.feediteminput feediteminput = new connectapi.feediteminput(); feediteminput.subjectid = 'me'; connectapi.textsegmentinput textsegmentinput = new connectapi.textsegmentinput(); textsegmentinput.text = 'look at this post i'm sharing.'; // the messagebodyinput object holds the text in the post connectapi.messagebodyinput messagebodyinput = new connectapi.messagebodyinput(); messagebodyinput.messagesegments = new list(); messagebodyinput.messagesegments.add(textsegmentinput); feediteminput.body = messagebodyinput; connectapi.feedentitysharecapabilityinput shareinput = new connectapi.feedentitysharecapabilityinput(); shareinput.feedentityid = '0d5r0000000sebc'; connectapi.feedelementcapabilitiesinput feedelementcapabilitiesinput = new connectapi.feedelementcapabilitiesinput(); feedelementcapabilitiesinput.feedentityshare = shareinput; feediteminput.capabilities = feedelementcapabilitiesinput; // post the feed item. connectapi.feedelement feedelement = connectapi.chatterfeeds.postfeedelement(network.getnetworkid(), feediteminput); example for sending a direct message // define the feediteminput object to pass to postfeedelement connectapi.feediteminput feediteminput = new connectapi.feediteminput(); connectapi.textsegmentinput textsegmentinput = new connectapi.textsegmentinput(); textsegmentinput.text = 'thanks for attending my presentation test run this morning. send me any feedback.'; // the messagebodyinput object holds the text in the post connectapi.messagebodyinput messagebodyinput = new connectapi.messagebodyinput(); messagebodyinput.messagesegments = new list(); messagebodyinput.messagesegments.add(textsegmentinput); feediteminput.body = messagebodyinput; // the feedelementcapabilitiesinput object holds the capabilities of the feed item. // for this feed item, we define a direct message capability to hold the member(s) and the subject. 595apex reference guide chatterfeeds class list memberids = new list(); memberids.add('005b00000016ouq'); memberids.add('005b0000001rin6'); connectapi.directmessagecapabilityinput dminput = new connectapi.directmessagecapabilityinput(); dminput.subject = 'thank you!'; dminput.memberstoadd = memberids; connectapi.feedelementcapabilitiesinput feedelement" "capabilitiesinput = new connectapi.feedelementcapabilitiesinput(); feedelementcapabilitiesinput.directmessage = dminput; feediteminput.capabilities = feedelementcapabilitiesinput; // post the feed item. connectapi.feedelement feedelement = connectapi.chatterfeeds.postfeedelement(network.getnetworkid(), feediteminput); postfeedelementbatch(communityid, feedelements) post a list of feed elements. api version 32.0 requires chatter yes signature public static connectapi.batchresult[] postfeedelementbatch(string communityid, list feedelements) parameters communityid type: string id for an experience cloud site, internal, or null. feedelements type: list the list can contain up to 500 connectapi.batchinput objects. in the connectapi.batchinput constructor, the input object must be a concrete instance of the abstract connectapi.feedelementinput class. return value type: connectapi.batchresult[] 596apex reference guide chatterfeeds class the connectapi.batchresult.getresult() method returns a connectapi.feedelement object. the returned objects correspond to each of the input objects and are returned in the same order as the input objects. the method call fails only if an error occurs that affects the entire operation (such as a parsing failure). if an individual object causes an error, the error is embedded within the connectapi.batchresult list. usage use this method to post a list of feed elements efficiently. create a list containing up to 500 objects and insert them all for the cost of one dml statement. in version 36.0 and later, you can attach only one already uploaded file to each post. the connectapi.batchinput has three constructors, but the postfeedelementbatch method supports only connectapi.batchinput(object input) in version 35.0 and later. this constructor doesn’t support a binary input. in version 32.0–35.0, this method supports both connectapi.batchinput(object input) and connectapi.batchinput(object input, connectapi.binaryinput binary) constructors. the connectapi.batchinput(object input, connectapi.binaryinput binary) constructor allows for a single binary input. in each constructor, the input object must be an instance of connectapi.feedelementinput. example this trigger bulk posts to the feeds of newly inserted accounts. trigger postfeeditemtoaccount on account (after insert) { account[] accounts = trigger.new; // bulk post to the account feeds. list batchinputs = new list(); for (account a : accounts) { connectapi.feediteminput input = new connectapi.feediteminput(); input.subjectid = a.id; connectapi.messagebodyinput body = new connectapi.messagebodyinput(); body.messagesegments = new list(); connectapi.textsegmentinput textsegment = new connectapi.textsegmentinput(); textsegment.text = 'let\'s win the ' + a.name + ' account.'; body.messagesegments.add(textsegment); input.body = body; connectapi.batchinput batchinput = new connectapi.batchinput(input); batchinputs.add(batchinput); } connectapi.chatterfeeds.postfeedelementbatch(network.getnetworkid(), batchinputs); } 597apex reference guide chatterfeeds class publishdraftfeedelement(communityid, feedelementid, feedelement) publish a draft feed element. api version 44.0 requires chatter yes signature public static connectapi.feedelement publishdraftfeedelement(string communityid, string feedelementid, connectapi.feedelementinput feedelement) parameters communityid type: string id for an experience cloud site, internal, or null. feedelementid type: string id of the feed element to publish. feedelement type: connectapi.feedelementinput use this optional parameter to edit your draft before publishing. return value type: connectapi.feedelement the" "published feed element has a new id. searchfeedelements(communityid, q) get the first page of feed elements that match the search criteria. api version 31.0 available to guest users 31.0 requires chatter yes 598apex reference guide chatterfeeds class signature public static connectapi.feedelementpage searchfeedelements(string communityid, string q) parameters communityid type: string id for an experience cloud site, internal, or null. q type: string required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. return value type: connectapi.feedelementpage usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestsearchfeedelements(communityid, q, result) apex developer guide: testing connectapi code searchfeedelements(communityid, q, sortparam) get the first page of sorted feed elements that match the search criteria. api version 31.0 available to guest users 31.0 requires chatter yes signature public static connectapi.feedelementpage searchfeedelements(string communityid, string q, connectapi.feedsortorder sortparam) 599apex reference guide chatterfeeds class parameters communityid type: string id for an experience cloud site, internal, or null. q type: string required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. sortparam type: connectapi.feedsortorder values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. if you pass in null, the default value createddatedesc is used. return value type: connectapi.feedelementpage usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestsearchfeedelements(communityid, q, sortparam, result) apex developer guide: testing connectapi code searchfeedelements(communityid, q, threadedcommentscollapsed) get the feed elements and comments that match the search criteria. api version 44.0 available to guest users 44.0 600apex reference guide chatterfeeds class requires chatter yes signature public static connectapi.feedelementpage searchfeedelements(string communityid, string q, boolean threadedcommentscollapsed) parameters communityid type: string id for an experience cloud site, internal, or null. q type: string required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. threadedcommentscollapsed type: boolean specifies whether to return threaded comments in a collapsed style (true) or not (false). if you pass in null, the default is false. return value type: connectapi.feedelementpage usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestsearchfeedelements(communityid, q, threadedcommentscollapsed, result) apex developer guide: testing connectapi code searchfeedelements(communityid, q, pageparam, pagesize) get a page of feed elements that match the search criteria. api version 31.0 available to guest users 31.0 601apex reference guide chatterfeeds class requires chatter yes signature public static connectapi" ".feedelementpage searchfeedelements(string communityid, string q, string pageparam, integer pagesize) parameters communityid type: string id for an experience cloud site, internal, or null. q type: string required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of feed elements per page. valid values are from 1 through 100. if you pass in null, the default size is 25. return value type: connectapi.feedelementpage usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestsearchfeedelements(communityid, q, pageparam, pagesize, result) apex developer guide: testing connectapi code searchfeedelements(communityid, q, pageparam, pagesize, sortparam) get a page of sorted feed elements that match the search criteria. api version 31.0 602apex reference guide chatterfeeds class available to guest users 31.0 requires chatter yes signature public static connectapi.feedelementpage searchfeedelements(string communityid, string q, string pageparam, integer pagesize, connectapi.feedsortorder sortparam) parameters communityid type: string id for an experience cloud site, internal, or null. q type: string required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of feed elements per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.feedsortorder values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. if you pass in null, the default value createddatedesc is used. return value type: connectapi.feedelementpage 603apex reference guide chatterfeeds class usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestsearchfeedelements(communityid, q, pageparam, pagesize, sortparam, result) apex developer guide: testing connectapi code searchfeedelements(communityid, q, pageparam, pagesize, threadedcommentscollapsed) get a page of feed elements with comments in a threaded style that match the search criteria. api version 44.0 available to guest users 44.0 requires chatter yes signature public static connectapi.feedelementpage searchfeedelements(string communityid, string q, string pageparam, integer pagesize, boolean threadedcommentscollapsed) parameters communityid type: string id for an experience cloud site, internal, or null. q type: string required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null" ", the first page is returned. pagesize type: integer specifies the number of feed elements per page. valid values are from 1 through 100. if you pass in null, the default size is 25. 604apex reference guide chatterfeeds class threadedcommentscollapsed type: boolean specifies whether to return threaded comments in a collapsed style (true) or not (false). if you pass in null, the default is false. return value type: connectapi.feedelementpage usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestsearchfeedelements(communityid, q, pageparam, pagesize, threadedcommentscollapsed, result) apex developer guide: testing connectapi code searchfeedelements(communityid, q, recentcommentcount, pageparam, pagesize, sortparam) get a page of sorted feed elements that match the search criteria. each feed element includes no more than the specified number of comments. api version 31.0 available to guest users 31.0 requires chatter yes signature public static connectapi.feedelementpage searchfeedelements(string communityid, string q, integer recentcommentcount, string pageparam, integer pagesize, connectapi.feedsortorder sortparam) parameters communityid type: string id for an experience cloud site, internal, or null. 605apex reference guide chatterfeeds class q type: string required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. recentcommentcount type: integer maximum number of comments to return with each feed element. the default value is 3. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of feed elements per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.feedsortorder values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. if you pass in null, the default value createddatedesc is used. return value type: connectapi.feedelementpage usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestsearchfeedelements(communityid, q, recentcommentcount, pageparam, pagesize, sortparam, result) apex developer guide: testing connectapi code searchfeedelementsinfeed(communityid, feedtype, q) get the feed elements from the company, directmessagemoderation, home, moderation, and pendingreview feeds that match the search criteria. 606apex reference guide chatterfeeds class api version 31.0 available to guest users 31.0 requires chatter yes signature public static connectapi.feedelementpage searchfeedelementsinfeed(string communityid, connectapi.feedtype feedtype, string q) parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype type of feed. valid values are company, directmessagemoderation, home, moderation, and pendingreview. q type: string required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. return value type: connectapi.feedelementpage usage to test code that uses this method, use the" "matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestsearchfeedelementsinfeed(communityid, feedtype, q, result) apex developer guide: testing connectapi code searchfeedelementsinfeed(communityid, feedtype, pageparam, pagesize, sortparam, q) get a page of sorted feed elements from the company, directmessagemoderation, home, moderation, and pendingreview feeds that match the search criteria. 607apex reference guide chatterfeeds class api version 31.0 available to guest users 31.0 requires chatter yes signature public static connectapi.feedelementpage searchfeedelementsinfeed(string communityid, connectapi.feedtype feedtype, string pageparam, integer pagesize, connectapi.feedsortorder sortparam, string q) parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype type of feed. valid values are company, directmessagemoderation, home, moderation, and pendingreview. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of feed elements per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.feedsortorder values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. if you pass in null, the default value createddatedesc is used. 608apex reference guide chatterfeeds class q type: string required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. return value type: connectapi.feedelementpage usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestsearchfeedelementsinfeed(communityid, feedtype, pageparam, pagesize, sortparam, q, result) apex developer guide: testing connectapi code searchfeedelementsinfeed(communityid, feedtype, recentcommentcount, density, pageparam, pagesize, sortparam, q) get a page of sorted feed elements from the company, directmessagemoderation, home, moderation, and pendingreview feeds that match the search criteria. each feed element includes no more than the specified number of comments. api version 31.0 available to guest users 31.0 requires chatter yes signature public static connectapi.feedelementpage searchfeedelementsinfeed(string communityid, connectapi.feedtype feedtype, integer recentcommentcount, connectapi.feeddensity density, string pageparam, integer pagesize, connectapi.feedsortorder sortparam, string q) parameters communityid type: string id for an experience cloud site, internal, or null. 609apex reference guide chatterfeeds class feedtype type: connectapi.feedtype type of feed. valid values are company, directmessagemoderation, home, moderation, and pendingreview. recentcommentcount type: integer maximum number of comments to return with each feed element. the default value is 3. density type: connectapi.feeddensity specify the amount of content in a feed. • allupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations. • fewerupdates—displays all updates from people and records the" "user follows and groups the user is a member of. also displays custom recommendations, but hides some system-generated updates from records. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of feed elements per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.feedsortorder values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. if you pass in null, the default value createddatedesc is used. q type: string required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. return value type: connectapi.feedelementpage 610apex reference guide chatterfeeds class usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestsearchfeedelementsinfeed(communityid, feedtype, recentcommentcount, density, pageparam, pagesize, sortparam, q, result) apex developer guide: testing connectapi code searchfeedelementsinfeed(communityid, feedtype, recentcommentcount, density, pageparam, pagesize, sortparam, q, filter) get a page of sorted and filtered feed elements from the home feed that match the search criteria. each feed element includes no more than the specified number of comments. api version 32.0 available to guest users 32.0 requires chatter yes signature public static connectapi.feedelementpage searchfeedelementsinfeed(string communityid, connectapi.feedtype feedtype, integer recentcommentcount, connectapi.feeddensity density, string pageparam, integer pagesize, connectapi.feedsortorder sortparam, string q, connectapi.feedfilter filter) parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype the type of feed. the only valid value is home. recentcommentcount type: integer maximum number of comments to return with each feed element. the default value is 3. 611apex reference guide chatterfeeds class density type: connectapi.feeddensity specify the amount of content in a feed. • allupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations. • fewerupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations, but hides some system-generated updates from records. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. when the sortparam is mostviewed, you must pass in null for the pageparam. pagesize type: integer specifies the number of feed elements per page. valid values are from 1 through 100. if you pass in null, the default size is 25. when the sortparam is mostviewed, the pagesize must be a value from 1 to 25. sortparam type: connectapi.feedsortorder values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most" "viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. if you pass in null, the default value createddatedesc is used. q type: string required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. filter type: connectapi.feedfilter specifies the feed filters. • allquestions—feed elements that are questions. • authoredby—feed elements authored by the user profile owner. this value is valid only for the userprofile feed. • communityscoped—feed elements that are scoped to experience cloud sites. currently, these feed elements have a user or a group parent record. however, other parent record types could be scoped to sites in the future. feed elements that are always visible in all sites are filtered out. this value is valid only for the userprofile feed. • questionswithcandidateanswers—feed elements that are questions that have candidate answers associated with them.this value is valid only for users with the access einstein-generated answers permission. 612apex reference guide chatterfeeds class • questionswithcandidateanswersreviewedpublished—feed elements that are questions that have candidate answers that have been reviewed or published. this value is valid only for users with the access einstein-generated answers permission. • read—feed elements that are older than 30 days or are marked as read for the context user. includes existing feed elements when the context user joined the group. this value is valid only for the record feed of a group. • solvedquestions—feed elements that are questions and that have a best answer. • unansweredquestions—feed elements that are questions and that don’t have any answers. • unansweredquestionswithcandidateanswers—feed elements that are questions that don’t have answers but have candidate answers associated with them. this value is valid only for users with the access einstein-generated answers permission. • unread—feed elements that are created in the past 30 days and aren’t marked as read for the context user. this value is valid only for the record feed of a group. • unsolvedquestions—feed elements that are questions and that don’t have a best answer. return value type: connectapi.feedelementpage usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestsearchfeedelementsinfeed(communityid, feedtype, recentcommentcount, density, pageparam, pagesize, sortparam, q, filter, result) apex developer guide: testing connectapi code searchfeedelementsinfeed(communityid, feedtype, subjectid, q) search up to 5,000 of the most recent feed elements in a feed for a subject id that match the search string. feed elements are returned in order of most recent activity. api version 31.0 available to guest users 31.0 requires chatter yes 613apex reference guide chatterfeeds class signature public static connectapi.feedelementpage searchfeedelementsinfeed(string communityid, connectapi.feedtype feedtype, string subjectid, string q) parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype type of feed. valid values include every connectapi.feedtype except company, directmessages, filter, landing, streams, and topics. subjectid type: string if feedtype is record, subjectid can be any record id, including a group id. if feedtype is userprofile, subjectid can be any user id. if the feedtype is any other value, subjectid must be the id of the context user or the alias me. q type: string required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. return value type: connectapi.feedelementpage usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also:" "settestsearchfeedelementsinfeed(communityid, feedtype, subjectid, q, result) apex developer guide: testing connectapi code searchfeedelementsinfeed(communityid, feedtype, subjectid, pageparam, pagesize, sortparam, q) get a page of sorted feed elements from a feed for a record or user that match the search criteria. api version 31.0 614apex reference guide chatterfeeds class available to guest users 31.0 requires chatter yes signature public static connectapi.feedelementpage searchfeedelementsinfeed(string communityid, connectapi.feedtype feedtype, string subjectid, string pageparam, integer pagesize, connectapi.feedsortorder sortparam, string q) parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype type of feed. valid values include every connectapi.feedtype except company, directmessages, filter, landing, streams, and topics. subjectid type: string if feedtype is record, subjectid can be any record id, including a group id. if feedtype is userprofile, subjectid can be any user id. if the feedtype is any other value, subjectid must be the id of the context user or the alias me. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of feed elements per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.feedsortorder order of feed items in the feed. • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. 615apex reference guide chatterfeeds class if you pass in null, the default value createddatedesc is used. q type: string search term. searches keywords in the user or group name. a minimum of one character is required. this parameter doesn’t support wildcards. this parameter is required. return value type: connectapi.feedelementpage usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestsearchfeedelementsinfeed(communityid, feedtype, subjectid, pageparam, pagesize, sortparam, q, result) apex developer guide: testing connectapi code searchfeedelementsinfeed(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, sortparam, q) get a page of sorted feed elements from a feed that match the search criteria. each feed element includes no more than the specified number of comments. api version 31.0 available to guest users 31.0 requires chatter yes signature public static connectapi.feedelementpage searchfeedelementsinfeed(string communityid, connectapi.feedtype feedtype, string subjectid, integer recentcommentcount, connectapi.feeddensity density, string pageparam, integer pagesize, connectapi.feedsortorder sortparam, string q) parameters communityid type: string 616apex reference guide chatterfeeds class id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype type of feed. valid values include every connectapi.feedtype except company, directmessages, filter, landing, streams, and topics. subjectid type: string if feedtype is record, subjectid can be any record id, including a group id. if feedtype is userprofile, subjectid can be any user id. if the feedtype is any other value" ", subjectid must be the id of the context user or the alias me. recentcommentcount type: integer maximum number of comments to return with each feed element. the default value is 3. density type: connectapi.feeddensity specify the amount of content in a feed. • allupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations. • fewerupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations, but hides some system-generated updates from records. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of feed elements per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.feedsortorder values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. if you pass in null, the default value createddatedesc is used. q type: string 617apex reference guide chatterfeeds class required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. return value type: connectapi.feedelementpage usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestsearchfeedelementsinfeed(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, sortparam, q, result) apex developer guide: testing connectapi code searchfeedelementsinfeed(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, sortparam, q, filter) get a page of sorted and filtered feed elements from a userprofile feed that match the search criteria. api version 35.0 available to guest users 35.0 requires chatter yes signature public static connectapi.feedelementpage searchfeedelementsinfeed(string communityid, connectapi.feedtype feedtype, string subjectid, integer recentcommentcount, connectapi.feeddensity density, string pageparam, integer pagesize, connectapi.feedsortorder sortparam, string q, connectapi.feedfilter filter) parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype 618apex reference guide chatterfeeds class value must be connectapi.feedtype.userprofile. subjectid type: string id of any user. to specify the context user, use the user id or the alias me. recentcommentcount type: integer maximum number of comments to return with each feed element. the default value is 3. density type: connectapi.feeddensity specify the amount of content in a feed. • allupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations. • fewerupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations, but hides some system-generated updates from records. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of feed elements per page. valid values are from 1 through 100. if you pass in null, the default size is" "25. sortparam type: connectapi.feedsortorder values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. if you pass in null, the default value createddatedesc is used. q type: string one or more keywords to search for in the feed elements visible to the context user. the search string can contain wildcards and must contain at least two characters that aren’t wildcards. see wildcards. filter type: connectapi.feedfilter value must be connectapi.feedfilter.communityscoped. filters the feed to include only feed elements that are scoped to experience cloud sites. feed elements that are always visible in all sites are filtered out. 619apex reference guide chatterfeeds class return value type: connectapi.feedelementpage usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestsearchfeedelementsinfeed(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, sortparam, q, filter, result) apex developer guide: testing connectapi code searchfeedelementsinfeed(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, sortparam, q, customfilter) get a page of sorted and filtered feed elements from a case feed that match the search criteria. api version 40.0 available to guest users 40.0 requires chatter yes signature public static connectapi.feedelementpage searchfeedelementsinfeed(string communityid, connectapi.feedtype feedtype, string subjectid, integer recentcommentcount, connectapi.feeddensity density, string pageparam, integer pagesize, connectapi.feedsortorder sortparam, string q, string customfilter) parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype value must be connectapi.feedtype.record. subjectid type: string 620apex reference guide chatterfeeds class the id of a case. recentcommentcount type: integer maximum number of comments to return with each feed element. the default value is 3. density type: connectapi.feeddensity specify the amount of content in a feed. • allupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations. • fewerupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations, but hides some system-generated updates from records. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of feed elements per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.feedsortorder values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. if you pass in null, the default value createddatedesc is used. q type: string one or more keywords to search" "for in the feed elements visible to the context user. the search string can contain wildcards and must contain at least two characters that aren’t wildcards. see wildcards. customfilter type: string custom filter that applies only to the case feed. see customfeedfilter in the metadata api developer guide for supported values. return value type: connectapi.feedelementpage 621apex reference guide chatterfeeds class usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestsearchfeedelementsinfeed(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, sortparam, q, customfilter, result) apex developer guide: testing connectapi code searchfeedelementsinfeed(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, sortparam, q, showinternalonly) get a page of sorted feed elements from a feed for a record or user that match the search criteria. each feed element includes no more than the specified number of comments. specify whether to return feed elements posted by internal (non-experience cloud site) users only. api version 31.0 available to guest users 31.0 requires chatter yes signature public static connectapi.feedelementpage searchfeedelementsinfeed(string communityid, connectapi.feedtype feedtype, string subjectid, integer recentcommentcount, connectapi.feeddensity density, string pageparam, integer pagesize, connectapi.feedsortorder sortparam, string q, boolean showinternalonly) parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype value must be connectapi.feedtype.record. subjectid type: string any record id, including a group id. 622apex reference guide chatterfeeds class recentcommentcount type: integer maximum number of comments to return with each feed element. the default value is 3. density type: connectapi.feeddensity specify the amount of content in a feed. • allupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations. • fewerupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations, but hides some system-generated updates from records. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of feed elements per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.feedsortorder values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. if you pass in null, the default value createddatedesc is used. q type: string required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. showinternalonly type: boolean specifies whether to show only feed elements from internal (non-experience cloud site) users (true), or not (false). the default value is false. return value type: connectapi.feedelementpage 623apex reference guide chatterfeeds class usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestsearchfeedelementsinfeed(communityid, feedtype, subjectid" ", recentcommentcount, density, pageparam, pagesize, sortparam, q, showinternalonly, result) apex developer guide: testing connectapi code searchfeedelementsinfeed(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, sortparam, q, showinternalonly, filter) get a page of sorted and filtered feed elements from a feed for a record or user that match the search criteria. each feed element includes no more than the specified number of comments. specify whether to return feed elements posted by internal (non-experience cloud site) users only. api version 32.0 available to guest users 32.0 requires chatter yes signature public static connectapi.feedelementpage searchfeedelementsinfeed(string communityid, connectapi.feedtype feedtype, string subjectid, integer recentcommentcount, connectapi.feeddensity density, string pageparam, integer pagesize, connectapi.feedsortorder sortparam, string q, boolean showinternalonly, connectapi.feedfilter filter) parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype value must be connectapi.feedtype.record. subjectid type: string any record id, including a group id. 624apex reference guide chatterfeeds class recentcommentcount type: integer maximum number of comments to return with each feed element. the default value is 3. density type: connectapi.feeddensity specify the amount of content in a feed. • allupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations. • fewerupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations, but hides some system-generated updates from records. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of feed elements per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.feedsortorder values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. if you pass in null, the default value createddatedesc is used. q type: string required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. showinternalonly type: boolean specifies whether to show only feed elements from internal (non-experience cloud site) users (true), or not (false). the default value is false. filter type: connectapi.feedfilter specifies the feed filters. • allquestions—feed elements that are questions. • authoredby—feed elements authored by the user profile owner. this value is valid only for the userprofile feed. 625apex reference guide chatterfeeds class • communityscoped—feed elements that are scoped to experience cloud sites. currently, these feed elements have a user or a group parent record. however, other parent record types could be scoped to sites in the future. feed elements that are always visible in all sites are filtered out. this value is valid only for the userprofile feed. • questionswithcandidateanswers—feed elements that are questions that have candidate answers associated with them.this value is valid only for users with the access einstein-generated answers permission. • questionswithcandidateanswersreviewedpublished—feed elements that are questions that have candidate answers that have been reviewed or published. this value is valid only for users with the access einstein-generated answers permission. • read—feed elements that are" "older than 30 days or are marked as read for the context user. includes existing feed elements when the context user joined the group. this value is valid only for the record feed of a group. • solvedquestions—feed elements that are questions and that have a best answer. • unansweredquestions—feed elements that are questions and that don’t have any answers. • unansweredquestionswithcandidateanswers—feed elements that are questions that don’t have answers but have candidate answers associated with them. this value is valid only for users with the access einstein-generated answers permission. • unread—feed elements that are created in the past 30 days and aren’t marked as read for the context user. this value is valid only for the record feed of a group. • unsolvedquestions—feed elements that are questions and that don’t have a best answer. return value type: connectapi.feedelementpage usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestsearchfeedelementsinfeed(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, sortparam, q, showinternalonly, filter, result) apex developer guide: testing connectapi code searchfeedelementsinfeed(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, sortparam, q, showinternalonly, customfilter) get a page of sorted and filtered feed elements from a case feed that match the search criteria. api version 40.0 available to guest users 40.0 626apex reference guide chatterfeeds class requires chatter yes signature public static connectapi.feedelementpage searchfeedelementsinfeed(string communityid, connectapi.feedtype feedtype, string subjectid, integer recentcommentcount, connectapi.feeddensity density, string pageparam, integer pagesize, connectapi.feedsortorder sortparam, string q, boolean showinternalonly, string customfilter) parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype value must be connectapi.feedtype.record. subjectid type: string the id of a case. recentcommentcount type: integer maximum number of comments to return with each feed element. the default value is 3. density type: connectapi.feeddensity specify the amount of content in a feed. • allupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations. • fewerupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations, but hides some system-generated updates from records. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of feed elements per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.feedsortorder values are: 627apex reference guide chatterfeeds class • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. if you pass in null, the default value createddatedesc is used. q type: string required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. showinternalonly type: boolean specifies whether to show only feed elements from internal (non-experience cloud site) users (true), or not (false). the default" "value is false. filter type: string custom filter that applies only to the case feed. see customfeedfilter in the metadata api developer guide for supported values. return value type: connectapi.feedelementpage usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestsearchfeedelementsinfeed(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, sortparam, q, showinternalonly, customfilter, result) apex developer guide: testing connectapi code searchfeedelementsinfilterfeed(communityid, subjectid, keyprefix, q) get the feed elements from a feed filtered by a key prefix that match the search criteria. api version 31.0 requires chatter yes 628apex reference guide chatterfeeds class signature public static connectapi.feedelementpage searchfeedelementsinfilterfeed(string communityid, string subjectid, string keyprefix, string q) parameters communityid type: string id for an experience cloud site, internal, or null. subjectid type: string id of the context user or the alias me. keyprefix type: string a key prefix that specifies record type. a key prefix is the first three characters in the object id, which specifies the object type. for example, user objects have a prefix of 005 and group objects have a prefix of 0f9. q type: string required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. return value type: connectapi.feedelementpage usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestsearchfeedelementsinfilterfeed(communityid, subjectid, keyprefix, q, result) apex developer guide: testing connectapi code searchfeedelementsinfilterfeed(communityid, subjectid, keyprefix, pageparam, pagesize, sortparam, q) get a page of sorted feed elements from a feed filtered by a key prefix that match the search criteria. api version 31.0 requires chatter yes 629apex reference guide chatterfeeds class signature public static connectapi.feedelementpage searchfeedelementsinfilterfeed(string communityid, string subjectid, string keyprefix, string pageparam, integer pagesize, connectapi.feedsortorder sortparam, string q) parameters communityid type: string id for an experience cloud site, internal, or null. subjectid type: string id of the context user or the alias me. keyprefix type: string a key prefix that specifies record type. a key prefix is the first three characters in the object id, which specifies the object type. for example, user objects have a prefix of 005 and group objects have a prefix of 0f9. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of feed elements per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.feedsortorder values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. if you pass in null, the default value createddatedesc is used. q type: string required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards." "return value type: connectapi.feedelementpage 630apex reference guide chatterfeeds class usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestsearchfeedelementsinfilterfeed(communityid, subjectid, keyprefix, pageparam, pagesize, sortparam, q, result) apex developer guide: testing connectapi code searchfeedelementsinfilterfeed(communityid, subjectid, keyprefix, recentcommentcount, density, pageparam, pagesize, sortparam, q) get a page of sorted feed elements from a feed filtered by a key prefix that match the search criteria. each feed element includes no more than the specified number of comments. api version 31.0 requires chatter yes signature public static connectapi.feedelementpage searchfeedelementsinfilterfeed(string communityid, string subjectid, string keyprefix, integer recentcommentcount, connectapi.feeddensity density, string pageparam, integer pagesize, connectapi.feedsortorder sortparam, string q) parameters communityid type: string id for an experience cloud site, internal, or null. subjectid type: string id of the context user or the alias me. keyprefix type: string a key prefix that specifies record type. a key prefix is the first three characters in the object id, which specifies the object type. for example, user objects have a prefix of 005 and group objects have a prefix of 0f9. recentcommentcount type: integer maximum number of comments to return with each feed element. the default value is 3. density type: connectapi.feeddensity 631apex reference guide chatterfeeds class specify the amount of content in a feed. • allupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations. • fewerupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations, but hides some system-generated updates from records. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of feed elements per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.feedsortorder values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. if you pass in null, the default value createddatedesc is used. q type: string required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. return value type: connectapi.feedelementpage usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestsearchfeedelementsinfilterfeed(communityid, subjectid, keyprefix, recentcommentcount, density, pageparam, pagesize, sortparam, q, result) apex developer guide: testing connectapi code 632" "apex reference guide chatterfeeds class searchstreams(communityid, q) search the chatter feed streams for the context user. api version 40.0 requires chatter yes signature public static connectapi.chatterstreampage searchstreams(string communityid, string q) parameters communityid type: string id for an experience cloud site, internal, or null. q type: string required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. return value type: connectapi.chatterstreampage usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestsearchstreams(communityid, q, result) apex developer guide: testing connectapi code searchstreams(communityid, q, sortparam) search and sort the chatter feed streams for the context user. api version 40.0 633apex reference guide chatterfeeds class requires chatter yes signature public static connectapi.chatterstreampage searchstreams(string communityid, string q, connectapi.sortorder sortparam) parameters communityid type: string id for an experience cloud site, internal, or null. q type: string required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. sortparam type: connectapi.sortorder specifies the sort order. values are: • ascending—items are in ascending alphabetical order (a-z). • descending—items are in descending alphabetical order (z-a). • mostrecentlyviewed—items are in descending chronological order by view. this sort order is valid only for chatter feed streams. if not specified, default value is ascending. return value type: connectapi.chatterstreampage usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestsearchstreams(communityid, q, sortparam, result) apex developer guide: testing connectapi code searchstreams(communityid, q, pageparam, pagesize) search the chatter feed streams for the context user and return a page of results. api version 40.0 634apex reference guide chatterfeeds class requires chatter yes signature public static connectapi.chatterstreampage searchstreams(string communityid, string q, integer pageparam, integer pagesize) parameters communityid type: string id for an experience cloud site, internal, or null. q type: string required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. pageparam type: integer number of the page you want returned. starts at 0. if you pass in null or 0, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 to 250. the default size is 25. return value type: connectapi.chatterstreampage usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestsearchstreams(communityid, q, pageparam, pagesize, result) apex developer guide: testing connectapi code searchstreams(communityid, q, pageparam, pagesize, sortparam) search the chatter feed streams for the context user and return a sorted page of results. api version 40.0 635apex reference guide chatterfeeds class requires chatter yes signature public static connectapi.chatterstreampage searchstreams(string communityid, string q, integer pageparam, integer pagesize, connectapi.sortorder sortparam) parameters communityid type: string id for an experience cloud site, internal, or null. q type: string required and can’t be null. specifies the string to search. the" "search string must contain at least two characters, not including wildcards. see wildcards. pageparam type: integer number of the page you want returned. starts at 0. if you pass in null or 0, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 to 250. the default size is 25. sortparam type: connectapi.sortorder specifies the sort order. values are: • ascending—items are in ascending alphabetical order (a-z). • descending—items are in descending alphabetical order (z-a). • mostrecentlyviewed—items are in descending chronological order by view. this sort order is valid only for chatter feed streams. if not specified, default value is ascending. return value type: connectapi.chatterstreampage usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestsearchstreams(communityid, q, pageparam, pagesize, sortparam, result) apex developer guide: testing connectapi code 636apex reference guide chatterfeeds class searchstreams(communityid, q, pageparam, pagesize, sortparam, globalscope) search the chatter feed streams from all experience cloud sites for the context user and return a sorted page of results. api version 41.0 requires chatter yes signature public static connectapi.chatterstreampage searchstreams(string communityid, string q, integer pageparam, integer pagesize, connectapi.sortorder sortparam, boolean globalscope) parameters communityid type: string id for an experience cloud site, internal, or null. q type: string required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. pageparam type: integer number of the page you want returned. starts at 0. if you pass in null or 0, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 to 250. the default size is 25. sortparam type: connectapi.sortorder specifies the sort order. values are: • ascending—items are in ascending alphabetical order (a-z). • descending—items are in descending alphabetical order (z-a). • mostrecentlyviewed—items are in descending chronological order by view. this sort order is valid only for chatter feed streams. if not specified, default value is ascending. globalscope type: boolean specifies whether to get streams from all the context user’s experience cloud sites, regardless of the communityid value. tip: if you know the communityid for the streams, we recommend setting globalscope to false. 637apex reference guide chatterfeeds class return value type: connectapi.chatterstreampage usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. setcommentisverified(communityid, commentid, isverified) mark a comment as verified or unverified. api version 41.0 requires chatter yes signature public static connectapi.verifiedcapability setcommentisverified(string communityid, string commentid, boolean isverified) parameters communityid type: string id for an experience cloud site, internal, or null. commentid type: string id of the comment on a question post. only one comment on a question post can be marked as verified. isverified type: boolean specifies whether to mark the comment as verified (true) or unverified (false). only verified comments can be marked as unverified, and only unverified comments can be marked as verified. return value type: connectapi.verifiedcapability if the comment doesn’t support this capability, the return value is connectapi.notfoundexception. setcommentisverifiedbyanonymized(communityid, commentid, isverified, isverifiedbyanonymized) mark a comment as verified by an anonymous user. 638apex reference guide chatterfeeds class api version 43.0 requires chatter yes" "signature public static connectapi.verifiedcapability setcommentisverifiedbyanonymized(string communityid, string commentid, boolean isverified, boolean isverifiedbyanonymized) parameters communityid type: string id for an experience cloud site, internal, or null. commentid type: string id of the comment on a question post. only one comment on a question post can be marked as verified. isverified type: boolean specifies whether to mark the comment as verified (true) or unverified (false). only verified comments can be marked as unverified, and only unverified comments can be marked as verified. isverifiedbyanonymized type: boolean specifies whether to mark the comment as verified by an anonymous user (true). if a user previously verified a comment and then requested the activity to be deleted, use isverifiedbyanonymized to maintain the verification and anonymize the value of lastverifiedbyuser. you can’t set isverified and isverifiedbyanonymized to true at the same time. isverifiedbyanonymized can be set to true only if isverified is already set to true. you can’t set isverifiedbyanonymized to false. after isverifiedbyanonymized is set to true, it can be undone only when another user marks the comment as unverified and then reverifies the comment. return value type: connectapi.verifiedcapability if the comment doesn’t support this capability, the return value is connectapi.notfoundexception. setcommentvote(communityid, commentid, updownvote) upvote or downvote a comment. 639apex reference guide chatterfeeds class api version 41.0 requires chatter yes signature public static connectapi.updownvotecapability setcommentvote(string communityid, string commentid, connectapi.updownvotecapabilityinput updownvote) parameters communityid type: string id for an experience cloud site, internal, or null. commentid type: string id of the comment. updownvote type: connectapi.updownvotecapabilityinput a connectapi.updownvotecapabilityinput object that includes your vote. return value type: connectapi.updownvotecapability if the comment doesn’t support this capability, the return value is connectapi.notfoundexception. setfeedcommentstatus(communityid, commentid, status) set the status of a comment. api version 38.0 requires chatter yes signature public static connectapi.statuscapability setfeedcommentstatus(string communityid, string commentid, connectapi.statuscapabilityinput status) 640apex reference guide chatterfeeds class parameters communityid type: string id for an experience cloud site, internal, or null. commentid type: string id of the comment. status type: connectapi.statuscapabilityinput a connectapi.statuscapabilityinput object that includes the status you want to set. return value type: connectapi.statuscapability if the comment doesn’t support this capability, the return value is connectapi.notfoundexception. usage only users with the can approve feed post and comment permission can set the status of a feed post or comment. setfeedelementisclosed(communityid, feedelementid, isclosed) set a feed element to closed. users can’t edit (specifically the feed item body or title), comment on, or delete a closed feed element. if the closed feed element is a poll, users can’t vote on it. users can’t edit (specifically the comment body) or delete a comment on a closed feed element or select or remove it as best answer. admins and moderators can edit and delete closed feed elements and comments on closed feed elements. admins and moderators can select or remove the best answer status on comments on closed feed elements. api version 43.0 requires chatter yes signature public static connectapi.closecapability setfeedelementisclosed(string communityid, string feedelementid, boolean isclosed) parameters communityid type: string id for an experience cloud site, internal, or null. 641apex reference guide chatterfeeds class feedelementid type: string id of the feed element. isclosed type: boolean spec" "ifies whether to set the feed element to closed (true) or not (false). return value type: connectapi.closecapability if the feed element doesn’t support this capability, the return value is connectapi.notfoundexception. setfeedelementvote(communityid, feedelementid, updownvote) upvote or downvote a feed element. api version 41.0 requires chatter yes signature public static connectapi.updownvotecapability setfeedelementvote(string communityid, string feedelementid, connectapi.updownvotecapabilityinput updownvote) parameters communityid type: string id for an experience cloud site, internal, or null. feedelementid type: string id of the feed element. updownvote type: connectapi.updownvotecapabilityinput a connectapi.updownvotecapabilityinput object that includes your vote. return value type: connectapi.updownvotecapability if the feed element doesn’t support this capability, the return value is connectapi.notfoundexception. 642apex reference guide chatterfeeds class setfeedentitystatus(communityid, feedelementid, status) set the status of a feed post. api version 37.0 requires chatter yes signature public static connectapi.statuscapability setfeedentitystatus(string communityid, string feedelementid, connectapi.statuscapabilityinput status) parameters communityid type: string id for an experience cloud site, internal, or null. feedelementid type: string id of the feed element. status type: connectapi.statuscapabilityinput a connectapi.statuscapabilityinput object that includes the status you want to set. return value type: connectapi.statuscapability if the feed element doesn’t support this capability, the return value is connectapi.notfoundexception. usage only users with the can approve feed post and comment permission can set the status of a feed post or comment. setismutedbyme(communityid, feedelementid, ismutedbyme) mute or unmute a feed element. api version 35.0 requires chatter yes 643apex reference guide chatterfeeds class signature public static connectapi.mutecapability setismutedbyme(string communityid, string feedelementid, boolean ismutedbyme) parameters communityid type: string id for an experience cloud site, internal, or null. feedelementid type: string id of the feed element. ismutedbyme type: boolean indicates whether the feed element is muted for the context user. default value is false. return value type: connectapi.mutecapability if the feed element doesn’t support this capability, the return value is connectapi.notfoundexception. setisreadbyme(communityid, feedelementid, readby) mark a feed element as read for the context user using an input class. api version 40.0 requires chatter yes signature public static connectapi.readbycapability setisreadbyme(string communityid, string feedelementid, connectapi.readbycapabilityinput readby) parameters communityid type: string id for an experience cloud site, internal, or null. feedelementid type: string id of the feed element to mark as read. 644apex reference guide chatterfeeds class readby type: connectapi.readbycapabilityinput a connectapi.readbycapabilityinput body indicating to mark the feed elements as read. return value type: connectapi.readbycapability if the feed element doesn’t support this capability, the return value is connectapi.notfoundexception. setisreadbyme(communityid, feedelementid, isreadbyme) mark a feed element as read for the context user. api version 40.0 requires chatter yes signature public static connectapi.readbycapability setisreadbyme(string communityid, string feedelementid, boolean isreadbyme) parameters communityid type: string id for an experience cloud site, internal, or null. feedelementid type: string id of the feed element to mark as read. isreadbyme type: boolean specifies to mark the feed element as read" "(true) for the context user. return value type: connectapi.readbycapability if the feed element doesn’t support this capability, the return value is connectapi.notfoundexception. updatecomment(communityid, commentid, comment) edit a comment. 645apex reference guide chatterfeeds class api version 34.0 requires chatter yes signature public static connectapi.comment updatecomment(string communityid, string commentid, connectapi.commentinput comment) parameters communityid type: string id for an experience cloud site, internal, or null. commentid type: string id of the comment to be edited. comment type: connectapi.commentinput information about the comment to be edited. return value type: connectapi.comment if the comment doesn’t support the edit capability, the return value is connectapi.notfoundexception. example string commentid; string communityid = network.getnetworkid(); // get the last feed item created by the context user. list feeditems = [select id from feeditem where createdbyid = :userinfo.getuserid() order by createddate desc]; if (feeditems.isempty()) { // return null within anonymous apex. return null; } string feedelementid = feeditems[0].id; connectapi.commentpage commentpage = connectapi.chatterfeeds.getcommentsforfeedelement(communityid, feedelementid); if (commentpage.items.isempty()) { // return null within anonymous apex. return null; } 646apex reference guide chatterfeeds class commentid = commentpage.items[0].id; connectapi.feedentityiseditable iseditable = connectapi.chatterfeeds.iscommenteditablebyme(communityid, commentid); if (iseditable.iseditablebyme == true){ connectapi.commentinput commentinput = new connectapi.commentinput(); connectapi.messagebodyinput messagebodyinput = new connectapi.messagebodyinput(); connectapi.textsegmentinput textsegmentinput = new connectapi.textsegmentinput(); messagebodyinput.messagesegments = new list(); textsegmentinput.text = 'this is my edited comment.'; messagebodyinput.messagesegments.add(textsegmentinput); commentinput.body = messagebodyinput; connectapi.comment editedcomment = connectapi.chatterfeeds.updatecomment(communityid, commentid, commentinput); } updatedirectmessage(communityid, feedelementid, directmessage) update the members of a direct message. api version 40.0 requires chatter yes signature public static connectapi.directmessagecapability updatedirectmessage(string communityid, string feedelementid, connectapi.directmessagecapabilityinput directmessage) parameters communityid type: string id for an experience cloud site, internal, or null. feedelementid type: string id of the feed element. directmessage type: connectapi.directmessagecapabilityinput a connectapi.directmessagecapabilityinput body that includes the members to add and remove. 647apex reference guide chatterfeeds class return value type: connectapi.directmessagecapability if the feed element doesn’t support this capability, the return value is connectapi.notfoundexception. updatefeedelement(communityid, feedelementid, feedelement) edit a feed element. api version 34.0 requires chatter yes signature public static connectapi.feedelement updatefeedelement(string communityid, string feedelementid, connectapi.feedelementinput feedelement) parameters communityid type: string id for an experience cloud site, internal, or null. feedelementid type: string id of the feed element to be edited. feed items are the only type of feed element that can be edited. feedelement type: connectapi.feedelementinput information about the feed item to be edited. return value type: connectapi.feedelement if the feed element doesn’t support the edit capability, the return value is connectapi.notfoundexception. example for editing a feed post string communityid = network.getnetworkid(); // get the last feed item created by" "the context user. list feeditems = [select id from feeditem where createdbyid = :userinfo.getuserid() order by createddate desc]; if (feeditems.isempty()) { // return null within anonymous apex. return null; 648apex reference guide chatterfeeds class } string feedelementid = feeditems[0].id; connectapi.feedentityiseditable iseditable = connectapi.chatterfeeds.isfeedelementeditablebyme(communityid, feedelementid); if (iseditable.iseditablebyme == true){ connectapi.feediteminput feediteminput = new connectapi.feediteminput(); connectapi.messagebodyinput messagebodyinput = new connectapi.messagebodyinput(); connectapi.textsegmentinput textsegmentinput = new connectapi.textsegmentinput(); messagebodyinput.messagesegments = new list(); textsegmentinput.text = 'this is my edited post.'; messagebodyinput.messagesegments.add(textsegmentinput); feediteminput.body = messagebodyinput; connectapi.feedelement editedfeedelement = connectapi.chatterfeeds.updatefeedelement(communityid, feedelementid, feediteminput); } example for editing a question title and post string communityid = network.getnetworkid(); // get the last feed item created by the context user. list feeditems = [select id from feeditem where createdbyid = :userinfo.getuserid() order by createddate desc]; if (feeditems.isempty()) { // return null within anonymous apex. return null; } string feedelementid = feeditems[0].id; connectapi.feedentityiseditable iseditable = connectapi.chatterfeeds.isfeedelementeditablebyme(communityid, feedelementid); if (iseditable.iseditablebyme == true){ connectapi.feediteminput feediteminput = new connectapi.feediteminput(); connectapi.feedelementcapabilitiesinput feedelementcapabilitiesinput = new connectapi.feedelementcapabilitiesinput(); connectapi.questionandanswerscapabilityinput questionandanswerscapabilityinput = new connectapi.questionandanswerscapabilityinput(); connectapi.messagebodyinput messagebodyinput = new connectapi.messagebodyinput(); connectapi.textsegmentinput textsegmentinput = new connectapi.textsegmentinput(); messagebodyinput.messagesegments = new list(); textsegmentinput.text = 'this is my edited question.'; messagebodyinput.messagesegments.add(textsegmentinput); feediteminput.body = messagebodyinput; 649apex reference guide chatterfeeds class feediteminput.capabilities = feedelementcapabilitiesinput; feedelementcapabilitiesinput.questionandanswers = questionandanswerscapabilityinput; questionandanswerscapabilityinput.questiontitle = 'where is my edited question?'; connectapi.feedelement editedfeedelement = connectapi.chatterfeeds.updatefeedelement(communityid, feedelementid, feediteminput); } updatefeedelementbookmarks(communityid, feedelementid, bookmarks) bookmark a feed element or remove a bookmark from a feed element using an input class. api version 32.0 requires chatter yes signature public static connectapi.bookmarkscapability updatefeedelementbookmarks(string communityid, string feedelementid, connectapi.bookmarkscapabilityinput bookmarks) parameters communityid type: string id for an experience cloud site, internal, or null. feedelementid type: string id of the feed element. bookmarks type: connectapi.bookmarkscapabilityinput information about a bookmark. return value type: connectapi.bookmarkscapability if the feed element doesn’t support this capability, the return value is connectapi.notfoundexception. updatefeedelementbookmarks(communityid, feedelementid, isbookmarkedbycurrentuser) bookmark a feed element or remove a bookmark from a feed element. 650apex reference guide chatterfeeds class api version 32.0 requires chatter yes signature public static connecta" "pi.bookmarkscapability updatefeedelementbookmarks(string communityid, string feedelementid, boolean isbookmarkedbycurrentuser) parameters communityid type: string id for an experience cloud site, internal, or null. feedelementid type: string id of the feed element. isbookmarkedbycurrentuser type: boolean specify whether to bookmark the feed element (true) or not (false). return value type: connectapi.bookmarkscapability if the feed element doesn’t support this capability, the return value is connectapi.notfoundexception. example connectapi.bookmarkscapability bookmark = connectapi.chatterfeeds.updatefeedelementbookmarks(null, '0d5d0000000kugh', true); updatefeedelementreadbycapabilitybatch(communityid, feedelementids, readby) mark multiple feed elements as read by the context user at the same time using an input class. api version 40.0 requires chatter yes 651apex reference guide chatterfeeds class signature public static connectapi.batchresult[] updatefeedelementreadbycapabilitybatch(string communityid, list feedelementids, connectapi.readbycapabilityinput readby) parameters communityid type: string id for an experience cloud site, internal, or null. feedelementids type: list up to 500 feed element ids to mark as read. readby type: connectapi.readbycapabilityinput a connectapi.readbycapabilityinput body indicating to mark the feed elements as read. return value type: connectapi.batchresult[] if the feed element doesn’t support this capability, the return value is connectapi.notfoundexception. the returned objects correspond to each of the input objects and are returned in the same order as the input objects. the method call fails only if an error occurs that affects the entire operation (such as a parsing failure). if an individual object causes an error, the error is embedded within the connectapi.batchresult list. updatefeedelementreadbycapabilitybatch(communityid, feedelementids, isreadbyme) mark multiple feed elements as read by the context user at the same time. api version 40.0 requires chatter yes signature public static connectapi.batchresult[] updatefeedelementreadbycapabilitybatch(string communityid, list feedelementids, boolean isreadbyme) parameters communityid type: string 652apex reference guide chatterfeeds class id for an experience cloud site, internal, or null. feedelementids type: list up to 500 feed element ids to mark as read. isreadbyme type: boolean specifies to mark the feed element as read (true) for the context user. return value type: connectapi.batchresult[] if the feed element doesn’t support this capability, the return value is connectapi.notfoundexception. updatelikeforcomment(communityid, commentid, islikedbycurrentuser) like or unlike a comment. api version 39.0 requires chatter yes signature public static connectapi.chatterlikepage updatelikeforcomment(string communityid, string commentid, boolean islikedbycurrentuser) parameters communityid type: string id for an experience cloud site, internal, or null. commentid type: string id of the comment. islikedbycurrentuser type: boolean specifies if the context user likes (true) or unlikes (false) the comment. return value type: connectapi.chatterlikepage 653apex reference guide chatterfeeds class updatelikeforfeedelement(communityid, feedelementid, islikedbycurrentuser) like or unlike a feed element. api version 39.0 requires chatter yes signature public static connectapi.chatterlikepage updatelikeforfeedelement(string communityid, string feedelementid, boolean islikedbycurrentuser) parameters communityid type: string id for an experience cloud site, internal, or null. feedelementid type: string id of the feed element. islikedbycurrentuser type: boolean specifies if the context user likes (true) or unlikes (false) the feed element. return value type:" "connectapi.chatterlikepage if the feed element doesn’t support the chatterlikes capability, the return value is connectapi.notfoundexception. updatepinnedfeedelements(communityid, feedtype, subjectid, pin) pin or unpin feed elements to a group or topic feed. api version 41.0 available to guest users 41.0 requires chatter yes 654apex reference guide chatterfeeds class signature public static connectapi.pincapability updatepinnedfeedelements(string communityid, connectapi.feedtype feedtype, string subjectid, connectapi.pincapabilityinput pin) parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype the type of feed. valid values are record and topics. subjectid type: string if feedtype is record, subjectid must be a group id. if feedtype is topics, subjectid must be a topic id. pin type: connectapi.pincapabilityinput a connectapi.pincapabilityinput object indicating the feed element to pin or unpin. return value type: connectapi.pincapability if the feed doesn’t support this capability, the return value is connectapi.notfoundexception. updatestream(communityid, streamid, streaminput) update a chatter feed stream. api version 39.0 requires chatter yes signature public static connectapi.chatterstream updatestream(string communityid, string streamid, connectapi.chatterstreaminput streaminput) parameters communityid type: string id for an experience cloud site, internal, or null. 655apex reference guide chatterfeeds class streamid type: string id of the chatter feed stream. streaminput type: connectapi.chatterstreaminput a connectapi.chatterstreaminput object. return value type: connectapi.chatterstream voteonfeedelementpoll(communityid, feedelementid, mychoiceid) vote on a poll or change your vote on a poll. api version 32.0 requires chatter yes signature public static connectapi.pollcapability voteonfeedelementpoll(string communityid, string feedelementid, string mychoiceid) parameters communityid type: string id for an experience cloud site, internal, or null. feedelementid type: string id of the feed element. mychoiceid type: string id of the poll item you’re voting for. the key prefix for poll items is 09a. return value type: connectapi.pollcapability if the feed element doesn’t support this capability, the return value is connectapi.notfoundexception. 656apex reference guide chatterfeeds class example connectapi.pollcapability poll = connectapi.chatterfeeds.voteonfeedelementpoll(null, '0d5d0000000xzaukaw', '09ad000000000tkmay'); chatterfeeds test methods the following are the test methods for chatterfeeds. all methods are static. for information about using these methods to test your connectapi code, see testing connectapi code. in this section: settestgetfeedelementsfromfeed(communityid, feedtype, result) register a connectapi.feedelementpage object to be returned when getfeedelementsfromfeed is called with matching parameters in a test context. use the get feed method with the same parameters or the code throws an exception. settestgetfeedelementsfromfeed(communityid, feedtype, pageparam, pagesize, sortparam, result) register a connectapi.feedelementpage object to be returned when getfeedelementsfromfeed is called with matching parameters in a test context. use the get feed method with the same parameters or the code throws an exception. settestgetfeedelementsfromfeed(communityid, feedtype, recentcommentcount, density, pageparam, pagesize, sortparam, result) register a connectapi.feedelementpage object to be returned when getfeedelementsfromfeed is called with matching parameters in a test context. use the get feed method with the same parameters or the code throws an exception. settestgetfeedelementsfromfeed(communityid, feedtype, recentcommentcount, density, pageparam, pagesize, sortparam, filter, result)" "register a connectapi.feedelementpage object to be returned when getfeedelementsfromfeed is called with matching parameters in a test context. use the get feed method with the same parameters or the code throws an exception. settestgetfeedelementsfromfeed(communityid, feedtype, recentcommentcount, density, pageparam, pagesize, sortparam, filter, threadedcommentscollapsed, result) register a connectapi.feedelementpage object to be returned when the matching connectapi.getfeedelementsfromfeed method is called in a test context. use the method with the same parameters or you receive an exception. settestgetfeedelementsfromfeed(communityid, feedtype, subjectid, result) register a connectapi.feedelementpage object to be returned when getfeedelementsfromfeed is called with matching parameters in a test context. use the get feed method with the same parameters or the code throws an exception. settestgetfeedelementsfromfeed(communityid, feedtype, subjectid, pageparam, pagesize, sortparam, result) register a connectapi.feedelementpage object to be returned when getfeedelementsfromfeed is called with matching parameters in a test context. use the get feed method with the same parameters or the code throws an exception. settestgetfeedelementsfromfeed(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, sortparam, result) register a connectapi.feedelementpage object to be returned when getfeedelementsfromfeed is called with matching parameters in a test context. use the get feed method with the same parameters or the code throws an exception. settestgetfeedelementsfromfeed(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, sortparam, showinternalonly, result) register a connectapi.feedelementpage object to be returned when getfeedelementsfromfeed is called with matching parameters in a test context. use the get feed method with the same parameters or the code throws an exception. 657apex reference guide chatterfeeds class settestgetfeedelementsfromfeed(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, sortparam, filter, result) register a connectapi.feedelementpage object to be returned when getfeedelementsfromfeed is called with matching parameters in a test context. use the method with the same parameters or the code throws an exception. settestgetfeedelementsfromfeed(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, sortparam, filter, threadedcommentscollapsed, result) register a connectapi.feedelementpage object to be returned when the matching connectapi.getfeedelementsfromfeed method is called in a test context. use the method with the same parameters or you receive an exception. settestgetfeedelementsfromfeed(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, sortparam, customfilter, result) register a connectapi.feedelementpage object to be returned when getfeedelementsfromfeed is called with matching parameters in a test context. use the get feed method with the same parameters or the code throws an exception. settestgetfeedelementsfromfeed(communityid, feedtype, subjectid, recentcommentcount, elementsperbundle, density, pageparam, pagesize, sortparam, showinternalonly, result) register a connectapi.feedelementpage object to be returned when getfeedelementsfromfeed is called with matching parameters in a test context. use the get feed method with the same parameters or the code throws an exception. settestgetfeedelementsfromfeed(communityid, feedtype, subjectid, recentcommentcount, elementsperbundle, density, pageparam, pagesize, sortparam, showinternalonly, filter, result) register a connectapi.feedelementpage object to be returned when getfeedelementsfromfeed is called with matching parameters in a test context. use the get feed method with the same parameters or the code throws an exception. settestgetfeedelementsfromfeed(communityid, feedtype, subjectid, recentcommentcount, elementsperbundle, density, pageparam, pagesize, sortparam, showinternalonly, filter, threadedcommentscollapsed, result) register a connectapi.feedelementpage object to be returned when getfeedelementsfromfeed is called with matching parameters in a test context. use" "the get feed method with the same parameters or the code throws an exception. settestgetfeedelementsfromfeed(communityid, feedtype, subjectid, recentcommentcount, elementsperbundle, density, pageparam, pagesize, sortparam, showinternalonly, customfilter, result) register a connectapi.feedelementpage object to be returned when getfeedelementsfromfeed is called with matching parameters in a test context. use the get feed method with the same parameters or the code throws an exception. settestgetfeedelementsfromfeed(communityid, feedtype, subjectid, recentcommentcount, elementsperbundle, density, pageparam, pagesize, sortparam, showinternalonly, customfilter, threadedcommentscollapsed, result) register a connectapi.feedelementpage object to be returned when the matching connectapi.getfeedelementsfromfeed method is called in a test context. use the method with the same parameters or you receive an exception. settestgetfeedelementsfromfilterfeed(communityid, subjectid, keyprefix, result) register a connectapi.feedelementpage object to be returned when the matching getfeedelements fromfilterfeed method is called in a test context. use the method with the same parameters or the code throws an exception. settestgetfeedelementsfromfilterfeed(communityid, subjectid, keyprefix, pageparam, pagesize, sortparam, result) register a connectapi.feedelementpage object to be returned when the matching getfeedelements fromfilterfeed method is called in a test context. use the method with the same parameters or the code throws an exception. settestgetfeedelementsfromfilterfeed(communityid, subjectid, keyprefix, recentcommentcount, elementsperbundle, density, pageparam, pagesize, sortparam, result) register a connectapi.feedelementpage object to be returned when the matching getfeedelements fromfilterfeed method is called in a test context. use the method with the same parameters or the code throws an exception. 658apex reference guide chatterfeeds class settestgetfeedelementsfromfilterfeedupdatedsince(communityid, subjectid, keyprefix, recentcommentcount, elementsperbundle, density, pageparam, pagesize, updatedsince, result) register a connectapi.feedelementpage object to be returned when the getfeedelementsfromfilterfeedupdatedsince method is called in a test context. settestgetfeedelementsupdatedsince(communityid, feedtype, recentcommentcount, density, pageparam, pagesize, updatedsince, result) register a connectapi.feedelementpage object to be returned when getfeedelementsupdatedsince is called with matching parameters in a test context. use the method with the same parameters or the code throws an exception. settestgetfeedelementsupdatedsince(communityid, feedtype, recentcommentcount, density, pageparam, pagesize, updatedsince, filter, result) register a connectapi.feedelementpage object to be returned when getfeedelementsupdatedsince is called with matching parameters in a test context. use the method with the same parameters or the code throws an exception. settestgetfeedelementsupdatedsince(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, updatedsince, result) register a connectapi.feedelementpage object to be returned when getfeedelementsupdatedsince is called with matching parameters in a test context. use the method with the same parameters or the code throws an exception. settestgetfeedelementsupdatedsince(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, updatedsince, showinternalonly, result) register a connectapi.feedelementpage object to be returned when getfeedelementsupdatedsince is called with matching parameters in a test context. use the method with the same parameters or the code throws an exception. settestgetfeedelementsupdatedsince(communityid, feedtype, subjectid, recentcommentcount, elementsperbundle, density, pageparam, pagesize, updatedsince, filter, result) register a connectapi.feedelementpage object to be returned when getfeedelementsupdatedsince is called with matching parameters in a test context. use the method with the same parameters or the code throws an exception. settestgetfeedelementsupdatedsince(communityid, feedtype, subjectid, recentcommentcount, elementsperbundle, density, pageparam, pagesize, updatedsince, customfilter, result) register a connectapi.feedelement" "page object to be returned when getfeedelementsupdatedsince is called with matching parameters in a test context. use the method with the same parameters or the code throws an exception. settestgetfeedelementsupdatedsince(communityid, feedtype, subjectid, recentcommentcount, elementsperbundle, density, pageparam, pagesize, updatedsince, showinternalonly, result) register a connectapi.feedelementpage object to be returned when getfeedelementsupdatedsince is called with matching parameters in a test context. use the method with the same parameters or the code throws an exception. settestgetfeedelementsupdatedsince(communityid, feedtype, subjectid, recentcommentcount, elementsperbundle, density, pageparam, pagesize, updatedsince, showinternalonly, filter, result) register a connectapi.feedelementpage object to be returned when getfeedelementsupdatedsince is called with matching parameters in a test context. use the method with the same parameters or the code throws an exception. settestgetfeedelementsupdatedsince(communityid, feedtype, subjectid, recentcommentcount, elementsperbundle, density, pageparam, pagesize, updatedsince, showinternalonly, customfilter, result) register a connectapi.feedelementpage object to be returned when getfeedelementsupdatedsince is called with matching parameters in a test context. use the method with the same parameters or the code throws an exception. settestgetrelatedposts(communityid, feedelementid, filter, maxresults, result) register a connectapi.relatedfeedposts object to be returned when the matching connectapi.getrelatedposts(communityid, feedelementid, filter, maxresults) method is called in a test context. use the method with the same parameters or you receive an exception. 659apex reference guide chatterfeeds class settestgettopunansweredquestions(communityid, result) (pilot) register a connectapi.feedelementpage object to be returned when the matching connectapi.gettopunansweredquestions method is called in a test context. use the method with the same parameters or you receive an exception. settestgettopunansweredquestions(communityid, filter, result) (pilot) register a connectapi.feedelementpage object to be returned when the matching connectapi.gettopunansweredquestions method is called in a test context. use the method with the same parameters or you receive an exception. settestgettopunansweredquestions(communityid, pagesize, result) (pilot) register a connectapi.feedelementpage object to be returned when the matching connectapi.gettopunansweredquestions method is called in a test context. use the method with the same parameters or you receive an exception. settestgettopunansweredquestions(communityid, filter, pagesize, result) (pilot) register a connectapi.feedelementpage object to be returned when the matching connectapi.gettopunansweredquestions method is called in a test context. use the method with the same parameters or you receive an exception. settestsearchfeedelements(communityid, q, result) register a connectapi.feedelementpage object to be returned when the matching connectapi.searchfeedelements method is called in a test context. use the method with the same parameters or you receive an exception. settestsearchfeedelements(communityid, q, sortparam, result) register a connectapi.feedelementpage object to be returned when the matching connectapi.searchfeedelements method is called in a test context. use the method with the same parameters or you receive an exception. settestsearchfeedelements(communityid, q, threadedcommentscollapsed, result) register a connectapi.feedelementpage object to be returned when the matching connectapi.searchfeedelements method is called in a test context. use the method with the same parameters or you receive an exception. settestsearchfeedelements(communityid, q, pageparam, pagesize, result) register a connectapi.feedelementpage object to be returned when the matching connectapi.searchfeedelements method is called in a test context. use the method with the same parameters or you receive an exception. settestsearchfeedelements(communityid, q, pageparam, pagesize, sortparam, result) register a connectapi.feedelementpage object to be returned when the matching connectapi.searchfeedelements method is called in a test context. use the method with the same parameters or" "you receive an exception. settestsearchfeedelements(communityid, q, pageparam, pagesize, threadedcommentscollapsed, result) register a connectapi.feedelementpage object to be returned when the matching connectapi.searchfeedelements method is called in a test context. use the method with the same parameters or you receive an exception. settestsearchfeedelements(communityid, q, recentcommentcount, pageparam, pagesize, sortparam, result) register a connectapi.feedelementpage object to be returned when the matching connectapi.searchfeedelements method is called in a test context. use the method with the same parameters or you receive an exception. 660apex reference guide chatterfeeds class settestsearchfeedelementsinfeed(communityid, feedtype, q, result) register a connectapi.feedelementpage object to be returned when the matching connectapi.searchfeedelementsinfeed method is called in a test context. use the method with the same parameters or you receive an exception. settestsearchfeedelementsinfeed(communityid, feedtype, pageparam, pagesize, sortparam, q, result) register a connectapi.feedelementpage object to be returned when the matching connectapi.searchfeedelementsinfeed method is called in a test context. use the method with the same parameters or you receive an exception. settestsearchfeedelementsinfeed(communityid, feedtype, recentcommentcount, density, pageparam, pagesize, sortparam, q, result) register a connectapi.feedelementpage object to be returned when the matching connectapi.searchfeedelementsinfeed method is called in a test context. use the method with the same parameters or you receive an exception. settestsearchfeedelementsinfeed(communityid, feedtype, recentcommentcount, density, pageparam, pagesize, sortparam, q, filter, result) register a connectapi.feedelementpage object to be returned when the matching connectapi.searchfeedelementsinfeed method is called in a test context. use the method with the same parameters or you receive an exception. settestsearchfeedelementsinfeed(communityid, feedtype, subjectid, q, result) register a connectapi.feedelementpage object to be returned when the matching connectapi.searchfeedelementsinfeed method is called in a test context. use the method with the same parameters or you receive an exception. settestsearchfeedelementsinfeed(communityid, feedtype, subjectid, pageparam, pagesize, sortparam, q, result) register a connectapi.feedelementpage object to be returned when the matching connectapi.searchfeedelementsinfeed method is called in a test context. use the method with the same parameters or you receive an exception. settestsearchfeedelementsinfeed(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, sortparam, q, result) register a connectapi.feedelementpage object to be returned when the matching connectapi.searchfeedelementsinfeed method is called in a test context. use the method with the same parameters or you receive an exception. settestsearchfeedelementsinfeed(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, sortparam, q, filter, result) register a connectapi.feedelementpage object to be returned when searchfeedelementsinfeed is called with matching parameters in a test context. use the method with the same parameters or the code throws an exception. settestsearchfeedelementsinfeed(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, sortparam, q, customfilter, result) register a connectapi.feedelementpage object to be returned when the matching connectapi.searchfeedelementsinfeed method is called in a test context. use the method with the same parameters or you receive an exception. settestsearchfeedelementsinfeed(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, sortparam, q, showinternalonly, result) register a connectapi.feedelementpage object to be returned when the matching connectapi.searchfeedelementsinfeed method is called in a test context. use the method with the same parameters or you receive an exception. 661apex reference guide chatterfeeds class settestsearch" "feedelementsinfeed(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, sortparam, q, showinternalonly, filter, result) register a connectapi.feedelementpage object to be returned when the matching connectapi.searchfeedelementsinfeed method is called in a test context. use the method with the same parameters or you receive an exception. settestsearchfeedelementsinfeed(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, sortparam, q, showinternalonly, customfilter, result) register a connectapi.feedelementpage object to be returned when the matching connectapi.searchfeedelementsinfeed method is called in a test context. use the method with the same parameters or you receive an exception. settestsearchfeedelementsinfilterfeed(communityid, subjectid, keyprefix, q, result) register a connectapi.feedelementpage object to be returned when the matching connectapi.searchfeedelementsinfilterfeed method is called in a test context. use the method with the same parameters or you receive an exception. settestsearchfeedelementsinfilterfeed(communityid, subjectid, keyprefix, pageparam, pagesize, sortparam, q, result) register a connectapi.feedelementpage object to be returned when the matching connectapi.searchfeedelementsinfilterfeed method is called in a test context. use the method with the same parameters or you receive an exception. settestsearchfeedelementsinfilterfeed(communityid, subjectid, keyprefix, recentcommentcount, density, pageparam, pagesize, sortparam, q, result) register a connectapi.feedelementpage object to be returned when the matching connectapi.searchfeedelementsinfilterfeed method is called in a test context. use the method with the same parameters or you receive an exception. settestsearchstreams(communityid, q, result) register a connectapi.chatterstreampage object to be returned when the matching connectapi.searchstream(communityid, q) method is called in a test context. use the method with the same parameters or you receive an exception. settestsearchstreams(communityid, q, sortparam, result) register a connectapi.chatterstreampage object to be returned when the matching connectapi.searchstream(communityid, q, sortparam) method is called in a test context. use the method with the same parameters or you receive an exception. settestsearchstreams(communityid, q, pageparam, pagesize, result) register a connectapi.chatterstreampage object to be returned when the matching connectapi.searchstreams(communityid, q, pageparam, pagesize) method is called in a test context. use the method with the same parameters or you receive an exception. settestsearchstreams(communityid, q, pageparam, pagesize, sortparam, result) register a connectapi.chatterstreampage object to be returned when the matching connectapi.searchstreams(communityid, q, pageparam, pagesize, sortparam) method is called in a test context. use the method with the same parameters or you receive an exception. settestsearchstreams(communityid, q, pageparam, pagesize, sortparam, globalscope, result) register a connectapi.chatterstreampage object to be returned when the matching connectapi.searchstreams(communityid, q, pageparam, pagesize, sortparam, globalscope) method is called in a test context. use the method with the same parameters or you receive an exception. 662apex reference guide chatterfeeds class settestgetfeedelementsfromfeed(communityid, feedtype, result) register a connectapi.feedelementpage object to be returned when getfeedelementsfromfeed is called with matching parameters in a test context. use the get feed method with the same parameters or the code throws an exception. api version 31.0 signature public static void settestgetfeedelementsfromfeed(string communityid, connectapi.feedtype feedtype, connectapi.feedelementpage result) parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype type of feed. valid values are company, directmessagemoderation, directmessages, home, moderation" ", and pendingreview. result type: connectapi.feedelementpage object containing test data. return value type: void see also: getfeedelementsfromfeed(communityid, feedtype) apex developer guide: testing connectapi code settestgetfeedelementsfromfeed(communityid, feedtype, pageparam, pagesize, sortparam, result) register a connectapi.feedelementpage object to be returned when getfeedelementsfromfeed is called with matching parameters in a test context. use the get feed method with the same parameters or the code throws an exception. api version 31.0 663apex reference guide chatterfeeds class signature public static void settestgetfeedelementsfromfeed(string communityid, connectapi.feedtype feedtype, string pageparam, integer pagesize, connectapi.feedsortorder sortparam, connectapi.feedelementpage result) parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype the only valid value for this parameter is company. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of feed elements per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.feedsortorder values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. if you pass in null, the default value createddatedesc is used. result type: connectapi.feedelementpage object containing test data. return value type: void see also: getfeedelementsfromfeed(communityid, feedtype, pageparam, pagesize, sortparam) apex developer guide: testing connectapi code 664apex reference guide chatterfeeds class settestgetfeedelementsfromfeed(communityid, feedtype, recentcommentcount, density, pageparam, pagesize, sortparam, result) register a connectapi.feedelementpage object to be returned when getfeedelementsfromfeed is called with matching parameters in a test context. use the get feed method with the same parameters or the code throws an exception. api version 31.0 signature public static void settestgetfeedelementsfromfeed(string communityid, connectapi.feedtype feedtype, integer recentcommentcount, connectapi.feeddensity density, string pageparam, integer pagesize, connectapi.feedsortorder sortparam, connectapi.feedelementpage result) parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype type of feed. valid values are company, directmessagemoderation, directmessages, home, moderation, and pendingreview. recentcommentcount type: integer maximum number of comments to return with each feed element. the default value is 3. density type: connectapi.feeddensity specify the amount of content in a feed. • allupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations. • fewerupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations, but hides some system-generated updates from records. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of feed elements per page. valid values are from 1 through 100. if you pass in null" ", the default size is 25. sortparam type: connectapi.feedsortorder values are: 665apex reference guide chatterfeeds class • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. if you pass in null, the default value createddatedesc is used. result type: connectapi.feedelementpage object containing test data. return value type: void see also: getfeedelementsfromfeed(communityid, feedtype, recentcommentcount, density, pageparam, pagesize, sortparam) apex developer guide: testing connectapi code settestgetfeedelementsfromfeed(communityid, feedtype, recentcommentcount, density, pageparam, pagesize, sortparam, filter, result) register a connectapi.feedelementpage object to be returned when getfeedelementsfromfeed is called with matching parameters in a test context. use the get feed method with the same parameters or the code throws an exception. api version 32.0 signature public static void settestgetfeedelementsfromfeed(string communityid, connectapi.feedtype feedtype, integer recentcommentcount, connectapi.feeddensity density, string pageparam, integer pagesize, connectapi.feedsortorder sortparam, connectapi.feedfilter filter, connectapi.feedelementpage result) parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype the type of feed. the only valid value is home. 666apex reference guide chatterfeeds class recentcommentcount type: integer maximum number of comments to return with each feed element. the default value is 3. density type: connectapi.feeddensity specify the amount of content in a feed. • allupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations. • fewerupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations, but hides some system-generated updates from records. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of feed elements per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.feedsortorder values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. if you pass in null, the default value createddatedesc is used. filter type: connectapi.feedfilter specifies the feed filters. • allquestions—feed elements that are questions. • authoredby—feed elements authored by the user profile owner. this value is valid only for the userprofile feed. • communityscoped—feed elements that are scoped to experience cloud sites. currently, these feed elements have a user or a group parent record. however, other parent record types could be scoped to sites in the future. feed elements that are always visible in all sites are filtered out. this value is valid only for the userprofile feed. • questionswithcandidateanswers—feed elements that are questions that have candidate answers associated with them.this value is valid only for users with the access" "einstein-generated answers permission. • questionswithcandidateanswersreviewedpublished—feed elements that are questions that have candidate answers that have been reviewed or published. this value is valid only for users with the access einstein-generated answers permission. 667apex reference guide chatterfeeds class • read—feed elements that are older than 30 days or are marked as read for the context user. includes existing feed elements when the context user joined the group. this value is valid only for the record feed of a group. • solvedquestions—feed elements that are questions and that have a best answer. • unansweredquestions—feed elements that are questions and that don’t have any answers. • unansweredquestionswithcandidateanswers—feed elements that are questions that don’t have answers but have candidate answers associated with them. this value is valid only for users with the access einstein-generated answers permission. • unread—feed elements that are created in the past 30 days and aren’t marked as read for the context user. this value is valid only for the record feed of a group. • unsolvedquestions—feed elements that are questions and that don’t have a best answer. result type: connectapi.feedelementpage object containing test data. return value type: void see also: getfeedelementsfromfeed(communityid, feedtype, recentcommentcount, density, pageparam, pagesize, sortparam, filter) apex developer guide: testing connectapi code settestgetfeedelementsfromfeed(communityid, feedtype, recentcommentcount, density, pageparam, pagesize, sortparam, filter, threadedcommentscollapsed, result) register a connectapi.feedelementpage object to be returned when the matching connectapi.getfeedelementsfromfeed method is called in a test context. use the method with the same parameters or you receive an exception. api version 44.0 signature public static void settestgetfeedelementsfromfeed(string communityid, connectapi.feedtype feedtype, integer recentcommentcount, connectapi.feeddensity density, string pageparam, integer pagesize, connectapi.feedsortorder sortparam, connectapi.feedfilter filter, boolean threadedcommentscollapsed, connectapi.feedelementpage result) parameters communityid type: string id for an experience cloud site, internal, or null. 668apex reference guide chatterfeeds class feedtype type: connectapi.feedtype the type of feed. the only valid value is home. recentcommentcount type: integer maximum number of comments to return with each feed item. the default value is 3. density type: connectapi.feeddensity specify the amount of content in a feed. • allupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations. • fewerupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations, but hides some system-generated updates from records. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of feed elements per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.feedsortorder values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. if you pass in null, the default value createddatedesc is used. filter type: connectapi.feedfilter specifies the feed filters. • allquestions—feed elements that are questions. • authoredby—feed elements authored by the user profile owner. this value is valid only for the userprofile feed. • community" "scoped—feed elements that are scoped to experience cloud sites. currently, these feed elements have a user or a group parent record. however, other parent record types could be scoped to sites in the future. feed elements that are always visible in all sites are filtered out. this value is valid only for the userprofile feed. • questionswithcandidateanswers—feed elements that are questions that have candidate answers associated with them.this value is valid only for users with the access einstein-generated answers permission. 669apex reference guide chatterfeeds class • questionswithcandidateanswersreviewedpublished—feed elements that are questions that have candidate answers that have been reviewed or published. this value is valid only for users with the access einstein-generated answers permission. • read—feed elements that are older than 30 days or are marked as read for the context user. includes existing feed elements when the context user joined the group. this value is valid only for the record feed of a group. • solvedquestions—feed elements that are questions and that have a best answer. • unansweredquestions—feed elements that are questions and that don’t have any answers. • unansweredquestionswithcandidateanswers—feed elements that are questions that don’t have answers but have candidate answers associated with them. this value is valid only for users with the access einstein-generated answers permission. • unread—feed elements that are created in the past 30 days and aren’t marked as read for the context user. this value is valid only for the record feed of a group. • unsolvedquestions—feed elements that are questions and that don’t have a best answer. threadedcommentscollapsed type: boolean specifies whether to return threaded comments in a collapsed style (true) or not (false). if you pass in null, the default is false. result type: connectapi.feedelementpage object containing test data. return value type: void see also: apex developer guide: testing connectapi code getfeedelementsfromfeed(communityid, feedtype, recentcommentcount, density, pageparam, pagesize, sortparam, filter, threadedcommentscollapsed) settestgetfeedelementsfromfeed(communityid, feedtype, subjectid, result) register a connectapi.feedelementpage object to be returned when getfeedelementsfromfeed is called with matching parameters in a test context. use the get feed method with the same parameters or the code throws an exception. api version 31.0 signature public static void settestgetfeedelementsfromfeed(string communityid, connectapi.feedtype feedtype, string subjectid, connectapi.feedelementpage result) 670apex reference guide chatterfeeds class parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype the feed type. subjectid type: string id of the context user or the alias me. result type: connectapi.feedelementpage object containing test data. return value type: void see also: getfeedelementsfromfeed(communityid, feedtype, subjectid) apex developer guide: testing connectapi code settestgetfeedelementsfromfeed(communityid, feedtype, subjectid, pageparam, pagesize, sortparam, result) register a connectapi.feedelementpage object to be returned when getfeedelementsfromfeed is called with matching parameters in a test context. use the get feed method with the same parameters or the code throws an exception. api version 31.0 signature public static void settestgetfeedelementsfromfeed(string communityid, connectapi.feedtype feedtype, string subjectid, string pageparam, integer pagesize, connectapi.feedsortorder sortparam, connectapi.feedelementpage result) parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype 671apex reference guide chatterfeeds class type of feed. valid values include every connectapi.feedtype except company, directmessagemoderation, directmessages, filter, home, landing, moderation, and pendingreview. subjectid type: string if feedtype is record, subjectid can be any record id, including a group id. if feedtype is streams, subjectid must be a stream id. if feedtype is topics," "subjectid must be a topic id. if feedtype is userprofile, subjectid can be any user id. if the feedtype is any other value, subjectid must be the id of the context user or the alias me. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of feed elements per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.feedsortorder values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. if you pass in null, the default value createddatedesc is used. result type: connectapi.feedelementpage object containing test data. return value type: void see also: getfeedelementsfromfeed(communityid, feedtype, subjectid, pageparam, pagesize, sortparam) apex developer guide: testing connectapi code settestgetfeedelementsfromfeed(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, sortparam, result) register a connectapi.feedelementpage object to be returned when getfeedelementsfromfeed is called with matching parameters in a test context. use the get feed method with the same parameters or the code throws an exception. 672apex reference guide chatterfeeds class api version 31.0 signature public static void settestgetfeedelementsfromfeed(string communityid, connectapi.feedtype feedtype, string subjectid, integer recentcommentcount, connectapi.feeddensity density, string pageparam, integer pagesize, connectapi.feedsortorder sortparam, connectapi.feedelementpage result) parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype type of feed. valid values include every connectapi.feedtype except company, directmessagemoderation, directmessages, filter, home, landing, moderation, and pendingreview. subjectid type: string if feedtype is record, subjectid can be any record id, including a group id. if feedtype is streams, subjectid must be a stream id. if feedtype is topics, subjectid must be a topic id. if feedtype is userprofile, subjectid can be any user id. if the feedtype is any other value, subjectid must be the id of the context user or the alias me. recentcommentcount type: integer maximum number of comments to return with each feed element. the default value is 3. density type: connectapi.feeddensity specify the amount of content in a feed. • allupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations. • fewerupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations, but hides some system-generated updates from records. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of feed elements per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.feedsortorder 673apex reference guide chatterfeeds class values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmod" "ifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. if you pass in null, the default value createddatedesc is used. result type: connectapi.feedelementpage object containing test data. return value type: void see also: getfeedelementsfromfeed(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, sortparam) apex developer guide: testing connectapi code settestgetfeedelementsfromfeed(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, sortparam, showinternalonly, result) register a connectapi.feedelementpage object to be returned when getfeedelementsfromfeed is called with matching parameters in a test context. use the get feed method with the same parameters or the code throws an exception. api version 31.0 signature public static void settestgetfeedelementsfromfeed(string communityid, connectapi.feedtype feedtype, string subjectid, integer recentcommentcount, connectapi.feeddensity density, string pageparam, integer pagesize, connectapi.feedsortorder sortparam, boolean showinternalonly, connectapi.feedelementpage result) parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype 674apex reference guide chatterfeeds class value must be connectapi.feedtype.record. subjectid type: string any record id, including a group id. recentcommentcount type: integer maximum number of comments to return with each feed item. the default value is 3. density type: connectapi.feeddensity specify the amount of content in a feed. • allupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations. • fewerupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations, but hides some system-generated updates from records. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of feed elements per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.feedsortorder values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. if you pass in null, the default value createddatedesc is used. showinternalonly type: boolean specifies whether to show only feed items from internal (non-experience cloud site) users (true), or not (false). the default value is false. result type: connectapi.feedelementpage object containing test data. 675apex reference guide chatterfeeds class return value type: void see also: getfeedelementsfromfeed(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, sortparam, showinternalonly) apex developer guide: testing connectapi code settestgetfeedelementsfromfeed(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, sortparam, filter, result) register a connectapi.feedelementpage object to be returned when getfeedelementsfromfeed is called with matching parameters in a test context. use the method with the same parameters or the code throws an exception. api version 35.0 signature" "public static void settestgetfeedelementsfromfeed(string communityid, connectapi.feedtype feedtype, string subjectid, integer recentcommentcount, connectapi.feeddensity density, string pageparam, integer pagesize, connectapi.feedsortorder sortparam, connectapi.feedfilter filter, connectapi.feedelementpage result) parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype value must be connectapi.feedtype.userprofile. subjectid type: string id of any user. to specify the context user, use the user id or the alias me. recentcommentcount type: integer maximum number of comments to return with each feed element. the default value is 3. density type: connectapi.feeddensity specify the amount of content in a feed. • allupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations. 676apex reference guide chatterfeeds class • fewerupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations, but hides some system-generated updates from records. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of feed elements per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.feedsortorder values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. if you pass in null, the default value createddatedesc is used. filter type: connectapi.feedfilter value must be connectapi.feedfilter.communityscoped. filters the feed to include only feed elements that are scoped to experience cloud sites. feed elements that are always visible in all sites are filtered out. currently, feed elements scoped to sites have a user or a group parent record. however, other parent record types could be scoped to sites in the future. result type: connectapi.feedelementpage object containing test data. return value type: void see also: getfeedelementsfromfeed(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, sortparam, filter) apex developer guide: testing connectapi code 677apex reference guide chatterfeeds class settestgetfeedelementsfromfeed(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, sortparam, filter, threadedcommentscollapsed, result) register a connectapi.feedelementpage object to be returned when the matching connectapi.getfeedelementsfromfeed method is called in a test context. use the method with the same parameters or you receive an exception. api version 44.0 signature public static void settestgetfeedelementsfromfeed(string communityid, connectapi.feedtype feedtype, string subjectid, integer recentcommentcount, connectapi.feeddensity density, string pageparam, integer pagesize, connectapi.feedsortorder sortparam, connectapi.feedfilter filter, boolean threadedcommentscollapsed, connectapi.feedelementpage result) parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype value must be connectapi.feedtype.userprofile. subjectid type: string id of any user. to specify the context user, use the user id or the alias me. recentcommentcount type: integer maximum number of comments to return with each feed element. the default value is 3." "density type: connectapi.feeddensity specify the amount of content in a feed. • allupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations. • fewerupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations, but hides some system-generated updates from records. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. 678apex reference guide chatterfeeds class pagesize type: integer specifies the number of feed elements per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.feedsortorder values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. if you pass in null, the default value createddatedesc is used. filter type: connectapi.feedfilter value must be connectapi.feedfilter.communityscoped. filters the feed to include only feed elements that are scoped to experience cloud sites. feed elements that are always visible in all sites are filtered out. currently, feed elements scoped to sites have a user or a group parent record. however, other parent record types could be scoped to sites in the future. threadedcommentscollapsed type: boolean specifies whether to return threaded comments in a collapsed style (true) or not (false). if you pass in null, the default is false. result type: connectapi.feedelementpage object containing test data. return value type: void see also: apex developer guide: testing connectapi code getfeedelementsfromfeed(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, sortparam, filter, threadedcommentscollapsed) settestgetfeedelementsfromfeed(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, sortparam, customfilter, result) register a connectapi.feedelementpage object to be returned when getfeedelementsfromfeed is called with matching parameters in a test context. use the get feed method with the same parameters or the code throws an exception. 679apex reference guide chatterfeeds class api version 40.0 signature public static void settestgetfeedelementsfromfeed(string communityid, connectapi.feedtype feedtype, string subjectid, integer recentcommentcount, connectapi.feeddensity density, string pageparam, integer pagesize, connectapi.feedsortorder sortparam, string customfilter, connectapi.feedelementpage result) parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype value must be connectapi.feedtype.record. subjectid type: string the id of a case. recentcommentcount type: integer maximum number of comments to return with each feed element. the default value is 3. density type: connectapi.feeddensity specify the amount of content in a feed. • allupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations. • fewerupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations, but hides some system-generated updates from records. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of feed elements per page." "valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.feedsortorder values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. 680apex reference guide chatterfeeds class • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. if you pass in null, the default value createddatedesc is used. customfilter type: string custom filter that applies only to the case feed. see customfeedfilter in the metadata api developer guide for supported values. result type: connectapi.feedelementpage object containing test data. return value type: void see also: getfeedelementsfromfeed(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, sortparam, customfilter) apex developer guide: testing connectapi code settestgetfeedelementsfromfeed(communityid, feedtype, subjectid, recentcommentcount, elementsperbundle, density, pageparam, pagesize, sortparam, showinternalonly, result) register a connectapi.feedelementpage object to be returned when getfeedelementsfromfeed is called with matching parameters in a test context. use the get feed method with the same parameters or the code throws an exception. api version 31.0 signature public static void settestgetfeedelementsfromfeed(string communityid, connectapi.feedtype feedtype, string subjectid, integer recentcommentcount, integer elementsperbundle, connectapi.feeddensity density, string pageparam, integer pagesize, connectapi.feedsortorder sortparam, boolean showinternalonly, connectapi.feedelementpage result) parameters communityid type: string id for an experience cloud site, internal, or null. 681apex reference guide chatterfeeds class feedtype type: connectapi.feedtype value must be connectapi.feedtype.record. subjectid type: string any record id, including a group id. recentcommentcount type: integer maximum number of comments to return with each feed item. the default value is 3. elementsperbundle type: integer maximum number of feed elements per bundle. the default and maximum value is 10. density type: connectapi.feeddensity specify the amount of content in a feed. • allupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations. • fewerupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations, but hides some system-generated updates from records. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of feed elements per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.feedsortorder values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. if you pass in null, the default value createddatedesc is used. showinternalonly type: boolean specifies whether to show only feed items from internal (non-experience cloud site) users (true), or not (false). the default value is false. 682" "apex reference guide chatterfeeds class result type: connectapi.feedelementpage object containing test data. return value type: void see also: getfeedelementsfromfeed(communityid, feedtype, subjectid, recentcommentcount, elementsperbundle, density, pageparam, pagesize, sortparam, showinternalonly) apex developer guide: testing connectapi code settestgetfeedelementsfromfeed(communityid, feedtype, subjectid, recentcommentcount, elementsperbundle, density, pageparam, pagesize, sortparam, showinternalonly, filter, result) register a connectapi.feedelementpage object to be returned when getfeedelementsfromfeed is called with matching parameters in a test context. use the get feed method with the same parameters or the code throws an exception. api version 32.0 signature public static void settestgetfeedelementsfromfeed(string communityid, connectapi.feedtype feedtype, string subjectid, integer recentcommentcount, integer elementsperbundle, connectapi.feeddensity density, string pageparam, integer pagesize, connectapi.feedsortorder sortparam, boolean showinternalonly, connectapi.feedfilter filter, connectapi.feedelementpage result) parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype value must be connectapi.feedtype.record. subjectid type: string any record id, including a group id. recentcommentcount type: integer maximum number of comments to return with each feed item. the default value is 3. 683apex reference guide chatterfeeds class elementsperbundle type: integer maximum number of feed elements per bundle. the default and maximum value is 10. density type: connectapi.feeddensity specify the amount of content in a feed. • allupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations. • fewerupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations, but hides some system-generated updates from records. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of feed elements per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.feedsortorder values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. if you pass in null, the default value createddatedesc is used. showinternalonly type: boolean specifies whether to show only feed items from internal (non-experience cloud site) users (true), or not (false). the default value is false. filter type: connectapi.feedfilter specifies the feed filters. • allquestions—feed elements that are questions. • authoredby—feed elements authored by the user profile owner. this value is valid only for the userprofile feed. • communityscoped—feed elements that are scoped to experience cloud sites. currently, these feed elements have a user or a group parent record. however, other parent record types could be scoped to sites in the future. feed elements that are always visible in all sites are filtered out. this value is valid only for the userprofile feed. 684apex reference guide chatterfeeds class • questionswithcandidateanswers—feed elements that are questions that have candidate answers associated with them.this value is valid only for users with the access einstein-generated answers permission. • questionswithcandidateanswersreviewedpublished—feed elements that are questions that have candidate answers that have been reviewed or" "published. this value is valid only for users with the access einstein-generated answers permission. • read—feed elements that are older than 30 days or are marked as read for the context user. includes existing feed elements when the context user joined the group. this value is valid only for the record feed of a group. • solvedquestions—feed elements that are questions and that have a best answer. • unansweredquestions—feed elements that are questions and that don’t have any answers. • unansweredquestionswithcandidateanswers—feed elements that are questions that don’t have answers but have candidate answers associated with them. this value is valid only for users with the access einstein-generated answers permission. • unread—feed elements that are created in the past 30 days and aren’t marked as read for the context user. this value is valid only for the record feed of a group. • unsolvedquestions—feed elements that are questions and that don’t have a best answer. result type: connectapi.feedelementpage object containing test data. return value type: void see also: getfeedelementsfromfeed(communityid, feedtype, subjectid, recentcommentcount, elementsperbundle, density, pageparam, pagesize, sortparam, showinternalonly, filter) apex developer guide: testing connectapi code settestgetfeedelementsfromfeed(communityid, feedtype, subjectid, recentcommentcount, elementsperbundle, density, pageparam, pagesize, sortparam, showinternalonly, filter, threadedcommentscollapsed, result) register a connectapi.feedelementpage object to be returned when getfeedelementsfromfeed is called with matching parameters in a test context. use the get feed method with the same parameters or the code throws an exception. api version 44.0 signature public static void settestgetfeedelementsfromfeed(string communityid, connectapi.feedtype feedtype, string subjectid, integer recentcommentcount, integer elementsperbundle, connectapi.feeddensity density, string pageparam, integer pagesize, connectapi.feedsortorder sortparam, boolean showinternalonly, connectapi.feedfilter filter, boolean threadedcommentscollapsed, connectapi.feedelementpage result) 685apex reference guide chatterfeeds class parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype value must be connectapi.feedtype.record. subjectid type: string any record id, including a group id. recentcommentcount type: integer maximum number of comments to return with each feed item. the default value is 3. elementsperbundle type: integer maximum number of feed elements per bundle. the default and maximum value is 10. density type: connectapi.feeddensity specify the amount of content in a feed. • allupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations. • fewerupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations, but hides some system-generated updates from records. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of feed elements per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.feedsortorder values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. 686apex reference guide chatterfeeds class if you pass in null, the default value createddatedesc is used. showinternalonly type: boolean spec" "ifies whether to show only feed items from internal (non-experience cloud site) users (true), or not (false). the default value is false. filter type: connectapi.feedfilter specifies the feed filters. • allquestions—feed elements that are questions. • authoredby—feed elements authored by the user profile owner. this value is valid only for the userprofile feed. • communityscoped—feed elements that are scoped to experience cloud sites. currently, these feed elements have a user or a group parent record. however, other parent record types could be scoped to sites in the future. feed elements that are always visible in all sites are filtered out. this value is valid only for the userprofile feed. • questionswithcandidateanswers—feed elements that are questions that have candidate answers associated with them.this value is valid only for users with the access einstein-generated answers permission. • questionswithcandidateanswersreviewedpublished—feed elements that are questions that have candidate answers that have been reviewed or published. this value is valid only for users with the access einstein-generated answers permission. • read—feed elements that are older than 30 days or are marked as read for the context user. includes existing feed elements when the context user joined the group. this value is valid only for the record feed of a group. • solvedquestions—feed elements that are questions and that have a best answer. • unansweredquestions—feed elements that are questions and that don’t have any answers. • unansweredquestionswithcandidateanswers—feed elements that are questions that don’t have answers but have candidate answers associated with them. this value is valid only for users with the access einstein-generated answers permission. • unread—feed elements that are created in the past 30 days and aren’t marked as read for the context user. this value is valid only for the record feed of a group. • unsolvedquestions—feed elements that are questions and that don’t have a best answer. threadedcommentscollapsed type: boolean specifies whether to return threaded comments in a collapsed style (true) or not (false). if you pass in null, the default is false. result type: connectapi.feedelementpage object containing test data. 687apex reference guide chatterfeeds class return value type: void see also: getfeedelementsfromfeed(communityid, feedtype, subjectid, recentcommentcount, elementsperbundle, density, pageparam, pagesize, sortparam, showinternalonly, filter, threadedcommentscollapsed) apex developer guide: testing connectapi code settestgetfeedelementsfromfeed(communityid, feedtype, subjectid, recentcommentcount, elementsperbundle, density, pageparam, pagesize, sortparam, showinternalonly, customfilter, result) register a connectapi.feedelementpage object to be returned when getfeedelementsfromfeed is called with matching parameters in a test context. use the get feed method with the same parameters or the code throws an exception. api version 40.0 signature public static void settestgetfeedelementsfromfeed(string communityid, connectapi.feedtype feedtype, string subjectid, integer recentcommentcount, integer elementsperbundle, connectapi.feeddensity density, string pageparam, integer pagesize, connectapi.feedsortorder sortparam, boolean showinternalonly, string customfilter, connectapi.feedelementpage result) parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype value must be connectapi.feedtype.record. subjectid type: string the id of a case. recentcommentcount type: integer maximum number of comments to return with each feed item. the default value is 3. elementsperbundle type: integer maximum number of feed elements per bundle. the default and maximum value is 10. 688apex reference guide chatterfeeds class density type: connectapi.feeddensity specify the amount of content in a feed. • allupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations. • fewerupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations, but hides some system-generated updates from records. pageparam type: string" "page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of feed elements per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.feedsortorder values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. if you pass in null, the default value createddatedesc is used. showinternalonly type: boolean specifies whether to show only feed items from internal (non-experience cloud site) users (true), or not (false). the default value is false. customfilter type: string custom filter that applies only to the case feed. see customfeedfilter in the metadata api developer guide for supported values. result type: connectapi.feedelementpage object containing test data. 689apex reference guide chatterfeeds class return value type: void see also: getfeedelementsfromfeed(communityid, feedtype, subjectid, recentcommentcount, elementsperbundle, density, pageparam, pagesize, sortparam, showinternalonly, customfilter) apex developer guide: testing connectapi code settestgetfeedelementsfromfeed(communityid, feedtype, subjectid, recentcommentcount, elementsperbundle, density, pageparam, pagesize, sortparam, showinternalonly, customfilter, threadedcommentscollapsed, result) register a connectapi.feedelementpage object to be returned when the matching connectapi.getfeedelementsfromfeed method is called in a test context. use the method with the same parameters or you receive an exception. api version 44.0 signature public static void settestgetfeedelementsfromfeed(string communityid, connectapi.feedtype feedtype, string subjectid, integer recentcommentcount, integer elementsperbundle, connectapi.feeddensity density, string pageparam, integer pagesize, connectapi.feedsortorder sortparam, boolean showinternalonly, string customfilter, boolean threadedcommentscollapsed, connectapi.feedelementpage result) parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype value must be connectapi.feedtype.record. subjectid type: string the id of a case. recentcommentcount type: integer maximum number of comments to return with each feed item. the default value is 3. elementsperbundle type: integer maximum number of feed elements per bundle. the default and maximum value is 10. 690apex reference guide chatterfeeds class density type: connectapi.feeddensity specify the amount of content in a feed. • allupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations. • fewerupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations, but hides some system-generated updates from records. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of feed elements per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.feedsortorder values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—s" "orts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. if you pass in null, the default value createddatedesc is used. showinternalonly type: boolean specifies whether to show only feed items from internal (non-experience cloud site) users (true), or not (false). the default value is false. customfilter type: string custom filter that applies only to the case feed. see customfeedfilter in the metadata api developer guide for supported values. threadedcommentscollapsed type: boolean specifies whether to return threaded comments in a collapsed style (true) or not (false). if you pass in null, the default is false. result type: connectapi.feedelementpage object containing test data. 691apex reference guide chatterfeeds class return value type: void see also: apex developer guide: testing connectapi code getfeedelementsfromfeed(communityid, feedtype, subjectid, recentcommentcount, elementsperbundle, density, pageparam, pagesize, sortparam, showinternalonly, customfilter, threadedcommentscollapsed) settestgetfeedelementsfromfilterfeed(communityid, subjectid, keyprefix, result) register a connectapi.feedelementpage object to be returned when the matching getfeedelements fromfilterfeed method is called in a test context. use the method with the same parameters or the code throws an exception. api version 31.0 signature public static void settestgetfeedelementsfromfilterfeed(string communityid, string subjectid, string keyprefix, connectapi.feedelementpage result) parameters communityid type: string id for an experience cloud site, internal, or null. subjectid type: string id of the context user or the alias me. keyprefix type: string a key prefix that specifies record type. a key prefix is the first three characters in the object id, which specifies the object type. for example, user objects have a prefix of 005 and group objects have a prefix of 0f9. result type: connectapi.feedelementpage object containing test data. 692apex reference guide chatterfeeds class return value type: void see also: getfeedelementsfromfilterfeed(communityid, subjectid, keyprefix) apex developer guide: testing connectapi code settestgetfeedelementsfromfilterfeed(communityid, subjectid, keyprefix, pageparam, pagesize, sortparam, result) register a connectapi.feedelementpage object to be returned when the matching getfeedelements fromfilterfeed method is called in a test context. use the method with the same parameters or the code throws an exception. api version 31.0 signature public static void settestgetfeedelementsfromfilterfeed(string communityid, string subjectid, string keyprefix, string pageparam, integer pagesize, connectapi.feedsortorder sortparam, connectapi.feedelementpage result) parameters communityid type: string id for an experience cloud site, internal, or null. subjectid type: string id of the context user or the alias me. keyprefix type: string a key prefix that specifies record type. a key prefix is the first three characters in the object id, which specifies the object type. for example, user objects have a prefix of 005 and group objects have a prefix of 0f9. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of feed elements per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.feedsortorder 693apex reference guide chatterfeeds class values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. •" "mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. if you pass in null, the default value createddatedesc is used. result type: connectapi.feedelementpage object containing test data. return value type: void see also: getfeedelementsfromfilterfeed(communityid, subjectid, keyprefix, pageparam, pagesize, sortparam) apex developer guide: testing connectapi code settestgetfeedelementsfromfilterfeed(communityid, subjectid, keyprefix, recentcommentcount, elementsperbundle, density, pageparam, pagesize, sortparam, result) register a connectapi.feedelementpage object to be returned when the matching getfeedelements fromfilterfeed method is called in a test context. use the method with the same parameters or the code throws an exception. api version 31.0 signature public static void settestgetfeedelementsfromfilterfeed(string communityid, string subjectid, string keyprefix, integer recentcommentcount, integer elementsperbundle, connectapi.feeddensity density, string pageparam, integer pagesize, connectapi.feedsortorder sortparam, connectapi.feedelementpage result) parameters communityid type: string id for an experience cloud site, internal, or null. subjectid type: string 694apex reference guide chatterfeeds class id of the context user or the alias me. keyprefix type: string a key prefix that specifies record type. a key prefix is the first three characters in the object id, which specifies the object type. for example, user objects have a prefix of 005 and group objects have a prefix of 0f9. recentcommentcount type: integer maximum number of comments to return with each feed element. the default value is 3. elementsperbundle type: integer maximum number of feed elements per bundle. the default and maximum value is 10. density type: connectapi.feeddensity specify the amount of content in a feed. • allupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations. • fewerupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations, but hides some system-generated updates from records. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of feed elements per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.feedsortorder values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. if you pass in null, the default value createddatedesc is used. result type: connectapi.feedelementpage object containing test data. 695apex reference guide chatterfeeds class return value type: void see also: getfeedelementsfromfilterfeed(communityid, subjectid, keyprefix, recentcommentcount, elementsperbundle, density, pageparam, pagesize, sortparam) apex developer guide: testing connectapi code settestgetfeedelementsfromfilterfeedupdatedsince(communityid, subjectid, keyprefix, recentcommentcount, elementsperbundle, density, pageparam, pagesize, updatedsince, result) register a connectapi.feedelementpage object to be returned when the getfeedelementsfromfilterfeedupdatedsince method is called in a test context. api version 31.0 signature" "public static void settestgetfeedelementsfromfilterfeedupdatedsince(string communityid, string subjectid, string keyprefix, integer recentcommentcount, integer elementsperbundle, connectapi.feeddensity density, string pageparam, integer pagesize, string updatedsince, connectapi.feedelementpage result) parameters communityid type: string id for an experience cloud site, internal, or null. subjectid type: string id of the context user or the alias me. keyprefix type: string a key prefix that specifies record type. a key prefix is the first three characters in the object id, which specifies the object type. for example, user objects have a prefix of 005 and group objects have a prefix of 0f9. recentcommentcount type: integer maximum number of comments to return with each feed element. the default value is 3. elementsperbundle type: integer maximum number of feed elements per bundle. the default and maximum value is 10. 696apex reference guide chatterfeeds class density type: connectapi.feeddensity specify the amount of content in a feed. • allupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations. • fewerupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations, but hides some system-generated updates from records. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of feed elements per page. valid values are from 1 through 100. if you pass in null, the default size is 25. updatedsince type: string opaque token defining the modification timestamp of the feed and the sort order. the updatedsince parameter doesn’t return feed elements that are created in the same second as the call. result type: connectapi.feedelementpage object containing test data. return value type: void see also: getfeedelementsfromfilterfeedupdatedsince(communityid, subjectid, keyprefix, recentcommentcount, elementsperbundle, density, pageparam, pagesize, updatedsince) apex developer guide: testing connectapi code settestgetfeedelementsupdatedsince(communityid, feedtype, recentcommentcount, density, pageparam, pagesize, updatedsince, result) register a connectapi.feedelementpage object to be returned when getfeedelementsupdatedsince is called with matching parameters in a test context. use the method with the same parameters or the code throws an exception. api version 31.0 697apex reference guide chatterfeeds class signature public static void settestgetfeedelementsupdatedsince(string communityid, connectapi.feedtype feedtype, integer recentcommentcount, connectapi.feeddensity density, string pageparam, integer pagesize, string updatedsince, connectapi.feedelementpage result) parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype type of feed. valid values are company, directmessagemoderation, home, moderation, and pendingreview. recentcommentcount type: integer maximum number of comments to return with each feed element. the default value is 3. density type: connectapi.feeddensity specify the amount of content in a feed. • allupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations. • fewerupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations, but hides some system-generated updates from records. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of feed elements per page. valid values are from 1 through 100. if you pass in null, the default size is 25. updatedsince type: string an opaque token containing information about the last modified date of the feed. do not construct this token. ret" "rieve this token from the updatestoken property of the connectapi.feedelementpage response body. the updatedsince parameter doesn’t return feed elements that are created in the same second as the call. result type: connectapi.feedelementpage object containing test data. 698apex reference guide chatterfeeds class return value type: void see also: getfeedelementsupdatedsince(communityid, feedtype, recentcommentcount, density, pageparam, pagesize, updatedsince) apex developer guide: testing connectapi code settestgetfeedelementsupdatedsince(communityid, feedtype, recentcommentcount, density, pageparam, pagesize, updatedsince, filter, result) register a connectapi.feedelementpage object to be returned when getfeedelementsupdatedsince is called with matching parameters in a test context. use the method with the same parameters or the code throws an exception. api version 32.0 signature public static void settestgetfeedelementsupdatedsince(string communityid, connectapi.feedtype feedtype, integer recentcommentcount, connectapi.feeddensity density, string pageparam, integer pagesize, string updatedsince, connectapi.feedfilter filter, connectapi.feedelementpage result) parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype type of feed. valid values are company, directmessagemoderation, directmessages, home, moderation, and pendingreview. recentcommentcount type: integer maximum number of comments to return with each feed element. the default value is 3. density type: connectapi.feeddensity specify the amount of content in a feed. • allupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations. • fewerupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations, but hides some system-generated updates from records. pageparam type: string 699apex reference guide chatterfeeds class page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of feed elements per page. valid values are from 1 through 100. if you pass in null, the default size is 25. updatedsince type: string an opaque token containing information about the last modified date of the feed. do not construct this token. retrieve this token from the updatestoken property of the connectapi.feedelementpage response body. the updatedsince parameter doesn’t return feed elements that are created in the same second as the call. filter type: connectapi.feedfilter specifies the feed filters. • allquestions—feed elements that are questions. • authoredby—feed elements authored by the user profile owner. this value is valid only for the userprofile feed. • communityscoped—feed elements that are scoped to experience cloud sites. currently, these feed elements have a user or a group parent record. however, other parent record types could be scoped to sites in the future. feed elements that are always visible in all sites are filtered out. this value is valid only for the userprofile feed. • questionswithcandidateanswers—feed elements that are questions that have candidate answers associated with them.this value is valid only for users with the access einstein-generated answers permission. • questionswithcandidateanswersreviewedpublished—feed elements that are questions that have candidate answers that have been reviewed or published. this value is valid only for users with the access einstein-generated answers permission. • read—feed elements that are older than 30 days or are marked as read for the context user. includes existing feed elements when the context user joined the group. this value is valid only for the record feed of a group. • solvedquestions—feed elements that are questions and that have a best answer. • unansweredquestions—feed elements that are questions and that don’t have any answers. • unansweredquestionswithcandidateanswers—feed elements that are questions that don’t have answers but have candidate answers associated with them. this value is valid only for users with the access einstein-generated answers permission. • unread—feed elements that are created in the past 30 days and aren" "’t marked as read for the context user. this value is valid only for the record feed of a group. • unsolvedquestions—feed elements that are questions and that don’t have a best answer. result type: connectapi.feedelementpage object containing test data. 700apex reference guide chatterfeeds class return value type: void see also: getfeedelementsupdatedsince(communityid, feedtype, recentcommentcount, density, pageparam, pagesize, updatedsince, filter) apex developer guide: testing connectapi code settestgetfeedelementsupdatedsince(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, updatedsince, result) register a connectapi.feedelementpage object to be returned when getfeedelementsupdatedsince is called with matching parameters in a test context. use the method with the same parameters or the code throws an exception. api version 31.0 signature public static void settestgetfeedelementsupdatedsince(string communityid, connectapi.feedtype feedtype, string subjectid, integer recentcommentcount, connectapi.feeddensity density, string pageparam, integer pagesize, string updatedsince, connectapi.feedelementpage result) parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype one of these values: • files • groups • news • people • record subjectid type: string if feedtype is connectapi.record, subjectid can be any record id, including a group id. otherwise, it must be the context user or the alias me. recentcommentcount type: integer maximum number of comments to return with each feed item. the default value is 3. 701apex reference guide chatterfeeds class density type: connectapi.feeddensity specify the amount of content in a feed. • allupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations. • fewerupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations, but hides some system-generated updates from records. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of feed elements per page. valid values are from 1 through 100. if you pass in null, the default size is 25. updatedsince type: string an opaque token containing information about the last modified date of the feed. do not construct this token. retrieve this token from the updatestoken property of the connectapi.feedelementpage response body. the updatedsince parameter doesn’t return feed elements that are created in the same second as the call. result type: connectapi.feedelementpage object containing test data. return value type: void see also: getfeedelementsupdatedsince(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, updatedsince) apex developer guide: testing connectapi code settestgetfeedelementsupdatedsince(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, updatedsince, showinternalonly, result) register a connectapi.feedelementpage object to be returned when getfeedelementsupdatedsince is called with matching parameters in a test context. use the method with the same parameters or the code throws an exception. api version 31.0 702apex reference guide chatterfeeds class signature public static void settestgetfeedelementsupdatedsince(string communityid, connectapi.feedtype feedtype, string subjectid, integer recentcommentcount, connectapi.feeddensity density, string pageparam, integer pagesize, string updatedsince, boolean showinternalonly, connectapi.feedelementpage result) parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype value must be connectapi.feedtype.record. subjectid type: string any record id, including a group id. recentcommentcount type: integer maximum number of comments to" "return with each feed element. the default value is 3. density type: connectapi.feeddensity specify the amount of content in a feed. • allupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations. • fewerupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations, but hides some system-generated updates from records. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of feed elements per page. valid values are from 1 through 100. if you pass in null, the default size is 25. updatedsince type: string an opaque token containing information about the last modified date of the feed. do not construct this token. retrieve this token from the updatestoken property of the connectapi.feedelementpage response body. the updatedsince parameter doesn’t return feed elements that are created in the same second as the call. showinternalonly type: boolean 703apex reference guide chatterfeeds class specifies whether to show only feed elements from internal (non-experience cloud site) users (true), or not (false). the default value is false. result type: connectapi.feedelementpage object containing test data. return value type: void see also: getfeedelementsupdatedsince(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, updatedsince, showinternalonly) apex developer guide: testing connectapi code settestgetfeedelementsupdatedsince(communityid, feedtype, subjectid, recentcommentcount, elementsperbundle, density, pageparam, pagesize, updatedsince, filter, result) register a connectapi.feedelementpage object to be returned when getfeedelementsupdatedsince is called with matching parameters in a test context. use the method with the same parameters or the code throws an exception. api version 35.0 signature public static void settestgetfeedelementsupdatedsince(string communityid, connectapi.feedtype feedtype, string subjectid, integer recentcommentcount, integer elementsperbundle, connectapi.feeddensity density, string pageparam, integer pagesize, string updatedsince, connectapi.feedfilter filter, connectapi.feedelementpage result) parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype value must be connectapi.feedtype.userprofile. subjectid type: string id of any user. to specify the context user, use the user id or the alias me. recentcommentcount type: integer 704apex reference guide chatterfeeds class maximum number of comments to return with each feed element. the default value is 3. elementsperbundle type: integer maximum number of feed elements per bundle. the default and maximum value is 10. density type: connectapi.feeddensity specify the amount of content in a feed. • allupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations. • fewerupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations, but hides some system-generated updates from records. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of feed elements per page. valid values are from 1 through 100. if you pass in null, the default size is 25. updatedsince type: string opaque token defining the modification timestamp of the feed and the sort order. the updatedsince parameter doesn’t return feed elements that are created in the same second as the call. filter type: connectapi.feedfilter value must be connectapi.feedfilter.communityscoped. filters the feed to include only feed elements that are scoped to experience cloud sites. feed elements that are always visible in all sites are filtered out. currently," "feed elements scoped to sites have a user or a group parent record. however, other parent record types could be scoped to sites in the future. result type: connectapi.feedelementpage object containing test data. return value type: void see also: getfeedelementsupdatedsince(communityid, feedtype, subjectid, recentcommentcount, elementsperbundle, density, pageparam, pagesize, updatedsince, filter) apex developer guide: testing connectapi code 705apex reference guide chatterfeeds class settestgetfeedelementsupdatedsince(communityid, feedtype, subjectid, recentcommentcount, elementsperbundle, density, pageparam, pagesize, updatedsince, customfilter, result) register a connectapi.feedelementpage object to be returned when getfeedelementsupdatedsince is called with matching parameters in a test context. use the method with the same parameters or the code throws an exception. api version 40.0 signature public static void settestgetfeedelementsupdatedsince(string communityid, connectapi.feedtype feedtype, string subjectid, integer recentcommentcount, integer elementsperbundle, connectapi.feeddensity density, string pageparam, integer pagesize, string updatedsince, string customfilter, connectapi.feedelementpage result) parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype value must be connectapi.feedtype.record. subjectid type: string the id of a case. recentcommentcount type: integer maximum number of comments to return with each feed element. the default value is 3. elementsperbundle type: integer maximum number of feed elements per bundle. the default and maximum value is 10. density type: connectapi.feeddensity specify the amount of content in a feed. • allupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations. • fewerupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations, but hides some system-generated updates from records. pageparam type: string 706apex reference guide chatterfeeds class page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of feed elements per page. valid values are from 1 through 100. if you pass in null, the default size is 25. updatedsince type: string opaque token defining the modification timestamp of the feed and the sort order. the updatedsince parameter doesn’t return feed elements that are created in the same second as the call. customfilter type: string custom filter that applies only to the case feed. see customfeedfilter in the metadata api developer guide for supported values. result type: connectapi.feedelementpage object containing test data. return value type: void see also: getfeedelementsupdatedsince(communityid, feedtype, subjectid, recentcommentcount, elementsperbundle, density, pageparam, pagesize, updatedsince, customfilter) apex developer guide: testing connectapi code settestgetfeedelementsupdatedsince(communityid, feedtype, subjectid, recentcommentcount, elementsperbundle, density, pageparam, pagesize, updatedsince, showinternalonly, result) register a connectapi.feedelementpage object to be returned when getfeedelementsupdatedsince is called with matching parameters in a test context. use the method with the same parameters or the code throws an exception. api version 31.0 signature public static void settestgetfeedelementsupdatedsince(string communityid, connectapi.feedtype feedtype, string subjectid, integer recentcommentcount, integer elementsperbundle, connectapi.feeddensity density, string pageparam, integer pagesize, string updatedsince, boolean showinternalonly, connectapi.feedelementpage result) 707apex reference guide chatterfeeds class parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype value must be connectapi.feedtype.record. subjectid" "type: string any record id, including a group id. recentcommentcount type: integer maximum number of comments to return with each feed element. the default value is 3. elementsperbundle type: integer maximum number of feed elements per bundle. the default and maximum value is 10. density type: connectapi.feeddensity specify the amount of content in a feed. • allupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations. • fewerupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations, but hides some system-generated updates from records. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of feed elements per page. valid values are from 1 through 100. if you pass in null, the default size is 25. updatedsince type: string an opaque token containing information about the last modified date of the feed. do not construct this token. retrieve this token from the updatestoken property of the connectapi.feedelementpage response body. the updatedsince parameter doesn’t return feed elements that are created in the same second as the call. showinternalonly type: boolean specifies whether to show only feed elements from internal (non-experience cloud site) users (true), or not (false). the default value is false. result type: connectapi.feedelementpage 708apex reference guide chatterfeeds class object containing test data. return value type: void see also: getfeedelementsupdatedsince(communityid, feedtype, subjectid, recentcommentcount, elementsperbundle, density, pageparam, pagesize, updatedsince, showinternalonly) apex developer guide: testing connectapi code settestgetfeedelementsupdatedsince(communityid, feedtype, subjectid, recentcommentcount, elementsperbundle, density, pageparam, pagesize, updatedsince, showinternalonly, filter, result) register a connectapi.feedelementpage object to be returned when getfeedelementsupdatedsince is called with matching parameters in a test context. use the method with the same parameters or the code throws an exception. api version 32.0 signature public static void settestgetfeedelementsupdatedsince(string communityid, connectapi.feedtype feedtype, string subjectid, integer recentcommentcount, integer elementsperbundle, connectapi.feeddensity density, string pageparam, integer pagesize, string updatedsince, boolean showinternalonly, connectapi.feedfilter filter, connectapi.feedelementpage result) parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype value must be connectapi.feedtype.record. subjectid type: string any record id, including a group id. recentcommentcount type: integer maximum number of comments to return with each feed element. the default value is 3. elementsperbundle type: integer 709apex reference guide chatterfeeds class maximum number of feed elements per bundle. the default and maximum value is 10. density type: connectapi.feeddensity specify the amount of content in a feed. • allupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations. • fewerupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations, but hides some system-generated updates from records. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of feed elements per page. valid values are from 1 through 100. if you pass in null, the default size is 25. updatedsince type: string an opaque token containing information about the last modified date of the feed. do not construct this token. retrieve this token from the updatestoken property of the connectapi.feedelementpage response body." "the updatedsince parameter doesn’t return feed elements that are created in the same second as the call. showinternalonly type: boolean specifies whether to show only feed elements from internal (non-experience cloud site) users (true), or not (false). the default value is false. filter type: connectapi.feedfilter specifies the feed filters. • allquestions—feed elements that are questions. • authoredby—feed elements authored by the user profile owner. this value is valid only for the userprofile feed. • communityscoped—feed elements that are scoped to experience cloud sites. currently, these feed elements have a user or a group parent record. however, other parent record types could be scoped to sites in the future. feed elements that are always visible in all sites are filtered out. this value is valid only for the userprofile feed. • questionswithcandidateanswers—feed elements that are questions that have candidate answers associated with them.this value is valid only for users with the access einstein-generated answers permission. • questionswithcandidateanswersreviewedpublished—feed elements that are questions that have candidate answers that have been reviewed or published. this value is valid only for users with the access einstein-generated answers permission. • read—feed elements that are older than 30 days or are marked as read for the context user. includes existing feed elements when the context user joined the group. this value is valid only for the record feed of a group. • solvedquestions—feed elements that are questions and that have a best answer. • unansweredquestions—feed elements that are questions and that don’t have any answers. 710apex reference guide chatterfeeds class • unansweredquestionswithcandidateanswers—feed elements that are questions that don’t have answers but have candidate answers associated with them. this value is valid only for users with the access einstein-generated answers permission. • unread—feed elements that are created in the past 30 days and aren’t marked as read for the context user. this value is valid only for the record feed of a group. • unsolvedquestions—feed elements that are questions and that don’t have a best answer. result type: connectapi.feedelementpage object containing test data. return value type: void see also: getfeedelementsupdatedsince(communityid, feedtype, subjectid, recentcommentcount, elementsperbundle, density, pageparam, pagesize, updatedsince, showinternalonly, filter) apex developer guide: testing connectapi code settestgetfeedelementsupdatedsince(communityid, feedtype, subjectid, recentcommentcount, elementsperbundle, density, pageparam, pagesize, updatedsince, showinternalonly, customfilter, result) register a connectapi.feedelementpage object to be returned when getfeedelementsupdatedsince is called with matching parameters in a test context. use the method with the same parameters or the code throws an exception. api version 40.0 signature public static void settestgetfeedelementsupdatedsince(string communityid, connectapi.feedtype feedtype, string subjectid, integer recentcommentcount, integer elementsperbundle, connectapi.feeddensity density, string pageparam, integer pagesize, string updatedsince, boolean showinternalonly, string customfilter, connectapi.feedelementpage result) parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype value must be connectapi.feedtype.record. 711apex reference guide chatterfeeds class subjectid type: string the id of a case. recentcommentcount type: integer maximum number of comments to return with each feed element. the default value is 3. elementsperbundle type: integer maximum number of feed elements per bundle. the default and maximum value is 10. density type: connectapi.feeddensity specify the amount of content in a feed. • allupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations. • fewerupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations, but hides some system-generated updates from records. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class," "for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of feed elements per page. valid values are from 1 through 100. if you pass in null, the default size is 25. updatedsince type: string an opaque token containing information about the last modified date of the feed. do not construct this token. retrieve this token from the updatestoken property of the connectapi.feedelementpage response body. the updatedsince parameter doesn’t return feed elements that are created in the same second as the call. showinternalonly type: boolean specifies whether to show only feed elements from internal (non-experience cloud site) users (true), or not (false). the default value is false. customfilter type: string custom filter that applies only to the case feed. see customfeedfilter in the metadata api developer guide for supported values. result type: connectapi.feedelementpage object containing test data. 712apex reference guide chatterfeeds class return value type: void see also: getfeedelementsupdatedsince(communityid, feedtype, subjectid, recentcommentcount, elementsperbundle, density, pageparam, pagesize, updatedsince, showinternalonly, customfilter) apex developer guide: testing connectapi code settestgetrelatedposts(communityid, feedelementid, filter, maxresults, result) register a connectapi.relatedfeedposts object to be returned when the matching connectapi.getrelatedposts(communityid, feedelementid, filter, maxresults) method is called in a test context. use the method with the same parameters or you receive an exception. api version 37.0 signature public static void settestgetrelatedposts(string communityid, string feedelementid, connectapi.relatedfeedposttype filter, integer maxresults, connectapi.relatedfeedposts result) parameters communityid type: string id for an experience cloud site, internal, or null. feedelementid type: string id of the feed element. the feed element must be a question. filter type: connectapi.relatedfeedposttype specifies the type of related feed post. values are: • answered—related questions that have at least one answer. • bestanswer—related questions that have a best answer. • generic—all types of related questions, including answered, with a best answer, and unanswered. • unanswered—related questions that don’t have answers. generic is the default value. maxresults type: integer the maximum number of results to return. you can return up to 25 results; 5 is the default. 713apex reference guide chatterfeeds class result type: connectapi.relatedfeedposts object containing test data. in version 37.0 and later, related feed posts are questions. return value type: void settestgettopunansweredquestions(communityid, result) (pilot) register a connectapi.feedelementpage object to be returned when the matching connectapi.gettopunansweredquestions method is called in a test context. use the method with the same parameters or you receive an exception. note: we provided top-five unanswered questions to selected customers through a pilot program that required agreement to specific terms and conditions. this pilot program is closed and not accepting new participants. api version 42.0 signature public static void settestgettopunansweredquestions(string communityid, connectapi.feedelementpage result) parameters communityid type: string id of the experience cloud site. result type: connectapi.feedelementpage object containing test data. return value type: void see also: gettopunansweredquestions(communityid) (pilot) apex developer guide: testing connectapi code 714apex reference guide chatterfeeds class settestgettopunansweredquestions(communityid, filter, result) (pilot) register a connectapi.feedelementpage object to be returned when the matching connectapi.gettopunansweredquestions method is called in a test context. use the method with the same parameters or you receive an exception. note: we provided top-five unanswered questions to selected customers through a pilot program that required agreement to specific terms and conditions. this pilot program is closed and not accepting new participants. api version 42.0 signature public static void settestgettopunansweredquestions(string communityid, connectapi" ".topunansweredquestionsfiltertype filter, connectapi.feedelementpage result) parameters communityid type: string id of the experience cloud site. filter type: connectapi.feedfilter specifies the filter for the feed. unansweredquestionswithcandidateanswers is the only valid value. result type: connectapi.feedelementpage object containing test data. return value type: void see also: gettopunansweredquestions(communityid, filter) (pilot) apex developer guide: testing connectapi code settestgettopunansweredquestions(communityid, pagesize, result) (pilot) register a connectapi.feedelementpage object to be returned when the matching connectapi.gettopunansweredquestions method is called in a test context. use the method with the same parameters or you receive an exception. note: we provided top-five unanswered questions to selected customers through a pilot program that required agreement to specific terms and conditions. this pilot program is closed and not accepting new participants. 715apex reference guide chatterfeeds class api version 42.0 signature public static void settestgettopunansweredquestions(string communityid, integer pagesize, connectapi.feedelementpage result) parameters communityid type: string id of the experience cloud site. pagesize type: integer specifies the number of items per page. valid values are from 0 through 10. if you pass in null, the default size is 5. result type: connectapi.feedelementpage object containing test data. return value type: void see also: gettopunansweredquestions(communityid, pagesize) (pilot) apex developer guide: testing connectapi code settestgettopunansweredquestions(communityid, filter, pagesize, result) (pilot) register a connectapi.feedelementpage object to be returned when the matching connectapi.gettopunansweredquestions method is called in a test context. use the method with the same parameters or you receive an exception. note: we provided top-five unanswered questions to selected customers through a pilot program that required agreement to specific terms and conditions. this pilot program is closed and not accepting new participants. api version 42.0 signature public static void settestgettopunansweredquestions(string communityid, connectapi.feedfilter filter, integer pagesize, connectapi.feedelementpage result) 716apex reference guide chatterfeeds class parameters communityid type: string id of the experience cloud site. filter type: connectapi.feedfilter specifies the filter for the feed. unansweredquestionswithcandidateanswers is the only valid value. pagesize type: integer specifies the number of items per page. valid values are from 0 through 10. if you pass in null, the default size is 5. result type: connectapi.feedelementpage object containing test data. return value type: void see also: gettopunansweredquestions(communityid, filter, pagesize) (pilot) apex developer guide: testing connectapi code settestsearchfeedelements(communityid, q, result) register a connectapi.feedelementpage object to be returned when the matching connectapi.searchfeedelements method is called in a test context. use the method with the same parameters or you receive an exception. api version 31.0 signature public static void settestsearchfeedelements(string communityid, string q, connectapi.feedelementpage result) parameters communityid type: string id for an experience cloud site, internal, or null. q type: string 717apex reference guide chatterfeeds class required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. result type: connectapi.feedelementpage object containing test data. return value type: void see also: searchfeedelements(communityid, q) apex developer guide: testing connectapi code settestsearchfeedelements(communityid, q, sortparam, result) register a connectapi.feedelementpage object to be returned when the matching connectapi.searchfeedelements method is called in a test context. use the method with the same parameters or you receive an exception. api version 31.0 signature public" "static void settestsearchfeedelements(string communityid, string q, connectapi.feedsortorder sortparam, connectapi.feedelementpage result) parameters communityid type: string id for an experience cloud site, internal, or null. q type: string required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. sortparam type: connectapi.feedsortorder values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. 718apex reference guide chatterfeeds class • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. if you pass in null, the default value createddatedesc is used. result type: connectapi.feedelementpage object containing test data. return value type: void see also: searchfeedelements(communityid, q, sortparam) apex developer guide: testing connectapi code settestsearchfeedelements(communityid, q, threadedcommentscollapsed, result) register a connectapi.feedelementpage object to be returned when the matching connectapi.searchfeedelements method is called in a test context. use the method with the same parameters or you receive an exception. api version 44.0 signature public static void settestsearchfeedelements(string communityid, string q, boolean threadedcommentscollapsed, connectapi.feedelementpage result) parameters communityid type: string id for an experience cloud site, internal, or null. q type: string required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. threadedcommentscollapsed type: boolean specifies whether to return threaded comments in a collapsed style (true) or not (false). if you pass in null, the default is false. result type: connectapi.feedelementpage 719apex reference guide chatterfeeds class object containing test data. return value type: void see also: searchfeedelements(communityid, q, threadedcommentscollapsed) apex developer guide: testing connectapi code settestsearchfeedelements(communityid, q, pageparam, pagesize, result) register a connectapi.feedelementpage object to be returned when the matching connectapi.searchfeedelements method is called in a test context. use the method with the same parameters or you receive an exception. api version 31.0 signature public static void settestsearchfeedelements(string communityid, string q, string pageparam, integer pagesize, connectapi.feedelementpage result) parameters communityid type: string id for an experience cloud site, internal, or null.d q type: string required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of feed elements per page. valid values are from 1 through 100. if you pass in null, the default size is 25. result type: connectapi.feedelementpage object containing test data. 720apex reference guide chatterfeeds class return value type: void see also: searchfeedelements(communityid, q, pageparam, pagesize) apex developer guide: testing connectapi code settestsearchfeedelements(communityid, q, pageparam, pagesize, sortparam, result) register a connectapi.feedelementpage object to be returned when the matching connectapi.searchfeedelements method is called in a test context. use the method with the" "same parameters or you receive an exception. api version 31.0 signature public static void settestsearchfeedelements(string communityid, string q, string pageparam, integer pagesize, connectapi.feedsortorder sortparam, connectapi.feedelementpage result) parameters communityid type: string id for an experience cloud site, internal, or null. q type: string required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of feed elements per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.feedsortorder values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. 721apex reference guide chatterfeeds class • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. if you pass in null, the default value createddatedesc is used. result type: connectapi.feedelementpage object containing test data. return value type: void see also: searchfeedelements(communityid, q, pageparam, pagesize, sortparam) apex developer guide: testing connectapi code settestsearchfeedelements(communityid, q, pageparam, pagesize, threadedcommentscollapsed, result) register a connectapi.feedelementpage object to be returned when the matching connectapi.searchfeedelements method is called in a test context. use the method with the same parameters or you receive an exception. api version 44.0 signature public static void settestsearchfeedelements(string communityid, string q, string pageparam, integer pagesize, boolean threadedcommentscollapsed, connectapi.feedelementpage result) parameters communityid type: string id for an experience cloud site, internal, or null. q type: string required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. pageparam type: string 722apex reference guide chatterfeeds class page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of feed elements per page. valid values are from 1 through 100. if you pass in null, the default size is 25. threadedcommentscollapsed type: boolean specifies whether to return threaded comments in a collapsed style (true) or not (false). if you pass in null, the default is false. result type: connectapi.feedelementpage object containing test data. return value type: void see also: searchfeedelements(communityid, q, pageparam, pagesize, threadedcommentscollapsed) apex developer guide: testing connectapi code settestsearchfeedelements(communityid, q, recentcommentcount, pageparam, pagesize, sortparam, result) register a connectapi.feedelementpage object to be returned when the matching connectapi.searchfeedelements method is called in a test context. use the method with the same parameters or you receive an exception. api version 31.0 signature public static void settestsearchfeedelements(string communityid, string q, integer recentcommentcount, string pageparam, integer pagesize, connectapi.feedsortorder sortparam, connectapi.feedelementpage result) parameters communityid type: string id for an experience cloud site, internal, or null. q" "type: string 723apex reference guide chatterfeeds class required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. recentcommentcount type: integer maximum number of comments to return with each feed element. the default value is 3. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of feed elements per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.feedsortorder values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. if you pass in null, the default value createddatedesc is used. result type: connectapi.feedelementpage object containing test data. return value type: void see also: searchfeedelements(communityid, q, recentcommentcount, pageparam, pagesize, sortparam) apex developer guide: testing connectapi code settestsearchfeedelementsinfeed(communityid, feedtype, q, result) register a connectapi.feedelementpage object to be returned when the matching connectapi.searchfeedelementsinfeed method is called in a test context. use the method with the same parameters or you receive an exception. api version 31.0 724apex reference guide chatterfeeds class signature public static void settestsearchfeedelementsinfeed(string communityid, connectapi.feedtype feedtype, string q, connectapi.feedelementpage result) parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype type of feed. valid values are company, directmessagemoderation, home, moderation, and pendingreview. q type: string required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. result type: connectapi.feedelementpage object containing test data. return value type: void see also: searchfeedelementsinfeed(communityid, feedtype, q) apex developer guide: testing connectapi code settestsearchfeedelementsinfeed(communityid, feedtype, pageparam, pagesize, sortparam, q, result) register a connectapi.feedelementpage object to be returned when the matching connectapi.searchfeedelementsinfeed method is called in a test context. use the method with the same parameters or you receive an exception. api version 31.0 signature public static void settestsearchfeedelementsinfeed(string communityid, connectapi.feedtype feedtype, string pageparam, integer pagesize, connectapi.feedsortorder sortparam, string q, connectapi.feedelementpage result) 725apex reference guide chatterfeeds class parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype type of feed. valid values are company, directmessagemoderation, home, moderation, and pendingreview. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of feed elements per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.feedsortorder values are: • createddateasc—sorts by" "oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. if you pass in null, the default value createddatedesc is used. q type: string required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. result type: connectapi.feedelementpage object containing test data. return value type: void see also: searchfeedelementsinfeed(communityid, feedtype, pageparam, pagesize, sortparam, q) apex developer guide: testing connectapi code 726apex reference guide chatterfeeds class settestsearchfeedelementsinfeed(communityid, feedtype, recentcommentcount, density, pageparam, pagesize, sortparam, q, result) register a connectapi.feedelementpage object to be returned when the matching connectapi.searchfeedelementsinfeed method is called in a test context. use the method with the same parameters or you receive an exception. api version 31.0 signature public static void settestsearchfeedelementsinfeed(string communityid, connectapi.feedtype feedtype, integer recentcommentcount, connectapi.feeddensity density, string pageparam, integer pagesize, connectapi.feedsortorder sortparam, string q, connectapi.feedelementpage result) parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype type of feed. valid values are company, directmessagemoderation, home, moderation, and pendingreview. recentcommentcount type: integer maximum number of comments to return with each feed element. the default value is 3. density type: connectapi.feeddensity specify the amount of content in a feed. • allupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations. • fewerupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations, but hides some system-generated updates from records. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of feed elements per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.feedsortorder 727apex reference guide chatterfeeds class values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. if you pass in null, the default value createddatedesc is used. q type: string required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. result type: connectapi.feedelementpage object containing test data. return value type: void see also: searchfeedelementsinfeed(communityid, feedtype, recentcommentcount, density, pageparam, pagesize, sortparam, q) apex developer guide: testing connectapi code settestsearchfeedelementsinfeed(communityid, feedtype, recentcommentcount, density, pageparam, pagesize, sortparam," "q, filter, result) register a connectapi.feedelementpage object to be returned when the matching connectapi.searchfeedelementsinfeed method is called in a test context. use the method with the same parameters or you receive an exception. api version 32.0 signature public static void settestsearchfeedelementsinfeed(string communityid, connectapi.feedtype feedtype, integer recentcommentcount, connectapi.feeddensity density, string pageparam, integer pagesize, connectapi.feedsortorder sortparam, string q, connectapi.feedfilter filter, connectapi.feedelementpage result) 728apex reference guide chatterfeeds class parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype the type of feed. the only valid value is home. recentcommentcount type: integer maximum number of comments to return with each feed element. the default value is 3. density type: connectapi.feeddensity specify the amount of content in a feed. • allupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations. • fewerupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations, but hides some system-generated updates from records. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of feed elements per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.feedsortorder values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. if you pass in null, the default value createddatedesc is used. q type: string required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. filter type: connectapi.feedfilter 729apex reference guide chatterfeeds class specifies the feed filters. • allquestions—feed elements that are questions. • authoredby—feed elements authored by the user profile owner. this value is valid only for the userprofile feed. • communityscoped—feed elements that are scoped to experience cloud sites. currently, these feed elements have a user or a group parent record. however, other parent record types could be scoped to sites in the future. feed elements that are always visible in all sites are filtered out. this value is valid only for the userprofile feed. • questionswithcandidateanswers—feed elements that are questions that have candidate answers associated with them.this value is valid only for users with the access einstein-generated answers permission. • questionswithcandidateanswersreviewedpublished—feed elements that are questions that have candidate answers that have been reviewed or published. this value is valid only for users with the access einstein-generated answers permission. • read—feed elements that are older than 30 days or are marked as read for the context user. includes existing feed elements when the context user joined the group. this value is valid only for the record feed of a group. • solvedquestions—feed elements that are questions and that have a best answer. • unansweredquestions—feed elements that are questions and that don’t have any answers. • unansweredquestionswithcandidateanswers—feed elements that are questions that don’t have answers but have candidate answers associated with them. this value is valid only for users with the access einstein-generated answers permission. • unread—feed elements that are created in the past 30 days and aren’t marked as read for the context user. this value" "is valid only for the record feed of a group. • unsolvedquestions—feed elements that are questions and that don’t have a best answer. result type: connectapi.feedelementpage object containing test data. return value type: void see also: searchfeedelementsinfeed(communityid, feedtype, recentcommentcount, density, pageparam, pagesize, sortparam, q, filter) apex developer guide: testing connectapi code settestsearchfeedelementsinfeed(communityid, feedtype, subjectid, q, result) register a connectapi.feedelementpage object to be returned when the matching connectapi.searchfeedelementsinfeed method is called in a test context. use the method with the same parameters or you receive an exception. api version 31.0 730apex reference guide chatterfeeds class signature public static void settestsearchfeedelementsinfeed(string communityid, connectapi.feedtype feedtype, string subjectid, string q, connectapi.feedelementpage result) parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype type of feed. valid values include every connectapi.feedtype except company, directmessages, filter, landing, streams, and topics. subjectid type: string if feedtype is record, subjectid can be any record id, including a group id. if feed type is userprofile, subjectid can be any user id. if feedtype is any other value, subjectid must be the id of the context user or the alias me. q type: string required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. result type: connectapi.feedelementpage object containing test data. return value type: void see also: searchfeedelementsinfeed(communityid, feedtype, subjectid, q) apex developer guide: testing connectapi code settestsearchfeedelementsinfeed(communityid, feedtype, subjectid, pageparam, pagesize, sortparam, q, result) register a connectapi.feedelementpage object to be returned when the matching connectapi.searchfeedelementsinfeed method is called in a test context. use the method with the same parameters or you receive an exception. api version 31.0 731apex reference guide chatterfeeds class signature public static void settestsearchfeedelementsinfeed(string communityid, connectapi.feedtype feedtype, string subjectid, string pageparam, integer pagesize, connectapi.feedsortorder sortparam, string q, connectapi.feedelementpage result) parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype type of feed. valid values include every connectapi.feedtype except company, directmessages, filter, landing, streams, and topics. subjectid type: string if feedtype is record, subjectid can be any record id, including a group id. if feedtype is userprofile, subjectid can be any user id. if the feedtype is any other value, subjectid must be the id of the context user or the alias me. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of feed elements per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.feedsortorder order of feed items in the feed. • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home" ", and topics feeds. if you pass in null, the default value createddatedesc is used. q type: string search term. searches keywords in the user or group name. a minimum of one character is required. this parameter doesn’t support wildcards. this parameter is required. 732" "apex reference guide chatterfeeds class result type: connectapi.feedelementpage object containing test data. return value type: void see also: searchfeedelementsinfeed(communityid, feedtype, subjectid, pageparam, pagesize, sortparam, q) apex developer guide: testing connectapi code settestsearchfeedelementsinfeed(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, sortparam, q, result) register a connectapi.feedelementpage object to be returned when the matching connectapi.searchfeedelementsinfeed method is called in a test context. use the method with the same parameters or you receive an exception. api version 31.0 signature public static void settestsearchfeedelementsinfeed(string communityid, connectapi.feedtype feedtype, string subjectid, integer recentcommentcount, connectapi.feeddensity density, string pageparam, integer pagesize, connectapi.feedsortorder sortparam, string q, connectapi.feedelementpage result) parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype type of feed. valid values include every connectapi.feedtype except company, directmessages, filter, landing, streams, and topics. subjectid type: string if feedtype is record, subjectid can be any record id, including a group id. if feedtype is userprofile, subjectid can be any user id. if the feedtype is any other value, subjectid must be the id of the context user or the alias me. recentcommentcount type: integer 733apex reference guide chatterfeeds class maximum number of comments to return with each feed element. the default value is 3. density type: connectapi.feeddensity specify the amount of content in a feed. • allupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations. • fewerupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations, but hides some system-generated updates from records. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of feed elements per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.feedsortorder values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. if you pass in null, the default value createddatedesc is used. q type: string required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. result type: connectapi.feedelementpage object containing test data. return value type: void see also: searchfeedelementsinfeed(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, sortparam, q) apex developer guide: testing connectapi code 734apex reference guide chatterfeeds class settestsearchfeedelementsinfeed(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, sortparam, q, filter, result) register a connectapi.feedelementpage object to be returned when searchfeedelementsinfeed is called with matching parameters in a test context. use the method with the same parameters or the code throws an exception. api version 35.0 signature public static void settestsearchfeedelementsinfeed(string community" "id, connectapi.feedtype feedtype, string subjectid, integer recentcommentcount, connectapi.feeddensity density, string pageparam, integer pagesize, connectapi.feedsortorder sortparam, string q, connectapi.feedfilter filter, connectapi.feedelementpage result) parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype value must be connectapi.feedtype.userprofile. subjectid type: string id of any user. to specify the context user, use the user id or the alias me. recentcommentcount type: integer maximum number of comments to return with each feed element. the default value is 3. density type: connectapi.feeddensity the amount of content in a feed. • allupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations. • fewerupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations, but hides some system-generated updates from records. pageparam type: string specifies the page token to use to view a page of information. page tokens are returned as part of the response class, such as currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. 735apex reference guide chatterfeeds class pagesize type: integer specifies the number of feed elements per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.feedsortorder values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. if you pass in null, the default value createddatedesc is used. q type: string one or more keywords to search for in the feed elements visible to the context user. the search string can contain wildcards and must contain at least two characters that aren’t wildcards. see wildcards. filter type: connectapi.feedfilter value must be connectapi.feedfilter.communityscoped. filters the feed to include only feed elements that are scoped to experience cloud sites. feed elements that are always visible in all sites are filtered out. currently, feed elements scoped to sites have a user or a group parent record. however, other parent record types could be scoped to sites in the future. result type: connectapi.feedelementpage object containing test data. return value type: void see also: searchfeedelementsinfeed(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, sortparam, q, filter) apex developer guide: testing connectapi code settestsearchfeedelementsinfeed(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, sortparam, q, customfilter, result) register a connectapi.feedelementpage object to be returned when the matching connectapi.searchfeedelementsinfeed method is called in a test context. use the method with the same parameters or you receive an exception. 736apex reference guide chatterfeeds class api version 40.0 signature public static void settestsearchfeedelementsinfeed(string communityid, connectapi.feedtype feedtype, string subjectid, integer recentcommentcount, connectapi.feeddensity density, string pageparam, integer pagesize, connectapi.feedsortorder sortparam, string q, string customfilter, connectapi.feedelementpage result) parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype value must be connectapi.feedtype.record. subjectid type: string the id of a case. recentcommentcount type" ": integer maximum number of comments to return with each feed element. the default value is 3. density type: connectapi.feeddensity the amount of content in a feed. • allupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations. • fewerupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations, but hides some system-generated updates from records. pageparam type: string specifies the page token to use to view a page of information. page tokens are returned as part of the response class, such as currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of feed elements per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.feedsortorder values are: 737apex reference guide chatterfeeds class • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. if you pass in null, the default value createddatedesc is used. q type: string one or more keywords to search for in the feed elements visible to the context user. the search string can contain wildcards and must contain at least two characters that aren’t wildcards. see wildcards. customfilter type: string custom filter that applies only to the case feed. see customfeedfilter in the metadata api developer guide for supported values. result type: connectapi.feedelementpage object containing test data. return value type: void see also: searchfeedelementsinfeed(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, sortparam, q, customfilter) apex developer guide: testing connectapi code settestsearchfeedelementsinfeed(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, sortparam, q, showinternalonly, result) register a connectapi.feedelementpage object to be returned when the matching connectapi.searchfeedelementsinfeed method is called in a test context. use the method with the same parameters or you receive an exception. api version 31.0 signature public static void settestsearchfeedelementsinfeed(string communityid, connectapi.feedtype feedtype, string subjectid, integer recentcommentcount, connectapi.feeddensity density, string pageparam, integer pagesize, 738apex reference guide chatterfeeds class connectapi.feedsortorder sortparam, string q, boolean showinternalonly, connectapi.feedelementpage result) parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype value must be connectapi.feedtype.record. subjectid type: string any record id, including a group id. recentcommentcount type: integer maximum number of comments to return with each feed element. the default value is 3. density type: connectapi.feeddensity specify the amount of content in a feed. • allupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations. • fewerupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations, but hides some system-generated updates from records. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of feed elements per page. valid values are from 1 through 100. if you pass in null, the default" "size is 25. sortparam type: connectapi.feedsortorder values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. if you pass in null, the default value createddatedesc is used. 739apex reference guide chatterfeeds class q type: string required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. showinternalonly type: boolean specifies whether to show only feed elements from internal (non-experience cloud site) users (true), or not (false). the default value is false. result type: connectapi.feedelementpage object containing test data. return value type: void see also: searchfeedelementsinfeed(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, sortparam, q, showinternalonly) apex developer guide: testing connectapi code settestsearchfeedelementsinfeed(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, sortparam, q, showinternalonly, filter, result) register a connectapi.feedelementpage object to be returned when the matching connectapi.searchfeedelementsinfeed method is called in a test context. use the method with the same parameters or you receive an exception. api version 32.0 signature public static void settestsearchfeedelementsinfeed(string communityid, connectapi.feedtype feedtype, string subjectid, integer recentcommentcount, connectapi.feeddensity density, string pageparam, integer pagesize, connectapi.feedsortorder sortparam, string q, boolean showinternalonly, connectapi.feedfilter filter, connectapi.feedelementpage result) parameters communityid type: string id for an experience cloud site, internal, or null. 740apex reference guide chatterfeeds class feedtype type: connectapi.feedtype value must be connectapi.feedtype.record. subjectid type: string any record id, including a group id. recentcommentcount type: integer maximum number of comments to return with each feed element. the default value is 3. density type: connectapi.feeddensity specify the amount of content in a feed. • allupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations. • fewerupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations, but hides some system-generated updates from records. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of feed elements per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.feedsortorder values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. if you pass in null, the default value createddatedesc is used. q type: string required and can’t be null. specifies the string to search. the search string must" "contain at least two characters, not including wildcards. see wildcards. showinternalonly type: boolean 741apex reference guide chatterfeeds class specifies whether to show only feed elements from internal (non-experience cloud site) users (true), or not (false). the default value is false. filter type: connectapi.feedfilter specifies the feed filters. • allquestions—feed elements that are questions. • authoredby—feed elements authored by the user profile owner. this value is valid only for the userprofile feed. • communityscoped—feed elements that are scoped to experience cloud sites. currently, these feed elements have a user or a group parent record. however, other parent record types could be scoped to sites in the future. feed elements that are always visible in all sites are filtered out. this value is valid only for the userprofile feed. • questionswithcandidateanswers—feed elements that are questions that have candidate answers associated with them.this value is valid only for users with the access einstein-generated answers permission. • questionswithcandidateanswersreviewedpublished—feed elements that are questions that have candidate answers that have been reviewed or published. this value is valid only for users with the access einstein-generated answers permission. • read—feed elements that are older than 30 days or are marked as read for the context user. includes existing feed elements when the context user joined the group. this value is valid only for the record feed of a group. • solvedquestions—feed elements that are questions and that have a best answer. • unansweredquestions—feed elements that are questions and that don’t have any answers. • unansweredquestionswithcandidateanswers—feed elements that are questions that don’t have answers but have candidate answers associated with them. this value is valid only for users with the access einstein-generated answers permission. • unread—feed elements that are created in the past 30 days and aren’t marked as read for the context user. this value is valid only for the record feed of a group. • unsolvedquestions—feed elements that are questions and that don’t have a best answer. result type: connectapi.feedelementpage object containing test data. return value type: void see also: searchfeedelementsinfeed(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, sortparam, q, showinternalonly, filter) apex developer guide: testing connectapi code 742apex reference guide chatterfeeds class settestsearchfeedelementsinfeed(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, sortparam, q, showinternalonly, customfilter, result) register a connectapi.feedelementpage object to be returned when the matching connectapi.searchfeedelementsinfeed method is called in a test context. use the method with the same parameters or you receive an exception. api version 40.0 signature public static void settestsearchfeedelementsinfeed(string communityid, connectapi.feedtype feedtype, string subjectid, integer recentcommentcount, connectapi.feeddensity density, string pageparam, integer pagesize, connectapi.feedsortorder sortparam, string q, boolean showinternalonly, string customfilter, connectapi.feedelementpage result) parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype value must be connectapi.feedtype.record. subjectid type: string the id of a case. recentcommentcount type: integer maximum number of comments to return with each feed element. the default value is 3. density type: connectapi.feeddensity specify the amount of content in a feed. • allupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations. • fewerupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations, but hides some system-generated updates from records. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. 743apex reference guide chatter" "feeds class pagesize type: integer specifies the number of feed elements per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.feedsortorder values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. if you pass in null, the default value createddatedesc is used. q type: string required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. showinternalonly type: boolean specifies whether to show only feed elements from internal (non-experience cloud site) users (true), or not (false). the default value is false. cusotmfilter type: string custom filter that applies only to the case feed. see customfeedfilter in the metadata api developer guide for supported values. result type: connectapi.feedelementpage object containing test data. return value type: void see also: searchfeedelementsinfeed(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, sortparam, q, showinternalonly, customfilter) apex developer guide: testing connectapi code 744apex reference guide chatterfeeds class settestsearchfeedelementsinfilterfeed(communityid, subjectid, keyprefix, q, result) register a connectapi.feedelementpage object to be returned when the matching connectapi.searchfeedelementsinfilterfeed method is called in a test context. use the method with the same parameters or you receive an exception. api version 31.0 signature public static void settestsearchfeedelementsinfilterfeed(string communityid, string subjectid, string keyprefix, string q, connectapi.feedelementpage result) parameters communityid type: string id for an experience cloud site, internal, or null. subjectid type: string id of the context user or the alias me. keyprefix type: string a key prefix that specifies record type. a key prefix is the first three characters in the object id, which specifies the object type. for example, user objects have a prefix of 005 and group objects have a prefix of 0f9. q type: string required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. result type: connectapi.feedelementpage object containing test data. return value type: void see also: searchfeedelementsinfilterfeed(communityid, subjectid, keyprefix, q) apex developer guide: testing connectapi code 745apex reference guide chatterfeeds class settestsearchfeedelementsinfilterfeed(communityid, subjectid, keyprefix, pageparam, pagesize, sortparam, q, result) register a connectapi.feedelementpage object to be returned when the matching connectapi.searchfeedelementsinfilterfeed method is called in a test context. use the method with the same parameters or you receive an exception. api version 31.0 signature public static void settestsearchfeedelementsinfilterfeed(string communityid, string subjectid, string keyprefix, string pageparam, integer pagesize, connectapi.feedsortorder sortparam, string q, connectapi.feedelementpage result) parameters communityid type: string id for an experience cloud site, internal, or null. subjectid type: string id of the context user or the alias me. keyprefix type: string a key prefix that specifies record type. a key prefix is the first three characters in the object id, which specifies the object type. for example, user objects have a prefix of 005 and group objects have a prefix of 0f9. pageparam type: string" "page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of feed elements per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.feedsortorder values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. 746apex reference guide chatterfeeds class • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. if you pass in null, the default value createddatedesc is used. q type: string required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. result type: connectapi.feedelementpage object containing test data. return value type: void see also: searchfeedelementsinfilterfeed(communityid, subjectid, keyprefix, pageparam, pagesize, sortparam, q) apex developer guide: testing connectapi code settestsearchfeedelementsinfilterfeed(communityid, subjectid, keyprefix, recentcommentcount, density, pageparam, pagesize, sortparam, q, result) register a connectapi.feedelementpage object to be returned when the matching connectapi.searchfeedelementsinfilterfeed method is called in a test context. use the method with the same parameters or you receive an exception. api version 31.0 signature public static void settestsearchfeedelementsinfilterfeed(string communityid, string subjectid, string keyprefix, integer recentcommentcount, connectapi.feeddensity density, string pageparam, integer pagesize, connectapi.feedsortorder sortparam, string q, connectapi.feedelementpage result) parameters communityid type: string id for an experience cloud site, internal, or null. subjectid type: string id of the context user or the alias me. keyprefix type: string 747apex reference guide chatterfeeds class a key prefix that specifies record type. a key prefix is the first three characters in the object id, which specifies the object type. for example, user objects have a prefix of 005 and group objects have a prefix of 0f9. recentcommentcount type: integer maximum number of comments to return with each feed element. the default value is 3. density type: connectapi.feeddensity specify the amount of content in a feed. • allupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations. • fewerupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations, but hides some system-generated updates from records. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of feed elements per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.feedsortorder values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds." "if you pass in null, the default value createddatedesc is used. q type: string required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. result type: connectapi.feedelementpage object containing test data. 748apex reference guide chatterfeeds class return value type: void see also: searchfeedelementsinfilterfeed(communityid, subjectid, keyprefix, recentcommentcount, density, pageparam, pagesize, sortparam, q) apex developer guide: testing connectapi code settestsearchstreams(communityid, q, result) register a connectapi.chatterstreampage object to be returned when the matching connectapi.searchstream(communityid, q) method is called in a test context. use the method with the same parameters or you receive an exception. api version 40.0 signature public static void settestsearchstreams(string communityid, string q, connectapi.chatterstreampage result) parameters communityid type: string id for an experience cloud site, internal, or null. q type: string required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. result type: connectapi.chatterstreampage object containing test data. return value type: void see also: searchstreams(communityid, q) apex developer guide: testing connectapi code 749apex reference guide chatterfeeds class settestsearchstreams(communityid, q, sortparam, result) register a connectapi.chatterstreampage object to be returned when the matching connectapi.searchstream(communityid, q, sortparam) method is called in a test context. use the method with the same parameters or you receive an exception. api version 40.0 signature public static void settestsearchstreams(string communityid, string q, connectapi.sortorder sortparam, connectapi.chatterstreampage result) parameters communityid type: string id for an experience cloud site, internal, or null. q type: string required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. sortparam type: connectapi.sortorder specifies the sort order. values are: • ascending—items are in ascending alphabetical order (a-z). • descending—items are in descending alphabetical order (z-a). • mostrecentlyviewed—items are in descending chronological order by view. this sort order is valid only for chatter feed streams. if not specified, default value is ascending. result type: connectapi.chatterstreampage object containing test data. return value type: void see also: searchstreams(communityid, q, sortparam) apex developer guide: testing connectapi code 750apex reference guide chatterfeeds class settestsearchstreams(communityid, q, pageparam, pagesize, result) register a connectapi.chatterstreampage object to be returned when the matching connectapi.searchstreams(communityid, q, pageparam, pagesize) method is called in a test context. use the method with the same parameters or you receive an exception. api version 40.0 signature public static void settestsearchstreams(string communityid, string q, integer pageparam, integer pagesize, connectapi.chatterstreampage result) parameters communityid type: string id for an experience cloud site, internal, or null. q type: string required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. pageparam type: integer number of the page you want returned. starts at 0. if you pass in null or 0, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 to 250. the default size is 25. result type: connectapi.chatterstreampage object containing test data. return value type: void see also: searchstreams(communityid, q, page" "param, pagesize) apex developer guide: testing connectapi code 751apex reference guide chatterfeeds class settestsearchstreams(communityid, q, pageparam, pagesize, sortparam, result) register a connectapi.chatterstreampage object to be returned when the matching connectapi.searchstreams(communityid, q, pageparam, pagesize, sortparam) method is called in a test context. use the method with the same parameters or you receive an exception. api version 40.0 signature public static void settestsearchstreams(string communityid, string q, integer pageparam, integer pagesize, connectapi.sortorder sortparam, connectapi.chatterstreampage result) parameters communityid type: string id for an experience cloud site, internal, or null. q type: string required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. pageparam type: integer number of the page you want returned. starts at 0. if you pass in null or 0, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 to 250. the default size is 25. sortparam type: connectapi.sortorder specifies the sort order. values are: • ascending—items are in ascending alphabetical order (a-z). • descending—items are in descending alphabetical order (z-a). • mostrecentlyviewed—items are in descending chronological order by view. this sort order is valid only for chatter feed streams. if not specified, default value is ascending. result type: connectapi.chatterstreampage object containing test data. 752apex reference guide chatterfeeds class return value type: void see also: searchstreams(communityid, q, pageparam, pagesize, sortparam) apex developer guide: testing connectapi code settestsearchstreams(communityid, q, pageparam, pagesize, sortparam, globalscope, result) register a connectapi.chatterstreampage object to be returned when the matching connectapi.searchstreams(communityid, q, pageparam, pagesize, sortparam, globalscope) method is called in a test context. use the method with the same parameters or you receive an exception. api version 41.0 signature public static void settestsearchstreams(string communityid, string q, integer pageparam, integer pagesize, connectapi.sortorder sortparam, boolean globalscope, connectapi.chatterstreampage result) parameters communityid type: string id for an experience cloud site, internal, or null. q type: string required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. pageparam type: integer number of the page you want returned. starts at 0. if you pass in null or 0, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 to 250. the default size is 25. sortparam type: connectapi.sortorder specifies the sort order. values are: • ascending—items are in ascending alphabetical order (a-z). • descending—items are in descending alphabetical order (z-a). 753apex reference guide chatterfeeds class • mostrecentlyviewed—items are in descending chronological order by view. this sort order is valid only for chatter feed streams. if not specified, default value is ascending. globalscope type: boolean specifies whether to get streams from all the context user’s experience cloud sites, regardless of the communityid value. result type: connectapi.chatterstreampage object containing test data. return value type: void retired chatterfeeds methods the following methods for chatterfeeds are retired. in this section: deletefeeditem(communityid, feeditemid) delete a feed item. getcommentsforfeeditem(communityid, feeditemid) get comments for a feed item. getcommentsforfeeditem(communityid, feeditemid, pageparam, pagesize) get a page of comments for a feed item. getfeeditem(communityid, feeditemid)" "get a feed item. getfeeditembatch(communityid, feeditemids) get a list of feed items. getfeeditemsfromfeed(communityid, feedtype) get feed items from the company, home, and moderation feeds. getfeeditemsfromfeed(communityid, feedtype, pageparam, pagesize, sortparam) get a page of sorted feed items from the company, home, and moderation feeds. getfeeditemsfromfeed(communityid, feedtype, recentcommentcount, density, pageparam, pagesize, sortparam) get a page of sorted feed items from the company, home, and moderation feeds. each feed item contains no more than the specified number of comments. getfeeditemsfromfeed(communityid, feedtype, subjectid) get feed items from a feed for a user or record. getfeeditemsfromfeed(communityid, feedtype, subjectid, pageparam, pagesize, sortparam) get a page of sorted feed items from a feed for a user or record. 754apex reference guide chatterfeeds class getfeeditemsfromfeed(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, sortparam) get a page of sorted feed items from a feed for a user or record. each feed item includes no more than the specified number of comments. getfeeditemsfromfeed(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, sortparam, showinternalonly) get a page of sorted feed items from a record feed for a user or record. each feed item includes no more than the specified number of comments. specify whether to return feed items posted by internal (non-experience cloud site) users only. getfeeditemsfromfilterfeed(communityid, subjectid, keyprefix) get feed items from a feed filtered by a key prefix for a user. getfeeditemsfromfilterfeed(communityid, subjectid, keyprefix, pageparam, pagesize, sortparam) get a page of sorted feed items from a feed filtered by a key prefix for a user. getfeeditemsfromfilterfeed(communityid, subjectid, keyprefix, recentcommentcount, density, pageparam, pagesize, sortparam) get a page of sorted feed items from a feed filtered by a key prefix for a user. each feed item contains no more than the specified number of comments. getfeeditemsfromfilterfeedupdatedsince(communityid, subjectid, keyprefix, recentcommentcount, density, pageparam, pagesize, updatedsince) get a page of feed items from a feed filtered by a key prefix for a user. include only feed items that have been updated since the time specified in the updatedsince parameter. getfeeditemsupdatedsince(communityid, feedtype, recentcommentcount, density, pageparam, pagesize, updatedsince) get a page of feed items from the company, home, and moderation feeds. include only feed items that have been updated since the time specified in the updatedsince parameter. each feed item contains no more than the specified number of comments. getfeeditemsupdatedsince(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, updatedsince) get a page of feed items from the files, groups, news, people, and record feeds. include only feed items that have been updated since the time specified in the updatedsince parameter. each feed item contains no more than the specified number of comments. getfeeditemsupdatedsince(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, updatedsince, showinternalonly) get a page of feed items from a record feed. include only feed items that have been updated since the time specified in the updatedsince parameter. specify whether to return feed items posted by internal (non-experience cloud site) users only. getfeedpoll(communityid, feeditemid) get the poll associated with a feed item. getlikesforfeeditem(communityid, feeditemid) get likes for a feed item. getlikesforfeeditem(communityid, feeditemid, pageparam, pagesize) get a page of likes for a feed item. likefeeditem(communityid, feeditemid) like a feed item for the context user. postcomment(communityid, feeditemid, text) post a plain-text comment to a feed item. postcomment(communityid, feeditemid, comment, feeditemfileupload) post a rich-text comment to a feed item. use this method to include mentions" "and to attach a file to a comment. 755apex reference guide chatterfeeds class postfeedelement(communityid, feedelement, feedelementfileupload) post a rich-text feed element. include mentions and hashtag topics, attach a file to a feed element, and associate action link groups with a feed element. you can also use this method to share a feed element and add a comment. postfeeditem(communityid, feedtype, subjectid, text) post a plain-text feed item. postfeeditem(communityid, feedtype, subjectid, feediteminput, feeditemfileupload) post a rich-text feed item to a feed. use this method to include mentions and hashtag topics and to attach a file to a feed item. you can also use this method to share a feed item and add a comment. searchfeeditems(communityid, q) get the feed items that match the search criteria. searchfeeditems(communityid, q, sortparam) get the sorted feed items that match the search criteria. searchfeeditems(communityid, q, pageparam, pagesize) get a page of feed items that match the search criteria. searchfeeditems(communityid, q, pageparam, pagesize, sortparam) get a page of sorted feed items that match the search criteria. searchfeeditems(communityid, q, recentcommentcount, pageparam, pagesize, sortparam) get a page of sorted feed items that match the search criteria. searchfeeditemsinfeed(communityid, feedtype, q) get the feed items from the company, home, and moderation feeds that match the search criteria. searchfeeditemsinfeed(communityid, feedtype, pageparam, pagesize, sortparam, q) get a page of sorted feed items from the company, home, and moderation feeds that match the search criteria. searchfeeditemsinfeed(communityid, feedtype, recentcommentcount, density, pageparam, pagesize, sortparam, q) get a page of sorted feed items from the company, home, and moderation feeds that match the search criteria. each feed item includes no more than the specified number of comments. searchfeeditemsinfeed(communityid, feedtype, subjectid, q) get the feed items from a feed that match the search criteria. searchfeeditemsinfeed(communityid, feedtype, subjectid, pageparam, pagesize, sortparam, q) get a page of sorted feed items from a feed for a user or record that match the search criteria. searchfeeditemsinfeed(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, sortparam, q) get a page of sorted feed items from a feed that match the search criteria. each feed item includes no more than the specified number of comments. searchfeeditemsinfeed(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, sortparam, q, showinternalonly) get a page of sorted feed items from a feed for a user or record that match the search criteria. each feed item includes no more than the specified number of comments. specify whether to return feed items posted by internal (non-experience cloud site) users only. searchfeeditemsinfilterfeed(communityid, subjectid, keyprefix, q) get the feed items that match the search criteria from a feed filtered by a key prefix for a user. searchfeeditemsinfilterfeed(communityid, subjectid, keyprefix, pageparam, pagesize, sortparam, q) get a page of sorted feed items that match the search criteria from a feed filtered by a key prefix for a user. 756apex reference guide chatterfeeds class searchfeeditemsinfilterfeed(communityid, subjectid, keyprefix, recentcommentcount, density, pageparam, pagesize, sortparam, q) get a page of sorted feed items that match the search criteria from a feed filtered by a key prefix for a user. each feed item includes no more than the specified number of comments. sharefeedelement(communityid, subjectid, feedelementtype, originalfeedelementid) share the originalfeedelementid as the context user. sharefeeditem(communityid, feedtype, subjectid, originalfeeditemid) share the originalfeeditemid to the feed specified by the feedtype. updatebookmark(communityid, feeditemid, isbookmarkedbycurrentuser) bookmark a feed item or remove a bookmark from a feed item. voteonfeedpoll(communityid, feeditemid, mychoiceid) vote or change your vote" "on a feed poll. settestgetfeeditemsfromfeed(communityid, feedtype, result) register a connectapi.feeditempage object to be returned when getfeeditemsfromfeed is called with matching parameters in a test context. use the get feed method with the same parameters or the code throws an exception. settestgetfeeditemsfromfeed(communityid, feedtype, pageparam, pagesize, sortparam, result) register a connectapi.feeditempage object to be returned when getfeeditemsfromfeed is called with matching parameters in a test context. use the get feed method with the same parameters or the code throws an exception. settestgetfeeditemsfromfeed(communityid, feedtype, recentcommentcount, density, pageparam, pagesize, sortparam, result) register a connectapi.feeditempage object to be returned when getfeeditemsfromfeed is called with matching parameters in a test context. use the get feed method with the same parameters or the code throws an exception. settestgetfeeditemsfromfeed(communityid, feedtype, subjectid, result) register a connectapi.feeditempage object to be returned when getfeeditemsfromfeed is called with matching parameters in a test context. use the get feed method with the same parameters or the code throws an exception. settestgetfeeditemsfromfeed(communityid, feedtype, subjectid, pageparam, pagesize, sortparam, result) register a connectapi.feeditempage object to be returned when getfeeditemsfromfeed is called with matching parameters in a test context. use the get feed method with the same parameters or the code throws an exception. settestgetfeeditemsfromfeed(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, sortparam, result) register a connectapi.feeditempage object to be returned when getfeeditemsfromfeed is called with matching parameters in a test context. use the get feed method with the same parameters or the code throws an exception. settestgetfeeditemsfromfeed(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, sortparam, showinternalonly, result) register a connectapi.feeditempage object to be returned when getfeeditemsfromfeed is called with matching parameters in a test context. use the get feed method with the same parameters or the code throws an exception. settestgetfeeditemsfromfilterfeed(communityid, subjectid, keyprefix, result) register a connectapi.feeditempage object to be returned when the matching getfeeditemsfromfilterfeed method is called in a test context. use the method with the same parameters or the code throws an exception. settestgetfeeditemsfromfilterfeed(communityid, subjectid, keyprefix, pageparam, pagesize, sortparam, result) register a connectapi.feeditempage object to be returned when the matching getfeeditemsfromfilterfeed method is called in a test context. use the method with the same parameters or the code throws an exception. 757apex reference guide chatterfeeds class settestgetfeeditemsfromfilterfeed(communityid, subjectid, keyprefix, recentcommentcount, density, pageparam, pagesize, sortparam, result) register a connectapi.feeditempage object to be returned when the matching getfeeditemsfromfilterfeed method is called in a test context. use the method with the same parameters or the code throws an exception. settestgetfeeditemsfromfilterfeedupdatedsince(communityid, subjectid, keyprefix, recentcommentcount, density, pageparam, pagesize, sortparam, updatedsince, result) register a connectapi.feeditempage object to be returned when the getfeeditemsfromfilterfeedupdatedsince method is called in a test context. settestgetfeeditemsupdatedsince(communityid, feedtype, recentcommentcount, density, pageparam, pagesize, updatedsince, connectapi.feeditempage, results) register a connectapi.feeditempage object to be returned when getfeeditemsupdatedsince is called with matching parameters in a test context. use the method with the same parameters or the code throws an exception. settestgetfeeditemsupdatedsince(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, updatedsince, result) register a connectapi.feeditempage object to be returned when getfeeditemsupdatedsince is called with matching parameters in a test context. use the method with the same parameters or the code throws an" "exception. settestgetfeeditemsupdatedsince(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, updatedsince, showinternalonly, result) register a connectapi.feeditempage object to be returned when getfeeditemsupdatedsince is called with matching parameters in a test context. use the method with the same parameters or the code throws an exception. settestsearchfeeditems(communityid, q, result) register a test feed item page to be returned when searchfeeditems(communityid, q) is called during a test. settestsearchfeeditems(communityid, q, sortparam, result) register a test feed item page to be returned when searchfeeditems(string, string, connectapi.feedsortorder) is called during a test. settestsearchfeeditems(communityid, q, pageparam, pagesize, result) register a test feed item page to be returned when searchfeeditems(string, string, string, integer) is called during a test. settestsearchfeeditems(communityid, q, pageparam, pagesize, sortparam, result) register a test feed item page to be returned when searchfeeditems(string, string, string, integer, connectapi.feedsortorder) is called during a test. settestsearchfeeditems(communityid, q, recentcommentcount, pageparam, pagesize, sortparam, result) register a test feed item page to be returned when searchfeeditems(communityid, q, recentcommentcount, pageparam, pagesize, sortparam) is called during a test. settestsearchfeeditemsinfeed(communityid, feedtype, q, result) register a connectapi.feeditempage object to be returned when the matching connectapi.searchfeeditemsinfeed method is called in a test context. use the method with the same parameters or you receive an exception. settestsearchfeeditemsinfeed(communityid, feedtype, pageparam, pagesize, sortparam, q, result) register a connectapi.feeditempage object to be returned when the matching connectapi.searchfeeditemsinfeed method is called in a test context. use the method with the same parameters or you receive an exception. 758apex reference guide chatterfeeds class settestsearchfeeditemsinfeed(communityid, feedtype, recentcommentcount, density, pageparam, pagesize, sortparam, q, result) register a connectapi.feeditempage object to be returned when the matching connectapi.searchfeeditemsinfeed method is called in a test context. use the method with the same parameters or you receive an exception. settestsearchfeeditemsinfeed(communityid, feedtype, subjectid, q, result) register a connectapi.feeditempage object to be returned when the matching connectapi.searchfeeditemsinfeed method is called in a test context. use the method with the same parameters or you receive an exception. settestsearchfeeditemsinfeed(communityid, feedtype, subjectid, pageparam, pagesize, sortparam, q, result) register a connectapi.feeditempage object to be returned when the matching connectapi.searchfeeditemsinfeed method is called in a test context. use the method with the same parameters or you receive an exception. settestsearchfeeditemsinfeed(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, sortparam, q, result) register a connectapi.feeditempage object to be returned when the matching connectapi.searchfeeditemsinfeed method is called in a test context. use the method with the same parameters or you receive an exception. settestsearchfeeditemsinfeed(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, sortparam, q, showinternalonly, result) register a connectapi.feeditempage object to be returned when the matching connectapi.searchfeeditemsinfeed method is called in a test context. use the method with the same parameters or you receive an exception. settestsearchfeeditemsinfilterfeed(communityid, subjectid, keyprefix, q, result) register a connectapi.feeditempage object to be returned when the matching connectapi.searchfeeditemsinfilterfeed method is called in a test context. use the method with the same parameters or you receive an exception. settestsearchfeeditemsinfilterfeed(communityid, feedtype, subjectid, keyprefix, page" "param, pagesize, sortparam, q, result) register a connectapi.feeditempage object to be returned when the matching connectapi.searchfeeditemsinfilterfeed method is called in a test context. use the method with the same parameters or you receive an exception. settestsearchfeeditemsinfilterfeed(communityid, feedtype, subjectid, keyprefix, recentcommentcount, density, pageparam, pagesize, sortparam, q, result) register a connectapi.feeditempage object to be returned when the matching connectapi.searchfeeditemsinfilterfeed method is called in a test context. use the method with the same parameters or you receive an exception. deletefeeditem(communityid, feeditemid) delete a feed item. api version 28.0–31.0 important: in version 32.0 and later, use deletefeedelement(communityid, feedelementid). 759apex reference guide chatterfeeds class requires chatter yes signature public static void deletefeeditem(string communityid, string feeditemid) parameters communityid type: string id for an experience cloud site, internal, or null. feeditemid type: string id for a feed item. return value type: void getcommentsforfeeditem(communityid, feeditemid) get comments for a feed item. api version 28.0–31.0 important: in version 32.0 and later, use getcommentsforfeedelement(communityid, feedelementid). available to guest users 31.0 only requires chatter yes signature public static connectapi.commentpage getcommentsforfeeditem(string communityid, string feeditemid) parameters communityid type: string id for an experience cloud site, internal, or null. 760apex reference guide chatterfeeds class feeditemid type: string id for a feed item. return value type: connectapi.commentpage getcommentsforfeeditem(communityid, feeditemid, pageparam, pagesize) get a page of comments for a feed item. api version 28.0–31.0 important: in version 32.0 and later, use getcommentsforfeedelement(communityid, feedelementid, pageparam, pagesize). available to guest users 31.0 only requires chatter yes signature public static connectapi.commentpage getcommentsforfeeditem(string communityid, string feeditemid, string pageparam, integer pagesize) parameters communityid type: string id for an experience cloud site, internal, or null. feeditemid type: string id for a feed item. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. 761apex reference guide chatterfeeds class return value type: connectapi.commentpage getfeeditem(communityid, feeditemid) get a feed item. api version 28.0–31.0 important: in version 32.0 and later, use getfeedelement(communityid, feedelementid). available to guest users 31.0 only requires chatter yes signature public static connectapi.feeditem getfeeditem(string communityid, string feeditemid) parameters communityid type: string id for an experience cloud site, internal, or null. feeditemid type: string id for a feed item. return value type: connectapi.feeditem note: triggers on feeditem objects run before their attachment and capabilities information is saved, which means that connectapi.feeditem.attachment information and connectapi.feedelement.capabilities information may not be available in the trigger. getfeeditembatch(communityid, feeditemids) get a list of feed items. api version 31.0–31.0 762apex reference guide chatterfeeds class important: in version 32.0 and later, use getfeedelementbatch(communityid, feedelementids). requires chatter yes signature public static connectapi.batchresult[] getfeeditembatch" "(string communityid, list feeditemids) parameters communityid type: string id for an experience cloud site, internal, or null. feeditemids type: list a list of up to 500 feed item ids. return value type: connectapi.batchresult[] the connectapi.batchresult.getresult() method returns a connectapi.feeditem object and errors for feed items that didn’t load. example // create a list of feed items. connectapi.feeditempage feeditempage = connectapi.chatterfeeds.getfeeditemsfromfeed(null, connectapi.feedtype.company); system.debug(feeditempage); // create a list of feed item ids. list feeditemids = new list(); for (connectapi.feeditem afeeditem : feeditempage.items){ feeditemids.add(afeeditem.id); } // get info about the feed items in the list. connectapi.batchresult[] batchresults = connectapi.chatterfeeds.getfeeditembatch(null, feeditemids); for (connectapi.batchresult batchresult : batchresults) { if (batchresult.issuccess()) { // operation was successful. // print the header for each feed item. connectapi.feeditem afeeditem; if(batchresult.getresult() instanceof connectapi.feeditem) { afeeditem = (connectapi.feeditem) batchresult.getresult(); 763apex reference guide chatterfeeds class } system.debug('success'); system.debug(afeeditem.header.text); } else { // operation failed. print errors. system.debug('failure'); system.debug(batchresult.geterrormessage()); } } getfeeditemsfromfeed(communityid, feedtype) get feed items from the company, home, and moderation feeds. api version 28.0–31.0 important: in version 32.0 and later, use getfeedelementsfromfeed(communityid, feedtype). available to guest users 31.0 only requires chatter yes signature public static connectapi.feeditempage getfeeditemsfromfeed(string communityid, connectapi.feedtype feedtype) parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype type of feed. valid values are company, directmessagemoderation, directmessages, home, moderation, and pendingreview. return value type: connectapi.feeditempage 764apex reference guide chatterfeeds class usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestgetfeeditemsfromfeed(communityid, feedtype, result) apex developer guide: testing connectapi code getfeeditemsfromfeed(communityid, feedtype, pageparam, pagesize, sortparam) get a page of sorted feed items from the company, home, and moderation feeds. api version 28.0–31.0 important: in version 32.0 and later, use getfeedelementsfromfeed(communityid, feedtype, pageparam, pagesize, sortparam). available to guest users 31.0 only requires chatter yes signature public static connectapi.feeditempage getfeeditemsfromfeed(string communityid, connectapi.feedtype feedtype, string pageparam, integer pagesize, connectapi.feedsortorder sortparam) parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype type of feed. valid values are company, directmessagemoderation, directmessages, home, moderation, and pendingreview. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer 765apex reference guide chatterfeeds class number of feed items per page. valid values are from 1" "through 100. if you pass in null, the default size is 25. sortparam type: connectapi.feedsortorder values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. sorts the returned feed by the most recently created feed item, or by the most recently modified feed item. if you pass in null, the default value createddatedesc is used. return value type: connectapi.feeditempage usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestgetfeeditemsfromfeed(communityid, feedtype, pageparam, pagesize, sortparam, result) apex developer guide: testing connectapi code getfeeditemsfromfeed(communityid, feedtype, recentcommentcount, density, pageparam, pagesize, sortparam) get a page of sorted feed items from the company, home, and moderation feeds. each feed item contains no more than the specified number of comments. api version 29.0–31.0 important: in version 32.0 and later, use getfeedelementsfromfeed(communityid, feedtype, recentcommentcount, density, pageparam, pagesize, sortparam). available to guest users 31.0 only requires chatter yes 766apex reference guide chatterfeeds class signature public static connectapi.feeditempage getfeeditemsfromfeed(string communityid, connectapi.feedtype feedtype, integer recentcommentcount, connectapi.feeddensity density, string pageparam, integer pagesize, connectapi.feedsortorder sortparam) parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype type of feed. valid values are company, directmessagemoderation, directmessages, home, moderation, and pendingreview. recentcommentcount type: integer maximum number of comments to return with each feed item. the default value is 3. density type: connectapi.feeddensity specify the amount of content in a feed. • allupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations. • fewerupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations, but hides some system-generated updates from records. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer number of feed items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.feedsortorder values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. 767apex reference guide chatterfeeds class sorts the returned feed by the most recently created feed item, or by the most recently modified feed item. if you pass in null, the default value createddatedesc is used. return value type: connectapi.feeditempage usage to test code that uses this method, use the matching set test method (prefix the method name with settest)." "use the set test method with the same parameters or the code throws an exception. see also: settestgetfeeditemsfromfeed(communityid, feedtype, recentcommentcount, density, pageparam, pagesize, sortparam, result) apex developer guide: testing connectapi code getfeeditemsfromfeed(communityid, feedtype, subjectid) get feed items from a feed for a user or record. api version 28.0–31.0 important: in version 32.0 and later, use getfeedelementsfromfeed(communityid, feedtype, subjectid). available to guest users 31.0 only requires chatter yes signature public static connectapi.feeditempage getfeeditemsfromfeed(string communityid, connectapi.feedtype feedtype, string subjectid) parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype type of feed. valid values include every connectapi.feedtype except company, directmessagemoderation, directmessages, filter, home, landing, moderation, and pendingreview. 768apex reference guide chatterfeeds class subjectid type: string if feedtype is record, subjectid can be any record id, including a group id. if feedtype is streams, subjectid must be a stream id. if feedtype is topics, subjectid must be a topic id. if feedtype is userprofile, subjectid can be any user id. if the feedtype is any other value, subjectid must be the id of the context user or the alias me. return value type: connectapi.feeditempage usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestgetfeeditemsfromfeed(communityid, feedtype, subjectid, result) apex developer guide: testing connectapi code getfeeditemsfromfeed(communityid, feedtype, subjectid, pageparam, pagesize, sortparam) get a page of sorted feed items from a feed for a user or record. api version 28.0–31.0 important: in version 32.0 and later, use getfeedelementsfromfeed(communityid, feedtype, subjectid, pageparam, pagesize, sortparam). available to guest users 31.0 only requires chatter yes signature public static connectapi.feeditempage getfeeditemsfromfeed(string communityid, connectapi.feedtype feedtype, string subjectid, string pageparam, integer pagesize, connectapi.feedsortorder sortparam) parameters communityid type: string 769apex reference guide chatterfeeds class id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype type of feed. valid values include every connectapi.feedtype except company, directmessagemoderation, directmessages, filter, home, landing, moderation, and pendingreview. subjectid type: string if feedtype is record, subjectid can be any record id, including a group id. if feedtype is streams, subjectid must be a stream id. if feedtype is topics, subjectid must be a topic id. if feedtype is userprofile, subjectid can be any user id. if the feedtype is any other value, subjectid must be the id of the context user or the alias me. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer number of feed items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.feedsortorder values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • re" "levance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. sorts the returned feed by the most recently created feed item, or by the most recently modified feed item. if you pass in null, the default value createddatedesc is used. return value type: connectapi.feeditempage usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestgetfeeditemsfromfeed(communityid, feedtype, subjectid, pageparam, pagesize, sortparam, result) apex developer guide: testing connectapi code 770apex reference guide chatterfeeds class getfeeditemsfromfeed(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, sortparam) get a page of sorted feed items from a feed for a user or record. each feed item includes no more than the specified number of comments. api version 29.0–31.0 important: in version 32.0 and later, use getfeedelementsfromfeed(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, sortparam). available to guest users 31.0 only requires chatter yes signature public static connectapi.feeditempage getfeeditemsfromfeed(string communityid, connectapi.feedtype feedtype, string subjectid, integer recentcommentcount, connectapi.feeddensity density, string pageparam, integer pagesize, connectapi.feedsortorder sortparam) parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype type of feed. valid values include every connectapi.feedtype except company, directmessagemoderation, directmessages, filter, home, landing, moderation, and pendingreview. subjectid type: string if feedtype is record, subjectid can be any record id, including a group id. if feedtype is streams, subjectid must be a stream id. if feedtype is topics, subjectid must be a topic id. if feedtype is userprofile, subjectid can be any user id. if the feedtype is any other value, subjectid must be the id of the context user or the alias me. recentcommentcount type: integer maximum number of comments to return with each feed item. the default value is 3. density type: connectapi.feeddensity specify the amount of content in a feed. 771apex reference guide chatterfeeds class • allupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations. • fewerupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations, but hides some system-generated updates from records. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer number of feed items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.feedsortorder values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. sorts the returned feed by the most recently created feed item, or by the most recently modified feed item. if you pass in null, the default value createddatedesc is used. return value type: connectapi.feeditempage usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also" ": settestgetfeeditemsfromfeed(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, sortparam, result) apex developer guide: testing connectapi code getfeeditemsfromfeed(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, sortparam, showinternalonly) get a page of sorted feed items from a record feed for a user or record. each feed item includes no more than the specified number of comments. specify whether to return feed items posted by internal (non-experience cloud site) users only. 772apex reference guide chatterfeeds class api version 30.0–31.0 important: in version 32.0 and later, use getfeedelementsfromfeed(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, sortparam, showinternalonly). available to guest users 31.0 only requires chatter yes signature public static connectapi.feeditempage getfeeditemsfromfeed(string communityid, connectapi.feedtype feedtype, string subjectid, integer recentcommentcount, connectapi.feeddensity density, string pageparam, integer pagesize, connectapi.feedsortorder sortparam, boolean showinternalonly) parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype value must be connectapi.feedtype.record. subjectid type: string any record id, including a group id. recentcommentcount type: integer maximum number of comments to return with each feed item. the default value is 3. density type: connectapi.feeddensity specify the amount of content in a feed. • allupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations. • fewerupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations, but hides some system-generated updates from records. pageparam type: string 773apex reference guide chatterfeeds class page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer number of feed items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.feedsortorder values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. sorts the returned feed by the most recently created feed item, or by the most recently modified feed item. if you pass in null, the default value createddatedesc is used. showinternalonly type: boolean specifies whether to show only feed items from internal (non-experience cloud site) users (true), or not (false). the default value is false. return value type: connectapi.feeditempage usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestgetfeeditemsfromfeed(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, sortparam, showinternalonly, result) apex developer guide: testing connectapi code getfeeditemsfromfilterfeed(communityid, subjectid, keyprefix) get feed items from a feed filtered by a key prefix for a user. api version 28.0–31.0 important: in version 32.0 and later, use getfeedelementsfromfilterfeed(communityid, subjectid, keyprefix). 774apex reference guide chatterfeeds class requires chatter yes signature" "public static connectapi.feeditempage getfeeditemsfromfilterfeed(string communityid, string subjectid, string keyprefix) parameters communityid type: string id for an experience cloud site, internal, or null. subjectid type: string id of the context user or the alias me. keyprefix type: string a key prefix that specifies record type. a key prefix is the first three characters in the object id, which specifies the object type. for example, user objects have a prefix of 005 and group objects have a prefix of 0f9. return value type: connectapi.feeditempage usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestgetfeeditemsfromfilterfeed(communityid, subjectid, keyprefix, result) apex developer guide: testing connectapi code getfeeditemsfromfilterfeed(communityid, subjectid, keyprefix, pageparam, pagesize, sortparam) get a page of sorted feed items from a feed filtered by a key prefix for a user. api version 28.0–31.0 important: in version 32.0 and later, use getfeedelementsfromfilterfeed(communityid, subjectid, keyprefix, pageparam, pagesize, sortparam). 775apex reference guide chatterfeeds class requires chatter yes signature public static connectapi.feeditempage getfeeditemsfromfilterfeed(string communityid, string subjectid, string keyprefix, string pageparam, integer pagesize, connectapi.feedsortorder sortparam) parameters communityid type: string id for an experience cloud site, internal, or null. subjectid type: string id of the context user or the alias me. keyprefix type: string a key prefix that specifies record type. a key prefix is the first three characters in the object id, which specifies the object type. for example, user objects have a prefix of 005 and group objects have a prefix of 0f9. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer number of feed items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.feedsortorder values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. sorts the returned feed by the most recently created feed item, or by the most recently modified feed item. if you pass in null, the default value createddatedesc is used. return value type: connectapi.feeditempage 776apex reference guide chatterfeeds class usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestgetfeeditemsfromfilterfeed(communityid, subjectid, keyprefix, pageparam, pagesize, sortparam, result) apex developer guide: testing connectapi code getfeeditemsfromfilterfeed(communityid, subjectid, keyprefix, recentcommentcount, density, pageparam, pagesize, sortparam) get a page of sorted feed items from a feed filtered by a key prefix for a user. each feed item contains no more than the specified number of comments. api version 29.0–31.0 important: in version 32.0 and later, use getfeedelementsfromfilterfeed(communityid, subjectid, keyprefix, recentcommentcount, elementsperbundle, density, pageparam, pagesize, sortparam). requires chatter yes signature public static connect" "api.feeditempage getfeeditemsfromfilterfeed(string communityid, string subjectid, string keyprefix, integer recentcommentcount, connectapi.feeddensity density, string pageparam, integer pagesize, connectapi.feedsortorder sortparam) parameters communityid type: string id for an experience cloud site, internal, or null. subjectid type: string id of the context user or the alias me. keyprefix type: string a key prefix that specifies record type. a key prefix is the first three characters in the object id, which specifies the object type. for example, user objects have a prefix of 005 and group objects have a prefix of 0f9. recentcommentcount type: integer maximum number of comments to return with each feed item. the default value is 3. 777apex reference guide chatterfeeds class density type: connectapi.feeddensity specify the amount of content in a feed. • allupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations. • fewerupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations, but hides some system-generated updates from records. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer number of feed items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.feedsortorder values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. sorts the returned feed by the most recently created feed item, or by the most recently modified feed item. if you pass in null, the default value createddatedesc is used. return value type: connectapi.feeditempage usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestgetfeeditemsfromfilterfeed(communityid, subjectid, keyprefix, recentcommentcount, density, pageparam, pagesize, sortparam, result) apex developer guide: testing connectapi code 778apex reference guide chatterfeeds class getfeeditemsfromfilterfeedupdatedsince(communityid, subjectid, keyprefix, recentcommentcount, density, pageparam, pagesize, updatedsince) get a page of feed items from a feed filtered by a key prefix for a user. include only feed items that have been updated since the time specified in the updatedsince parameter. api version 30.0–31.0 important: in version 32.0 and later, use getfeedelementsfromfilterfeedupdatedsince(communityid, subjectid, keyprefix, recentcommentcount, elementsperbundle, density, pageparam, pagesize, updatedsince). requires chatter yes signature public static connectapi.feeditempage getfeeditemsfromfilterfeedupdatedsince(string communityid, string subjectid, string keyprefix, integer recentcommentcount, connectapi.feeddensity density, string pageparam, integer pagesize, string updatedsince) parameters communityid type: string id for an experience cloud site, internal, or null. subjectid type: string id of the context user or the alias me. keyprefix type: string a key prefix that specifies record type. a key prefix is the first three characters in the object id, which specifies the object type. for example, user objects have a prefix of 005 and group objects have a prefix of 0f9. recentcommentcount type: integer maximum number of comments to return with each feed item. the default value is 3." "density type: connectapi.feeddensity specify the amount of content in a feed. • allupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations. • fewerupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations, but hides some system-generated updates from records. 779apex reference guide chatterfeeds class pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer number of feed items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. updatedsince type: string opaque token containing information about the last modified date of the feed. do not construct this token. to retrieve this token, call getfeeditemsfromfilterfeed and take the value from the updatestoken property of the connectapi.feeditempage response body. return value type: connectapi.feeditempage usage this method returns only feed items that have been updated since the time specified in the updatedsince argument. a feed item is considered to be updated if it was created since the last feed request, or if sort=lastmodifieddatedesc and a comment was added to the feed item since the last feed request. adding likes and topics doesn’t update a feed item. to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestgetfeeditemsfromfilterfeedupdatedsince(communityid, subjectid, keyprefix, recentcommentcount, density, pageparam, pagesize, sortparam, updatedsince, result) apex developer guide: testing connectapi code getfeeditemsupdatedsince(communityid, feedtype, recentcommentcount, density, pageparam, pagesize, updatedsince) get a page of feed items from the company, home, and moderation feeds. include only feed items that have been updated since the time specified in the updatedsince parameter. each feed item contains no more than the specified number of comments. api version 30.0–31.0 important: in version 32.0 and later, use getfeedelementsupdatedsince(communityid, feedtype, recentcommentcount, density, pageparam, pagesize, updatedsince). available to guest users 31.0 only 780apex reference guide chatterfeeds class requires chatter yes signature public static connectapi.feeditempage getfeeditemsupdatedsince(string communityid, connectapi.feedtype feedtype, integer recentcommentcount, connectapi.feeddensity density, string pageparam, integer pagesize, string updatedsince) parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype type of feed. valid values are company, directmessagemoderation, directmessages, home, moderation, and pendingreview. recentcommentcount type: integer maximum number of comments to return with each feed item. the default value is 3. density type: connectapi.feeddensity specify the amount of content in a feed. • allupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations. • fewerupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations, but hides some system-generated updates from records. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer number of feed items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. updatedsince type: string an opaque token containing information about the last modified date of the feed. do not construct this token. retrieve this token from the updatestoken property of the connectapi.feeditempage response body. return value type: connectapi.feeditempage 781apex reference guide chatterfeeds class usage" "this method returns only feed items that have been updated since the time specified in the updatedsince argument. a feed item is considered to be updated if it was created since the last feed request, or if sort=lastmodifieddatedesc and a comment was added to the feed item since the last feed request. adding likes and topics doesn’t update a feed item. to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. example this example gets the feed items in the company feed and grabs the updatestoken property from the returned object. it then passes the value of updatestoken to the getfeeditemsupdatedsince method to get the feed items updated since the first call: // get the feed items in the company feed and return the updatestoken string communityid = null; // get the feed and extract the update token connectapi.feeditempage page = connectapi.chatterfeeds.getfeeditemsfromfeed(communityid, connectapi.feedtype.company); // page.updatestoken is opaque and has a value like '2:1384549034000' // get the feed items that changed since the provided updatestoken connectapi.feeditempage feeditems= connectapi.chatterfeeds.getfeeditemsupdatedsince (communityid, connectapi.feedtype.company, 1, connectapi.feeddensity.allupdates, null, 1, page.updatestoken); see also: settestgetfeeditemsupdatedsince(communityid, feedtype, recentcommentcount, density, pageparam, pagesize, updatedsince, connectapi.feeditempage, results) apex developer guide: testing connectapi code getfeeditemsupdatedsince(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, updatedsince) get a page of feed items from the files, groups, news, people, and record feeds. include only feed items that have been updated since the time specified in the updatedsince parameter. each feed item contains no more than the specified number of comments. api version 30.0–31.0 important: in version 32.0 and later, use getfeedelementsupdatedsince(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, updatedsince). available to guest users 31.0 only 782" "apex reference guide chatterfeeds class requires chatter yes signature public static connectapi.feeditempage getfeeditemsupdatedsince(string communityid, connectapi.feedtype feedtype, string subjectid, integer recentcommentcount, connectapi.feeddensity density, string pageparam, integer pagesize, string updatedsince) parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype one of these values: • files • groups • news • people • record subjectid type: string if feedtype is connectapi.record, subjectid can be any record id, including a group id. otherwise, it must be the context user or the alias me. recentcommentcount type: integer maximum number of comments to return with each feed item. the default value is 3. density type: connectapi.feeddensity specify the amount of content in a feed. • allupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations. • fewerupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations, but hides some system-generated updates from records. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer number of feed items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. 783apex reference guide chatterfeeds class updatedsince type: string an opaque token containing information about the last modified date of the feed. do not construct this token. retrieve this token from the updatestoken property of the connectapi.feeditempage response body. return value type: connectapi.feeditempage usage this method returns only feed items that have been updated since the time specified in the updatedsince argument. a feed item is considered to be updated if it was created since the last feed request, or if sort=lastmodifieddatedesc and a comment was added to the feed item since the last feed request. adding likes and topics doesn’t update a feed item. to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. example this example gets the feed items in the news feed and grabs the updatestoken property from the returned object. it then passes the value of updatestoken to the getfeeditemsupdatedsince method to get the feed items updated since the first call: // get the feed items in the news feed and return the updatestoken string communityid = null; string subjectid = 'me'; // get the feed and extract the update token connectapi.feeditempage page = connectapi.chatterfeeds.getfeeditemsfromfeed(communityid, connectapi.feedtype.news, subjectid); // page.updatestoken is opaque and has a value like '2:1384549034000' // get the feed items that changed since the provided updatestoken connectapi.feeditempage feeditems= connectapi.chatterfeeds.getfeeditemsupdatedsince (communityid, connectapi.feedtype.news, subjectid, 1, connectapi.feeddensity.allupdates, null, 1, page.updatestoken); see also: settestgetfeeditemsupdatedsince(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, updatedsince, result) apex developer guide: testing connectapi code getfeeditemsupdatedsince(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, updatedsince, showinternalonly) get a page of feed items from a record feed. include only feed items that have been updated since the time specified in the updatedsince parameter. specify whether to return feed items posted by internal (non-experience cloud site) users only. 784apex reference guide chatterfeeds class api version 30.0–31.0 important: in version 32.0 and later, use getfeedelementsupdatedsince(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize," "updatedsince, showinternalonly). available to guest users 31.0 only requires chatter yes signature public static connectapi.feeditempage getfeeditemsupdatedsince(string communityid, connectapi.feedtype feedtype, string subjectid, integer recentcommentcount, connectapi.feeddensity density, string pageparam, integer pagesize, string updatedsince, boolean showinternalonly) parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype value must be connectapi.feedtype.record. subjectid type: string any record id, including a group id. recentcommentcount type: integer maximum number of comments to return with each feed item. the default value is 3. density type: connectapi.feeddensity specify the amount of content in a feed. • allupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations. • fewerupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations, but hides some system-generated updates from records. pageparam type: string 785apex reference guide chatterfeeds class page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer number of feed items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. updatedsince type: string an opaque token containing information about the last modified date of the feed. do not construct this token. retrieve this token from the updatestoken property of the connectapi.feeditempage response body. showinternalonly type: boolean specifies whether to show only feed items from internal (non-experience cloud site) users (true), or not (false). the default value is false. return value type: connectapi.feeditempage usage this method returns only feed items that have been updated since the time specified in the updatedsince argument. a feed item is considered to be updated if it was created since the last feed request, or if sort=lastmodifieddatedesc and a comment was added to the feed item since the last feed request. adding likes and topics doesn’t update a feed item. if showinternalonly is true and digital experiences is enabled, feed items from experience cloud sites are included. otherwise, only feed items from the internal site are included. to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. example this example gets the feed items in the news feed and grabs the updatestoken property from the returned object. it then passes the value of updatestoken to the getfeeditemsupdatedsince method to get the feed items updated since the first call: // get the feed items in the news feed and return the updatestoken string communityid = null; string subjectid = 'me'; // get the feed and extract the update token connectapi.feeditempage page = connectapi.chatterfeeds.getfeeditemsfromfeed(communityid, connectapi.feedtype.news, subjectid); // page.updatestoken is opaque and has a value like '2:1384549034000' // get the feed items that changed since the provided updatestoken connectapi.feeditempage feeditems= connectapi.chatterfeeds.getfeeditemsupdatedsince 786apex reference guide chatterfeeds class (communityid, connectapi.feedtype.news, subjectid, 1, connectapi.feeddensity.allupdates, null, 1, page.updatestoken, true); see also: settestgetfeeditemsupdatedsince(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, updatedsince, showinternalonly, result) apex developer guide: testing connectapi code getfeedpoll(communityid, feeditemid) get the poll associated with a feed item. api version 28.0–31.0 important: in version 32.0 and later, use getfeedelementpoll(communityid, feedelementid). requires chatter yes signature public static connectapi.feedpoll getfeed" "poll(string communityid, string feeditemid) parameters communityid type: string id for an experience cloud site, internal, or null. feeditemid type: string id for a feed item. return value type: connectapi.feedpoll note: triggers on feeditem objects run before their attachment and capabilities information is saved, which means that connectapi.feeditem.attachment information and connectapi.feedelement.capabilities information may not be available in the trigger. getlikesforfeeditem(communityid, feeditemid) get likes for a feed item. 787apex reference guide chatterfeeds class api version 28.0–31.0 important: in version 32.0 and later, use getlikesforfeedelement(communityid, feedelementid). available to guest users 31.0 only requires chatter yes signature public static connectapi.chatterlikepage getlikesforfeeditem(string communityid, string feeditemid) parameters communityid type: string id for an experience cloud site, internal, or null. feeditemid type: string id for a feed item. return value type: connectapi.chatterlikepage getlikesforfeeditem(communityid, feeditemid, pageparam, pagesize) get a page of likes for a feed item. api version 28.0–31.0 important: in version 32.0 and later, use getlikesforfeedelement(communityid, feedelementid, pageparam, pagesize). available to guest users 31.0 only requires chatter yes 788apex reference guide chatterfeeds class signature public static connectapi.chatterlikepage getlikesforfeeditem(string communityid, string feeditemid, integer pageparam, integer pagesize) parameters communityid type: string id for an experience cloud site, internal, or null. feeditemid type: string id for a feed item. pageparam type: integer number of the page you want returned. starts at 0. if you pass in null or 0, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. return value type: connectapi.chatterlikepage likefeeditem(communityid, feeditemid) like a feed item for the context user. api version 28.0–31.0 important: in version 32.0 and later, use likefeedelement(communityid, feedelementid). requires chatter yes signature public static connectapi.chatterlike likefeeditem(string communityid, string feeditemid) parameters communityid type: string id for an experience cloud site, internal, or null. 789apex reference guide chatterfeeds class feeditemid type: string id for a feed item. return value type: connectapi.chatterlike if the context user already liked the feed item, this method is a non-operation and returns the existing like. postcomment(communityid, feeditemid, text) post a plain-text comment to a feed item. api version 28.0–31.0 important: in version 32.0 and later, use postcommenttofeedelement(communityid, feedelementid, text). requires chatter yes signature public static connectapi.comment postcomment(string communityid, string feeditemid, string text) parameters communityid type: string id for an experience cloud site, internal, or null. feeditemid type: string id for a feed item. text type: string the text of the comment. mentions are downgraded to plain text. to include a mention that links to a user, call postcomment(communityid, feeditemid, comment, feeditemfileupload) and pass the mention in a connectapi.commentinput object. return value type: connectapi.comment 790apex reference guide chatterfeeds class usage if hashtags or links are detected in text, they’re included in the comment as hashtag and link segments. mentions aren’t detected in text and aren’t separated out of the text. feed items and comments can contain up to 10,000 characters. postcomment(communityid, feeditemid, comment, feeditemfileupload" ") post a rich-text comment to a feed item. use this method to include mentions and to attach a file to a comment. api version 28.0–31.0 important: in version 32.0 and later, use postcommenttofeedelement(communityid, feedelementid, comment, feedelementfileupload). requires chatter yes signature public static connectapi.comment postcomment(string communityid, string feeditemid, connectapi.commentinput comment, connectapi.binaryinput feeditemfileupload) parameters communityid type: string id for an experience cloud site, internal, or null. feeditemid type: string id for a feed item. comment type: connectapi.commentinput in the commentinput object, specify rich text, including @mentions. optionally, in the commentinput.attachment property, specify an existing file or a new file feeditemfileupload type: connectapi.binaryinput if you specify a newfileattachmentinput object in the commentinput.attachment property, specify the new binary file to attach in this argument. otherwise, do not specify a value. return value type: connectapi.comment 791apex reference guide chatterfeeds class usage feed items and comments can contain up to 10,000 characters. sample: posting a comment with a new file attachment to post a comment and upload and attach a new file to the comment, create a connectapi.commentinput object and a connectapi.binaryinput object to pass to the connectapi.chatterfeeds.postcomment method. string communityid = null; string feeditemid = '0d5d0000000kcd1'; connectapi.commentinput input = new connectapi.commentinput(); connectapi.messagebodyinput messageinput = new connectapi.messagebodyinput(); connectapi.textsegmentinput textsegment; textsegment = new connectapi.textsegmentinput(); textsegment.text = 'comment text body'; messageinput.messagesegments = new list(); messageinput.messagesegments.add(textsegment); input.body = messageinput; connectapi.newfileattachmentinput attachmentinput = new connectapi.newfileattachmentinput(); attachmentinput.description = 'the description of the file'; attachmentinput.title = 'contentfile.txt'; input.attachment = attachmentinput; string filecontents = 'this is the content of the file.'; blob fileblob = blob.valueof(filecontents); connectapi.binaryinput binaryinput = new connectapi.binaryinput(fileblob, 'text/plain', 'contentfile.txt'); connectapi.comment commentrep = connectapi.chatterfeeds.postcomment(communityid, feeditemid, input, binaryinput); postfeedelement(communityid, feedelement, feedelementfileupload) post a rich-text feed element. include mentions and hashtag topics, attach a file to a feed element, and associate action link groups with a feed element. you can also use this method to share a feed element and add a comment. api version 31.0–35.0 important: in version 36.0 and later, this method is no longer available because you can’t create a feed post and upload a binary file in the same call. upload files to salesforce first, and then use postfeedelement(communityid, feedelement) to create the feed post and attach the files. requires chatter yes 792apex reference guide chatterfeeds class signature public static connectapi.feedelement postfeedelement(string communityid, connectapi.feedelementinput feedelement, connectapi.binaryinput feedelementfileupload) parameters communityid type: string id for an experience cloud site, internal, or null. feedelement type: connectapi.feedelementinput specify rich text, including mentions. optionally, specify a link, a poll, an existing file, or a new file. feedelementfileupload type: connectapi.binaryinput specify the new binary file to attach to the post only if you also specify a newfileattachmentinput object in the feedelement parameter. otherwise, pass null. return value type: connectapi.feedelement example for posting a feed element with a new (binary) file connecta" "pi.feediteminput input = new connectapi.feediteminput(); input.subjectid = 'me'; connectapi.contentcapabilityinput contentinput = new connectapi.contentcapabilityinput(); contentinput.title = 'title'; connectapi.feedelementcapabilitiesinput capabilities = new connectapi.feedelementcapabilitiesinput(); capabilities.content = contentinput; input.capabilities = capabilities; string text = 'these are the contents of the new file.'; blob myblob = blob.valueof(text); connectapi.binaryinput bininput = new connectapi.binaryinput(myblob, 'text/plain', 'filename'); connectapi.chatterfeeds.postfeedelement(network.getnetworkid(), input, bininput); postfeeditem(communityid, feedtype, subjectid, text) post a plain-text feed item. api version 28.0–31.0 793apex reference guide chatterfeeds class important: in version 32.0 and later, use postfeedelement(communityid, subjectid, feedelementtype, text). requires chatter yes signature public static connectapi.feeditem postfeeditem(string communityid, connectapi.feedtype feedtype, string subjectid, string text) parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype one of the following: • news • record • userprofile use record to post to a group. subjectid type: string the value depends on the feedtype: • news—id of the context user or the keyword me. • record—id of any record with a feed, including groups. • userprofile—id of any user. text type: string text of the feed item. mentions are downgraded to plain text. to include a mention that links to the user, call the postfeeditem(communityid, feedtype, subjectid, feediteminput, feeditemfileupload) method and pass the mention in a connectapi.feediteminput object. return value type: connectapi.feeditem note: triggers on feeditem objects run before their attachment and capabilities information is saved, which means that connectapi.feeditem.attachment information and connectapi.feedelement.capabilities information may not be available in the trigger. 794apex reference guide chatterfeeds class usage feed items and comments can contain up to 10,000 characters. posts to connectapi.feedtype.userprofile in api versions 23.0 and 24.0 created user status updates, not feed items. for posts to the user profile feed in those api versions, the character limit is 1,000 characters. postfeeditem(communityid, feedtype, subjectid, feediteminput, feeditemfileupload) post a rich-text feed item to a feed. use this method to include mentions and hashtag topics and to attach a file to a feed item. you can also use this method to share a feed item and add a comment. api version 28.0–31.0 important: in version 32.0 and later, use postfeedelement(communityid, feedelement, feedelementfileupload). requires chatter yes signature public static connectapi.feeditem postfeeditem(string communityid, connectapi.feedtype feedtype, string subjectid, connectapi.feediteminput feediteminput, connectapi.binaryinput feeditemfileupload) parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype one of the following: • news • record • userprofile to post a feed item to a group, use record and use a group id as the subjectid. subjectid type: string if feedtype is record, subjectid can be any record id, including a group id. if feedtype is streams, subjectid must be a stream id. if feedtype is topics, subjectid must be a topic id. if feedtype is userprofile, subjectid can be any user id. if the feedtype is any other value, subjectid must be the id of the context user or the alias me. feediteminput type: connectapi.feediteminput 795apex reference guide chatterfeeds class in the feediteminput object, specify rich text. optionally, in" "the feediteminput.attachment property, specify a link, a poll, an existing file, or a new file. feeditemfileupload type: connectapi.binaryinput if you specify a newfileattachmentinput object in the feediteminput.attachment property, specify the new binary file to attach in this argument. otherwise, do not specify a value. return value type: connectapi.feeditem note: triggers on feeditem objects run before their attachment and capabilities information is saved, which means that connectapi.feeditem.attachment information and connectapi.feedelement.capabilities information may not be available in the trigger. usage feed items and comments can contain up to 10,000 characters.posts to connectapi.feedtype.userprofile in api versions 23.0 and 24.0 created user status updates, not feed items. for posts to the user profile feed in those api versions, the character limit is 1,000 characters. example for sharing a feed item and adding a comment to share a feed item and add a comment, create a connectapi.feediteminput object containing the comment and the feed item to share. then pass the object to connectapi.chatterfeeds.postfeeditem in the feediteminput argument. the message segments in the message body input are used as the comment. connectapi.feediteminput input = new connectapi.feediteminput(); input.originalfeeditemid = '0d5d0000000juag'; connectapi.messagebodyinput body = new connectapi.messagebodyinput(); list segmentlist = new list(); connectapi.textsegmentinput textsegment = new connectapi.textsegmentinput(); textsegment.text = 'i hope you enjoy this post i found in another group.'; segmentlist.add((connectapi.messagesegmentinput)textsegment); body.messagesegments = segmentlist; input.body = body; connectapi.chatterfeeds.postfeeditem(null, connectapi.feedtype.userprofile, 'me', input, null); example for posting a mention to a user profile feed to post to a user profile feed and include an @mention, call the connectapi.chatterfeeds.postfeeditem method. string communityid = null; connectapi.feedtype feedtype = connectapi.feedtype.userprofile; connectapi.feediteminput input = new connectapi.feediteminput(); connectapi.messagebodyinput messageinput = new connectapi.messagebodyinput(); connectapi.textsegmentinput textsegment; 796apex reference guide chatterfeeds class connectapi.mentionsegmentinput mentionsegment = new connectapi.mentionsegmentinput(); messageinput.messagesegments = new list(); textsegment = new connectapi.textsegmentinput(); textsegment.text = 'hey there '; messageinput.messagesegments.add(textsegment); mentionsegment.id = '005d0000001llo1'; messageinput.messagesegments.add(mentionsegment); textsegment = new connectapi.textsegmentinput(); textsegment.text = '. how are you?'; messageinput.messagesegments.add(textsegment); input.body = messageinput; connectapi.feeditem feeditemrep = connectapi.chatterfeeds.postfeeditem(communityid, feedtype, 'me', input, null); searchfeeditems(communityid, q) get the feed items that match the search criteria. api version 28.0–31.0 important: in version 32.0 and later, use searchfeedelements(communityid, q). available to guest users 31.0 only requires chatter yes signature public static connectapi.feeditempage searchfeeditems(string communityid, string q) parameters communityid type: string id for an experience cloud site, internal, or null. q type: string required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. 797apex reference guide chatterfeeds class return value type: connectapi.feeditempage" "usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestsearchfeeditems(communityid, q, result) apex developer guide: testing connectapi code searchfeeditems(communityid, q, sortparam) get the sorted feed items that match the search criteria. api version 28.0–31.0 important: in version 32.0 and later, use searchfeedelements(communityid, q, sortparam). available to guest users 31.0 only requires chatter yes signature public static connectapi.feeditempage searchfeeditems(string communityid, string q, connectapi.feedsortorder sortparam) parameters communityid type: string id for an experience cloud site, internal, or null. q type: string required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. sortparam type: connectapi.feedsortorder values are: 798apex reference guide chatterfeeds class • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. sorts the returned feed by the most recently created feed item, or by the most recently modified feed item. if you pass in null, the default value createddatedesc is used. return value type: connectapi.feeditempage usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestsearchfeeditems(communityid, q, sortparam, result) apex developer guide: testing connectapi code searchfeeditems(communityid, q, pageparam, pagesize) get a page of feed items that match the search criteria. api version 28.0–31.0 important: in version 32.0 and later, use searchfeedelements(communityid, q, pageparam, pagesize). available to guest users 31.0 only requires chatter yes signature public static connectapi.feeditempage searchfeeditems(string communityid, string q, string pageparam, integer pagesize) 799apex reference guide chatterfeeds class parameters communityid type: string id for an experience cloud site, internal, or null. q type: string required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer number of feed items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. return value type: connectapi.feeditempage usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestsearchfeeditems(communityid, q, pageparam, pagesize, result) apex developer guide: testing connectapi code searchfeeditems(communityid, q, pageparam, pagesize, sortparam) get a page of sorted feed items that match the search criteria. api version 28.0–31.0 important: in version 32.0 and later, use searchfeedelements(communityid, q, pageparam, pagesize, sortparam). available to guest users 31.0 only requires chatter yes 800apex reference guide chatterfeeds class signature public static connectapi.feeditempage" "searchfeeditems(string communityid, string q, string pageparam, integer pagesize, connectapi.feedsortorder sortparam) parameters communityid type: string id for an experience cloud site, internal, or null. q type: string required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer number of feed items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.feedsortorder values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. sorts the returned feed by the most recently created feed item, or by the most recently modified feed item. if you pass in null, the default value createddatedesc is used. return value type: connectapi.feeditempage 801apex reference guide chatterfeeds class usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestsearchfeeditems(communityid, q, pageparam, pagesize, sortparam, result) apex developer guide: testing connectapi code searchfeeditems(communityid, q, recentcommentcount, pageparam, pagesize, sortparam) get a page of sorted feed items that match the search criteria. api version 29.0–31.0 important: in version 32.0 and later, use searchfeedelements(communityid, q, recentcommentcount, pageparam, pagesize, sortparam). available to guest users 31.0 only requires chatter yes signature public static connectapi.feeditempage searchfeeditems(string communityid, string q, integer recentcommentcount, string pageparam, integer pagesize, connectapi.feedsortorder sortparam) parameters communityid type: string id for an experience cloud site, internal, or null. q type: string required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. recentcommentcount type: integer maximum number of comments to return with each feed item. the default value is 3. 802apex reference guide chatterfeeds class pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer number of feed items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.feedsortorder values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. sorts the returned feed by the most recently created feed item, or by the most recently modified feed item. if you pass in null, the default value createddatedesc is used. return value type: connectapi.feeditempage usage to test code that uses" "this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestsearchfeeditems(communityid, q, recentcommentcount, pageparam, pagesize, sortparam, result) apex developer guide: testing connectapi code searchfeeditemsinfeed(communityid, feedtype, q) get the feed items from the company, home, and moderation feeds that match the search criteria. api version 28.0–31.0 important: in version 32.0 and later, use searchfeedelementsinfeed(communityid, feedtype, q). 803apex reference guide chatterfeeds class available to guest users 31.0 only requires chatter yes signature public static connectapi.feeditempage searchfeeditemsinfeed(string communityid, connectapi.feedtype feedtype, string q) parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype type of feed. valid values are company, directmessagemoderation, directmessages, home, moderation, and pendingreview. q type: string required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. return value type: connectapi.feeditempage usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestsearchfeeditemsinfeed(communityid, feedtype, q, result) apex developer guide: testing connectapi code searchfeeditemsinfeed(communityid, feedtype, pageparam, pagesize, sortparam, q) get a page of sorted feed items from the company, home, and moderation feeds that match the search criteria. api version 28.0–31.0 804apex reference guide chatterfeeds class important: in version 32.0 and later, use searchfeedelementsinfeed(communityid, feedtype, pageparam, pagesize, sortparam, q). available to guest users 31.0 only requires chatter yes signature public static connectapi.feeditempage searchfeeditemsinfeed(string communityid, connectapi.feedtype feedtype, string pageparam, integer pagesize, connectapi.feedsortorder sortparam, string q) parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype type of feed. valid values are company, directmessagemoderation, directmessages, home, moderation, and pendingreview. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer number of feed items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.feedsortorder values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. sorts the returned feed by the most recently created feed item, or by the most recently modified feed item. if you pass in null, the default value createddatedesc is used. 805apex reference guide chatterfeeds class q type: string required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. return value type: connectapi.feeditempage usage to test code that uses this method, use the matching set test method (prefix the method name with set" "test). use the set test method with the same parameters or the code throws an exception. see also: settestsearchfeeditemsinfeed(communityid, feedtype, pageparam, pagesize, sortparam, q, result) apex developer guide: testing connectapi code searchfeeditemsinfeed(communityid, feedtype, recentcommentcount, density, pageparam, pagesize, sortparam, q) get a page of sorted feed items from the company, home, and moderation feeds that match the search criteria. each feed item includes no more than the specified number of comments. api version 29.0–31.0 important: in version 32.0 and later, use searchfeedelementsinfeed(communityid, feedtype, recentcommentcount, density, pageparam, pagesize, sortparam, q). available to guest users 31.0 only requires chatter yes signature public static connectapi.feeditempage searchfeeditemsinfeed(string communityid, connectapi.feedtype feedtype, integer recentcommentcount, connectapi.feeddensity density, string pageparam, integer pagesize, connectapi.feedsortorder sortparam, string q) parameters communityid type: string 806apex reference guide chatterfeeds class id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype type of feed. valid values are company, directmessagemoderation, directmessages, home, moderation, and pendingreview. recentcommentcount type: integer maximum number of comments to return with each feed item. the default value is 3. density type: connectapi.feeddensity specify the amount of content in a feed. • allupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations. • fewerupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations, but hides some system-generated updates from records. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer number of feed items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.feedsortorder values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. sorts the returned feed by the most recently created feed item, or by the most recently modified feed item. if you pass in null, the default value createddatedesc is used. q type: string required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. return value type: connectapi.feeditempage 807apex reference guide chatterfeeds class usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestsearchfeeditemsinfeed(communityid, feedtype, recentcommentcount, density, pageparam, pagesize, sortparam, q, result) apex developer guide: testing connectapi code searchfeeditemsinfeed(communityid, feedtype, subjectid, q) get the feed items from a feed that match the search criteria. api version 28.0–31.0 important: in version 32.0 and later, use searchfeedelementsinfeed(communityid, feedtype, subjectid, q). available to guest users 31.0 only requires chatter yes signature public static connectapi.feeditempage searchfeeditemsinfeed(string communityid, connectapi." "feedtype feedtype, string subjectid, string q) parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype type of feed. valid values include every connectapi.feedtype except company, directmessages, filter, landing, and streams. subjectid type: string if feedtype is record, subjectid can be any record id, including a group id. if feed type is userprofile, subjectid can be any user id. if feedtype is any other value, subjectid must be the id of the context user or the alias me. q type: string 808apex reference guide chatterfeeds class required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. return value type: connectapi.feeditempage usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestsearchfeeditemsinfeed(communityid, feedtype, subjectid, q, result) apex developer guide: testing connectapi code searchfeeditemsinfeed(communityid, feedtype, subjectid, pageparam, pagesize, sortparam, q) get a page of sorted feed items from a feed for a user or record that match the search criteria. api version 28.0–31.0 important: in version 32.0 and later, use searchfeedelementsinfeed(communityid, feedtype, subjectid, pageparam, pagesize, sortparam, q). available to guest users 31.0 only requires chatter yes signature public static connectapi.feeditempage searchfeeditemsinfeed(string communityid, connectapi.feedtype feedtype, string subjectid, string pageparam, integer pagesize, connectapi.feedsortorder sortparam, string q) parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype 809apex reference guide chatterfeeds class type of feed. valid values include every connectapi.feedtype except company, directmessages, filter, landing, and streams. subjectid type: string if feedtype is record, subjectid can be any record id, including a group id. if feedtype is streams, subjectid must be a stream id. if feedtype is topics, subjectid must be a topic id. if feedtype is userprofile, subjectid can be any user id. if the feedtype is any other value, subjectid must be the id of the context user or the alias me. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer number of feed items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.feedsortorder order of feed items in the feed. • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. sorts the returned feed by the most recently created feed item, or by the most recently modified feed item. if you pass in null, the default value createddatedesc is used. q type: string search term. searches keywords in the user or group name. a minimum of one character is required. this parameter doesn’t support wildcards. this parameter is required. return value type: connectapi.feeditempage usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see" "also: settestsearchfeeditemsinfeed(communityid, feedtype, subjectid, pageparam, pagesize, sortparam, q, result) apex developer guide: testing connectapi code 810apex reference guide chatterfeeds class searchfeeditemsinfeed(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, sortparam, q) get a page of sorted feed items from a feed that match the search criteria. each feed item includes no more than the specified number of comments. api version 29.0–31.0 important: in version 32.0 and later, use searchfeedelementsinfeed(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, sortparam, q). available to guest users 31.0 only requires chatter yes signature public static connectapi.feeditempage searchfeeditemsinfeed(string communityid, connectapi.feedtype feedtype, string subjectid, integer recentcommentcount, connectapi.feeddensity density, string pageparam, integer pagesize, connectapi.feedsortorder sortparam, string q) parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype type of feed. valid values include every connectapi.feedtype except company, directmessages, filter, landing, and streams. subjectid type: string if feedtype is record, subjectid can be any record id, including a group id. if feedtype is streams, subjectid must be a stream id. if feedtype is topics, subjectid must be a topic id. if feedtype is userprofile, subjectid can be any user id. if the feedtype is any other value, subjectid must be the id of the context user or the alias me. recentcommentcount type: integer maximum number of comments to return with each feed item. the default value is 3. density type: connectapi.feeddensity specify the amount of content in a feed. 811apex reference guide chatterfeeds class • allupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations. • fewerupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations, but hides some system-generated updates from records. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer number of feed items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.feedsortorder values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. sorts the returned feed by the most recently created feed item, or by the most recently modified feed item. if you pass in null, the default value createddatedesc is used. q type: string required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. return value type: connectapi.feeditempage usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestsearchfeeditemsinfeed(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, sortparam, q, result) apex developer guide: testing connectapi code 812apex reference guide chatterfeeds class searchfeeditemsinfeed(communityid, feedtype, subjectid, recent" "commentcount, density, pageparam, pagesize, sortparam, q, showinternalonly) get a page of sorted feed items from a feed for a user or record that match the search criteria. each feed item includes no more than the specified number of comments. specify whether to return feed items posted by internal (non-experience cloud site) users only. api version 30.0–31.0 important: in version 32.0 and later, use searchfeedelementsinfeed(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, sortparam, q, showinternalonly). available to guest users 31.0 only requires chatter yes signature public static connectapi.feeditempage searchfeeditemsinfeed(string communityid, connectapi.feedtype feedtype, string subjectid, integer recentcommentcount, connectapi.feeddensity density, string pageparam, integer pagesize, connectapi.feedsortorder sortparam, string q, boolean showinternalonly) parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype value must be connectapi.feedtype.record. subjectid type: string any record id, including a group id. recentcommentcount type: integer maximum number of comments to return with each feed item. the default value is 3. density type: connectapi.feeddensity specify the amount of content in a feed. • allupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations. 813apex reference guide chatterfeeds class • fewerupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations, but hides some system-generated updates from records. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer number of feed items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.feedsortorder values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. sorts the returned feed by the most recently created feed item, or by the most recently modified feed item. if you pass in null, the default value createddatedesc is used. q type: string required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. showinternalonly type: boolean specifies whether to show only feed items from internal (non-experience cloud site) users (true), or not (false). the default value is false. return value type: connectapi.feeditempage usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestsearchfeeditemsinfeed(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, sortparam, q, showinternalonly, result) apex developer guide: testing connectapi code 814apex reference guide chatterfeeds class searchfeeditemsinfilterfeed(communityid, subjectid, keyprefix, q) get the feed items that match the search criteria from a feed filtered by a key prefix for a user. api version 28.0–31.0 important: in version 32.0 and later, use searchfeedelementsinfilterfeed(communityid, subjectid, keyprefix, q). requires chatter yes signature public static connectapi.feeditem" "page searchfeeditemsinfilterfeed(string communityid, string subjectid, string keyprefix, string q) parameters communityid type: string id for an experience cloud site, internal, or null. subjectid type: string id of the context user or the alias me. keyprefix type: string a key prefix that specifies record type. a key prefix is the first three characters in the object id, which specifies the object type. for example, user objects have a prefix of 005 and group objects have a prefix of 0f9. q type: string required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. return value type: connectapi.feeditempage 815apex reference guide chatterfeeds class usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestsearchfeeditemsinfilterfeed(communityid, subjectid, keyprefix, q, result) apex developer guide: testing connectapi code searchfeeditemsinfilterfeed(communityid, subjectid, keyprefix, pageparam, pagesize, sortparam, q) get a page of sorted feed items that match the search criteria from a feed filtered by a key prefix for a user. api version 28.0–31.0 important: in version 32.0 and later, use searchfeedelementsinfilterfeed(communityid, subjectid, keyprefix, pageparam, pagesize, sortparam, q). requires chatter yes signature public static connectapi.feeditempage searchfeeditemsinfilterfeed(string communityid, string subjectid, string keyprefix, string pageparam, integer pagesize, connectapi.feedsortorder sortparam, string q) parameters communityid type: string id for an experience cloud site, internal, or null. subjectid type: string id of the context user or the alias me. keyprefix type: string a key prefix that specifies record type. a key prefix is the first three characters in the object id, which specifies the object type. for example, user objects have a prefix of 005 and group objects have a prefix of 0f9. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. 816apex reference guide chatterfeeds class pagesize type: integer number of feed items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.feedsortorder values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. sorts the returned feed by the most recently created feed item, or by the most recently modified feed item. if you pass in null, the default value createddatedesc is used. q type: string required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. return value type: connectapi.feeditempage usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestsearchfeeditemsinfilterfeed(communityid, feedtype, subjectid, keyprefix, pageparam, pagesize, sortparam, q, result) apex developer guide: testing connectapi code searchfeeditemsinfilterfeed(communityid, subjectid, keyprefix, recentcommentcount, density, pageparam, pagesize, sortparam, q) get a page of sorted feed items" "that match the search criteria from a feed filtered by a key prefix for a user. each feed item includes no more than the specified number of comments. api version 29.0–31.0 important: in version 32.0 and later, use searchfeedelementsinfilterfeed(communityid, subjectid, keyprefix, recentcommentcount, density, pageparam, pagesize, sortparam, q). 817apex reference guide chatterfeeds class requires chatter yes signature public static connectapi.feeditempage searchfeeditemsinfilterfeed(string communityid, string subjectid, string keyprefix, integer recentcommentcount, connectapi.feeddensity density, string pageparam, integer pagesize, connectapi.feedsortorder sortparam, string q) parameters communityid type: string id for an experience cloud site, internal, or null. subjectid type: string id of the context user or the alias me. keyprefix type: string a key prefix that specifies record type. a key prefix is the first three characters in the object id, which specifies the object type. for example, user objects have a prefix of 005 and group objects have a prefix of 0f9. recentcommentcount type: integer maximum number of comments to return with each feed item. the default value is 3. density type: connectapi.feeddensity specify the amount of content in a feed. • allupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations. • fewerupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations, but hides some system-generated updates from records. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer number of feed items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.feedsortorder values are: 818apex reference guide chatterfeeds class • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. sorts the returned feed by the most recently created feed item, or by the most recently modified feed item. if you pass in null, the default value createddatedesc is used. q type: string required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. return value type: connectapi.feeditempage usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestsearchfeeditemsinfilterfeed(communityid, feedtype, subjectid, keyprefix, recentcommentcount, density, pageparam, pagesize, sortparam, q, result) apex developer guide: testing connectapi code sharefeedelement(communityid, subjectid, feedelementtype, originalfeedelementid) share the originalfeedelementid as the context user. api version 31.0–38.0 important: in version 39.0 and later, use postfeedelement(communityid, feedelement) or updatefeedelement(communityid, feedelementid, feedelement) with the connectapi. feedentitysharecapabilityinput to share a feed entity with a feed element. requires chatter yes 819apex reference guide chatterfeeds class signature public static connectapi.feedelement sharefeedelement(string communityid, string subjectid, connectapi.feedelementtype feedelementtype, string originalfeedelementid) parameters communityid type: string" "id for an experience cloud site, internal, or null. subjectid type: string the id of the user or group with whom to share the feed element. feedelementtype type: connectapi.feedelementtype values are: • bundle—a container of feed elements. a bundle also has a body made up of message segments that can always be gracefully degraded to text-only values. • feeditem—a feed item has a single parent and is scoped to oneexperience cloud site or across all experience cloud sites. a feed item can have capabilities such as bookmarks, canvas, content, comment, link, poll. feed items have a body made up of message segments that can always be gracefully degraded to text-only values. • recommendation—a recommendation is a feed element with a recommendations capability. a recommendation suggests records to follow, groups to join, or applications that are helpful to the context user. originalfeedelementid type: string the id of the feed element to share. return value type: connectapi.feedelement example connectapi.chatterfeeds.sharefeedelement(null, '0f9rr0000004cpw', connectapi.feedelementtype.feeditem, '0d5rr0000004gxc'); sharefeeditem(communityid, feedtype, subjectid, originalfeeditemid) share the originalfeeditemid to the feed specified by the feedtype. api version 28.0–31.0 important: • in version 32.0–38.0, use sharefeedelement(communityid, subjectid, feedelementtype, originalfeedelementid). 820apex reference guide chatterfeeds class • in version 39.0 and later, use postfeedelement(communityid, feedelement) or updatefeedelement(communityid, feedelementid, feedelement) with the connectapi. feedentitysharecapabilityinput. requires chatter yes signature public static connectapi.feeditem sharefeeditem(string communityid, connectapi.feedtype feedtype, string subjectid, string originalfeeditemid) parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype one of the following: • news • record • userprofile to share a feed item with a group, use record and use a group id as the subjectid. subjectid type: string the value depends on the value of feedtype: • news—subjectid must be the id of the context user or the keyword me. • record—subjectid can be a group id or the id of the context user (or me). • userprofile—subjectid can be any user id. originalfeeditemid type: string the id of the feed item to share. return value type: connectapi.feeditem 821apex reference guide chatterfeeds class example to share a feed item with a group, pass in the experience cloud site id (or null), the feed type record, the group id, and the id of the feed item to share. connectapi.chatterfeeds.sharefeeditem(null, connectapi.feedtype.record, '0f9d00000000izf', '0d5d0000000juag'); updatebookmark(communityid, feeditemid, isbookmarkedbycurrentuser) bookmark a feed item or remove a bookmark from a feed item. api version 28.0–31.0 important: in version 32.0 and later, use updatefeedelementbookmarks(communityid, feedelementid, bookmarks) or updatefeedelementbookmarks(communityid, feedelementid, isbookmarkedbycurrentuser). requires chatter yes signature public static connectapi.feeditem updatebookmark(string communityid, string feeditemid, boolean isbookmarkedbycurrentuser) parameters communityid type: string id for an experience cloud site, internal, or null. feeditemid type: string id for a feed item. isbookmarkedbycurrentuser type: boolean —specifying true adds the feed item to the list of bookmarks for the context user. specify false to remove a bookmark. return value type: connectapi.feeditem voteonfeedpoll(communityid, feeditemid, mychoiceid) vote or change your vote on a feed poll. 822apex reference guide chatterfeeds class api version 28.0–31.0" "important: in version 32.0 and later, use voteonfeedelementpoll(communityid, feedelementid, mychoiceid). requires chatter yes signature public static connectapi.feedpoll voteonfeedpoll(string communityid, string feeditemid, string mychoiceid) parameters communityid type: string id for an experience cloud site, internal, or null. feeditemid type: string id of the feed item that is associated with the poll. mychoiceid type: string id of the item in the poll you’re voting for. return value type: connectapi.feedpoll settestgetfeeditemsfromfeed(communityid, feedtype, result) register a connectapi.feeditempage object to be returned when getfeeditemsfromfeed is called with matching parameters in a test context. use the get feed method with the same parameters or the code throws an exception. api version 28.0–31.0 signature public static void settestgetfeeditemsfromfeed(string communityid, connectapi.feedtype feedtype, connectapi.feeditempage result) parameters communityid type: string 823apex reference guide chatterfeeds class id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype type of feed. valid values are company, directmessagemoderation, directmessages, home, moderation, and pendingreview. result type: connectapi.feeditempage object containing test data. return value type: void see also: getfeeditemsfromfeed(communityid, feedtype) apex developer guide: testing connectapi code settestgetfeeditemsfromfeed(communityid, feedtype, pageparam, pagesize, sortparam, result) register a connectapi.feeditempage object to be returned when getfeeditemsfromfeed is called with matching parameters in a test context. use the get feed method with the same parameters or the code throws an exception. api version 28.0–31.0 signature public static void settestgetfeeditemsfromfeed(string communityid, connectapi.feedtype feedtype, string pageparam, integer pagesize, connectapi.feedsortorder sortparam, connectapi.feeditempage result) parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype type of feed. valid values are company, directmessagemoderation, directmessages, home, moderation, and pendingreview. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. 824apex reference guide chatterfeeds class pagesize type: integer number of feed items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.feedsortorder values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. sorts the returned feed by the most recently created feed item, or by the most recently modified feed item. if you pass in null, the default value createddatedesc is used. result type: connectapi.feeditempage object containing test data. return value type: void see also: getfeeditemsfromfeed(communityid, feedtype, pageparam, pagesize, sortparam) apex developer guide: testing connectapi code settestgetfeeditemsfromfeed(communityid, feedtype, recentcommentcount, density, pageparam, pagesize, sortparam, result) register a connectapi.feeditempage object to be returned when getfeeditemsfromfeed is called with matching parameters in a test context. use the get feed method with the same parameters or the code" "throws an exception. api version 29.0–31.0 signature public static void settestgetfeeditemsfromfeed(string communityid, connectapi.feedtype feedtype, integer recentcommentcount, connectapi.feeddensity density, string pageparam, integer pagesize, connectapi.feedsortorder sortparam, connectapi.feeditempage result) 825apex reference guide chatterfeeds class parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype type of feed. valid values are company, directmessagemoderation, directmessages, home, moderation, and pendingreview. recentcommentcount type: integer maximum number of comments to return with each feed item. the default value is 3. density type: connectapi.feeddensity specify the amount of content in a feed. • allupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations. • fewerupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations, but hides some system-generated updates from records. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer number of feed items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.feedsortorder values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. sorts the returned feed by the most recently created feed item, or by the most recently modified feed item. if you pass in null, the default value createddatedesc is used. result type: connectapi.feeditempage object containing test data. 826apex reference guide chatterfeeds class return value type: void see also: getfeeditemsfromfeed(communityid, feedtype, recentcommentcount, density, pageparam, pagesize, sortparam) apex developer guide: testing connectapi code settestgetfeeditemsfromfeed(communityid, feedtype, subjectid, result) register a connectapi.feeditempage object to be returned when getfeeditemsfromfeed is called with matching parameters in a test context. use the get feed method with the same parameters or the code throws an exception. api version 28.0–31.0 signature public static void settestgetfeeditemsfromfeed(string communityid, connectapi.feedtype feedtype, string subjectid, connectapi.feeditempage result) parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype type of feed. valid values include every connectapi.feedtype except company, directmessagemoderation, directmessages, filter, home, landing, moderation, and pendingreview. subjectid type: string if feedtype is record, subjectid can be any record id, including a group id. if feedtype is streams, subjectid must be a stream id. if feedtype is topics, subjectid must be a topic id. if feedtype is userprofile, subjectid can be any user id. if the feedtype is any other value, subjectid must be the id of the context user or the alias me. result type: connectapi.feeditempage object containing test data. 827apex reference guide chatterfeeds class return value type: void see also: getfeeditemsfromfeed(communityid, feedtype, subjectid) apex developer guide: testing connectapi code settestgetfeeditemsfromfeed(communityid, feedtype, subjectid, page" "param, pagesize, sortparam, result) register a connectapi.feeditempage object to be returned when getfeeditemsfromfeed is called with matching parameters in a test context. use the get feed method with the same parameters or the code throws an exception. api version 28.0–31.0 signature public static void settestgetfeeditemsfromfeed(string communityid, connectapi.feedtype feedtype, string subjectid, string pageparam, integer pagesize, connectapi.feedsortorder sortparam, connectapi.feeditempage result) parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype type of feed. valid values include every connectapi.feedtype except company, directmessagemoderation, directmessages, filter, home, landing, moderation, and pendingreview. subjectid type: string if feedtype is record, subjectid can be any record id, including a group id. if feedtype is streams, subjectid must be a stream id. if feedtype is topics, subjectid must be a topic id. if feedtype is userprofile, subjectid can be any user id. if the feedtype is any other value, subjectid must be the id of the context user or the alias me. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer number of feed items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. 828apex reference guide chatterfeeds class sortparam type: connectapi.feedsortorder values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. sorts the returned feed by the most recently created feed item, or by the most recently modified feed item. if you pass in null, the default value createddatedesc is used. result type: connectapi.feeditempage object containing test data. return value type: void see also: getfeeditemsfromfeed(communityid, feedtype, subjectid, pageparam, pagesize, sortparam) apex developer guide: testing connectapi code settestgetfeeditemsfromfeed(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, sortparam, result) register a connectapi.feeditempage object to be returned when getfeeditemsfromfeed is called with matching parameters in a test context. use the get feed method with the same parameters or the code throws an exception. api version 29.0–31.0 signature public static void settestgetfeeditemsfromfeed(string communityid, connectapi.feedtype feedtype, string subjectid, integer recentcommentcount, connectapi.feeddensity density, string pageparam, integer pagesize, connectapi.feedsortorder sortparam, connectapi.feeditempage result) parameters communityid type: string 829apex reference guide chatterfeeds class id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype type of feed. valid values include every connectapi.feedtype except company, directmessagemoderation, directmessages, filter, home, landing, moderation, and pendingreview. subjectid type: string if feedtype is record, subjectid can be any record id, including a group id. if feedtype is streams, subjectid must be a stream id. if feedtype is topics, subjectid must be a topic id. if feedtype is userprofile, subjectid can be any user id. if the feedtype is any other value, subjectid must be the id of the context user or the alias me. recentcommentcount type: integer maximum" "number of comments to return with each feed item. the default value is 3. density type: connectapi.feeddensity specify the amount of content in a feed. • allupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations. • fewerupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations, but hides some system-generated updates from records. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer number of feed items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.feedsortorder values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. sorts the returned feed by the most recently created feed item, or by the most recently modified feed item. if you pass in null, the default value createddatedesc is used. result type: connectapi.feeditempage 830apex reference guide chatterfeeds class object containing test data. return value type: void see also: getfeeditemsfromfeed(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, sortparam) apex developer guide: testing connectapi code settestgetfeeditemsfromfeed(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, sortparam, showinternalonly, result) register a connectapi.feeditempage object to be returned when getfeeditemsfromfeed is called with matching parameters in a test context. use the get feed method with the same parameters or the code throws an exception. api version 30.0–31.0 signature public static void settestgetfeeditemsfromfeed(string communityid, connectapi.feedtype feedtype, string subjectid, integer recentcommentcount, connectapi.feeddensity density, string pageparam, integer pagesize, connectapi.feedsortorder sortparam, boolean showinternalonly, connectapi.feeditempage result) parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype type of feed. valid values include every connectapi.feedtype except company, directmessagemoderation, directmessages, filter, home, landing, moderation, and pendingreview. subjectid type: string if feedtype is record, subjectid can be any record id, including a group id. if feedtype is streams, subjectid must be a stream id. if feedtype is topics, subjectid must be a topic id. if feedtype is userprofile, subjectid can be any user id. if the feedtype is any other value, subjectid must be the id of the context user or the alias me. recentcommentcount type: integer maximum number of comments to return with each feed item. the default value is 3. 831apex reference guide chatterfeeds class density type: connectapi.feeddensity specify the amount of content in a feed. • allupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations. • fewerupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations, but hides some system-generated updates from records. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer" "number of feed items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.feedsortorder values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. sorts the returned feed by the most recently created feed item, or by the most recently modified feed item. if you pass in null, the default value createddatedesc is used. showinternalonly type: boolean specifies whether to show only feed items from internal (non-experience cloud site) users (true), or not (false). the default value is false. result type: connectapi.feeditempage object containing test data. return value type: void see also: getfeeditemsfromfeed(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, sortparam, showinternalonly) apex developer guide: testing connectapi code 832" "apex reference guide chatterfeeds class settestgetfeeditemsfromfilterfeed(communityid, subjectid, keyprefix, result) register a connectapi.feeditempage object to be returned when the matching getfeeditemsfromfilterfeed method is called in a test context. use the method with the same parameters or the code throws an exception. api version 28.0–31.0 signature public static void settestgetfeeditemsfromfilterfeed(string communityid, string subjectid, string keyprefix, connectapi.feeditempage result) parameters communityid type: string id for an experience cloud site, internal, or null. subjectid type: string id of the context user or the alias me. keyprefix type: string a key prefix that specifies record type. a key prefix is the first three characters in the object id, which specifies the object type. for example, user objects have a prefix of 005 and group objects have a prefix of 0f9. result type: connectapi.feeditempage object containing test data. return value type: void see also: getfeeditemsfromfilterfeed(communityid, subjectid, keyprefix) apex developer guide: testing connectapi code settestgetfeeditemsfromfilterfeed(communityid, subjectid, keyprefix, pageparam, pagesize, sortparam, result) register a connectapi.feeditempage object to be returned when the matching getfeeditemsfromfilterfeed method is called in a test context. use the method with the same parameters or the code throws an exception. api version 28.0–31.0 833apex reference guide chatterfeeds class signature public static void settestgetfeeditemsfromfilterfeed(string communityid, string subjectid, string keyprefix, string pageparam, integer pagesize, connectapi.feedsortorder sortparam, connectapi.feeditempage result) parameters communityid type: string id for an experience cloud site, internal, or null. subjectid type: string id of the context user or the alias me. keyprefix type: string a key prefix that specifies record type. a key prefix is the first three characters in the object id, which specifies the object type. for example, user objects have a prefix of 005 and group objects have a prefix of 0f9. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer number of feed items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.feedsortorder values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. sorts the returned feed by the most recently created feed item, or by the most recently modified feed item. if you pass in null, the default value createddatedesc is used. result type: connectapi.feeditempage object containing test data. 834apex reference guide chatterfeeds class return value type: void see also: getfeeditemsfromfilterfeed(communityid, subjectid, keyprefix, pageparam, pagesize, sortparam) apex developer guide: testing connectapi code settestgetfeeditemsfromfilterfeed(communityid, subjectid, keyprefix, recentcommentcount, density, pageparam, pagesize, sortparam, result) register a connectapi.feeditempage object to be returned when the matching getfeeditemsfromfilterfeed method is called in a test context. use the method with the same parameters or the code throws an exception. api version 29.0–31.0 signature public static void settestgetfeeditemsfromfilterfeed(string communityid, string subjectid, string keyprefix, integer recentcommentcount" ", connectapi.feeddensity density, string pageparam, integer pagesize, connectapi.feedsortorder sortparam, connectapi.feeditempage result) parameters communityid type: string id for an experience cloud site, internal, or null. subjectid type: string id of the context user or the alias me. keyprefix type: string a key prefix that specifies record type. a key prefix is the first three characters in the object id, which specifies the object type. for example, user objects have a prefix of 005 and group objects have a prefix of 0f9. recentcommentcount type: integer maximum number of comments to return with each feed item. the default value is 3. density type: connectapi.feeddensity specify the amount of content in a feed. • allupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations. 835apex reference guide chatterfeeds class • fewerupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations, but hides some system-generated updates from records. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer number of feed items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.feedsortorder values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. sorts the returned feed by the most recently created feed item, or by the most recently modified feed item. if you pass in null, the default value createddatedesc is used. result type: connectapi.feeditempage object containing test data. return value type: void see also: getfeeditemsfromfilterfeed(communityid, subjectid, keyprefix, recentcommentcount, density, pageparam, pagesize, sortparam) apex developer guide: testing connectapi code settestgetfeeditemsfromfilterfeedupdatedsince(communityid, subjectid, keyprefix, recentcommentcount, density, pageparam, pagesize, sortparam, updatedsince, result) register a connectapi.feeditempage object to be returned when the getfeeditemsfromfilterfeedupdatedsince method is called in a test context. api version 30.0–31.0 836apex reference guide chatterfeeds class signature public static void settestgetfeeditemsfromfilterfeedupdatedsince(string communityid, string subjectid, string keyprefix, integer recentcommentcount, connectapi.feeddensity density, string pageparam, integer pagesize, connectapi.feedsortorder sortparam, string updatedsince, connectapi.feeditempage result) parameters communityid type: string id for an experience cloud site, internal, or null. subjectid type: string id of the context user or the alias me. keyprefix type: string a key prefix that specifies record type. a key prefix is the first three characters in the object id, which specifies the object type. for example, user objects have a prefix of 005 and group objects have a prefix of 0f9. recentcommentcount type: integer maximum number of comments to return with each feed item. the default value is 3. density type: connectapi.feeddensity specify the amount of content in a feed. • allupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations. • fewerupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations, but hides some system-generated updates from" "records. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer number of feed items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.feedsortorder values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. 837apex reference guide chatterfeeds class • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. sorts the returned feed by the most recently created feed item, or by the most recently modified feed item. if you pass in null, the default value createddatedesc is used. updatedsince type: string opaque token containing information about the last modified date of the feed. do not construct this token. to retrieve this token, call getfeeditemsfromfilterfeed and take the value from the updatestoken property of the connectapi.feeditempage response body. result type: connectapi.feeditempage object containing test data. return value type: void see also: getfeeditemsfromfilterfeedupdatedsince(communityid, subjectid, keyprefix, recentcommentcount, density, pageparam, pagesize, updatedsince) apex developer guide: testing connectapi code settestgetfeeditemsupdatedsince(communityid, feedtype, recentcommentcount, density, pageparam, pagesize, updatedsince, connectapi.feeditempage, results) register a connectapi.feeditempage object to be returned when getfeeditemsupdatedsince is called with matching parameters in a test context. use the method with the same parameters or the code throws an exception. api version 30.0–31.0 signature public static void settestgetfeeditemsupdatedsince(string communityid, connectapi.feedtype feedtype, integer recentcommentcount, connectapi.feeddensity density, string pageparam, integer pagesize, string updatedsince, connectapi.feeditempage results) parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype 838apex reference guide chatterfeeds class type of feed. valid values are company, directmessagemoderation, directmessages, home, moderation, and pendingreview. recentcommentcount type: integer maximum number of comments to return with each feed item. the default value is 3. density type: connectapi.feeddensity specify the amount of content in a feed. • allupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations. • fewerupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations, but hides some system-generated updates from records. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer number of feed items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. updatedsince type: string an opaque token containing information about the last modified date of the feed. do not construct this token. retrieve this token from the updatestoken property of the connectapi.feeditempage response body. result type: connectapi.feeditempage object containing test data. return value type: void see also: getfeeditemsupdatedsince(communityid, feedtype, recentcommentcount, density, pageparam, pagesize, updatedsince) apex developer guide: testing connectapi code settestgetfeeditemsupdatedsince(communityid, feedtype, subjectid, recentcommentcount, density," "pageparam, pagesize, updatedsince, result) register a connectapi.feeditempage object to be returned when getfeeditemsupdatedsince is called with matching parameters in a test context. use the method with the same parameters or the code throws an exception. api version 30.0–31.0 839apex reference guide chatterfeeds class signature public static void settestgetfeeditemsupdatedsince(string communityid, connectapi.feedtype feedtype, string subjectid, integer recentcommentcount, connectapi.feeddensity density, string pageparam, integer pagesize, string updatedsince, connectapi.feeditempage result) parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype one of these values: • files • groups • news • people • record subjectid type: string if feedtype is connectapi.record, subjectid can be any record id, including a group id. otherwise, it must be the context user or the alias me. recentcommentcount type: integer maximum number of comments to return with each feed item. the default value is 3. density type: connectapi.feeddensity specify the amount of content in a feed. • allupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations. • fewerupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations, but hides some system-generated updates from records. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer number of feed items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. updatedsince type: string 840apex reference guide chatterfeeds class an opaque token containing information about the last modified date of the feed. do not construct this token. retrieve this token from the updatestoken property of the connectapi.feeditempage response body. result type: connectapi.feeditempage object containing test data. return value type: void see also: getfeeditemsupdatedsince(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, updatedsince) apex developer guide: testing connectapi code settestgetfeeditemsupdatedsince(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, updatedsince, showinternalonly, result) register a connectapi.feeditempage object to be returned when getfeeditemsupdatedsince is called with matching parameters in a test context. use the method with the same parameters or the code throws an exception. api version 30.0–31.0 signature public static void settestgetfeeditemsupdatedsince(string communityid, connectapi.feedtype feedtype, string subjectid, integer recentcommentcount, connectapi.feeddensity density, string pageparam, integer pagesize, string updatedsince, boolean showinternalonly, connectapi.feeditempage result) parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype one of these values: • files • groups • news • people • record 841apex reference guide chatterfeeds class subjectid type: string if feedtype is connectapi.record, subjectid can be any record id, including a group id. otherwise, it must be the context user or the alias me. recentcommentcount type: integer maximum number of comments to return with each feed item. the default value is 3. density type: connectapi.feeddensity specify the amount of content in a feed. • allupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations. • fewerupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations, but hides some system-generated updates from records. pageparam type: string page token to use to view the page. page tokens" "are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer number of feed items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. updatedsince type: string an opaque token containing information about the last modified date of the feed. do not construct this token. retrieve this token from the updatestoken property of the connectapi.feeditempage response body. showinternalonly type: boolean specifies whether to show only feed items from internal (non-experience cloud site) users (true), or not (false). the default value is false. result type: connectapi.feeditempage object containing test data. return value type: void see also: getfeeditemsupdatedsince(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, updatedsince, showinternalonly) apex developer guide: testing connectapi code 842apex reference guide chatterfeeds class settestsearchfeeditems(communityid, q, result) register a test feed item page to be returned when searchfeeditems(communityid, q) is called during a test. api version 28.0–31.0 signature public static void searchfeeditems(string communityid, string q, connectapi.feeditempage result) parameters communityid type: string id for an experience cloud site, internal, or null. q type: string required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. result type: connectapi.feeditempage object containing test data. return value type: void see also: searchfeeditems(communityid, q) apex developer guide: testing connectapi code settestsearchfeeditems(communityid, q, sortparam, result) register a test feed item page to be returned when searchfeeditems(string, string, connectapi.feedsortorder) is called during a test. api version 28.0–31.0 signature public static void settestsearchfeeditems(string communityid, string q, connectapi.feedsortorder sortparam, connectapi.feeditempage result) 843apex reference guide chatterfeeds class parameters communityid type: string id for an experience cloud site, internal, or null. q type: string required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. sortparam type: connectapi.feedsortorder values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. sorts the returned feed by the most recently created feed item, or by the most recently modified feed item. if you pass in null, the default value createddatedesc is used. result type: connectapi.feeditempage the feed item test page. return value type: void see also: searchfeeditems(communityid, q, sortparam) apex developer guide: testing connectapi code settestsearchfeeditems(communityid, q, pageparam, pagesize, result) register a test feed item page to be returned when searchfeeditems(string, string, string, integer) is called during a test. api version 28.0–31.0 844apex reference guide chatterfeeds class signature public static void settestsearchfeeditems(string communityid, string q, string pageparam, integer pagesize, connectapi.feeditempage result) parameters communityid type: string id for an experience cloud site, internal, or null. q type: string required and can’t be null. specifies the string to search. the search string must contain" "at least two characters, not including wildcards. see wildcards. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer number of feed items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. result type: connectapi.feeditempage the test feed item page. return value type: void see also: searchfeeditems(communityid, q, pageparam, pagesize) apex developer guide: testing connectapi code settestsearchfeeditems(communityid, q, pageparam, pagesize, sortparam, result) register a test feed item page to be returned when searchfeeditems(string, string, string, integer, connectapi.feedsortorder) is called during a test. api version 28.0–31.0 signature public static void settestsearchfeeditems(string communityid, string q, string pageparam, integer pagesize, connectapi.feedsortorder sortparam, connectapi.feeditempage result) 845apex reference guide chatterfeeds class parameters communityid type: string id for an experience cloud site, internal, or null. q type: string required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer number of feed items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.feedsortorder values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. sorts the returned feed by the most recently created feed item, or by the most recently modified feed item. if you pass in null, the default value createddatedesc is used. result type: connectapi.feeditempage the test feed item page. return value type: void see also: searchfeeditems(communityid, q, pageparam, pagesize, sortparam) apex developer guide: testing connectapi code 846apex reference guide chatterfeeds class settestsearchfeeditems(communityid, q, recentcommentcount, pageparam, pagesize, sortparam, result) register a test feed item page to be returned when searchfeeditems(communityid, q, recentcommentcount, pageparam, pagesize, sortparam) is called during a test. api version 29.0–31.0 signature public static void settestsearchfeeditems(string communityid, string q, integer recentcommentcount, string pageparam, integer pagesize, connectapi.feedsortorder sortparam, connectapi.feeditempage result) parameters communityid type: string id for an experience cloud site, internal, or null. q type: string required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. recentcommentcount type: integer maximum number of comments to return with each feed item. the default value is 3. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer number of feed items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi." "feedsortorder values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. 847apex reference guide chatterfeeds class sorts the returned feed by the most recently created feed item, or by the most recently modified feed item. if you pass in null, the default value createddatedesc is used. result type: connectapi.feeditempage the test feed item page. return value type: void see also: searchfeeditems(communityid, q, recentcommentcount, pageparam, pagesize, sortparam) apex developer guide: testing connectapi code settestsearchfeeditemsinfeed(communityid, feedtype, q, result) register a connectapi.feeditempage object to be returned when the matching connectapi.searchfeeditemsinfeed method is called in a test context. use the method with the same parameters or you receive an exception. api version 28.0–31.0 signature public static void settestsearchfeeditemsinfeed(string communityid, connectapi.feedtype feedtype, string q, connectapi.feeditempage result) parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype type of feed. valid values are company, directmessagemoderation, directmessages, home, moderation, and pendingreview. q type: string required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. result type: connectapi.feeditempage object containing test data. 848apex reference guide chatterfeeds class return value type: void see also: searchfeeditemsinfeed(communityid, feedtype, q) apex developer guide: testing connectapi code settestsearchfeeditemsinfeed(communityid, feedtype, pageparam, pagesize, sortparam, q, result) register a connectapi.feeditempage object to be returned when the matching connectapi.searchfeeditemsinfeed method is called in a test context. use the method with the same parameters or you receive an exception. api version 28.0–31.0 signature public static void settestsearchfeeditemsinfeed(string communityid, connectapi.feedtype feedtype, string pageparam, integer pagesize, connectapi.feedsortorder sortparam, string q, connectapi.feeditempage result) parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype type of feed. valid values include every connectapi.feedtype except company, directmessagemoderation, directmessages, filter, home, landing, moderation, and pendingreview. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer number of feed items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.feedsortorder values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. 849apex reference guide chatterfeeds class • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds" ". sorts the returned feed by the most recently created feed item, or by the most recently modified feed item. if you pass in null, the default value createddatedesc is used. q type: string required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. result type: connectapi.feeditempage object containing test data. return value type: void see also: searchfeeditemsinfeed(communityid, feedtype, pageparam, pagesize, sortparam, q) apex developer guide: testing connectapi code settestsearchfeeditemsinfeed(communityid, feedtype, recentcommentcount, density, pageparam, pagesize, sortparam, q, result) register a connectapi.feeditempage object to be returned when the matching connectapi.searchfeeditemsinfeed method is called in a test context. use the method with the same parameters or you receive an exception. api version 29.0–31.0 signature public static void settestsearchfeeditemsinfeed(string communityid, connectapi.feedtype feedtype, integer recentcommentcount, connectapi.feeddensity density, string pageparam, integer pagesize, connectapi.feedsortorder sortparam, string q, connectapi.feeditempage result) parameters communityid type: string id for an experience cloud site, internal, or null. 850apex reference guide chatterfeeds class feedtype type: connectapi.feedtype type of feed. valid values include every connectapi.feedtype except company, directmessagemoderation, directmessages, filter, home, landing, moderation, and pendingreview. recentcommentcount type: integer maximum number of comments to return with each feed item. the default value is 3. density type: connectapi.feeddensity specify the amount of content in a feed. • allupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations. • fewerupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations, but hides some system-generated updates from records. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer number of feed items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.feedsortorder values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. sorts the returned feed by the most recently created feed item, or by the most recently modified feed item. if you pass in null, the default value createddatedesc is used. q type: string required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. result type: connectapi.feeditempage object containing test data. 851apex reference guide chatterfeeds class return value type: void see also: searchfeeditemsinfeed(communityid, feedtype, recentcommentcount, density, pageparam, pagesize, sortparam, q) apex developer guide: testing connectapi code settestsearchfeeditemsinfeed(communityid, feedtype, subjectid, q, result) register a connectapi.feeditempage object to be returned when the matching connectapi.searchfeeditemsinfeed method is called in a test context. use the method with the same parameters or you receive an exception. api version 28.0–31.0 signature public static void settestsearch" "feeditemsinfeed(string communityid, connectapi.feedtype feedtype, string subjectid, string q, connectapi.feeditempage result) parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype type of feed. valid values include every connectapi.feedtype except company, directmessages, filter, landing, and streams. subjectid type: string if feedtype is record, subjectid can be any record id, including a group id. if feedtype is streams, subjectid must be a stream id. if feedtype is topics, subjectid must be a topic id. if feedtype is userprofile, subjectid can be any user id. if the feedtype is any other value, subjectid must be the id of the context user or the alias me. q type: string required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. result type: connectapi.feeditempage object containing test data. 852apex reference guide chatterfeeds class return value type: void see also: searchfeeditemsinfeed(communityid, feedtype, subjectid, q) apex developer guide: testing connectapi code settestsearchfeeditemsinfeed(communityid, feedtype, subjectid, pageparam, pagesize, sortparam, q, result) register a connectapi.feeditempage object to be returned when the matching connectapi.searchfeeditemsinfeed method is called in a test context. use the method with the same parameters or you receive an exception. api version 28.0–31.0 signature public static void settestsearchfeeditemsinfeed(string communityid, connectapi.feedtype feedtype, string subjectid, string pageparam, integer pagesize, connectapi.feedsortorder sortparam, string q, connectapi.feeditempage result) parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype type of feed. valid values include every connectapi.feedtype except company, directmessages, filter, landing, and streams. subjectid type: string if feedtype is record, subjectid can be any record id, including a group id. if feedtype is streams, subjectid must be a stream id. if feedtype is topics, subjectid must be a topic id. if feedtype is userprofile, subjectid can be any user id. if the feedtype is any other value, subjectid must be the id of the context user or the alias me. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer number of feed items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. 853apex reference guide chatterfeeds class sortparam type: connectapi.feedsortorder values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. sorts the returned feed by the most recently created feed item, or by the most recently modified feed item. if you pass in null, the default value createddatedesc is used. q type: string required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. result type: connectapi.feeditempage object containing test data. return value type: void see also: searchfeeditemsinfeed(communityid, feedtype, subjectid, pageparam, pagesize, sortparam, q) apex developer guide: testing" "connectapi code settestsearchfeeditemsinfeed(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, sortparam, q, result) register a connectapi.feeditempage object to be returned when the matching connectapi.searchfeeditemsinfeed method is called in a test context. use the method with the same parameters or you receive an exception. api version 29.0–31.0 signature public static void settestsearchfeeditemsinfeed(string communityid, connectapi.feedtype feedtype, string subjectid, integer recentcommentcount, connectapi.feeddensity density, string pageparam, integer pagesize, connectapi.feedsortorder sortparam, string q, connectapi.feeditempage result) 854apex reference guide chatterfeeds class parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype type of feed. valid values include every connectapi.feedtype except company, directmessages, filter, landing, and streams. subjectid type: string if feedtype is record, subjectid can be any record id, including a group id. if feedtype is streams, subjectid must be a stream id. if feedtype is topics, subjectid must be a topic id. if feedtype is userprofile, subjectid can be any user id. if the feedtype is any other value, subjectid must be the id of the context user or the alias me. recentcommentcount type: integer maximum number of comments to return with each feed item. the default value is 3. density type: connectapi.feeddensity specify the amount of content in a feed. • allupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations. • fewerupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations, but hides some system-generated updates from records. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer number of feed items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.feedsortorder values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. 855apex reference guide chatterfeeds class sorts the returned feed by the most recently created feed item, or by the most recently modified feed item. if you pass in null, the default value createddatedesc is used. q type: string required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. result type: connectapi.feeditempage object containing test data. return value type: void see also: searchfeeditemsinfeed(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, sortparam, q) apex developer guide: testing connectapi code settestsearchfeeditemsinfeed(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, sortparam, q, showinternalonly, result) register a connectapi.feeditempage object to be returned when the matching connectapi.searchfeeditemsinfeed method is called in a test context. use the method with the same parameters or you receive an exception. api version 29.0–31.0 signature public static void settestsearchfeeditemsinfeed(string communityid, connectapi.feedtype feedtype, string subjectid, integer recentcomment" "count, connectapi.feeddensity density, string pageparam, integer pagesize, connectapi.feedsortorder sortparam, string q, boolean showinternalonly, connectapi.feeditempage result) parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype type of feed. valid values include every connectapi.feedtype except company, directmessages, filter, landing, and streams. 856apex reference guide chatterfeeds class subjectid type: string if feedtype is record, subjectid can be any record id, including a group id. if feedtype is streams, subjectid must be a stream id. if feedtype is topics, subjectid must be a topic id. if feedtype is userprofile, subjectid can be any user id. if the feedtype is any other value, subjectid must be the id of the context user or the alias me. recentcommentcount type: integer maximum number of comments to return with each feed item. the default value is 3. density type: connectapi.feeddensity specify the amount of content in a feed. • allupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations. • fewerupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations, but hides some system-generated updates from records. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer number of feed items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.feedsortorder values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. sorts the returned feed by the most recently created feed item, or by the most recently modified feed item. if you pass in null, the default value createddatedesc is used. q type: string required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. showinternalonly type: boolean 857apex reference guide chatterfeeds class specifies whether to show only feed items from internal (non-experience cloud site) users (true), or not (false). the default value is false. result type: connectapi.feeditempage object containing test data. return value type: void see also: searchfeeditemsinfeed(communityid, feedtype, subjectid, recentcommentcount, density, pageparam, pagesize, sortparam, q, showinternalonly) apex developer guide: testing connectapi code settestsearchfeeditemsinfilterfeed(communityid, subjectid, keyprefix, q, result) register a connectapi.feeditempage object to be returned when the matching connectapi.searchfeeditemsinfilterfeed method is called in a test context. use the method with the same parameters or you receive an exception. api version 28.0–31.0 signature public static void settestsearchfeeditemsinfilterfeed(string communityid, string subjectid, string keyprefix, string q, connectapi.feeditempage result) parameters communityid type: string id for an experience cloud site, internal, or null. subjectid type: string id of the context user or the alias me. keyprefix type: string a key prefix that specifies record type. a key prefix is the first three characters in the object id, which specifies the object type. for example, user objects have a prefix of 005 and group objects have a prefix of 0f" "9. q type: string 858apex reference guide chatterfeeds class required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. result type: connectapi.feeditempage specify the test feed item page. return value type: void see also: searchfeeditemsinfilterfeed(communityid, subjectid, keyprefix, q) apex developer guide: testing connectapi code settestsearchfeeditemsinfilterfeed(communityid, feedtype, subjectid, keyprefix, pageparam, pagesize, sortparam, q, result) register a connectapi.feeditempage object to be returned when the matching connectapi.searchfeeditemsinfilterfeed method is called in a test context. use the method with the same parameters or you receive an exception. api version 28.0–31.0 signature public static void settestsearchfeeditemsinfilterfeed(string communityid, connectapi.feedtype feedtype, string subjectid, string keyprefix, string pageparam, integer pagesize, connectapi.feedsortorder sortparam, string q, connectapi.feeditempage result) parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype type of feed. valid values include every connectapi.feedtype except company, directmessagemoderation, directmessages, filter, home, landing, moderation, and pendingreview. subjectid type: string id of the context user or the alias me. keyprefix type: string 859apex reference guide chatterfeeds class a key prefix that specifies record type. a key prefix is the first three characters in the object id, which specifies the object type. for example, user objects have a prefix of 005 and group objects have a prefix of 0f9. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer number of feed items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.feedsortorder values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. sorts the returned feed by the most recently created feed item, or by the most recently modified feed item. if you pass in null, the default value createddatedesc is used. q type: string required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. result type: connectapi.feeditempage specify the test feed item page. return value type: void see also: searchfeeditemsinfilterfeed(communityid, subjectid, keyprefix, pageparam, pagesize, sortparam, q) apex developer guide: testing connectapi code 860apex reference guide chatterfeeds class settestsearchfeeditemsinfilterfeed(communityid, feedtype, subjectid, keyprefix, recentcommentcount, density, pageparam, pagesize, sortparam, q, result) register a connectapi.feeditempage object to be returned when the matching connectapi.searchfeeditemsinfilterfeed method is called in a test context. use the method with the same parameters or you receive an exception. api version 29.0–31.0 signature public static void settestsearchfeeditemsinfilterfeed(string communityid, connectapi.feedtype feedtype, string subjectid, string keyprefix, integer recentcommentcount, connectapi.feeddensity density, string pageparam, integer pagesize," "connectapi.feedsortorder sortparam, string q, connectapi.feeditempage result) parameters communityid type: string id for an experience cloud site, internal, or null. feedtype type: connectapi.feedtype type of feed. valid values include every connectapi.feedtype except company, directmessagemoderation, directmessages, filter, home, landing, moderation, and pendingreview. subjectid type: string id of the context user or the alias me. keyprefix type: string a key prefix that specifies record type. a key prefix is the first three characters in the object id, which specifies the object type. for example, user objects have a prefix of 005 and group objects have a prefix of 0f9. recentcommentcount type: integer maximum number of comments to return with each feed item. the default value is 3. density type: connectapi.feeddensity specify the amount of content in a feed. • allupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations. • fewerupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations, but hides some system-generated updates from records. 861apex reference guide chattergroups class pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer number of feed items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.feedsortorder values are: • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. sorts the returned feed by the most recently created feed item, or by the most recently modified feed item. if you pass in null, the default value createddatedesc is used. q type: string required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. result type: connectapi.feeditempage specify the test feed item page. return value type: void see also: searchfeeditemsinfilterfeed(communityid, subjectid, keyprefix, recentcommentcount, density, pageparam, pagesize, sortparam, q) apex developer guide: testing connectapi code chattergroups class information about groups, such as the group’s members, photo, and the groups the specified user is a member of. add members to a group, remove members, and change the group photo. 862apex reference guide chattergroups class namespace connectapi chattergroups methods the following are methods for chattergroups. all methods are static. in this section: addmember(communityid, groupid, userid) add a user to a group as a standard member. addmemberwithrole(communityid, groupid, userid, role) add a user with a role to a group. addrecord(communityid, groupid, recordid) associate a record with a group. creategroup(communityid, groupinput) create a group. deletebannerphoto(communityid, groupid) delete the group banner photo. deletegroup(communityid, groupid) delete a group. deletemember(communityid, membershipid) remove a member from a group. deletephoto(communityid, groupid) delete the group photo. getannouncements(communityid, groupid) get the first page of announcements in a group. getannouncements(communityid, groupid, pageparam, pagesize) get a page of announcements in a group. getbannerphoto(communityid, group" "id) get the group banner photo. getgroup(communityid, groupid) get information about a group. getgroupbatch(communityid, groupids) get information about a list of groups. getgroupmembershiprequest(communityid, requestid) get information about a request to join a private group. getgroupmembershiprequests(communityid, groupid) get information about every request to join a private group. getgroupmembershiprequests(communityid, groupid, status) get information about every request to join a private group that has a specified status. 863apex reference guide chattergroups class getgroups(communityid) get the first page of groups. getgroups(communityid, pageparam, pagesize) get a page of groups. getgroups(communityid, pageparam, pagesize, archivestatus) get a page of groups with an archive status. getmember(communityid, membershipid) get information about a group member. getmembers(communityid, groupid) get the first page of information about the members of a group. getmembers(communityid, groupid, pageparam, pagesize) get a page of information about the members of a group. getmembershipbatch(communityid, membershipids) get information about a list of group memberships. getmychattersettings(communityid, groupid) get the context user’s chatter settings for a group. getphoto(communityid, groupid) get the photo for a group. getrecord(communityid, grouprecordid) get a record associated with a group. getrecords(communityid, groupid) get the first page of records associated with a group. getrecords(communityid, groupid, pageparam, pagesize) get a page of records associated with a group. inviteusers(groupid, invite) invite internal and external users to join a group. postannouncement(communityid, groupid, announcement) post an announcement to a group. removerecord(communityid, grouprecordid) remove the association of a record with a group. requestgroupmembership(communityid, groupid) request membership in a private group. searchgroups(communityid, q) get the first page of groups that match the search criteria. searchgroups(communityid, q, pageparam, pagesize) get a page of groups that match the search criteria. searchgroups(communityid, q, archivestatus, pageparam, pagesize) get a page of groups with the archive status that match the search criteria. setbannerphoto(communityid, groupid, fileid, versionnumber) set an uploaded file as the group banner photo. 864apex reference guide chattergroups class setbannerphoto(communityid, groupid, fileupload) set a file that hasn’t been uploaded as the group banner photo. setbannerphotowithattributes(communityid, groupid, bannerphoto) set and crop an uploaded file as the group banner photo. setbannerphotowithattributes(communityid, groupid, bannerphoto, fileupload) set and crop a file that hasn’t been uploaded as the group banner photo. setphoto(communityid, groupid, fileid, versionnumber) set an uploaded file as the group photo. setphoto(communityid, groupid, fileupload) set a file that hasn’t been uploaded as the group photo. setphotowithattributes(communityid, groupid, photo) set and crop an uploaded file as the group photo. setphotowithattributes(communityid, groupid, photo, fileupload) set and crop a file that hasn’t been uploaded as the group photo. updategroup(communityid, groupid, groupinput) update the settings of a group. updategroupmember(communityid, membershipid, role) update the role of a group member. updatemychattersettings(communityid, groupid, emailfrequency) update the context user’s email frequency for a group. updaterequeststatus(communityid, requestid, status) update a request to join a private group. updaterequeststatus(communityid, requestid, status, responsemessage) update a request to join a private group and optionally provide a message when the request is denied. addmember(communityid, groupid, userid) add a user to a group as a standard member. api version 28.0 requires chatter yes sign" "ature public static connectapi.groupmember addmember(string communityid, string groupid, string userid) 865apex reference guide chattergroups class parameters communityid type: string id for an experience cloud site, internal, or null. groupid type: string id for a group. userid type: string id for a user. return value type: connectapi.groupmember usage to execute this method, the context user must be the group owner or moderator. addmemberwithrole(communityid, groupid, userid, role) add a user with a role to a group. api version 29.0 requires chatter yes signature public static connectapi.groupmember addmemberwithrole(string communityid, string groupid, string userid, connectapi.groupmembershiptype role) parameters communityid type: string id for an experience cloud site, internal, or null. groupid type: string id for a group. userid type: string 866apex reference guide chattergroups class id for a user. role type: connectapi.groupmembershiptype the group membership type. one of these values: • groupmanager • standardmember return value type: connectapi.groupmember usage to execute this method, the context user must be the group owner or moderator. addrecord(communityid, groupid, recordid) associate a record with a group. api version 34.0 requires chatter yes signature public static connectapi.grouprecord addrecord(string communityid, string groupid, string recordid) parameters communityid type: string id for an experience cloud site, internal, or null. groupid type: string id of the group with which to associate the record. recordid type: string id of the record to associate with the group. return value type: connectapi.grouprecord 867apex reference guide chattergroups class creategroup(communityid, groupinput) create a group. api version 29.0 requires chatter yes signature public static connectapi.chattergroupdetail creategroup(string, communityid, connectapi.chattergroupinput groupinput) parameters communityid type: string, id for an experience cloud site, internal, or null. groupinput type: connectapi.chattergroupinput the properties of the group. return value type: connectapi.chattergroupdetail deletebannerphoto(communityid, groupid) delete the group banner photo. api version 36.0 requires chatter yes signature public static void deletebannerphoto(string communityid, string groupid) parameters communityid type: string 868apex reference guide chattergroups class id for an experience cloud site, internal, or null. groupid type: string id of the group. return value type: void usage this method is successful only when the context user is the group manager or owner, or has modify all data permission. deletegroup(communityid, groupid) delete a group. api version 29.0 requires chatter yes signature public static void deletegroup(string communityid, string groupid) parameters communityid type: string id for an experience cloud site, internal, or null. groupid type: string id for a group. return value type: void deletemember(communityid, membershipid) remove a member from a group. api version 28.0 869apex reference guide chattergroups class requires chatter yes signature public static void deletemember(string communityid, string membershipid) parameters communityid type: string id for an experience cloud site, internal, or null. membershipid type: string id for a membership. return value type: void usage this method is successful only when the context user is the group manager or owner, or has modify all data permission. deletephoto(communityid, groupid) delete the group photo. api version 28.0 requires chatter yes signature public static void deletephoto(string communityid, string groupid) parameters communityid type: string id for an experience cloud site, internal, or null. groupid type: string id for a group. 870" "apex reference guide chattergroups class return value type: void usage this method is only successful when the context user is the group manager or owner, or has modify all data permission. getannouncements(communityid, groupid) get the first page of announcements in a group. api version 31.0 requires chatter yes signature public static connectapi.announcementpage getannouncements(string communityid, string groupid) parameters communityid type: string id for an experience cloud site, internal, or null. groupid type: string id for a group. return value type: connectapi.announcementpage usage to post an announcement, get information about an announcement, update the expiration date of an announcement, or delete an announcement, use the methods of the connectapi.announcements class. getannouncements(communityid, groupid, pageparam, pagesize) get a page of announcements in a group. api version 31.0 871apex reference guide chattergroups class requires chatter yes signature public static connectapi.announcementpage getannouncements(string communityid, string groupid, integer pageparam, integer pagesize) parameters communityid type: string id for an experience cloud site, internal, or null. groupid type: string id for a group. pageparam type: integer number of the page you want returned. starts at 0. if you pass in null or 0, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. return value type: connectapi.announcementpage usage to post an announcement, get information about an announcement, update the expiration date of an announcement, or delete an announcement, use the methods of the connectapi.announcements class. getbannerphoto(communityid, groupid) get the group banner photo. api version 36.0 requires chatter yes signature public static connectapi.bannerphoto getbannerphoto(string communityid, string groupid) 872apex reference guide chattergroups class parameters communityid type: string id for an experience cloud site, internal, or null. groupid type: string the id of the group. return value type: connectapi.bannerphoto getgroup(communityid, groupid) get information about a group. api version 28.0 available to guest users 31.0 requires chatter yes signature public static connectapi.chattergroupdetail getgroup(string communityid, string groupid) parameters communityid type: string id for an experience cloud site, internal, or null. groupid type: string id for a group. return value type: connectapi.chattergroupdetail getgroupbatch(communityid, groupids) get information about a list of groups. 873apex reference guide chattergroups class api version 31.0 requires chatter yes signature public static connectapi.batchresult[] getgroupbatch(string communityid, list groupids) parameters communityid type: string id for an experience cloud site, internal, or null. groupids type: list a list of up to 500 group ids. return value type: connectapi.batchresult[] the connectapi.batchresult.getresult() method returns a connectapi.chattergroup object and errors embedded in the results for groups that didn’t load. example // create a list of groups. connectapi.chattergrouppage grouppage = connectapi.chattergroups.getgroups(null); // create a list of group ids. list groupids = new list(); for (connectapi.chattergroup agroup : grouppage.groups){ groupids.add(agroup.id); } // get info about all the groups in the list. connectapi.batchresult[] batchresults = connectapi.chattergroups.getgroupbatch(null, groupids); for (connectapi.batchresult batchresult : batchresults) { if (batchresult" ".issuccess()) { // operation was successful. // print the number of members in each group. connectapi.chattergroup agroup; if(batchresult.getresult() instanceof connectapi.chattergroup) { agroup = (connectapi.chattergroup) batchresult.getresult(); } 874apex reference guide chattergroups class system.debug('success'); system.debug(agroup.membercount); } else { // operation failed. print errors. system.debug('failure'); system.debug(batchresult.geterrormessage()); } } see also: getmembershipbatch(communityid, membershipids) getgroupmembershiprequest(communityid, requestid) get information about a request to join a private group. api version 28.0 requires chatter yes signature public static connectapi.groupmembershiprequest getgroupmembershiprequest(string communityid, string requestid) parameters communityid type: string id for an experience cloud site, internal, or null. requestid type: string the id of a request to join a private group. return value type: connectapi.groupmembershiprequest usage this method is successful only when the context user is the group manager or owner, or has modify all data permission. 875apex reference guide chattergroups class getgroupmembershiprequests(communityid, groupid) get information about every request to join a private group. api version 28.0 requires chatter yes signature public static connectapi.groupmembershiprequests getgroupmembershiprequests(string communityid, string groupid) parameters communityid type: string id for an experience cloud site, internal, or null. groupid type: string id for a group. return value type: connectapi.groupmembershiprequests usage this method is successful only when the context user is the group manager or owner, or has modify all data permission. getgroupmembershiprequests(communityid, groupid, status) get information about every request to join a private group that has a specified status. api version 28.0 requires chatter yes signature public static connectapi.groupmembershiprequests getgroupmembershiprequests(string communityid, string groupid, connectapi.groupmembershiprequeststatus status) 876apex reference guide chattergroups class parameters communityid type: string id for an experience cloud site, internal, or null. groupid type: string id for a group. status type: connectapi.groupmembershiprequeststatus status—status of a request to join a private group. • accepted • declined • pending return value type: connectapi.groupmembershiprequests usage this method is successful only when the context user is the group manager or owner, or has modify all data permission. getgroups(communityid) get the first page of groups. api version 28.0 available to guest users 31.0 requires chatter yes signature public static connectapi.chattergrouppage getgroups(string communityid) parameters communityid type: string id for an experience cloud site, internal, or null. 877apex reference guide chattergroups class return value type: connectapi.chattergrouppage getgroups(communityid, pageparam, pagesize) get a page of groups. api version 28.0 available to guest users 31.0 requires chatter yes signature public static connectapi.chattergrouppage getgroups(string communityid, integer pageparam, integer pagesize) parameters communityid type: string id for an experience cloud site, internal, or null. pageparam type: integer number of the page you want returned. starts at 0. if you pass in null or 0, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. return value type: connectapi.chattergrouppage getgroups(communityid, pageparam, pagesize, archivestatus) get a page of groups with an archive status. api version 29.0 878apex reference guide chattergroups class available to guest" "users 31.0 requires chatter yes signature public static connectapi.chattergrouppage getgroups(string communityid, integer pageparam, integer pagesize, connectapi.grouparchivestatus archivestatus) parameters communityid type: string id for an experience cloud site, internal, or null. pageparam type: integer number of the page you want returned. starts at 0. if you pass in null or 0, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. archivestatus type: connectapi.grouparchivestatus archive status of groups. • all—all groups, including groups that are archived and groups that aren’t archived. • archived—groups that are archived. • notarchived—groups that aren’t archived. if you pass in null, the default value is all. return value type: connectapi.chattergrouppage getmember(communityid, membershipid) get information about a group member. api version 28.0 requires chatter yes 879apex reference guide chattergroups class signature public static connectapi.groupmember getmember(string communityid, string membershipid) parameters communityid type: string id for an experience cloud site, internal, or null. membershipid type: string id for a membership. return value type: connectapi.groupmember getmembers(communityid, groupid) get the first page of information about the members of a group. api version 28.0 available to guest users 36.0 requires chatter yes signature public static connectapi.groupmemberpage getmembers(string communityid, string groupid) parameters communityid type: string id for an experience cloud site, internal, or null. groupid type: string id for a group. return value type: connectapi.groupmemberpage 880apex reference guide chattergroups class getmembers(communityid, groupid, pageparam, pagesize) get a page of information about the members of a group. api version 28.0 available to guest users 36.0 requires chatter yes signature public static connectapi.groupmemberpage getmembers(string communityid, string groupid, integer pageparam, integer pagesize) parameters communityid type: string id for an experience cloud site, internal, or null. groupid type: string id for a group. pageparam type: integer number of the page you want returned. starts at 0. if you pass in null or 0, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. return value type: connectapi.groupmemberpage getmembershipbatch(communityid, membershipids) get information about a list of group memberships. api version 31.0 881apex reference guide chattergroups class requires chatter yes signature public static connectapi.batchresult[] getmembershipbatch(string communityid, list membershipids) parameters communityid type: string id for an experience cloud site, internal, or null. membershipids type: list a list of up to 500 group membership ids. return value type: connectapi.batchresult[] the connectapi.batchresult.getresult() method returns a connectapi.groupmember object and errors embedded in the results for group memberships that didn’t load. example // get members of a group. connectapi.groupmemberpage memberspage = connectapi.chattergroups.getmembers(null, '0f9d00000000oot'); // create a list of membership ids. list memberslist = new list(); for (connectapi.groupmember groupmember : memberspage.members){ memberslist.add(groupmember.id); } // get info about all group memberships in the list. connectapi.batchresult[] batchresults = connectapi.chattergroups.getmembershipbatch(null, memberslist); for (connectapi.batch" result batchresult : batchresults) { if (batchresult.issuccess()) { // operation was successful. // print the first name of each member. connectapi.groupmember groupmember; if(batchresult.getresult() instanceof connectapi.groupmember) { groupmember = (connectapi.groupmember) batchresult.getresult(); } system.debug('success'); system.debug(groupmember.user.firstname); } 882 "apex reference guide chattergroups class else { // operation failed. print errors. system.debug('failure'); system.debug(batchresult.geterrormessage()); } } see also: getgroupbatch(communityid, groupids) getmychattersettings(communityid, groupid) get the context user’s chatter settings for a group. api version 28.0 requires chatter yes signature public static connectapi.groupchattersettings getmychattersettings(string communityid, string groupid) parameters communityid type: string id for an experience cloud site, internal, or null. groupid type: string id for a group. return value type: connectapi.groupchattersettings getphoto(communityid, groupid) get the photo for a group. api version 28.0 883apex reference guide chattergroups class requires chatter yes signature public static connectapi.photo getphoto(string communityid, string groupid) parameters communityid type: string id for an experience cloud site, internal, or null. groupid type: string id for a group. return value type: connectapi.photo getrecord(communityid, grouprecordid) get a record associated with a group. api version 34.0 requires chatter yes signature public static connectapi.grouprecord getrecord(string communityid, string grouprecordid) parameters communityid type: string id for an experience cloud site, internal, or null. grouprecordid type: string id of the group record. return value type: connectapi.grouprecord 884apex reference guide chattergroups class getrecords(communityid, groupid) get the first page of records associated with a group. api version 33.0 requires chatter yes signature public static connectapi.grouprecordpage getrecords(string communityid, string groupid) parameters communityid type: string id for an experience cloud site, internal, or null. groupid type: string id for a group. return value type: connectapi.grouprecordpage getrecords(communityid, groupid, pageparam, pagesize) get a page of records associated with a group. api version 33.0 requires chatter yes signature public static connectapi.grouprecordpage getrecords(string communityid, string groupid, integer pageparam, integer pagesize) parameters communityid type: string 885apex reference guide chattergroups class id for an experience cloud site, internal, or null. groupid type: string id for a group. pageparam type: integer number of the page you want returned. starts at 0. if you pass in null or 0, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. return value type: connectapi.grouprecordpage inviteusers(groupid, invite) invite internal and external users to join a group. api version 39.0 requires chatter yes signature public static connectapi.invitations inviteusers(string groupid, connectapi.inviteinput invite) parameters groupid type: string id of the group. invite type: connectapi.inviteinput a connectapi.inviteinput body. return value type: connectapi.invitations 886apex reference guide chattergroups class postannouncement(communityid, groupid, announcement) post an announcement to a group. api version 31.0 requires chatter yes signature public static connectapi.announcement postannouncement(string communityid, string groupid, connectapi.announcementinput announcement) parameters communityid type: string id for an experience cloud site, internal, or null. groupid type: string id for a group. announcement type: connectapi.announcementinput a connectapi.announcementinput object. return value type: connectapi.announcement usage use an announcement to highlight information. users can discuss, like, and post comments on announcements. deleting the feed post" "deletes the announcement. to post an announcement, get information about an announcement, update the expiration date of an announcement, or delete an announcement, use the methods of the connectapi.announcements class. removerecord(communityid, grouprecordid) remove the association of a record with a group. api version 34.0 887apex reference guide chattergroups class requires chatter yes signature public static void removerecord(string communityid, string grouprecordid) parameters communityid type: string id for an experience cloud site, internal, or null. grouprecordid type: string id of the group record. return value type: void requestgroupmembership(communityid, groupid) request membership in a private group. api version 28.0 requires chatter yes signature public static connectapi.groupmembershiprequest requestgroupmembership(string communityid, string groupid) parameters communityid type: string id for an experience cloud site, internal, or null. groupid type: string id for a group. 888apex reference guide chattergroups class return value type: connectapi.groupmembershiprequest sample: requesting to join a private group this sample code calls connectapi.chattergroups.requestgroupmembership to request to join a private group. string communityid = null; id groupid = '0f9x00000000haz'; connectapi.groupmembershiprequest membershiprequest = connectapi.chattergroups.requestgroupmembership(communityid, groupid); searchgroups(communityid, q) get the first page of groups that match the search criteria. api version 28.0 available to guest users 31.0 requires chatter yes signature public static connectapi.chattergrouppage searchgroups(string communityid, string q) parameters communityid type: string id for an experience cloud site, internal, or null. q type: string specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. can be specified as null. return value type: connectapi.chattergrouppage 889apex reference guide chattergroups class usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestsearchgroups(communityid, q, result) apex developer guide: testing connectapi code searchgroups(communityid, q, pageparam, pagesize) get a page of groups that match the search criteria. api version 28.0 available to guest users 31.0 requires chatter yes signature public static connectapi.chattergrouppage searchgroups(string communityid, string q, integer pageparam, integer pagesize) parameters communityid type: string id for an experience cloud site, internal, or null. q type: string specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. can be specified as null. pageparam type: integer number of the page you want returned. starts at 0. if you pass in null or 0, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. 890apex reference guide chattergroups class return value type: connectapi.chattergrouppage usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestsearchgroups(communityid, q, pageparam, pagesize, result) apex developer guide: testing connectapi code searchgroups(communityid, q, archivestatus, pageparam, pagesize) get a page of groups with the archive status that match the search criteria. api version 29.0 available to guest users 31.0 requires chatter yes signature public static connectapi.chattergrouppage searchgroups(string communityid, string q, connectapi.grouparchivestatus archivestatus, integer pageparam, integer pagesize) parameters communityid" "type: string id for an experience cloud site, internal, or null. q type: string specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. can be specified as null. archivestatus type: connectapi.grouparchivestatus archive status of groups. • all—all groups, including groups that are archived and groups that aren’t archived. • archived—groups that are archived. 891apex reference guide chattergroups class • notarchived—groups that aren’t archived. pageparam type: integer number of the page you want returned. starts at 0. if you pass in null or 0, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. return value type: connectapi.chattergrouppage usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestsearchgroups(communityid, q, archivestatus, pageparam, pagesize, result) apex developer guide: testing connectapi code setbannerphoto(communityid, groupid, fileid, versionnumber) set an uploaded file as the group banner photo. api version 36.0 requires chatter yes signature public static connectapi.bannerphoto setbannerphoto(string communityid, string groupid, string fileid, integer versionnumber) parameters communityid type: string id for an experience cloud site, internal, or null. groupid type: string the id of the group. 892apex reference guide chattergroups class fileid type: string the id of the already uploaded file. the key prefix must be 069, and the image must be smaller than 8 mb. versionnumber type: integer version number of the existing file. specify either an existing version number or, to get the latest version, specify null. return value type: connectapi.bannerphoto usage this method is successful only when the context user is the group manager or owner, or has modify all data permission. photos are processed asynchronously and might not be visible right away. setbannerphoto(communityid, groupid, fileupload) set a file that hasn’t been uploaded as the group banner photo. api version 36.0 requires chatter yes signature public static connectapi.bannerphoto setbannerphoto(string communityid, string groupid, connectapi.binaryinput fileupload) parameters communityid type: string id for an experience cloud site, internal, or null. groupid type: string the id of the group. fileupload type: connectapi.binaryinput file to use as the photo. the content type must be usable as an image. 893apex reference guide chattergroups class return value type: connectapi.bannerphoto usage this method is successful only when the context user is the group manager or owner, or has modify all data permission. photos are processed asynchronously and might not be visible right away. setbannerphotowithattributes(communityid, groupid, bannerphoto) set and crop an uploaded file as the group banner photo. api version 36.0 requires chatter yes signature public static connectapi.bannerphoto setbannerphotowithattributes(string communityid, string groupid, connectapi.bannerphotoinput bannerphoto) parameters communityid type: string id for an experience cloud site, internal, or null. groupid type: string the id of the group. bannerphoto type: connectapi.bannerphotoinput a connectapi.bannerphotoinput object that specifies the id and version of the file, and how to crop the file. return value type: connectapi.bannerphoto usage this method is successful only when the context user is the group manager or owner, or has modify all data permission. photos are processed asynchronously and might not be visible right away. 894apex reference guide chattergroups class setbannerphotowithattributes(communityid, groupid, bannerphoto, fileupload) set and crop a file that hasn’" "t been uploaded as the group banner photo. api version 36.0 requires chatter yes signature public static connectapi.bannerphoto setbannerphotowithattributes(string communityid, string groupid, connectapi.bannerphotoinput bannerphoto, connectapi.binaryinput fileupload) parameters communityid type: string id for an experience cloud site, internal, or null. groupid type: string the id of the group. bannerphoto type: connectapi.bannerphotoinput a connectapi.bannerphotoinput object specifying the cropping parameters. fileupload type: connectapi.binaryinput file to use as the photo. the content type must be usable as an image. return value type: connectapi.bannerphoto usage this method is successful only when the context user is the group manager or owner, or has modify all data permission. photos are processed asynchronously and might not be visible right away. setphoto(communityid, groupid, fileid, versionnumber) set an uploaded file as the group photo. 895apex reference guide chattergroups class api version 28.0 requires chatter yes signature public static connectapi.photo setphoto(string communityid, string groupid, string fileid, integer versionnumber) parameters communityid type: string id for an experience cloud site, internal, or null. groupid type: string id for a group. fileid type: string id of a file already uploaded. the key prefix must be 069, and the file must be an image that is smaller than 2 gb. versionnumber type: integer version number of the existing file. specify either an existing version number or, to get the latest version, specify null. return value type: connectapi.photo usage this method is successful only when the context user is the group manager or owner, or has modify all data permission. photos are processed asynchronously and might not be visible right away. sample: updating a group photo with an existing file when a group is created, it doesn’t have a group photo. you can set an existing photo that has already been uploaded to salesforce as the group photo. the key prefix must be 069 and the file size must be less than 2 gb. string communityid = null; id groupid = '0f9x00000000hak'; id fileid = '069x00000001ion'; // set photo connectapi.photo photo = connectapi.chattergroups.setphoto(communityid, groupid, fileid, null); 896apex reference guide chattergroups class setphoto(communityid, groupid, fileupload) set a file that hasn’t been uploaded as the group photo. api version 28.0 requires chatter yes signature public static connectapi.photo setphoto(string communityid, string groupid, connectapi.binaryinput fileupload) parameters communityid type: string id for an experience cloud site, internal, or null. groupid type: string id for a group. fileupload type: connectapi.binaryinput file to use as the photo. the content type must be usable as an image. return value type: connectapi.photo usage this method is successful only when the context user is the group manager or owner, or has modify all data permission. photos are processed asynchronously and might not be visible right away. sample: uploading a new file and using it as a group photo when a group is created, it doesn’t have a group photo. you can upload a photo and set it as the group photo. string communityid = null; id groupid = '0f9x00000000hap'; id photoid = '069x00000001ioo'; // set photo list groupphoto = [select c.versiondata from contentversion c where contentdocumentid=:photoid]; connectapi.binaryinput binary = new connectapi.binaryinput(groupphoto.get(0).versiondata, 897apex reference guide chattergroups class 'image/png', 'image.png'); connectapi.photo photo = connectapi.chattergroups.setphoto(communityid, groupid, binary); setphotowithattributes(communityid, groupid, photo) set and crop an uploaded" "file as the group photo. api version 29.0 requires chatter yes signature public static connectapi.photo setphotowithattributes(string communityid, string groupid, connectapi.photoinput photo) parameters communityid type: string id for an experience cloud site, internal, or null. groupid type: string id for a group. photo type: connectapi.photoinput a connectapi.photoinput object that specifies the id and version of the file, and how to crop the file. return value type: connectapi.photo usage this method is successful only when the context user is the group manager or owner, or has modify all data permission. photos are processed asynchronously and might not be visible right away. setphotowithattributes(communityid, groupid, photo, fileupload) set and crop a file that hasn’t been uploaded as the group photo. 898apex reference guide chattergroups class api version 29.0 requires chatter yes signature public static connectapi.photo setphotowithattributes(string communityid, string groupid, connectapi.photoinput photo, connectapi.binaryinput fileupload) parameters communityid type: string id for an experience cloud site, internal, or null. groupid type: string id for a group. photo type: connectapi.photoinput a connectapi.photoinput object that specifies how to crop the file specified in fileupload. fileupload type: connectapi.binaryinput file to use as the photo. the content type must be usable as an image. return value type: connectapi.photo usage this method is successful only when the context user is the group manager or owner, or has modify all data permission. photos are processed asynchronously and might not be visible right away. updategroup(communityid, groupid, groupinput) update the settings of a group. api version 28.0 requires chatter yes 899apex reference guide chattergroups class signature public static connectapi.chattergroup updategroup(string communityid, string groupid, connectapi.chattergroupinput groupinput) parameters communityid type: string id for an experience cloud site, internal, or null. groupid type: string id for a group. groupinput type: connectapi.chattergroupinput a connectapi.chattergroupinput object. return value type: connectapi.chattergroup usage this method is successful only when the context user is the group manager or owner, or has modify all data permission. use this method to update any settings in the connectapi.chattergroupinput class. these settings include the group title and text in the “information” section, whether the group is public or private, and whether the group is archived. example this example archives a group. string groupid = '0f9d00000000qsz'; string communityid = null; connectapi.chattergroupinput groupinput = new connectapi.chattergroupinput(); groupinput.isarchived = true; connectapi.chattergroups.updategroup(communityid, groupid, groupinput); updategroupmember(communityid, membershipid, role) update the role of a group member. api version 29.0 requires chatter yes 900apex reference guide chattergroups class signature public static connectapi.chattergroup updategroupmember(string communityid, string membershipid, connectapi.groupmembershiptype role) parameters communityid type: string id for an experience cloud site, internal, or null. membershipid type: string id for a membership. role type: connectapi.groupmembershiptype the group membership type. one of these values: • groupmanager • standardmember return value type: connectapi.chattergroup usage this method is successful only when the context user is the group manager or owner, or has modify all data permission. updatemychattersettings(communityid, groupid, emailfrequency) update the context user’s email frequency for a group. api version 28.0 requires chatter yes signature public static connectapi.groupchattersettings updatemychattersettings(string communityid, string groupid, connectapi.groupemailfrequency email" "frequency) parameters communityid type: string 901apex reference guide chattergroups class id for an experience cloud site, internal, or null. groupid type: string id for a group. emailfrequency type: connectapi.groupemailfrequency frequency with which a user receives email. • eachpost • dailydigest • weeklydigest • never • usedefault the value usedefault uses the value set in a call to updatechattersettings(communityid, userid, defaultgroupemailfrequency). return value type: connectapi.groupchattersettings updaterequeststatus(communityid, requestid, status) update a request to join a private group. api version 28.0 requires chatter yes signature public static connectapi.groupmembershiprequest updaterequeststatus(string communityid, string requestid, connectapi.groupmembershiprequeststatus status) parameters communityid type: string id for an experience cloud site, internal, or null. requestid type: string id for a request to join a private group. status type: connectapi.groupmembershiprequeststatus 902apex reference guide chattergroups class status of the request: • accepted • declined the pending value of the enum is not valid in this method. return value type: connectapi.groupmembershiprequest usage this method is successful only when the context user is the group manager or owner, or has modify all data permission. sample: accepting or declining a request to join a private group this sample code calls connectapi.chattergroups.updaterequeststatus and passes it the membership request id and an connectapi.groupmembershiprequeststatus.accepted status. you can also pass connectapi.groupmembershiprequeststatus.declined. string communityid = null; id groupid = '0f9x00000000haz'; string requestid = '0i5x000000001sncaa'; connectapi.groupmembershiprequest membershiprequestrep = connectapi.chattergroups.updaterequeststatus(communityid, requestid, connectapi.groupmembershiprequeststatus.accepted); updaterequeststatus(communityid, requestid, status, responsemessage) update a request to join a private group and optionally provide a message when the request is denied. api version 35.0 requires chatter yes signature public static connectapi.groupmembershiprequest updaterequeststatus(string communityid, string requestid, connectapi.groupmembershiprequeststatus status, string responsemessage) parameters communityid type: string id for an experience cloud site, internal, or null. 903apex reference guide chattergroups class requestid type: string id for a request to join a private group. status type: connectapi.groupmembershiprequeststatus status of the request: • accepted • declined the pending value of the enum is not valid in this method. responsemessage type: string provide a message to the user if their membership request is declined. the value of this property is used only when the value of the status property is declined. the maximum length is 756 characters. return value type: connectapi.groupmembershiprequest usage this method is successful only when the context user is the group manager or owner, or has modify all data permission. chattergroups test methods the following are the test methods for chattergroups. all methods are static. for information about using these methods to test your connectapi code, see testing connectapi code. settestsearchgroups(communityid, q, result) register a connectapi.chattergrouppage object to be returned when the matching connectapi.searchgroups method is called in a test context. use the test method with the same parameters or you receive an exception. api version 29.0 signature public static void settestsearchgroups(string communityid, string q, connectapi.chattergrouppage result) parameters communityid type: string 904apex reference guide chattergroups class id for an experience cloud site, internal, or null. q type: string specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. can be specified as null. result type: connectapi.chattergrouppage test connecta" "pi.chattergrouppage object. return value type: void see also: searchgroups(communityid, q) apex developer guide: testing connectapi code settestsearchgroups(communityid, q, pageparam, pagesize, result) register a connectapi.chattergrouppage object to be returned when the matching connectapi.searchgroups method is called in a test context. use the test method with the same parameters or you receive an exception. api version 28.0 signature public static void settestsearchgroups(string communityid, string q, integer pageparam, integer pagesize, connectapi.chattergrouppage result) parameters communityid type: string id for an experience cloud site, internal, or null. q type: string specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. can be specified as null. pageparam type: integer number of the page you want returned. starts at 0. if you pass in null or 0, the first page is returned. pagesize type: integer 905apex reference guide chattergroups class specifies the number of items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. result type: connectapi.chattergrouppage test connectapi.chattergrouppage object. return value type: void see also: searchgroups(communityid, q, pageparam, pagesize) apex developer guide: testing connectapi code settestsearchgroups(communityid, q, archivestatus, pageparam, pagesize, result) register a connectapi.chattergrouppage object to be returned when the matching connectapi.searchgroups method is called in a test context. use the test method with the same parameters or you receive an exception. api version 29.0 signature public static void settestsearchgroups(string communityid, string q, connectapi.grouparchivestatus, archivestatus, integer pageparam, integer pagesize, connectapi.chattergrouppage result) parameters communityid type: string id for an experience cloud site, internal, or null. q type: string specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. can be specified as null. archivestatus type: connectapi.grouparchivestatus archive status of groups. • all—all groups, including groups that are archived and groups that aren’t archived. • archived—groups that are archived. • notarchived—groups that aren’t archived. 906apex reference guide chattermessages class pageparam type: integer number of the page you want returned. starts at 0. if you pass in null or 0, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. result type: connectapi.chattergrouppage test connectapi.chattergrouppage object. return value type: void see also: searchgroups(communityid, q, archivestatus, pageparam, pagesize) apex developer guide: testing connectapi code chattermessages class get, send, search, and reply to private messages. you can also get and search private conversations, mark conversations as read, and get a count of unread private messages. namespace connectapi usage private messages and direct messages are different features. direct messages are newer and offer a richer feature set for private communication in experience cloud sites. direct messages are a capability within chatter feeds. to work with direct messages, use the chatterfeeds class. chattermessages methods the following are methods for chattermessages. all methods are static. in this section: getconversation(conversationid) get a conversation. getconversation(conversationid, pageparam, pagesize) get a page of a conversation. getconversation(communityid, conversationid) get a conversation from an experience cloud site. 907apex reference guide chattermessages class getconversation(communityid, conversationid, pageparam, pagesize) get a page of a conversation from an experience cloud site. getconversations() get the most recent conversations." "getconversations(pageparam, pagesize) get a page of conversations. getconversations(communityid) get the most recent conversations from an experience cloud site. getconversations(communityid, pageparam, pagesize) get a page of conversations from an experience cloud site. getmessage(messageid) get a message. getmessage(communityid, messageid) get a message from an experience cloud site. getmessages() get the most recent messages. getmessages(pageparam, pagesize) get a page of messages. getmessages(communityid) get the most recent messages from an experience cloud site. getmessages(communityid, pageparam, pagesize) get a page of messages from an experience cloud site. getunreadcount() get the number of conversations that are marked unread. getunreadcount(communityid) get the number of conversations that are marked unread in an experience cloud site. markconversationread(conversationid, read) mark a conversation as read or unread. markconversationread(communityid, conversationid, read) mark a conversation as read or unread in an experience cloud site. replytomessage(text, inreplyto) reply to a message. replytomessage(communityid, text, inreplyto) reply to a message in an experience cloud site. searchconversation(conversationid, q) get a conversation that matches the search criteria. searchconversation(conversationid, pageparam, pagesize, q) get a conversation with a page of messages that match the search criteria. searchconversation(communityid, conversationid, q) get a conversation with messages that match the search criteria in an experience cloud site. 908apex reference guide chattermessages class searchconversation(communityid, conversationid, pageparam, pagesize, q) get a conversation with a page of messages that match the search criteria in an experience cloud site. searchconversations(q) get conversations in which member names and messages match the search criteria. searchconversations(pageparam, pagesize, q) get a page of conversations in which member names and messages match the search criteria. searchconversations(communityid, q) get conversations in which member names and messages match the search criteria in an experience cloud site. searchconversations(communityid, pageparam, pagesize, q) get a page of conversations in which member names and messages match the search criteria in an experience cloud site. searchmessages(q) get messages that match the search criteria. searchmessages(pageparam, pagesize, q) get a page of messages that match the search criteria. searchmessages(communityid, q) get messages that match the search criteria in an experience cloud site. searchmessages(communityid, pageparam, pagesize, q) get a page of messages that match the search criteria in an experience cloud site. sendmessage(text, recipients) send a message to a list of recipients. sendmessage(communityid, text, recipients) send a message to a list of recipients in an experience cloud site. getconversation(conversationid) get a conversation. api version 29.0 requires chatter yes signature public static connectapi.chatterconversation getconversation(string conversationid) parameters conversationid type: string id for the conversation. 909apex reference guide chattermessages class return value type: connectapi.chatterconversation getconversation(conversationid, pageparam, pagesize) get a page of a conversation. api version 29.0 requires chatter yes signature public static connectapi.chatterconversation getconversation(string conversationid, string pageparam, integer pagesize) parameters conversationid type: string id for the conversation. pageparam type: string specifies the page token to use to view a page of information. page tokens are returned as part of the response class, such as currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. return value type: connectapi.chatterconversation getconversation(communityid, conversationid)" "get a conversation from an experience cloud site. api version 30.0 requires chatter yes 910apex reference guide chattermessages class signature public static connectapi.chatterconversation getconversation(string communityid, string conversationid) parameters communityid type:string id for an experience cloud site, internal, or null. conversationid type: string id for the conversation. return value type: connectapi.chatterconversation getconversation(communityid, conversationid, pageparam, pagesize) get a page of a conversation from an experience cloud site. api version 30.0 requires chatter yes signature public static connectapi.chatterconversation getconversation(string communityid, string conversationid, string pageparam, string pagesize) parameters communityid type:string id for an experience cloud site, internal, or null. conversationid type: string id for the conversation. pageparam type:string specifies the page token to use to view a page of information. page tokens are returned as part of the response class, such as currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. 911apex reference guide chattermessages class pagesize type: integer specifies the number of items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. return value type: connectapi.chatterconversation getconversations() get the most recent conversations. api version 29.0 requires chatter yes signature public static connectapi.chatterconversationpage getconversations() return value type: connectapi.chatterconversationpage getconversations(pageparam, pagesize) get a page of conversations. api version 29.0 requires chatter yes signature public static connectapi.chatterconversationpage getconversations(string pageparam, integer pagesize) parameters pageparam type: string 912apex reference guide chattermessages class specifies the page token to use to view a page of information. page tokens are returned as part of the response class, such as currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. return value type: connectapi.chatterconversationpage getconversations(communityid) get the most recent conversations from an experience cloud site. api version 30.0 requires chatter yes signature public static connectapi.chatterconversationpage getconversations(string communityid) parameters communityid type:string id for an experience cloud site, internal, or null. return value type: connectapi.chatterconversationpage getconversations(communityid, pageparam, pagesize) get a page of conversations from an experience cloud site. api version 30.0 requires chatter yes 913apex reference guide chattermessages class signature public static connectapi.chatterconversationpage getconversations(string communityid, string pageparam, integer pagesize) parameters communityid type:string id for an experience cloud site, internal, or null. pageparam type:string specifies the page token to use to view a page of information. page tokens are returned as part of the response class, such as currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. return value type: connectapi.chatterconversationpage getmessage(messageid) get a message. api version 29.0 requires chatter yes signature public static connectapi.chattermessage getmessage(string messageid) parameters messageid type: string id for the message. return value type: connectapi.chattermessage 914apex reference guide chattermessages class getmessage(communityid, messageid) get a message from an experience cloud site. api" "version 30.0 requires chatter yes signature public static connectapi.chattermessage getmessage(string communityid, string messageid) parameters communityid type:string id for an experience cloud site, internal, or null. messageid type: string id for the message. return value type:connectapi.chattermessage getmessages() get the most recent messages. api version 29.0 requires chatter yes signature public static connectapi.chattermessagepage getmessages() return value type: connectapi.chattermessagepage 915apex reference guide chattermessages class getmessages(pageparam, pagesize) get a page of messages. api version 29.0 requires chatter yes signature public static connectapi.chattermessagepage getmessages(string pageparam, integer pagesize) parameters pageparam type: string specifies the page token to use to view a page of information. page tokens are returned as part of the response class, such as currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. return value type: connectapi.chattermessagepage getmessages(communityid) get the most recent messages from an experience cloud site. api version 30.0 requires chatter yes signature public static connectapi.chattermessagepage getmessages(string communityid) 916apex reference guide chattermessages class parameters communityid type:string id for an experience cloud site, internal, or null. return value type: connectapi.chattermessagepage getmessages(communityid, pageparam, pagesize) get a page of messages from an experience cloud site. api version 30.0 requires chatter yes signature public static connectapi.chattermessagepage getmessages(string communityid, string pageparam, integer pagesize) parameters communityid type:string id for an experience cloud site, internal, or null. pageparam type: string specifies the page token to use to view a page of information. page tokens are returned as part of the response class, such as currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. return value type: connectapi.chattermessagepage getunreadcount() get the number of conversations that are marked unread. 917apex reference guide chattermessages class api version 29.0 requires chatter yes signature public static connectapi.unreadconversationcount getunreadcount() return value type: connectapi.unreadconversationcount if there are fewer than 50 unread conversations, connectapi.ureadconversationcount returns the exact number of unread conversations and the hasmore property is false. if there are more than 50 unread conversations, connectapi.ureadconversationcount returns 50 unread conversations and the hasmore property is true. example connectapi.unreadconversationcount unread = connectapi.chattermessages.getunreadcount(); getunreadcount(communityid) get the number of conversations that are marked unread in an experience cloud site. api version 30.0 requires chatter yes signature public static connectapi.unreadconversationcount getunreadcount(string communityid) parameters communityid type:string id for an experience cloud site, internal, or null. return value type: connectapi.unreadconversationcount 918apex reference guide chattermessages class if there are fewer than 50 unread conversations, connectapi.ureadconversationcount returns the exact number of unread conversations and the hasmore property is false. if there are more than 50 unread conversations, connectapi.ureadconversationcount returns 50 unread conversations and the hasmore property is true. markconversationread(conversationid, read) mark a conversation as read or unread. api version 29.0 requires" "chatter yes signature public static connectapi.chatterconversationsummary markconversationread(string conversationid, boolean read) parameters conversationid type: string id for the conversation. read type: boolean specify whether the conversation is read (true) or not (false). return value type: connectapi.chatterconversationsummary markconversationread(communityid, conversationid, read) mark a conversation as read or unread in an experience cloud site. api version 30.0 requires chatter yes signature public static connectapi.chatterconversationsummary markconversationread(string communityid, string conversationid, boolean read) 919apex reference guide chattermessages class parameters communityid type:string id for an experience cloud site, internal, or null. conversationid type: string id for the conversation. read type: boolean specify whether the conversation is read (true) or not (false). return value type: connectapi.chatterconversationsummary replytomessage(text, inreplyto) reply to a message. api version 29.0 requires chatter yes signature public static connectapi.chattermessage replytomessage(string text, string inreplyto) parameters text type: string text of the message. can’t be empty or over 10,000 characters. inreplyto type: string id of the message that is being responded to. return value type: connectapi.chattermessage replytomessage(communityid, text, inreplyto) reply to a message in an experience cloud site. 920apex reference guide chattermessages class api version 30.0 requires chatter yes signature public static connectapi.chattermessage replytomessage(string communityid, string text, string inreplyto) parameters communityid type:string id for an experience cloud site, internal, or null. text type: string text of the message. can’t be empty or over 10,000 characters. inreplyto type: string id of the message that is being responded to. return value type: connectapi.chattermessage searchconversation(conversationid, q) get a conversation that matches the search criteria. api version 29.0 requires chatter yes signature public static connectapi.chatterconversation searchconversation(string conversationid, string q) 921apex reference guide chattermessages class parameters conversationid type: string id for the conversation. q type: string required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. return value type: connectapi.chatterconversation searchconversation(conversationid, pageparam, pagesize, q) get a conversation with a page of messages that match the search criteria. api version 29.0 requires chatter yes signature public static connectapi.chatterconversation searchconversation(string conversationid, string pageparam, integer pagesize, string q) parameters conversationid type: string id for the conversation. pageparam type: string specifies the page token to use to view a page of information. page tokens are returned as part of the response class, such as currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. q type: string required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. 922apex reference guide chattermessages class return value type: connectapi.chatterconversation searchconversation(communityid, conversationid, q) get a conversation with messages that match the search criteria in an experience cloud site. api version 30.0 requires chatter yes signature public static connectapi.chatterconversation searchconversation(string communityid, string conversationid, string q) parameters communityid type" ":string id for an experience cloud site, internal, or null. conversationid type: string id for the conversation. q type: string required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. return value type: connectapi.chatterconversation searchconversation(communityid, conversationid, pageparam, pagesize, q) get a conversation with a page of messages that match the search criteria in an experience cloud site. api version 30.0 requires chatter yes 923apex reference guide chattermessages class signature public static connectapi.chatterconversation searchconversation(string communityid, string conversationid, string pageparam, integer pagesize, string q) parameters communityid type:string id for an experience cloud site, internal, or null. conversationid type: string id for the conversation. pageparam type: string specifies the page token to use to view a page of information. page tokens are returned as part of the response class, such as currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. q type: string required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. return value type: connectapi.chatterconversation searchconversations(q) get conversations in which member names and messages match the search criteria. api version 29.0 requires chatter yes signature public static connectapi.chatterconversationpage searchconversations(string q) 924apex reference guide chattermessages class parameters q type: string required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. return value type: connectapi.chatterconversationpage searchconversations(pageparam, pagesize, q) get a page of conversations in which member names and messages match the search criteria. api version 29.0 requires chatter yes signature public static connectapi.chatterconversationpage searchconversations(string pageparam, integer pagesize, string q) parameters pageparam type: string specifies the page token to use to view a page of information. page tokens are returned as part of the response class, such as currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. q type: string required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. return value type: connectapi.chatterconversationpage searchconversations(communityid, q) get conversations in which member names and messages match the search criteria in an experience cloud site. 925apex reference guide chattermessages class api version 30.0 requires chatter yes signature public static connectapi.chatterconversationpage searchconversations(string communityid, string q) parameters communityid type:string id for an experience cloud site, internal, or null. q type: string required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. return value type: connectapi.chatterconversationpage searchconversations(communityid, pageparam, pagesize, q) get a page of conversations in which member names and messages match the search criteria in an experience cloud site. api version 30.0 requires chatter yes signature public static connectapi.chatterconversationpage searchconversations(string communityid, string pageparam, integer pagesize, string q) parameters communityid type:string id for an experience cloud site, internal, or null. 926apex" "reference guide chattermessages class pageparam type: string specifies the page token to use to view a page of information. page tokens are returned as part of the response class, such as currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. q type: string required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. return value type: connectapi.chatterconversationpage searchmessages(q) get messages that match the search criteria. api version 29.0 requires chatter yes signature public static connectapi.chattermessagepage searchmessages(string q) parameters q type: string required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. return value type: connectapi.chattermessagepage searchmessages(pageparam, pagesize, q) get a page of messages that match the search criteria. 927apex reference guide chattermessages class api version 29.0 requires chatter yes signature public static connectapi.chattermessagepage searchmessages(string pageparam, integer pagesize, string q) parameters pageparam type: string specifies the page token to use to view a page of information. page tokens are returned as part of the response class, such as currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. q type: string required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. return value type: connectapi.chattermessagepage searchmessages(communityid, q) get messages that match the search criteria in an experience cloud site. api version 30.0 requires chatter yes signature public static connectapi.chattermessagepage searchmessages(string communityid, string q) 928apex reference guide chattermessages class parameters communityid type:string id for an experience cloud site, internal, or null. q type: string required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. return value type: connectapi.chattermessagepage searchmessages(communityid, pageparam, pagesize, q) get a page of messages that match the search criteria in an experience cloud site. api version 30.0 requires chatter yes signature public static connectapi.chattermessagepage searchmessages(string communityid, string pageparam, integer pagesize, string q) parameters communityid type:string id for an experience cloud site, internal, or null. pageparam type: string specifies the page token to use to view a page of information. page tokens are returned as part of the response class, such as currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. q type: string required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. 929apex reference guide chattermessages class return value type: connectapi.chattermessagepage sendmessage(text, recipients) send a message to a list of recipients. api version 29.0 requires chatter yes signature public static connectapi.chattermessage sendmessage(string text, string recipients) parameters text type: string text of the message. can’t be empty or over 10,000 characters. recipients type: string up to nine comma-separated ids of the users receiving the message. return" "value type: connectapi.chattermessage sendmessage(communityid, text, recipients) send a message to a list of recipients in an experience cloud site. api version 30.0 requires chatter yes signature public static connectapi.chattermessage sendmessage(string communityid, string text, string recipients) 930apex reference guide chatterusers class parameters communityid type:string id for an experience cloud site, internal, or null. text type: string text of the message. can’t be empty or over 10,000 characters. recipients type: string up to nine comma-separated ids of users to receive the message. return value type: connectapi.chattermessage chatterusers class access information about users, such as activity, followers, subscriptions, files, and groups. namespace connectapi chatterusers methods the following are methods for chatterusers. all methods are static. in this section: exportuseractivities(communityid, userid) export chatter-related user activity, such as bookmarks, topic endorsements, and votes. follow(communityid, userid, subjectid) follow a user or record. getchattersettings(communityid, userid) get the default chatter settings for a user. getfollowers(communityid, userid) get the first page of followers for a user. getfollowers(communityid, userid, pageparam, pagesize) get a page of followers for a user. getfollowings(communityid, userid) get the first page of users and records that a user follows. getfollowings(communityid, userid, pageparam) get a page of users and records that a user follows. 931apex reference guide chatterusers class getfollowings(communityid, userid, pageparam, pagesize) get a page with the specified number of users and records that a user follows. getfollowings(communityid, userid, filtertype) get the first page of records, filtered by key prefix, that a user follows. getfollowings(communityid, userid, filtertype, pageparam) get a page of records, filtered by key prefix, that a user follows. getfollowings(communityid, userid, filtertype, pageparam, pagesize) get a page with the specified number of records, filtered by key prefix, that a user follows. getreputation(communityid, userid) get a user’s reputation. getuser(communityid, userid) get information about a user. getuserbatch(communityid, userids) get information about a list of users. getusergroups(communityid, userid) get a user’s groups. getusergroups(communityid, userid, pageparam, pagesize) get a page of a user’s groups. getusers(communityid) get the first page of users. getusers(communityid, pageparam, pagesize) get a page of users. purgeuseractivities(communityid, userid) start a job to purge chatter-related user activity, such as bookmarks, topic endorsements, and votes. searchusergroupdetails(communityid, userid, q) get the user’s groups that match the search criteria. searchusergroupdetails(communityid, userid, q, pageparam, pagesize) get a page of a user’s groups that match the search criteria. searchusers(communityid, q) get the first page of users that match the search criteria. searchusers(communityid, q, pageparam, pagesize) get a page of users that match the search criteria. searchusers(communityid, q, searchcontextid, pageparam, pagesize) get a page of users that match the search criteria. updatechattersettings(communityid, userid, defaultgroupemailfrequency) update the default chatter settings for a user. updateuser(communityid, userid, userinput) update the about me section for a user. 932" "apex reference guide chatterusers class exportuseractivities(communityid, userid) export chatter-related user activity, such as bookmarks, topic endorsements, and votes. api version 42.0 requires chatter yes signature public static connectapi.useractivitiesjob exportuseractivities(string communityid, string userid) parameters communityid type: string id for an experience cloud site, internal, or null. userid type: string id of the user. return value type: connectapi.useractivitiesjob usage the following activities can be exported. • bookmark—user bookmarked a post. • chatteractivity—total counts of posts and comments made and likes and comments received for a user. • chatterlike—user liked a post or comment. • comment—user commented on a post. • companyverify—user verified comment. • downvote—user downvoted a post or comment. • feedentityread—user read a post. • feedread—user read a feed. • mute—user muted a post. • post—user made a post. • topicendorsement—user endorsed another user on a topic or received endorsement on a topic. • upvote—user upvoted a post or comment. 933apex reference guide chatterusers class follow(communityid, userid, subjectid) follow a user or record. api version 28.0 requires chatter yes signature public static connectapi.subscription follow(string communityid, string userid, string subjectid) parameters communityid type: string id for an experience cloud site, internal, or null. userid type: string id for the context user or the keyword me. subjectid type: string id of the user or record to follow. return value type: connectapi.subscription example chatterusers.connectapi.subscription subscriptiontorecord = connectapi.chatterusers.follow(null, 'me', '001rr000002g4y0'); see also: unfollow a record getchattersettings(communityid, userid) get the default chatter settings for a user. api version 28.0 934apex reference guide chatterusers class requires chatter yes signature public static connectapi.userchattersettings getchattersettings(string communityid, string userid) parameters communityid type: string id for an experience cloud site, internal, or null. userid type: string id for the context user or the keyword me. return value type: connectapi.userchattersettings getfollowers(communityid, userid) get the first page of followers for a user. api version 28.0 available to guest users 32.0 requires chatter yes signature public static connectapi.followerpage getfollowers(string communityid, string userid) parameters communityid type: string id for an experience cloud site, internal, or null. userid type: string 935apex reference guide chatterusers class id for a user. return value type: connectapi.followerpage getfollowers(communityid, userid, pageparam, pagesize) get a page of followers for a user. api version 28.0 available to guest users 32.0 requires chatter yes signature public static connectapi.followerpage getfollowers(string communityid, string userid, integer pageparam, integer pagesize) parameters communityid type: string id for an experience cloud site, internal, or null. userid type: string id for a user. pageparam type: integer number of the page you want returned. starts at 0. if you pass in null or 0, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. return value type: connectapi.followerpage 936apex reference guide chatterusers class getfollowings(communityid, userid) get the first page of users and records that a user follows. api version 28.0 available to guest users 32.0 requires chatter yes signature public static connectapi.followingpage getfollowings(string communityid, string" "userid) parameters communityid type: string id for an experience cloud site, internal, or null. userid type: string id for a user. return value type: connectapi.followingpage getfollowings(communityid, userid, pageparam) get a page of users and records that a user follows. api version 28.0 available to guest users 32.0 requires chatter yes 937apex reference guide chatterusers class signature public static connectapi.followingpage getfollowings(string communityid, string userid, integer pageparam) parameters communityid type: string id for an experience cloud site, internal, or null. userid type: string id for a user. pageparam type: integer number of the page you want returned. starts at 0. if you pass in null or 0, the first page is returned. return value type: connectapi.followingpage getfollowings(communityid, userid, pageparam, pagesize) get a page with the specified number of users and records that a user follows. api version 28.0 available to guest users 32.0 requires chatter yes signature public static connectapi.followingpage getfollowings(string communityid, string userid, integer pageparam, integer pagesize) parameters communityid type: string id for an experience cloud site, internal, or null. userid type: string 938apex reference guide chatterusers class id for a user. pageparam type: integer number of the page you want returned. starts at 0. if you pass in null or 0, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. return value type: connectapi.followingpage getfollowings(communityid, userid, filtertype) get the first page of records, filtered by key prefix, that a user follows. api version 28.0 available to guest users 32.0 requires chatter yes signature public static connectapi.followingpage getfollowings(string communityid, string userid, string filtertype) parameters communityid type: string id for an experience cloud site, internal, or null. userid type: string id for a user. filtertype type: string specifies the key prefix to filter the type of objects returned. a key prefix is the first three characters of the object id, which specifies the object type. for example, user objects have a prefix of 005 and group objects have a prefix of 0f9. 939apex reference guide chatterusers class return value type: connectapi.followingpage getfollowings(communityid, userid, filtertype, pageparam) get a page of records, filtered by key prefix, that a user follows. api version 28.0 available to guest users 32.0 requires chatter yes signature public static connectapi.followingpage getfollowings(string communityid, string userid, string filtertype, integer pageparam) parameters communityid type: string id for an experience cloud site, internal, or null. userid type: string id for a user. filtertype type: string specifies the key prefix to filter the type of objects returned. a key prefix is the first three characters of the object id, which specifies the object type. for example, user objects have a prefix of 005 and group objects have a prefix of 0f9. pageparam type: integer number of the page you want returned. starts at 0. if you pass in null or 0, the first page is returned. return value type: connectapi.followingpage getfollowings(communityid, userid, filtertype, pageparam, pagesize) get a page with the specified number of records, filtered by key prefix, that a user follows. 940apex reference guide chatterusers class api version 28.0 available to guest users 32.0 requires chatter yes signature public static connectapi.followingpage getfollowings(string communityid, string userid, string filtertype, integer pageparam, integer pagesize) parameters communityid type: string id for an experience cloud site, internal, or null. userid type: string id for a user. filtertype" "type: string specifies the key prefix to filter the type of objects returned. a key prefix is the first three characters of the object id, which specifies the object type. for example, user objects have a prefix of 005 and group objects have a prefix of 0f9. pageparam type: integer number of the page you want returned. starts at 0. if you pass in null or 0, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. return value type: connectapi.followingpage getreputation(communityid, userid) get a user’s reputation. api version 32.0 941apex reference guide chatterusers class available to guest users 32.0 requires chatter yes signature public static connectapi.reputation getreputation(string communityid, string userid) parameters communityid type: string id for an experience cloud site, internal, or null. userid type: string id of the user. return value type: connectapi.reputation getuser(communityid, userid) get information about a user. api version 28.0 available to guest users 32.0 requires chatter yes signature public static connectapi.usersummary getuser(string communityid, string userid) parameters communityid type: string id for an experience cloud site, internal, or null. 942apex reference guide chatterusers class userid type: string id for a user. return value type: connectapi.userdetail usage if the user is external, the properties that the connectapi.userdetail output class shares with the connectapi.usersummary output class can have non-null values. other properties are always null. getuserbatch(communityid, userids) get information about a list of users. api version 31.0 available to guest users 32.0 requires chatter yes signature public static connectapi.batchresult[] getuserbatch(string communityid, list userids) parameters communityid type: string id for an experience cloud site, internal, or null. userids type: list a list of up to 500 user ids. return value type: connectapi.batchresult[] the connectapi.batchresult.getresult() method returns a connectapi.user object and errors for users that didn’t load. 943apex reference guide chatterusers class example // get users in an organization. connectapi.userpage userpage = connectapi.chatterusers.getusers(null); // create a list of user ids. list userlist = new list(); for (connectapi.user user : userpage.users){ userlist.add(user.id); } // get info about all users in the list. connectapi.batchresult[] batchresults = connectapi.chatterusers.getuserbatch(null, userlist); for (connectapi.batchresult batchresult : batchresults) { if (batchresult.issuccess()) { // operation was successful. // print each user's username. connectapi.userdetail user; if(batchresult.getresult() instanceof connectapi.userdetail) { user = (connectapi.userdetail) batchresult.getresult(); } system.debug('success'); system.debug(user.username); } else { // operation failed. print errors. system.debug('failure'); system.debug(batchresult.geterrormessage()); } } getusergroups(communityid, userid) get a user’s groups. api version 45.0 available to guest users 45.0 requires chatter yes signature public static connectapi.usergroupdetailpage getusergroups(string communityid, string userid) 944apex reference guide chatterusers class parameters communityid type: string id for an experience cloud site, internal, or null. userid type: string id for a user. return value type: connectapi.usergroupdetailpage getusergroups(communityid" ", userid, pageparam, pagesize) get a page of a user’s groups. api version 45.0 available to guest users 45.0 requires chatter yes signature public static connectapi.usergroupdetailpage getusergroups(string communityid, string userid, integer pageparam, integer pagesize) parameters communityid type: string id for an experience cloud site, internal, or null. userid type: string id for a user. pageparam type: integer number of the page you want returned. starts at 0. if you pass in null or 0, the first page is returned. pagesize type: integer 945apex reference guide chatterusers class specifies the number of items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. return value type: connectapi.usergroupdetailpage getusers(communityid) get the first page of users. api version 28.0 available to guest users 32.0 requires chatter yes signature public static connectapi.userpage getusers(string communityid) parameters communityid type: string id for an experience cloud site, internal, or null. return value type: connectapi.userpage getusers(communityid, pageparam, pagesize) get a page of users. api version 28.0 available to guest users 32.0 requires chatter yes 946apex reference guide chatterusers class signature public static connectapi.userpage getusers(string communityid, integer pageparam, integer pagesize) parameters communityid type: string id for an experience cloud site, internal, or null. pageparam type: integer number of the page you want returned. starts at 0. if you pass in null or 0, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. return value type: connectapi.userpage purgeuseractivities(communityid, userid) start a job to purge chatter-related user activity, such as bookmarks, topic endorsements, and votes. api version 42.0 requires chatter yes signature public static connectapi.useractivitiesjob purgeuseractivities(string communityid, string userid) parameters communityid type: string id for an experience cloud site, internal, or null. userid type: string id of the user. 947apex reference guide chatterusers class return value type: connectapi.useractivitiesjob usage the following activities can be purged with this method. • bookmark—user bookmarked a post. • chatteractivity—total counts of posts and comments made and likes and comments received for a user. • chatterlike—user liked a post or comment. • companyverify—user verified comment. • downvote—user downvoted a post or comment. • feedentityread—user read a post. • feedread—user read a feed. • mute—user muted a post. • topicendorsement—user endorsed another user on a topic or received endorsement on a topic. • upvote—user upvoted a post or comment. to delete a user’s posts and comments, use these methods, respectively. • deletefeedelement(communityid, feedelementid) • deletecomment(communityid, commentid) searchusergroupdetails(communityid, userid, q) get the user’s groups that match the search criteria. api version 45.0 available to guest users 45.0 requires chatter yes signature public static connectapi.usergroupdetailpage searchusergroupdetails(string communityid, string userid, string q) parameters communityid type: string id for an experience cloud site, internal, or null. 948apex reference guide chatterusers class userid type: string id for a user. q type: string required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. return value type: connectapi.usergroupdetailpage searchusergroupdetails(communityid, userid, q, pageparam, pagesize" ") get a page of a user’s groups that match the search criteria. api version 45.0 available to guest users 45.0 requires chatter yes signature public static connectapi.usergroupdetailpage searchusergroupdetails(string communityid, string userid, string q, integer pageparam, integer pagesize) parameters communityid type: string id for an experience cloud site, internal, or null. userid type: string id for a user. q type: string required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. pageparam type: integer 949apex reference guide chatterusers class number of the page you want returned. starts at 0. if you pass in null or 0, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. return value type: connectapi.usergroupdetailpage searchusers(communityid, q) get the first page of users that match the search criteria. api version 28.0 available to guest users 32.0 requires chatter yes signature public static connectapi.userpage searchusers(string communityid, string q) parameters communityid type: string id for an experience cloud site, internal, or null. q type: string required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. return value type: connectapi.userpage 950apex reference guide chatterusers class usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestsearchusers(communityid, q, result) apex developer guide: testing connectapi code searchusers(communityid, q, pageparam, pagesize) get a page of users that match the search criteria. api version 28.0 available to guest users 32.0 requires chatter yes signature public static connectapi.userpage searchusers(string communityid, string q, integer pageparam, integer pagesize) parameters communityid type: string id for an experience cloud site, internal, or null. q type: string required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. pageparam type: integer number of the page you want returned. starts at 0. if you pass in null or 0, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. 951apex reference guide chatterusers class return value type: connectapi.userpage usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestsearchusers(communityid, q, pageparam, pagesize, result) apex developer guide: testing connectapi code searchusers(communityid, q, searchcontextid, pageparam, pagesize) get a page of users that match the search criteria. api version 28.0 available to guest users 32.0 requires chatter yes signature public static connectapi.userpage searchusers(string communityid, string q, string searchcontextid, integer pageparam, integer pagesize) parameters communityid type: string id for an experience cloud site, internal, or null. q type: string required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. searchcontextid type: string a feed item id that filters search results for feed @mentions. more useful results are listed first. when you specify this argument, you cannot query more than 500 results and you cannot use wildcards in the search term. 952apex reference guide chatterusers class pageparam type: integer number of the" "page you want returned. starts at 0. if you pass in null or 0, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. return value type: connectapi.userpage usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestsearchusers(communityid, q, searchcontextid, pageparam, pagesize, result) apex developer guide: testing connectapi code updatechattersettings(communityid, userid, defaultgroupemailfrequency) update the default chatter settings for a user. api version 28.0 requires chatter yes signature public static connectapi.userchattersettings updatechattersettings(string communityid, string userid, connectapi.groupemailfrequency defaultgroupemailfrequency) parameters communityid type: string id for an experience cloud site, internal, or null. userid type: string id for the context user or the keyword me. defaultgroupemailfrequency type: connectapi.groupemailfrequency 953apex reference guide chatterusers class frequency with which a user receives email. values are: • eachpost • dailydigest • weeklydigest • never • usedefault don’t pass the value usedefault for the defaultgroupemailfrequency parameter because calling updatechattersettings sets the default value. return value type: connectapi.userchattersettings updateuser(communityid, userid, userinput) update the about me section for a user. api version 29.0 requires chatter yes signature public static connectapi.userdetail updateuser(string communityid, string userid, connectapi.userinput userinput) parameters communityid type: string id for an experience cloud site, internal, or null. userid type: string id for the context user or the keyword me. userinput type: connectapi.userinput specifies the updated information. return value type: connectapi.userdetail 954apex reference guide chatterusers class chatterusers test methods the following are the test methods for chatterusers. all methods are static. for information about using these methods to test your connectapi code, see testing connectapi code. in this section: settestsearchusers(communityid, q, result) register a connectapi.userpage object to be returned when the matching connectapi.searchusers method is called in a test context. use the method with the same parameters or you receive an exception. settestsearchusers(communityid, q, pageparam, pagesize, result) register a connectapi.userpage object to be returned when the matching connectapi.searchusers method is called in a test context. use the method with the same parameters or you receive an exception. settestsearchusers(communityid, q, searchcontextid, pageparam, pagesize, result) register a connectapi.userpage object to be returned when the matching connectapi.searchusers method is called in a test context. use the method with the same parameters or you receive an exception. settestsearchusers(communityid, q, result) register a connectapi.userpage object to be returned when the matching connectapi.searchusers method is called in a test context. use the method with the same parameters or you receive an exception. api version 28.0 signature public static void settestsearchusers(string communityid, string q, connectapi.userpage result) parameters communityid type: string id for an experience cloud site, internal, or null. q type: string required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. result type: connectapi.userpage object containing test data. 955apex reference guide chatterusers class return value type: void see also: searchusers(communityid, q) apex developer guide: testing connectapi code settestsearchusers(communityid, q, pageparam, pagesize, result) register a connectapi.userpage object to be returned when the matching connecta" "pi.searchusers method is called in a test context. use the method with the same parameters or you receive an exception. api version 28.0 signature public static void settestsearchusers(string communityid, string q, integer pageparam, integer pagesize, connectapi.userpage result) parameters communityid type: string id for an experience cloud site, internal, or null. q type: string required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. pageparam type: integer number of the page you want returned. starts at 0. if you pass in null or 0, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. result type: connectapi.userpage object containing test data. 956apex reference guide chatterusers class return value type: void see also: searchusers(communityid, q, pageparam, pagesize) apex developer guide: testing connectapi code settestsearchusers(communityid, q, searchcontextid, pageparam, pagesize, result) register a connectapi.userpage object to be returned when the matching connectapi.searchusers method is called in a test context. use the method with the same parameters or you receive an exception. api version 28.0 signature public static void settestsearchusers(string communityid, string q, string searchcontextid, integer pageparam, integer pagesize, connectapi.userpage result) parameters communityid type: string id for an experience cloud site, internal, or null. q type: string required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. searchcontextid type: string a feed item id that filters search results for feed @mentions. more useful results are listed first. when you specify this argument, you cannot query more than 500 results and you cannot use wildcards in the search term. pageparam type: integer number of the page you want returned. starts at 0. if you pass in null or 0, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. result type: connectapi.userpage object containing test data. 957apex reference guide chatterusers class return value type: void see also: searchusers(communityid, q, searchcontextid, pageparam, pagesize) apex developer guide: testing connectapi code retired chatterusers methods the following methods for chatterusers are retired. in this section: deletephoto(communityid, userid) delete a user’s photo. getgroups(communityid, userid) get the groups that a user is a member of. getgroups(communityid, userid, pageparam, pagesize) get a page of groups that a user is a member of. getphoto(communityid, userid) get a user’s photo. searchusergroups(communityid, userid, q) get the user’s groups that match the search criteria. searchusergroups(communityid, userid, q, pageparam, pagesize) get a page of a user’s groups that match the search criteria. setphoto(communityid, userid, fileid, versionnumber) set an uploaded file as a user’s photo. setphoto(communityid, userid, fileupload) set a file that hasn’t been uploaded as the user’s photo. setphotowithattributes(communityid, userid, photo) set and crop an uploaded file as a user’s photo. setphotowithattributes(communityid, userid, photo, fileupload) set and crop a file that hasn’t been uploaded as a user’s photo. deletephoto(communityid, userid) delete a user’s photo. api version 28.0–34.0 important: in version 35.0 and later, use connectapi.userprofiles.deletephoto(communityid, userid) 958apex reference guide chatterusers" "class signature public static void deletephoto(string communityid, string userid) parameters communityid type: string id for an experience cloud site, internal, or null. userid type: string id for the context user or the keyword me. return value type: void getgroups(communityid, userid) get the groups that a user is a member of. api version 28.0–44.0 important: in version 45.0 and later, use getusergroups(communityid, userid). available to guest users 32.0–44.0 requires chatter yes signature public static connectapi.usergrouppage getgroups(string communityid, string userid) parameters communityid type: string id for an experience cloud site, internal, or null. userid type: string id for a user. 959apex reference guide chatterusers class return value type: connectapi.usergrouppage getgroups(communityid, userid, pageparam, pagesize) get a page of groups that a user is a member of. api version 28.0–44.0 important: in version 45.0 and later, use getusergroups(communityid, userid, pageparam, pagesize). available to guest users 32.0–44.0 requires chatter yes signature public static connectapi.usergrouppage getgroups(string communityid, string userid, integer pageparam, integer pagesize) parameters communityid type: string id for an experience cloud site, internal, or null. userid type: string id for a user. pageparam type: integer number of the page you want returned. starts at 0. if you pass in null or 0, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. return value type: connectapi.usergrouppage getphoto(communityid, userid) get a user’s photo. 960apex reference guide chatterusers class api version 28.0–34.0 important: in version 35.0 and later, use connectapi.userprofiles.getphoto(communityid, userid). available to guest users 32.0 requires chatter yes signature public static connectapi.photo getphoto(string communityid, string userid) parameters communityid type: string id for an experience cloud site, internal, or null. userid type: string id for a user. return value type: connectapi.photo searchusergroups(communityid, userid, q) get the user’s groups that match the search criteria. api version 30.0–44.0 important: in version 45.0 and later, use searchusergroupdetails(communityid, userid, q). available to guest users 32.0–44.0 requires chatter yes 961apex reference guide chatterusers class signature public static connectapi.usergrouppage searchusergroups(string communityid, string userid, string q) parameters communityid type: string id for an experience cloud site, internal, or null. userid type: string id for a user. q type: string required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. return value type: connectapi.usergrouppage searchusergroups(communityid, userid, q, pageparam, pagesize) get a page of a user’s groups that match the search criteria. api version 30.0–44.0 important: in version 45.0 and later, use searchusergroupdetails(communityid, userid, q, pageparam, pagesize). available to guest users 32.0–44.0 requires chatter yes signature public static connectapi.usergrouppage searchusergroups(string communityid, string userid, string q, integer pageparam, integer pagesize) parameters communityid type: string 962apex reference guide chatterusers class id for an experience cloud site, internal, or null. userid type: string id for a user." "q type: string required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. pageparam type: integer number of the page you want returned. starts at 0. if you pass in null or 0, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. return value type: connectapi.usergrouppage setphoto(communityid, userid, fileid, versionnumber) set an uploaded file as a user’s photo. api version 28.0–34.0 important: in version 35.0 and later, use connectapi.userprofiles.setphoto(communityid, userid, fileid, versionnumber) requires chatter yes signature public static connectapi.photo setphoto(string communityid, string userid, string fileid, integer versionnumber) parameters communityid type: string id for an experience cloud site, internal, or null. userid type: string id for the context user or the keyword me. 963apex reference guide chatterusers class fileid type: string id of a file already uploaded. the file must be an image, and be smaller than 2 gb. versionnumber type: integer version number of the existing file. specify either an existing version number, or null to get the latest version. return value type: connectapi.photo usage photos are processed asynchronously and might not be visible right away. setphoto(communityid, userid, fileupload) set a file that hasn’t been uploaded as the user’s photo. api version 28.0–34.0 important: in version 35.0 and later, use connectapi.userprofiles.setphoto(communityid, userid, fileupload) requires chatter yes signature public static connectapi.photo setphoto(string communityid, string userid, connectapi.binaryinput fileupload) parameters communityid type: string id for an experience cloud site, internal, or null. userid type: string id for the context user or the keyword me. fileupload type: connectapi.binaryinput file to use as the photo. the content type must be usable as an image. 964apex reference guide chatterusers class return value type: connectapi.photo usage photos are processed asynchronously and might not be visible right away. setphotowithattributes(communityid, userid, photo) set and crop an uploaded file as a user’s photo. api version 29.0–34.0 important: in version 35.0 and later, use connectapi.userprofiles.setphotowithattributes(communityid, userid, photo) requires chatter yes signature public static connectapi.photo setphotowithattributes(string communityid, string userid, connectapi.photoinput photo) parameters communityid type: string id for an experience cloud site, internal, or null. userid type: string id for the context user or the keyword me. photo type: connectapi.photoinput a connectapi.photoinput object specifying the file id, version number, and cropping parameters. return value type: connectapi.photo usage photos are processed asynchronously and might not be visible right away. 965apex reference guide clm class setphotowithattributes(communityid, userid, photo, fileupload) set and crop a file that hasn’t been uploaded as a user’s photo. api version 29.0–34.0 important: in version 35.0 and later, use connectapi.userprofiles.setphotowithattributes(communityid, userid, photo, fileupload) requires chatter yes signature public static connectapi.photo setphotowithattributes(string communityid, string userid, connectapi.photoinput photo, connectapi.binaryinput fileupload) parameters communityid type: string id for an experience cloud site, internal, or null. userid type: string id for the context user or the keyword me. photo type: connectapi.photoinput a connectapi" ".photoinput object specifying the cropping parameters. fileupload type: connectapi.binaryinput file to use as the photo. the content type must be usable as an image. return value type: connectapi.photo usage photos are processed asynchronously and might not be visible right away. clm class create and update contract lifecycle management (clm) contracts using object id. 966apex reference guide clm class namespace connectapi clm methods the following are methods for clm. all methods are static. in this section: createcontract(contractinputpayload) create contracts using the object id. updatecontract(contractinputpayload) update contracts using the object id. createcontract(contractinputpayload) create contracts using the object id. api version 56.0 requires chatter no signature public static connectapi.contractoutputrepresentation createcontract(connectapi.contractinputrepresentation contractinputpayload) parameters contractinputpayload type: connectapi.contractinputrepresentation on page 1575 input payload to create contract. return value type: connectapi.contractoutputrepresentation on page 1759 updatecontract(contractinputpayload) update contracts using the object id. api version 56.0 967apex reference guide commercebuyerexperience class requires chatter no signature public static connectapi.contractoutputrepresentation updatecontract(connectapi.contractinputrepresentation contractinputpayload) parameters contractinputpayload type: connectapi.contractinputrepresentation on page 1575 input payload to update contract. return value type: connectapi.contractoutputrepresentation on page 1759 commercebuyerexperience class create, delete, or get commerce addresses. get order delivery group, order item, order shipments, shipment items, and order summaries. get adjustments for order items and order summaries. namespace connectapi commercebuyerexperience methods these methods are for commercebuyerexperience. all methods are static. in this section: addordertocart(webstoreid, ordersummaryid, ordertocartinput) add an order to a cart using a webstore order summary. addordertocart(webstoreid, ordersummaryid, ordertocartinput, effectiveaccountid) add an order to a cart for a specific account using a webstore order summary. calculateadjustmentaggregates(webstoreid, ordersummaryids) submit a job to calculate adjustment aggregates for a list of order summary ids. createcommerceaccountaddress(webstoreid, accountid, addressinput) create a commerce account address for a webstore account. deletecommerceaccountaddress(webstoreid, accountid, addressid) delete a commerce account address for a webstore. getcommerceaccountaddress(webstoreid, accountid) get a commerce account address for a webstore. 968apex reference guide commercebuyerexperience class getcommerceaccountaddress(webstoreid, accountid, defaultonly) get commerce account addresses for a webstore and account. getcommerceaccountaddress(webstoreid, accountid, defaultonly, addresstype, fields, pagetoken, pagesize, sortorder) get commerce account addresses for a webstore and account. getcommerceaccountaddress(webstoreid, accountid, addresstype, excludeunsupportedcountries) get commerce account addresses for a webstore and account. getcommerceaccountaddress(webstoreid, accountid, defaultonly, addresstype, excludeunsupportedcountries) get commerce account addresses for a webstore and account. getcommerceaccountaddress(webstoreid, accountid, defaultonly, addresstype, excludeunsupportedcountries, fields, pagetoken, pagesize, sortorder) get commerce account addresses for a webstore and account. getorderdeliverygroupsummaries(webstoreid, effectiveaccountid, ordersummaryid) get order delivery group summaries. getorderdeliverygroupsummaries(webstoreid, effectiveaccountid, ordersummaryid, pagesize) get order delivery group summaries. getorderdeliverygroupsummaries(webstoreid, effectiveaccountid, ordersummaryid, pageparam) get a page of order delivery group summaries. getorderdeliverygroupsummaries(webstoreid, effectiveaccountid, ordersummaryid, fields) get order delivery group summaries with specific fields. getorderdeliverygroupsummaries(webstoreid, effectiveaccountid, ordersummaryid, pageparam, fields) get a page of order delivery" "group summaries with specific fields. getorderdeliverygroupsummaries(webstoreid, effectiveaccountid, ordersummaryid, fields, pagesize) get order delivery group summaries with specific fields. getorderdeliverygroupsummaries(webstoreid, effectiveaccountid, ordersummaryid, fields, sortparam) get a sorted list of order delivery group summaries with specific fields. getorderdeliverygroupsummaries(webstoreid, effectiveaccountid, ordersummaryid, fields, pagesize, sortparam) get a sorted list of order delivery group summaries with specific fields. getorderitemsummaries(webstoreid, effectiveaccountid, ordersummaryid) get order item summaries. getorderitemsummaries(webstoreid, effectiveaccountid, ordersummaryid, pagesize) get order item summaries. getorderitemsummaries(webstoreid, effectiveaccountid, ordersummaryid, orderdeliverygroupsummaryid) get order item summaries for a delivery group summary. getorderitemsummaries(webstoreid, effectiveaccountid, ordersummaryid, orderdeliverygroupsummaryid, pagesize) get order item summaries for a delivery group summary. getorderitemsummaries(webstoreid, effectiveaccountid, ordersummaryid, orderdeliverygroupsummaryid, pageparam) get a page of order item summaries for a delivery group summary. getorderitemsummaries(webstoreid, effectiveaccountid, ordersummaryid, orderdeliverygroupsummaryid, fields) get order item summaries for a delivery group summary with specific fields. getorderitemsummaries(webstoreid, effectiveaccountid, ordersummaryid, orderdeliverygroupsummaryid, fields, pagesize) get order item summaries for a delivery group summary with specific fields. 969apex reference guide commercebuyerexperience class getorderitemsummaries(webstoreid, effectiveaccountid, ordersummaryid, orderdeliverygroupsummaryid, fields, pageparam) get a page of order item summaries for a delivery group summary with specific fields. getorderitemsummaries(webstoreid, effectiveaccountid, ordersummaryid, orderdeliverygroupsummaryid, fields, sortparam) get a sorted list of order item summaries for a delivery group summary with specific fields. getorderitemsummaries(webstoreid, effectiveaccountid, ordersummaryid, orderdeliverygroupsummaryid, fields, pagesize, sortparam) get a sorted page of order item summaries for a delivery group summary with specific fields. getorderitemsummaries(webstoreid, effectiveaccountid, ordersummaryid, orderdeliverygroupsummaryid, fields, pageparam, pagesize, sortparam, includeadjustmentdetails) get a sorted page of order item summaries for a delivery group summary with specific fields and include adjustment details. getorderitemsummaryadjustments(webstoreid, ordersummaryid, orderitemsummaryadjustmentcollectioninput) get adjustments for order items. getorderitemsummaryadjustments(webstoreid, ordersummaryid, orderitemsummaryadjustmentcollectioninput, effectiveaccountid) get adjustments for order items. getordershipmentitems(webstoreid, shipmentid) get order shipment items. getordershipmentitems(webstoreid, shipmentid, effectiveaccountid) get order shipment items. getordershipmentitems(webstoreid, shipmentid, effectiveaccountid, fields) get order shipment items with specific fields. getordershipmentitems(webstoreid, shipmentid, effectiveaccountid, fields, pagetoken, pagesize) get a page of order shipment items with specific fields. getordershipmentitems(webstoreid, shipmentid, effectiveaccountid, fields, pagetoken, pagesize, sortorder) get a sorted page of order shipment items. getordershipments(webstoreid, ordersummaryid) get order shipments. getordershipments(webstoreid, ordersummaryid, effectiveaccountid) get order shipments. getordershipments(webstoreid, ordersummaryid, effectiveaccountid, fields) get order shipments with specific fields. getordershipments(webstoreid, ordersummaryid, effectiveaccountid, fields, pagesize, pagetoken) get a page of order shipments with specific fields. getordershipments(webstoreid, ordersummaryid, effectiveaccountid, fields, pagesize, pagetoken, sortorder) get a sorted page of order shipments with specific fields. getordersummaries(webstoreid) get order summaries. getordersummaries(webstoreid, effectiveaccountid)" "get order summaries. getordersummaries(webstoreid, effectiveaccountid, fields) get order summaries with specific fields. getordersummaries(webstoreid, effectiveaccountid, fields, pagesize, pagetoken) get a page of order summaries with specific fields. 970apex reference guide commercebuyerexperience class getordersummaries(webstoreid, effectiveaccountid, fields, pagesize, pagetoken, sortorder) get a sorted page of order summaries with specific fields. getordersummaries(webstoreid, effectiveaccountid, fields, pagesize, pagetoken, sortorder, earliestdate, latestdate) get a sorted page of order summaries with specific fields within a specific date range. getordersummaries(webstoreid, effectiveaccountid, fields, pagesize, pagetoken, sortorder, earliestdate, latestdate, ownerscoped) get a sorted page of order summaries with specific fields within a specific date range and scoped to orders owned by the context user. getordersummaries(webstoreid, effectiveaccountid, fields, pagesize, pagetoken, sortorder, earliestdate, latestdate, ownerscoped, includeadjustmentdetails) get a sorted page of order summaries with specific fields within a specific date range and scoped to orders owned by the context user. getordersummary(webstoreid, ordersummaryid, effectiveaccountid) get an order summary. getordersummary(webstoreid, ordersummaryid, effectiveaccountid, fields) get an order summary with fields. getordersummary(webstoreid, ordersummaryid, effectiveaccountid, fields, includeadjustmentdetails) get an order summary with fields and include adjustment details. getordersummaryadjustments(webstoreid, ordersummaryid) get adjustments for an order summary. getordersummaryadjustments(webstoreid, ordersummaryid, effectiveaccountid) get adjustments for an order summary. updatecommerceaccountaddress(webstoreid, accountid, addressid, addressinput) update a commerce account address for a webstore. addordertocart(webstoreid, ordersummaryid, ordertocartinput) add an order to a cart using a webstore order summary. api version 57.0 requires chatter no signature public static connectapi.ordertocartresult addordertocart(string webstoreid, string ordersummaryid, connectapi.ordertocartinput ordertocartinput) parameters webstoreid type: string 971apex reference guide commercebuyerexperience class id of the webstore. ordersummaryid type: string id of the order summary. ordertocartinput type: connectapi.ordertocartinput input value indicating which cart the order should be added to. return value type: connectapi.ordertocartresult addordertocart(webstoreid, ordersummaryid, ordertocartinput, effectiveaccountid) add an order to a cart for a specific account using a webstore order summary. api version 57.0 requires chatter no signature public static connectapi.ordertocartresult addordertocart(string webstoreid, string ordersummaryid, connectapi.ordertocartinput ordertocartinput, string effectiveaccountid) parameters webstoreid type: string id of the webstore. ordersummaryid type: string id of the order summary. ordertocartinput type: connectapi.ordertocartinput input value indicating which cart the order should be added to. effectiveaccountid type: string id of the account for which the request is made. if null, defaults to the account id for the context user. 972apex reference guide commercebuyerexperience class return value type: connectapi.ordertocartresult calculateadjustmentaggregates(webstoreid, ordersummaryids) submit a job to calculate adjustment aggregates for a list of order summary ids. api version 55.0 requires chatter no signature public static connectapi.ordersummaryadjustmentaggregatesasyncoutput calculateadjustmentaggregates(string webstoreid, connectapi.ordersummaryadjustmentaggregatesasyncinput ordersummaryids) parameters webstoreid type: string id of the webstore. ordersummaryids type: connectapi.ordersummaryadjustmentaggregatesasyncinput a connectapi.ordersummaryadjustmentaggregatesasyncinput class with" "a list of order summary ids. return value type: connectapi.ordersummaryadjustmentaggregatesasyncoutput createcommerceaccountaddress(webstoreid, accountid, addressinput) create a commerce account address for a webstore account. api version 54.0 requires chatter no 973apex reference guide commercebuyerexperience class signature public static connectapi.commerceaddressoutput createcommerceaccountaddress(string webstoreid, string accountid, connectapi.commerceaddressinput addressinput) parameters webstoreid type: string id of the webstore. accountid type: string id of the account. addressinput type: connectapi.commerceaddressinput information about the address you want to create. return value type: connectapi.commerceaddressoutput deletecommerceaccountaddress(webstoreid, accountid, addressid) delete a commerce account address for a webstore. api version 54.0 requires chatter no signature public static void deletecommerceaccountaddress(string webstoreid, string accountid, string addressid) parameters webstoreid type: string id of the webstore. accountid type: string id of the account. addressid type: string 974apex reference guide commercebuyerexperience class id of the address. return value type: void getcommerceaccountaddress(webstoreid, accountid) get a commerce account address for a webstore. api version 54.0 requires chatter no signature public static connectapi.commerceaddresscollection getcommerceaccountaddress(string webstoreid, string accountid) parameters webstoreid type: string id of the webstore. accountid type: string id of the account. return value type: connectapi.commerceaddresscollection getcommerceaccountaddress(webstoreid, accountid, defaultonly) get commerce account addresses for a webstore and account. you can get the default address by itself, or you can get all of the addresses for the account. api version 54.0 requires chatter no 975apex reference guide commercebuyerexperience class signature public static connectapi.commerceaddresscollection getcommerceaccountaddress(string webstoreid, string accountid, boolean defaultonly) parameters webstoreid type: string id of the webstore. accountid type: string id of the account. defaultonly type: boolean indicate if you only want the default address (true) or all addresses for the account (false). the default value is false. return value type: connectapi.commerceaddresscollection getcommerceaccountaddress(webstoreid, accountid, defaultonly, addresstype, fields, pagetoken, pagesize, sortorder) get commerce account addresses for a webstore and account. api version 54.0 requires chatter no signature public static connectapi.commerceaddresscollection getcommerceaccountaddress(string webstoreid, string accountid, boolean defaultonly, list addresstype, list fields, string pagetoken, integer pagesize, connectapi.commerceaddresssort sortorder) parameters webstoreid type: string id of the webstore. accountid type: string id of the account. 976apex reference guide commercebuyerexperience class defaultonly type: boolean indicate if you want only the default address (true) or all addresses for the account (false). the default value is false. addresstype type: list type of address, for example, billing or shipping. fields type: list a list of custom fields for the address. pagetoken type: string specifies the page token to use to view a page of information. page tokens are returned as part of the response class, such as currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortorder type: connectapi.commerceaddresssort sort order for commerce addresses. • createddateasc—sort in ascending order of created date. • createddatedesc—sort in descending order of created date. • nameasc—sort in ascending order of name. • namedesc—sort in descending order of name. return value type: connectapi.commerceaddresscollection get" "commerceaccountaddress(webstoreid, accountid, addresstype, excludeunsupportedcountries) get commerce account addresses for a webstore and account. api version 57.0 requires chatter no 977apex reference guide commercebuyerexperience class signature public static connectapi.commerceaddresscollection getcommerceaccountaddress(string webstoreid, string accountid, list addresstype, boolean excludeunsupportedcountries) parameters webstoreid type: string id of the webstore. accountid type: string id of the account. addresstype type: list type of address, for example, billing or shipping. excludeunsupportedcountries type: boolean indicate if you want to retrieve all addresses (false) or only addresses of type shipping that are in countries included in the store’s shiptocountries list (true). the default value is false. return value type: connectapi.commerceaddresscollection getcommerceaccountaddress(webstoreid, accountid, defaultonly, addresstype, excludeunsupportedcountries) get commerce account addresses for a webstore and account. api version 57.0 requires chatter no signature public static connectapi.commerceaddresscollection getcommerceaccountaddress(string webstoreid, string accountid, boolean defaultonly, list addresstype, boolean excludeunsupportedcountries) 978apex reference guide commercebuyerexperience class parameters webstoreid type: string id of the webstore. accountid type: string id of the account. defaultonly type: boolean indicate if you want only the default address (true) or all addresses for the account (false). the default value is false. addresstype type: list type of address, for example, billing or shipping. excludeunsupportedcountries type: boolean indicate if you want to retrieve all addresses (false) or only addresses of type shipping that are in countries included in the store’s shiptocountries list (true). the default value is false. return value type: connectapi.commerceaddresscollection getcommerceaccountaddress(webstoreid, accountid, defaultonly, addresstype, excludeunsupportedcountries, fields, pagetoken, pagesize, sortorder) get commerce account addresses for a webstore and account. api version 57.0 requires chatter no signature public static connectapi.commerceaddresscollection getcommerceaccountaddress(string webstoreid, string accountid, boolean defaultonly, list addresstype, boolean excludeunsupportedcountries, list fields, string pagetoken, integer pagesize, connectapi.commerceaddresssort sortorder) parameters webstoreid type: string 979apex reference guide commercebuyerexperience class id of the webstore. accountid type: string id of the account. defaultonly type: boolean indicate if you want only the default address (true) or all addresses for the account (false). the default value is false. addresstype type: list type of address, for example, billing or shipping. excludeunsupportedcountries type: boolean indicate if you want to retrieve all addresses (false) or only addresses of type shipping that are in countries included in the store’s shiptocountries list (true). the default value is false. fields type: list a list of custom fields for the address. pagetoken type: string specifies the page token to use to view a page of information. page tokens are returned as part of the response class, such as currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortorder type: connectapi.commerceaddresssort sort order for commerce addresses. values are: • createddateasc—sort in ascending order of created date. • createddatedesc—sort in descending order of created date. • nameasc—sort in ascending order of name. • namedesc—sort in descending order of name. return value type: connectapi.commerceaddresscollection getorderdeliverygroupsummaries(webstoreid, effectiveaccountid, ordersummaryid) get order delivery group summaries. api version 51.0" "980apex reference guide commercebuyerexperience class requires chatter no signature public static connectapi.orderdeliverygroupsummarycollection getorderdeliverygroupsummaries(string webstoreid, string effectiveaccountid, string ordersummaryid) parameters webstoreid type: string id of the webstore. effectiveaccountid type: string id of the account for which the request is made. if null, defaults to the account id for the context user. ordersummaryid type: string id of the order summary. return value type: connectapi.orderdeliverygroupsummarycollection getorderdeliverygroupsummaries(webstoreid, effectiveaccountid, ordersummaryid, pagesize) get order delivery group summaries. api version 51.0 requires chatter no signature public static connectapi.orderdeliverygroupsummarycollection getorderdeliverygroupsummaries(string webstoreid, string effectiveaccountid, string ordersummaryid, integer pagesize) parameters webstoreid type: string 981apex reference guide commercebuyerexperience class id of the webstore. effectiveaccountid type: string id of the account for which the request is made. if null, defaults to the account id for the context user. ordersummaryid type: string id of the order summary. pagesize type: integer specifies the number of items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. return value type: connectapi.orderdeliverygroupsummarycollection getorderdeliverygroupsummaries(webstoreid, effectiveaccountid, ordersummaryid, pageparam) get a page of order delivery group summaries. api version 51.0 requires chatter no signature public static connectapi.orderdeliverygroupsummarycollection getorderdeliverygroupsummaries(string webstoreid, string effectiveaccountid, string ordersummaryid, string pageparam) parameters webstoreid type: string id of the webstore. effectiveaccountid type: string id of the account for which the request is made. if null, defaults to the account id for the context user. ordersummaryid type: string id of the order summary. 982" "apex reference guide commercebuyerexperience class pageparam type: string specifies the page token to use to view a page of information. page tokens are returned as part of the response class, such as currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. return value type: connectapi.orderdeliverygroupsummarycollection getorderdeliverygroupsummaries(webstoreid, effectiveaccountid, ordersummaryid, fields) get order delivery group summaries with specific fields. api version 51.0 requires chatter no signature public static connectapi.orderdeliverygroupsummarycollection getorderdeliverygroupsummaries(string webstoreid, string effectiveaccountid, string ordersummaryid, list fields) parameters webstoreid type: string id of the webstore. effectiveaccountid type: string id of the account for which the request is made. if null, defaults to the account id for the context user. ordersummaryid type: string id of the order summary. fields type: list list of up to 15 order delivery group summary or order delivery method fields to display in the ui in each item row. return value type: connectapi.orderdeliverygroupsummarycollection 983apex reference guide commercebuyerexperience class getorderdeliverygroupsummaries(webstoreid, effectiveaccountid, ordersummaryid, pageparam, fields) get a page of order delivery group summaries with specific fields. api version 51.0 requires chatter no signature public static connectapi.orderdeliverygroupsummarycollection getorderdeliverygroupsummaries(string webstoreid, string effectiveaccountid, string ordersummaryid, string pageparam, list fields) parameters webstoreid type: string id of the webstore. effectiveaccountid type: string id of the account for which the request is made. if null, defaults to the account id for the context user. ordersummaryid type: string id of the order summary. pageparam type: string specifies the page token to use to view a page of information. page tokens are returned as part of the response class, such as currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. fields type: list list of up to 15 order delivery group summary or order delivery method fields to display in the ui in each item row. return value type: connectapi.orderdeliverygroupsummarycollection getorderdeliverygroupsummaries(webstoreid, effectiveaccountid, ordersummaryid, fields, pagesize) get order delivery group summaries with specific fields. 984apex reference guide commercebuyerexperience class api version 51.0 requires chatter no signature public static connectapi.orderdeliverygroupsummarycollection getorderdeliverygroupsummaries(string webstoreid, string effectiveaccountid, string ordersummaryid, list fields, integer pagesize) parameters webstoreid type: string id of the webstore. effectiveaccountid type: string id of the account for which the request is made. if null, defaults to the account id for the context user. ordersummaryid type: string id of the order summary. fields type: list list of up to 15 order delivery group summary or order delivery method fields to display in the ui in each item row. pagesize type: integer specifies the number of items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. return value type: connectapi.orderdeliverygroupsummarycollection getorderdeliverygroupsummaries(webstoreid, effectiveaccountid, ordersummaryid, fields, sortparam) get a sorted list of order delivery group summaries with specific fields. api version 51.0 requires chatter no 985apex reference guide commercebuyerexperience class signature public static connectapi.orderdeliverygroupsummarycollection getorderdeliverygroupsummaries(string webstoreid, string effectiveaccountid, string ordersummaryid, list fields, connectapi.orderdeliverygroupsummarysort sortparam) parameters webstoreid type: string id of the webstore. effectiveaccountid type: string id of the account for which the request is made. if null, defaults to the account id for the context user. ordersummaryid type: string id of the" "order summary. fields type: list list of up to 15 order delivery group summary or order delivery method fields to display in the ui in each item row. sortparam type: connectapi.orderdeliverygroupsummarysort sort order for order delivery group summaries. values are: • idasc—sorts by id in ascending alphanumeric order (a–z, 0–9). • iddesc—sorts by id in descending alphanumeric order (z–a, 9–0). if null, idasc is the default sort order. return value type: connectapi.orderdeliverygroupsummarycollection getorderdeliverygroupsummaries(webstoreid, effectiveaccountid, ordersummaryid, fields, pagesize, sortparam) get a sorted list of order delivery group summaries with specific fields. api version 51.0 requires chatter no 986apex reference guide commercebuyerexperience class signature public static connectapi.orderdeliverygroupsummarycollection getorderdeliverygroupsummaries(string webstoreid, string effectiveaccountid, string ordersummaryid, list fields, integer pagesize, connectapi.orderdeliverygroupsummarysort sortparam) parameters webstoreid type: string id of the webstore. effectiveaccountid type: string id of the account for which the request is made. if null, defaults to the account id for the context user. ordersummaryid type: string id of the order summary. fields type: list list of up to 15 order delivery group summary or order delivery method fields to display in the ui in each item row. pagesize type: integer specifies the number of items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.orderdeliverygroupsummarysort sort order for order delivery group summaries. values are: • idasc—sorts by id in ascending alphanumeric order (a–z, 0–9). • iddesc—sorts by id in descending alphanumeric order (z–a, 9–0). if null, idasc is the default sort order. return value type: connectapi.orderdeliverygroupsummarycollection getorderitemsummaries(webstoreid, effectiveaccountid, ordersummaryid) get order item summaries. api version 51.0 requires chatter no 987apex reference guide commercebuyerexperience class signature public static connectapi.orderitemsummarycollection getorderitemsummaries(string webstoreid, string effectiveaccountid, string ordersummaryid) parameters webstoreid type: string id of the webstore. effectiveaccountid type: string id of the account for which the request is made. if null, defaults to the account id for the context user. ordersummaryid type: string id of the order summary. return value type: connectapi.orderitemsummarycollection getorderitemsummaries(webstoreid, effectiveaccountid, ordersummaryid, pagesize) get order item summaries. api version 51.0 requires chatter no signature public static connectapi.orderitemsummarycollection getorderitemsummaries(string webstoreid, string effectiveaccountid, string ordersummaryid, integer pagesize) parameters webstoreid type: string id of the webstore. effectiveaccountid type: string id of the account for which the request is made. if null, defaults to the account id for the context user. 988apex reference guide commercebuyerexperience class ordersummaryid type: string id of the order summary. pagesize type: integer specifies the number of items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. return value type: connectapi.orderitemsummarycollection getorderitemsummaries(webstoreid, effectiveaccountid, ordersummaryid, orderdeliverygroupsummaryid) get order item summaries for a delivery group summary. api version 51.0 requires chatter no signature public static connectapi.orderitemsummarycollection getorderitemsummaries(string webstoreid, string effectiveaccountid, string ordersummaryid, string orderdeliverygroupsummaryid) parameters webstoreid type: string id of the webstore. effectiveaccountid type: string id of the account for which" "the request is made. if null, defaults to the account id for the context user. ordersummaryid type: string id of the order summary. orderdeliverygroupsummaryid type: string id of the order delivery group summary. 989apex reference guide commercebuyerexperience class return value type: connectapi.orderitemsummarycollection getorderitemsummaries(webstoreid, effectiveaccountid, ordersummaryid, orderdeliverygroupsummaryid, pagesize) get order item summaries for a delivery group summary. api version 51.0 requires chatter no signature public static connectapi.orderitemsummarycollection getorderitemsummaries(string webstoreid, string effectiveaccountid, string ordersummaryid, string orderdeliverygroupsummaryid, integer pagesize) parameters webstoreid type: string id of the webstore. effectiveaccountid type: string id of the account for which the request is made. if null, defaults to the account id for the context user. ordersummaryid type: string id of the order summary. orderdeliverygroupsummaryid type: string id of the order delivery group summary. pagesize type: integer specifies the number of items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. return value type: connectapi.orderitemsummarycollection 990apex reference guide commercebuyerexperience class getorderitemsummaries(webstoreid, effectiveaccountid, ordersummaryid, orderdeliverygroupsummaryid, pageparam) get a page of order item summaries for a delivery group summary. api version 51.0 requires chatter no signature public static connectapi.orderitemsummarycollection getorderitemsummaries(string webstoreid, string effectiveaccountid, string ordersummaryid, string orderdeliverygroupsummaryid, string pageparam) parameters webstoreid type: string id of the webstore. effectiveaccountid type: string id of the account for which the request is made. if null, defaults to the account id for the context user. ordersummaryid type: string id of the order summary. orderdeliverygroupsummaryid type: string id of the order delivery group summary. pageparam type: string specifies the page token to use to view a page of information. page tokens are returned as part of the response class, such as currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. return value type: connectapi.orderitemsummarycollection getorderitemsummaries(webstoreid, effectiveaccountid, ordersummaryid, orderdeliverygroupsummaryid, fields) get order item summaries for a delivery group summary with specific fields. 991apex reference guide commercebuyerexperience class api version 51.0 requires chatter no signature public static connectapi.orderitemsummarycollection getorderitemsummaries(string webstoreid, string effectiveaccountid, string ordersummaryid, string orderdeliverygroupsummaryid, list fields) parameters webstoreid type: string id of the webstore. effectiveaccountid type: string id of the account for which the request is made. if null, defaults to the account id for the context user. ordersummaryid type: string id of the order summary. orderdeliverygroupsummaryid type: string id of the order delivery group summary. fields type: list list of up to 15 order item summary or product fields to display in the ui in each item row. return value type: connectapi.orderitemsummarycollection getorderitemsummaries(webstoreid, effectiveaccountid, ordersummaryid, orderdeliverygroupsummaryid, fields, pagesize) get order item summaries for a delivery group summary with specific fields. api version 51.0 requires chatter no 992apex reference guide commercebuyerexperience class signature public static connectapi.orderitemsummarycollection getorderitemsummaries(string webstoreid, string effectiveaccountid, string ordersummaryid, string orderdeliverygroupsummaryid, list fields, integer pagesize) parameters webstoreid type: string id of the webstore. effectiveaccountid type: string id of the account for which the request is made. if null, defaults to the account id for the context user. ordersummaryid type: string id of" "the order summary. orderdeliverygroupsummaryid type: string id of the order delivery group summary. fields type: list list of up to 15 order item summary or product fields to display in the ui in each item row. pagesize type: integer specifies the number of items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. return value type: connectapi.orderitemsummarycollection getorderitemsummaries(webstoreid, effectiveaccountid, ordersummaryid, orderdeliverygroupsummaryid, fields, pageparam) get a page of order item summaries for a delivery group summary with specific fields. api version 51.0 requires chatter no 993apex reference guide commercebuyerexperience class signature public static connectapi.orderitemsummarycollection getorderitemsummaries(string webstoreid, string effectiveaccountid, string ordersummaryid, string orderdeliverygroupsummaryid, list fields, string pageparam) parameters webstoreid type: string id of the webstore. effectiveaccountid type: string id of the account for which the request is made. if null, defaults to the account id for the context user. ordersummaryid type: string id of the order summary. orderdeliverygroupsummaryid type: string id of the order delivery group summary. fields type: list list of up to 15 order item summary or product fields to display in the ui in each item row. pageparam type: string specifies the page token to use to view a page of information. page tokens are returned as part of the response class, such as currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. return value type: connectapi.orderitemsummarycollection getorderitemsummaries(webstoreid, effectiveaccountid, ordersummaryid, orderdeliverygroupsummaryid, fields, sortparam) get a sorted list of order item summaries for a delivery group summary with specific fields. api version 51.0 requires chatter no 994apex reference guide commercebuyerexperience class signature public static connectapi.orderitemsummarycollection getorderitemsummaries(string webstoreid, string effectiveaccountid, string ordersummaryid, string orderdeliverygroupsummaryid, list fields, connectapi.orderitemsummarysort sortparam) parameters webstoreid type: string id of the webstore. effectiveaccountid type: string id of the account for which the request is made. if null, defaults to the account id for the context user. ordersummaryid type: string id of the order summary. orderdeliverygroupsummaryid type: string id of the order delivery group summary. fields type: list list of up to 15 order item summary or product fields to display in the ui in each item row. sortparam type: connectapi.orderitemsummarysort sort order for order item summaries. values are: • idasc—sorts by id in ascending alphanumeric order (a–z, 0–9). • iddesc—sorts by id in descending alphanumeric order (z–a, 9–0). if null, idasc is the default sort order. return value type: connectapi.orderitemsummarycollection getorderitemsummaries(webstoreid, effectiveaccountid, ordersummaryid, orderdeliverygroupsummaryid, fields, pagesize, sortparam) get a sorted page of order item summaries for a delivery group summary with specific fields. api version 51.0 995apex reference guide commercebuyerexperience class requires chatter no signature public static connectapi.orderitemsummarycollection getorderitemsummaries(string webstoreid, string effectiveaccountid, string ordersummaryid, string orderdeliverygroupsummaryid, list fields, integer pagesize, connectapi.orderitemsummarysort sortparam) parameters webstoreid type: string id of the webstore. effectiveaccountid type: string id of the account for which the request is made. if null, defaults to the account id for the context user. ordersummaryid type: string id of the order summary. orderdeliverygroupsummaryid type: string id of the order delivery group summary. fields type: list list of up to 15 order item summary or product fields" "to display in the ui in each item row. pagesize type: integer specifies the number of items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.orderitemsummarysort sort order for order item summaries. values are: • idasc—sorts by id in ascending alphanumeric order (a–z, 0–9). • iddesc—sorts by id in descending alphanumeric order (z–a, 9–0). if null, idasc is the default sort order. return value type: connectapi.orderitemsummarycollection 996apex reference guide commercebuyerexperience class getorderitemsummaries(webstoreid, effectiveaccountid, ordersummaryid, orderdeliverygroupsummaryid, fields, pageparam, pagesize, sortparam, includeadjustmentdetails) get a sorted page of order item summaries for a delivery group summary with specific fields and include adjustment details. api version 56.0 requires chatter no signature public static connectapi.orderitemsummarycollection getorderitemsummaries(string webstoreid, string effectiveaccountid, string ordersummaryid, string orderdeliverygroupsummaryid, list fields, string pageparam, integer pagesize, connectapi.orderitemsummarysort sortparam, boolean includeadjustmentdetails) parameters webstoreid type: string id of the webstore. effectiveaccountid type: string id of the account for which the request is made. if null, defaults to the account id for the context user. ordersummaryid type: string id of the order summary. orderdeliverygroupsummaryid type: string id of the order delivery group summary. fields type: list list of up to 15 order item summary or product fields to display in the ui in each item row. pageparam type: string specifies the page token to use to view a page of information. page tokens are returned as part of the response class, such as currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. 997apex reference guide commercebuyerexperience class sortparam type: connectapi.orderitemsummarysort sort order for order item summaries. values are: • idasc—sorts by id in ascending alphanumeric order (a–z, 0–9). • iddesc—sorts by id in descending alphanumeric order (z–a, 9–0). if null, idasc is the default sort order. includeadjustmentdetails type: boolean specifies whether to return adjustment details (true) or not (false). return value type: connectapi.orderitemsummarycollection getorderitemsummaryadjustments(webstoreid, ordersummaryid, orderitemsummaryadjustmentcollectioninput) get adjustments for order items. api version 53.0 requires chatter no signature public static connectapi.orderitemsummaryadjustmentcollection getorderitemsummaryadjustments(string webstoreid, string ordersummaryid, connectapi.orderitemsummaryadjustmentcollectioninput orderitemsummaryadjustmentcollectioninput) parameters webstoreid type: string id of the webstore. ordersummaryid type: string id of the order summary. orderitemsummaryadjustmentcollectioninput type: connectapi.orderitemsummaryadjustmentcollectioninput collection of order item summaries to get adjustments for. 998apex reference guide commercebuyerexperience class return value type: connectapi.orderitemsummaryadjustmentcollection getorderitemsummaryadjustments(webstoreid, ordersummaryid, orderitemsummaryadjustmentcollectioninput, effectiveaccountid) get adjustments for order items. api version 53.0 requires chatter no signature public static connectapi.orderitemsummaryadjustmentcollection getorderitemsummaryadjustments(string webstoreid, string ordersummaryid, connectapi.orderitemsummaryadjustmentcollectioninput orderitemsummaryadjustmentcollectioninput, string effectiveaccountid) parameters webstoreid type: string id of the webstore. ordersummaryid type: string id of the order summary. orderitemsummaryadjustmentcollectioninput type: connectapi.orderitemsummaryadjustmentcollectioninput collection of order item" "summaries to get adjustments for. effectiveaccountid type: string id of the account for which the request is made. if null, defaults to the account id for the context user. return value type: connectapi.orderitemsummaryadjustmentcollection getordershipmentitems(webstoreid, shipmentid) get order shipment items. 999apex reference guide commercebuyerexperience class api version 52.0 requires chatter no signature public static connectapi.ordershipmentitemcollection getordershipmentitems(string webstoreid, string shipmentid) parameters webstoreid type: string id of the webstore. shipmentid type: string id of the shipment. return value type: connectapi.ordershipmentitemcollection getordershipmentitems(webstoreid, shipmentid, effectiveaccountid) get order shipment items. api version 52.0 requires chatter no signature public static connectapi.ordershipmentitemcollection getordershipmentitems(string webstoreid, string shipmentid, string effectiveaccountid) parameters webstoreid type: string id of the webstore. 1000apex reference guide commercebuyerexperience class shipmentid type: string id of the shipment. effectiveaccountid type: string id of the account for which the request is made. if null, defaults to the account id for the context user. return value type: connectapi.ordershipmentitemcollection getordershipmentitems(webstoreid, shipmentid, effectiveaccountid, fields) get order shipment items with specific fields. api version 52.0 requires chatter no signature public static connectapi.ordershipmentitemcollection getordershipmentitems(string webstoreid, string shipmentid, string effectiveaccountid, list fields) parameters webstoreid type: string id of the webstore. shipmentid type: string id of the shipment. effectiveaccountid type: string id of the account for which the request is made. if null, defaults to the account id for the context user. fields type: list list of up to 15 additional shipment items, order item summary, and product fields to display in the ui in each item row. return value type: connectapi.ordershipmentitemcollection 1001apex reference guide commercebuyerexperience class getordershipmentitems(webstoreid, shipmentid, effectiveaccountid, fields, pagetoken, pagesize) get a page of order shipment items with specific fields. api version 52.0 requires chatter no signature public static connectapi.ordershipmentitemcollection getordershipmentitems(string webstoreid, string shipmentid, string effectiveaccountid, list fields, string pagetoken, integer pagesize) parameters webstoreid type: string id of the webstore. shipmentid type: string id of the shipment. effectiveaccountid type: string id of the account for which the request is made. if null, defaults to the account id for the context user. fields type: list list of up to 15 additional shipment items, order item summary, and product fields to display in the ui in each item row. pagetoken type: string specifies the base64 encoded page token. page tokens are returned as part of the response. if unspecified, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. return value type: connectapi.ordershipmentitemcollection 1002apex reference guide commercebuyerexperience class getordershipmentitems(webstoreid, shipmentid, effectiveaccountid, fields, pagetoken, pagesize, sortorder) get a sorted page of order shipment items. api version 52.0 requires chatter no signature public static connectapi.ordershipmentitemcollection getordershipmentitems(string webstoreid, string shipmentid, string effectiveaccountid, list fields, string pagetoken, integer pagesize, connectapi.ordershipmentitemsort sortorder) parameters webstoreid type: string id of the webstore. shipmentid type: string id of the shipment. effectiveaccountid type: string id of the account for which the request is made. if null, defaults" "to the account id for the context user. fields type: list list of up to 15 additional shipment items, order item summary, and product fields to display in the ui in each item row. pagetoken type: string specifies the base64 encoded page token. page tokens are returned as part of the response. if unspecified, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortorder type: connectapi.ordershipmentitemsort sort order for order shipment items. values are: • idasc—sorts by id in ascending alphanumeric order (a–z, 0–9). • iddesc—sorts by id in descending alphanumeric order (z–a, 9–0). if unspecified, defaults to idasc. 1003apex reference guide commercebuyerexperience class return value type: connectapi.ordershipmentitemcollection getordershipments(webstoreid, ordersummaryid) get order shipments. api version 52.0 requires chatter no signature public static connectapi.ordershipmentcollection getordershipments(string webstoreid, string ordersummaryid) parameters webstoreid type: string id of the webstore. ordersummaryid type: string id of the order summary. return value type: connectapi.ordershipmentcollection getordershipments(webstoreid, ordersummaryid, effectiveaccountid) get order shipments. api version 52.0 requires chatter no signature public static connectapi.ordershipmentcollection getordershipments(string webstoreid, string ordersummaryid, string effectiveaccountid) 1004apex reference guide commercebuyerexperience class parameters webstoreid type: string id of the webstore. ordersummaryid type: string id of the order summary. effectiveaccountid type: string id of the account for which the request is made. if null, defaults to the account id for the context user. return value type: connectapi.ordershipmentcollection getordershipments(webstoreid, ordersummaryid, effectiveaccountid, fields) get order shipments with specific fields. api version 52.0 requires chatter no signature public static connectapi.ordershipmentcollection getordershipments(string webstoreid, string ordersummaryid, string effectiveaccountid, list fields) parameters webstoreid type: string id of the webstore. ordersummaryid type: string id of the order summary. effectiveaccountid type: string id of the account for which the request is made. if null, defaults to the account id for the context user. fields type: list list of up to 15 additional shipment and order delivery method fields to display in the ui in each item row. 1005apex reference guide commercebuyerexperience class return value type: connectapi.ordershipmentcollection getordershipments(webstoreid, ordersummaryid, effectiveaccountid, fields, pagesize, pagetoken) get a page of order shipments with specific fields. api version 52.0 requires chatter no signature public static connectapi.ordershipmentcollection getordershipments(string webstoreid, string ordersummaryid, string effectiveaccountid, list fields, integer pagesize, string pagetoken) parameters webstoreid type: string id of the webstore. ordersummaryid type: string id of the order summary. effectiveaccountid type: string id of the account for which the request is made. if null, defaults to the account id for the context user. fields type: list list of up to 15 additional shipment and order delivery method fields to display in the ui in each item row. pagesize type: integer specifies the number of items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. pagetoken type: string specifies the base64 encoded page token. page tokens are returned as part of the response. if unspecified, the first page is returned. return value type: connectapi.ordershipmentcollection 1006apex reference guide commercebuyerexperience class getordershipments(webstoreid, ordersummaryid, effectiveaccountid, fields, page" "size, pagetoken, sortorder) get a sorted page of order shipments with specific fields. api version 52.0 requires chatter no signature public static connectapi.ordershipmentcollection getordershipments(string webstoreid, string ordersummaryid, string effectiveaccountid, list fields, integer pagesize, string pagetoken, connectapi.ordershipmentsort sortorder) parameters webstoreid type: string id of the webstore. ordersummaryid type: string id of the order summary. effectiveaccountid type: string id of the account for which the request is made. if null, defaults to the account id for the context user. fields type: list list of up to 15 additional shipment and order delivery method fields to display in the ui in each item row. pagesize type: integer specifies the number of items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. pagetoken type: string specifies the base64 encoded page token. page tokens are returned as part of the response. if unspecified, the first page is returned. sortorder type: connectapi.ordershipmentsort sort order for order shipments. values are: • expecteddeliverydateasc—sorts by the oldest expected delivery date. • expecteddeliverydatedesc—sorts by the most recent expected delivery date. • shipmentnumberasc—sorts by shipment number in ascending order (0–9). 1007apex reference guide commercebuyerexperience class • shipmentnumberdesc—sorts by shipment number in descending order (9–0). if unspecified, defaults to shipmentnumberasc. if you’re sorting by expected delivery date, make sure the expected delivery date is populated on your shipment records. a null value isn’t supported and results in an error. return value type: connectapi.ordershipmentcollection getordersummaries(webstoreid) get order summaries. api version 51.0 requires chatter no signature public static connectapi.ordersummarycollectionrepresentation getordersummaries(string webstoreid) parameters webstoreid type: string id of the webstore. return value type: connectapi.ordersummarycollectionrepresentation getordersummaries(webstoreid, effectiveaccountid) get order summaries. api version 51.0 requires chatter no 1008apex reference guide commercebuyerexperience class signature public static connectapi.ordersummarycollectionrepresentation getordersummaries(string webstoreid, string effectiveaccountid) parameters webstoreid type: string id of the webstore. effectiveaccountid type: string id of the account for which the request is made. if null, defaults to the account id for the context user. return value type: connectapi.ordersummarycollectionrepresentation getordersummaries(webstoreid, effectiveaccountid, fields) get order summaries with specific fields. api version 51.0 requires chatter no signature public static connectapi.ordersummarycollectionrepresentation getordersummaries(string webstoreid, string effectiveaccountid, list fields) parameters webstoreid type: string id of the webstore. effectiveaccountid type: string id of the account for which the request is made. if null, defaults to the account id for the context user. fields type: list list of up to 35 additional order summary fields to display in the ui in each item row. these order summary fields are returned regardless of fields specified. 1009apex reference guide commercebuyerexperience class • createddate • ordersummaryid • ordernumber • ordereddate • ownerid • status • totalamount return value type: connectapi.ordersummarycollectionrepresentation getordersummaries(webstoreid, effectiveaccountid, fields, pagesize, pagetoken) get a page of order summaries with specific fields. api version 51.0 requires chatter no signature public static connectapi.ordersummarycollectionrepresentation getordersummaries(string webstoreid, string effectiveaccountid, list fields, integer pagesize, string pagetoken) parameters webstoreid type: string id of the webstore. effectiveaccountid type: string id of the account for which the request" "is made. if null, defaults to the account id for the context user. fields type: list list of up to 35 additional order summary fields to display in the ui in each item row. these order summary fields are returned regardless of fields specified. • createddate • ordersummaryid • ordernumber 1010apex reference guide commercebuyerexperience class • ordereddate • ownerid • status • totalamount pagesize type: integer specifies the number of items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. pagetoken type: string specifies the base64 encoded page token. page tokens are returned as part of the response. if unspecified, the first page is returned. return value type: connectapi.ordersummarycollectionrepresentation getordersummaries(webstoreid, effectiveaccountid, fields, pagesize, pagetoken, sortorder) get a sorted page of order summaries with specific fields. api version 51.0 requires chatter no signature public static connectapi.ordersummarycollectionrepresentation getordersummaries(string webstoreid, string effectiveaccountid, list fields, integer pagesize, string pagetoken, connectapi.ordersummarysortorder sortorder) parameters webstoreid type: string id of the webstore. effectiveaccountid type: string id of the account for which the request is made. if null, defaults to the account id for the context user. fields type: list list of up to 35 additional order summary fields to display in the ui in each item row. these order summary fields are returned regardless of fields specified. 1011apex reference guide commercebuyerexperience class • createddate • ordersummaryid • ordernumber • ordereddate • ownerid • status • totalamount pagesize type: integer specifies the number of items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. pagetoken type: string specifies the base64 encoded page token. page tokens are returned as part of the response. if unspecified, the first page is returned. sortorder type: connectapi.ordersummarysortorder sort order for order summaries. values are: • createddateasc—sorts by the oldest created date. • createddatedesc—sorts by the most recent created date. • ordereddateasc—sorts by the oldest ordered date. • ordereddatedesc—sorts by the most recent ordered date. if unspecified, defaults to ordereddatedesc. if you’re sorting by ordered date, make sure the ordered date is populated on your order summary records. a null value isn’t supported and results in an error. return value type: connectapi.ordersummarycollectionrepresentation getordersummaries(webstoreid, effectiveaccountid, fields, pagesize, pagetoken, sortorder, earliestdate, latestdate) get a sorted page of order summaries with specific fields within a specific date range. api version 51.0 requires chatter no 1012apex reference guide commercebuyerexperience class signature public static connectapi.ordersummarycollectionrepresentation getordersummaries(string webstoreid, string effectiveaccountid, list fields, integer pagesize, string pagetoken, connectapi.ordersummarysortorder sortorder, string earliestdate, string latestdate) parameters webstoreid type: string id of the webstore. effectiveaccountid type: string id of the account for which the request is made. if null, defaults to the account id for the context user. fields type: list list of up to 35 additional order summary fields to display in the ui in each item row. these order summary fields are returned regardless of fields specified. • createddate • ordersummaryid • ordernumber • ordereddate • ownerid • status • totalamount pagesize type: integer specifies the number of items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. pagetoken type: string specifies the base64 encoded page token. page tokens are returned as part of the response. if unspecified, the first page is returned. sortorder type: connectapi.ordersummarysortorder sort order for order summaries. values are: • createddateasc—sorts by the oldest" "created date. • createddatedesc—sorts by the most recent created date. • ordereddateasc—sorts by the oldest ordered date. • ordereddatedesc—sorts by the most recent ordered date. if unspecified, defaults to ordereddatedesc. if you’re sorting by ordered date, make sure the ordered date is populated on your order summary records. a null value isn’t supported and results in an error. 1013apex reference guide commercebuyerexperience class earliestdate type: string oldest created or ordered date, depending on the sortorder value, for order summaries to return. results include any orders on and after this date. expected format is an iso 8601 date string, for example, 2020-02-25t18:24:31.000z. latestdate type: string most recent created or ordered date, depending on the sortorder value, for order summaries to return. results include any orders before this date. expected format is an iso 8601 date string, for example, 2020-02-25t18:24:31.000z. return value type: connectapi.ordersummarycollectionrepresentation getordersummaries(webstoreid, effectiveaccountid, fields, pagesize, pagetoken, sortorder, earliestdate, latestdate, ownerscoped) get a sorted page of order summaries with specific fields within a specific date range and scoped to orders owned by the context user. api version 51.0 requires chatter no signature public static connectapi.ordersummarycollectionrepresentation getordersummaries(string webstoreid, string effectiveaccountid, list fields, integer pagesize, string pagetoken, connectapi.ordersummarysortorder sortorder, string earliestdate, string latestdate, boolean ownerscoped) parameters webstoreid type: string id of the webstore. effectiveaccountid type: string id of the account for which the request is made. if null, defaults to the account id for the context user. fields type: list list of up to 35 additional order summary fields to display in the ui in each item row. these order summary fields are returned regardless of fields specified. • createddate 1014apex reference guide commercebuyerexperience class • ordersummaryid • ordernumber • ordereddate • ownerid • status • totalamount pagesize type: integer specifies the number of items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. pagetoken type: string specifies the base64 encoded page token. page tokens are returned as part of the response. if unspecified, the first page is returned. sortorder type: connectapi.ordersummarysortorder sort order for order summaries. values are: • createddateasc—sorts by the oldest created date. • createddatedesc—sorts by the most recent created date. • ordereddateasc—sorts by the oldest ordered date. • ordereddatedesc—sorts by the most recent ordered date. if unspecified, defaults to ordereddatedesc. if you’re sorting by ordered date, make sure the ordered date is populated on your order summary records. a null value isn’t supported and results in an error. earliestdate type: string oldest created or ordered date, depending on the sortorder value, for order summaries to return. results include any orders on and after this date. expected format is an iso 8601 date string, for example, 2020-02-25t18:24:31.000z. latestdate type: string most recent created or ordered date, depending on the sortorder value, for order summaries to return. results include any orders before this date. expected format is an iso 8601 date string, for example, 2020-02-25t18:24:31.000z. ownerscoped type: boolean specifies whether the results are scoped to orders owned by the context user (true) or to orders owned by and shared with the context user (false). if unspecified, defaults to true. return value type: connectapi.ordersummarycollectionrepresentation 1015apex reference guide commercebuyerexperience class getordersummaries(webstoreid, effectiveaccountid, fields, pagesize, pagetoken, sortorder, earliestdate, latestdate, ownerscoped, includeadjustmentdetails) get a sorted page of order summaries with specific fields within a" "specific date range and scoped to orders owned by the context user. api version 51.0 requires chatter no signature public static connectapi.ordersummarycollectionrepresentation getordersummaries(string webstoreid, string effectiveaccountid, list fields, integer pagesize, string pagetoken, connectapi.ordersummarysortorder sortorder, string earliestdate, string latestdate, boolean ownerscoped, boolean includeadjustmentdetails) parameters webstoreid type: string id of the webstore. effectiveaccountid type: string id of the account for which the request is made. if null, defaults to the account id for the context user. fields type: list list of up to 35 additional order summary fields to display in the ui in each item row. these order summary fields are returned regardless of fields specified. • createddate • ordersummaryid • ordernumber • ordereddate • ownerid • status • totalamount pagesize type: integer specifies the number of items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. pagetoken type: string specifies the base64 encoded page token. page tokens are returned as part of the response. if unspecified, the first page is returned. 1016apex reference guide commercebuyerexperience class sortorder type: connectapi.ordersummarysortorder sort order for order summaries. values are: • createddateasc—sorts by the oldest created date. • createddatedesc—sorts by the most recent created date. • ordereddateasc—sorts by the oldest ordered date. • ordereddatedesc—sorts by the most recent ordered date. if unspecified, defaults to ordereddatedesc. if you’re sorting by ordered date, make sure the ordered date is populated on your order summary records. a null value isn’t supported and results in an error. earliestdate type: string oldest created or ordered date, depending on the sortorder value, for order summaries to return. results include any orders on and after this date. expected format is an iso 8601 date string, for example, 2020-02-25t18:24:31.000z. latestdate type: string most recent created or ordered date, depending on the sortorder value, for order summaries to return. results include any orders before this date. expected format is an iso 8601 date string, for example, 2020-02-25t18:24:31.000z. ownerscoped type: boolean specifies whether the results are scoped to orders owned by the context user (true) or to orders owned by and shared with the context user (false). if unspecified, defaults to true. includeadjustmentdetails type: boolean specifies whether to fetch price adjustment details based on their type (true). if unspecified, defaults to false. return value type: connectapi.ordersummarycollectionrepresentation getordersummary(webstoreid, ordersummaryid, effectiveaccountid) get an order summary. api version 55.0 requires chatter no 1017apex reference guide commercebuyerexperience class signature public static connectapi.ordersummaryrepresentation getordersummary(string webstoreid, string ordersummaryid, string effectiveaccountid) parameters webstoreid type: string id of the webstore. ordersummaryid type: string id of the order summary. effectiveaccountid type: string id of the account for which the request is made. if null, defaults to the account id for the context user. return value type: connectapi.ordersummaryrepresentation getordersummary(webstoreid, ordersummaryid, effectiveaccountid, fields) get an order summary with fields. api version 55.0 requires chatter no signature public static connectapi.ordersummaryrepresentation getordersummary(string webstoreid, string ordersummaryid, string effectiveaccountid, list fields) parameters webstoreid type: string id of the webstore. ordersummaryid type: string id of the order summary. effectiveaccountid type: string 1018apex reference guide commercebuyerexperience class id of the account for which the request is made. if null, defaults to the account id for the context user. fields type: list list of up to 35 additional order summary fields to display in the ui in each item row" ". these order summary fields are returned regardless of fields specified. • createddate • ordersummaryid • ordernumber • ordereddate • ownerid • status • totalamount return value type: connectapi.ordersummaryrepresentation getordersummary(webstoreid, ordersummaryid, effectiveaccountid, fields, includeadjustmentdetails) get an order summary with fields and include adjustment details. api version 55.0 requires chatter no signature public static connectapi.ordersummaryrepresentation getordersummary(string webstoreid, string ordersummaryid, string effectiveaccountid, list fields, boolean includeadjustmentdetails) parameters webstoreid type: string id of the webstore. ordersummaryid type: string id of the order summary. effectiveaccountid type: string 1019apex reference guide commercebuyerexperience class id of the account for which the request is made. if null, defaults to the account id for the context user. fields type: list list of up to 35 additional order summary fields to display in the ui in each item row. these order summary fields are returned regardless of fields specified. • createddate • ordersummaryid • ordernumber • ordereddate • ownerid • status • totalamount includeadjustmentdetails type: boolean specifies whether to return adjustment details (true) or not (false).if unspecified, the default value is false. return value type: connectapi.ordersummaryrepresentation getordersummaryadjustments(webstoreid, ordersummaryid) get adjustments for an order summary. api version 53.0 requires chatter no signature public static connectapi.ordersummaryadjustmentcollection getordersummaryadjustments(string webstoreid, string ordersummaryid) parameters webstoreid type: string id of the webstore. ordersummaryid type: string id of the order summary. 1020apex reference guide commercebuyerexperience class return value type: connectapi.ordersummaryadjustmentcollection getordersummaryadjustments(webstoreid, ordersummaryid, effectiveaccountid) get adjustments for an order summary. api version 53.0 requires chatter no signature public static connectapi.ordersummaryadjustmentcollection getordersummaryadjustments(string webstoreid, string ordersummaryid, string effectiveaccountid) parameters webstoreid type: string id of the webstore. ordersummaryid type: string id of the order summary. effectiveaccountid type: string id of the account for which the request is made. if null, defaults to the account id for the context user. return value type: connectapi.ordersummaryadjustmentcollection updatecommerceaccountaddress(webstoreid, accountid, addressid, addressinput) update a commerce account address for a webstore. api version 54.0 requires chatter no 1021apex reference guide commercecart class signature public static connectapi.commerceaddressoutput updatecommerceaccountaddress(string webstoreid, string accountid, string addressid, connectapi.commerceaddressinput addressinput) parameters webstoreid type: string id of the webstore. accountid type: string id of the account. addressid type: string id of the address. addressinput type: connectapi.commerceaddressinput information about the address fields you want to update. return value type: connectapi.commerceaddressoutput commercecart class get, create, update, and delete carts. get cart items, add items to carts, update and delete cart items. namespace connectapi commercecart methods these methods are for commercecart. all methods are static. in this section: additemtocart(webstoreid, effectiveaccountid, activecartorid, cartiteminput, currencyisocode) add an item to a cart of a specific currency. additemstocart(webstoreid, effectiveaccountid, activecartorid, cartitems) add a batch of up to 100 items to a cart. additemstocart(webstoreid, effectiveaccountid, activecartorid, cartitems, currencyisocode) add a batch of up to 100 items to a cart of a specific currency. 1022apex reference guide commercecart class additemtocart(webstoreid, effectiveaccountid, activecartorid, cartiteminput) add an item to" "a cart. applycartcoupon(webstoreid, effectiveaccountid, activecartorid, cartcouponinput) apply a coupon to a cart. applycartcoupon(webstoreid, effectiveaccountid, activecartorid, cartcouponinput, currencyisocode) apply a coupon to a cart. copycarttowishlist(webstoreid, effectiveaccountid, activecartorid, carttowishlistinput) copy the products from a cart to a wishlist. createcart(webstoreid, cart) create a cart. deletecart(webstoreid, effectiveaccountid, activecartorid) delete a cart. deletecartcoupon(webstoreid, effectiveaccountid, activecartorid, cartcouponid) delete a coupon from a cart. deletecartcoupon(webstoreid, effectiveaccountid, activecartorid, cartcouponid, currencyisocode) delete a coupon from a cart. deletecartitem(webstoreid, effectiveaccountid, activecartorid, cartitemid) delete an item from a cart. deleteinventoryreservation(webstoreid, activecartorid, effectiveaccountid) (developer preview) delete an inventory reservation. getcartcoupons(webstoreid, effectiveaccountid, activecartorid) get coupons for a cart. getcartcoupons(webstoreid, effectiveaccountid, activecartorid, currencyisocode) get coupons for a cart. getcartitempromotion(webstoreid, effectiveaccountid, activecartorid, cartitempromotioncollectioninput) get promotions for a cart item. getcartitempromotion(webstoreid, effectiveaccountid, activecartorid, cartitempromotioncollectioninput, currencyisocode) get a promotion for a cart item. getcartitems(webstoreid, effectiveaccountid, activecartorid) get items in a cart. getcartitems(webstoreid, effectiveaccountid, activecartorid, pageparam) get a page of items in a cart. getcartitems(webstoreid, effectiveaccountid, activecartorid, pageparam, sortparam) get a sorted page of items in a cart. getcartitems(webstoreid, effectiveaccountid, activecartorid, pageparam, pagesize) get a specified size page of items in a cart. getcartitems(webstoreid, effectiveaccountid, activecartorid, pageparam, pagesize, sortparam) get a specified size, sorted page of items in a cart. getcartitems(webstoreid, effectiveaccountid, activecartorid, productfields, pageparam, pagesize, sortparam) get a specified size, sorted page of items filtered by product fields in a cart. 1023apex reference guide commercecart class getcartitems(webstoreid, effectiveaccountid, activecartorid, productfields, pageparam, pagesize, sortparam, currencyisocode) get a specified size, sorted page of items filtered by product fields in a cart. getcartpromotions(webstoreid, effectiveaccountid, activecartorid) get promotions for a cart. getcartpromotions(webstoreid, effectiveaccountid, activecartorid, currencyisocode) get promotions for a cart in a specific currency. getcartsummary(webstoreid, effectiveaccountid, activecartorid) get a cart. getcartsummary(webstoreid, effectiveaccountid, activecartorid, currencyisocode) get a cart in a specific currency. getorcreateactivecartsummary(webstoreid, effectiveaccountid, activecartorid) get a cart or create an active cart if one doesn’t exist. getorcreateactivecartsummary(webstoreid, effectiveaccountid, activecartorid, currencyisocode) get a cart in a specific currency, or create an active cart if one doesn’t exist. makecartprimary(webstoreid, activecartorid, effectiveaccountid) make a secondary cart a primary cart. setcartmessagesvisibility(webstoreid, activecartorid, effectiveaccountid, messagevisibility) set the visibility for cart messages. updatecartitem(webstoreid, effectiveaccountid, activecartorid, cartitemid, cartitem) update an item in a cart. updatecartitem(webstoreid, effectiveaccountid, activecartorid, cartitemid, cartitem, currencyi" "socode) update an item in a cart of a specific currency. upsertinventoryreservation(webstoreid, activecartorid, effectiveaccountid, cartinventoryreservationinput) (developer preview) create or update an inventory reservation. additemtocart(webstoreid, effectiveaccountid, activecartorid, cartiteminput, currencyisocode) add an item to a cart of a specific currency. api version 57.0 available to guest users 57.0 requires chatter no 1024apex reference guide commercecart class signature public static connectapi.cartitem additemtocart(string webstoreid, string effectiveaccountid, string activecartorid, connectapi.cartiteminput cartiteminput, string currencyisocode) parameters webstoreid type: string id of the webstore. effectiveaccountid type: string id of the buyer account or guest buyer profile for which the request is made. if null, the default value is determined from context. activecartorid type: string id of the cart, active, or current. the current value indicates a cart with a status that isn’t closed or pendingdelete. cartiteminput type: connectapi.cartiteminput a connectapi.cartiteminput object representing an item to add to the cart. currencyisocode type: string the currency iso code of the cart. return value type: connectapi.cartitem usage buyers with read access to carts can add, update, and delete items in carts. this method respects buyer view product entitlements and only users entitled to view product data can access it. additemstocart(webstoreid, effectiveaccountid, activecartorid, cartitems) add a batch of up to 100 items to a cart. api version 49.0 available to guest users 54.0 1025apex reference guide commercecart class requires chatter no signature public static connectapi.batchresult[] additemstocart(string webstoreid, string effectiveaccountid, string activecartorid, list cartitems) parameters webstoreid type: string id of the webstore. effectiveaccountid type: string id of the buyer account or guest buyer profile for which the request is made. if null, the default value is determined from context. activecartorid type: string id of the cart, active, or current. the current value is available in version 50.0 and later and indicates a cart with a status that isn’t closed or pendingdelete. cartitems type: list the list can contain up to 100 connectapi.batchinput objects. in the connectapi.batchinput constructor, the input object must be connectapi.cartiteminput. return value type: connectapi.batchresult[] the connectapi.batchresult.getresult() method returns a connectapi.cartitem object. the returned objects correspond to each of the input objects and are returned in the same order as the input objects. the method call fails only if an error occurs that affects the entire operation (such as a parsing failure). if an individual object causes an error, the error is embedded within the connectapi.batchresult list. usage buyers with read access to carts can add, update, and delete items in carts. this method respects buyer view product entitlements and only users entitled to view product data can access it. additemstocart(webstoreid, effectiveaccountid, activecartorid, cartitems, currencyisocode) add a batch of up to 100 items to a cart of a specific currency. api version 57.0 1026apex reference guide commercecart class available to guest users 57.0 requires chatter no signature public static connectapi.batchresult[] additemstocart(string webstoreid, string effectiveaccountid, string activecartorid, list cartitems, string currencyisocode) parameters webstoreid type: string id of the webstore. effectiveaccountid type: string id of the buyer account or guest buyer profile for which the request is made. if null, the default value is determined from context. activecartorid type: string id of the cart, active, or current. the current value is available in version 50.0 and later and indicates" "a cart with a status that isn’t closed or pendingdelete. cartitems type: list the list can contain up to 100 connectapi.batchinput objects. in the connectapi.batchinput constructor, the input object must be connectapi.cartiteminput. currencyisocode type: string the currency iso code of the cart. return value type: connectapi.batchresult[] the connectapi.batchresult.getresult() method returns a connectapi.cartitem object. the returned objects correspond to each of the input objects and are returned in the same order as the input objects. the method call fails only if an error occurs that affects the entire operation (such as a parsing failure). if an individual object causes an error, the error is embedded within the connectapi.batchresult list. usage buyers with read access to carts can add, update, and delete items in carts. this method respects buyer view product entitlements and only users entitled to view product data can access it. 1027apex reference guide commercecart class additemtocart(webstoreid, effectiveaccountid, activecartorid, cartiteminput) add an item to a cart. api version 49.0 available to guest users 54.0 requires chatter no signature public static connectapi.cartitem additemtocart(string webstoreid, string effectiveaccountid, string activecartorid, connectapi.cartiteminput cartiteminput) parameters webstoreid type: string id of the webstore. effectiveaccountid type: string id of the buyer account or guest buyer profile for which the request is made. if null, the default value is determined from context. activecartorid type: string id of the cart, active, or current. the current value is available in version 50.0 and later and indicates a cart with a status that isn’t closed or pendingdelete. cartiteminput type: connectapi.cartiteminput a connectapi.cartiteminput object representing an item to add to the cart. return value type: connectapi.cartitem usage buyers with read access to carts can add, update, and delete items in carts. this method respects buyer view product entitlements and only users entitled to view product data can access it. 1028apex reference guide commercecart class applycartcoupon(webstoreid, effectiveaccountid, activecartorid, cartcouponinput) apply a coupon to a cart. api version 54.0 available to guest users 57.0 requires chatter no signature public static connectapi.cartcouponcollection applycartcoupon(string webstoreid, string effectiveaccountid, string activecartorid, connectapi.cartcouponinput cartcouponinput) parameters webstoreid type: string id of the webstore. effectiveaccountid type: string id of the buyer account or guest buyer profile for which the request is made. if null, the default value is determined from context. activecartorid type: string id of the cart, active, or current. the current value is available in version 50.0 and later and indicates a cart with a status that isn’t closed or pendingdelete. cartcouponinput type: connectapi.cartcouponinput coupon code for the coupon. return value type: connectapi.cartcouponcollection applycartcoupon(webstoreid, effectiveaccountid, activecartorid, cartcouponinput, currencyisocode) apply a coupon to a cart. 1029apex reference guide commercecart class api version 57.0 available to guest users 57.0 requires chatter no signature public static connectapi.cartcouponcollection applycartcoupon(string webstoreid, string effectiveaccountid, string activecartorid, connectapi.cartcouponinput cartcouponinput, string currencyisocode) parameters webstoreid type: string id of the webstore. effectiveaccountid type: string id of the buyer account or guest buyer profile for which the request is made. if null, the default value is determined from context. activecartorid type: string id of the cart, active, or current. the current value indicates a cart with a status that isn’" "t closed or pendingdelete. cartcouponinput type: connectapi.cartcouponinput coupon code for the coupon. currencyisocode type: string currency iso code of the cart. return value type: connectapi.cartcouponcollection copycarttowishlist(webstoreid, effectiveaccountid, activecartorid, carttowishlistinput) copy the products from a cart to a wishlist. api version 50.0 1030apex reference guide commercecart class available to guest users 54.0 requires chatter no signature public static connectapi.carttowishlistresult copycarttowishlist(string webstoreid, string effectiveaccountid, string activecartorid, connectapi.carttowishlistinput carttowishlistinput) parameters webstoreid type: string id of the webstore. effectiveaccountid type: string id of the buyer account or guest buyer profile for which the request is made. if null, the default value is determined from context. activecartorid type: string id of the cart, active, or current. the current value is available in version 50.0 and later and indicates a cart with a status that isn’t closed or pendingdelete. carttowishlistinput type: connectapi.carttowishlistinput a connectapi.carttowishlistinput object indicating the wishlist to copy products to. return value type: connectapi.carttowishlistresult createcart(webstoreid, cart) create a cart. api version 49.0 available to guest users 54.0 requires chatter no 1031apex reference guide commercecart class signature public static connectapi.cartsummary createcart(string webstoreid, connectapi.cartinput cart) parameters webstoreid type: string id of the webstore. cart type: connectapi.cartinput a connectapi.cartinput object representing a cart. return value type: connectapi.cartsummary usage buyers with read access to carts can create and delete carts. deletecart(webstoreid, effectiveaccountid, activecartorid) delete a cart. api version 49.0 available to guest users 54.0 requires chatter no signature public static void deletecart(string webstoreid, string effectiveaccountid, string activecartorid) parameters webstoreid type: string id of the webstore. 1032" "apex reference guide commercecart class effectiveaccountid type: string id of the buyer account or guest buyer profile for which the request is made. if null, the default value is determined from context. activecartorid type: string id of the cart, active, or current. the current value is available in version 50.0 and later and indicates a cart with a status that isn’t closed or pendingdelete. return value type: void usage buyers with read access to carts can create and delete carts. deletecartcoupon(webstoreid, effectiveaccountid, activecartorid, cartcouponid) delete a coupon from a cart. api version 54.0 available to guest users 57.0 requires chatter no signature public static void deletecartcoupon(string webstoreid, string effectiveaccountid, string activecartorid, string cartcouponid) parameters webstoreid type: string id of the webstore. effectiveaccountid type: string id of the buyer account or guest buyer profile for which the request is made. if null, the default value is determined from context. activecartorid type: string 1033apex reference guide commercecart class id of the cart, active, or current. the current value is available in version 50.0 and later and indicates a cart with a status that isn’t closed or pendingdelete. cartcouponid type: string id of the cart coupon. return value type: void deletecartcoupon(webstoreid, effectiveaccountid, activecartorid, cartcouponid, currencyisocode) delete a coupon from a cart. api version 57.0 available to guest users 57.0 requires chatter no signature public static void deletecartcoupon(string webstoreid, string effectiveaccountid, string activecartorid, string cartcouponid, string currencyisocode) parameters webstoreid type: string id of the webstore. effectiveaccountid type: string id of the buyer account or guest buyer profile for which the request is made. if null, the default value is determined from context. activecartorid type: string id of the cart, active, or current. the current value indicates a cart with a status that isn’t closed or pendingdelete. cartcouponid type: string id of the cart coupon. 1034apex reference guide commercecart class currencyisocode type: string currency iso code of the cart. return value type: void deletecartitem(webstoreid, effectiveaccountid, activecartorid, cartitemid) delete an item from a cart. api version 49.0 available to guest users 54.0 requires chatter no signature public static void deletecartitem(string webstoreid, string effectiveaccountid, string activecartorid, string cartitemid) parameters webstoreid type: string id of the webstore. effectiveaccountid type: string id of the buyer account or guest buyer profile for which the request is made. if null, the default value is determined from context. activecartorid type: string id of the cart, active, or current. the current value is available in version 50.0 and later and indicates a cart with a status that isn’t closed or pendingdelete. cartitemid type: string id of the cart item. 1035apex reference guide commercecart class return value type: void usage buyers with read access to carts can add, update, and delete items in carts. deleteinventoryreservation(webstoreid, activecartorid, effectiveaccountid) (developer preview) delete an inventory reservation. note: this feature is available as a developer preview. it isn’t generally available unless or until salesforce announces its general availability in documentation or in press releases or public statements. all commands, parameters, and other features are subject to change or deprecation at any time, with or without notice. api version 58.0 available to guest users 58.0 requires chatter no signature public static void deleteinventoryreservation(string webstoreid, string activecartorid, string effectiveaccountid) parameters webstoreid type: string id of the webstore. activecartorid type: string id of the cart, active, or" "current. the current value indicates a cart with a status that isn’t closed or pendingdelete. effectiveaccountid type: string id of the buyer account or guest buyer profile for which the request is made. if null, the default value is determined from context. return value type: void 1036apex reference guide commercecart class getcartcoupons(webstoreid, effectiveaccountid, activecartorid) get coupons for a cart. api version 54.0 available to guest users 57.0 requires chatter no signature public static connectapi.cartcouponcollection getcartcoupons(string webstoreid, string effectiveaccountid, string activecartorid) parameters webstoreid type: string id of the webstore. effectiveaccountid type: string id of the buyer account or guest buyer profile for which the request is made. if null, the default value is determined from context. activecartorid type: string id of the cart, active, or current. the current value is available in version 50.0 and later and indicates a cart with a status that isn’t closed or pendingdelete. return value type: connectapi.cartcouponcollection getcartcoupons(webstoreid, effectiveaccountid, activecartorid, currencyisocode) get coupons for a cart. api version 57.0 1037apex reference guide commercecart class available to guest users 57.0 requires chatter no signature public static connectapi.cartcouponcollection getcartcoupons(string webstoreid, string effectiveaccountid, string activecartorid, string currencyisocode) parameters webstoreid type: string id of the webstore. effectiveaccountid type: string id of the buyer account or guest buyer profile for which the request is made. if null, the default value is determined from context. activecartorid type: string id of the cart, active, or current. the current value indicates a cart with a status that isn’t closed or pendingdelete. return value type: connectapi.cartcouponcollection getcartitempromotion(webstoreid, effectiveaccountid, activecartorid, cartitempromotioncollectioninput) get promotions for a cart item. api version 52.0 available to guest users 57.0 requires chatter no 1038apex reference guide commercecart class signature public static connectapi.cartitempromotioncollectionoutputrepresentation getcartitempromotion(string webstoreid, string effectiveaccountid, string activecartorid, connectapi.cartitempromotioncollectioninputrepresentation cartitempromotioncollectioninput) parameters webstoreid type: string id of the webstore. effectiveaccountid type: string id of the buyer account or guest buyer profile for which the request is made. if null, the default value is determined from context. activecartorid type: string id of the cart, active, or current. the current value indicates a cart with a status that isn’t closed or pendingdelete. cartitempromotioncollectioninput type: connectapi.cartitempromotioncollectioninputrepresentation promotions for a cart item. return value type: connectapi.cartitempromotioncollectionoutputrepresentation getcartitempromotion(webstoreid, effectiveaccountid, activecartorid, cartitempromotioncollectioninput, currencyisocode) get a promotion for a cart item. api version 57.0 available to guest users 57.0 requires chatter no signature public static connectapi.cartitempromotioncollectionoutputrepresentation getcartitempromotion(string webstoreid, string effectiveaccountid, string activecartorid, 1039apex reference guide commercecart class connectapi.cartitempromotioncollectioninputrepresentation cartitempromotioncollectioninput, string currencyisocode) parameters webstoreid type: string id of the webstore. effectiveaccountid type: string id of the buyer account or guest buyer profile for which the request is made. if null, the default value is determined from context. activecartorid type: string id of the cart, active, or current. the current value indicates a cart with a status that isn’t closed or pendingdelete. cartitempromotioncollectioninput type: connectapi.cartitempromotioncollectioninput" "representation promotions for a cart item. currencyisocode type: string currency iso code of the cart. return value type: connectapi.cartitempromotioncollectionoutputrepresentation getcartitems(webstoreid, effectiveaccountid, activecartorid) get items in a cart. api version 49.0 available to guest users 54.0 requires chatter no signature public static connectapi.cartitemcollection getcartitems(string webstoreid, string effectiveaccountid, string activecartorid) 1040apex reference guide commercecart class parameters webstoreid type: string id of the webstore. effectiveaccountid type: string id of the buyer account or guest buyer profile for which the request is made. if null, the default value is determined from context. activecartorid type: string id of the cart, active, or current. the current value is available in version 50.0 and later and indicates a cart with a status that isn’t closed or pendingdelete. return value type: connectapi.cartitemcollection getcartitems(webstoreid, effectiveaccountid, activecartorid, pageparam) get a page of items in a cart. api version 49.0 available to guest users 54.0 requires chatter no signature public static connectapi.cartitemcollection getcartitems(string webstoreid, string effectiveaccountid, string activecartorid, string pageparam) parameters webstoreid type: string id of the webstore. effectiveaccountid type: string id of the buyer account or guest buyer profile for which the request is made. if null, the default value is determined from context. activecartorid type: string 1041apex reference guide commercecart class id of the cart, active, or current. the current value is available in version 50.0 and later and indicates a cart with a status that isn’t closed or pendingdelete. pageparam type: string specifies the page token to use to view a page of information. page tokens are returned as part of the response class, such as currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. return value type: connectapi.cartitemcollection getcartitems(webstoreid, effectiveaccountid, activecartorid, pageparam, sortparam) get a sorted page of items in a cart. api version 49.0 available to guest users 54.0 requires chatter no signature public static connectapi.cartitemcollection getcartitems(string webstoreid, string effectiveaccountid, string activecartorid, string pageparam, connectapi.cartitemsortorder sortparam) parameters webstoreid type: string id of the webstore. effectiveaccountid type: string id of the buyer account or guest buyer profile for which the request is made. if null, the default value is determined from context. activecartorid type: string id of the cart, active, or current. the current value is available in version 50.0 and later and indicates a cart with a status that isn’t closed or pendingdelete. 1042apex reference guide commercecart class pageparam type: string specifies the page token to use to view a page of information. page tokens are returned as part of the response class, such as currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. sortparam type: connectapi.cartitemsortorder sort order for items in a cart. values are: • createddateasc—sorts by oldest creation date. • createddatedesc—sorts by most recent creation date. • nameasc—sorts by name in ascending alphabetical order (a–z). • namedesc—sorts by name in descending alphabetical order (z–a). • salespriceasc—sorts from lowest to highest negotiated price. • salespricedesc—sorts from highest to lowest negotiated price. if null, the default is createddatedesc. return value type: connectapi.cartitemcollection getcartitems(webstoreid, effectiveaccountid, activecartorid, pageparam, pagesize) get a specified size page of items in a cart. api version 49.0 available to guest users 54.0 requires chatter no signature public static connectapi.cart" "itemcollection getcartitems(string webstoreid, string effectiveaccountid, string activecartorid, string pageparam, integer pagesize) parameters webstoreid type: string id of the webstore. 1043apex reference guide commercecart class effectiveaccountid type: string id of the buyer account or guest buyer profile for which the request is made. if null, the default value is determined from context. activecartorid type: string id of the cart, active, or current. the current value is available in version 50.0 and later and indicates a cart with a status that isn’t closed or pendingdelete. pageparam type: string specifies the page token to use to view a page of information. page tokens are returned as part of the response class, such as currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. return value type: connectapi.cartitemcollection getcartitems(webstoreid, effectiveaccountid, activecartorid, pageparam, pagesize, sortparam) get a specified size, sorted page of items in a cart. api version 49.0 available to guest users 54.0 requires chatter no signature public static connectapi.cartitemcollection getcartitems(string webstoreid, string effectiveaccountid, string activecartorid, string pageparam, integer pagesize, connectapi.cartitemsortorder sortparam) parameters webstoreid type: string id of the webstore. 1044apex reference guide commercecart class effectiveaccountid type: string id of the buyer account or guest buyer profile for which the request is made. if null, the default value is determined from context. activecartorid type: string id of the cart, active, or current. the current value is available in version 50.0 and later and indicates a cart with a status that isn’t closed or pendingdelete. pageparam type: string specifies the page token to use to view a page of information. page tokens are returned as part of the response class, such as currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.cartitemsortorder sort order for items in a cart. values are: • createddateasc—sorts by oldest creation date. • createddatedesc—sorts by most recent creation date. • nameasc—sorts by name in ascending alphabetical order (a–z). • namedesc—sorts by name in descending alphabetical order (z–a). • salespriceasc—sorts from lowest to highest negotiated price. • salespricedesc—sorts from highest to lowest negotiated price. if null, the default is createddatedesc. return value type: connectapi.cartitemcollection getcartitems(webstoreid, effectiveaccountid, activecartorid, productfields, pageparam, pagesize, sortparam) get a specified size, sorted page of items filtered by product fields in a cart. api version 49.0 available to guest users 54.0 1045apex reference guide commercecart class requires chatter no signature public static connectapi.cartitemcollection getcartitems(string webstoreid, string effectiveaccountid, string activecartorid, string productfields, string pageparam, integer pagesize, connectapi.cartitemsortorder sortparam) parameters webstoreid type: string id of the webstore. effectiveaccountid type: string id of the buyer account or guest buyer profile for which the request is made. if null, the default value is determined from context. activecartorid type: string id of the cart, active, or current. the current value is available in version 50.0 and later and indicates a cart with a status that isn’t closed or pendingdelete. productfields type: string comma-separated list of up to five product fields. results include fields that you have access to. some product fields (such as productname and sku) are returned even when not included in the productfields" "parameter. pageparam type: string specifies the page token to use to view a page of information. page tokens are returned as part of the response class, such as currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.cartitemsortorder sort order for items in a cart. values are: • createddateasc—sorts by oldest creation date. • createddatedesc—sorts by most recent creation date. • nameasc—sorts by name in ascending alphabetical order (a–z). • namedesc—sorts by name in descending alphabetical order (z–a). • salespriceasc—sorts from lowest to highest negotiated price. • salespricedesc—sorts from highest to lowest negotiated price. if null, the default is createddatedesc. 1046apex reference guide commercecart class return value type: connectapi.cartitemcollection getcartitems(webstoreid, effectiveaccountid, activecartorid, productfields, pageparam, pagesize, sortparam, currencyisocode) get a specified size, sorted page of items filtered by product fields in a cart. api version 57.0 available to guest users 57.0 requires chatter no signature public static connectapi.cartitemcollection getcartitems(string webstoreid, string effectiveaccountid, string activecartorid, string productfields, string pageparam, integer pagesize, connectapi.cartitemsortorder sortparam, string currencyisocode) parameters webstoreid type: string id of the webstore. effectiveaccountid type: string id of the buyer account or guest buyer profile for which the request is made. if null, the default value is determined from context. activecartorid type: string id of the cart, active, or current. the current value is available in version 50.0 and later and indicates a cart with a status that isn’t closed or pendingdelete. productfields type: string comma-separated list of up to five product fields. results include fields that you have access to. some product fields (such as productname and sku) are returned even when not included in the productfields parameter. pageparam type: string specifies the page token to use to view a page of information. page tokens are returned as part of the response class, such as currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. 1047apex reference guide commercecart class pagesize type: integer specifies the number of items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. currencyisocode type: string currency iso code of the cart. return value type: connectapi.cartitemcollection getcartpromotions(webstoreid, effectiveaccountid, activecartorid) get promotions for a cart. api version 53.0 available to guest users 57.0 requires chatter no signature public static connectapi.cartpromotioncollection getcartpromotions(string webstoreid, string effectiveaccountid, string activecartorid) parameters webstoreid type: string id of the webstore. effectiveaccountid type: string id of the buyer account or guest buyer profile for which the request is made. if null, the default value is determined from context. activecartorid type: string id of the cart, active, or current. the current value indicates a cart with a status that isn’t closed or pendingdelete. return value type: connectapi.cartpromotioncollection 1048apex reference guide commercecart class getcartpromotions(webstoreid, effectiveaccountid, activecartorid, currencyisocode) get promotions for a cart in a specific currency. api version 57.0 available to guest users 57.0 requires chatter no signature public static connectapi.cartpromotioncollection getcartpromotions(string webstoreid, string effectiveaccountid, string activecartorid, string currencyisocode) parameters webstoreid type: string id of the webstore. effectiveaccountid type: string id of the buyer account or guest" "buyer profile for which the request is made. if null, the default value is determined from context. activecartorid type: string id of the cart, active, or current. the current value indicates a cart with a status that isn’t closed or pendingdelete. currencyisocode type: string currency iso code of the cart. return value type: connectapi.cartpromotioncollection getcartsummary(webstoreid, effectiveaccountid, activecartorid) get a cart. api version 49.0 1049apex reference guide commercecart class available to guest users 54.0 requires chatter no signature public static connectapi.cartsummary getcartsummary(string webstoreid, string effectiveaccountid, string activecartorid) parameters webstoreid type: string id of the webstore. effectiveaccountid type: string id of the buyer account or guest buyer profile for which the request is made. if null, the default value is determined from context. activecartorid type: string id of the cart, active, or current. the current value is available in version 50.0 and later and indicates a cart with a status that isn’t closed or pendingdelete. if you specify active and there isn’t an active cart, you get an error. return value type: connectapi.cartsummary getcartsummary(webstoreid, effectiveaccountid, activecartorid, currencyisocode) get a cart in a specific currency. api version 57.0 available to guest users 57.0 requires chatter no 1050apex reference guide commercecart class signature public static connectapi.cartsummary getcartsummary(string webstoreid, string effectiveaccountid, string activecartorid, string currencyisocode) parameters webstoreid type: string id of the webstore. effectiveaccountid type: string id of the buyer account or guest buyer profile for which the request is made. if null, the default value is determined from context. activecartorid type: string id of the cart, active, or current. the current value is available in version 50.0 and later and indicates a cart with a status that isn’t closed or pendingdelete. if you specify active and there isn’t an active cart, you get an error. currencyisocode type: string currency iso code of the cart. return value type: connectapi.cartsummary getorcreateactivecartsummary(webstoreid, effectiveaccountid, activecartorid) get a cart or create an active cart if one doesn’t exist. api version 49.0 available to guest users 54.0 requires chatter no signature public static connectapi.cartsummary getorcreateactivecartsummary(string webstoreid, string effectiveaccountid, string activecartorid) 1051apex reference guide commercecart class parameters webstoreid type: string id of the webstore. effectiveaccountid type: string id of the buyer account or guest buyer profile for which the request is made. if null, the default value is determined from context. activecartorid type: string id of the cart, active, or current. the current value is available in version 50.0 and later and indicates a cart with a status that isn’t closed or pendingdelete. if you specify active and there isn’t an active cart, one is created. return value type: connectapi.cartsummary usage buyers with read access to carts can create and delete carts. getorcreateactivecartsummary(webstoreid, effectiveaccountid, activecartorid, currencyisocode) get a cart in a specific currency, or create an active cart if one doesn’t exist. api version 57.0 available to guest users 57.0 requires chatter no signature public static connectapi.cartsummary getorcreateactivecartsummary(string webstoreid, string effectiveaccountid, string activecartorid, string currencyisocode) parameters webstoreid type: string id of the webstore. 1052apex reference guide commercecart class effectiveaccountid type: string id of the buyer account or guest buyer profile for which the request is made. if null, the default value is determined from context. activecartorid type: string id of the cart, active, or current." "the current value is available in version 50.0 and later and indicates a cart with a status that isn’t closed or pendingdelete. if you specify active and there isn’t an active cart, one is created. currencyisocode type: string currency iso code of the cart. return value type: connectapi.cartsummary usage buyers with read access to carts can create and delete carts. makecartprimary(webstoreid, activecartorid, effectiveaccountid) make a secondary cart a primary cart. api version 53.0 available to guest users 56.0 requires chatter yes signature public static connectapi.commerceactionresult makecartprimary(string webstoreid, string activecartorid, string effectiveaccountid) parameters webstoreid type: string id of the webstore. activecartorid type: string 1053apex reference guide commercecart class id of the cart, active, or current. the current value is available in version 50.0 and later and indicates a cart with a status that isn’t closed or pendingdelete. effectiveaccountid type: string id of the buyer account or guest buyer profile for which the request is made. if null, the default value is determined from context. return value type: connectapi.commerceactionresult setcartmessagesvisibility(webstoreid, activecartorid, effectiveaccountid, messagevisibility) set the visibility for cart messages. api version 50.0 available to guest users 54.0 requires chatter no signature public static connectapi.cartmessagesvisibilityresult setcartmessagesvisibility(string webstoreid, string activecartorid, string effectiveaccountid, connectapi.cartmessagesvisibilityinput messagevisibility) parameters webstoreid type: string id of the webstore. activecartorid type: string id of the cart, active, or current. the current value is available in version 50.0 and later and indicates a cart with a status that isn’t closed or pendingdelete. effectiveaccountid type: string id of the buyer account or guest buyer profile for which the request is made. if null, the default value is determined from context. messagevisibility type: connectapi.cartmessagesvisibilityinput 1054apex reference guide commercecart class a connectapi.cartmessagesvisibilityinput object specifying the visibility setting. return value type: connectapi.cartmessagesvisibilityresult updatecartitem(webstoreid, effectiveaccountid, activecartorid, cartitemid, cartitem) update an item in a cart. api version 49.0 available to guest users 54.0 requires chatter no signature public static connectapi.cartitem updatecartitem(string webstoreid, string effectiveaccountid, string activecartorid, string cartitemid, connectapi.cartiteminput cartitem) parameters webstoreid type: string id of the webstore. effectiveaccountid type: string id of the buyer account or guest buyer profile for which the request is made. if null, the default value is determined from context. activecartorid type: string id of the cart, active, or current. the current value is available in version 50.0 and later and indicates a cart with a status that isn’t closed or pendingdelete. cartitemid type: string id of the cart item. cartitem type: connectapi.cartiteminput a connectapi.cartiteminput object representing a cart item to update. 1055apex reference guide commercecart class return value type: connectapi.cartitem usage buyers with read access to carts can add, update, and delete items in carts. this method respects buyer view product entitlements and only users entitled to view product data can access it. updatecartitem(webstoreid, effectiveaccountid, activecartorid, cartitemid, cartitem, currencyisocode) update an item in a cart of a specific currency. api version 57.0 available to guest users 57.0 requires chatter no signature public static connectapi.cartitem updatecartitem(string webstoreid, string effectiveaccountid, string activecartorid, string cartitemid, connectapi.cartiteminput cartitem, string currencyisocode) parameters webstore" "id type: string id of the webstore. effectiveaccountid type: string id of the buyer account or guest buyer profile for which the request is made. if null, the default value is determined from context. activecartorid type: string id of the cart, active, or current. the current value is available in version 50.0 and later and indicates a cart with a status that isn’t closed or pendingdelete. cartitemid type: string id of the cart item. 1056apex reference guide commercecart class cartitem type: connectapi.cartiteminput a connectapi.cartiteminput object representing a cart item to update. currencyisocode type: string the currency iso code of the cart. return value type: connectapi.cartitem usage buyers with read access to carts can add, update, and delete items in carts. this method respects buyer view product entitlements and only users entitled to view product data can access it. upsertinventoryreservation(webstoreid, activecartorid, effectiveaccountid, cartinventoryreservationinput) (developer preview) create or update an inventory reservation. note: this feature is available as a developer preview. it isn’t generally available unless or until salesforce announces its general availability in documentation or in press releases or public statements. all commands, parameters, and other features are subject to change or deprecation at any time, with or without notice. api version 58.0 available to guest users 58.0 requires chatter no signature public static connectapi.cartinventoryreservationoutputrepresentation upsertinventoryreservation(string webstoreid, string activecartorid, string effectiveaccountid, connectapi.cartinventoryreservationinputrepresentation cartinventoryreservationinput) parameters webstoreid type: string id of the webstore. 1057apex reference guide commercecatalog class activecartorid type: string id of the cart, active, or current. the current value indicates a cart with a status that isn’t closed or pendingdelete. effectiveaccountid type: string id of the buyer account or guest buyer profile for which the request is made. if null, the default value is determined from context. cartinventoryreservationinput type: connectapi.cartinventoryreservationinputrepresentation a connectapi.cartinventoryreservationinputrepresentation input class indicating the reservation duration. return value type: connectapi.cartinventoryreservationoutputrepresentation commercecatalog class get products, product categories, and product category paths. namespace connectapi commercecatalog methods these methods are for commercecatalog. all methods are static. in this section: getproduct(webstoreid, productid, effectiveaccountid, fields, excludefields, mediagroups, excludemedia, excludeentitlementdetails, excludeprimaryproductcategory) get a product. getproduct(webstoreid, productid, effectiveaccountid, fields, excludefields, mediagroups, excludemedia, excludeentitlementdetails, excludeprimaryproductcategory, excludevariationinfo, excludeattributesetinfo) get a product with variation and attribute information. getproduct(webstoreid, productid, effectiveaccountid, fields, excludefields, mediagroups, excludemedia, excludeentitlementdetails, excludeprimaryproductcategory, excludevariationinfo, excludeattributesetinfo, excludequantityrule) get a product with quantity rule information. getproduct(webstoreid, productid, effectiveaccountid, fields, excludefields, mediagroups, excludemedia, excludeentitlementdetails, excludeprimaryproductcategory, excludevariationinfo, excludeattributesetinfo, excludequantityrule, excludeproductsellingmodels) get detailed information for a product, optionally including information about its product selling models. getproduct(webstoreid, productid, effectiveaccountid, fields, mediagroups, excludefields, excludemedia, excludeprimaryproductcategory, excludevariationinfo, excludeattributesetinfo, excludequantityrule, excludeproductsellingmodels) get detailed information for a product without its entitlement information. getproductcategory(webstoreid, productcategoryid, effectiveaccountid, fields, excludefields, mediagroups, excludemedia) get a product category. 1058apex reference guide commercecatalog class getproductcategorychildren(webstoreid, effectiveaccountid, parentproductcategoryid, fields, excludefields, mediagroups, excludemedia" ") get product categories. getproductcategorypath(webstoreid, productcategoryid) get the product category path from the root category to the current category. getproductchildcollection(webstoreid, productid, effectiveaccountid, fields, mediagroups, excludefields, excludemedia, excludeattributesetinfo, excludequantityrule, pagetoken, pagesize) get a collection of child products related to a parent product. getproducts(webstoreid, effectiveaccountid, ids, skus, fields, excludemedia, excludeprices) get fields, prices, and default images for a list of products. getproducts(webstoreid, effectiveaccountid, ids, skus, fields, excludemedia) get fields and default images for a list of products. getproduct(webstoreid, productid, effectiveaccountid, fields, excludefields, mediagroups, excludemedia, excludeentitlementdetails, excludeprimaryproductcategory) get a product. api version 49.0 available to guest users 51.0 requires chatter no signature public static connectapi.productdetail getproduct(string webstoreid, string productid, string effectiveaccountid, list fields, boolean excludefields, list mediagroups, boolean excludemedia, boolean excludeentitlementdetails, boolean excludeprimaryproductcategory) parameters webstoreid type: string id of the webstore. productid type: string id of the product. 1059apex reference guide commercecatalog class effectiveaccountid type: string id of the buyer account or guest buyer profile for which the request is made. if null, the default value is determined from context. fields type: list comma-separated list of field names. if this list is empty or unspecified, all fields are returned. there is no limit to the number of fields you can specify. the number of fields and number of characters in the field name may affect the url size limit. if excludefields and fields are specified, the excludefields parameter takes precedence. excludefields type: boolean specifies whether the fields are returned (false) or not (true). if unspecified, defaults to false. mediagroups type: list comma-separated list of developer names of media group records. if this list is empty or unspecified, all media groups are returned. if excludemedia and mediagroups are specified, the excludemedia parameter takes precedence. excludemedia type: boolean specifies whether the media groups and default images of the product are returned (false) or not (true). if unspecified, defaults to false. excludeentitlementdetails type: boolean specifies whether the entitlement details of the product are returned (false) or not (true). if unspecified, defaults to false. excludeprimaryproductcategory type: boolean specifies whether the primary category path of the product is returned (false) or not (true). if unspecified, defaults to false. return value type: connectapi.productdetail usage this method respects buyer view product entitlements and only users entitled to view product data can access it. getproduct(webstoreid, productid, effectiveaccountid, fields, excludefields, mediagroups, excludemedia, excludeentitlementdetails, excludeprimaryproductcategory, excludevariationinfo, excludeattributesetinfo) get a product with variation and attribute information. 1060apex reference guide commercecatalog class api version 50.0 available to guest users 51.0 requires chatter no signature public static connectapi.productdetail getproduct(string webstoreid, string productid, string effectiveaccountid, list fields, boolean excludefields, list mediagroups, boolean excludemedia, boolean excludeentitlementdetails, boolean excludeprimaryproductcategory, boolean excludevariationinfo, boolean excludeattributesetinfo) parameters webstoreid type: string id of the webstore. productid type: string id of the product. effectiveaccountid type: string id of the buyer account or guest buyer profile for which the request is made. if null, the default value is determined from context. fields type: list comma-separated list of field names. if this list is empty or unspecified, all fields are returned. there is no limit to the number of fields you can specify. the number of fields and number of characters in the field name may affect the url" "size limit. if excludefields and fields are specified, the excludefields parameter takes precedence. excludefields type: boolean specifies whether the fields are returned (false) or not (true). if unspecified, defaults to false. mediagroups type: list comma-separated list of developer names of media group records. if this list is empty or unspecified, all media groups are returned. if excludemedia and mediagroups are specified, the excludemedia parameter takes precedence. 1061apex reference guide commercecatalog class excludemedia type: boolean specifies whether the media groups and default images of the product are returned (false) or not (true). if unspecified, defaults to false. excludeentitlementdetails type: boolean specifies whether the entitlement details of the product are returned (false) or not (true). if unspecified, defaults to false. excludeprimaryproductcategory type: boolean specifies whether the primary category path of the product is returned (false) or not (true). if unspecified, defaults to false. excludevariationinfo type: boolean specifies whether the variation information for the product is returned (false) or not (true). if unspecified, defaults to false. excludeattributesetinfo type: boolean specifies whether the attribute set information for the product is returned (false) or not (true). if unspecified, defaults to false. return value type: connectapi.productdetail usage this method respects buyer view product entitlements and only users entitled to view product data can access it. getproduct(webstoreid, productid, effectiveaccountid, fields, excludefields, mediagroups, excludemedia, excludeentitlementdetails, excludeprimaryproductcategory, excludevariationinfo, excludeattributesetinfo, excludequantityrule) get a product with quantity rule information. api version 52.0 available to guest users 52.0 requires chatter no 1062apex reference guide commercecatalog class signature public static connectapi.productdetail getproduct(string webstoreid, string productid, string effectiveaccountid, list fields, boolean excludefields, list mediagroups, boolean excludemedia, boolean excludeentitlementdetails, boolean excludeprimaryproductcategory, boolean excludevariationinfo, boolean excludeattributesetinfo, boolean excludequantityrule) parameters webstoreid type: string id of the webstore. productid type: string id of the product. effectiveaccountid type: string id of the buyer account or guest buyer profile for which the request is made. if null, the default value is determined from context. fields type: list comma-separated list of field names. if this list is empty or unspecified, all fields are returned. there is no limit to the number of fields you can specify. the number of fields and number of characters in the field name may affect the url size limit. if excludefields and fields are specified, the excludefields parameter takes precedence. excludefields type: boolean specifies whether the fields are returned (false) or not (true). if unspecified, defaults to false. mediagroups type: list comma-separated list of developer names of media group records. if this list is empty or unspecified, all media groups are returned. if excludemedia and mediagroups are specified, the excludemedia parameter takes precedence. excludemedia type: boolean specifies whether the media groups and default images of the product are returned (false) or not (true). if unspecified, defaults to false. excludeentitlementdetails type: boolean specifies whether the entitlement details of the product are returned (false) or not (true). if unspecified, defaults to false. excludeprimaryproductcategory type: boolean specifies whether the primary category path of the product is returned (false) or not (true). if unspecified, defaults to false. 1063apex reference guide commercecatalog class excludevariationinfo type: boolean specifies whether the variation information for the product is returned (false) or not (true). if unspecified, defaults to false. excludeattributesetinfo type: boolean specifies whether the attribute set information for the product is returned (false) or not (true). if unspecified, defaults to false. excludequantityrule type: boolean specifies whether the quantity rule information for the product is returned (false) or not (true). if unspecified, defaults to false. return value type" ": connectapi.productdetail usage this method respects buyer view product entitlements and only users entitled to view product data can access it. getproduct(webstoreid, productid, effectiveaccountid, fields, excludefields, mediagroups, excludemedia, excludeentitlementdetails, excludeprimaryproductcategory, excludevariationinfo, excludeattributesetinfo, excludequantityrule, excludeproductsellingmodels) get detailed information for a product, optionally including information about its product selling models. api version 56.0 available to guest users 56.0 requires chatter no signature public static connectapi.productdetail getproduct(string webstoreid, string productid, string effectiveaccountid, list fields, boolean excludefields, list mediagroups, boolean excludemedia, boolean excludeentitlementdetails, boolean excludeprimaryproductcategory, boolean excludevariationinfo, boolean excludeattributesetinfo, boolean excludequantityrule, boolean excludeproductsellingmodels) 1064apex reference guide commercecatalog class parameters webstoreid type: string id of the webstore. productid type: string id of the product. effectiveaccountid type: string id of the buyer account or guest buyer profile for which the request is made. if null, the default value is determined from context. fields type: list comma-separated list of field names. if this list is empty or unspecified, all fields are returned. there is no limit to the number of fields you can specify. the number of fields and number of characters in the field name may affect the url size limit. if excludefields and fields are specified, the excludefields parameter takes precedence. excludefields type: boolean specifies whether the fields are returned (false) or not (true). if unspecified, defaults to false. mediagroups type: list comma-separated list of developer names of media group records. if this list is empty or unspecified, all media groups are returned. if excludemedia and mediagroups are specified, the excludemedia parameter takes precedence. excludemedia type: boolean specifies whether the media groups and default images of the product are returned (false) or not (true). if unspecified, defaults to false. excludeentitlementdetails type: boolean specifies whether the entitlement details of the product are returned (false) or not (true). if unspecified, defaults to false. excludeprimaryproductcategory type: boolean specifies whether the primary category path of the product is returned (false) or not (true). if unspecified, defaults to false. excludevariationinfo type: boolean specifies whether the variation information for the product is returned (false) or not (true). if unspecified, defaults to false. excludeattributesetinfo type: boolean specifies whether the attribute set information for the product is returned (false) or not (true). if unspecified, defaults to false. 1065apex reference guide commercecatalog class excludequantityrule type: boolean specifies whether the quantity rule information for the product is returned (false) or not (true). if unspecified, defaults to false. excludeproductsellingmodels type: boolean specifies whether product selling models are returned or not. the behavior of this parameter depends on whether you turn on the commercesubscription permission. if the permission is on, and if you set the parameter to false (or if you omit the parameter), product selling models are returned. if the permission is on, and if you set the parameter to true, product selling models are not returned. if the permission is off, product selling models are not returned, regardless of whether you omit the parameter or provide a value. return value type: connectapi.productdetail usage this method respects buyer view product entitlements and only users entitled to view product data can access it. getproduct(webstoreid, productid, effectiveaccountid, fields, mediagroups, excludefields, excludemedia, excludeprimaryproductcategory, excludevariationinfo, excludeattributesetinfo, excludequantityrule, excludeproductsellingmodels) get detailed information for a product without its entitlement information. api version 57.0 available to guest users 57.0 requires chatter no signature public static connectapi.productdetail getproduct(string webstoreid, string productid, string effectiveaccountid, list fields, list mediagroups, boolean ex" "cludefields, boolean excludemedia, boolean excludeprimaryproductcategory, boolean excludevariationinfo, boolean excludeattributesetinfo, boolean excludequantityrule, boolean excludeproductsellingmodels) 1066apex reference guide commercecatalog class parameters webstoreid type: string id of the webstore. productid type: string id of the product. effectiveaccountid type: string id of the buyer account or guest buyer profile for which the request is made. if null, the default value is determined from context. fields type: list comma-separated list of field names. if this list is empty or unspecified, all fields are returned. there is no limit to the number of fields you can specify. the number of fields and number of characters in the field name may affect the url size limit. if excludefields and fields are specified, the excludefields parameter takes precedence. mediagroups type: list comma-separated list of developer names of media group records. if this list is empty or unspecified, all media groups are returned. if excludemedia and mediagroups are specified, the excludemedia parameter takes precedence. excludefields type: boolean specifies whether the fields are returned (false) or not (true). if unspecified, defaults to false. excludemedia type: boolean specifies whether the media groups and default images of the product are returned (false) or not (true). if unspecified, defaults to false. excludeprimaryproductcategory type: boolean specifies whether the primary category path of the product is returned (false) or not (true). if unspecified, defaults to false. excludevariationinfo type: boolean specifies whether the variation information for the product is returned (false) or not (true). if unspecified, defaults to false. excludeattributesetinfo type: boolean specifies whether the attribute set information for the product is returned (false) or not (true). if unspecified, defaults to false. excludequantityrule type: boolean specifies whether the quantity rule information for the product is returned (false) or not (true). if unspecified, defaults to false. 1067apex reference guide commercecatalog class excludeproductsellingmodels type: boolean specifies whether product selling models are returned or not. the behavior of this parameter depends on whether you turn on the commercesubscription permission. if the permission is on, and if you set the parameter to false (or if you omit the parameter), product selling models are returned. if the permission is on, and if you set the parameter to true, product selling models are not returned. if the permission is off, product selling models are not returned, regardless of whether you omit the parameter or provide a value. return value type: connectapi.productdetail usage this method respects buyer view product entitlements and only users entitled to view product data can access it. getproductcategory(webstoreid, productcategoryid, effectiveaccountid, fields, excludefields, mediagroups, excludemedia) get a product category. api version 49.0 available to guest users 51.0 requires chatter no signature public static connectapi.productcategorydetail getproductcategory(string webstoreid, string productcategoryid, string effectiveaccountid, list fields, boolean excludefields, list mediagroups, boolean excludemedia) parameters webstoreid type: string id of the webstore. productcategoryid type: string id of the product category. 1068apex reference guide commercecatalog class effectiveaccountid type: string id of the buyer account or guest buyer profile for which the request is made. if null, the default value is determined from context. fields type: list comma-separated list of field names. if this list is empty or unspecified, all fields are returned. there is no limit to the number of fields you can specify. the number of fields and number of characters in the field name may affect the url size limit. if excludefields and fields are specified, the excludefields parameter takes precedence. excludefields type: boolean specifies whether the fields are returned (false) or not (true). if unspecified, defaults to false. mediagroups type: list comma-separated list of developer names of media group records. if this list is empty or unspecified, all media groups are returned. if excludemedia and mediagroups are specified, the excludemedia" "parameter takes precedence. excludemedia type: boolean specifies whether the media groups and default images of the product are returned (false) or not (true). if unspecified, defaults to false. return value type: connectapi.productcategorydetail getproductcategorychildren(webstoreid, effectiveaccountid, parentproductcategoryid, fields, excludefields, mediagroups, excludemedia) get product categories. api version 52.0 available to guest users 52.0 requires chatter no 1069apex reference guide commercecatalog class signature public static connectapi.productcategorydetailcollection getproductcategorychildren(string webstoreid, string effectiveaccountid, string parentproductcategoryid, list fields, boolean excludefields, list mediagroups, boolean excludemedia) parameters webstoreid type: string id of the webstore. effectiveaccountid type: string id of the buyer account or guest buyer profile for which the request is made. if null, the default value is determined from context. parentproductcategoryid type: string id of the product category for which you want to get all the children product categories. if null, returns all the top-level product categories for the store. fields type: list comma-separated list of field names. if this list is empty or unspecified, all fields are returned. there is no limit to the number of fields you can specify. the number of fields and number of characters in the field name may affect the url size limit. if excludefields and fields are specified, the excludefields parameter takes precedence. excludefields type: boolean specifies whether the fields are returned (false) or not (true). if unspecified, defaults to false. mediagroups type: list comma-separated list of developer names of media group records. if this list is empty or unspecified, all media groups are returned. if excludemedia and mediagroups are specified, the excludemedia parameter takes precedence. excludemedia type: boolean specifies whether the media groups and default images of the product are returned (false) or not (true). if unspecified, defaults to false. return value type: connectapi.productcategorydetailcollection getproductcategorypath(webstoreid, productcategoryid) get the product category path from the root category to the current category. 1070apex reference guide commercecatalog class api version 49.0 available to guest users 51.0 requires chatter no signature public static connectapi.productcategorypath getproductcategorypath(string webstoreid, string productcategoryid) parameters webstoreid type: string id of the webstore. productcategoryid type: string id of the product category. return value type: connectapi.productcategorypath usage this method respects buyer view product entitlements and only users entitled to view product data can access it. getproductchildcollection(webstoreid, productid, effectiveaccountid, fields, mediagroups, excludefields, excludemedia, excludeattributesetinfo, excludequantityrule, pagetoken, pagesize) get a collection of child products related to a parent product. api version 57.0 available to guest users 57.0 1071apex reference guide commercecatalog class requires chatter no signature public static connectapi.productchildcollection getproductchildcollection(string webstoreid, string productid, string effectiveaccountid, list fields, list mediagroups, boolean excludefields, boolean excludemedia, boolean excludeattributesetinfo, boolean excludequantityrule, string pagetoken, integer pagesize) parameters webstoreid type: string id of the webstore. productid type: string id of the product. effectiveaccountid type: string id of the buyer account or guest buyer profile for which the request is made. if unspecified, the default value is determined from context. fields type: list comma-separated list of field names. if this list is empty or unspecified, all fields are returned. there is no limit to the number of fields you can specify. the number of fields and number of characters in the field name may affect the url size limit. if excludefields and fields are specified, the excludefields parameter takes precedence. mediagroups type: list comma-separated list of developer names of media group" "records. if this list is empty or unspecified, all media groups are returned. if excludemedia and mediagroups are specified, the excludemedia parameter takes precedence. excludefields type: boolean specifies whether the fields are returned (false) or not (true). if unspecified, defaults to false. excludemedia type: boolean specifies whether the media groups and default images of the product are returned (false) or not (true). if unspecified, defaults to false. excludeattributesetinfo type: boolean specifies whether the attribute set information for the product is returned (false) or not (true). if unspecified, defaults to false. 1072apex reference guide commercecatalog class excludequantityrule type: boolean specifies whether the quantity rule information for the product is returned (false) or not (true). if unspecified, defaults to false. pagetoken type: string specifies the base64 encoded page token. page tokens are returned as part of the response. if unspecified, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 through 100. if you don’t specify a value, the default size is 20. return value type: connectapi.productchildcollection getproducts(webstoreid, effectiveaccountid, ids, skus, fields, excludemedia, excludeprices) get fields, prices, and default images for a list of products. api version 54.0 available to guest users 54.0 requires chatter no signature public static connectapi.productoverviewcollection getproducts(string webstoreid, string effectiveaccountid, list ids, list skus, list fields, boolean excludemedia, boolean excludeprices) parameters webstoreid type: string id of the webstore. effectiveaccountid type: string id of the buyer account or guest buyer profile for which the request is made. if unspecified, the default value is determined from context. 1073apex reference guide commercecatalog class ids type: list list of product ids. specify either a list of up to 20 product ids or skus, but not both. skus type: list list of skus. specify either a list of up to 20 skus or product ids, but not both. fields type: list comma-separated list of field names to return for each product. if the list is empty or not specified, all fields are returned. you can specify any number of fields. excludemedia type: boolean specifies whether default images are returned for the products (false) or not (true). the default is false. excludeprices type: boolean specifies whether prices are returned for the products (false) or not (true). the default is false. note: in version 58.0 and later, prices aren’t returned for products regardless of this parameter. to get pricing information for products in version 58.0 and later, use the commercestorepricing class. return value type: connectapi.productoverviewcollection getproducts(webstoreid, effectiveaccountid, ids, skus, fields, excludemedia) get fields and default images for a list of products. api version 58.0 available to guest users 58.0 requires chatter no signature public static connectapi.productoverviewcollection getproducts(string webstoreid, string effectiveaccountid, list ids, list skus, list fields, boolean excludemedia) 1074apex reference guide commercepromotions class parameters webstoreid type: string id of the webstore. effectiveaccountid type: string id of the buyer account or guest buyer profile for which the request is made. if null, the default value is determined from context. ids type: list list of product ids. specify either a list of up to 20 product ids or skus, but not both. skus type: list list of skus. specify either a list of up to 20 skus or product ids, but not both. fields type: list comma-separated list of field names to return for each product. if the list is empty or not specified, all fields are returned. you can specify any number of fields. excludemedia type: boolean specifies whether default images are returnedspecifies" "whether the media groups and default images of the product are returned (false) or not (true). if unspecified, defaults to false. return value type: connectapi.productoverviewcollection commercepromotions class evaluate promotions for commerce orders. get coupon code redemption usage. namespace connectapi commercepromotions methods the following are methods for commercepromotions. all methods are static. in this section: decreaseredemption(couponcoderedemption) get coupon code redemption usage to revert a previously redeemed coupon code. 1075apex reference guide commercepromotions class evaluate(salestransaction) determine which promotions the customer is eligible for based on the store and buyer group, and compute the applicable price adjustments based on the coupons and the items in the cart. this api evaluates only the first 50 active manual promotions and first 50 active automatic promotions, based on priority. if you want to enable promotions based on shipping, contact salesforce customer support. increaseredemption(couponcoderedemption) get coupon code redemption addition (increase) usage. decreaseredemption(couponcoderedemption) get coupon code redemption usage to revert a previously redeemed coupon code. api version 58.0 available to guest users 58.0 requires chatter no signature public static connectapi.couponcoderedemptioncollection decreaseredemption(connectapi.couponcoderedemptioninput couponcoderedemption) parameters couponcoderedemption type: connectapi.couponcoderedemptioninput on page 1576 tracks each coupon code redemption. return value type: connectapi.couponcoderedemptioncollection on page 1760 evaluate(salestransaction) determine which promotions the customer is eligible for based on the store and buyer group, and compute the applicable price adjustments based on the coupons and the items in the cart. this api evaluates only the first 50 active manual promotions and first 50 active automatic promotions, based on priority. if you want to enable promotions based on shipping, contact salesforce customer support. api version 57.0 1076apex reference guide commercepromotions class available to guest users 57.0 requires chatter no signature global static connectapi.promotionevaluation evaluate(connectapi.promotionevaluateinput salestransaction) parameters salestransaction type: connectapi.promotionevaluateinput find promotions that the customer is eligible for and compute their discounts. return value type: connectapi.promotionevaluation increaseredemption(couponcoderedemption) get coupon code redemption addition (increase) usage. api version 58.0 available to guest users 58.0 requires chatter no signature public static connectapi.couponcoderedemptioncollection increaseredemption(connectapi.couponcoderedemptioninput couponcoderedemption) parameters couponcoderedemption type: connectapi.couponcoderedemptioninput on page 1576 tracks each coupon code redemption. 1077apex reference guide commercesearch class return value type: connectapi.couponcoderedemptioncollection on page 1760 commercesearch class get sort rules for the live search index. get product search suggestions. search products. namespace connectapi commercesearch methods these methods are for commercesearch. all methods are static. in this section: getsortrules(webstoreid) get sort rules for the live index. getsuggestions(webstoreid, effectiveaccountid, searchterm, maxresults) get suggestions for product searches. getsuggestions(webstoreid, effectiveaccountid, searchterm, maxresults, includesuggestedproducts, maxsuggestedproducts) get suggestions for product searches. searchproducts(webstoreid, effectiveaccountid, productsearchinput) search products. searchproducts(webstoreid, searchterm, categoryid, sortruleid, grouping, fields, refinements, pageparam, pagesize, effectiveaccountid, includequantityrule) search products by search term or category in a webstore. getsortrules(webstoreid) get sort rules for the live index. api version 52.0 available to guest users 52.0 requires chatter no 1078apex reference guide commercesearch class signature public static connectapi.sortrulescollection getsortrules(string webstoreid) parameters webstoreid type: string id" "of the webstore. return value type: connectapi.sortrulescollection getsuggestions(webstoreid, effectiveaccountid, searchterm, maxresults) get suggestions for product searches. api version 52.0 available to guest users 52.0 requires chatter no signature public static connectapi.productsearchsuggestionsresults getsuggestions(string webstoreid, string effectiveaccountid, string searchterm, integer maxresults) parameters webstoreid type: string id of the webstore. effectiveaccountid type: string id of the buyer account or guest buyer profile for which the request is made. if null, the default value is determined from context. searchterm type: string search term with up to 10 characters. if specified, the service returns autocomplete suggestions from the user’s recent searches. if unspecified, the service returns suggestions from the user’s recent searches. maxresults type: integer 1079apex reference guide commercesearch class maximum number of suggestions. values are from 1 through 10. if unspecified, defaults to 10. return value type: connectapi.productsearchsuggestionsresults getsuggestions(webstoreid, effectiveaccountid, searchterm, maxresults, includesuggestedproducts, maxsuggestedproducts) get suggestions for product searches. api version 58.0 available to guest users 58.0 requires chatter no signature public static connectapi.productsearchsuggestionsresults getsuggestions(string webstoreid, string effectiveaccountid, string searchterm, integer maxresults, boolean includesuggestedproducts, integer maxsuggestedproducts) parameters webstoreid type: string id of the webstore. effectiveaccountid type: string id of the buyer account or guest buyer profile for which the request is made. if null, the default value is determined from context. searchterm type: string search term with up to 10 characters. if specified, the service returns autocomplete suggestions from the user’s recent searches. if unspecified, the service returns suggestions from the user’s recent searches. maxresults type: integer maximum number of suggestions. values are from 1 through 10. if unspecified, defaults to 10. includesuggestedproducts type: boolean 1080apex reference guide commercesearch class specifies whether a search term returns product suggestions (true) or not (false). if unspecified, defaults to false. if true, the service returns the suggested product ids. maxsuggestedproducts type: string maximum number of product suggestions. values are from 1 through 10. if unspecified, defaults to 4. return value type: connectapi.productsearchsuggestionsresults searchproducts(webstoreid, effectiveaccountid, productsearchinput) search products. api version 52.0 available to guest users 52.0 requires chatter no signature public static connectapi.productsearchresults searchproducts(string webstoreid, string effectiveaccountid, connectapi.productsearchinput productsearchinput) parameters webstoreid type: string id of the webstore. effectiveaccountid type: string id of the buyer account or guest buyer profile for which the request is made. if null, the default value is determined from context. productsearchinput type: connectapi.productsearchinput a connectapi.productsearchinput body with either a category id or search terms. return value type: connectapi.productsearchresults 1081apex reference guide commercesearch class usage searching products respects buyer view product entitlements and only users entitled to view product data can access this resource. searchproducts(webstoreid, searchterm, categoryid, sortruleid, grouping, fields, refinements, pageparam, pagesize, effectiveaccountid, includequantityrule) search products by search term or category in a webstore. api version 58.0 available to guest users 58.0 requires chatter no signature public static connectapi.commerceproductsearchresults searchproducts(string webstoreid, string searchterm, string categoryid, string sortruleid, string grouping, list fields, string refinements, integer pageparam, integer pagesize, string effectiveaccountid, boolean includequantityrule) parameters webstoreid type: string id of the webstore. searchterm type: string list of up to 32 space-separated search terms. categoryid type: string category id returns results for products in this category or its subcategories." "sortruleid type: string id of the sort rule that specifies the order of products in the search results. if unspecified, the default sort type is relevancy. grouping type: string specifies whether to group products in search results and how to group them. 1082" "apex reference guide commercesearchsettings class fields type: list product fields to return in search results. search results include fields you have access to. refinements type: string list up to nine refinements (facets) for search results. buyers or shoppers can select up to 20 values for each refinement. the refinements parameter is encoded as a base64 string from the json representation of connectapi.distinctvaluerefinementinput . pageparam type: integer number of the page you want returned. starts at 0. if you pass in null or 0, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 through 200. if unspecified, defaults to 20. effectiveaccountid type: string id of the buyer account or guest buyer profile for which the request is made. if unspecified, the default value is determined from context. includequantityrule type: boolean specifies whether to include purchase quantity rule information for products in search results (true) or not (false). if unspecified, defaults to false. return value type: connectapi.productsearchresults usage searching products respects buyer view product entitlements and only users entitled to view product data can access this resource. commercesearchsettings class get indexes. get index logs. create an index of a product catalog. namespace connectapi commercesearchsettings methods these methods are for commercesearchsettings. all methods are static. 1083apex reference guide commercesearchsettings class in this section: createcommercesearchindex(webstoreid, indexbuildtype) create an index of a product catalog. getcommercesearchindex(webstoreid, indexid) get a commerce search index. getcommercesearchindexes(webstoreid) get commerce search indexes. getcommercesearchindexlogs(webstoreid) get commerce search index logs. createcommercesearchindex(webstoreid, indexbuildtype) create an index of a product catalog. api version 57.0 requires chatter yes signature public static connectapi.commercesearchindex postcommercesearchindex(string webstoreid) parameters webstoreid type: string id of the webstore. indexbuildtype type: connectapi.commercesearchindexbuildtype build type of the index. values are: • full • incremental return value type: connectapi.commercesearchindex usage this method creates a live index that replaces the current live index. any indexes that are in progress are removed when you manually create an index with this method. 1084apex reference guide commercesearchsettings class getcommercesearchindex(webstoreid, indexid) get a commerce search index. api version 52.0 requires chatter yes signature public static connectapi.commercesearchindex getsinglecommercesearchindex(string webstoreid, string indexid) parameters webstoreid type: string id of the webstore. indexid type: string id of the index. return value type: connectapi.commercesearchindex getcommercesearchindexes(webstoreid) get commerce search indexes. api version 52.0 requires chatter yes signature public static connectapi.commercesearchindexcollection getcommercesearchindexes(string webstoreid) 1085apex reference guide commercestorepricing class parameters webstoreid type: string id of the webstore. return value type: connectapi.commercesearchindexcollection getcommercesearchindexlogs(webstoreid) get commerce search index logs. api version 57.0 requires chatter no signature public static connectapi.commercesearchindexlogcollection getcommercesearchindexlogs(string webstoreid) parameters webstoreid type: string id of the webstore. return value type: connectapi.commercesearchindexlogcollection commercestorepricing class get product prices. namespace connectapi commercestorepricing methods these methods are for commercestorepricing. all methods are static. 1086apex reference guide commercestorepricing class in this section: getproductprice(webstoreid, productid, effectiveaccountid) get the list and buyer price for a product. getproductprice(webstoreid, productid, effectiveaccountid, productsellingmodelids) get a product’s list and buyer price for specified product selling models. getproductprices(web" "storeid, effectiveaccountid, pricinginput) get the prices for multiple products. getproductprices(webstoreid, effectiveaccountid, productids) get the prices for multiple products. getproductprice(webstoreid, productid, effectiveaccountid) get the list and buyer price for a product. api version 49.0 available to guest users 51.0 requires chatter no signature public static connectapi.productprice getproductprice(string webstoreid, string productid, string effectiveaccountid) parameters webstoreid type: string id of the webstore. productid type: string id of the product. effectiveaccountid type: string id of the buyer account or guest buyer profile for which the request is made. return value type: connectapi.productprice 1087apex reference guide commercestorepricing class usage this method respects buyer entitlements and only users entitled to view product and price data can access it. if a store is segmented into markets, this api looks at the language parameter appended to the url to determine the shopper’s locale and returns the appropriate values. getproductprice(webstoreid, productid, effectiveaccountid, productsellingmodelids) get a product’s list and buyer price for specified product selling models. api version 56.0 available to guest users 56.0 requires chatter no signature public static connectapi.productprice getproductprice(string webstoreid, string productid, string effectiveaccountid, list productsellingmodelids) parameters webstoreid type: string id of the webstore. productid type: string id of the product. effectiveaccountid type: string id of the buyer account or guest buyer profile for which the request is made. productsellingmodelids type: list list of product selling model ids for the product. return value type: connectapi.productprice 1088apex reference guide commercestorepricing class getproductprices(webstoreid, effectiveaccountid, pricinginput) get the prices for multiple products. api version 49.0 available to guest users 51.0 requires chatter no signature public static connectapi.pricingresult getproductprices(string webstoreid, string effectiveaccountid, connectapi.pricinginput pricinginput) parameters webstoreid type: string id of the webstore. effectiveaccountid type: string id of the buyer account or guest buyer profile for which the request is made. if null, the default value is determined from context. pricinginput type: connectapi.pricinginput a connectapi.pricinginput body with the list of line items to price. return value type: connectapi.pricingresult usage this method respects buyer entitlements and only users entitled to view product and price data can access it. if a store is segmented into markets, this api looks at the language parameter appended to the url to determine the shopper’s locale and returns the appropriate values. getproductprices(webstoreid, effectiveaccountid, productids) get the prices for multiple products. 1089apex reference guide commercewishlist class api version 54.0 available to guest users 54.0 requires chatter no signature public static connectapi.pricingresult getproductprices(string webstoreid, string effectiveaccountid, list productids) parameters webstoreid type: string id of the webstore. effectiveaccountid type: string id of the buyer account or guest buyer profile for which the request is made. if null, the default value is determined from context. productids type: list list of product ids for which you want to get prices. return value type: connectapi.pricingresult usage this method respects buyer entitlements and only users entitled to view product and price data can access it. if a store is segmented into markets, this api looks at the language parameter appended to the url to determine the shopper’s locale and returns the appropriate values. commercewishlist class get, create, update, and delete wishlists. add wishlists to carts. get wishlist items, add items to wishlists, and delete wishlist items. namespace connectapi" "1090apex reference guide commercewishlist class commercewishlist methods these methods are for commercewishlist. all methods are static. in this section: additemtowishlist(webstoreid, wishlistid, wishlistiteminput) add an item to a wishlist for the context user. additemtowishlist(webstoreid, effectiveaccountid, wishlistid, wishlistiteminput) add an item to a wishlist. addwishlisttocart(webstoreid, wishlistid) add a wishlist to the active cart for the context user. addwishlisttocart(webstoreid, wishlistid, effectiveaccountid) add a wishlist to the active cart. addwishlisttocartwithcartid(webstoreid, wishlistid, cartid) add a wishlist to a cart. addwishlisttocartwithcartid(webstoreid, wishlistid, cartid, effectiveaccountid) add a wishlist to a cart. createwishlist(webstoreid, wishlistinput) create a wishlist for the context user. createwishlist(webstoreid, effectiveaccountid, wishlistinput) create a wishlist. deletewishlist(webstoreid, wishlistid) delete a wishlist for the context user. deletewishlist(webstoreid, effectiveaccountid, wishlistid) delete a wishlist. getwishlist(webstoreid, effectiveaccountid, wishlistid, productfields, sortitemsby) get a wishlist with product fields sorted by items. getwishlist(webstoreid, effectiveaccountid, wishlistid, productfields, pagesize, sortitemsby) get a wishlist with product fields sorted by items with a specified number of items per page. getwishlistitems(webstoreid, effectiveaccountid, wishlistid, productfields, pageparam, sortitemsby) get a page of sorted wishlist items with product fields. getwishlistitems(webstoreid, effectiveaccountid, wishlistid, productfields, pageparam, pagesize, sortitemsby) get a page of specified size of sorted wishlist items with product fields. getwishlistsummaries(webstoreid, effectiveaccountid, includedisplayedlist) get wishlist summaries. getwishlistsummaries(webstoreid, effectiveaccountid, includedisplayedlist, productfields, sortitemsby) get wishlist summaries with product fields sorted by items. getwishlistsummaries(webstoreid, effectiveaccountid, includedisplayedlist, productfields, pagesize, sortitemsby) get wishlist summaries with product fields sorted by items with a specified number of items per page. removewishlistitem(webstoreid, effectiveaccountid, wishlistid, wishlistitemid) remove an item from a wishlist. 1091apex reference guide commercewishlist class updatewishlist(webstoreid, wishlistid, wishlistupdateinput) update the name of a wishlist for the context user. updatewishlist(webstoreid, effectiveaccountid, wishlistid, wishlistupdateinput) update the name of a wishlist. additemtowishlist(webstoreid, wishlistid, wishlistiteminput) add an item to a wishlist for the context user. api version 49.0 requires chatter no signature public static connectapi.wishlistitem additemtowishlist(string webstoreid, string wishlistid, connectapi.wishlistiteminput wishlistiteminput) parameters webstoreid type: string id of the webstore. wishlistid type: string id of the wishlist. wishlistiteminput type: connectapi.wishlistiteminput a connectapi.wishlistiteminput body with the item to add to the wishlist. return value type: connectapi.wishlistitem usage this method respects buyer view product entitlements and only users entitled to view product data can access it. additemtowishlist(webstoreid, effectiveaccountid, wishlistid, wishlistiteminput) add an item to a wishlist. 1092apex reference guide commercewishlist class api version 49.0 requires chatter no signature public static connectapi.wishlistitem additemto" "wishlist(string webstoreid, string effectiveaccountid, string wishlistid, connectapi.wishlistiteminput wishlistiteminput) parameters webstoreid type: string id of the webstore. effectiveaccountid type: string id of the account for which the request is made. if null, defaults to the account id for the context user. wishlistid type: string id of the wishlist. wishlistiteminput type: connectapi.wishlistiteminput a connectapi.wishlistiteminput body with the item to add to the wishlist. return value type: connectapi.wishlistitem usage this method respects buyer view product entitlements and only users entitled to view product data can access it. addwishlisttocart(webstoreid, wishlistid) add a wishlist to the active cart for the context user. api version 49.0 requires chatter no 1093apex reference guide commercewishlist class signature public static connectapi.wishlisttocartresult addwishlisttocart(string webstoreid, string wishlistid) parameters webstoreid type: string id of the webstore. wishlistid type: string id of the wishlist. return value type: connectapi.wishlisttocartresult usage this method respects buyer view product entitlements and only users entitled to view product data can access it. addwishlisttocart(webstoreid, wishlistid, effectiveaccountid) add a wishlist to the active cart. api version 49.0 requires chatter no signature public static connectapi.wishlisttocartresult addwishlisttocart(string webstoreid, string wishlistid, string effectiveaccountid) parameters webstoreid type: string id of the webstore. wishlistid type: string id of the wishlist. effectiveaccountid type: string 1094apex reference guide commercewishlist class id of the account for which the request is made. if null, defaults to the account id for the context user. return value type: connectapi.wishlisttocartresult usage this method respects buyer view product entitlements and only users entitled to view product data can access it. addwishlisttocartwithcartid(webstoreid, wishlistid, cartid) add a wishlist to a cart. api version 49.0 requires chatter no signature public static connectapi.wishlisttocartresult addwishlisttocartwithcartid(string webstoreid, string wishlistid, string cartid) parameters webstoreid type: string id of the webstore. wishlistid type: string id of the wishlist. cartid type: string id of the cart. if null, wishlist items are added to the active cart. return value type: connectapi.wishlisttocartresult usage this method respects buyer view product entitlements and only users entitled to view product data can access it. 1095apex reference guide commercewishlist class addwishlisttocartwithcartid(webstoreid, wishlistid, cartid, effectiveaccountid) add a wishlist to a cart. api version 49.0 requires chatter no signature public static connectapi.wishlisttocartresult addwishlisttocartwithcartid(string webstoreid, string wishlistid, string cartid, string effectiveaccountid) parameters webstoreid type: string id of the webstore. wishlistid type: string id of the wishlist. cartid type: string id of the cart. if null, wishlist items are added to the active cart. effectiveaccountid type: string id of the account for which the request is made. if null, defaults to the account id for the context user. return value type: connectapi.wishlisttocartresult usage this method respects buyer view product entitlements and only users entitled to view product data can access it. createwishlist(webstoreid, wishlistinput) create a wishlist for the context user. api version 49.0 1096apex reference guide commercewishlist class requires chatter no signature public static connectapi.wishlist createwishlist" "(string webstoreid, connectapi.wishlistinput wishlistinput) parameters webstoreid type: string id of the webstore. wishlistinput type: connectapi.wishlistinput a connectapi.wishlistinput body that includes the wishlist name and items. return value type: connectapi.wishlist createwishlist(webstoreid, effectiveaccountid, wishlistinput) create a wishlist. api version 49.0 requires chatter no signature public static connectapi.wishlist createwishlist(string webstoreid, string effectiveaccountid, connectapi.wishlistinput wishlistinput) parameters webstoreid type: string id of the webstore. effectiveaccountid type: string id of the account for which the request is made. if null, defaults to the account id for the context user. wishlistinput type: connectapi.wishlistinput 1097apex reference guide commercewishlist class a connectapi.wishlistinput body that includes the wishlist name and items. return value type: connectapi.wishlist deletewishlist(webstoreid, wishlistid) delete a wishlist for the context user. api version 49.0 requires chatter no signature public static void deletewishlist(string webstoreid, string wishlistid) parameters webstoreid type: string id of the webstore. wishlistid type: string id of the wishlist. return value type: void deletewishlist(webstoreid, effectiveaccountid, wishlistid) delete a wishlist. api version 51.0 requires chatter no 1098apex reference guide commercewishlist class signature public static void deletewishlist(string webstoreid, string effectiveaccountid, string wishlistid) parameters webstoreid type: string id of the webstore. effectiveaccountid type: string id of the account for which the request is made. if null, defaults to the account id for the context user. wishlistid type: string id of the wishlist. return value type: void getwishlist(webstoreid, effectiveaccountid, wishlistid, productfields, sortitemsby) get a wishlist with product fields sorted by items. api version 51.0 requires chatter no signature public static connectapi.wishlist getwishlist(string webstoreid, string effectiveaccountid, string wishlistid, string productfields, connectapi.wishlistitemsortorder sortitemsby) parameters webstoreid type: string id of the webstore. effectiveaccountid type: string id of the account for which the request is made. if null, defaults to the account id for the context user. 1099apex reference guide commercewishlist class wishlistid type: string id of the wishlist. productfields type: string comma-separated list of custom product fields. fields aren’t case-sensitive. for example, productcode and productcode return the same results. sortitemsby type: connectapi.wishlistitemsortorder sort order for wishlist items. values are: • createddateasc—sorts by oldest creation date. • createddatedesc—sorts by most recent creation date. the default sort order is createddatedesc. return value type: connectapi.wishlist getwishlist(webstoreid, effectiveaccountid, wishlistid, productfields, pagesize, sortitemsby) get a wishlist with product fields sorted by items with a specified number of items per page. api version 51.0 requires chatter no signature public static connectapi.wishlist getwishlist(string webstoreid, string effectiveaccountid, string wishlistid, string productfields, integer pagesize, connectapi.wishlistitemsortorder sortitemsby) parameters webstoreid type: string id of the webstore. effectiveaccountid type: string id of the account for which the request is made. if null, defaults to the account id for the context user. 1100apex reference guide commercewishlist class wishlistid type: string id of" "the wishlist. productfields type: string comma-separated list of custom product fields. fields aren’t case-sensitive. for example, productcode and productcode return the same results. pagesize type: integer specifies the number of items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortitemsby type: connectapi.wishlistitemsortorder sort order for wishlist items. values are: • createddateasc—sorts by oldest creation date. • createddatedesc—sorts by most recent creation date. the default sort order is createddatedesc. return value type: connectapi.wishlist getwishlistitems(webstoreid, effectiveaccountid, wishlistid, productfields, pageparam, sortitemsby) get a page of sorted wishlist items with product fields. api version 51.0 requires chatter no signature public static connectapi.wishlistitemcollection getwishlistitems(string webstoreid, string effectiveaccountid, string wishlistid, string productfields, string pageparam, connectapi.wishlistitemsortorder sortitemsby) parameters webstoreid type: string id of the webstore. 1101apex reference guide commercewishlist class effectiveaccountid type: string id of the account for which the request is made. if null, defaults to the account id for the context user. wishlistid type: string id of the wishlist. productfields type: string comma-separated list of custom product fields. fields aren’t case-sensitive. for example, productcode and productcode return the same results. pageparam type: string specifies the page token to use to view a page of information. page tokens are returned as part of the response class, such as currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. sortitemsby type: connectapi.wishlistitemsortorder sort order for wishlist items. values are: • createddateasc—sorts by oldest creation date. • createddatedesc—sorts by most recent creation date. the default sort order is createddatedesc. return value type: connectapi.wishlistitemcollection getwishlistitems(webstoreid, effectiveaccountid, wishlistid, productfields, pageparam, pagesize, sortitemsby) get a page of specified size of sorted wishlist items with product fields. api version 51.0 requires chatter no signature public static connectapi.wishlistitemcollection getwishlistitems(string webstoreid, string effectiveaccountid, string wishlistid, string productfields, string pageparam, integer pagesize, connectapi.wishlistitemsortorder sortitemsby) 1102apex reference guide commercewishlist class parameters webstoreid type: string id of the webstore. effectiveaccountid type: string id of the account for which the request is made. if null, defaults to the account id for the context user. wishlistid type: string id of the wishlist. productfields type: string comma-separated list of custom product fields. fields aren’t case-sensitive. for example, productcode and productcode return the same results. pageparam type: string specifies the page token to use to view a page of information. page tokens are returned as part of the response class, such as currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 through 200. if you pass in null, the default size is 25. sortitemsby type: connectapi.wishlistitemsortorder sort order for wishlist items. values are: • createddateasc—sorts by oldest creation date. • createddatedesc—sorts by most recent creation date. the default sort order is createddatedesc. return value type: connectapi.wishlistitemcollection getwishlistsummaries(webstoreid, effectiveaccountid, includedisplayedlist) get wishlist summaries. api version 49.0 requires chatter no 1103apex reference guide commercewishlist class signature public static connecta" "pi.wishlistssummary getwishlistsummaries(string webstoreid, string effectiveaccountid, boolean includedisplayedlist) parameters webstoreid type: string id of the webstore. effectiveaccountid type: string id of the account for which the request is made. if null, defaults to the account id for the context user. includedisplayedlist type: boolean specifies whether to include the displayed list (true) or not (false). if null, defaults to false. return value type: connectapi.wishlistssummary getwishlistsummaries(webstoreid, effectiveaccountid, includedisplayedlist, productfields, sortitemsby) get wishlist summaries with product fields sorted by items. api version 51.0 requires chatter no signature public static connectapi.wishlistssummary getwishlistsummaries(string webstoreid, string effectiveaccountid, boolean includedisplayedlist, string productfields, connectapi.wishlistitemsortorder sortitemsby) parameters webstoreid type: string id of the webstore. effectiveaccountid type: string id of the account for which the request is made. if null, defaults to the account id for the context user. 1104apex reference guide commercewishlist class includedisplayedlist type: boolean specifies whether to include the displayed list (true) or not (false). productfields type: string comma-separated list of custom product fields. fields aren’t case-sensitive. for example, productcode and productcode return the same results. if includedisplayedlist is false, productfields is ignored. sortitemsby type: connectapi.wishlistitemsortorder sort order for wishlist items. values are: • createddateasc—sorts by oldest creation date. • createddatedesc—sorts by most recent creation date. the default sort order is createddatedesc. if includedisplayedlist is false, sortitemsby is ignored. return value type: connectapi.wishlistssummary getwishlistsummaries(webstoreid, effectiveaccountid, includedisplayedlist, productfields, pagesize, sortitemsby) get wishlist summaries with product fields sorted by items with a specified number of items per page. api version 51.0 requires chatter no signature public static connectapi.wishlistssummary getwishlistsummaries(string webstoreid, string effectiveaccountid, boolean includedisplayedlist, integer pagesize, string productfields, pagesize, connectapi.wishlistitemsortorder sortitemsby) parameters webstoreid type: string id of the webstore. 1105apex reference guide commercewishlist class effectiveaccountid type: string id of the account for which the request is made. if null, defaults to the account id for the context user. includedisplayedlist type: boolean specifies whether to include the displayed list (true) or not (false). productfields type: string comma-separated list of custom product fields. fields aren’t case-sensitive. for example, productcode and productcode return the same results. if includedisplayedlist is false, productfields is ignored. pagesize type: integer specifies the number of items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortitemsby type: connectapi.wishlistitemsortorder sort order for wishlist items. values are: • createddateasc—sorts by oldest creation date. • createddatedesc—sorts by most recent creation date. the default sort order is createddatedesc. if includedisplayedlist is false, sortitemsby is ignored. return value type: connectapi.wishlistssummary removewishlistitem(webstoreid, effectiveaccountid, wishlistid, wishlistitemid) remove an item from a wishlist. api version 49.0 requires chatter no signature public static void removewishlistitem(string webstoreid, string effectiveaccountid, string wishlistid, string wishlistitemid) 1106apex reference guide commercewishlist class parameters webstoreid type: string id of the webstore. effectiveaccountid type: string id of the account for which the request" "is made. if null, defaults to the account id for the context user. wishlistid type: string id of the wishlist. wishlistitemid type: string id of the wishlist item to remove. return value type: void updatewishlist(webstoreid, wishlistid, wishlistupdateinput) update the name of a wishlist for the context user. api version 50.0 requires chatter no signature public static connectapi.wishlistsummary updatewishlist(string webstoreid, string wishlistid, connectapi.wishlistupdateinput wishlistupdateinput) parameters webstoreid type: string id of the webstore. wishlistid type: string id of the wishlist. wishlistupdateinput type: connectapi.wishlistupdateinput a connectapi.wishlistupdateinput body with the wishlist name to update. 1107apex reference guide communities class return value type: connectapi.wishlistsummary updatewishlist(webstoreid, effectiveaccountid, wishlistid, wishlistupdateinput) update the name of a wishlist. api version 50.0 requires chatter no signature public static connectapi.wishlistsummary updatewishlist(string webstoreid, string effectiveaccountid, string wishlistid, connectapi.wishlistupdateinput wishlistupdateinput) parameters webstoreid type: string id of the webstore. effectiveaccountid type: string id of the account for which the request is made. if null, defaults to the account id for the context user. wishlistid type: string id of the wishlist. wishlistupdateinput type: connectapi.wishlistupdateinput a connectapi.wishlistupdateinput body with the wishlist name to update. return value type: connectapi.wishlistsummary communities class get information about experience cloud sites in your org. 1108apex reference guide communities class namespace connectapi communities methods the following are methods for communities. all methods are static. in this section: getcommunities() get a list of experience cloud sites that the context user has access to. getcommunities(communitystatus) get a list of experience cloud sites with the specified status that the context user has access to. getcommunity(communityid) get information about an experience cloud site. getcommunities() get a list of experience cloud sites that the context user has access to. api version 28.0 requires chatter no signature public static connectapi.communitypage getcommunities() return value type: connectapi.communitypage getcommunities(communitystatus) get a list of experience cloud sites with the specified status that the context user has access to. api version 28.0 requires chatter no 1109apex reference guide communities class signature public static connectapi.communitypage getcommunities(connectapi.communitystatus communitystatus) parameters communitystatus type: connectapi.communitystatus communitystatus—status of the experience cloud site. values are: • live • inactive • underconstruction return value type: connectapi.communitypage getcommunity(communityid) get information about an experience cloud site. api version 28.0 available to guest users 35.0 requires chatter no signature public static connectapi.community getcommunity(string communityid) parameters communityid type: string id of an experience cloud site. you can’t specify null or internal. return value type: connectapi.community 1110apex reference guide communitymoderation class communitymoderation class get information about flagged feed items and comments in an experience cloud site. add and remove flags from comments and feed items. namespace connectapi communitymoderation methods the following are methods for communitymoderation. all methods are static. in this section: addflagtocomment(communityid, commentid) add a moderation flag to a comment. addflagtocomment(communityid, commentid, visibility) add a moderation flag of the specified visibility to a comment. addflagtocomment(communityid, commentid, type) add a moderation flag of the specified type to a comment. addflagtocomment(communityid, commentid" ", note) add a moderation flag with a note to a comment. addflagtocomment(communityid, commentid, type, note) add a moderation flag of the specified type with a note to a comment. addflagtocomment(communityid, commentid, type, visibility) add a moderation flag of the specified type and visibility to a comment. addflagtocomment(communityid, commentid, visibility, note) add a moderation flag of the specified visibility with a note to a comment. addflagtocomment(communityid, commentid, type, visibility, note) add a moderation flag of the specified type and visibility with a note to a comment. addflagtofeedelement(communityid, feedelementid) add a moderation flag to a feed element. addflagtofeedelement(communityid, feedelementid, visibility) add a moderation flag of the specified visibility to a feed element. addflagtofeedelement(communityid, feedelementid, type) add a moderation flag of the specified type to a feed element. addflagtofeedelement(communityid, feedelementid, note) add a moderation flag with a note to a feed element. addflagtofeedelement(communityid, feedelementid, type, note) add a moderation flag of the specified type with a note to a feed element. addflagtofeedelement(communityid, feedelementid, type, visibility) add a moderation flag of the specified type and visibility to a feed element. 1111apex reference guide communitymoderation class addflagtofeedelement(communityid, feedelementid, visibility, note) add a moderation flag of the specified visibility with a note to a feed element. addflagtofeedelement(communityid, feedelementid, type, visibility, note) add a moderation flag of the specified type and visibility with a note to a feed element. getflagsoncomment(communityid, commentid) get the moderation flags on a comment. getflagsoncomment(communityid, commentid, visibility) get the moderation flags with specified visibility on a comment. getflagsoncomment(communityid, commentid, pagesize, pageparam) get a page of moderation flags on a comment. getflagsoncomment(communityid, commentid, visibility, pagesize, pageparam) get a page of moderation flags with specified visibility on a comment. getflagsonfeedelement(communityid, feedelementid) get the moderation flags on a feed element. getflagsonfeedelement(communityid, feedelementid, visibility) get the moderation flags with specified visibility on a feed element. getflagsonfeedelement(communityid, feedelementid, pageparam, pagesize) get a page of moderation flags on a feed element. getflagsonfeedelement(communityid, feedelementid, visibility, pagesize, pageparam) get a page of moderation flags with specified visibility on a feed element. removeflagfromcomment(communityid, commentid, userid) remove a moderation flag from a comment. removeflagfromfeedelement(communityid, feedelementid, userid) remove a moderation flag from a feed element. addflagtocomment(communityid, commentid) add a moderation flag to a comment. api version 29.0 requires chatter yes signature public static connectapi.moderationflags addflagtocomment(string communityid, string commentid) 1112apex reference guide communitymoderation class parameters communityid type: string id for an experience cloud site, internal, or null. commentid type: string id for a comment. return value type: connectapi.moderationflags usage to add a flag to a comment, allow members to flag content must be selected for an experience cloud site. addflagtocomment(communityid, commentid, visibility) add a moderation flag of the specified visibility to a comment. api version 30.0 requires chatter yes signature public static connectapi.moderationflags addflagtocomment(string communityid, string commentid, connectapi.communityflagvisibility visibility) parameters communityid type: string id for an experience cloud site, internal, or null. commentid type: string id for a comment. visibility type: connectapi.communityflagvisibility visibility behavior of a flag for various user types. • moderatorsonly—the flag is visible only to users with moderation permissions on the flagged element or item. 1113apex reference guide communitymoderation class • selfandmoder" "ators—the flag is visible to the creator of the flag and to users with moderation permissions on the flagged element or item. return value type: connectapi.moderationflags usage to add a flag to a comment, allow members to flag content must be selected for an experience cloud site. addflagtocomment(communityid, commentid, type) add a moderation flag of the specified type to a comment. api version 38.0 requires chatter yes signature public static connectapi.moderationflags addflagtocomment(string communityid, string commentid, connectapi.communityflagtype type) parameters communityid type: string id for an experience cloud site, internal, or null. commentid type: string id for a comment. type type: connectapi.communityflagtype type of moderation flag. • flagasinappropriate—flag for inappropriate content. • flagasspam—flag for spam. if a type isn’t specified, it defaults to flagasinappropriate. return value type: connectapi.moderationflags 1114apex reference guide communitymoderation class usage to add a flag to a comment, allow members to flag content must be selected for an experience cloud site. addflagtocomment(communityid, commentid, note) add a moderation flag with a note to a comment. api version 38.0 requires chatter yes signature public static connectapi.moderationflags addflagtocomment(string communityid, string commentid, string note) parameters communityid type: string id for an experience cloud site, internal, or null. commentid type: string id for a comment. note type: string a note of up to 4,000 characters about the flag. return value type: connectapi.moderationflags usage to add a flag to a comment, allow members to flag content must be selected for an experience cloud site. addflagtocomment(communityid, commentid, type, note) add a moderation flag of the specified type with a note to a comment. api version 38.0 1115apex reference guide communitymoderation class requires chatter yes signature public static connectapi.moderationflags addflagtocomment(string communityid, string commentid, connectapi.communityflagtype type, string note) parameters communityid type: string id for an experience cloud site, internal, or null. commentid type: string id for a comment. type type: connectapi.communityflagtype type of moderation flag. • flagasinappropriate—flag for inappropriate content. • flagasspam—flag for spam. if a type isn’t specified, it defaults to flagasinappropriate. note type: string a note of up to 4,000 characters about the flag. return value type: connectapi.moderationflags usage to add a flag to a comment, allow members to flag content must be selected for an experience cloud site. addflagtocomment(communityid, commentid, type, visibility) add a moderation flag of the specified type and visibility to a comment. api version 38.0 requires chatter yes 1116apex reference guide communitymoderation class signature public static connectapi.moderationflags addflagtocomment(string communityid, string commentid, connectapi.communityflagtype type, connectapi.communityflagvisibility visibility) parameters communityid type: string id for an experience cloud site, internal, or null. commentid type: string id for a comment. type type: connectapi.communityflagtype type of moderation flag. • flagasinappropriate—flag for inappropriate content. • flagasspam—flag for spam. if a type isn’t specified, it defaults to flagasinappropriate. visibility type: connectapi.communityflagvisibility visibility behavior of a flag for various user types. • moderatorsonly—the flag is visible only to users with moderation permissions on the flagged element or item. • selfandmoderators—the flag is visible to the creator of the flag and to users with moderation permissions on the flagged element or item. return value type: connectapi.moderationflags usage to add a flag to a comment, allow members to flag content must be selected for an experience cloud site. addflagto" "comment(communityid, commentid, visibility, note) add a moderation flag of the specified visibility with a note to a comment. api version 38.0 requires chatter yes 1117apex reference guide communitymoderation class signature public static connectapi.moderationflags addflagtocomment(string communityid, string commentid, connectapi.communityflagvisibility visibility, string note) parameters communityid type: string id for an experience cloud site, internal, or null. commentid type: string id for a comment. visibility type: connectapi.communityflagvisibility visibility behavior of a flag for various user types. • moderatorsonly—the flag is visible only to users with moderation permissions on the flagged element or item. • selfandmoderators—the flag is visible to the creator of the flag and to users with moderation permissions on the flagged element or item. note type: string a note of up to 4,000 characters about the flag. return value type: connectapi.moderationflags usage to add a flag to a comment, allow members to flag content must be selected for an experience cloud site. addflagtocomment(communityid, commentid, type, visibility, note) add a moderation flag of the specified type and visibility with a note to a comment. api version 38.0 requires chatter yes signature public static connectapi.moderationflags addflagtocomment(string communityid, string commentid, connectapi.communityflagtype type, connectapi.communityflagvisibility visibility, string note) 1118apex reference guide communitymoderation class parameters communityid type: string id for an experience cloud site, internal, or null. commentid type: string id for a comment. type type: connectapi.communityflagtype type of moderation flag. • flagasinappropriate—flag for inappropriate content. • flagasspam—flag for spam. if a type isn’t specified, it defaults to flagasinappropriate. visibility type: connectapi.communityflagvisibility visibility behavior of a flag for various user types. • moderatorsonly—the flag is visible only to users with moderation permissions on the flagged element or item. • selfandmoderators—the flag is visible to the creator of the flag and to users with moderation permissions on the flagged element or item. note type: string a note of up to 4,000 characters about the flag. return value type: connectapi.moderationflags usage to add a flag to a comment, allow members to flag content must be selected for an experience cloud site. addflagtofeedelement(communityid, feedelementid) add a moderation flag to a feed element. api version 31.0 requires chatter yes 1119apex reference guide communitymoderation class signature public static connectapi.moderationcapability addflagtofeedelement(string communityid, string feedelementid) parameters communityid type: string id for an experience cloud site, internal, or null. feedelementid type: string id of the feed element. return value type: connectapi.moderationcapability if the feed element doesn’t support this capability, the return value is connectapi.notfoundexception. usage to add a flag to a feed element, allow members to flag content must be selected for an experience cloud site. addflagtofeedelement(communityid, feedelementid, visibility) add a moderation flag of the specified visibility to a feed element. api version 31.0 requires chatter yes signature public static connectapi.moderationcapability addflagtofeedelement(string communityid, string feedelementid, connectapi.communityflagvisibility visibility) parameters communityid type: string id for an experience cloud site, internal, or null. feedelementid type: string id of the feed element. 1120apex reference guide communitymoderation class visibility type: connectapi.communityflagvisibility visibility behavior of a flag for various user types. one of these values: • moderatorsonly—the flag is visible only to users with moderation permissions on the flagged element or item. • selfandmoderators—the flag is visible to the creator of the flag and to users with moderation permissions on the flagged element or item. return value type:" "connectapi.moderationcapability if the feed element doesn’t support this capability, the return value is connectapi.notfoundexception. usage to add a flag to a feed element, allow members to flag content must be selected for an experience cloud site. addflagtofeedelement(communityid, feedelementid, type) add a moderation flag of the specified type to a feed element. api version 38.0 requires chatter yes signature public static connectapi.moderationcapability addflagtofeedelement(string communityid, string feedelementid, connectapi.communityflagtype type) parameters communityid type: string id for an experience cloud site, internal, or null. feedelementid type: string id of the feed element. type type: connectapi.communityflagtype type of moderation flag. • flagasinappropriate—flag for inappropriate content. • flagasspam—flag for spam. 1121apex reference guide communitymoderation class if a type isn’t specified, it defaults to flagasinappropriate. return value type: connectapi.moderationcapability usage to add a flag to a feed element, allow members to flag content must be selected for an experience cloud site. addflagtofeedelement(communityid, feedelementid, note) add a moderation flag with a note to a feed element. api version 38.0 requires chatter yes signature public static connectapi.moderationcapability addflagtofeedelement(string communityid, string feedelementid, string note) parameters communityid type: string id for an experience cloud site, internal, or null. feedelementid type: string id of the feed element. note type: string a note of up to 4,000 characters about the flag. return value type: connectapi.moderationcapability usage to add a flag to a feed element, allow members to flag content must be selected for an experience cloud site. 1122apex reference guide communitymoderation class addflagtofeedelement(communityid, feedelementid, type, note) add a moderation flag of the specified type with a note to a feed element. api version 38.0 requires chatter yes signature public static connectapi.moderationcapability addflagtofeedelement(string communityid, string feedelementid, connectapi.communityflagtype type, string note) parameters communityid type: string id for an experience cloud site, internal, or null. feedelementid type: string id of the feed element. type type: connectapi.communityflagtype type of moderation flag. • flagasinappropriate—flag for inappropriate content. • flagasspam—flag for spam. if a type isn’t specified, it defaults to flagasinappropriate. note type: string a note of up to 4,000 characters about the flag. return value type: connectapi.moderationcapability usage to add a flag to a feed element, allow members to flag content must be selected for an experience cloud site. addflagtofeedelement(communityid, feedelementid, type, visibility) add a moderation flag of the specified type and visibility to a feed element. 1123apex reference guide communitymoderation class api version 38.0 requires chatter yes signature public static connectapi.moderationcapability addflagtofeedelement(string communityid, string feedelementid, connectapi.communityflagtype type, connectapi.communityflagvisibility visibility) parameters communityid type: string id for an experience cloud site, internal, or null. feedelementid type: string id of the feed element. type type: connectapi.communityflagtype type of moderation flag. • flagasinappropriate—flag for inappropriate content. • flagasspam—flag for spam. if a type isn’t specified, it defaults to flagasinappropriate. visibility type: connectapi.communityflagvisibility visibility behavior of a flag for various user types. one of these values: • moderatorsonly—the flag is visible only to users with moderation permissions on the flagged element or item. • selfandmoderators—the flag is visible to the creator of the flag and to users with moderation permissions on the flagged element or item. return value type:" "connectapi.moderationcapability usage to add a flag to a feed element, allow members to flag content must be selected for an experience cloud site. addflagtofeedelement(communityid, feedelementid, visibility, note) add a moderation flag of the specified visibility with a note to a feed element. 1124apex reference guide communitymoderation class api version 38.0 requires chatter yes signature public static connectapi.moderationcapability addflagtofeedelement(string communityid, string feedelementid, connectapi.communityflagvisibility visibility, string note) parameters communityid type: string id for an experience cloud site, internal, or null. feedelementid type: string id of the feed element. visibility type: connectapi.communityflagvisibility visibility behavior of a flag for various user types. one of these values: • moderatorsonly—the flag is visible only to users with moderation permissions on the flagged element or item. • selfandmoderators—the flag is visible to the creator of the flag and to users with moderation permissions on the flagged element or item. note type: string a note of up to 4,000 characters about the flag. return value type: connectapi.moderationcapability usage to add a flag to a feed element, allow members to flag content must be selected for an experience cloud site. addflagtofeedelement(communityid, feedelementid, type, visibility, note) add a moderation flag of the specified type and visibility with a note to a feed element. api version 38.0 1125apex reference guide communitymoderation class requires chatter yes signature public static connectapi.moderationcapability addflagtofeedelement(string communityid, string feedelementid, connectapi.communityflagtype type, connectapi.communityflagvisibility visibility, string note) parameters communityid type: string id for an experience cloud site, internal, or null. feedelementid type: string id of the feed element. type type: connectapi.communityflagtype type of moderation flag. • flagasinappropriate—flag for inappropriate content. • flagasspam—flag for spam. if a type isn’t specified, it defaults to flagasinappropriate. visibility type: connectapi.communityflagvisibility visibility behavior of a flag for various user types. one of these values: • moderatorsonly—the flag is visible only to users with moderation permissions on the flagged element or item. • selfandmoderators—the flag is visible to the creator of the flag and to users with moderation permissions on the flagged element or item. note type: string a note of up to 4,000 characters about the flag. return value type: connectapi.moderationcapability usage to add a flag to a feed element, allow members to flag content must be selected for an experience cloud site. getflagsoncomment(communityid, commentid) get the moderation flags on a comment. 1126apex reference guide communitymoderation class api version 29.0 requires chatter yes signature public static connectapi.moderationflags getflagsoncomment(string communityid, string commentid) parameters communityid type: string id for an experience cloud site, internal, or null. commentid type: string id for a comment. return value type: connectapi.moderationflags usage to get moderation flags, the context user must have the moderate experiences feeds permission. getflagsoncomment(communityid, commentid, visibility) get the moderation flags with specified visibility on a comment. api version 30.0 requires chatter yes signature public static connectapi.moderationflags getflagsoncomment(string communityid, string commentid, connectapi.communityflagvisibility visibility) 1127apex reference guide communitymoderation class parameters communityid type: string id for an experience cloud site, internal, or null. commentid type: string id for a comment. visibility type: connectapi.communityflagvisibility visibility behavior of a flag for various user types. • moderatorsonly—the flag is visible only to users with moderation permissions on the flagged element or item. • selfandmoderators—the flag is visible to the creator of the flag and to users with moderation" "permissions on the flagged element or item. return value type: connectapi.moderationflags usage to get moderation flags, the context user must have the moderate experiences feeds permission. getflagsoncomment(communityid, commentid, pagesize, pageparam) get a page of moderation flags on a comment. api version 40.0 requires chatter yes signature public static connectapi.moderationflags getflagsoncomment(string communityid, string commentid, integer pagesize, string pageparam) parameters communityid type: string id for an experience cloud site, internal, or null. commentid type: string 1128apex reference guide communitymoderation class id for a comment. pagesize type: integer specifies the number of items per page. valid values are from 1 through 100. the default size is 0. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. return value type: connectapi.moderationflags usage to get moderation flags, the context user must have the moderate experiences feeds permission. getflagsoncomment(communityid, commentid, visibility, pagesize, pageparam) get a page of moderation flags with specified visibility on a comment. api version 40.0 requires chatter yes signature public static connectapi.moderationflags getflagsoncomment(string communityid, string commentid, connectapi.communityflagvisibility visibility, integer pagesize, string pageparam) parameters communityid type: string id for an experience cloud site, internal, or null. commentid type: string id for a comment. visibility type: connectapi.communityflagvisibility visibility behavior of a flag for various user types. • moderatorsonly—the flag is visible only to users with moderation permissions on the flagged element or item. 1129apex reference guide communitymoderation class • selfandmoderators—the flag is visible to the creator of the flag and to users with moderation permissions on the flagged element or item. pagesize type: integer specifies the number of items per page. valid values are from 1 through 100. the default size is 0. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. return value type: connectapi.moderationflags usage to get moderation flags, the context user must have the moderate experiences feeds permission. getflagsonfeedelement(communityid, feedelementid) get the moderation flags on a feed element. api version 31.0 requires chatter yes signature public static connectapi.moderationcapability getflagsonfeedelement(string communityid, string feedelementid) parameters communityid type: string id for an experience cloud site, internal, or null. feedelementid type: string id of the feed element. return value type: connectapi.moderationcapability if the feed element doesn’t support this capability, the return value is connectapi.notfoundexception. 1130apex reference guide communitymoderation class usage to get moderation flags, the context user must have the moderate experiences feeds permission. getflagsonfeedelement(communityid, feedelementid, visibility) get the moderation flags with specified visibility on a feed element. api version 31.0 requires chatter yes signature public static connectapi.moderationcapability getflagsonfeedelement(string communityid, string feedelementid, connectapi.communityflagvisibility visibility) parameters communityid type: string id for an experience cloud site, internal, or null. feedelementid type: string id of the feed element. visibility type: connectapi.communityflagvisibility visibility behavior of a flag for various user types. one of these values: • moderatorsonly—the flag is visible only to users with moderation permissions on the flagged element or item. • selfandmoderators—the flag is visible to the creator of the flag and to users with moderation permissions on the flagged element or item. return value type: connectapi.moderation" "capability if the feed element doesn’t support this capability, the return value is connectapi.notfoundexception. usage to get moderation flags, the context user must have the moderate experiences feeds permission. getflagsonfeedelement(communityid, feedelementid, pageparam, pagesize) get a page of moderation flags on a feed element. 1131apex reference guide communitymoderation class api version 40.0 requires chatter yes signature public static connectapi.moderationcapability getflagsonfeedelement(string communityid, string feedelementid, string pageparam, integer pagesize) parameters communityid type: string id for an experience cloud site, internal, or null. feedelementid type: string id of the feed element. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 through 100. the default size is 0. return value type: connectapi.moderationcapability if the feed element doesn’t support this capability, the return value is connectapi.notfoundexception. usage to get moderation flags, the context user must have the moderate experiences feeds permission. getflagsonfeedelement(communityid, feedelementid, visibility, pagesize, pageparam) get a page of moderation flags with specified visibility on a feed element. api version 40.0 1132" "apex reference guide communitymoderation class requires chatter yes signature public static connectapi.moderationcapability getflagsonfeedelement(string communityid, string feedelementid, connectapi.communityflagvisibility visibility, integer pagesize, string pageparam) parameters communityid type: string id for an experience cloud site, internal, or null. feedelementid type: string id of the feed element. visibility type: connectapi.communityflagvisibility visibility behavior of a flag for various user types. • moderatorsonly—the flag is visible only to users with moderation permissions on the flagged element or item. • selfandmoderators—the flag is visible to the creator of the flag and to users with moderation permissions on the flagged element or item. pagesize type: integer specifies the number of items per page. valid values are from 1 through 100. the default size is 0. pageparam type: string page token to use to view the page. page tokens are returned as part of the response class, for example, currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. return value type: connectapi.moderationcapability if the feed element doesn’t support this capability, the return value is connectapi.notfoundexception. usage to get moderation flags, the context user must have the moderate experiences feeds permission. removeflagfromcomment(communityid, commentid, userid) remove a moderation flag from a comment. 1133apex reference guide communitymoderation class api version 29.0 requires chatter yes signature public static connectapi.moderationflags removeflagfromcomment(string communityid, string commentid, string userid) parameters communityid type: string id for an experience cloud site, internal, or null. commentid type: string id for a comment. userid type: string id of the context user for whom the flag is removed. specify null to remove the flag for all users. return value type: void usage to remove a moderation flag, the context user must have added the flag or must have the moderate experiences feeds permission. removeflagfromfeedelement(communityid, feedelementid, userid) remove a moderation flag from a feed element. api version 31.0 requires chatter yes signature public static void removeflagfromfeedelement(string communityid, string feedelementid, string userid) 1134apex reference guide communitymoderation class parameters communityid type: string id for an experience cloud site, internal, or null. feedelementid type: string id of the feed element. userid type: string id of the context user for whom the flag is removed. specify null to remove the flag for all users. return value type: connectapi.moderationcapability if the feed element doesn’t support this capability, the return value is connectapi.notfoundexception. usage to remove a moderation flag, the context user must have added the flag or must have the moderate experiences feeds permission. retired communitymoderation methods the following methods for communitymoderation are retired. in this section: addflagtofeeditem(communityid, feeditemid) add a moderation flag to a feed item. addflagtofeeditem(communityid, feeditemid, visibility) add a moderation flag with specified visibility to a feed item. getflagsonfeeditem(communityid, feeditemid) get the moderation flags on a feed item. getflagsonfeeditem(communityid, feeditemid, visibility) get the moderation flags with specified visibility on a feed item. removeflagsonfeeditem(communityid, feeditemid, userid) remove a moderation flag from a feed item. addflagtofeeditem(communityid, feeditemid) add a moderation flag to a feed item. api version 29.0–31.0 1135apex reference guide communitymoderation class important: in version 32.0 and later, use addflagtofeedelement(communityid, feedelementid). requires chatter yes signature public static connectapi.moderationflags addflagtofeeditem(string communityid, string feeditemid) parameters communityid type: string id for an experience cloud site, internal, or null. feeditemid type: string id for" "a feed item. return value type: connectapi.moderationflags usage to add a flag to a feed item, allow members to flag content must be selected for an experience cloud site. addflagtofeeditem(communityid, feeditemid, visibility) add a moderation flag with specified visibility to a feed item. api version 30.0–31.0 important: in version 32.0 and later, use addflagtofeedelement(communityid, feedelementid, visibility). requires chatter yes signature public static connectapi.moderationflags addflagtofeeditem(string communityid, string feeditemid, connectapi.communityflagvisibility visibility) 1136apex reference guide communitymoderation class parameters communityid type: string id for an experience cloud site, internal, or null. feeditemid type: string id for a feed item. visibility type: connectapi.communityflagvisibility visibility behavior of a flag for various user types. • moderatorsonly—the flag is visible only to users with moderation permissions on the flagged element or item. • selfandmoderators—the flag is visible to the creator of the flag and to users with moderation permissions on the flagged element or item. return value type: connectapi.moderationflags usage to add a flag to a feed item, allow members to flag content must be selected for an experience cloud site. getflagsonfeeditem(communityid, feeditemid) get the moderation flags on a feed item. api version 29.0–31.0 important: in version 32.0 and later, use getflagsonfeedelement(communityid, feedelementid). requires chatter yes signature public static connectapi.moderationflags getflagsonfeeditem(string communityid, string feeditemid) parameters communityid type: string id for an experience cloud site, internal, or null. 1137apex reference guide communitymoderation class feeditemid type: string id for a feed item. return value type: connectapi.moderationflags usage to get moderation flags, the context user must have the moderate experiences feeds permission. getflagsonfeeditem(communityid, feeditemid, visibility) get the moderation flags with specified visibility on a feed item. api version 30.0–31.0 important: in version 32.0 and later, use getflagsonfeedelement(communityid, feedelementid, visibility). requires chatter yes signature public static connectapi.moderationflags getflagsonfeeditem(string communityid, string feeditemid, connectapi.communityflagvisibility visibility) parameters communityid type: string id for an experience cloud site, internal, or null. feeditemid type: string id for a feed item. visibility type: connectapi.communityflagvisibility visibility behavior of a flag for various user types. values are: • moderatorsonly—the flag is visible only to users with moderation permissions on the flagged element or item. • selfandmoderators—the flag is visible to the creator of the flag and to users with moderation permissions on the flagged element or item. 1138apex reference guide communitymoderation class return value type: connectapi.moderationflags usage to get moderation flags, the context user must have the moderate experiences feeds permission. removeflagsonfeeditem(communityid, feeditemid, userid) remove a moderation flag from a feed item. api version 29.0–31.0 important: in version 32.0 and later, use removeflagfromfeedelement(communityid, feedelementid, userid). requires chatter yes signature public static connectapi.moderationflags removeflagsonfeeditem(string communityid, string feeditemid, string userid) parameters communityid type: string id for an experience cloud site, internal, or null. feeditemid type: string id for a feed item. userid type: string id of the context user for whom the flag is removed. specify null to remove the flag for all users. return value type: void usage to remove a moderation flag, the context user must have added the flag or must have the moderate experiences feeds permission. 1139apex reference guide contenthub class contenthub class access files connect repositories and their files and" "folders. namespace connectapi contenthub methods the following are methods for contenthub. all methods are static. use contenthub methods to work with files connect repositories. in this section: addrepositoryitem(repositoryid, repositoryfolderid, file) add a repository item. addrepositoryitem(communityid, repositoryid, repositoryfolderid, file) add a repository item in an experience cloud site. addrepositoryitem(repositoryid, repositoryfolderid, file, filedata) add a repository item, including the binary file. addrepositoryitem(communityid, repositoryid, repositoryfolderid, file, filedata) add a repository item, including the binary file, in an experience cloud site. getalloweditemtypes(repositoryid, repositoryfolderid) get the item types that the context user is allowed to create in the repository folder. getalloweditemtypes(repositoryid, repositoryfolderid, filter) get the item types, filtered by type, that the context user is allowed to create in the repository folder. getalloweditemtypes(communityid, repositoryid, repositoryfolderid) get the item types that the context user is allowed to create in the repository folder in an experience cloud site. getalloweditemtypes(communityid, repositoryid, repositoryfolderid, filter) get the item types, filtered by type, that the context user is allowed to create in the repository folder in an experience cloud site. getfilepreview(repositoryid, repositoryfileid, formattype) get a repository file preview. getfilepreview(repositoryid, repositoryfileid, formattype, startpagenumber, endpagenumber) get a page or page range of a repository file preview. getfilepreview(communityid, repositoryid, repositoryfileid, formattype) get a repository file preview in an experience cloud site. getfilepreview(communityid, repositoryid, repositoryfileid, formattype, startpagenumber, endpagenumber) get a page or page range of a repository file preview in an experience cloud site. getitemtype(repositoryid, repositoryitemtypeid) get information about an item type associated with a repository. getitemtype(communityid, repositoryid, repositoryitemtypeid) get information about an item type associated with a repository in an experience cloud site. 1140apex reference guide contenthub class getpreviews(repositoryid, repositoryfileid) get information about a repository file’s supported previews. getpreviews(communityid, repositoryid, repositoryfileid) get information about a repository file’s supported previews in an experience cloud site. getrepositories() get a list of repositories. getrepositories(communityid) get a list of repositories in an experience cloud site. getrepositories(pageparam, pagesize) get a page of repositories. getrepositories(communityid, pageparam, pagesize) get a page of repositories in an experience cloud site. getrepository(repositoryid) get a repository. getrepository(communityid, repositoryid) get a repository in an experience cloud site. getrepositoryfile(repositoryid, repositoryfileid) get a repository file. getrepositoryfile(repositoryid, repositoryfileid, includeexternalfilepermissionsinfo) get a repository file with or without permissions information. getrepositoryfile(communityid, repositoryid, repositoryfileid) get a repository file in an experience cloud site. getrepositoryfile(communityid, repositoryid, repositoryfileid, includeexternalfilepermissionsinfo) get a repository file with or without permissions information in an experience cloud site. getrepositoryfolder(repositoryid, repositoryfolderid) get a repository folder. getrepositoryfolder(communityid, repositoryid, repositoryfolderid) get a repository folder in an experience cloud site. getrepositoryfolderitems(repositoryid, repositoryfolderid) get repository folder items. getrepositoryfolderitems(communityid, repositoryid, repositoryfolderid) get repository folder items in an experience cloud site. getrepositoryfolderitems(repositoryid, repositoryfolderid, pageparam, pagesize) get a page of repository folder items. getrepositoryfolderitems(communityid, repositoryid, repositoryfolderid, pageparam, pagesize) get a page of repository folder items in an experience cloud site. updaterepositoryfile(repositoryid, repositoryfileid, file) update the name of a repository file. updaterepositoryfile(re" "positoryid, repositoryfileid, file, filedata) update the content of a repository file. 1141apex reference guide contenthub class updaterepositoryfile(communityid, repositoryid, repositoryfileid, file) update the name of a repository file in an experience cloud site. updaterepositoryfile(communityid, repositoryid, repositoryfileid, file, filedata) update the content of a repository file in an experience cloud site. addrepositoryitem(repositoryid, repositoryfolderid, file) add a repository item. api version 39.0 requires chatter no signature public static connectapi.repositoryfolderitem addrepositoryitem(string repositoryid, string repositoryfolderid, connectapi.contenthubiteminput file) parameters repositoryid type: string the id of the repository. repositoryfolderid type: string the id of the repository folder. file type: connectapi.contenthubiteminput the item type id and fields of the item type. return value type: connectapi.repositoryfolderitem usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. 1142apex reference guide contenthub class example this example creates a file without binary content (metadata only) in a google drive repository folder. after the file is created, we show the file’s id, name, description, external url, and download url. final string gdriverepositoryid = '0xcxx00000000odgay', gdrivefolderid = 'folder:0b0ltys1kmm3ssvj2bjiztgfqsws'; final connectapi.contenthubiteminput newitem = new connectapi.contenthubiteminput(); newitem.itemtypeid = 'document'; //see getallowedtypes for any file item types available for creation/update newitem.fields = new list(); //metadata: name field final connectapi.contenthubfieldvalueinput fieldvalueinput = new connectapi.contenthubfieldvalueinput(); fieldvalueinput.name = 'name'; fieldvalueinput.value = 'new folder item name.txt'; newitem.fields.add(fieldvalueinput); //metadata: description field final connectapi.contenthubfieldvalueinput fieldvalueinputdesc = new connectapi.contenthubfieldvalueinput(); fieldvalueinputdesc.name = 'description'; fieldvalueinputdesc.value = 'it does describe it'; newitem.fields.add(fieldvalueinputdesc); final connectapi.repositoryfolderitem newfolderitem = connectapi.contenthub.addrepositoryitem(gdriverepositoryid, gdrivefolderid, newitem); final connectapi.repositoryfilesummary newfile = newfolderitem.file; system.debug(string.format('new file - id: \'\'{0}\'\', name: \'\'{1}\'\', description: \'\'{2}\'\' \n external url: \'\'{3}\'\', download url: \'\'{4}\'\'', new string[]{ newfile.id, newfile.name, newfile.description, newfile.externaldocumenturl, newfile.downloadurl})); see also: settestaddrepositoryitem(repositoryid, repositoryfolderid, file, result) apex developer guide: testing connectapi code addrepositoryitem(communityid, repositoryid, repositoryfolderid, file) add a repository item in an experience cloud site. api version 39.0 requires chatter no 1143apex reference guide contenthub class signature public static connectapi.repositoryfolderitem addrepositoryitem(string communityid, string repositoryid, string repositoryfolderid, connectapi.contenthubiteminput file) parameters communityid type: string id for an experience cloud site, internal, or null. repositoryid type: string the id of the repository. repositoryfolderid type: string the id of the repository folder. file type: connectapi.contenthubiteminput the item type id and fields of the item type. return value type: connectapi.repositoryfolderitem usage to test code that uses this method, use the matching set test method (" "prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestaddrepositoryitem(communityid, repositoryid, repositoryfolderid, file, result) apex developer guide: testing connectapi code addrepositoryitem(repositoryid, repositoryfolderid, file, filedata) add a repository item, including the binary file. api version 39.0 requires chatter no 1144apex reference guide contenthub class signature public static connectapi.repositoryfolderitem addrepositoryitem(string repositoryid, string repositoryfolderid, connectapi.contenthubiteminput file, connectapi.binaryinput filedata) parameters repositoryid type: string the id of the repository. repositoryfolderid type: string the id of the repository folder. file type: connectapi.contenthubiteminput the item type id and fields of the item type. filedata type: connectapi.binaryinput the binary file. return value type: connectapi.repositoryfolderitem usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. example this example creates a file with binary content and metadata in a google drive repository folder. after the file is created, we show the file’s id, name, description, external url, and download url. final string gdriverepositoryid = '0xcxx00000000odgay', gdrivefolderid = 'folder:0b0ltys1kmm3ssvj2bjiztgfqsws'; final connectapi.contenthubiteminput newitem = new connectapi.contenthubiteminput(); newitem.itemtypeid = 'document'; //see getallowedtypes for any file item types available for creation/update newitem.fields = new list(); //metadata: name field final string newfilename = 'new folder item name.txt'; final connectapi.contenthubfieldvalueinput fieldvalueinput = new connectapi.contenthubfieldvalueinput(); fieldvalueinput.name = 'name'; fieldvalueinput.value = newfilename; newitem.fields.add(fieldvalueinput); 1145apex reference guide contenthub class //metadata: description field final connectapi.contenthubfieldvalueinput fieldvalueinputdesc = new connectapi.contenthubfieldvalueinput(); fieldvalueinputdesc.name = 'description'; fieldvalueinputdesc.value = 'it does describe it'; newitem.fields.add(fieldvalueinputdesc); //binary content final blob newfileblob = blob.valueof('awesome content for brand new file'); final string newfilemimetype = 'text/plain'; final connectapi.binaryinput filebinaryinput = new connectapi.binaryinput(newfileblob, newfilemimetype, newfilename); final connectapi.repositoryfolderitem newfolderitem = connectapi.contenthub.addrepositoryitem(gdriverepositoryid, gdrivefolderid, newitem, filebinaryinput); final connectapi.repositoryfilesummary newfile = newfolderitem.file; system.debug(string.format('new file - id: \'\'{0}\'\', name: \'\'{1}\'\', description: \'\'{2}\'\' \n external url: \'\'{3}\'\', download url: \'\'{4}\'\'', new string[]{ newfile.id, newfile.name, newfile.description, newfile.externaldocumenturl, newfile.downloadurl})); see also: settestaddrepositoryitem(repositoryid, repositoryfolderid, file, filedata, result) apex developer guide: testing connectapi code addrepositoryitem(communityid, repositoryid, repositoryfolderid, file, filedata) add a repository item, including the binary file, in an experience cloud site. api version 39.0 requires chatter no signature public static connectapi.repositoryfolderitem addrepositoryitem(string communityid, string repositoryid, string repositoryfolderid, connectapi.contenthubiteminput file, connectapi" ".binaryinput filedata) parameters communityid type: string 1146apex reference guide contenthub class id for an experience cloud site, internal, or null. repositoryid type: string the id of the repository. repositoryfolderid type: string the id of the repository folder. file type: connectapi.contenthubiteminput the item type id and fields of the item type. filedata type: connectapi.binaryinput the binary file. return value type: connectapi.repositoryfolderitem usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestaddrepositoryitem(communityid, repositoryid, repositoryfolderid, file, filedata, result) apex developer guide: testing connectapi code getalloweditemtypes(repositoryid, repositoryfolderid) get the item types that the context user is allowed to create in the repository folder. api version 39.0 requires chatter no signature public static connectapi.contenthuballoweditemtypecollection getalloweditemtypes(string repositoryid, string repositoryfolderid) 1147apex reference guide contenthub class parameters repositoryid type: string the id of the repository. repositoryfolderid type: string the id of the repository folder. return value type: connectapi.contenthuballoweditemtypecollection usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestgetalloweditemtypes(repositoryid, repositoryfolderid, result) apex developer guide: testing connectapi code getalloweditemtypes(repositoryid, repositoryfolderid, filter) get the item types, filtered by type, that the context user is allowed to create in the repository folder. api version 39.0 requires chatter no signature public static connectapi.contenthuballoweditemtypecollection getalloweditemtypes(string repositoryid, string repositoryfolderid, connectapi.connectcontenthubitemtype filter) parameters repositoryid type: string the id of the repository. repositoryfolderid type: string the id of the repository folder. 1148apex reference guide contenthub class filter type: connectapi.contenthubitemtype item types. values are: • any—includes files and folders. • filesonly—includes files only. • foldersonly—includes folders only. return value type: connectapi.contenthuballoweditemtypecollection usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. example this example calls getalloweditemtypes(repositoryid, repositoryfolderid, connectapi.contenthubitemtype.filesonly) to get the first connectapi.contenthubitemtypesummary.id of a file. the context user can create allowed files in a repository folder in the external system. final connectapi.contenthuballoweditemtypecollection alloweditemtypescoll = connectapi.contenthub.getalloweditemtypes(repositoryid, repositoryfolderid, connectapi.contenthubitemtype.filesonly); final list alloweditemtypes = alloweditemtypescoll.alloweditemtypes; string allowedfileitemtypeid = null; if(alloweditemtypes.size() > 0){ connectapi.contenthubitemtypesummary alloweditemtypesummary = alloweditemtypes.get(0); allowedfileitemtypeid = alloweditemtypesummary.id; } see also: settestgetalloweditemtypes(repositoryid, repositoryfolderid, filter, result) apex developer guide: testing connectapi code getalloweditemtypes(communityid, repositoryid, repositoryfolderid) get the item types that the context user is allowed to create in the repository folder in an experience cloud site. api version 39.0 requires chatter no 1149apex reference guide contenthub class signature public static connectapi.contenthuballoweditemtypecollection getalloweditem" "types(string communityid, string repositoryid, string repositoryfolderid) parameters communityid type: string id for an experience cloud site, internal, or null. repositoryid type: string the id of the repository. repositoryfolderid type: string the id of the repository folder. return value type: connectapi.contenthuballoweditemtypecollection usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestgetalloweditemtypes(communityid, repositoryid, repositoryfolderid, result) apex developer guide: testing connectapi code getalloweditemtypes(communityid, repositoryid, repositoryfolderid, filter) get the item types, filtered by type, that the context user is allowed to create in the repository folder in an experience cloud site. api version 39.0 requires chatter no signature public static connectapi.contenthuballoweditemtypecollection getalloweditemtypes(string communityid, string repositoryid, string repositoryfolderid, connectapi.connectcontenthubitemtype filter) 1150apex reference guide contenthub class parameters communityid type: string id for an experience cloud site, internal, or null. repositoryid type: string the id of the repository. repositoryfolderid type: string the id of the repository folder. filter type: connectapi.contenthubitemtype item types. values are: • any—includes files and folders. • filesonly—includes files only. • foldersonly—includes folders only. return value type: connectapi.contenthuballoweditemtypecollection usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestgetalloweditemtypes(communityid, repositoryid, repositoryfolderid, filter, result) apex developer guide: testing connectapi code getfilepreview(repositoryid, repositoryfileid, formattype) get a repository file preview. api version 39.0 requires chatter no signature public static connectapi.filepreview getfilepreview(string repositoryid, string repositoryfileid, connectapi.filepreviewformat formattype) 1151apex reference guide contenthub class parameters repositoryid type: string the id of the repository. repositoryfileid type: string the id of the repository file. formattype type: connectapi.filepreviewformat specifies the format of the file preview. values are: • jpg—preview format is jpg. • pdf—preview format is pdf. • svg—preview format is compressed svg. • thumbnail—preview format is 240 x 180 png. • thumbnailbig—preview format is 720 x 480 png. • thumbnailtiny—preview format is 120 x 90 png. pdf previews are available for files of type doc, docx, ppt, pptx, text, xls, and xlsx.svg files are generated on demand. if you’re concerned that feature-rich svg previews don’t work in your org, choose alternative file previews. to use jpg file previews, enter general in the quick find box in setup. select general settings, and then select display alternative file previews. return value type: connectapi.filepreview usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. example this example calls getfilepreview(repositoryid, repositoryfileid, connectapi.filepreviewformat.thumbnail) to get the thumbnail format preview along with its respective url and number of thumbnail renditions. for each thumbnail format, we show every rendition url available. final string gdriverepositoryid = '0xcxx00000000odgay', gdrivefileid = 'document:1-zca1baeoqbo2_ynfihcck6qjtpmoke-khfc4tyg3rk';final connectapi.filepreview filepreview = connectapi.contenthub.getfilepreview(gdriverepositoryid, gdrivefileid, connecta" "pi.filepreviewformat.thumbnail);system.debug(string.format('preview - url: \'\'{0}\'\', format: \'\'{1}\'\', nbr of renditions for this format: {2}', new string[]{ filepreview.url, filepreview.format.name(),string.valueof(filepreview.previewurls.size())}));for(connectapi.filepreviewurl filepreviewurl : filepreview.previewurls){ 1152apex reference guide contenthub class system.debug('-----> rendition url: ' + filepreviewurl.previewurl); } see also: settestgetfilepreview(repositoryid, repositoryfileid, formattype, result) apex developer guide: testing connectapi code getfilepreview(repositoryid, repositoryfileid, formattype, startpagenumber, endpagenumber) get a page or page range of a repository file preview. api version 39.0 requires chatter no signature public static connectapi.filepreview getfilepreview(string repositoryid, string repositoryfileid, connectapi.filepreviewformat formattype, integer startpagenumber, integer endpagenumber) parameters repositoryid type: string the id of the repository. repositoryfileid type: string the id of the repository file. formattype type: connectapi.filepreviewformat specifies the format of the file preview. values are: • jpg—preview format is jpg. • pdf—preview format is pdf. • svg—preview format is compressed svg. • thumbnail—preview format is 240 x 180 png. • thumbnailbig—preview format is 720 x 480 png. • thumbnailtiny—preview format is 120 x 90 png. pdf previews are available for files of type doc, docx, ppt, pptx, text, xls, and xlsx.svg files are generated on demand. 1153apex reference guide contenthub class if you’re concerned that feature-rich svg previews don’t work in your org, choose alternative file previews. to use jpg file previews, enter general in the quick find box in setup. select general settings, and then select display alternative file previews. startpagenumber type: integer the starting page number in the range of file preview urls. endpagenumber type: integer the ending page number in the range of file preview urls. return value type: connectapi.filepreview usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestgetfilepreview(repositoryid, repositoryfileid, formattype, startpagenumber, endpagenumber, result) apex developer guide: testing connectapi code getfilepreview(communityid, repositoryid, repositoryfileid, formattype) get a repository file preview in an experience cloud site. api version 39.0 requires chatter no signature public static connectapi.filepreview getfilepreview(string communityid, string repositoryid, string repositoryfileid, connectapi.filepreviewformat formattype) parameters communityid type: string id for an experience cloud site, internal, or null. repositoryid type: string the id of the repository. 1154apex reference guide contenthub class repositoryfileid type: string the id of the repository file. formattype type: connectapi.filepreviewformat specifies the format of the file preview. values are: • jpg—preview format is jpg. • pdf—preview format is pdf. • svg—preview format is compressed svg. • thumbnail—preview format is 240 x 180 png. • thumbnailbig—preview format is 720 x 480 png. • thumbnailtiny—preview format is 120 x 90 png. pdf previews are available for files of type doc, docx, ppt, pptx, text, xls, and xlsx.svg files are generated on demand. if you’re concerned that feature-rich svg previews don’t work in your org, choose alternative file previews. to use jpg file previews, enter general in the quick find box in setup. select general settings, and then select display alternative file previews. return value type: connectapi.filepreview usage" "to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestgetfilepreview(communityid, repositoryid, repositoryfileid, formattype, result) apex developer guide: testing connectapi code getfilepreview(communityid, repositoryid, repositoryfileid, formattype, startpagenumber, endpagenumber) get a page or page range of a repository file preview in an experience cloud site. api version 39.0 requires chatter no 1155apex reference guide contenthub class signature public static connectapi.filepreview getfilepreview(string communityid, string repositoryid, string repositoryfileid, connectapi.filepreviewformat formattype, integer startpagenumber, integer endpagenumber) parameters communityid type: string id for an experience cloud site, internal, or null. repositoryid type: string the id of the repository. repositoryfileid type: string the id of the repository file. formattype type: connectapi.filepreviewformat specifies the format of the file preview. values are: • jpg—preview format is jpg. • pdf—preview format is pdf. • svg—preview format is compressed svg. • thumbnail—preview format is 240 x 180 png. • thumbnailbig—preview format is 720 x 480 png. • thumbnailtiny—preview format is 120 x 90 png. pdf previews are available for files of type doc, docx, ppt, pptx, text, xls, and xlsx.svg files are generated on demand. if you’re concerned that feature-rich svg previews don’t work in your org, choose alternative file previews. to use jpg file previews, enter general in the quick find box in setup. select general settings, and then select display alternative file previews. startpagenumber type: integer the starting page number in the range of file preview urls. endpagenumber type: integer the ending page number in the range of file preview urls. return value type: connectapi.filepreview 1156apex reference guide contenthub class usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestgetfilepreview(communityid, repositoryid, repositoryfileid, formattype, startpagenumber, endpagenumber, result) apex developer guide: testing connectapi code getitemtype(repositoryid, repositoryitemtypeid) get information about an item type associated with a repository. api version 39.0 requires chatter no signature public static connectapi.contenthubitemtypedetail getitemtype(string repositoryid, string repositoryitemtypeid) parameters repositoryid type: string the id of the repository. repositoryitemtypeid type: string the id of the repository item type. return value type: connectapi.contenthubitemtypedetail usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestgetitemtype(repositoryid, repositoryitemtypeid, result) apex developer guide: testing connectapi code 1157apex reference guide contenthub class getitemtype(communityid, repositoryid, repositoryitemtypeid) get information about an item type associated with a repository in an experience cloud site. api version 39.0 requires chatter no signature public static connectapi.contenthubitemtypedetail getitemtype(string communityid, string repositoryid, string repositoryitemtypeid) parameters communityid type: string id for an experience cloud site, internal, or null. repositoryid type: string the id of the repository. repositoryitemtypeid type: string the id of the repository item type. return value type: connectapi.contenthubitemtypedetail usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestgetitemtype" "(communityid, repositoryid, repositoryitemtypeid, result) apex developer guide: testing connectapi code getpreviews(repositoryid, repositoryfileid) get information about a repository file’s supported previews. 1158apex reference guide contenthub class api version 39.0 requires chatter no signature public static connectapi.filepreviewcollection getpreviews(string repositoryid, string repositoryfileid) parameters repositoryid type: string the id of the repository. repositoryfileid type: string the id of the repository file. return value type: connectapi.filepreviewcollection usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. example this example gets all supported preview formats and their respective urls and number of renditions. for each supported preview format, we show every rendition url available. final string gdriverepositoryid = '0xcxx00000000odgay', gdrivefileid = 'document:1-zca1baeoqbo2_ynfihcck6qjtpmoke-khfc4tyg3rk'; final connectapi.filepreviewcollection previewscollection = connectapi.contenthub.getpreviews(gdriverepositoryid, gdrivefileid); for(connectapi.filepreview filepreview : previewscollection.previews){ system.debug(string.format('preview - url: \'\'{0}\'\', format: \'\'{1}\'\', nbr of renditions for this format: {2}', new string[]{ filepreview.url, filepreview.format.name(),string.valueof(filepreview.previewurls.size())})); for(connectapi.filepreviewurl filepreviewurl : filepreview.previewurls){ system.debug('-----> rendition url: ' + filepreviewurl.previewurl); 1159apex reference guide contenthub class } } see also: settestgetpreviews(repositoryid, repositoryfileid, result) apex developer guide: testing connectapi code getpreviews(communityid, repositoryid, repositoryfileid) get information about a repository file’s supported previews in an experience cloud site. api version 39.0 requires chatter no signature public static connectapi.filepreviewcollection getpreviews(string communityid, string repositoryid, string repositoryfileid) parameters communityid type: string id for an experience cloud site, internal, or null. repositoryid type: string the id of the repository. repositoryfileid type: string the id of the repository file. return value type: connectapi.filepreviewcollection 1160apex reference guide contenthub class usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestgetpreviews(communityid, repositoryid, repositoryfileid, result) apex developer guide: testing connectapi code getrepositories() get a list of repositories. api version 39.0 requires chatter no signature public static connectapi.contenthubrepositorycollection getrepositories() return value type: connectapi.contenthubrepositorycollection usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. example this example gets all repositories and gets the first sharepoint online repository found. final string sharepointonlineprovidertype ='contenthubsharepointoffice365'; final connectapi.contenthubrepositorycollection repositorycollection = connectapi.contenthub.getrepositories(); connectapi.contenthubrepository sharepointonlinerepository = null; for(connectapi.contenthubrepository repository : repositorycollection.repositories){ if(sharepointonlineprovidertype.equalsignorecase(repository.providertype.type)){ sharepointonlinerepository = repository; break; 1161apex reference guide contenthub class } } see also: settestgetrepositories(result) apex developer guide:" "testing connectapi code getrepositories(communityid) get a list of repositories in an experience cloud site. api version 39.0 requires chatter no signature public static connectapi.contenthubrepositorycollection getrepositories(string communityid) parameters communityid type: string id for an experience cloud site, internal, or null. return value type: connectapi.contenthubrepositorycollection usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestgetrepositories(communityid, result) apex developer guide: testing connectapi code getrepositories(pageparam, pagesize) get a page of repositories. 1162apex reference guide contenthub class api version 39.0 requires chatter no signature public static connectapi.contenthubrepositorycollection getrepositories(integer pageparam, integer pagesize) parameters pageparam type: integer number of the page you want returned. starts at 0. if you pass in null or 0, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 through 100. if you pass in null, the default page size is 25. return value type: connectapi.contenthubrepositorycollection usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestgetrepositories(pageparam, pagesize, result) apex developer guide: testing connectapi code getrepositories(communityid, pageparam, pagesize) get a page of repositories in an experience cloud site. api version 39.0 requires chatter no 1163apex reference guide contenthub class signature public static connectapi.contenthubrepositorycollection getrepositories(string communityid, integer pageparam, integer pagesize) parameters communityid type: string id for an experience cloud site, internal, or null. pageparam type: integer number of the page you want returned. starts at 0. if you pass in null or 0, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 through 100. if you pass in null, the default page size is 25. return value type: connectapi.contenthubrepositorycollection usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestgetrepositories(communityid, pageparam, pagesize, result) apex developer guide: testing connectapi code getrepository(repositoryid) get a repository. api version 369.0 requires chatter no signature public static connectapi.contenthubrepository getrepository(string repositoryid) 1164apex reference guide contenthub class parameters repositoryid type: string the id of the repository. return value type: connectapi.contenthubrepository usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. example final string repositoryid = '0xcxx0000000123gaa'; final connectapi.contenthubrepository repository = connectapi.contenthub.getrepository(repositoryid); see also: settestgetrepository(repositoryid, result) apex developer guide: testing connectapi code getrepository(communityid, repositoryid) get a repository in an experience cloud site. api version 39.0 requires chatter no signature public static connectapi.contenthubrepository getrepository(string communityid, string repositoryid) parameters communityid type: string id for an experience cloud site, internal, or null. repositoryid type: string 1165apex reference guide contenthub class the id of the repository. return value type: connectapi.contenthubrepository usage to test code that uses this method, use the matching set test method (prefix the method" "name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestgetrepository(communityid, repositoryid, result) apex developer guide: testing connectapi code getrepositoryfile(repositoryid, repositoryfileid) get a repository file. api version 39.0 requires chatter no signature public static connectapi.repositoryfiledetail getrepositoryfile(string repositoryid, string repositoryfileid) parameters repositoryid type: string the id of the repository. repositoryfileid type: string the id of the repository file. return value type: connectapi.repositoryfiledetail usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. 1166apex reference guide contenthub class example final string gdriverepositoryid = '0xcxx00000000odgay', gdrivefileid = 'file:0b0ltys1kmm3stmxknjvjbwzja00'; final connectapi.repositoryfiledetail file = connectapi.contenthub.getrepositoryfile(gdriverepositoryid, gdrivefileid); system.debug(string.format('file - name: \'\'{0}\'\', size: {1}, external url: \'\'{2}\'\', download url: \'\'{3}\'\'', new string[]{ file.name, string.valueof(file.contentsize), file.externaldocumenturl, file.downloadurl})); see also: settestgetrepositoryfile(repositoryid, repositoryfileid, result) apex developer guide: testing connectapi code getrepositoryfile(repositoryid, repositoryfileid, includeexternalfilepermissionsinfo) get a repository file with or without permissions information. api version 39.0 requires chatter no signature public static connectapi.repositoryfiledetail getrepositoryfile(string repositoryid, string repositoryfileid, boolean includeexternalfilepermissionsinfo) parameters repositoryid type: string the id of the repository. repositoryfileid type: string the id of the repository file. includeexternalfilepermissionsinfo type: boolean specifies whether to include permission information, such as whether the file is shared and what are the available permission types. managing external file permissions is supported for google drive, sharepoint online, and onedrive for business. 1167apex reference guide contenthub class return value type: connectapi.repositoryfiledetail usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. example final string gdriverepositoryid = '0xcxx00000000odgay', gdrivefileid = 'file:0b0ltys1kmm3stmxknjvjbwzja00'; final connectapi.repositoryfiledetail file = connectapi.contenthub.getrepositoryfile(gdriverepositoryid, gdrivefileid, true); system.debug(string.format('file - name: \'\'{0}\'\', size: {1}, external url: \'\'{2}\'\', download url: \'\'{3}\'\'', new string[]{ file.name, string.valueof(file.contentsize), file.externaldocumenturl, file.downloadurl})); final connectapi.externalfilepermissioninformation externalfileperminfo = file.externalfilepermissioninformation; //permission types final list permissiontypes = externalfileperminfo.externalfilepermissiontypes; for(connectapi.contenthubpermissiontype permissiontype : permissiontypes){ system.debug(string.format('permission type - id: \'\'{0}\'\', label: \'\'{1}\'\'', new string[]{ permissiontype.id, permissiontype.label})); } //permission groups final list groups = externalfileperminfo.repositorypublicgroups; for(connectapi.repositorygroupsummary ggroup : groups" "){ system.debug(string.format('group - id: \'\'{0}\'\', name: \'\'{1}\'\', type: \'\'{2}\'\'', new string[]{ ggroup.id, ggroup.name, ggroup.type.name()})); } see also: settestgetrepositoryfile(repositoryid, repositoryfileid, includeexternalfilepermissionsinfo, result) apex developer guide: testing connectapi code getrepositoryfile(communityid, repositoryid, repositoryfileid) get a repository file in an experience cloud site. api version 39.0 1168apex reference guide contenthub class requires chatter no signature public static connectapi.repositoryfiledetail getrepositoryfile(string communityid, string repositoryid, string repositoryfileid) parameters communityid type: string id for an experience cloud site, internal, or null. repositoryid type: string the id of the repository. repositoryfileid type: string the id of the repository file. return value type: connectapi.repositoryfiledetail usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestgetrepositoryfile(communityid, repositoryid, repositoryfileid, result) apex developer guide: testing connectapi code getrepositoryfile(communityid, repositoryid, repositoryfileid, includeexternalfilepermissionsinfo) get a repository file with or without permissions information in an experience cloud site. api version 39.0 requires chatter no 1169apex reference guide contenthub class signature public static connectapi.repositoryfiledetail getrepositoryfile(string communityid, string repositoryid, string repositoryfileid, boolean includeexternalfilepermissionsinfo) parameters communityid type: string id for an experience cloud site, internal, or null. repositoryid type: string the id of the repository. repositoryfileid type: string the id of the repository file. includeexternalfilepermissionsinfo type: boolean specifies whether to include permission information, such as whether the file is shared and what are the available permission types. managing external file permissions is supported for google drive, sharepoint online, and onedrive for business. return value type: connectapi.repositoryfiledetail usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestgetrepositoryfile(communityid, repositoryid, repositoryfileid, includeexternalfilepermissionsinfo, result) apex developer guide: testing connectapi code getrepositoryfolder(repositoryid, repositoryfolderid) get a repository folder. api version 39.0 requires chatter no 1170apex reference guide contenthub class signature public static connectapi.repositoryfolderdetail getrepositoryfolder(string repositoryid, string repositoryfolderid) parameters repositoryid type: string the id of the repository. repositoryfolderid type: string the id of the repository folder. return value type: connectapi.repositoryfolderdetail usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. example final string gdriverepositoryid = '0xcxx00000000odgay', gdrivefolderid = 'folder:0b0ltys1kmm3ssvj2bjiztgfqsws'; final connectapi.repositoryfolderdetail folder = connectapi.contenthub.getrepositoryfolder(gdriverepositoryid, gdrivefolderid); system.debug(string.format('folder - name: \'\'{0}\'\', description: \'\'{1}\'\', external url: \'\'{2}\'\', folder items url: \'\'{3}\'\'', new string[]{ folder.name, folder.description, folder.externalfolderurl, folder.folderitemsurl})); see also: settestgetrepositoryfolder(repositoryid, repositoryfolderid, result" ") apex developer guide: testing connectapi code getrepositoryfolder(communityid, repositoryid, repositoryfolderid) get a repository folder in an experience cloud site. api version 39.0 requires chatter no 1171apex reference guide contenthub class signature public static connectapi.repositoryfolderdetail getrepositoryfolder(string communityid, string repositoryid, string repositoryfolderid) parameters communityid type: string id for an experience cloud site, internal, or null. repositoryid type: string the id of the repository. repositoryfolderid type: string the id of the repository folder. return value type: connectapi.repositoryfolderdetail usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestgetrepositoryfolder(communityid, repositoryid, repositoryfolderid, result) apex developer guide: testing connectapi code getrepositoryfolderitems(repositoryid, repositoryfolderid) get repository folder items. api version 39.0 requires chatter no signature public static connectapi.repositoryfolderitemscollection getrepositoryfolderitems(string repositoryid, string repositoryfolderid) 1172apex reference guide contenthub class parameters repositoryid type: string the id of the repository. repositoryfolderid type: string the id of the repository folder. return value type: connectapi.repositoryfolderitemscollection usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. example this example gets the collection of items in a repository folder. for files, we show the file’s name, size, external url, and download url. for folders, we show the folder’s name, description, and external url. final string gdriverepositoryid = '0xcxx00000000odgay', gdrivefolderid = 'folder:0b0ltys1kmm3ssvj2bjiztgfqsws'; final connectapi.repositoryfolderitemscollection folderitemscoll = connectapi.contenthub.getrepositoryfolderitems(gdriverepositoryid,gdrivefolderid); final list folderitems = folderitemscoll.items; system.debug('number of items in repository folder: ' + folderitems.size()); for(connectapi.repositoryfolderitem item : folderitems){ connectapi.repositoryfilesummary filesummary = item.file; if(filesummary != null){ system.debug(string.format('file item - name: \'\'{0}\'\', size: {1}, external url: \'\'{2}\'\', download url: \'\'{3}\'\'', new string[]{ filesummary.name, string.valueof(filesummary.contentsize), filesummary.externaldocumenturl, filesummary.downloadurl})); }else{ connectapi.repositoryfoldersummary foldersummary = item.folder; system.debug(string.format('folder item - name: \'\'{0}\'\', description: \'\'{1}\'\'', new string[]{ foldersummary.name, foldersummary.description})); } } see also: settestgetrepositoryfolderitems(repositoryid, repositoryfolderid, result) apex developer guide: testing connectapi code getrepositoryfolderitems(communityid, repositoryid, repositoryfolderid) get repository folder items in an experience cloud site. 1173apex reference guide contenthub class api version 39.0 requires chatter no signature public static connectapi.repositoryfolderitemscollection getrepositoryfolderitems(string communityid, string repositoryid, string repositoryfolderid) parameters communityid type: string id for an experience cloud site, internal, or null. repositoryid type: string the id of the repository. repositoryfolderid type: string the id of the repository folder. return value type: connectapi.repositoryfolderitemscollection usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the" "set test method with the same parameters or the code throws an exception. see also: settestgetrepositoryfolderitems(communityid, repositoryid, repositoryfolderid, result) apex developer guide: testing connectapi code getrepositoryfolderitems(repositoryid, repositoryfolderid, pageparam, pagesize) get a page of repository folder items. api version 39.0 1174apex reference guide contenthub class requires chatter no signature public static connectapi.repositoryfolderitemscollection getrepositoryfolderitems(string repositoryid, string repositoryfolderid, integer pageparam, integer pagesize) parameters repositoryid type: string the id of the repository. repositoryfolderid type: string the id of the repository folder. pageparam type: integer number of the page you want returned. starts at 0. if you pass in null or 0, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 through 100. if you pass in null, the default page size is 25. return value type: connectapi.repositoryfolderitemscollection usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestgetrepositoryfolderitems(repositoryid, repositoryfolderid, pageparam, pagesize, result) apex developer guide: testing connectapi code getrepositoryfolderitems(communityid, repositoryid, repositoryfolderid, pageparam, pagesize) get a page of repository folder items in an experience cloud site. api version 39.0 1175apex reference guide contenthub class requires chatter no signature public static connectapi.repositoryfolderitemscollection getrepositoryfolderitems(string communityid, string repositoryid, string repositoryfolderid, integer pageparam, integer pagesize) parameters communityid type: string id for an experience cloud site, internal, or null. repositoryid type: string the id of the repository. repositoryfolderid type: string the id of the repository folder. pageparam type: integer number of the page you want returned. starts at 0. if you pass in null or 0, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 through 100. if you pass in null, the default page size is 25. return value type: connectapi.repositoryfolderitemscollection usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestgetrepositoryfolderitems(communityid, repositoryid, repositoryfolderid, pageparam, pagesize, result) apex developer guide: testing connectapi code updaterepositoryfile(repositoryid, repositoryfileid, file) update the name of a repository file. 1176apex reference guide contenthub class api version 39.0 requires chatter no signature public static connectapi.repositoryfiledetail updaterepositoryfile(string repositoryid, string repositoryfileid, connectapi.contenthubiteminput file) parameters repositoryid type: string the id of the repository. repositoryfileid type: string the id of the repository file. file type: connectapi.contenthubiteminput the item type id and fields of the item type. when updating the metadata of a repository file, only the name field can be updated. return value type: connectapi.repositoryfiledetail usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. example this example updates the name of a file in a google drive repository. after the file is updated, we show the file’s id, name, description, external url, download url. final string gdriverepositoryid = '0xcxx00000000odgay', gdrivefolderid = 'folder:0b0ltys1kmm3ssvj2bjiztgfqsws', gdrivefileid = 'document:1q9oatv" "pcyybk-jwzp_phr75ulqghwfp15zhkamkrrcq'; final connectapi.contenthubiteminput updateditem = new connectapi.contenthubiteminput(); updateditem.itemtypeid = 'document'; //see getallowedtypes for any file item types available for creation/update updateditem.fields = new list(); //metadata: name field 1177apex reference guide contenthub class final connectapi.contenthubfieldvalueinput fieldvalueinputname = new connectapi.contenthubfieldvalueinput(); fieldvalueinputname.name = 'name'; fieldvalueinputname.value = 'updated file name.txt'; updateditem.fields.add(fieldvalueinputname); final connectapi.repositoryfiledetail updatedfile = connectapi.contenthub.updaterepositoryfile(gdriverepositoryid, gdrivefileid, updateditem); system.debug(string.format('updated file - id: \'\'{0}\'\', name: \'\'{1}\'\', description: \'\'{2}\'\',\n external url: \'\'{3}\'\', download url: \'\'{4}\'\'', new string[]{ updatedfile.id, updatedfile.name, updatedfile.description, updatedfile.externaldocumenturl, updatedfile.downloadurl})); see also: settestupdaterepositoryfile(communityid, repositoryid, repositoryfileid, file, filedata, result) apex developer guide: testing connectapi code updaterepositoryfile(repositoryid, repositoryfileid, file, filedata) update the content of a repository file. api version 39.0 requires chatter no signature public static connectapi.repositoryfiledetail updaterepositoryfile(string repositoryid, string repositoryfileid, connectapi.contenthubiteminput file, connectapi.binaryinput filedata) parameters repositoryid type: string the id of the repository. repositoryfileid type: string the id of the repository file. file type: connectapi.contenthubiteminput the item type id and fields of the item type. when updating the metadata of a repository file, only the name field can be updated. 1178apex reference guide contenthub class filedata type: connectapi.binaryinput the binary file. return value type: connectapi.repositoryfiledetail usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. example this example updates the content and name of a file in a google drive repository. after the file is updated, we show the file’s id, name, description, external url, and download url. final string gdriverepositoryid = '0xcxx00000000odgay', gdrivefolderid = 'folder:0b0ltys1kmm3ssvj2bjiztgfqsws', gdrivefileid = 'document:1q9oatvpcyybk-jwzp_phr75ulqghwfp15zhkamkrrcq'; final connectapi.contenthubiteminput updateditem = new connectapi.contenthubiteminput(); updateditem.itemtypeid = 'document'; //see getallowedtypes for any file item types available for creation/update updateditem.fields = new list(); //metadata: name field final connectapi.contenthubfieldvalueinput fieldvalueinputname = new connectapi.contenthubfieldvalueinput(); fieldvalueinputname.name = 'name'; fieldvalueinputname.value = 'updated file name.txt'; updateditem.fields.add(fieldvalueinputname); //binary content final blob updatedfileblob = blob.valueof('even more awesome content for updated file'); final string updatedfilemimetype = 'text/plain'; final connectapi.binaryinput filebinaryinput = new connectapi.binaryinput(updatedfileblob, updatedfilemimetype, updatedfilename); final connectapi.repositoryfiledetail updatedfile = connectapi.contenthub.updaterepositoryfile(gdriverep" "ositoryid, gdrivefileid, updateditem); system.debug(string.format('updated file - id: \'\'{0}\'\', name: \'\'{1}\'\', description: \'\'{2}\'\',\n external url: \'\'{3}\'\', download url: \'\'{4}\'\'', new string[]{ updatedfile.id, updatedfile.name, updatedfile.description, updatedfile.externaldocumenturl, updatedfile.downloadurl})); see also: settestupdaterepositoryfile(repositoryid, repositoryfileid, file, result) apex developer guide: testing connectapi code 1179apex reference guide contenthub class updaterepositoryfile(communityid, repositoryid, repositoryfileid, file) update the name of a repository file in an experience cloud site. api version 39.0 requires chatter no signature public static connectapi.repositoryfiledetail updaterepositoryfile(string communityid, string repositoryid, string repositoryfileid, connectapi.contenthubiteminput file) parameters communityid type: string id for an experience cloud site, internal, or null. repositoryid type: string the id of the repository. repositoryfileid type: string the id of the repository file. file type: connectapi.contenthubiteminput the item type id and fields of the item type. when updating the metadata of a repository file, only the name field can be updated. return value type: connectapi.repositoryfiledetail usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestupdaterepositoryfile(repositoryid, repositoryfileid, file, filedata, result) apex developer guide: testing connectapi code 1180apex reference guide contenthub class updaterepositoryfile(communityid, repositoryid, repositoryfileid, file, filedata) update the content of a repository file in an experience cloud site. api version 39.0 requires chatter no signature public static connectapi.repositoryfiledetail updaterepositoryfile(string communityid, string repositoryid, string repositoryfileid, connectapi.contenthubiteminput file, connectapi.binaryinput filedata) parameters communityid type: string id for an experience cloud site, internal, or null. repositoryid type: string the id of the repository. repositoryfileid type: string the id of the repository file. file type: connectapi.contenthubiteminput the item type id and fields of the item type. when updating the metadata of a repository file, only the name field can be updated. filedata type: connectapi.binaryinput the binary file. return value type: connectapi.repositoryfiledetail 1181apex reference guide contenthub class usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestupdaterepositoryfile(communityid, repositoryid, repositoryfileid, file, result) apex developer guide: testing connectapi code contenthub test methods the following are the test methods for contenthub. all methods are static. for information about using these methods to test your connectapi code, see testing connectapi code. settestaddrepositoryitem(repositoryid, repositoryfolderid, file, result) register a connectapi.repositoryfolderitem object to be returned when the matching addrepositoryitem(repositoryid, repositoryfolderid, file) method is called in a test context. use the method with the same parameters or you receive an exception. api version 40.0 signature public static void settestaddrepositoryitem(string repositoryid, string repositoryfolderid, connectapi.contenthubiteminput file, connectapi.repositoryfolderitem result) parameters repositoryid type: string the id of the repository. repositoryfolderid type: string the id of the repository folder. file type: connectapi.contenthubiteminput the item type id and fields of the item type. result type: connectapi" .repositoryfolderitem object containing test data. 1182 "apex reference guide contenthub class return value type: void see also: addrepositoryitem(repositoryid, repositoryfolderid, file) apex developer guide: testing connectapi code settestaddrepositoryitem(communityid, repositoryid, repositoryfolderid, file, result) register a connectapi.repositoryfolderitem object to be returned when the matching addrepositoryitem(communityid, repositoryid, repositoryfolderid, file) method is called in a test context. use the method with the same parameters or you receive an exception. api version 40.0 signature public static void settestaddrepositoryitem(string communityid, string repositoryid, string repositoryfolderid, connectapi.contenthubiteminput file, connectapi.repositoryfolderitem result) parameters communityid type: string id for an experience cloud site, internal, or null. repositoryid type: string the id of the repository. repositoryfolderid type: string the id of the repository folder. file type: connectapi.contenthubiteminput the item type id and fields of the item type. result type: connectapi.repositoryfolderitem object containing test data. 1183apex reference guide contenthub class return value type: void see also: addrepositoryitem(communityid, repositoryid, repositoryfolderid, file) apex developer guide: testing connectapi code settestaddrepositoryitem(repositoryid, repositoryfolderid, file, filedata, result) register a connectapi.repositoryfolderitem object to be returned when the matching addrepositoryitem(repositoryid, repositoryfolderid, file, filedata) method is called in a test context. use the method with the same parameters or you receive an exception. api version 40.0 signature public static void settestaddrepositoryitem(string repositoryid, string repositoryfolderid, connectapi.contenthubiteminput file, connectapi.binaryinput filedata, connectapi.repositoryfolderitem result) parameters repositoryid type: string the id of the repository. repositoryfolderid type: string the id of the repository folder. file type: connectapi.contenthubiteminput the item type id and fields of the item type. filedata type: connectapi.binaryinput the binary file. result type: connectapi.repositoryfolderitem object containing test data. 1184apex reference guide contenthub class return value type: void see also: addrepositoryitem(repositoryid, repositoryfolderid, file, filedata) apex developer guide: testing connectapi code settestaddrepositoryitem(communityid, repositoryid, repositoryfolderid, file, filedata, result) register a connectapi.repositoryfolderitem object to be returned when the matching addrepositoryitem(communityid, repositoryid, repositoryfolderid, file, filedata) method is called in a test context. use the method with the same parameters or you receive an exception. api version 40.0 signature public static void settestaddrepositoryitem(string communityid, string repositoryid, string repositoryfolderid, connectapi.contenthubiteminput file, connectapi.binaryinput filedata, connectapi.repositoryfolderitem result) parameters communityid type: string id for an experience cloud site, internal, or null. repositoryid type: string the id of the repository. repositoryfolderid type: string the id of the repository folder. file type: connectapi.contenthubiteminput the item type id and fields of the item type. filedata type: connectapi.binaryinput the binary file. result type: connectapi.repositoryfolderitem object containing test data. 1185apex reference guide contenthub class return value type: void see also: addrepositoryitem(communityid, repositoryid, repositoryfolderid, file, filedata) apex developer guide: testing connectapi code settestgetalloweditemtypes(repositoryid, repositoryfolderid, result) register a connectapi.contenthuballoweditemtypecollection object to be returned when the matching getalloweditemtypes(repositoryid, repositoryfolderid) method is called in a test context. use the method" "with the same parameters or you receive an exception. api version 40.0 signature public static void settestgetalloweditemtypes(string repositoryid, string repositoryfolderid, connectapi.contenthuballoweditemtypecollection result) parameters repositoryid type: string the id of the repository. repositoryfolderid type: string the id of the repository folder. result type: connectapi.contenthuballoweditemtypecollection object containing test data. return value type: void see also: getalloweditemtypes(repositoryid, repositoryfolderid) apex developer guide: testing connectapi code 1186apex reference guide contenthub class settestgetalloweditemtypes(repositoryid, repositoryfolderid, filter, result) register a connectapi.contenthuballoweditemtypecollection object to be returned when the matching getalloweditemtypes(repositoryid, repositoryfolderid, filter) method is called in a test context. use the method with the same parameters or you receive an exception. api version 40.0 signature public static void settestgetalloweditemtypes(string repositoryid, string repositoryfolderid, connectapi.contenthubitemtype filter, connectapi.contenthuballoweditemtypecollection result) parameters repositoryid type: string the id of the repository. repositoryfolderid type: string the id of the repository folder. filter type: connectapi.contenthubitemtype item types. values are: • any—includes files and folders. • filesonly—includes files only. • foldersonly—includes folders only. result type: connectapi.contenthuballoweditemtypecollection object containing test data. return value type: void see also: getalloweditemtypes(repositoryid, repositoryfolderid, filter) apex developer guide: testing connectapi code 1187apex reference guide contenthub class settestgetalloweditemtypes(communityid, repositoryid, repositoryfolderid, result) register a connectapi.contenthuballoweditemtypecollection object to be returned when the matching getalloweditemtypes(communityid, repositoryid, repositoryfolderid) method is called in a test context. use the method with the same parameters or you receive an exception. api version 40.0 signature public static void settestgetalloweditemtypes(string communityid, string repositoryid, string repositoryfolderid, connectapi.contenthuballoweditemtypecollection result) parameters communityid type: string id for an experience cloud site, internal, or null. repositoryid type: string the id of the repository. repositoryfolderid type: string the id of the repository folder. result type: connectapi.contenthuballoweditemtypecollection object containing test data. return value type: void see also: getalloweditemtypes(communityid, repositoryid, repositoryfolderid) apex developer guide: testing connectapi code settestgetalloweditemtypes(communityid, repositoryid, repositoryfolderid, filter, result) register a connectapi.contenthuballoweditemtypecollection object to be returned when the matching getalloweditemtypes(communityid, repositoryid, repositoryfolderid, filter) method is called in a test context. use the method with the same parameters or you receive an exception. 1188apex reference guide contenthub class api version 40.0 signature public static void settestgetalloweditemtypes(string communityid, string repositoryid, string repositoryfolderid, connectapi.contenthubitemtype filter, connectapi.contenthuballoweditemtypecollection result) parameters communityid type: string id for an experience cloud site, internal, or null. repositoryid type: string the id of the repository. repositoryfolderid type: string the id of the repository folder. filter type: connectapi.contenthubitemtype item types. values are: • any—includes files and folders. • filesonly—includes files only. • foldersonly—includes folders only. result type: connectapi.contenthuballoweditemtypecollection object containing test data. return value type: void see also: getalloweditemtypes(communityid, repositoryid, repositoryfolderid, filter) apex" "developer guide: testing connectapi code settestgetfilepreview(repositoryid, repositoryfileid, formattype, result) register a connectapi.filepreview object to be returned when the matching getfilepreview(repositoryid, repositoryfileid, formattype) method is called in a test context. use the method with the same parameters or you receive an exception. 1189apex reference guide contenthub class api version 40.0 signature public static void settestgetfilepreview(string repositoryid, string repositoryfileid, connectapi.filepreviewformat formattype, connectapi.filepreview result) parameters repositoryid type: string the id of the repository. repositoryfileid type: string the id of the repository file. formattype type: connectapi.filepreviewformat specifies the format of the file preview. values are: • jpg—preview format is jpg. • pdf—preview format is pdf. • svg—preview format is compressed svg. • thumbnail—preview format is 240 x 180 png. • thumbnailbig—preview format is 720 x 480 png. • thumbnailtiny—preview format is 120 x 90 png. pdf previews are available for files of type doc, docx, ppt, pptx, text, xls, and xlsx.svg files are generated on demand. if you’re concerned that feature-rich svg previews don’t work in your org, choose alternative file previews. to use jpg file previews, enter general in the quick find box in setup. select general settings, and then select display alternative file previews. result type: connectapi.filepreview object containing test data. return value type: void see also: getfilepreview(repositoryid, repositoryfileid, formattype) apex developer guide: testing connectapi code 1190apex reference guide contenthub class settestgetfilepreview(repositoryid, repositoryfileid, formattype, startpagenumber, endpagenumber, result) register a connectapi.filepreview object to be returned when the matching getfilepreview(repositoryid, repositoryfileid, formattype, startpagenumber, endpagenumber) method is called in a test context. use the method with the same parameters or you receive an exception. api version 40.0 signature public static void settestgetfilepreview(string repositoryid, string repositoryfileid, connectapi.filepreviewformat formattype, integer startpagenumber, integer endpagenumber, connectapi.filepreview result) parameters repositoryid type: string the id of the repository. repositoryfileid type: string the id of the repository file. formattype type: connectapi.filepreviewformat specifies the format of the file preview. values are: • jpg—preview format is jpg. • pdf—preview format is pdf. • svg—preview format is compressed svg. • thumbnail—preview format is 240 x 180 png. • thumbnailbig—preview format is 720 x 480 png. • thumbnailtiny—preview format is 120 x 90 png. pdf previews are available for files of type doc, docx, ppt, pptx, text, xls, and xlsx.svg files are generated on demand. if you’re concerned that feature-rich svg previews don’t work in your org, choose alternative file previews. to use jpg file previews, enter general in the quick find box in setup. select general settings, and then select display alternative file previews. startpagenumber type: integer the starting page number in the range of file preview urls. endpagenumber type: integer the ending page number in the range of file preview urls. 1191apex reference guide contenthub class result type: connectapi.filepreview object containing test data. return value type: void see also: getfilepreview(repositoryid, repositoryfileid, formattype, startpagenumber, endpagenumber) apex developer guide: testing connectapi code settestgetfilepreview(communityid, repositoryid, repositoryfileid, formattype, result) register a connectapi.filepreview object to be returned when the matching getfilepreview(communityid, repositoryid, repositoryfileid, formattype) method is called in a test context. use the method with the same parameters or you receive" "an exception. api version 40.0 signature public static void settestgetfilepreview(string communityid, string repositoryid, string repositoryfileid, connectapi.filepreviewformat formattype, connectapi.filepreview result) parameters communityid type: string id for an experience cloud site, internal, or null. repositoryid type: string the id of the repository. repositoryfileid type: string the id of the repository file. formattype type: connectapi.filepreviewformat specifies the format of the file preview. values are: • jpg—preview format is jpg. • pdf—preview format is pdf. 1192apex reference guide contenthub class • svg—preview format is compressed svg. • thumbnail—preview format is 240 x 180 png. • thumbnailbig—preview format is 720 x 480 png. • thumbnailtiny—preview format is 120 x 90 png. pdf previews are available for files of type doc, docx, ppt, pptx, text, xls, and xlsx.svg files are generated on demand. if you’re concerned that feature-rich svg previews don’t work in your org, choose alternative file previews. to use jpg file previews, enter general in the quick find box in setup. select general settings, and then select display alternative file previews. result type: connectapi.filepreview object containing test data. return value type: void see also: getfilepreview(communityid, repositoryid, repositoryfileid, formattype) apex developer guide: testing connectapi code settestgetfilepreview(communityid, repositoryid, repositoryfileid, formattype, startpagenumber, endpagenumber, result) register a connectapi.filepreview object to be returned when the matching getfilepreview(communityid, repositoryid, repositoryfileid, formattype, startpagenumber, endpagenumber) method is called in a test context. use the method with the same parameters or you receive an exception. api version 40.0 signature public static void settestgetfilepreview(string communityid, string repositoryid, string repositoryfileid, connectapi.filepreviewformat formattype, integer startpagenumber, integer endpagenumber, connectapi.filepreview result) parameters communityid type: string id for an experience cloud site, internal, or null. repositoryid type: string the id of the repository. 1193apex reference guide contenthub class repositoryfileid type: string the id of the repository file. formattype type: connectapi.filepreviewformat specifies the format of the file preview. values are: • jpg—preview format is jpg. • pdf—preview format is pdf. • svg—preview format is compressed svg. • thumbnail—preview format is 240 x 180 png. • thumbnailbig—preview format is 720 x 480 png. • thumbnailtiny—preview format is 120 x 90 png. pdf previews are available for files of type doc, docx, ppt, pptx, text, xls, and xlsx.svg files are generated on demand. if you’re concerned that feature-rich svg previews don’t work in your org, choose alternative file previews. to use jpg file previews, enter general in the quick find box in setup. select general settings, and then select display alternative file previews. startpagenumber type: integer the starting page number in the range of file preview urls. endpagenumber type: integer the ending page number in the range of file preview urls. result type: connectapi.filepreview object containing test data. return value type: void see also: getfilepreview(communityid, repositoryid, repositoryfileid, formattype, startpagenumber, endpagenumber) apex developer guide: testing connectapi code settestgetitemtype(repositoryid, repositoryitemtypeid, result) register a connectapi.contenthubitemtypedetail object to be returned when the matching getitemtype(repositoryid, repositoryitemtypeid) method is called in a test context. use the method with the same parameters or you receive an exception. api version 40.0 1194apex reference guide contenthub class signature public static void settestgetitemtype(string repositoryid, string repositoryitemtypeid," "connectapi.contenthubitemtypedetail result) parameters repositoryid type: string the id of the repository. repositoryitemtypeid type: string the id of the repository item type. result type: connectapi.contenthubitemtypedetail object containing test data. return value type: void see also: getitemtype(repositoryid, repositoryitemtypeid) apex developer guide: testing connectapi code settestgetitemtype(communityid, repositoryid, repositoryitemtypeid, result) register a connectapi.contenthubitemtypedetail object to be returned when the matching getitemtype(communityid, repositoryid, repositoryitemtypeid) method is called in a test context. use the method with the same parameters or you receive an exception. api version 40.0 signature public static void settestgetitemtype(string communityid, string repositoryid, string repositoryitemtypeid, connectapi.contenthubitemtypedetail result) parameters communityid type: string id for an experience cloud site, internal, or null. repositoryid type: string 1195apex reference guide contenthub class the id of the repository. repositoryitemtypeid type: string the id of the repository item type. result type: connectapi.contenthubitemtypedetail object containing test data. return value type: void see also: getitemtype(communityid, repositoryid, repositoryitemtypeid) apex developer guide: testing connectapi code settestgetpreviews(repositoryid, repositoryfileid, result) register a connectapi.filepreviewcollection object to be returned when the matching getpreviews(repositoryid, repositoryfileid) method is called in a test context. use the method with the same parameters or you receive an exception. api version 40.0 signature public static void settestgetpreviews(string repositoryid, string repositoryfileid, connectapi.filepreviewcollection result) parameters repositoryid type: string the id of the repository. repositoryfileid type: string the id of the repository file. result type: connectapi.filepreviewcollection object containing test data. 1196apex reference guide contenthub class return value type: void see also: getpreviews(repositoryid, repositoryfileid) apex developer guide: testing connectapi code settestgetpreviews(communityid, repositoryid, repositoryfileid, result) register a connectapi.filepreviewcollection object to be returned when the matching getpreviews(communityid, repositoryid, repositoryfileid) method is called in a test context. use the method with the same parameters or you receive an exception. api version 40.0 signature public static void settestgetpreviews(string communityid, string repositoryid, string repositoryfileid, connectapi.filepreviewcollection result) parameters communityid type: string id for an experience cloud site, internal, or null. repositoryid type: string the id of the repository. repositoryfileid type: string the id of the repository file. result type: connectapi.filepreviewcollection object containing test data. return value type: void see also: getpreviews(communityid, repositoryid, repositoryfileid) apex developer guide: testing connectapi code 1197apex reference guide contenthub class settestgetrepositories(result) register a connectapi.contenthubrepositorycollection object to be returned when the matching getrepositories() method is called in a test context. use the method with the same parameters or you receive an exception. api version 40.0 signature public static void settestgetrepositories(connectapi.contenthubrepositorycollection result) parameters result type: connectapi.contenthubrepositorycollection object containing test data. return value type: void see also: getrepositories() apex developer guide: testing connectapi code settestgetrepositories(communityid, result) register a getrepositories(communityid) object to be returned when the matching connectapi.contenthubrepositorycollection method is called in a test context. use the method with the same parameters or you receive an exception. api version 40.0 signature public static void" "settestgetrepositories(string communityid, connectapi.contenthubrepositorycollection result) parameters communityid type: string id for an experience cloud site, internal, or null. 1198apex reference guide contenthub class result type: connectapi.contenthubrepositorycollection object containing test data. return value type: void see also: getrepositories(communityid) apex developer guide: testing connectapi code settestgetrepositories(pageparam, pagesize, result) register a connectapi.contenthubrepositorycollection object to be returned when the matching getrepositories(pageparam, pagesize) method is called in a test context. use the method with the same parameters or you receive an exception. api version 40.0 signature public static void settestgetrepositories(integer pageparam, integer pagesize, connectapi.contenthubrepositorycollection result) parameters pageparam type: integer number of the page you want returned. starts at 0. if you pass in null or 0, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 through 100. if you pass in null, the default page size is 25. result type: connectapi.contenthubrepositorycollection object containing test data. return value type: void see also: getrepositories(pageparam, pagesize) apex developer guide: testing connectapi code 1199apex reference guide contenthub class settestgetrepositories(communityid, pageparam, pagesize, result) register a connectapi.contenthubrepositorycollection object to be returned when the matching getrepositories(communityid, pageparam, pagesize) method is called in a test context. use the method with the same parameters or you receive an exception. api version 40.0 signature public static void settestgetrepositories(string communityid, integer pageparam, integer pagesize, connectapi.contenthubrepositorycollection result) parameters communityid type: string id for an experience cloud site, internal, or null. pageparam type: integer number of the page you want returned. starts at 0. if you pass in null or 0, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 through 100. if you pass in null, the default page size is 25. result type: connectapi.contenthubrepositorycollection object containing test data. return value type: void see also: getrepositories(communityid, pageparam, pagesize) apex developer guide: testing connectapi code settestgetrepository(repositoryid, result) register a connectapi.contenthubrepository object to be returned when the matching getrepository(repositoryid) method is called in a test context. use the method with the same parameters or you receive an exception. api version 40.0 1200apex reference guide contenthub class signature public static void settestgetrepository(string repositoryid, connectapi.contenthubrepository result) parameters repositoryid type: string the id of the repository. result type: connectapi.contenthubrepository object containing test data. return value type: void see also: getrepository(repositoryid) apex developer guide: testing connectapi code settestgetrepository(communityid, repositoryid, result) register a connectapi.contenthubrepository object to be returned when the matching getrepository(communityid, repositoryid) method is called in a test context. use the method with the same parameters or you receive an exception. api version 40.0 signature public static void settestgetrepository(string communityid, string repositoryid, connectapi.contenthubrepository result) parameters communityid type: string id for an experience cloud site, internal, or null. repositoryid type: string the id of the repository. result type: connectapi.contenthubrepository 1201apex reference guide contenthub class object containing test data. return value type: void see also: getrepository(communityid, repositoryid) apex developer guide: testing connectapi code settestgetrepositoryfile(repositoryid, repositoryfileid, result) register a connectapi." "repositoryfiledetail object to be returned when the matching getrepositoryfile(repositoryid, repositoryfileid) method is called in a test context. use the method with the same parameters or you receive an exception. api version 40.0 signature public static void settestgetrepositoryfile(string repositoryid, string repositoryfileid, connectapi.repositoryfiledetail result) parameters repositoryid type: string the id of the repository. repositoryfileid type: string the id of the repository file. result type: connectapi.repositoryfiledetail object containing test data. return value type: void see also: getrepositoryfile(repositoryid, repositoryfileid) apex developer guide: testing connectapi code 1202apex reference guide contenthub class settestgetrepositoryfile(repositoryid, repositoryfileid, includeexternalfilepermissionsinfo, result) register a connectapi.repositoryfiledetail object to be returned when the matching getrepositoryfile(repositoryid, repositoryfileid, includeexternalfilepermissionsinfo) method is called in a test context. use the method with the same parameters or you receive an exception. api version 40.0 signature public static void settestgetrepositoryfile(string repositoryid, string repositoryfileid, boolean includeexternalfilepermissionsinfo, connectapi.repositoryfiledetail result) parameters repositoryid type: string the id of the repository. repositoryfileid type: string the id of the repository file. includeexternalfilepermissionsinfo type: boolean specifies whether to include permission information, such as whether the file is shared and what are the available permission types. managing external file permissions is supported for google drive, sharepoint online, and onedrive for business. result type: connectapi.repositoryfiledetail object containing test data. return value type: void see also: getrepositoryfile(repositoryid, repositoryfileid, includeexternalfilepermissionsinfo) apex developer guide: testing connectapi code settestgetrepositoryfile(communityid, repositoryid, repositoryfileid, result) register a connectapi.repositoryfiledetail object to be returned when the matching getrepositoryfile(communityid, repositoryid, repositoryfileid) method is called in a test context. use the method with the same parameters or you receive an exception. 1203apex reference guide contenthub class api version 40.0 signature public static void settestgetrepositoryfile(string communityid, string repositoryid, string repositoryfileid, connectapi.repositoryfiledetail result) parameters communityid type: string id for an experience cloud site, internal, or null. repositoryid type: string the id of the repository. repositoryfileid type: string the id of the repository file. result type: connectapi.repositoryfiledetail object containing test data. return value type: void see also: getrepositoryfile(communityid, repositoryid, repositoryfileid) apex developer guide: testing connectapi code settestgetrepositoryfile(communityid, repositoryid, repositoryfileid, includeexternalfilepermissionsinfo, result) register a connectapi.repositoryfiledetail object to be returned when the matching getrepositoryfile(communityid, repositoryid, repositoryfileid, includeexternalfilepermissionsinfo) method is called in a test context. use the method with the same parameters or you receive an exception. api version 40.0 1204apex reference guide contenthub class signature public static void settestgetrepositoryfile(string communityid, string repositoryid, string repositoryfileid, boolean includeexternalfilepermissionsinfo, connectapi.repositoryfiledetail result) parameters communityid type: string id for an experience cloud site, internal, or null. repositoryid type: string the id of the repository. repositoryfileid type: string the id of the repository file. includeexternalfilepermissionsinfo type: boolean specifies whether to include permission information, such as whether the file is shared and what are the available permission types. managing external file permissions is supported for google drive, sharepoint online, and onedrive for business. result type: connectapi.repositoryfiledetail" "object containing test data. return value type: void see also: getrepositoryfile(communityid, repositoryid, repositoryfileid, includeexternalfilepermissionsinfo) apex developer guide: testing connectapi code settestgetrepositoryfolder(repositoryid, repositoryfolderid, result) register a connectapi.repositoryfolderdetail object to be returned when the matching getrepositoryfolder(repositoryid, repositoryfolderid) method is called in a test context. use the method with the same parameters or you receive an exception. api version 40.0 1205apex reference guide contenthub class signature public static void settestgetrepositoryfolder(string repositoryid, string repositoryfolderid, connectapi.repositoryfolderdetail result) parameters repositoryid type: string the id of the repository. repositoryfolderid type: string the id of the repository folder. result type: connectapi.repositoryfolderdetail object containing test data. return value type: void see also: getrepositoryfolder(repositoryid, repositoryfolderid) apex developer guide: testing connectapi code settestgetrepositoryfolder(communityid, repositoryid, repositoryfolderid, result) register a connectapi.repositoryfolderdetail object to be returned when the matching getrepositoryfolder(communityid, repositoryid, repositoryfolderid) method is called in a test context. use the method with the same parameters or you receive an exception. api version 40.0 signature public static void settestgetrepositoryfolder(string communityid, string repositoryid, string repositoryfolderid, connectapi.repositoryfolderdetail result) parameters communityid type: string id for an experience cloud site, internal, or null. 1206apex reference guide contenthub class repositoryid type: string the id of the repository. repositoryfolderid type: string the id of the repository folder. result type: connectapi.repositoryfolderdetail object containing test data. return value type: void see also: getrepositoryfolder(communityid, repositoryid, repositoryfolderid) apex developer guide: testing connectapi code settestgetrepositoryfolderitems(repositoryid, repositoryfolderid, result) register a connectapi.repositoryfolderitemscollection object to be returned when the matching getrepositoryfolderitems(repositoryid, repositoryfolderid) method is called in a test context. use the method with the same parameters or you receive an exception. api version 40.0 signature public static void settestgetrepositoryfolderitems(string repositoryid, string repositoryfolderid, connectapi.repositoryfolderitemscollection result) parameters repositoryid type: string the id of the repository. repositoryfolderid type: string the id of the repository folder. result type: connectapi.repositoryfolderitemscollection object containing test data. 1207apex reference guide contenthub class return value type: void see also: getrepositoryfolderitems(repositoryid, repositoryfolderid) apex developer guide: testing connectapi code settestgetrepositoryfolderitems(communityid, repositoryid, repositoryfolderid, result) register a connectapi.repositoryfolderitemscollection object to be returned when the matching getrepositoryfolderitems(communityid, repositoryid, repositoryfolderid) method is called in a test context. use the method with the same parameters or you receive an exception. api version 40.0 signature public static void settestgetrepositoryfolderitems(string communityid, string repositoryid, string repositoryfolderid, connectapi.repositoryfolderitemscollection result) parameters communityid type: string id for an experience cloud site, internal, or null. repositoryid type: string the id of the repository. repositoryfolderid type: string the id of the repository folder. result type: connectapi.repositoryfolderitemscollection object containing test data. 1208apex reference guide contenthub class return value type: void see also: getrepositoryfolderitems(communityid, repositoryid, repositoryfolderid) apex developer guide: testing connectapi code settestgetrepositoryfolderitems(repositoryid, repositoryfolderid, pageparam," "pagesize, result) register a connectapi.repositoryfolderitemscollection object to be returned when the matching getrepositoryfolderitems(repositoryid, repositoryfolderid, pageparam, pagesize) method is called in a test context. use the method with the same parameters or you receive an exception. api version 40.0 signature public static void settestgetrepositoryfolderitems(string repositoryid, string repositoryfolderid, integer pageparam, integer pagesize, connectapi.repositoryfolderitemscollection result) parameters repositoryid type: string the id of the repository. repositoryfolderid type: string the id of the repository folder. pageparam type: integer number of the page you want returned. starts at 0. if you pass in null or 0, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 through 100. if you pass in null, the default page size is 25. result type: connectapi.repositoryfolderitemscollection object containing test data. 1209apex reference guide contenthub class return value type: void see also: getrepositoryfolderitems(repositoryid, repositoryfolderid, pageparam, pagesize) apex developer guide: testing connectapi code settestgetrepositoryfolderitems(communityid, repositoryid, repositoryfolderid, pageparam, pagesize, result) register a connectapi.repositoryfolderitemscollection object to be returned when the matching getrepositoryfolderitems(communityid, repositoryid, repositoryfolderid, pageparam, pagesize) method is called in a test context. use the method with the same parameters or you receive an exception. api version 40.0 signature public static void settestgetrepositoryfolderitems(string communityid, string repositoryid, string repositoryfolderid, integer pageparam, integer pagesize, connectapi.repositoryfolderitemscollection result) parameters communityid type: string id for an experience cloud site, internal, or null. repositoryid type: string the id of the repository. repositoryfolderid type: string the id of the repository folder. pageparam type: integer number of the page you want returned. starts at 0. if you pass in null or 0, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 through 100. if you pass in null, the default page size is 25. result type: connectapi.repositoryfolderitemscollection object containing test data. 1210apex reference guide contenthub class return value type: void see also: getrepositoryfolderitems(communityid, repositoryid, repositoryfolderid, pageparam, pagesize) apex developer guide: testing connectapi code settestupdaterepositoryfile(communityid, repositoryid, repositoryfileid, file, filedata, result) register a connectapi.repositoryfiledetail object to be returned when the matching updaterepositoryfile(communityid, repositoryid, repositoryfileid, file, filedata) method is called in a test context. use the method with the same parameters or you receive an exception. api version 40.0 signature public static void settestupdaterepositoryfile(string communityid, string repositoryid, string repositoryfileid, connectapi.contenthubiteminput file, connectapi.binaryinput filedata, connectapi.repositoryfiledetail result) parameters communityid type: string id for an experience cloud site, internal, or null. repositoryid type: string the id of the repository. repositoryfileid type: string the id of the repository file. file type: connectapi.contenthubiteminput the item type id and fields of the item type. filedata type: connectapi.binaryinput the binary file. result type: connectapi.repositoryfiledetail object containing test data. 1211apex reference guide contenthub class return value type: void see also: updaterepositoryfile(repositoryid, repositoryfileid, file) apex developer guide: testing connectapi code settestupdaterepositoryfile(repositoryid, repositoryfileid, file, result) register a connectapi.repositoryfiledetail object to be returned when the matching updaterepository" "file(repositoryid, repositoryfileid, file) method is called in a test context. use the method with the same parameters or you receive an exception. api version 40.0 signature public static void settestupdaterepositoryfile(string repositoryid, string repositoryfileid, connectapi.contenthubiteminput file, connectapi.repositoryfiledetail result) parameters repositoryid type: string the id of the repository. repositoryfileid type: string the id of the repository file. file type: connectapi.contenthubiteminput the item type id and fields of the item type. result type: connectapi.repositoryfiledetail object containing test data. return value type: void see also: updaterepositoryfile(repositoryid, repositoryfileid, file, filedata) apex developer guide: testing connectapi code 1212apex reference guide contenthub class settestupdaterepositoryfile(repositoryid, repositoryfileid, file, filedata, result) register a connectapi.repositoryfiledetail object to be returned when the matching updaterepositoryfile(repositoryid, repositoryfileid, file, filedata) method is called in a test context. use the method with the same parameters or you receive an exception. api version 40.0 signature public static void settestupdaterepositoryfile(string repositoryid, string repositoryfileid, connectapi.contenthubiteminput file, connectapi.binaryinput filedata, connectapi.repositoryfiledetail result) parameters repositoryid type: string the id of the repository. repositoryfileid type: string the id of the repository file. file type: connectapi.contenthubiteminput the item type id and fields of the item type. filedata type: connectapi.binaryinput the binary file. result type: connectapi.repositoryfiledetail object containing test data. return value type: void see also: updaterepositoryfile(communityid, repositoryid, repositoryfileid, file) apex developer guide: testing connectapi code 1213apex reference guide conversationapplicationdefinition class settestupdaterepositoryfile(communityid, repositoryid, repositoryfileid, file, result) register a connectapi.repositoryfiledetail object to be returned when the matching updaterepositoryfile(communityid, repositoryid, repositoryfileid, file) method is called in a test context. use the method with the same parameters or you receive an exception. api version 40.0 signature public static void settestupdaterepositoryfile(string communityid, string repositoryid, string repositoryfileid, connectapi.contenthubiteminput file, connectapi.repositoryfiledetail result) parameters communityid type: string id for an experience cloud site, internal, or null. repositoryid type: string the id of the repository. repositoryfileid type: string the id of the repository file. file type: connectapi.contenthubiteminput the item type id and fields of the item type. result type: connectapi.repositoryfiledetail object containing test data. return value type: void see also: updaterepositoryfile(communityid, repositoryid, repositoryfileid, file, filedata) apex developer guide: testing connectapi code conversationapplicationdefinition class access information about a conversation application definition. 1214apex reference guide datacloud class namespace connectapi conversationapplicationdefinition methods the following are methods for conversationapplicationdefinition. all methods are static. in this section: getconversationapplicationdefinition(integrationname) get information about an integration’s conversation application definition and the associated bot. getconversationapplicationdefinition(integrationname) get information about an integration’s conversation application definition and the associated bot. api version 54.0 requires chatter no signature public static connectapi.conversationapplicationdefinitiondetailrespresentation getconversationapplicationdefinition(string integrationname) parameters integrationname type: string name of the conversation application. return value type: connectapi.conversationapplicationdefinitiondetailrespresentation usage to access this method, enable the bot feature, and the user" "must be an admin or have the manage bots or manage bots training data user permissions. datacloud class purchase data.com contact or company records, and retrieve purchase information. 1215apex reference guide datacloud class namespace connectapi note: when your data.com prospector or data.com clean contract expires, data.com features, objects, and fields will be removed from your org. to support customers’ needs around compliance and to remain a leader in trust and privacy, salesforce removed all contact data from the data.com service on february 1, 2021. for more information, see data.com prospector and clean retirement. in this section: datacloud methods the following are methods for datacloud. all methods are static. datacloud methods the following are methods for datacloud. all methods are static. in this section: getcompaniesfromorder(orderid, pagesize, page) get a list of purchased company records for an order. getcompany(companyid) get a company record. getcontact(contactid) get a contact. getcontactsfromorder(orderid, page, pagesize) get a list of purchased contacts for an order. getorder(orderid) get an order. getusage(userid) get purchase usage information for a user. postorder(orderinput) purchase records that are listed in an input file. getcompaniesfromorder(orderid, pagesize, page) get a list of purchased company records for an order. api version 32.0 requires chatter no 1216apex reference guide datacloud class signature public static connectapi.datacloudcompanies getcompaniesfromorder(string orderid, string pagesize, string page) parameters orderid type: string id of an order. page type: integer number of the page that you want returned. pagesize type: integer number of companies to show on a page. the default pagesize is 25. return value type: connectapi.datacloudcompanies getcompany(companyid) get a company record. api version 32.0 requires chatter no signature public static connectapi.datacloudcompany getcompany(string companyid) parameters companyid type: string id of a company in the data.com database. return value type: connectapi.datacloudcompany 1217apex reference guide datacloud class getcontact(contactid) get a contact. api version 32.0 requires chatter no signature public static connectapi.datacloudcontact getcontact(string contactid) parameters contactid type: string id of a contact in the data.com database. return value type: connectapi.datacloudcontact getcontactsfromorder(orderid, page, pagesize) get a list of purchased contacts for an order. api version 32.0 requires chatter no signature public static connectapi.datacloudcontacts getcontactsfromorder(string orderid, string page, string pagesize) parameters orderid type: string id of an order. page type: integer 1218apex reference guide datacloud class number of the page that you want returned. pagesize type: integer number of contacts to show on a page. the default pagesize is 25. return value type: connectapi.datacloudcontacts getorder(orderid) get an order. api version 32.0 requires chatter no signature public static connectapi.datacloudorder getorder(string orderid) parameters orderid type: string id of an order. return value type: connectapi.datacloudorder getusage(userid) get purchase usage information for a user. api version 32.0 requires chatter no signature public static connectapi.datacloudpurchaseusage getusage(string userid) 1219apex reference guide emailmergefieldservice class parameters userid type: string id of a user. return value type: connectapi.datacloudpurchaseusage postorder(orderinput) purchase records that are listed in an input file. api version 32.0 requires chatter no signature public static connectapi.datacloudorder postorder(connectapi.datacloudorderinput order" "input) parameters orderinput type: connectapi.datacloudorderinput a list that contains ids for the contacts or companies that you want to see. return value type: connectapi.datacloudorder example connectapi.datacloudorderinput inputorder=new connectapi.datacloudorderinput(); list ids=new list(); ids.add('1234'); inputorder.companyids=ids; connectapi.datacloudorder datacloudorderrep = connectapi.datacloud.postorder(inputorder); emailmergefieldservice class extract a list of merge fields for an object. a merge field is a field you can put in an email template, mail merge template, custom link, or formula to incorporate values from a record. 1220apex reference guide employeeprofiles class namespace connectapi emailmergefieldservice methods the following are methods for emailmergefieldservice. all methods are static. in this section: getmergefields(objectapinames) extract the merge fields for a specific object. getmergefields(objectapinames) extract the merge fields for a specific object. api version 39.0 requires chatter no signature public static connectapi.emailmergefieldinfo getmergefields(list objectapinames) parameters objectapinames type: list the api names for the objects being referenced. return value type: connectapi.emailmergefieldinfo employeeprofiles class get, set and crop, and delete employee banner photos and photos. namespace connectapi 1221apex reference guide employeeprofiles class employeeprofiles methods these methods are for employeeprofiles. all methods are static. in this section: deletebannerphoto(employeeid) delete an employee’s banner photo. deletephoto(employeeid) delete an employee’s photo. getbannerphoto(employeeid) get an employee’s banner photo. getphoto(employeeid) get an employee’s photo. setbannerphoto(employeeid, fileid, versionnumber) set an uploaded file as an employee’s banner photo. setbannerphoto(employeeid, fileupload) set a file that hasn’t been uploaded as an employee’s banner photo. setbannerphotowithattributes(employeeid, bannerphoto) set and crop an uploaded file as an employee’s banner photo. setbannerphotowithattributes(employeeid, bannerphoto, fileupload) set and crop a file that hasn’t been uploaded as an employee’s banner photo. setphoto(employeeid, fileid, versionnumber) set an uploaded file as an employee’s photo. setphoto(employeeid, fileupload) set a file that hasn’t been uploaded as an employee’s photo. setphotowithattributes(employeeid, photo) set and crop an uploaded file as an employee’s photo. setphotowithattributes(employeeid, photo, fileupload) set and crop a file that hasn’t been uploaded as an employee’s photo. deletebannerphoto(employeeid) delete an employee’s banner photo. api version 51.0 requires chatter no 1222apex reference guide employeeprofiles class signature public static void deletebannerphoto(string employeeid) parameters employeeid type: string id of the employee. return value type: void deletephoto(employeeid) delete an employee’s photo. api version 51.0 requires chatter no signature public static void deletephoto(string employeeid) parameters employeeid type: string id of the employee. return value type: void getbannerphoto(employeeid) get an employee’s banner photo. api version 51.0 requires chatter no 1223apex reference guide employeeprofiles class signature public static connectapi.bannerphoto getbannerphoto(string employeeid) parameters employeeid type: string id of the employee. return value type: connectapi.bannerphoto getphoto(employeeid) get an employee’s photo. api version 51.0" "available to guest users 51.0 requires chatter no signature public static connectapi.photo getphoto(string employeeid) parameters employeeid type: string id of the employee. return value type: connectapi.photo setbannerphoto(employeeid, fileid, versionnumber) set an uploaded file as an employee’s banner photo. api version 51.0 1224apex reference guide employeeprofiles class requires chatter no signature public static connectapi.bannerphoto setbannerphoto(string employeeid, string fileid, integer versionnumber) parameters employeeid type: string id of the employee. fileid type: string id of the uploaded file to use as the employee banner photo. the file must be an image and be smaller than 2 gb. versionnumber type: integer version number of the file. specify an existing version number or, to get the latest version, specify null. return value type: connectapi.bannerphoto setbannerphoto(employeeid, fileupload) set a file that hasn’t been uploaded as an employee’s banner photo. api version 51.0 requires chatter no signature public static connectapi.bannerphoto setbannerphoto(string employeeid, connectapi.binaryinput fileupload) parameters employeeid type: string id of the employee. fileupload type: connectapi.binaryinput 1225apex reference guide employeeprofiles class file to use as the photo. the content type must be usable as an image. return value type: connectapi.bannerphoto usage photos are processed asynchronously and might not be visible right away. setbannerphotowithattributes(employeeid, bannerphoto) set and crop an uploaded file as an employee’s banner photo. api version 51.0 requires chatter no signature public static connectapi.bannerphoto setbannerphotowithattributes(string employeeid, connectapi.bannerphotoinput bannerphoto) parameters employeeid type: string id of the employee. bannerphoto type: connectapi.bannerphotoinput a connectapi.bannerphotoinput object that specifies the id and version of the file, and how to crop the file. return value type: connectapi.bannerphoto usage photos are processed asynchronously and might not be visible right away. setbannerphotowithattributes(employeeid, bannerphoto, fileupload) set and crop a file that hasn’t been uploaded as an employee’s banner photo. 1226apex reference guide employeeprofiles class api version 51.0 requires chatter no signature public static connectapi.bannerphoto setbannerphotowithattributes(string employeeid, connectapi.bannerphotoinput bannerphoto, connectapi.binaryinput fileupload) parameters employeeid type: string id of the employee. bannerphoto type: connectapi.bannerphotoinput a connectapi.bannerphotoinput object specifying the cropping parameters. fileupload type: connectapi.binaryinput file to use as the photo. the content type must be usable as an image. return value type: connectapi.bannerphoto usage photos are processed asynchronously and might not be visible right away. setphoto(employeeid, fileid, versionnumber) set an uploaded file as an employee’s photo. api version 51.0 requires chatter no signature public static connectapi.photo setphoto(string employeeid, string fileid, integer versionnumber) 1227apex reference guide employeeprofiles class parameters employeeid type: string id of the employee. fileid type: string id of the uploaded file to use as the employee photo. the file must be an image and be smaller than 2 gb. versionnumber type: integer version number of the file. specify an existing version number or, to get the latest version, specify null. return value type: connectapi.photo usage photos are processed asynchronously and might not be visible right away. setphoto(employeeid, fileupload) set a file that hasn’t been uploaded as an employee’s photo. api version 51.0 requires chatter no sign" "ature public static connectapi.photo setphoto(string employeeid, connectapi.binaryinput fileupload) parameters employeeid type: string id of the employee. fileupload type: connectapi.binaryinput file to use as the photo. the content type must be usable as an image. 1228apex reference guide employeeprofiles class return value type: connectapi.photo usage photos are processed asynchronously and might not be visible right away. setphotowithattributes(employeeid, photo) set and crop an uploaded file as an employee’s photo. api version 51.0 requires chatter no signature public static connectapi.photo setphotowithattributes(string employeeid, connectapi.photoinput photo) parameters employeeid type: string id of the employee. photo type: connectapi.photoinput a connectapi.photoinput object specifying the file id, version number, and cropping parameters. return value type: connectapi.photo usage photos are processed asynchronously and might not be visible right away. setphotowithattributes(employeeid, photo, fileupload) set and crop a file that hasn’t been uploaded as an employee’s photo. api version 51.0 1229apex reference guide externalemailservices class requires chatter no signature public static connectapi.photo setphotowithattributes(string employeeid, connectapi.photoinput photo, connectapi.binaryinput fileupload) parameters employeeid type: string id of the employee. photo type: connectapi.photoinput a connectapi.photoinput object specifying the cropping parameters. fileupload type: connectapi.binaryinput file to use as the photo. the content type must be usable as an image. return value type: connectapi.photo usage photos are processed asynchronously and might not be visible right away. externalemailservices class access information about integration with external email services, such as sending email within salesforce through an external email account. namespace connectapi external email services methods the following are methods for externalemailservice. all methods are static. in this section: getuseroauthinfo(landingpage) get information about whether an external email service has been authorized to send email on behalf of a user. 1230apex reference guide externalmanagedaccount class getuseroauthinfo(landingpage) get information about whether an external email service has been authorized to send email on behalf of a user. api version 37.0 requires chatter no signature public static getuseroauthinfo(string landingpage) parameters landingpage type: string the landing page that the user starts on when they are finished with the oauth authorization process. return value type: connectapi.useroauthinfo see also: apex developer guide: testing connectapi code externalmanagedaccount class get externally managed accounts. namespace connectapi externalmanagedaccount methods these methods are for externalmanagedaccount. all methods are static. in this section: getcommunitiesexternalmanagedaccounts(communityid) get externally managed accounts available to the context user across all experience cloud sites. getcommunitiesexternalmanagedaccounts(communityid, includemyaccount) get externally managed accounts available to the context user, including the context user’s account, across all experience cloud sites. 1231apex reference guide externalmanagedaccount class getexternalmanagedaccounts(webstoreid) get externally managed accounts for a store. getexternalmanagedaccounts(webstoreid, includemyaccount) get externally managed accounts, including the context user’s account, for a store. getcommunitiesexternalmanagedaccounts(communityid) get externally managed accounts available to the context user across all experience cloud sites. api version 50.0 requires chatter no signature public static connectapi.externalmanagedaccountcollectionoutput getcommunitiesexternalmanagedaccounts(string communityid) parameters communityid type: string id for an experience cloud site, internal, or null. note: regardless of the id specified, this method returns externally managed accounts available to the context user across all experience cloud sites. return value type: connectapi.externalmanagedaccountcollectionoutput getcommunitiesexternalmanagedaccounts(communityid, includemyaccount" ") get externally managed accounts available to the context user, including the context user’s account, across all experience cloud sites. api version 53.0 requires chatter no 1232" "apex reference guide externalmanagedaccount class signature public static connectapi.externalmanagedaccountcollectionoutput getcommunitiesexternalmanagedaccounts(string communityid, boolean includemyaccount) parameters communityid type: string id for an experience cloud site, internal, or null. note: regardless of the id specified, this method returns externally managed accounts available to the context user across all experience cloud sites. includemyaccount type: boolean specifies whether to return the context user’s account (true) or not (false). the default value is false. return value type: connectapi.externalmanagedaccountcollectionoutput getexternalmanagedaccounts(webstoreid) get externally managed accounts for a store. api version 49.0 requires chatter no signature public static connectapi.externalmanagedaccountcollectionoutput getexternalmanagedaccounts(string webstoreid) parameters webstoreid type: string id of the webstore. return value type: connectapi.externalmanagedaccountcollectionoutput 1233apex reference guide fieldservice class getexternalmanagedaccounts(webstoreid, includemyaccount) get externally managed accounts, including the context user’s account, for a store. api version 53.0 requires chatter no signature public static connectapi.externalmanagedaccountcollectionoutput getexternalmanagedaccounts(string webstoreid, boolean includemyaccount) parameters webstoreid type: string id of the webstore. includemyaccount type: boolean specifies whether to return the context user’s account (true) or not (false). the default value is false. return value type: connectapi.externalmanagedaccountcollectionoutput fieldservice class preview and create shifts from a pattern or filter fields on recordset filter criteria. namespace connectapi fieldservice methods these methods are for fieldservice. all methods are static. in this section: createshiftsfrompattern(shiftsfrompatterninput, shiftpatternid) create up to 2,000 shifts from a pattern. evaluaterecordsetfiltercriteria(recordsetfiltercriteriainput) filter records on recordset filter criteria. 1234apex reference guide fieldservice class previewshiftsfrompattern(shiftsfrompatterninput, shiftpatternid) preview up to 2,000 shifts from a pattern. createshiftsfrompattern(shiftsfrompatterninput, shiftpatternid) create up to 2,000 shifts from a pattern. api version 51.0 requires chatter yes signature public static connectapi.shiftsfrompattern createshiftsfrompattern(connectapi.shiftsfrompatterninput shiftsfrompatterninput, string shiftpatternid) parameters shiftsfrompatterninput type: connectapi.shiftsfrompatterninput a connectapi.shiftsfrompatterninput object providing the pattern. shiftpatternid type: string id of the shift pattern. return value type: connectapi.shiftsfrompattern evaluaterecordsetfiltercriteria(recordsetfiltercriteriainput) filter records on recordset filter criteria. api version 53.0 requires chatter no 1235apex reference guide fieldservice class signature public static connectapi.recordsetfiltercriteriaoutput evaluaterecordsetfiltercriteria(connectapi.recordsetfiltercriteriainput recordsetfiltercriteriainput) parameters recordsetfiltercriteriainput type: connectapi.recordsetfiltercriteriainput an connectapi.recordsetfiltercriteriainput object providing a set of recordset filter criteria and records. return value type: connectapi.recordsetfiltercriteriaoutput usage field service must be enabled. previewshiftsfrompattern(shiftsfrompatterninput, shiftpatternid) preview up to 2,000 shifts from a pattern. api version 51.0 requires chatter yes signature public static connectapi.shiftsfrompattern previewshiftsfrompattern(connectapi.shiftsfrompatterninput shiftsfrompatterninput, string shiftpatternid) parameters shiftsfrompatterninput type: connectapi.shiftsfrompatterninput a connectapi.shiftsfrompatterninput object providing the pattern. shiftpatternid type: string id of the shift pattern. return value type: connectapi.shiftsfrompattern 1236apex reference guide fulfillmentorder class fulfillmentorder class f" "ulfill orders in order management. namespace connectapi fulfillmentorder methods the following are methods for fulfillmentorder. all methods are static. in this section: cancelfulfillmentorderlineitems(fulfillmentorderid, cancelfulfillmentorderlineitemsinput) cancel fulfillmentorderlineitems from a fulfillmentorder. this action doesn’t cancel the associated orderitemsummaries, so reallocate the canceled quantities to a new fulfillmentorder. createfulfillmentorders(fulfillmentorderinput) create one or more fulfillmentorders and fulfillmentorderlineitems for an orderdeliverygroupsummary, which defines a delivery method and recipient for an ordersummary. you specify the orderitemsummaries to allocate, which can be fulfilled from different locations. specifying multiple fulfillment groups creates one fulfillmentorder for each location. for each orderitemsummary, a fulfillmentorderlineitem is created and assigned to the corresponding fulfillmentorder. createinvoice(fulfillmentorderid, invoiceinput) create an invoice for a fulfillmentorder that doesn’t have one. createmultiplefulfillmentorder(multiplefulfillmentorderinput) create fulfillmentorders for multiple orderdeliverygroups in a single request. createmultipleinvoices(invoicesinput) create invoices for multiple fulfillmentorders. cancelfulfillmentorderlineitems(fulfillmentorderid, cancelfulfillmentorderlineitemsinput) cancel fulfillmentorderlineitems from a fulfillmentorder. this action doesn’t cancel the associated orderitemsummaries, so reallocate the canceled quantities to a new fulfillmentorder. api version 48.0 requires chatter no signature public static connectapi.fulfillmentordercancellineitemsoutputrepresentation cancelfulfillmentorderlineitems(string fulfillmentorderid, 1237apex reference guide fulfillmentorder class connectapi.fulfillmentorderlineitemstocancelinputrepresentation cancelfulfillmentorderlineitemsinput) parameters fulfillmentorderid type: string id of the fulfilllmentorder. cancelfulfillmentorderlineitemsinput type: connectapi.fulfillmentorderlineitemstocancelinputrepresentation list of fulfillmentorderlineitems to cancel. return value type: connectapi.fulfillmentordercancellineitemsoutputrepresentation example string fulfillmentorderid = '0a3xx0000000085aaa'; list itemtocancellist = new list(); for(fulfillmentorderlineitem fulfillmentorderlineitem : fulfillmentorder.fulfillmentorderlineitems){ connectapi.fulfillmentorderlineiteminputrepresentation itemtocancel = new connectapi.fulfillmentorderlineiteminputrepresentation(); itemtocancel.fulfillmentorderlineitemid = fulfillmentorderlineitem.id; itemtocancel.quantity = 1; itemtocancellist.add(itemtocancel); } connectapi.fulfillmentorderlineitemstocancelinputrepresentation input = new connectapi.fulfillmentorderlineitemstocancelinputrepresentation(); input.fulfillmentorderlineitemstocancel = itemtocancellist; connectapi.fulfillmentordercancellineitemsoutputrepresentation result = connectapi.fulfillmentorder.cancelfulfillmentorderlineitems(fulfillmentorderid, input); createfulfillmentorders(fulfillmentorderinput) create one or more fulfillmentorders and fulfillmentorderlineitems for an orderdeliverygroupsummary, which defines a delivery method and recipient for an ordersummary. you specify the orderitemsummaries to allocate, which can be fulfilled from different locations. specifying multiple fulfillment groups creates one fulfillmentorder for each location. for each orderitemsummary, a fulfillmentorderlineitem is created and assigned to the corresponding fulfillmentorder. api version 48.0 1238apex reference guide fulfillmentorder class requires chatter no signature public" "static connectapi.fulfillmentorderoutputrepresentation createfulfillmentorders(connectapi.fulfillmentorderinputrepresentation fulfillmentorderinput) parameters fulfillmentorderinput type: connectapi.fulfillmentorderinputrepresentation orderitemsummaries to allocate, with location and delivery information. return value type: connectapi.fulfillmentorderoutputrepresentation example string ordersummaryid = '1osxx0000004ccg'; string fulfillmenttype = 'warehouse'; string warehousefromlocationid = [select id from location where locationtype='warehouse' limit 1].id; connectapi.fulfillmentorderinputrepresentation fulfillmentorderinput = new connectapi.fulfillmentorderinputrepresentation(); fulfillmentorderinput.ordersummaryid = ordersummaryid; list orderdeliverygroupsummarylist = [select id from orderdeliverygroupsummary where ordersummaryid =: ordersummaryid]; for (orderdeliverygroupsummary orderdeliverygroupsummary: orderdeliverygroupsummarylist){ fulfillmentorderinput.orderdeliverygroupsummaryid = orderdeliverygroupsummary.id; list fulfillmentgroups = new list(); connectapi.fulfillmentgroupinputrepresentation fulfillmentgroup = new connectapi.fulfillmentgroupinputrepresentation(); fulfillmentgroup.fulfilledfromlocationid = warehousefromlocationid; fulfillmentgroup.fulfillmenttype = fulfillmenttype; list orderitemsummaries = new list(); list orderitemsummarylist = [select id, quantity from orderitemsummary where ordersummaryid =: ordersummaryid and orderdeliverygroupsummaryid =: orderdeliverygroupsummary.id]; for(orderitemsummary orderitemsummary : orderitemsummarylist){ 1239apex reference guide fulfillmentorder class connectapi.orderitemsummaryinputrepresentation oisinputrepresentation = new connectapi.orderitemsummaryinputrepresentation(); oisinputrepresentation.orderitemsummaryid = orderitemsummary.id; oisinputrepresentation.quantity = orderitemsummary.quantity; orderitemsummaries.add(oisinputrepresentation); } fulfillmentgroup.orderitemsummaries = orderitemsummaries; fulfillmentgroups.add(fulfillmentgroup); fulfillmentorderinput.fulfillmentgroups = fulfillmentgroups; } connectapi.fulfillmentorderoutputrepresentation result = connectapi.fulfillmentorder.createfulfillmentorders(fulfillmentorderinput); createinvoice(fulfillmentorderid, invoiceinput) create an invoice for a fulfillmentorder that doesn’t have one. api version 48.0 requires chatter no signature public static connectapi.fulfillmentorderinvoiceoutputrepresentation createinvoice(string fulfillmentorderid, connectapi.fulfillmentorderinvoiceinputrepresentation invoiceinput) parameters fulfillmentorderid type: string id of the fulfillmentorder. invoiceinput type: connectapi.fulfillmentorderinvoiceinputrepresentation required input with no data. return value type: connectapi.fulfillmentorderinvoiceoutputrepresentation example string fulfillmentorderid = '0a3xx0000000085aaa'; 1240apex reference guide fulfillmentorder class connectapi.fulfillmentorderinvoiceinputrepresentation input = new connectapi.fulfillmentorderinvoiceinputrepresentation(); connectapi.fulfillmentorderinvoiceoutputrepresentation result = connectapi.fulfillmentorder.createinvoice(fulfillmentorderid, input); createmultiplefulfillmentorder(multiplefulfillmentorderinput) create fulfillmentorders for multiple orderdeliverygroups in a single request. api version 50.0 requires chatter no signature public static connectapi.multiplefulfillmentorderoutputrepresentation createmultiplefulfillmentorder(connectapi.multiplefulfillmentorderinputrepresentation multiplefulfillmentorderinput) parameters multiplefulfillmentorder" "input type: connectapi.multiplefulfillmentorderinputrepresentation wraps a list of inputs for creating fulfillment orders. return value type: connectapi.multiplefulfillmentorderoutputrepresentation createmultipleinvoices(invoicesinput) create invoices for multiple fulfillmentorders. api version 52.0 requires chatter no signature public static connectapi.multiplefulfillmentorderinvoicesoutputrepresentation createmultipleinvoices(connectapi.multiplefulfillmentorderinvoicesinputrepresentation invoicesinput) 1241apex reference guide knowledge class parameters invoicesinput type: connectapi.multiplefulfillmentorderinvoicesinputrepresentation the fulfillmentorders to create invoices for. return value type: connectapi.multiplefulfillmentorderinvoicesoutputrepresentation knowledge class get information about trending articles in experience cloud sites. namespace connectapi knowledge methods the following are methods for knowledge. all methods are static. in this section: gettopviewedarticlesfortopic(communityid, topicid, maxresults) get the top viewed articles for a topic. gettrendingarticles(communityid, maxresults) get trending articles for an experience cloud site. gettrendingarticlesfortopic(communityid, topicid, maxresults) get the trending articles for a topic in an experience cloud site. gettopviewedarticlesfortopic(communityid, topicid, maxresults) get the top viewed articles for a topic. api version 41.0 available to guest users 41.0 requires chatter no 1242apex reference guide knowledge class signature public static connectapi.knowledgearticleversioncollection gettopviewedarticlesfortopic(string communityid, string topicid, integer maxresults) parameters communityid type: string id for an experience cloud site, internal, or null. topicid type: string id of the topic. maxresults type: integer the maximum number of articles returned for each topic id. values can be from 1 to 25. the default value is 5. return value type: connectapi.knowledgearticleversioncollection gettrendingarticles(communityid, maxresults) get trending articles for an experience cloud site. api version 36.0 available to guest users 36.0 requires chatter no signature public static connectapi.knowledgearticleversioncollection gettrendingarticles(string communityid, integer maxresults) parameters communityid type: string id for an experience cloud site, internal, or null. maxresults type: integer 1243apex reference guide knowledge class the maximum number of articles returned. values can be from 0 to 25. default is 5. return value type: connectapi.knowledgearticleversioncollection usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestgettrendingarticles(communityid, maxresults, result) apex developer guide: testing connectapi code gettrendingarticlesfortopic(communityid, topicid, maxresults) get the trending articles for a topic in an experience cloud site. api version 36.0 available to guest users 36.0 requires chatter no signature public static connectapi.knowledgearticleversioncollection gettrendingarticlesfortopic(string communityid, string topicid, integer maxresults) parameters communityid type: string id for an experience cloud site, internal, or null. topicid type: string id of the topic. maxresults type: integer the maximum number of articles returned. values can be from 0 to 25. default is 5. 1244apex reference guide knowledge class return value type: connectapi.knowledgearticleversioncollection usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestgettrendingarticlesfortopic(communityid, topicid, maxresults, result) apex developer guide: testing connectapi code knowledge test methods the following are the test methods for knowledge. all methods are static. for information about using these methods" "to test your connectapi code, see testing connectapi code. settestgettrendingarticles(communityid, maxresults, result) register a connectapi.knowledgeversionarticlecollection object to be returned when the matching connectapi.gettrendingarticles method is called in a test context. use the method with the same parameters or you receive an exception. api version 36.0 signature public static void settestgettrendingarticles(string communityid, integer maxresults, connectapi.knowledgearticleversioncollection result) parameters communityid type: string id for an experience cloud site, internal, or null. maxresults type: integer the maximum number of articles returned. values can be from 0 to 25. default is 5. result type: connectapi.knowledgearticleversioncollection object containing test data. 1245apex reference guide knowledge class return value type: void see also: gettrendingarticles(communityid, maxresults) apex developer guide: testing connectapi code settestgettrendingarticlesfortopic(communityid, topicid, maxresults, result) register a connectapi.knowledgeversionarticlecollection object to be returned when the matching connectapi.gettrendingarticlesfortopic method is called in a test context. use the method with the same parameters or you receive an exception. api version 36.0 signature public static void settestgettrendingarticlesfortopic(string communityid, string topicid, integer maxresults, connectapi.knowledgearticleversioncollection result) parameters communityid type: string id for an experience cloud site, internal, or null. topicid type: string id of the topic. maxresults type: integer the maximum number of articles returned. values can be from 0 to 25. default is 5. result type: connectapi.knowledgearticleversioncollection object containing test data. return value type: void see also: gettrendingarticlesfortopic(communityid, topicid, maxresults) apex developer guide: testing connectapi code 1246apex reference guide lightningscheduler class lightningscheduler class create and update service appointments. namespace connectapi lightningscheduler methods the following are methods for lightningscheduler. all methods are static. in this section: createserviceappointment(createserviceappointmentinput) create a service appointment. updateserviceappointment(updateserviceappointmentinput) update a service appointment. createserviceappointment(createserviceappointmentinput) create a service appointment. api version 53.0 requires chatter no signature public static connectapi.serviceappointmentoutput createserviceappointment(connectapi.createserviceappointmentinput createserviceappointmentinput) parameters createserviceappointmentinput type: connectapi.createserviceappointmentinput input parameters to create a service appointment. return value type: connectapi.serviceappointmentoutput 1247apex reference guide lightningscheduler class usage considerations for using engagement channel types with the service-appointments resource: • enable schedule appointments using engagement channels in salesforce scheduler settings in your salesforce org. • when you create or modify appointments, shifts must be defined in the scheduling policy. for more information on setting up shifts in the scheduling policy, see define shift rules in scheduling policy. note: engagement channel types are not supported with operating hours rules in the scheduling policy. • when you use engagement channel type and shifts to create a service appointment, salesforce scheduler considers the default value for the appointment type (if not specified). however, salesforce scheduler only considers the engagement channel type and appointment type is ignored. example for an account (existing user): connectapi.extendedfieldinput extendedfieldemail = new connectapi.extendedfieldinput(); extendedfieldemail.name = 'email'; extendedfieldemail.value = 'rachael.adams@salesforce.com'; connectapi.extendedfieldinput extendedfieldphone = new connectapi.extendedfieldinput(); extendedfieldphone.name = 'phone'; extendedfieldphone.value = '1234567890'; list extendedfieldlist = new list(); extendedfieldlist.add(extendedfieldemail); extendedfieldlist" .add(extendedfieldphone); connectapi.serviceappointmentinput serviceappinput = new connectapi.serviceappointmentinput(); serviceappinput.extendedfields = extendedfieldlist; serviceappinput.engagementchanneltypeid = '0efrm00000000bv2ai'; serviceappinput.serviceterritoryid = '0hhxx0000004c92cae'; serviceappinput.worktypeid = '08qxx0000004c92aae'; serviceappinput.parentrecordid = '001xx000003gyr1aao'; serviceappinput.schedstarttime = datetime.valueof('2021-05-28 12:15:00'); serviceappinput.schedendtime = datetime.valueof('2021-05-28 12:45:00'); connectapi.assignedresourcesinput asresourceinput = new connectapi.assignedresourcesinput(); asresourceinput.serviceresourceid = '0hnxx0000004caicam'; asresourceinput.isrequiredresource = true; asresourceinput.isprimaryresource = true; list asresourceinputlist = new list(); asresourceinputlist.add(asresourceinput); connectapi.createserviceappointmentinput createinput = new connectapi.createserviceappointmentinput(); createinput.serviceappointment = serviceappinput; createinput.assignedresources = asresourceinputlist; 1248apex reference guide lightningscheduler class try{ connectapi.serviceappointmentoutput appointmentresult = connectapi.lightningscheduler.createserviceappointment(createinput); string serviceappointmentid = appointmentresult.result.serviceappointmentid; list assignedresourceids = appointmentresult.result.assignedresourceids; }catch(connectapi.connectapiexception ex){ //handle exception } for a lead (authenticated guest user): connectapi.leadinput leadinput = new connectapi.leadinput(); leadinput.firstname = 'rachel'; leadinput.lastname = 'adams'; leadinput.phone = '012-345-6789'; leadinput.email = 'rachel.adams@salesforce.com'; leadinput.company = 'salesforce'; connectapi.extendedfieldinput extendedfieldemail = new connectapi.extendedfieldinput(); extendedfieldemail.name = 'email'; extendedfieldemail.value = 'rachael.adams@salesforce.com'; connectapi.extendedfieldinput extendedfieldphone = new connectapi.extendedfieldinput(); extendedfieldphone.name = 'phone'; extendedfieldphone.value = '1234567890'; list extendedfieldlist = new list(); extendedfieldlist.add(extendedfieldemail); extendedfieldlist.add(extendedfieldphone); connectapi.serviceappointmentinput serviceappinput = new connectapi.serviceappointmentinput(); serviceappinput.extendedfields = extendedfieldlist; serviceappinput.engagementchanneltypeid = '0efrm00000000bv2ai'; serviceappinput.serviceterritoryid = '0hhxx0000004c92cae'; serviceappinput.worktypeid = '08qxx0000004c92aae'; serviceappinput.schedstarttime = datetime.valueof('2021-05-28 12:15:00'); serviceappinput.schedendtime = datetime.valueof('2021-05-28 12:45:00'); connectapi.assignedresourcesinput asresourceinput = new connectapi.assignedresourcesinput(); asresourceinput.serviceresourceid = '0hnxx0000004caicam'; asresourceinput.isrequiredresource = true; asresourceinput.isprimaryresource = true; list asresourceinputlist = new list(); asresourceinputlist.add(asresourceinput); connectapi.createserviceappointmentinput createinput = new connectapi.createserviceappointmentinput(); createinput.serviceappointment = serviceappinput; createinput.assignedresources = asresourceinputlist; 1249apex "reference guide lightningscheduler class createinput.lead = leadinput; try{ connectapi.serviceappointmentoutput appointmentresult = connectapi.lightningscheduler.createserviceappointment(createinput); string serviceappointmentid = appointmentresult.result.serviceappointmentid; list assignedresourceids = appointmentresult.result.assignedresourceids; }catch(connectapi.connectapiexception ex){ //handle exception } see also: service appointments updateserviceappointment(updateserviceappointmentinput) update a service appointment. api version 53.0 requires chatter no signature public static connectapi.serviceappointmentoutput updateserviceappointment(connectapi.updateserviceappointmentinput updateserviceappointmentinput) parameters updateserviceappointmentinput type: connectapi.updateserviceappointmentinput input parameters to update a service appointment. return value type: connectapi.serviceappointmentoutput usage considerations for using engagement channel types with the service-appointments resource: • enable schedule appointments using engagement channels in salesforce scheduler settings in your salesforce org. • when you create or modify appointments, shifts must be defined in the scheduling policy. for more information on setting up shifts in the scheduling policy, see define shift rules in scheduling policy. 1250apex reference guide lightningscheduler class note: engagement channel types are not supported with operating hours rules in the scheduling policy. • when you use engagement channel type and shifts to modify an appointment, salesforce scheduler considers the default value for the appointment type (if not specified). however, salesforce scheduler only considers the engagement channel type and appointment type is ignored. example connectapi.extendedfieldinput extendedfieldemail = new connectapi.extendedfieldinput(); extendedfieldemail.name = 'email'; extendedfieldemail.value = 'rachel.adams@salesforce.com.example'; connectapi.extendedfieldinput extendedfieldphone = new connectapi.extendedfieldinput(); extendedfieldphone.name = 'phone'; extendedfieldphone.value = '0123456789'; connectapi.extendedfieldinput extendedfieldstatus = new connectapi.extendedfieldinput(); extendedfieldstatus.name = 'status'; extendedfieldstatus.value = 'none'; list extendedfieldlist = new list(); extendedfieldlist.add(extendedfieldemail); extendedfieldlist.add(extendedfieldphone); extendedfieldlist.add(extendedfieldstatus); connectapi.serviceappointmentinput serviceappinput = new connectapi.serviceappointmentinput(); serviceappinput.extendedfields = extendedfieldlist; serviceappinput.serviceterritoryid = '0hhxx0000004c92cae'; serviceappinput.worktypeid = '08qxx0000004c92aae'; serviceappinput.schedstarttime = datetime.valueof('2021-05-28 12:15:00'); serviceappinput.schedendtime = datetime.valueof('2021-05-28 12:45:00'); connectapi.assignedresourcesinput asresourceinput = new connectapi.assignedresourcesinput(); asresourceinput.serviceresourceid = '0hnxx0000004caicam'; asresourceinput.isrequiredresource = true; asresourceinput.isprimaryresource = true; //multi-resource connectapi.assignedresourcesinput asresourceinputreq = new connectapi.assignedresourcesinput(); asresourceinputreq.serviceresourceid = '0hnxx0000004cagcam'; asresourceinputreq.isrequiredresource = true; asresourceinputreq.isprimaryresource = false; list asresourceinputlist = new list(); asresourceinputlist.add(asresourceinput); asresourceinputlist.add(asresourceinputreq); connectapi.updateserviceappointmentinput updateinput = new 1251apex reference guide managedcontent class connectapi.updateserviceappointmentinput(); updateinput.serviceappointment = serviceappinput; updateinput.assignedresources = asresourceinputlist; updateinput." "serviceappointmentid = '08pxx0000004cyqaam'; try{ connectapi.serviceappointmentoutput appointmentresult = connectapi.lightningscheduler.updateserviceappointment(updateinput); string serviceappointmentid = appointmentresult.result.serviceappointmentid; list assignedresourceids = appointmentresult.result.assignedresourceids; }catch(connectapi.connectapiexception ex){ //handle exception } see also: service appointments managedcontent class get managed content versions. get a managed content space. namespace connectapi managedcontent methods the following are methods for managedcontent. all methods are static. in this section: getallcontent(channelid, pageparam, pagesize, language, managedcontenttype, includemetadata, startdate, enddate) get all managed content versions for a channel. getallcontent(channelid, pageparam, pagesize, language, managedcontenttype, includemetadata, startdate, enddate, showabsoluteurl) get all managed content versions for a channel with absolute urls. getalldeliverychannels(pageparam, pagesize) get managed content delivery channels for the context user. getallmanagedcontent(communityid, pageparam, pagesize, language, managedcontenttype) get all managed content versions for an experience cloud site. getallmanagedcontent(communityid, pageparam, pagesize, language, managedcontenttype, showabsoluteurl) get all managed content versions for an experience cloud site with absolute urls. getcontentbycontentkeys(channelid, contentkeys, pageparam, pagesize, language, managedcontenttype, includemetadata, startdate, enddate, showabsoluteurl) get managed content versions for a channel using a list of content keys. 1252apex reference guide managedcontent class getcontentbyids(channelid, managedcontentids, pageparam, pagesize, language, managedcontenttype, includemetadata, startdate, enddate) get managed content versions for a channel using a list of managed content ids. getcontentbyids(channelid, managedcontentids, pageparam, pagesize, language, managedcontenttype, includemetadata, startdate, enddate, showabsoluteurl) get managed content versions for a channel with absolute urls using a list of managed content ids. getmanagedcontentbycontentkeys(communityid, contentkeys, pageparam, pagesize, language, managedcontenttype, showabsoluteurl) get managed content versions for an experience cloud site using a list of content keys. getmanagedcontentbyids(communityid, managedcontentids, pageparam, pagesize, language, managedcontenttype) get managed content versions for an experience cloud site using a list of managed content ids. getmanagedcontentbyids(communityid, managedcontentids, pageparam, pagesize, language, managedcontenttype, showabsoluteurl) get managed content versions for an experience cloud site with absolute urls using a list of managed content ids. getmanagedcontentbytopics(communityid, topics, pageparam, pagesize, language, managedcontenttype) get managed content versions using a list of content topic names. getmanagedcontentbytopics(communityid, topics, pageparam, pagesize, language, managedcontenttype, showabsoluteurl) get managed content versions with absolute urls using a list of content topic names. getmanagedcontentbytopicsandcontentkeys(communityid, contentkeys, topics, pageparam, pagesize, language, managedcontenttype, showabsoluteurl) get managed content versions using a list of content keys and content topic names. getmanagedcontentbytopicsandids(communityid, managedcontentids, topics, pageparam, pagesize, language, managedcontenttype) get managed content versions using a list of managed content ids and content topic names. getmanagedcontentbytopicsandids(communityid, managedcontentids, topics, pageparam, pagesize, language, managedcontenttype, showabsoluteurl) get managed content versions with absolute urls using a list of managed content ids and content topic names. getmanagedcontentspace(contentspaceid) get a managed content space. getallcontent(channelid, pageparam, pagesize, language, managedcontenttype, includemetadata, startdate, enddate) get all managed content versions for a channel. api version 48.0 available to guest users 48.0 1253apex reference guide managedcontent class requires ch" "atter no signature public static connectapi.managedcontentversioncollection getallcontent(string channelid, integer pageparam, integer pagesize, string language, string managedcontenttype, boolean includemetadata, string startdate, string enddate) parameters channelid type: string id of the channel. pageparam type: integer number of the page you want returned. starts at 0. if you pass in null or 0, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 through 250. for performance reasons, we recommend 25 or fewer items per page. if you pass in null, the default size is 25. language type: string language locale for the managed content, for example, en_us. if the requested translation isn’t available, the language defaults to the context user’s language. if the context user’s language isn’t available, the language defaults to the content type’s original language. managedcontenttype type: string developer name of the content type, such as cms_document or cms_image. includemetadata type: boolean specifies whether to include metadata in the response (true) or not (false). the default value is false. startdate type: string publish start date in iso 8601 format, for example, 2011-02-25t18:24:31.000z. enddate type: string publish end date in iso 8601 format, for example, 2011-02-25t18:24:31.000z. return value type: connectapi.managedcontentversioncollection 1254apex reference guide managedcontent class getallcontent(channelid, pageparam, pagesize, language, managedcontenttype, includemetadata, startdate, enddate, showabsoluteurl) get all managed content versions for a channel with absolute urls. api version 50.0 available to guest users 50.0 requires chatter no signature public static connectapi.managedcontentversioncollection getallcontent(string channelid, integer pageparam, integer pagesize, string language, string managedcontenttype, boolean includemetadata, string startdate, string enddate, boolean showabsoluteurl) parameters channelid type: string id of the channel. pageparam type: integer number of the page you want returned. starts at 0. if you pass in null or 0, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 through 250. for performance reasons, we recommend 25 or fewer items per page. if you pass in null, the default size is 25. language type: string language locale for the managed content, for example, en_us. if the requested translation isn’t available, the language defaults to the context user’s language. if the context user’s language isn’t available, the language defaults to the content type’s original language. managedcontenttype type: string developer name of the content type, such as cms_document or cms_image. includemetadata type: boolean specifies whether to include metadata in the response (true) or not (false). the default value is false. 1255apex reference guide managedcontent class startdate type: string publish start date in iso 8601 format, for example, 2011-02-25t18:24:31.000z. enddate type: string publish end date in iso 8601 format, for example, 2011-02-25t18:24:31.000z. showabsoluteurl type: boolean specifies whether to show absolute urls in the output class (true) or not (false). the default value is false. return value type: connectapi.managedcontentversioncollection getalldeliverychannels(pageparam, pagesize) get managed content delivery channels for the context user. api version 48.0 available to guest users 48.0 requires chatter no signature public static connectapi.managedcontentchannelcollection getalldeliverychannels(integer pageparam, integer pagesize) parameters pageparam type: integer number of the page you want returned. starts at 0. if you pass in null or 0, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 through 250. if you pass in" "null, the default size is 25. return value type: connectapi.managedcontentchannelcollection 1256apex reference guide managedcontent class getallmanagedcontent(communityid, pageparam, pagesize, language, managedcontenttype) get all managed content versions for an experience cloud site. api version 47.0 available to guest users 47.0 requires chatter no signature public static connectapi.managedcontentversioncollection getallmanagedcontent(string communityid, integer pageparam, integer pagesize, string language, string managedcontenttype) parameters communityid type: string id of the experience cloud site. pageparam type: integer number of the page you want returned. starts at 0. if you pass in null or 0, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 through 250. for performance reasons, we recommend 25 or fewer items per page. if you pass in null, the default size is 25. language type: string language locale for the managed content, for example, en_us. if the requested translation isn’t available, the language defaults to the context user’s language. if the context user’s language isn’t available, the language defaults to the content type’s original language. managedcontenttype type: string developer name of the content type, such as cms_document or cms_image. return value type: connectapi.managedcontentversioncollection 1257apex reference guide managedcontent class getallmanagedcontent(communityid, pageparam, pagesize, language, managedcontenttype, showabsoluteurl) get all managed content versions for an experience cloud site with absolute urls. api version 50.0 available to guest users 50.0 requires chatter no signature public static connectapi.managedcontentversioncollection getallmanagedcontent(string communityid, integer pageparam, integer pagesize, string language, string managedcontenttype, boolean showabsoluteurl) parameters communityid type: string id of the experience cloud site. pageparam type: integer number of the page you want returned. starts at 0. if you pass in null or 0, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 through 250. for performance reasons, we recommend 25 or fewer items per page. if you pass in null, the default size is 25. language type: string language locale for the managed content, for example, en_us. if the requested translation isn’t available, the language defaults to the context user’s language. if the context user’s language isn’t available, the language defaults to the content type’s original language. managedcontenttype type: string developer name of the content type, such as cms_document or cms_image. showabsoluteurl type: boolean specifies whether to show absolute urls in the output class (true) or not (false). the default value is false. 1258apex reference guide managedcontent class return value type: connectapi.managedcontentversioncollection getcontentbycontentkeys(channelid, contentkeys, pageparam, pagesize, language, managedcontenttype, includemetadata, startdate, enddate, showabsoluteurl) get managed content versions for a channel using a list of content keys. api version 51.0 available to guest users 51.0 requires chatter no signature public static connectapi.managedcontentversioncollection getcontentbycontentkeys(string channelid, list contentkeys, integer pageparam, integer pagesize, string language, string managedcontenttype, boolean includemetadata, string startdate, string enddate, boolean showabsoluteurl) parameters channelid type: string id of the channel. contentkeys type: list list of up to 50 content keys for the managed content. a content key is a universally unique identifier (uuid) such as mca4ccv5qs2bab5h7yrcrptcwgzq. pageparam type: integer number of the page you want returned. starts at 0. if you pass in null or 0, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 through 250. for performance" "reasons, we recommend 25 or fewer items per page. if you pass in null, the default size is 25. language type: string 1259apex reference guide managedcontent class language locale for the managed content, for example, en_us. if the requested translation isn’t available, the language defaults to the context user’s language. if the context user’s language isn’t available, the language defaults to the content type’s original language. managedcontenttype type: string developer name of the content type, such as cms_document or cms_image. includemetadata type: boolean specifies whether to include metadata in the response (true) or not (false). the default value is false. startdate type: string publish start date in iso 8601 format, for example, 2011-02-25t18:24:31.000z. enddate type: string publish end date in iso 8601 format, for example, 2011-02-25t18:24:31.000z. showabsoluteurl type: boolean specifies whether to show absolute urls in the output class (true) or not (false). the default value is false. return value type: connectapi.managedcontentversioncollection getcontentbyids(channelid, managedcontentids, pageparam, pagesize, language, managedcontenttype, includemetadata, startdate, enddate) get managed content versions for a channel using a list of managed content ids. api version 48.0 available to guest users 48.0 requires chatter no signature public static connectapi.managedcontentversioncollection getcontentbyids(string channelid, list managedcontentids, integer pageparam, integer pagesize, string language, string managedcontenttype, boolean includemetadata, string startdate, string enddate) 1260apex reference guide managedcontent class parameters channelid type: string id of the channel. managedcontentids type: list comma-separated list of managed content ids. pageparam type: integer number of the page you want returned. starts at 0. if you pass in null or 0, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 through 250. for performance reasons, we recommend 25 or fewer items per page. if you pass in null, the default size is 25. language type: string language locale for the managed content, for example, en_us. if the requested translation isn’t available, the language defaults to the context user’s language. if the context user’s language isn’t available, the language defaults to the content type’s original language. managedcontenttype type: string developer name of the content type, such as cms_document or cms_image. includemetadata type: boolean specifies whether to include metadata in the response (true) or not (false). the default value is false. startdate type: string publish start date in iso 8601 format, for example, 2011-02-25t18:24:31.000z. enddate type: string publish end date in iso 8601 format, for example, 2011-02-25t18:24:31.000z. return value type: connectapi.managedcontentversioncollection getcontentbyids(channelid, managedcontentids, pageparam, pagesize, language, managedcontenttype, includemetadata, startdate, enddate, showabsoluteurl) get managed content versions for a channel with absolute urls using a list of managed content ids. 1261apex reference guide managedcontent class api version 50.0 available to guest users 50.0 requires chatter no signature public static connectapi.managedcontentversioncollection getcontentbyids(string channelid, list managedcontentids, integer pageparam, integer pagesize, string language, string managedcontenttype, boolean includemetadata, string startdate, string enddate, boolean showabsoluteurl) parameters channelid type: string id of the channel. managedcontentids type: list comma-separated list of managed content ids. pageparam type: integer number of the page you want returned. starts at 0. if you pass in null or 0, the first page is returned. pagesize" "type: integer specifies the number of items per page. valid values are from 1 through 250. for performance reasons, we recommend 25 or fewer items per page. if you pass in null, the default size is 25. language type: string language locale for the managed content, for example, en_us. if the requested translation isn’t available, the language defaults to the context user’s language. if the context user’s language isn’t available, the language defaults to the content type’s original language. managedcontenttype type: string developer name of the content type, such as cms_document or cms_image. includemetadata type: boolean specifies whether to include metadata in the response (true) or not (false). the default value is false. 1262apex reference guide managedcontent class startdate type: string publish start date in iso 8601 format, for example, 2011-02-25t18:24:31.000z. enddate type: string publish end date in iso 8601 format, for example, 2011-02-25t18:24:31.000z. showabsoluteurl type: boolean specifies whether to show absolute urls in the output class (true) or not (false). the default value is false. return value type: connectapi.managedcontentversioncollection getmanagedcontentbycontentkeys(communityid, contentkeys, pageparam, pagesize, language, managedcontenttype, showabsoluteurl) get managed content versions for an experience cloud site using a list of content keys. api version 51.0 available to guest users 51.0 requires chatter no signature public static connectapi.managedcontentversioncollection getmanagedcontentbycontentkeys(string communityid, list contentkeys, integer pageparam, integer pagesize, string language, string managedcontenttype, boolean showabsoluteurl) parameters communityid type: string id of the experience cloud site. contentkeys type: list list of up to 50 content keys for the managed content. a content key is a universally unique identifier (uuid) such as mca4ccv5qs2bab5h7yrcrptcwgzq. 1263apex reference guide managedcontent class pageparam type: integer number of the page you want returned. starts at 0. if you pass in null or 0, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 through 250. for performance reasons, we recommend 25 or fewer items per page. if you pass in null, the default size is 25. language type: string language locale for the managed content, for example, en_us. if the requested translation isn’t available, the language defaults to the context user’s language. if the context user’s language isn’t available, the language defaults to the content type’s original language. managedcontenttype type: string developer name of the content type, such as cms_document or cms_image. showabsoluteurl type: boolean specifies whether to show absolute urls in the output class (true) or not (false). the default value is false. return value type: connectapi.managedcontentversioncollection getmanagedcontentbyids(communityid, managedcontentids, pageparam, pagesize, language, managedcontenttype) get managed content versions for an experience cloud site using a list of managed content ids. api version 47.0 available to guest users 47.0 requires chatter no signature public static connectapi.managedcontentversioncollection getmanagedcontentbyids(string communityid, list managedcontentids, integer pageparam, integer pagesize, string language, string managedcontenttype) 1264apex reference guide managedcontent class parameters communityid type: string id of the experience cloud site. managedcontentids type: list comma-separated list of managed content ids. pageparam type: integer number of the page you want returned. starts at 0. if you pass in null or 0, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 through 250. for performance reasons, we recommend 25 or fewer items per page. if you pass in null, the default size" "is 25. language type: string language locale for the managed content, for example, en_us. if the requested translation isn’t available, the language defaults to the context user’s language. if the context user’s language isn’t available, the language defaults to the content type’s original language. managedcontenttype type: string developer name of the content type, such as cms_document or cms_image. return value type: connectapi.managedcontentversioncollection getmanagedcontentbyids(communityid, managedcontentids, pageparam, pagesize, language, managedcontenttype, showabsoluteurl) get managed content versions for an experience cloud site with absolute urls using a list of managed content ids. api version 50.0 available to guest users 50.0 requires chatter no 1265apex reference guide managedcontent class signature public static connectapi.managedcontentversioncollection getmanagedcontentbyids(string communityid, list managedcontentids, integer pageparam, integer pagesize, string language, string managedcontenttype, boolean showabsoluteurl) parameters communityid type: string id of the experience cloud site. managedcontentids type: list comma-separated list of managed content ids. pageparam type: integer number of the page you want returned. starts at 0. if you pass in null or 0, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 through 250. for performance reasons, we recommend 25 or fewer items per page. if you pass in null, the default size is 25. language type: string language locale for the managed content, for example, en_us. if the requested translation isn’t available, the language defaults to the context user’s language. if the context user’s language isn’t available, the language defaults to the content type’s original language. managedcontenttype type: string developer name of the content type, such as cms_document or cms_image. showabsoluteurl type: boolean specifies whether to show absolute urls in the output class (true) or not (false). the default value is false. return value type: connectapi.managedcontentversioncollection getmanagedcontentbytopics(communityid, topics, pageparam, pagesize, language, managedcontenttype) get managed content versions using a list of content topic names. api version 47.0 1266apex reference guide managedcontent class available to guest users 47.0 requires chatter no signature public static connectapi.managedcontentversioncollection getmanagedcontentbytopics(string communityid, list topics, integer pageparam, integer pagesize, string language, string managedcontenttype) parameters communityid type: string id of the experience cloud site. topics type: list comma-separated list of up to 15 content topic names. pageparam type: integer number of the page you want returned. starts at 0. if you pass in null or 0, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 through 250. for performance reasons, we recommend 25 or fewer items per page. if you pass in null, the default size is 25. language type: string language locale for the managed content, for example, en_us. if the requested translation isn’t available, the language defaults to the context user’s language. if the context user’s language isn’t available, the language defaults to the content type’s original language. managedcontenttype type: string developer name of the content type, such as cms_document or cms_image. return value type: connectapi.managedcontentversioncollection getmanagedcontentbytopics(communityid, topics, pageparam, pagesize, language, managedcontenttype, showabsoluteurl) get managed content versions with absolute urls using a list of content topic names. 1267apex reference guide managedcontent class api version 50.0 available to guest users 50.0 requires chatter no signature public static connectapi.managedcontentversioncollection getmanagedcontentbytopics(string communityid, list topics, integer pageparam, integer page" "size, string language, string managedcontenttype, boolean showabsoluteurl) parameters communityid type: string id of the experience cloud site. topics type: list comma-separated list of up to 15 content topic names. pageparam type: integer number of the page you want returned. starts at 0. if you pass in null or 0, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 through 250. for performance reasons, we recommend 25 or fewer items per page. if you pass in null, the default size is 25. language type: string language locale for the managed content, for example, en_us. if the requested translation isn’t available, the language defaults to the context user’s language. if the context user’s language isn’t available, the language defaults to the content type’s original language. managedcontenttype type: string developer name of the content type, such as cms_document or cms_image. showabsoluteurl type: boolean specifies whether to show absolute urls in the output class (true) or not (false). the default value is false. 1268apex reference guide managedcontent class return value type: connectapi.managedcontentversioncollection getmanagedcontentbytopicsandcontentkeys(communityid, contentkeys, topics, pageparam, pagesize, language, managedcontenttype, showabsoluteurl) get managed content versions using a list of content keys and content topic names. api version 51.0 available to guest users 51.0 requires chatter no signature public static connectapi.managedcontentversioncollection getmanagedcontentbytopicsandcontentkeys(string communityid, list contentkeys, list topics, integer pageparam, integer pagesize, string language, string managedcontenttype, boolean showabsoluteurl) parameters communityid type: string id of the experience cloud site. contentkeys type: list list of up to 50 content keys for the managed content. a content key is a universally unique identifier (uuid) such as mca4ccv5qs2bab5h7yrcrptcwgzq. topics type: list comma-separated list of up to 15 content topic names. pageparam type: integer number of the page you want returned. starts at 0. if you pass in null or 0, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 through 250. for performance reasons, we recommend 25 or fewer items per page. if you pass in null, the default size is 25. 1269apex reference guide managedcontent class language type: string language locale for the managed content, for example, en_us. if the requested translation isn’t available, the language defaults to the context user’s language. if the context user’s language isn’t available, the language defaults to the content type’s original language. managedcontenttype type: string developer name of the content type, such as cms_document or cms_image. showabsoluteurl type: boolean specifies whether to show absolute urls in the output class (true) or not (false). the default value is false. return value type: connectapi.managedcontentversioncollection getmanagedcontentbytopicsandids(communityid, managedcontentids, topics, pageparam, pagesize, language, managedcontenttype) get managed content versions using a list of managed content ids and content topic names. api version 47.0 available to guest users 47.0 requires chatter no signature public static connectapi.managedcontentversioncollection getmanagedcontentbytopicsandids(string communityid, list managedcontentids, list topics, integer pageparam, integer pagesize, string language, string managedcontenttype) parameters communityid type: string id of the experience cloud site. managedcontentids type: list 1270apex reference guide managedcontent class comma-separated list of managed content ids. topics type: list comma-separated list of up to 15 content topic names. pageparam type: integer number of the page you want returned" ". starts at 0. if you pass in null or 0, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 through 250. for performance reasons, we recommend 25 or fewer items per page. if you pass in null, the default size is 25. language type: string language locale for the managed content, for example, en_us. if the requested translation isn’t available, the language defaults to the context user’s language. if the context user’s language isn’t available, the language defaults to the content type’s original language. managedcontenttype type: string developer name of the content type, such as cms_document or cms_image. return value type: connectapi.managedcontentversioncollection getmanagedcontentbytopicsandids(communityid, managedcontentids, topics, pageparam, pagesize, language, managedcontenttype, showabsoluteurl) get managed content versions with absolute urls using a list of managed content ids and content topic names. api version 50.0 available to guest users 50.0 requires chatter no signature public static connectapi.managedcontentversioncollection getmanagedcontentbytopicsandids(string communityid, list managedcontentids, 1271apex reference guide managedcontent class list topics, integer pageparam, integer pagesize, string language, string managedcontenttype, boolean showabsoluteurl) parameters communityid type: string id of the experience cloud site. managedcontentids type: list comma-separated list of managed content ids. topics type: list comma-separated list of up to 15 content topic names. pageparam type: integer number of the page you want returned. starts at 0. if you pass in null or 0, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 through 250. for performance reasons, we recommend 25 or fewer items per page. if you pass in null, the default size is 25. language type: string language locale for the managed content, for example, en_us. if the requested translation isn’t available, the language defaults to the context user’s language. if the context user’s language isn’t available, the language defaults to the content type’s original language. managedcontenttype type: string developer name of the content type, such as cms_document or cms_image. showabsoluteurl type: boolean specifies whether to show absolute urls in the output class (true) or not (false). the default value is false. return value type: connectapi.managedcontentversioncollection getmanagedcontentspace(contentspaceid) get a managed content space. api version 55.0 1272apex reference guide managedcontentdelivery class requires chatter no signature public static connectapi.managedcontentspace getmanagedcontentspace(string contentspaceid) parameters contentspaceid type: string id of the managed content space. return value type: connectapi.managedcontentspace managedcontentdelivery class get collection items. get collection metadata. get a managed content channel. get managed content. namespace connectapi managedcontentdelivery methods the following are methods for managedcontentdelivery. all methods are static. in this section: getcollectionitemsforchannel(channelid, collectionkeyorid, language) get collection items for a channel. getcollectionitemsforsite(siteid, collectionkeyorid, language) get collection items for an experience cloud site. getmanagedcontentchannel(channelid) get a managed content channel. getmanagedcontentforchannel(channelid, contentkeyorid, showabsoluteurl) get a piece of published content for a channel. getmanagedcontentforchannel(channelid, contentkeyorid, language, showabsoluteurl) get a piece of published content in a specified language for a channel. getmanagedcontentforchannel(channelid, contentkeyorid, language, showabsoluteurl, referencedepth, expandreferences, referencesaslist) get a piece of published content in a specified language with references for a channel. 1273apex reference guide managedcontentdelivery class getmanagedcontentforsite(siteid, contentkeyor" "id, showabsoluteurl) get a piece of published content for an experience cloud site. getmanagedcontentforsite(siteid, contentkeyorid, language, showabsoluteurl) get a piece of published content in a specified language for an experience cloud site. getmanagedcontentforsite(siteid, contentkeyorid, language, showabsoluteurl, referencedepth, expandreferences, referencesaslist) get a piece of published content in a specified language with references for an experience cloud site. getmanagedcontentsforchannel(channelid, managedcontentids, contentkeys, contenttypefqn, language, publishstartdate, publishenddate, includecontentbody, referencedepth, expandreferences, referencesaslist, pageparam, pagesize) get a collection of published contents for a channel. getmanagedcontentsforchannel(channelid, managedcontentids, contentkeys, contenttypefqn, language, publishstartdate, publishenddate, includecontentbody, referencedepth, expandreferences, referencesaslist, pageparam, pagesize, showabsoluteurl) get a collection of published contents for a channel. getmanagedcontentsforsite(siteid, managedcontentids, contentkeys, contenttypefqn, language, publishstartdate, publishenddate, includecontentbody, referencedepth, expandreferences, referencesaslist, pageparam, pagesize) get a collection of published contents for an experience cloud site. getmanagedcontentsforsite(siteid, managedcontentids, contentkeys, contenttypefqn, language, publishstartdate, publishenddate, includecontentbody, referencedepth, expandreferences, referencesaslist, pageparam, pagesize, showabsoluteurl) get a collection of published contents for an experience cloud site. getcollectionitemsforchannel(channelid, collectionkeyorid, language) get collection items for a channel. api version 56.0 available to guest users 56.0 requires chatter no signature public static connectapi.managedcontentcollectionitems getcollectionitemsforchannel(string channelid, string collectionkeyorid, string language) parameters channelid type: string id of the channel. collectionkeyorid type: string 1274apex reference guide managedcontentdelivery class collection key or id of the collection. a collection key is a unique identifier such as mca4ccv5qs2bab5h7yrcrptcwgzq. language type: string language locale for the managed content, for example, en_us. if the requested translation isn’t available, the language defaults to the channel or site’s default language. if the channel or site’s default language isn’t available, the language defaults to the primary language of the content space. return value type: connectapi.managedcontentcollectionitems getcollectionitemsforsite(siteid, collectionkeyorid, language) get collection items for an experience cloud site. api version 56.0 available to guest users 56.0 requires chatter no signature public static connectapi.managedcontentcollectionitems getcollectionitemsforsite(string siteid, string collectionkeyorid, string language) parameters siteid type: string id for the experience cloud site. collectionkeyorid type: string collection key or id of the collection. a collection key is a unique identifier such as mca4ccv5qs2bab5h7yrcrptcwgzq. language type: string language locale for the managed content, for example, en_us. if the requested translation isn’t available, the language defaults to the channel or site’s default language. if the channel or site’s default language isn’t available, the language defaults to the primary language of the content space. 1275apex reference guide managedcontentdelivery class return value type: connectapi.managedcontentcollectionitems getmanagedcontentchannel(channelid) get a managed content channel. api version 54.0 available to guest users 54.0 requires chatter no signature public static connectapi.managedcontentchanneldetail getmanagedcontentchannel(string channelid) parameters channelid type: string id of the channel. return value type: connectapi.managedcontentchanneldetail getmanagedcontentforchannel(channelid, contentkeyorid, showabsoluteurl) get a piece of published content for" "a channel. api version 54.0 available to guest users 54.0 requires chatter no 1276apex reference guide managedcontentdelivery class signature public static connectapi.managedcontentdeliverydocument getmanagedcontentforchannel(string channelid, string contentkeyorid, boolean showabsoluteurl) parameters channelid type: string id of the channel. contentkeyorid type: string content key or id of the content. a content key is a unique identifier such as mca4ccv5qs2bab5h7yrcrptcwgzq. showabsoluteurl type: boolean for public channels only, specifies whether to return the absolute unauthenticatedurl in the output class. the default value is false. return value type: connectapi.managedcontentdeliverydocument usage this method returns content only if it's published in the default language of the channel. if you request content that isn’t published in the default language of the channel, you get a connectapi.notfoundexception. to get content for a channel in another language use getmanagedcontentforchannel(channelid, contentkeyorid, language, showabsoluteurl) or getmanagedcontentforchannel(channelid, contentkeyorid, language, showabsoluteurl, referencedepth, expandreferences, referencesaslist) on page 1278. getmanagedcontentforchannel(channelid, contentkeyorid, language, showabsoluteurl) get a piece of published content in a specified language for a channel. api version 54.0 available to guest users 54.0 requires chatter no 1277apex reference guide managedcontentdelivery class signature public static connectapi.managedcontentdeliverydocument getmanagedcontentforchannel(string channelid, string contentkeyorid, string language, boolean showabsoluteurl) parameters channelid type: string id of the channel. contentkeyorid type: string content key or id of the content. a content key is a unique identifier such as mca4ccv5qs2bab5h7yrcrptcwgzq. language type: string language locale for the managed content, for example, en_us. the requested language must be added to the channel, otherwise, you get a connectapi.notfoundexception. if the requested translation isn’t available, the language defaults to the channel or site’s default language. if the channel or site’s default language isn’t available, the language defaults to the primary language of the content space. showabsoluteurl type: boolean for public channels only, specifies whether to return the absolute unauthenticatedurl in the output class. the default value is false. return value type: connectapi.managedcontentdeliverydocument getmanagedcontentforchannel(channelid, contentkeyorid, language, showabsoluteurl, referencedepth, expandreferences, referencesaslist) get a piece of published content in a specified language with references for a channel. api version 54.0 available to guest users 54.0 requires chatter no 1278apex reference guide managedcontentdelivery class signature public static connectapi.managedcontentdeliverydocument getmanagedcontentforchannel(string channelid, string contentkeyorid, string language, boolean showabsoluteurl, integer referencedepth, boolean expandreferences, boolean referencesaslist) parameters channelid type: string id of the channel. contentkeyorid type: string content key or id of the content. a content key is a unique identifier such as mca4ccv5qs2bab5h7yrcrptcwgzq. language type: string language locale for the managed content, for example, en_us. the requested language must be added to the channel, otherwise, you get a connectapi.notfoundexception. if the requested translation isn’t available, the language defaults to the channel or site’s default language. if the channel or site’s default language isn’t available, the language defaults to the primary language of the content space. showabsoluteurl type: boolean for public channels only, specifies whether to return the absolute unauthenticatedurl in the output class. the default value is false. referencedepth type: integer an integer 0–3 specifying the depth of references. if you specify 0, the references property of the" "connectapi.managedcontentdeliverydocument output class is null. if unspecified, the default value is 0. expandreferences type: boolean specifies whether to include details of references (true) or summaries of references (false) in the output class. if unspecified, the default value is false. referencesaslist type: boolean specifies whether to return the references as a list in the referenceslist property of the connectapi.managedcontentdeliverydocument output class (true). if you specify false, the references are returned as key value pairs in the references property. if unspecified, the default value is false. return value type: connectapi.managedcontentdeliverydocument getmanagedcontentforsite(siteid, contentkeyorid, showabsoluteurl) get a piece of published content for an experience cloud site. 1279apex reference guide managedcontentdelivery class api version 54.0 available to guest users 54.0 requires chatter no signature public static connectapi.managedcontentdeliverydocument getmanagedcontentforsite(string siteid, string contentkeyorid, boolean showabsoluteurl) parameters siteid type: string id for the experience cloud site. contentkeyorid type: string content key or id of the content. a content key is a unique identifier such as mca4ccv5qs2bab5h7yrcrptcwgzq. showabsoluteurl type: boolean for public channels only, specifies whether to return the absolute unauthenticatedurl in the output class. the default value is false. return value type: connectapi.managedcontentdeliverydocument getmanagedcontentforsite(siteid, contentkeyorid, language, showabsoluteurl) get a piece of published content in a specified language for an experience cloud site. api version 54.0 available to guest users 54.0 requires chatter no 1280apex reference guide managedcontentdelivery class signature public static connectapi.managedcontentdeliverydocument getmanagedcontentforsite(string siteid, string contentkeyorid, string language, boolean showabsoluteurl) parameters siteid type: string id for the experience cloud site. contentkeyorid type: string content key or id of the content. a content key is a unique identifier such as mca4ccv5qs2bab5h7yrcrptcwgzq. language type: string language locale for the managed content, for example, en_us. if the requested translation isn’t available, the language defaults to the channel or site’s default language. if the channel or site’s default language isn’t available, the language defaults to the primary language of the content space. showabsoluteurl type: boolean for public channels only, specifies whether to return the absolute unauthenticatedurl in the output class. the default value is false. return value type: connectapi.managedcontentdeliverydocument getmanagedcontentforsite(siteid, contentkeyorid, language, showabsoluteurl, referencedepth, expandreferences, referencesaslist) get a piece of published content in a specified language with references for an experience cloud site. api version 54.0 available to guest users 54.0 requires chatter no 1281apex reference guide managedcontentdelivery class signature public static connectapi.managedcontentdeliverydocument getmanagedcontentforsite(string siteid, string contentkeyorid, string language, boolean showabsoluteurl, integer referencedepth, boolean expandreferences, boolean referencesaslist) parameters siteid type: string id for the experience cloud site. contentkeyorid type: string content key or id of the content. a content key is a unique identifier such as mca4ccv5qs2bab5h7yrcrptcwgzq. language type: string language locale for the managed content, for example, en_us. if the requested translation isn’t available, the language defaults to the channel or site’s default language. if the channel or site’s default language isn’t available, the language defaults to the primary language of the content space. showabsoluteurl type: boolean for public channels only, specifies whether to return the absolute unauthenticatedurl in the output class. the default value is false. referencedepth type: integer an integer 0–3" "specifying the depth of references. if you specify 0, the references property of the connectapi.managedcontentdeliverydocument output class is null. if unspecified, the default value is 0. expandreferences type: boolean specifies whether to include details of references (true) or summaries of references (false) in the output class. if unspecified, the default value is false. referencesaslist type: boolean specifies whether to return the references as a list in the referenceslist property of the connectapi.managedcontentdeliverydocument output class (true). if you specify false, the references are returned as key value pairs in the references property. if unspecified, the default value is false. return value type: connectapi.managedcontentdeliverydocument getmanagedcontentsforchannel(channelid, managedcontentids, contentkeys, contenttypefqn, language, publishstartdate, publishenddate, 1282" "apex reference guide managedcontentdelivery class includecontentbody, referencedepth, expandreferences, referencesaslist, pageparam, pagesize) get a collection of published contents for a channel. api version 55.0—57.0 in version 58.0 and later, use getmanagedcontentsforchannel(channelid, managedcontentids, contentkeys, contenttypefqn, language, publishstartdate, publishenddate, includecontentbody, referencedepth, expandreferences, referencesaslist, pageparam, pagesize, showabsoluteurl). available to guest users 55.0—57.0 requires chatter no signature public static connectapi.managedcontentdeliverydocumentcollection getmanagedcontentsforchannel(string channelid, list managedcontentids, list contentkeys, string contenttypefqn, string language, string publishstartdate, string publishenddate, boolean includecontentbody, integer referencedepth, boolean expandreferences, boolean referencesaslist, integer pageparam, integer pagesize) parameters channelid type: string id of the channel. managedcontentids type: list comma-separated list of up to 100 managed content ids. specify either managed content ids or content keys. contentkeys type: list comma-separated list of up to 50 content keys. specify either managed content ids or content keys. contenttypefqn type: string fully qualified name of the managed content type. language type: string 1283apex reference guide managedcontentdelivery class language locale for the managed content, for example, en_us. if the requested translation isn’t available, the language defaults to the configured fallback language or the channel’s default language. if the content isn’t available in the fallback language and the channel’s default language, we return an error. publishstartdate type: string iso 8601 formatted publish start date. publishenddate type: string iso 8601 formatted publish end date. includecontentbody type: boolean specifies whether to return the content body (true) or the content summary (false). if unspecified, the default value is false. referencedepth type: integer an integer 0–3 specifying the depth of references. if you specify 0, the references property of the connectapi.managedcontentdeliverydocumentcollection output class is null. if unspecified, the default value is 0. expandreferences type: boolean specifies whether to include details of references (true) or summaries of references (false) in the output class. if unspecified, the default value is false. referencesaslist type: boolean specifies whether to return the references as a list in the referenceslist property of the connectapi.managedcontentdeliverydocumentcollection output class (true). if you specify false, the references are returned as key value pairs in the references property. if unspecified, the default value is false. pageparam type: integer number of the page you want returned. starts at 0. if you pass in null or 0, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 through 250. if you pass in null, the default size is 25. if you specify true for expandreferences or includecontentbody, the maximum page size you can specify is 25. return value type: connectapi.managedcontentdeliverydocumentcollection getmanagedcontentsforchannel(channelid, managedcontentids, contentkeys, contenttypefqn, language, publishstartdate, publishenddate, 1284apex reference guide managedcontentdelivery class includecontentbody, referencedepth, expandreferences, referencesaslist, pageparam, pagesize, showabsoluteurl) get a collection of published contents for a channel. api version 58.0 available to guest users 58.0 requires chatter no signature public static connectapi.managedcontentdeliverydocumentcollection getmanagedcontentsforchannel(string channelid, list managedcontentids, list contentkeys, string contenttypefqn, string language, string publishstartdate, string publishenddate, boolean includecontentbody, integer referencedepth, boolean expandreferences, boolean referencesaslist, integer pageparam, integer pagesize, boolean showabsoluteurl) parameters channelid type: string id of the channel. managedcontentids type: list" "comma-separated list of up to 100 managed content ids. specify either managed content ids or content keys. contentkeys type: list comma-separated list of up to 50 content keys. specify either managed content ids or content keys. contenttypefqn type: string fully qualified name of the managed content type. language type: string language locale for the managed content, for example, en_us. if the requested translation isn’t available, the language defaults to the configured fallback language or the channel’s default language. if the content isn’t available in the fallback language and the channel’s default language, we return an error. publishstartdate type: string 1285apex reference guide managedcontentdelivery class iso 8601 formatted publish start date. publishenddate type: string iso 8601 formatted publish end date. includecontentbody type: boolean specifies whether to return the content body (true) or the content summary (false). if unspecified, the default value is false. referencedepth type: integer an integer 0–3 specifying the depth of references. if you specify 0, the references property of the connectapi.managedcontentdeliverydocumentcollection output class is null. if unspecified, the default value is 0. expandreferences type: boolean specifies whether to include details of references (true) or summaries of references (false) in the output class. if unspecified, the default value is false. referencesaslist type: boolean specifies whether to return the references as a list in the referenceslist property of the connectapi.managedcontentdeliverydocumentcollection output class (true). if you specify false, the references are returned as key value pairs in the references property. if unspecified, the default value is false. pageparam type: integer number of the page you want returned. starts at 0. if you pass in null or 0, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 through 250. if you pass in null, the default size is 25. if you specify true for expandreferences or includecontentbody, the maximum page size you can specify is 25. showabsoluteurl type: boolean specifies whether to show absolute urls in the output class (true) or not (false). the default value is false. return value type: connectapi.managedcontentdeliverydocumentcollection getmanagedcontentsforsite(siteid, managedcontentids, contentkeys, contenttypefqn, language, publishstartdate, publishenddate, includecontentbody, referencedepth, expandreferences, referencesaslist, pageparam, pagesize) get a collection of published contents for an experience cloud site. 1286apex reference guide managedcontentdelivery class api version 55.0—57.0 in version 58.0 and later, use getmanagedcontentsforsite(siteid, managedcontentids, contentkeys, contenttypefqn, language, publishstartdate, publishenddate, includecontentbody, referencedepth, expandreferences, referencesaslist, pageparam, pagesize, showabsoluteurl). available to guest users 55.0—57.0 requires chatter no signature public static connectapi.managedcontentdeliverydocumentcollection getmanagedcontentsforsite(string siteid, list managedcontentids, list contentkeys, string contenttypefqn, string language, string publishstartdate, string publishenddate, boolean includecontentbody, integer referencedepth, boolean expandreferences, boolean referencesaslist, integer pageparam, integer pagesize) parameters siteid type: string id for the experience cloud site. managedcontentids type: list comma-separated list of up to 100 managed content ids. specify either managed content ids or content keys. contentkeys type: list comma-separated list of up to 50 content keys. specify either managed content ids or content keys. contenttypefqn type: string fully qualified name of the managed content type. language type: string language locale for the managed content, for example, en_us. if the requested translation isn’t available, the language defaults to the configured fallback language or the channel’s default language. if the content isn’t available in the fallback language and the channel’s default language, we return an error." "publishstartdate type: string iso 8601 formatted publish start date. 1287apex reference guide managedcontentdelivery class publishenddate type: string iso 8601 formatted publish end date. includecontentbody type: boolean specifies whether to return the content body (true) or the content summary (false). if unspecified, the default value is false. referencedepth type: integer an integer 0–3 specifying the depth of references. if you specify 0, the references property of the connectapi.managedcontentdeliverydocumentcollection output class is null. if unspecified, the default value is 0. expandreferences type: boolean specifies whether to include details of references (true) or summaries of references (false) in the output class. if unspecified, the default value is false. referencesaslist type: boolean specifies whether to return the references as a list in the referenceslist property of the connectapi.managedcontentdeliverydocumentcollection output class (true). if you specify false, the references are returned as key value pairs in the references property. if unspecified, the default value is false. pageparam type: integer number of the page you want returned. starts at 0. if you pass in null or 0, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 through 250. if you pass in null, the default size is 25. if you specify true for expandreferences or includecontentbody, the maximum page size you can specify is 25. return value type: connectapi.managedcontentdeliverydocumentcollection getmanagedcontentsforsite(siteid, managedcontentids, contentkeys, contenttypefqn, language, publishstartdate, publishenddate, includecontentbody, referencedepth, expandreferences, referencesaslist, pageparam, pagesize, showabsoluteurl) get a collection of published contents for an experience cloud site. api version 58.0 1288apex reference guide managedcontentdelivery class available to guest users 58.0 requires chatter no signature public static connectapi.managedcontentdeliverydocumentcollection getmanagedcontentsforsite(string siteid, list managedcontentids, list contentkeys, string contenttypefqn, string language, string publishstartdate, string publishenddate, boolean includecontentbody, integer referencedepth, boolean expandreferences, boolean referencesaslist, integer pageparam, integer pagesize, boolean showabsoluteurl) parameters siteid type: string id for the experience cloud site. managedcontentids type: list comma-separated list of up to 100 managed content ids. specify either managed content ids or content keys. contentkeys type: list comma-separated list of up to 50 content keys. specify either managed content ids or content keys. contenttypefqn type: string fully qualified name of the managed content type. language type: string language locale for the managed content, for example, en_us. if the requested translation isn’t available, the language defaults to the configured fallback language or the channel’s default language. if the content isn’t available in the fallback language and the channel’s default language, we return an error. publishstartdate type: string iso 8601 formatted publish start date. publishenddate type: string iso 8601 formatted publish end date. includecontentbody type: boolean specifies whether to return the content body (true) or the content summary (false). if unspecified, the default value is false. 1289apex reference guide managedtopics class referencedepth type: integer an integer 0–3 specifying the depth of references. if you specify 0, the references property of the connectapi.managedcontentdeliverydocumentcollection output class is null. if unspecified, the default value is 0. expandreferences type: boolean specifies whether to include details of references (true) or summaries of references (false) in the output class. if unspecified, the default value is false. referencesaslist type: boolean specifies whether to return the references as a list in the referenceslist property of the connectapi.managedcontentdeliverydocumentcollection output class (true). if you specify false, the references are returned as key value pairs in the references property. if unspecified, the default value is false. pageparam type: integer number" "of the page you want returned. starts at 0. if you pass in null or 0, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 through 250. if you pass in null, the default size is 25. if you specify true for expandreferences or includecontentbody, the maximum page size you can specify is 25. showabsoluteurl type: boolean specifies whether to show absolute urls in the output class (true) or not (false). the default value is false. return value type: connectapi.managedcontentdeliverydocumentcollection managedtopics class get managed topics in an experience cloud site. create, delete, and reorder managed topics. namespace connectapi managedtopics methods the following are methods for managedtopics. all methods are static. in this section: createmanagedtopic(communityid, recordid, managedtopictype) create a managed topic of a specific type for an experience cloud site. 1290apex reference guide managedtopics class createmanagedtopic(communityid, recordid, managedtopictype, parentid) create a child managed topic for an experience cloud site. createmanagedtopicbyname(communityid, name, managedtopictype) create a managed topic of a specific type by name for an experience cloud site. createmanagedtopicbyname(communityid, name, managedtopictype, parentid) create a child managed topic by name for an experience cloud site. deletemanagedtopic(communityid, managedtopicid) delete a managed topic from an experience cloud site. getmanagedtopic(communityid, managedtopicid) get a managed topic in an experience cloud site. getmanagedtopic(communityid, managedtopicid, depth) get a managed topic, including its parent and children managed topics, in an experience cloud site. getmanagedtopics(communityid) get the featured and navigational managed topics for an experience cloud site. getmanagedtopics(communityid, managedtopictype) get managed topics of the specified type for an experience cloud site. getmanagedtopics(communityid, managedtopictype, depth) get managed topics of the specified type, including their parent and children managed topics, in an experience cloud site. getmanagedtopics(communityid, managedtopictype, recordids, depth) get managed topics of the specified type, including their parent and children managed topics, that are associated with topics in an experience cloud site. getmanagedtopics(communityid, managedtopictype, pageparam, pagesize) get a page of managed topics. reordermanagedtopics(communityid, managedtopicpositioncollection) reorder the relative positions of managed topics in an experience cloud site. createmanagedtopic(communityid, recordid, managedtopictype) create a managed topic of a specific type for an experience cloud site. api version 32.0 requires chatter no signature public static connectapi.managedtopic createmanagedtopic(string communityid, string recordid, connectapi.managedtopictype managedtopictype) 1291apex reference guide managedtopics class parameters communityid type: string id for an experience cloud site, internal, or null. recordid type: string id of the topic. managedtopictype type: connectapi.managedtopictype specify the type of managed topic. • content—topics that are associated with native content. • featured—topics that are featured, for example, on the experience cloud site home page, but don’t provide overall navigation. • navigational—topics that display in a navigational menu in the experience cloud site. a topic can be associated with all three managed topic types, so a topic can be a featured, navigational, and content topic. you can create up to 25 featured and 5,000 content topics. you can create up to eight levels of navigational managed topics with 25 top-level topics and 10 children topics per level for a maximum of 2,775 navigational topics. return value type: connectapi.managedtopic usage only community managers (users with the create and set up experiences or manage experiences permission) can create managed topics. createmanagedtopic(communityid, recordid, managedtopictype, parentid) create a child managed topic for an experience cloud site. api version 35.0 requires chatter no signature public static connectapi.managedtopic createmanagedtopic(string communityid, string recordid, connect" "api.managedtopictype managedtopictype, string parentid) 1292apex reference guide managedtopics class parameters communityid type: string id for an experience cloud site, internal, or null. recordid type: string id of the topic. managedtopictype type: connectapi.managedtopictype specify navigational for the type of managed topic to create a child managed topic. you can create up to 25 featured and 5,000 content topics. you can create up to eight levels of navigational managed topics with 25 top-level topics and 10 children topics per level for a maximum of 2,775 navigational topics. parentid type: string id of the parent managed topic. you can create up to eight levels (parent, direct children, their children, etc.) of managed topics and up to 10 children managed topics per managed topic. return value type: connectapi.managedtopic usage only community managers (users with the create and set up experiences or manage experiences permission) can create managed topics. createmanagedtopicbyname(communityid, name, managedtopictype) create a managed topic of a specific type by name for an experience cloud site. api version 32.0 requires chatter no signature public static connectapi.managedtopic createmanagedtopicbyname(string communityid, string name, connectapi.managedtopictype managedtopictype) 1293apex reference guide managedtopics class parameters communityid type: string id for an experience cloud site, internal, or null. name type: string name of the topic. managedtopictype type: connectapi.managedtopictype specify the type of managed topic. • content—topics that are associated with native content. • featured—topics that are featured, for example, on the experience cloud site home page, but don’t provide overall navigation. • navigational—topics that display in a navigational menu in the experience cloud site. a topic can be associated with all three managed topic types, so a topic can be a featured, navigational, and content topic. you can create up to 25 featured and 5,000 content topics. you can create up to eight levels of navigational managed topics with 25 top-level topics and 10 children topics per level for a maximum of 2,775 navigational topics. return value type: connectapi.managedtopic usage only community managers (users with the create and set up experiences or manage experiences permission) can create managed topics. createmanagedtopicbyname(communityid, name, managedtopictype, parentid) create a child managed topic by name for an experience cloud site. api version 35.0 requires chatter no signature public static connectapi.managedtopic createmanagedtopicbyname(string communityid, string name, connectapi.managedtopictype managedtopictype, string parentid) 1294apex reference guide managedtopics class parameters communityid type: string id for an experience cloud site, internal, or null. name type: string name of the topic. managedtopictype type: connectapi.managedtopictype specify navigational for the type of managed topic to create a child managed topic. you can create up to 25 featured and 5,000 content topics. you can create up to eight levels of navigational managed topics with 25 top-level topics and 10 children topics per level for a maximum of 2,775 navigational topics. parentid type: string id of the parent managed topic. you can create up to eight levels (parent, direct children, their children, etc.) of managed topics and up to 10 children managed topics per managed topic. return value type: connectapi.managedtopic usage only community managers (users with the create and set up experiences or manage experiences permission) can create managed topics. deletemanagedtopic(communityid, managedtopicid) delete a managed topic from an experience cloud site. api version 32.0 requires chatter no signature public static deletemanagedtopic(string communityid, string managedtopicid) parameters communityid type: string 1295apex reference guide managedtopics class id for an experience cloud site, internal, or null. managedtopicid type: string id of managed topic. return value type: void usage only community managers (users with the" "create and set up experiences or manage experiences permission) can delete managed topics. getmanagedtopic(communityid, managedtopicid) get a managed topic in an experience cloud site. api version 32.0 available to guest users 32.0 requires chatter no signature public static connectapi.managedtopic getmanagedtopic(string communityid, string managedtopicid) parameters communityid type: string id for an experience cloud site, internal, or null. managedtopicid type: string id of managed topic. return value type: connectapi.managedtopic 1296apex reference guide managedtopics class getmanagedtopic(communityid, managedtopicid, depth) get a managed topic, including its parent and children managed topics, in an experience cloud site. api version 35.0 available to guest users 35.0 requires chatter no signature public static connectapi.managedtopic getmanagedtopic(string communityid, string managedtopicid, integer depth) parameters communityid type: string id for an experience cloud site, internal, or null. managedtopicid type: string id of managed topic. depth type: integer specify an integer 1–8. if you specify 1, the children property of the connectapi.managedtopic output class is null. if you specify 2, the children property of the connectapi.managedtopic output class contains the direct children managed topics, if any, of the managed topic. if you specify 3–8, you get the direct children managed topics and their children managed topics if there are any. if depth isn’t specified, it defaults to 1. return value type: connectapi.managedtopic getmanagedtopics(communityid) get the featured and navigational managed topics for an experience cloud site. to get the content topics for an experience cloud site, use getmanagedtopics(communityid, managedtopictype). api version 32.0 1297apex reference guide managedtopics class available to guest users 32.0 requires chatter no signature public static connectapi.managedtopiccollection getmanagedtopics(string communityid) parameters communityid type: string id for an experience cloud site, internal, or null. return value type: connectapi.managedtopiccollection getmanagedtopics(communityid, managedtopictype) get managed topics of the specified type for an experience cloud site. api version 32.0 available to guest users 32.0 requires chatter no signature public static connectapi.managedtopiccollection getmanagedtopics(string communityid, connectapi.managedtopictype managedtopictype) parameters communityid type: string id for an experience cloud site, internal, or null. managedtopictype type: connectapi.managedtopictype 1298apex reference guide managedtopics class type of managed topic. • content—topics that are associated with native content. • featured—topics that are featured, for example, on the experience cloud site home page, but don’t provide overall navigation. • navigational—topics that display in a navigational menu in the experience cloud site. a topic can be associated with all three managed topic types, so a topic can be a featured, navigational, and content topic. if you specify content, up to 50 topics are returned. if you want more than 50 content topics, use getmanagedtopics(communityid, managedtopictype, pageparam, pagesize). return value type: connectapi.managedtopiccollection getmanagedtopics(communityid, managedtopictype, depth) get managed topics of the specified type, including their parent and children managed topics, in an experience cloud site. api version 35.0 available to guest users 35.0 requires chatter no signature public static connectapi.managedtopiccollection getmanagedtopics(string communityid, connectapi.managedtopictype managedtopictype, integer depth) parameters communityid type: string id for an experience cloud site, internal, or null. managedtopictype type: connectapi.managedtopictype type of managed topic. • content—topics that are associated with native content. • featured—topics that are featured, for example, on the experience cloud site home page, but don’t provide overall navigation. • navigational—topics that display in a navig" "ational menu in the experience cloud site. a topic can be associated with all three managed topic types, so a topic can be a featured, navigational, and content topic. 1299apex reference guide managedtopics class depth type: integer specify an integer 1–8. if you specify 1, the children property of the connectapi.managedtopic output class is null. if you specify 2, the children property of the connectapi.managedtopic output class contains the direct children managed topics, if any, of the managed topic. if you specify 3–8, you get the direct children managed topics and their children managed topics if there are any. if depth isn’t specified, it defaults to 1. return value type: connectapi.managedtopiccollection getmanagedtopics(communityid, managedtopictype, recordids, depth) get managed topics of the specified type, including their parent and children managed topics, that are associated with topics in an experience cloud site. api version 38.0 available to guest users 38.0 requires chatter no signature public static connectapi.managedtopiccollection getmanagedtopics(string communityid, connectapi.managedtopictype managedtopictype, list recordids, integer depth) parameters communityid type: string id for an experience cloud site, internal, or null. managedtopictype type: connectapi.managedtopictype type of managed topic. • content—topics that are associated with native content. • featured—topics that are featured, for example, on the experience cloud site home page, but don’t provide overall navigation. • navigational—topics that display in a navigational menu in the experience cloud site. a topic can be associated with all three managed topic types, so a topic can be a featured, navigational, and content topic. 1300apex reference guide managedtopics class recordids type: list a list of up to 100 topic ids associated with the managed topics. if you list more than 10 topic ids, you can’t specify 2–8 for depth. depth type: integer specify an integer 1–8. if you specify 1, the children property of the connectapi.managedtopic output class is null. if you specify 2, the children property of the connectapi.managedtopic output class contains the direct children managed topics, if any, of the managed topic. if you specify 3–8, you get the direct children managed topics and their children managed topics if there are any. if depth isn’t specified, it defaults to 1. return value type: connectapi.managedtopiccollection getmanagedtopics(communityid, managedtopictype, pageparam, pagesize) get a page of managed topics. api version 44.0 available to guest users 44.0 requires chatter no signature public static connectapi.managedtopiccollection getmanagedtopics(string communityid, connectapi.managedtopictype managedtopictype, integer pageparam, integer pagesize) parameters communityid type: string id for an experience cloud site, internal, or null. managedtopictype type: connectapi.managedtopictype type of managed topic. • content—topics that are associated with native content. • featured—topics that are featured, for example, on the experience cloud site home page, but don’t provide overall navigation. • navigational—topics that display in a navigational menu in the experience cloud site. 1301apex reference guide managedtopics class a topic can be associated with all three managed topic types, so a topic can be a featured, navigational, and content topic. pageparam type: integer number of the page you want returned. starts at 0. if you pass in null or 0, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 through 100. if you pass in null, the default size is 50. return value type: connectapi.managedtopiccollection reordermanagedtopics(communityid, managedtopicpositioncollection) reorder the relative positions of managed topics in an experience cloud site. api version 32.0 requires chatter no signature public static connectapi.managedtopiccollection reordermanagedtopics(string communityid, connectapi.managedtopicpositioncollectioninput managedtopicpositioncollection) parameters communityid type: string" "id for an experience cloud site, internal, or null. managedtopicpositioncollection type: connectapi.managedtopicpositioncollectioninput a collection of relative positions of managed topics. this collection can include only featured and navigational topics and doesn’t have to include all managed topics. return value type: connectapi.managedtopiccollection usage only community managers (users with the create and set up experiences or manage experiences permission) can reorder managed topics. 1302apex reference guide managedtopics class you can reorder parent managed topics or children managed topics with the same parent. if you don’t include all managed topics in the connectapi.managedtopicpositioncollectioninput, the managed topics are reordered by respecting the positions indicated in the connectapi.managedtopicpositioncollectioninput and then by pushing down any managed topics that aren’t included in the connectapi.managedtopicpositioncollectioninput to the next available position. example if you have these managed topics: managed topic position managedtopica 0 managedtopicb 1 managedtopicc 2 managedtopicd 3 managedtopice 4 and you reorder managed topics by including this information in connectapi.managedtopicpositioncollectioninput: managed topic position managedtopicd 0 managedtopice 2 the result is: managed topic position managedtopicd 0 managedtopica 1 managedtopice 2 managedtopicb 3 managedtopicc 4 retired managedtopics methods the following methods for managedtopics are retired. 1303apex reference guide managedtopics class in this section: getmanagedtopics(communityid, managedtopictype, recordid, depth) get managed topics of the specified type, including their parent and children managed topics, that are associated with a given topic in an experience cloud site. getmanagedtopics(communityid, managedtopictype, recordid, depth) get managed topics of the specified type, including their parent and children managed topics, that are associated with a given topic in an experience cloud site. api version 35.0–37.0 important: in version 38.0 and later, use getmanagedtopics(communityid, managedtopictype, recordids, depth). available to guest users 35.0 requires chatter no signature public static connectapi.managedtopiccollection getmanagedtopics(string communityid, connectapi.managedtopictype managedtopictype, string recordid, integer depth) parameters communityid type: string id for an experience cloud site, internal, or null. managedtopictype type: connectapi.managedtopictype type of managed topic. • content—topics that are associated with native content. • featured—topics that are featured, for example, on the experience cloud site home page, but don’t provide overall navigation. • navigational—topics that display in a navigational menu in the experience cloud site. a topic can be associated with all three managed topic types, so a topic can be a featured, navigational, and content topic. recordid type: string id of the topic associated with the managed topics. 1304apex reference guide marketingintegration class depth type: integer specify an integer 1–8. if you specify 1, the children property of the connectapi.managedtopic output class is null. if you specify 2, the children property of the connectapi.managedtopic output class contains the direct children managed topics, if any, of the managed topic. if you specify 3–8, you get the direct children managed topics and their children managed topics if there are any. if depth isn’t specified, it defaults to 1. return value type: connectapi.managedtopiccollection marketingintegration class get, save, and submit a microsites marketing integration form for an experience cloud site. namespace connectapi marketingintegration methods the following are methods for marketingintegration. all methods are static. marketingintegration methods make calls to marketing cloud rest apis to create, query, and insert data to the data extension object. if marketing cloud rest apis return errors, connectinapex error messages include the error code and message from marketing cloud. in this section: getform(siteid, formid) get a marketing integration form for an experience cloud site. saveform(siteid, forminput) save a marketing integration form for an experience cloud site. submit" "form(siteid, formid, formsubmissioninput) submit a marketing integration form for an experience cloud site. getform(siteid, formid) get a marketing integration form for an experience cloud site. api version 53.0 requires chatter no 1305apex reference guide marketingintegration class signature public static connectapi.form getform(string siteid, string formid) parameters siteid type: string id for the experience cloud site. formid type: string id of the form. return value type: connectapi.form saveform(siteid, forminput) save a marketing integration form for an experience cloud site. api version 53.0 requires chatter no signature public static connectapi.form saveform(string siteid, connectapi.forminput forminput) parameters siteid type: string id for the experience cloud site. forminput type: connectapi.forminput a connectapi.forminput object to save. return value type: connectapi.form 1306apex reference guide mentions class usage this method attempts to create a read-only data extension in marketing cloud. a marketing cloud admin can change the read-only setting. we recommend keeping the data extension as read-only to maintain schema consistency with the form. submitform(siteid, formid, formsubmissioninput) submit a marketing integration form for an experience cloud site. api version 53.0 available to guest users 53.0 requires chatter no signature public static connectapi.formsubmission submitform(string siteid, string formid, connectapi.formsubmissioninput formsubmissioninput) parameters siteid type: string id for the experience cloud site. formid type: string id of the form. formsubmissioninput type: connectapi.formsubmissioninput a connectapi.formsubmissioninput object to submit. return value type: connectapi.formsubmission mentions class access information about mentions. a mention is an “@” character followed by a user or group name. when a user or group is mentioned, they receive a notification. 1307apex reference guide mentions class namespace connectapi mentions methods the following are methods for mentions. all methods are static. in this section: getmentioncompletions(communityid, q, contextid) get the first page of possible users and groups to mention in a feed item body or comment body. getmentioncompletions(communityid, q, contextid, type, pageparam, pagesize) get a page of possible mention proposals of the specified type. getmentionvalidations(communityid, parentid, recordids, visibility) get information about whether the mentions are valid for the context user. getmentioncompletions(communityid, q, contextid) get the first page of possible users and groups to mention in a feed item body or comment body. api version 29.0 requires chatter yes signature public static connectapi.mentioncompletionpage getmentioncompletions (string communityid, string q, string contextid) parameters communityid type: string id for an experience cloud site, internal, or null. q type: string a search term for matching user and group names. searching for a group requires a minimum of 2 characters. searching for a user doesn’t require a minimum number of characters. this parameter does not support wildcards. contextid type: string a feed item id (for a mention in a comment) or a feed subject id (for a mention in a feed item) that narrows search results, with more useful results listed first. use a group id for groups that allow customers to ensure mention completion results include customers. 1308apex reference guide mentions class return value type: connectapi.mentioncompletionpage usage call this method to generate a page of proposed mentions that a user can choose from when they enter characters after @ in a feed item body or a comment body. to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestgetmentioncompletions(communityid, q, contextid, result) apex developer guide: testing connectapi code getmention" "completions(communityid, q, contextid, type, pageparam, pagesize) get a page of possible mention proposals of the specified type. api version 29.0 requires chatter yes signature public static connectapi.mentions getmentioncompletions (string communityid, string q, string contextid, connectapi.mentioncompletiontype type, integer pageparam, integer pagesize) parameters communityid type: string id for an experience cloud site, internal, or null. q type: string a search term for matching user and group names. searching for a group requires a minimum of 2 characters. searching for a user doesn’t require a minimum number of characters. this parameter does not support wildcards. contextid type: string a feed item id (for a mention in a comment) or a feed subject id (for a mention in a feed item) that narrows search results, with more useful results listed first. use a group id for groups that allow customers to ensure mention completion results include customers. 1309apex reference guide mentions class type type: connectapi.mentioncompletiontype type of mention completion. • all—all mention completions, regardless of the type of record to which the mention refers. • group—mention completions for groups. • user—mention completions for users. pageparam type: integer number of the page you want returned. starts at 0. if you pass in null or 0, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. return value type: connectapi.mentioncompletionpage usage call this method to generate a page of proposed mentions that a user can choose from when they enter characters after @ in a feed item body or a comment body. to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestgetmentioncompletions(communityid, q, contextid, type, pageparam, pagesize, result) apex developer guide: testing connectapi code getmentionvalidations(communityid, parentid, recordids, visibility) get information about whether the mentions are valid for the context user. api version 29.0 requires chatter yes signature public static connectapi.mentions getmentionvalidations(string communityid, string parentid, list recordids, connectapi.feeditemvisibilitytype visibility) 1310apex reference guide mentions class parameters communityid type: string id for an experience cloud site, internal, or null. parentid type: string the feed item parent id. recordids type: list a comma-separated list of ids to be mentioned. the maximum value is 25. visibility type: connectapi.feeditemvisibilitytype type of users who can see a feed item. • allusers—visibility is not limited to internal users. • internalusers—visibility is limited to internal users. return value type: connectapi.mentionvalidations usage call this method to check whether the record ids returned from a call to connectapi.mentions.getmentioncompletions are valid for the context user. for example, the context users can’t mention private groups they don’t belong to. if such a group were included in the list of mention validations, the connectapi.mentionvalidations.haserrors property would be true and the group would have a connectapi.mentionvalidation.valdiationstatus of disallowed. mentions test methods these are the test methods for mentions. all methods are static. for information about using these methods to test your connectapi code, see testing connectapi code. settestgetmentioncompletions(communityid, q, contextid, result) register a connectapi.mentioncompletionpage object to be returned when getmentioncompletions(string, string, string) is called in a test context. api version 29.0 signature public static void settestgetmentioncompletions (string communityid, string q, string contextid, connectapi.mentioncompletionpage result) 1311apex reference" "guide mentions class parameters communityid type: string id for an experience cloud site, internal, or null. q type: string a search term for matching user and group names. searching for a group requires a minimum of 2 characters. searching for a user doesn’t require a minimum number of characters. this parameter does not support wildcards. contextid type: string a feed item id (for a mention in a comment) or a feed subject id (for a mention in a feed item) that narrows search results, with more useful results listed first. use a group id for groups that allow customers to ensure mention completion results include customers. result type: connectapi.mentioncompletionpage a connectapi.mentioncompletionpage object containing test data. return value type: void see also: getmentioncompletions(communityid, q, contextid) apex developer guide: testing connectapi code settestgetmentioncompletions(communityid, q, contextid, type, pageparam, pagesize, result) register a connectapi.mentioncompletionpage object to be returned when getmentioncompletions(string, string, string, connectapi.mentioncompletiontype, integer, integer) is called in a test context. api version 29.0 signature public static void settestgetmentioncompletions (string communityid, string q, string contextid, connectapi.mentioncompletiontype type, integer pageparam, integer pagesize, connectapi.mentioncompletionpage result) parameters communityid type: string id for an experience cloud site, internal, or null. 1312apex reference guide missions class q type: string a search term for matching user and group names. searching for a group requires a minimum of 2 characters. searching for a user doesn’t require a minimum number of characters. this parameter does not support wildcards. contextid type: string a feed item id (for a mention in a comment) or a feed subject id (for a mention in a feed item) that narrows search results, with more useful results listed first. use a group id for groups that allow customers to ensure mention completion results include customers. type type: connectapi.mentioncompletiontype type of mention completion. • all—all mention completions, regardless of the type of record to which the mention refers. • group—mention completions for groups. • user—mention completions for users. pageparam type: integer number of the page you want returned. starts at 0. if you pass in null or 0, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. result type: connectapi.mentioncompletionpage a connectapi.mentioncompletionpage object containing test data. return value type: void see also: getmentioncompletions(communityid, q, contextid, type, pageparam, pagesize) apex developer guide: testing connectapi code missions class export and purge mission activity for users. get a user’s mission progress. update mission activity counts for users. namespace connectapi missions methods the following are methods for missions. all methods are static. 1313apex reference guide missions class in this section: exportusermissionsactivities(communityid, userid) export mission activity for a user. getusermissionsprogress(communityid, userid) get mission activity progress for a user. purgeusermissionsactivities(communityid, userid) start a job to purge mission activity for a user. purgeusermissionsactivities(communityid) start a job to purge mission activity for all users. updateusermissionactivitycount(activitytype, activitycount, communityid, userid) update the mission activity count for a user. exportusermissionsactivities(communityid, userid) export mission activity for a user. api version 45.0 requires chatter no signature public static connectapi.usermissionactivitiesjob exportusermissionsactivities(string communityid, string userid) parameters communityid type: string id for an experience cloud site, internal, or null. userid type: string id of the user. return value type: connectapi.usermission" "activitiesjob usage you can export these activities with this method. • feeditemansweraquestion—user answered a question. 1314apex reference guide missions class • feeditemlikesomething—user liked a post or comment. • feeditemmarkanswerasbest—user marked an answer as the best answer. • feeditempostquestion—user posted a question. • feeditemreceiveacomment—user received a comment on a post. • feeditemreceivealike—user received a like on a post or comment. • feeditemreceiveananswer—user received an answer to a question. • feeditemwriteacomment—user commented on a post. • feeditemwriteapost—user made a post. • feeditemyouranswermarkedbest—user’s answer was marked as the best answer. getusermissionsprogress(communityid, userid) get mission activity progress for a user. api version 46.0 requires chatter no signature public static connectapi.usermissionactivitycollection getusermissionsprogress(string communityid, string userid) parameters communityid type: string id for an experience cloud site, internal, or null. userid type: string id of the user. return value type: connectapi.usermissionactivitycollection purgeusermissionsactivities(communityid, userid) start a job to purge mission activity for a user. api version 45.0 1315apex reference guide missions class requires chatter no signature public static connectapi.usermissionactivitiesjob purgeusermissionsactivities(string communityid, string userid) parameters communityid type: string id for an experience cloud site, internal, or null. userid type: string id of the user. return value type: connectapi.usermissionactivitiesjob usage this method purges these activities. • feeditemansweraquestion—user answered a question. • feeditemlikesomething—user liked a post or comment. • feeditemmarkanswerasbest—user marked an answer as the best answer. • feeditempostquestion—user posted a question. • feeditemreceiveacomment—user received a comment on a post. • feeditemreceivealike—user received a like on a post or comment. • feeditemreceiveananswer—user received an answer to a question. • feeditemwriteacomment—user commented on a post. • feeditemwriteapost—user made a post. • feeditemyouranswermarkedbest—user’s answer was marked as the best answer. purgeusermissionsactivities(communityid) start a job to purge mission activity for all users. api version 49.0 requires chatter no 1316apex reference guide missions class signature public static connectapi.usermissionactivitiesjob purgeusermissionsactivities(string communityid) parameters communityid type: string id for an experience cloud site, internal, or null. return value type: connectapi.usermissionactivitiesjob usage this method purges these activities. • feeditemansweraquestion—user answered a question. • feeditemlikesomething—user liked a post or comment. • feeditemmarkanswerasbest—user marked an answer as the best answer. • feeditempostquestion—user posted a question. • feeditemreceiveacomment—user received a comment on a post. • feeditemreceivealike—user received a like on a post or comment. • feeditemreceiveananswer—user received an answer to a question. • feeditemwriteacomment—user commented on a post. • feeditemwriteapost—user made a post. • feeditemyouranswermarkedbest—user’s answer was marked as the best answer. updateusermissionactivitycount(activitytype, activitycount, communityid, userid) update the mission activity count for a user. api version 45.0 requires chatter no signature public static connectapi.usermissionactivitystatus updateusermissionactivitycount(connectapi.usermissionactivitytype activitytype, integer activitycount, string communityid, string userid) 1317apex reference guide namedcredentials class parameters activitytype type: connectapi.usermissionactivitytype type of mission activity for a user. values are: • feeditemansweraquestion—user answered a question. • feed" "itemlikesomething—user liked a post or comment. • feeditemmarkanswerasbest—user marked an answer as the best answer. • feeditempostquestion—user posted a question. • feeditemreceiveacomment—user received a comment on a post. • feeditemreceivealike—user received a like on a post or comment. • feeditemreceiveananswer—user received an answer to a question. • feeditemwriteacomment—user commented on a post. • feeditemwriteapost—user made a post. • feeditemyouranswermarkedbest—user’s answer was marked as the best answer. activitycount type: integer number of mission activities of the specified type for the user. communityid type: string id for an experience cloud site, internal, or null. userid type: string id of the user. return value type: connectapi.usermissionactivitystatus namedcredentials class create, refresh, get, delete, and update credentials. create, get, delete, and update external credentials. create, get, delete, and update named credentials. get the url for the oauth token flow for an external credential. namespace connectapi namedcredentials methods the following are methods for namedcredentials. all methods are static. 1318apex reference guide namedcredentials class in this section: createcredential(requestbody) create a credential. createcredential(requestbody, action) refresh an oauth or aws roles anywhere credential. createexternalcredential(requestbody) create an external credential. createnamedcredential(requestbody) create a named credential. deletecredential(externalcredential, principalname, principaltype) delete a credential. deleteexternalcredential(developername) delete an external credential. deletenamedcredential(developername) delete a named credential. getcredential(externalcredential, principalname, principaltype) get a credential. getexternalcredential(developername) get an external credential, including the named credentials and principals associated with it and the type and status of each principal. getexternalcredentials() get external credentials that the user can authenticate to. getnamedcredential(developername) get a named credential. getnamedcredentials() get a list of named credentials for the org. getoauthcredentialauthurl(requestbody) get the url for the oauth token flow for an external credential. updatecredential(requestbody) update a credential. updateexternalcredential(developername, requestbody) update an external credential. updatenamedcredential(developername, requestbody) update a named credential. createcredential(requestbody) create a credential. api version 56.0 1319apex reference guide namedcredentials class requires chatter no signature public static connectapi.credential createcredential(connectapi.credentialinput requestbody) parameters requestbody type: connectapi.credentialinput a connectapi.credentialinput class. return value type: connectapi.credential createcredential(requestbody, action) refresh an oauth or aws roles anywhere credential. api version 58.0 requires chatter no signature public static connectapi.credential createcredential(connectapi.credentialinput requestbody, connectapi.createcredentialaction action) parameters requestbody type: connectapi.credentialinput a connectapi.credentialinput class. action type: connectapi.createcredentialaction action to take when creating the credential. value is: • refresh return value type: connectapi.credential 1320apex reference guide namedcredentials class createexternalcredential(requestbody) create an external credential. api version 58.0 requires chatter no signature public static connectapi.externalcredential createexternalcredential(connectapi.externalcredentialinput requestbody) parameters requestbody type: connectapi.externalcredentialinput input used to create or update an external credential. return value type: connectapi.externalcredential createnamedcredential(" "requestbody) create a named credential. api version 58.0 requires chatter no signature public static connectapi.namedcredential createnamedcredential(connectapi.namedcredentialinput requestbody) parameters requestbody type: connectapi.namedcredentialinput input used to create or update a named credential. 1321apex reference guide namedcredentials class return value type: connectapi.namedcredential deletecredential(externalcredential, principalname, principaltype) delete a credential. api version 56.0 requires chatter no signature public static void deletecredential(string externalcredential, string principalname, connectapi.credentialprincipaltype principaltype) parameters externalcredential type: string fully qualified developer name of the external credential. principalname type: string name of the external credential named principal. principaltype type: connectapi.credentialprincipaltype type of credential principal. values are: • awsstsprincipal • namedprincipal • peruserprincipal return value type: void deleteexternalcredential(developername) delete an external credential. api version 58.0 1322apex reference guide namedcredentials class requires chatter no signature public static void deleteexternalcredential(string developername) parameters developername type: string fully qualified developer name of the external credential. return value type: void deletenamedcredential(developername) delete a named credential. api version 58.0 requires chatter no signature public static void deletenamedcredential(string developername) parameters developername type: string fully qualified developer name of the named credential. return value type: void getcredential(externalcredential, principalname, principaltype) get a credential. api version 56.0 1323apex reference guide namedcredentials class requires chatter no signature public static connectapi.credential getcredential(string externalcredential, string principalname, connectapi.credentialprincipaltype principaltype) parameters externalcredential type: string fully qualified developer name of the external credential. principalname type: string name of the external credential named principal. principaltype type: connectapi.credentialprincipaltype type of credential principal. values are: • awsstsprincipal • namedprincipal • peruserprincipal return value type: connectapi.credential getexternalcredential(developername) get an external credential, including the named credentials and principals associated with it and the type and status of each principal. api version 56.0 requires chatter no signature public static connectapi.externalcredential getexternalcredential(string developername) parameters developername type: string 1324apex reference guide namedcredentials class fully qualified developer name of the external credential. return value type: connectapi.externalcredential getexternalcredentials() get external credentials that the user can authenticate to. api version 56.0 requires chatter no signature public static connectapi.externalcredentiallist getexternalcredentials() return value type: connectapi.externalcredentiallist getnamedcredential(developername) get a named credential. api version 58.0 requires chatter no signature public static connectapi.namedcredential getnamedcredential(string developername) parameters developername type: string fully qualified developer name of the named credential. return value type: connectapi.namedcredential 1325apex reference guide namedcredentials class getnamedcredentials() get a list of named credentials for the org. api version 58.0 requires chatter no signature public static connectapi.namedcredentiallist getnamedcredentials() return value type: connectapi.namedcredentiallist getoauthcredentialauthurl(requestbody) get the url for the oauth token flow for an external credential." "api version 56.0 requires chatter no signature public static connectapi.oauthcredentialauthurl getoauthcredentialauthurl(connectapi.oauthcredentialauthurlinput requestbody) parameters requestbody type: connectapi.oauthcredentialauthurlinput a connectapi.oauthcredentialauthurlinput class indicating the oauth authentication flow. return value type: connectapi.oauthcredentialauthurl 1326apex reference guide namedcredentials class usage accepts input parameters representing a specific external credential and, optionally, a named principal. returns the url a user must visit to begin the authentication flow, ultimately returning authentication tokens to salesforce. use this method as part of building a customized or branded user interface to help users initiate authentication. example connectapi.oauthcredentialauthurlinput input = new connectapi.oauthcredentialauthurlinput(); input.externalcredential = 'myexternalcredentialdevelopername'; input.principaltype = connectapi.credentialprincipaltype.peruserprincipal; input.principalname = 'myprincipal'; // only required when principaltype = namedprincipal connectapi.oauthcredentialauthurl output = connectapi.namedcredentials.getoauthcredentialauthurl(input); string authenticationurl = output.authenticationurl; // redirect users to this url to authenticate in the browser updatecredential(requestbody) update a credential. api version 56.0 requires chatter no signature public static connectapi.credential updatecredential(connectapi.credentialinput requestbody) parameters requestbody type: connectapi.credentialinput a connectapi.credentialinput class. return value type: connectapi.credential updateexternalcredential(developername, requestbody) update an external credential. 1327apex reference guide namedcredentials class api version 58.0 requires chatter no signature public static connectapi.externalcredential updateexternalcredential(string developername, connectapi.externalcredentialinput requestbody) parameters developername type: string fully qualified developer name of the external credential. requestbody type: connectapi.externalcredentialinput input used to create or update an external credential. return value type: connectapi.externalcredential updatenamedcredential(developername, requestbody) update a named credential. api version 58.0 requires chatter no signature public static connectapi.namedcredential updatenamedcredential(string developername, connectapi.namedcredentialinput requestbody) parameters developername type: string fully qualified developer name of the named credential. 1328apex reference guide navigationmenu class requestbody type: connectapi.namedcredentialinput input used to create or update a named credential. return value type: connectapi.namedcredential navigationmenu class get navigation menu items for an experience cloud site. namespace connectapi navigationmenu methods these methods are for navigationmenu. all methods are static. in this section: getcommunitynavigationmenu(communityid, navigationlinksetid, navigationlinksetdevelopername, publishstatus, includeimageurl, addhomemenuitem, menuitemtypestoskip) get navigation menu items for an experience cloud site. getcommunitynavigationmenu(communityid, navigationlinksetid, navigationlinksetdevelopername, publishstatus, includeimageurl, addhomemenuitem, menuitemtypestoskip, effectiveaccountid) get navigation menu items for an experience cloud based on an effective account. getcommunitynavigationmenu(communityid, navigationlinksetid, navigationlinksetdevelopername, publishstatus, includeimageurl, addhomemenuitem, menuitemtypestoskip) get navigation menu items for an experience cloud site. api version 52.0 available to guest users 52.0 requires chatter no 1329apex reference guide navigationmenu class signature public static connectapi.navigationmenuitemcollection getcommunitynavigationmenu(string communityid, string navigationlinksetid, string navigationlinksetdevelopername, connectapi.publishstatus publishstatus" ", boolean includeimageurl, boolean addhomemenuitem, list menuitemtypestoskip) parameters communityid type: string id of an experience cloud site. navigationlinksetid type: string id of the navigation link set. navigationlinksetdevelopername type: string developer name of the navigation link set. publishstatus type: connectapi.publishstatus publish status of the navigation menu item. values are: • draft • live includeimageurl type: boolean specifies whether to include the image url with the menu item (true) or not (false). addhomemenuitem type: boolean specifies whether to add the home menu item (true) or not (false). menuitemtypestoskip type: list list of menu item types to filter out of the results. values are: • datasourcedriven—menu items dynamically added from a data source. • event—event, such as logging in, logging out, or switching accounts. • externallink—url outside of your site. • globalaction—lets users create records that aren’t related to other records. • internallink—relative url inside your site. • menulabel—menu label. • modal—modal, such as account switcher. • navigationaltopic—dropdown list with links to the navigational topics in your site. • salesforceobject—objects such as accounts, cases, contacts, and custom objects. • systemlink—system link, such as a link to builder, workspaces, or setup. 1330apex reference guide navigationmenu class return value type: connectapi.navigationmenuitemcollection usage supported navigation menu item types are: • datasourcedriven—menu items dynamically added from a data source. • event—event, such as logging in, logging out, or switching accounts. • externallink—url outside of your site. • globalaction—lets users create records that aren’t related to other records. • internallink—relative url inside your site. • menulabel—menu label. • modal—modal, such as account switcher. • navigationaltopic—dropdown list with links to the navigational topics in your site. • salesforceobject—objects such as accounts, cases, contacts, and custom objects. • systemlink—system link, such as a link to builder, workspaces, or setup. getcommunitynavigationmenu(communityid, navigationlinksetid, navigationlinksetdevelopername, publishstatus, includeimageurl, addhomemenuitem, menuitemtypestoskip, effectiveaccountid) get navigation menu items for an experience cloud based on an effective account. api version 54.0 available to guest users 54.0 requires chatter no signature public static connectapi.navigationmenuitemcollection getcommunitynavigationmenu(string communityid, string navigationlinksetid, string navigationlinksetdevelopername, connectapi.publishstatus publishstatus, boolean includeimageurl, boolean addhomemenuitem, list menuitemtypestoskip, string effectiveaccountid) parameters communityid type: string id of an experience cloud site. 1331apex reference guide navigationmenu class navigationlinksetid type: string id of the navigation link set. navigationlinksetdevelopername type: string developer name of the navigation link set. publishstatus type: connectapi.publishstatus publish status of the navigation menu item. values are: • draft • live includeimageurl type: boolean specifies whether to include the image url with the menu item (true) or not (false). addhomemenuitem type: boolean specifies whether to add the home menu item (true) or not (false). menuitemtypestoskip type: list list of menu item types to filter out of the results. values are: • datasourcedriven—menu items dynamically added from a data source. • event—event, such as logging in, logging out, or switching accounts. • externallink—url outside of your site. • globalaction—lets users create records that aren’t related to other records. • internallink—relative url inside your site. • menulabel—menu label. • modal—modal, such as account" "switcher. • navigationaltopic—dropdown list with links to the navigational topics in your site. • salesforceobject—objects such as accounts, cases, contacts, and custom objects. • systemlink—system link, such as a link to builder, workspaces, or setup. effectiveaccountid type: string id of the account for which the request is made. if unspecified, defaults to the account id for the context user. return value type: connectapi.navigationmenuitemcollection usage supported navigation menu item types are: 1332" "apex reference guide nextbestaction class • datasourcedriven—menu items dynamically added from a data source. • event—event, such as logging in, logging out, or switching accounts. • externallink—url outside of your site. • globalaction—lets users create records that aren’t related to other records. • internallink—relative url inside your site. • menulabel—menu label. • modal—modal, such as account switcher. • navigationaltopic—dropdown list with links to the navigational topics in your site. • salesforceobject—objects such as accounts, cases, contacts, and custom objects. • systemlink—system link, such as a link to builder, workspaces, or setup. nextbestaction class execute recommendation strategies, get recommendations, manage recommendation reactions. namespace connectapi usage community users can't access this class. portal and guest users can access strategies only through the suggested actions component. nextbestaction methods the following are methods for nextbestaction. all methods are static. in this section: deleterecommendationreaction(reactionid) delete a recommendation reaction. executestrategy(strategyname, maxresults, contextrecordid) execute a strategy. executestrategy(strategyname, maxresults, contextrecordid, debugtrace) execute a strategy and request a trace. executestrategy(strategyname, strategyinput) execute a strategy using an input class. getrecommendation(recommendationid) get a recommendation. getrecommendationreaction(reactionid) get a recommendation reaction. getrecommendationreactions(onbehalfofid, createdbyid, targetid, contextrecordid, pageparam, pagesize) get recommendation reactions. 1333apex reference guide nextbestaction class setrecommendationreaction(reaction) record user reactions to recommendations. deleterecommendationreaction(reactionid) delete a recommendation reaction. api version 45.0 requires chatter no signature public static void deleterecommendationreaction(string reactionid) parameters reactionid type: string id of the recommendation reaction. return value type: void usage users with the manage next best action recommendations or modify all data permission can delete recommendation reactions. executestrategy(strategyname, maxresults, contextrecordid) execute a strategy. api version 45.0 available to guest users 45.0 requires chatter no 1334apex reference guide nextbestaction class signature public static connectapi.nbarecommendations executestrategy(string strategyname, integer maxresults, string contextrecordid) parameters strategyname type: string name of the strategy. maxresults type: integer maximum number of results. valid values are from 1 to 25. the default is 3. contextrecordid type: string id of the context record. for example, if the next best action is on a case detail page, the id of the case. return value type: connectapi.nbarecommendations executestrategy(strategyname, maxresults, contextrecordid, debugtrace) execute a strategy and request a trace. api version 45.0 available to guest users 45.0 requires chatter no signature public static connectapi.nbarecommendations executestrategy(string strategyname, integer maxresults, string contextrecordid, boolean debugtrace) parameters strategyname type: string name of the strategy. maxresults type: integer 1335apex reference guide nextbestaction class maximum number of results. valid values are from 1 to 25. the default is 3. contextrecordid type: string id of the context record. for example, if the next best action is on a case detail page, the id of the case. debugtrace type: boolean specifies whether to return trace and debug information in the response (true) or not (false). return value type: connectapi.nbarecommendations executestrategy(strategyname, strategyinput) execute a strategy using an input class. api version 45.0 available to guest users 45.0 requires chatter no signature public static connectapi.nbarecommendations executestrategy(string strategyname, connectapi.nbastrategyinput strategyinput) parameters strategyname type: string" "name of the strategy. strategyinput type: connectapi.nbastrategyinput a connectapi.nbastrategyinput body. return value type: connectapi.nbarecommendations 1336apex reference guide nextbestaction class getrecommendation(recommendationid) get a recommendation. api version 45.0 requires chatter no signature public static connectapi.recommendation getrecommendation(string recommendationid) parameters recommendationid type: string id of the recommendation. return value type: connectapi.recommendation getrecommendationreaction(reactionid) get a recommendation reaction. api version 45.0 requires chatter no signature public static connectapi.recommendationreaction getrecommendationreaction(string reactionid) parameters reactionid type: string id of the recommendation reaction. 1337apex reference guide nextbestaction class return value type: connectapi.recommendationreaction usage users with the manage next best action recommendations or modify all data permission can get recommendation reactions. getrecommendationreactions(onbehalfofid, createdbyid, targetid, contextrecordid, pageparam, pagesize) get recommendation reactions. api version 45.0 requires chatter no signature public static connectapi.recommendationreactions getrecommendationreactions(string onbehalfofid, string createdbyid, string targetid, string contextrecordid, integer pageparam, integer pagesize) parameters onbehalfofid type: string use the id of the user who is indirectly reacting to the recommendation to filter the results. createdbyid type: string use the id of the user or record that created the recommendation reaction to filter the results. targetid type: string use the id of the target to filter the results. contextrecordid type: string use the id of a context record to filter the results. pageparam type: integer number of the page you want returned. starts at 0. if you pass in null or 0, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. 1338apex reference guide omnichannelinventoryservice class return value type: connectapi.recommendationreactions usage users with the manage next best action recommendations or modify all data permission can get recommendation reactions. setrecommendationreaction(reaction) record user reactions to recommendations. api version 45.0 available to guest users 48.0 requires chatter no signature public static connectapi.recommendationreaction setrecommendationreaction(connectapi.recommendationreactioninput reaction) parameters reaction type: connectapi.recommendationreactioninput a connectapi.recommendationreactioninput object representing a reaction to a recommendation produced by a recommendation strategy. return value type: connectapi.recommendationreaction omnichannelinventoryservice class route orders to inventory locations in order management. namespace connectapi 1339apex reference guide omnichannelinventoryservice class omnichannelinventoryservice methods the following are methods for omnichannelinventoryservice. all methods are static. in this section: createreservation(createreservationinputrepresentation) create an inventory reservation in omnichannel inventory. fulfillreservation(fulfillreservationinputrepresentation) fulfill one or more inventory reservations. getinventoryavailability(inventoryavailabilityinputrepresentation) retrieve inventory availability data for one or more products at one or more inventory locations or location groups. getinventoryavailabilityuploadstatus(uploadid) retrieve the status of an inventory availability upload job. getpublishlocationstructurestatus(uploadid) retrieve the status of a publish location structure job. publishlocationstructure() asynchronously publish information about your inventory locations and location groups to omnichannel inventory. the publish includes records whose isenabled and shouldsyncwithoci fields are both true. this method returns an id that you can use to retrieve the status of the publish job. releasereservation(releasereservationinputrepresentation) release one or more existing inventory reservations to free up that inventory. submitinventoryavailabilityupload(fileupload) upload an inventory availability data file to omnichannel inventory. transferreservation(transfer" "reservationinputrepresentation) transfer one or more inventory reservations between locations or location groups. this api doesn’t change physical quantities, but reduces the reserved quantity at the source and increases it at the destination. createreservation(createreservationinputrepresentation) create an inventory reservation in omnichannel inventory. api version 51.0 requires chatter no signature public static connectapi.ocicreatereservationoutputrepresentation createreservation(connectapi.ocicreatereservationinputrepresentation createreservationinputrepresentation) 1340apex reference guide omnichannelinventoryservice class parameters createreservationinputrepresentation type: connectapi.ocicreatereservationinputrepresentation data to reserve inventory at one or more omnichannel inventory locations or location groups. return value type: connectapi.ocicreatereservationoutputrepresentation fulfillreservation(fulfillreservationinputrepresentation) fulfill one or more inventory reservations. api version 51.0 requires chatter no signature public static connectapi.ocifulfillreservationoutputrepresentation fulfillreservation(connectapi.ocifulfillreservationinputrepresentation fulfillreservationinputrepresentation) parameters fulfillreservationinputrepresentation type: connectapi.ocifulfillreservationinputrepresentation wraps a list of inventory reservations to fulfill. return value type: connectapi.ocifulfillreservationoutputrepresentation getinventoryavailability(inventoryavailabilityinputrepresentation) retrieve inventory availability data for one or more products at one or more inventory locations or location groups. api version 51.0 requires chatter no 1341apex reference guide omnichannelinventoryservice class signature public static connectapi.ocigetinventoryavailabilityoutputrepresentation getinventoryavailability(connectapi.ocigetinventoryavailabilityinputrepresentation inventoryavailabilityinputrepresentation) parameters inventoryavailabilityinputrepresentation type: connectapi.ocigetinventoryavailabilityinputrepresentation details of a request to retrieve inventory availability. return value type: connectapi.ocigetinventoryavailabilityoutputrepresentation getinventoryavailabilityuploadstatus(uploadid) retrieve the status of an inventory availability upload job. api version 51.0 requires chatter no signature public static connectapi.ociuploadinventoryavailabilitystatusoutputrepresentation getinventoryavailabilityuploadstatus(string uploadid) parameters uploadid type: string the upload id of the upload job. return value type: connectapi.ociuploadinventoryavailabilitystatusoutputrepresentation getpublishlocationstructurestatus(uploadid) retrieve the status of a publish location structure job. api version 51.0 1342apex reference guide omnichannelinventoryservice class requires chatter no signature public static connectapi.ocipublishlocationstructurestatusoutputrepresentation getpublishlocationstructurestatus(string uploadid) parameters uploadid type: string the upload id of the publish job. return value type: connectapi.ocipublishlocationstructurestatusoutputrepresentation publishlocationstructure() asynchronously publish information about your inventory locations and location groups to omnichannel inventory. the publish includes records whose isenabled and shouldsyncwithoci fields are both true. this method returns an id that you can use to retrieve the status of the publish job. api version 51.0 requires chatter no signature public static connectapi.ocipublishlocationstructureoutputrepresentation publishlocationstructure() return value type: connectapi.ocipublishlocationstructureoutputrepresentation releasereservation(releasereservationinputrepresentation) release one or more existing inventory reservations to free up that inventory. api version 51.0 1343apex reference guide omnichannelinventoryservice class requires chatter no signature public static connectapi.ocireleasereservationoutputrepresentation releasereservation(connectapi.ocireleasereservationinputrepresentation releasereservationinputrepresentation) parameters releasereservationinputrepresentation type: connectapi.ocireleasereservationinputrepresentation details of one or more inventory reservations to release. return value type: connectapi.ocireleasereservationoutputrepresentation submitinventoryavailabilityupload(fileupload) upload an inventory availability data file to omn" "ichannel inventory. api version 51.0 requires chatter no signature public static connectapi.ociuploadinventoryavailabilityoutputrepresentation submitinventoryavailabilityupload(connectapi.binaryinput fileupload) parameters fileupload type: connectapi.binaryinput json file containing inventory availability data. return value type: connectapi.ociuploadinventoryavailabilityoutputrepresentation usage to create an inventory data file, format the data as a series of json entries representing locations and individual inventory records. 1344apex reference guide omnichannelinventoryservice class inventory import data considerations: • separate the top-level entries with line feeds, not commas. each entry must be on a single line. • when the system reads a location entry, it assigns the subsequent inventory entries to that location until it reads another location entry. • for each location entry, specify ""mode"":""update"". • each inventory record entry requires a unique recordid. best practice is to use a uuid. the record id protects against importing duplicate data. • each inventory record entry requires an effectivedate. • each futures entry requires a nonzero quantity and a future expecteddate. • the system only creates or updates entries that are included in the data. it doesn’t delete entries that aren’t included. however, if an included entry has an empty value, that value is deleted. note: the file size limit is 10 mb, and it must be in json format. for larger data sets, you can use the headless commerce api or split the data into multiple files. the headless commerce api accepts gzip or json files up to 100 mb in size. this example illustrates the data format: note: for readability, this example shows the first few entries on multiple lines. in the import file, each location and inventory record entry must be on a single line. { ""location"":""warehouse-a"", // location identifier ""mode"":""update"" // must be update (other operations might be available in future releases) } { ""recordid"":""0a87539d-f3dd-47bc-91c7-9c752e39dbe0"", // unique identifier for the inventory record ""onhand"":10, ""sku"":""12389156"", ""effectivedate"":""2020-12-08t14:05:22.790896-07:00"", ""futures"":[ // list of future restocks { ""quantity"":1, ""expecteddate"":""2021-04-18t14:05:22.781-07:00"" }, { ""quantity"":5, ""expecteddate"":""2021-05-18t14:05:22.781-07:00"" } ], ""safetystockcount"":0 } { ""recordid"":""0a87539d-f3dd-47bc-91c7-9c752e312345"", ""onhand"":10, ""sku"":""9485728"", ""effectivedate"":""2020-12-08t14:05:22.790896-07:00"", ""futures"":[ { ""quantity"":10, ""expecteddate"":""2021-04-18t14:05:22.781-07:00"" } 1345apex reference guide orchestration class ], ""safetystockcount"":0 } {""location"":""warehouse-b"",""mode"":""update""} {""recordid"":""0a87539d-f3dd-47bc-91c7-9c75abc123de"",""onhand"":10,""sku"":""12389156"",""effectivedate"":""2020-12-08t14:05:22.790896-07:00"",""futures"":[{""quantity"":1,""expecteddate"":""2021-04-18t14:05:22.781-07:00""}],""safetystockcount"":0} {""recordid"":""0a87539d-f3dd-47bc-91c7-9c75abc98765"",""onhand"":10,""sku"":""93867201"",""effectivedate"":""2020-12-08t14:05:22.790896-07:00"",""futures"":[{""quantity"":5,""expecteddate"":""2021-04-18t14:05:22.781-07:00""}],""safetystockcount"":0} transferreservation(transferreservationinputrepresentation) transfer one or more inventory reservations between locations or location groups. this api doesn’t change physical quantities, but red" "uces the reserved quantity at the source and increases it at the destination. api version 51.0 requires chatter no signature public static connectapi.ocitransferreservationoutputrepresentation transferreservation(connectapi.ocitransferreservationinputrepresentation transferreservationinputrepresentation) parameters transferreservationinputrepresentation type: connectapi.ocitransferreservationinputrepresentation wraps a list of inventory reservation transfers and specifies whether a single failure cancels the entire list. return value type: connectapi.ocitransferreservationoutputrepresentation orchestration class get orchestration instances. namespace connectapi orchestration methods the following are methods for orchestration. all methods are static. 1346apex reference guide orderpaymentsummary class in this section: getorchestrationinstancecollection(relatedrecordid) get orchestration instances associated with a salesforce record that’s configured as a context record for orchestration interactive steps. getorchestrationinstancecollection(relatedrecordid) get orchestration instances associated with a salesforce record that’s configured as a context record for orchestration interactive steps. api version 54.0 requires chatter no signature public static connectapi.orchestrationinstancecollection getorchestrationinstancecollection(string relatedrecordid) parameters relatedrecordid type: string the id of a record configured as a context record for orchestration interactive steps. return value type: connectapi.orchestrationinstancecollection orderpaymentsummary class work with payments in order management. namespace connectapi orderpaymentsummary methods the following are methods for orderpaymentsummary. all methods are static. 1347apex reference guide orderpaymentsummary class in this section: createorderpaymentsummary(orderpaymentsummaryinput) create an orderpaymentsummary for an ordersummary. specify a payment authorization or payments that share the same payment method. in an org with the multicurrency feature enabled, the orderpaymentsummary inherits the currencyisocode value from the ordersummary. createorderpaymentsummary(orderpaymentsummaryinput) create an orderpaymentsummary for an ordersummary. specify a payment authorization or payments that share the same payment method. in an org with the multicurrency feature enabled, the orderpaymentsummary inherits the currencyisocode value from the ordersummary. api version 48.0 requires chatter no signature public static connectapi.createorderpaymentsummaryoutputrepresentation createorderpaymentsummary(connectapi.createorderpaymentsummaryinputrepresentation orderpaymentsummaryinput) parameters orderpaymentsummaryinput type: connectapi.createorderpaymentsummaryinputrepresentation the ordersummary and payment authorization or payments. return value type: connectapi.createorderpaymentsummaryoutputrepresentation example string ordersummaryid = '1osxx0000004ccg'; string paymentid1 = '0a3xx0000000085aaa'; string paymentid2 = '0a3xx0000000085bbb'; connectapi.createorderpaymentsummaryinputrepresentation orderpaymentsummaryinput = new connectapi.createorderpaymentsummaryinputrepresentation(); orderpaymentsummaryinput.ordersummaryid = ordersummaryid; list paymentlist = new list(); paymentlist.add(paymentid1); paymentlist.add(paymentid2); orderpaymentsummaryinput.paymentids = paymentlist; 1348apex reference guide ordersummary class connectapi.createorderpaymentsummaryoutputrepresentation result = connectapi.orderpaymentsummary.createorderpaymentsummary(orderpaymentsummaryinput); ordersummary class work with orders in order management. namespace connectapi ordersummary methods the following are methods for ordersummary. all methods are static. in this section: adjustpreview(ordersummaryid, adjustinput) retrieve the expected results of adjusting the price of one or more orderitemsummaries from an ordersummary, without actually executing the adjustment. the response data contains the financial changes that would result from submitting the proposed adjustment. adjustsubmit(ordersummaryid, adjustinput) adjust the price of one or more orderitemsummaries from an ordersummary, and create corresponding change orders. createcreditmemo(ordersummaryid, creditmemoinput) create a credit memo to represent the refund for one or more change orders associated with an ordersummary. create" "multipleinvoices(invoicesinput) create invoices to represent the charges for one or more change orders. create invoices for change orders that increase order amounts, such as for return fees. when you ensure the refund for a return, include the invoices for any associated return fees in the request. ensurefundsasync(ordersummaryid, ensurefundsinput) ensure funds for an invoice and apply them to it. if needed, capture authorized funds by sending a request to a payment provider. this method inserts a background operation into an asynchronous job queue and returns the id of that operation so you can track its status. payment gateway responses appear in the payment gateway log and do not affect the background operation status. ensurerefundsasync(ordersummaryid, ensurerefundsinput) ensure refunds for a creditmemo or excess funds by sending a request to a payment provider. this method inserts a background operation into an asynchronous job queue and returns the id of that operation so you can track its status. payment gateway responses appear in the payment gateway log and do not affect the background operation status. multipleensurefundsasync(multipleensurefundsinput) ensure and apply funds for one or more invoices. if needed, capture authorized funds by sending a request to a payment provider. this method inserts a background operation into an asynchronous job queue and returns the id of that operation so you can track its status. payment gateway responses appear in the payment gateway log and do not affect the background operation status. previewcancel(ordersummaryid, changeinput) retrieve the expected change order values for canceling one or more orderitemsummaries from an ordersummary, without actually executing the cancel. 1349apex reference guide ordersummary class previewreturn(ordersummaryid, changeinput) retrieve the expected change order values for a simple return of one or more orderitemsummaries from an ordersummary, without actually executing the return. submitcancel(ordersummaryid, changeinput) cancel one or more orderitemsummaries from an ordersummary, and create a corresponding change order. submitreturn(ordersummaryid, changeinput) return one or more orderitemsummaries from an ordersummary, and create a corresponding change order. this return is a simple return that creates a change order but not a returnorder. adjustpreview(ordersummaryid, adjustinput) retrieve the expected results of adjusting the price of one or more orderitemsummaries from an ordersummary, without actually executing the adjustment. the response data contains the financial changes that would result from submitting the proposed adjustment. api version 49.0 requires chatter no signature public static connectapi.adjustordersummaryoutputrepresentation adjustpreview(string ordersummaryid, connectapi.adjustorderitemsummaryinputrepresentation adjustinput) parameters ordersummaryid type: string id of the ordersummary. adjustinput type: connectapi.adjustorderitemsummaryinputrepresentation price adjustments to orderitemsummaries that together make up a price adjustment to an order, with options for adjusting items in the process of being fulfilled. return value type: connectapi.adjustordersummaryoutputrepresentation usage when a price adjustment is applied to an orderitemsummary, its quantities are considered in three groups: pre-fulfillment quantityavailabletofulfill, which is equal to quantityordered - quantitycanceled - quantityallocated 1350apex reference guide ordersummary class in-fulfillment quantityallocated - quantityfulfilled post-fulfillment quantityavailabletoreturn, which is equal to quantityfulfilled - quantityreturninitiated you can apply adjustments to these groups in three different ways, controlled by the allocateditemschangeordertype input property: • distribute the adjustment evenly between pre-fulfillment and post-fulfillment quantities. ignore in-fulfillment quantities. submitting the adjustment would create one change order for the adjustments to pre-fulfillment quantities and one change order for the adjustments to post-fulfillment quantities. • distribute the adjustment evenly between pre-fulfillment, in-fulfillment, and post-fulfillment quantities. submitting the adjustment would create one change order for the adjustments to both pre-fulfillment and in-fulfillment quantities, and one change order for the adjustments to post-fulfillment quantities. • distribute the adjustment evenly between pre-fulfillment, in-fulfillment, and post-fulfillment quantities. submitting the adjustment would create one change order for the adjustments to pre" "-fulfillment quantities, one change order for the adjustments to in-fulfillment quantities, and one change order for the adjustments to post-fulfillment quantities. see also: createcreditmemo(ordersummaryid, creditmemoinput) ensurerefundsasync(ordersummaryid, ensurerefundsinput) adjustsubmit(ordersummaryid, adjustinput) adjustsubmit(ordersummaryid, adjustinput) adjust the price of one or more orderitemsummaries from an ordersummary, and create corresponding change orders. api version 49.0 requires chatter no signature public static connectapi.adjustordersummaryoutputrepresentation adjustsubmit(string ordersummaryid, connectapi.adjustorderitemsummaryinputrepresentation adjustinput) parameters ordersummaryid type: string id of the ordersummary. adjustinput type: connectapi.adjustorderitemsummaryinputrepresentation 1351apex reference guide ordersummary class price adjustments to orderitemsummaries that together make up a price adjustment to an order, with options for adjusting items in the process of being fulfilled. return value type: connectapi.adjustordersummaryoutputrepresentation usage when a price adjustment is applied to an orderitemsummary, its quantities are considered in three groups: pre-fulfillment quantityavailabletofulfill, which is equal to quantityordered - quantitycanceled - quantityallocated in-fulfillment quantityallocated - quantityfulfilled post-fulfillment quantityavailabletoreturn, which is equal to quantityfulfilled - quantityreturninitiated you can apply adjustments to these groups in three different ways, controlled by the allocateditemschangeordertype input property: • distribute the adjustment evenly between pre-fulfillment and post-fulfillment quantities. ignore in-fulfillment quantities. create one change order for the adjustments to pre-fulfillment quantities and one change order for the adjustments to post-fulfillment quantities. • distribute the adjustment evenly between pre-fulfillment, in-fulfillment, and post-fulfillment quantities. create one change order for the adjustments to both pre-fulfillment and in-fulfillment quantities, and one change order for the adjustments to post-fulfillment quantities. • distribute the adjustment evenly between pre-fulfillment, in-fulfillment, and post-fulfillment quantities. create one change order for the adjustments to pre-fulfillment quantities, one change order for the adjustments to in-fulfillment quantities, and one change order for the adjustments to post-fulfillment quantities. after submitting a price adjustment, process refunds as appropriate: • if the discount only applied to orderitemsummaries for which payment hasn’t been captured, it doesn’t require a refund. this situation normally applies to orderitemsummaries in the us that haven’t been fulfilled. • if the discount applied to orderitemsummaries that haven’t been fulfilled and for which payment has been captured, process a refund. in this case, pass the totalexcessfundsamount from the output representation to the ensurerefundsasync() method. • if the discount applied to orderitemsummaries that have been fulfilled, process a refund. pass the postfulfillmentchangeorderid from the output representation to the createcreditmemo() method, then pass the creditmemo to the ensurerefundsasync() method. • if the discount applied to both fulfilled and unfulfilled orderitemsummaries for which payment has been captured, process both refunds. pass the postfulfillmentchangeorderid from the output representation to the createcreditmemo() method, then pass the credit memo and the totalexcessfundsamount from the output representation to the ensurerefundsasync() method. see also: createcreditmemo(ordersummaryid, creditmemoinput) ensurerefundsasync(ordersummaryid, ensurerefundsinput) adjustpreview(ordersummaryid, adjustinput) 1352apex reference guide ordersummary class createcreditmemo(ordersummaryid, creditmemoinput) create a credit memo to represent the refund for one or more change orders associated with an ordersummary. api version 48.0 requires chatter no signature public static connectapi.createcreditmemooutputrepresentation createcreditmemo(string ordersummaryid, connectapi.createcreditmemoinputrepresentation creditmemoinput) parameters ordersummaryid type: string id of the" "ordersummary. creditmemoinput type: connectapi.createcreditmemoinputrepresentation the list of change order ids. return value type: connectapi.createcreditmemooutputrepresentation createmultipleinvoices(invoicesinput) create invoices to represent the charges for one or more change orders. create invoices for change orders that increase order amounts, such as for return fees. when you ensure the refund for a return, include the invoices for any associated return fees in the request. api version 56.0 requires chatter no signature public static connectapi.createmultipleinvoicesfromchangeordersoutputrepresentation createmultipleinvoices(connectapi.createmultipleinvoicesfromchangeordersinputrepresentation invoicesinput) 1353apex reference guide ordersummary class parameters invoicesinput type: connectapi.createmultipleinvoicesfromchangeordersinputrepresentation data about the change orders to create invoices for. return value type: connectapi.createmultipleinvoicesfromchangeordersoutputrepresentation see also: ensurerefundsasync(ordersummaryid, ensurerefundsinput) createreturnorder(returnorderinput) returnitems(returnorderid, returnitemsinput) ensurefundsasync(ordersummaryid, ensurefundsinput) ensure funds for an invoice and apply them to it. if needed, capture authorized funds by sending a request to a payment provider. this method inserts a background operation into an asynchronous job queue and returns the id of that operation so you can track its status. payment gateway responses appear in the payment gateway log and do not affect the background operation status. api version 48.0 requires chatter no signature public static connectapi.ensurefundsasyncoutputrepresentation ensurefundsasync(string ordersummaryid, connectapi.ensurefundsasyncinputrepresentation ensurefundsinput) parameters ordersummaryid type: string id of the ordersummary. ensurefundsinput type: connectapi.ensurefundsasyncinputrepresentation the id of the invoice. return value type: connectapi.ensurefundsasyncoutputrepresentation 1354apex reference guide ordersummary class usage this method checks the orderpaymentsummaries associated with the specified ordersummary for funds to apply to the invoice balance following this logic: note: if multiple orderpaymentsummaries have equal balanceamount values, their order of selection is random. 1. verify that the invoice balance doesn’t exceed the total balanceamount of all the orderpaymentsummaries associated with the ordersummary. 2. if an orderpaymentsummary has a balanceamount equal to the invoice balance, apply the funds from that orderpaymentsummary. 3. if no exact match was found, apply funds from the orderpaymentsummary with the largest balanceamount. 4. if the invoice still has a balance to ensure, repeat steps 2 and 3 until the full balance is ensured or no captured funds remain. 5. if the invoice still has a balance, look for an orderpaymentsummary with an authorized amount equal to the remaining invoice balance. if one exists, capture and apply the funds from that orderpaymentsummary. 6. if no exact match was found, capture and apply funds from the orderpaymentsummary with the largest authorized amount. 7. if the invoice still has a balance to ensure, repeat steps 5 and 6 until the full balance is ensured. note: if the method creates a payment, the payment record’s clientcontext value isn’t predictable. don't use it in custom logic. see also: multipleensurefundsasync(multipleensurefundsinput) ensurerefundsasync(ordersummaryid, ensurerefundsinput) ensure refunds for a creditmemo or excess funds by sending a request to a payment provider. this method inserts a background operation into an asynchronous job queue and returns the id of that operation so you can track its status. payment gateway responses appear in the payment gateway log and do not affect the background operation status. api version 48.0 requires chatter no signature public static connectapi.ensurerefundsasyncoutputrepresentation ensurerefundsasync(string ordersummaryid, connectapi.ensurerefundsasyncinputrepresentation ensurerefundsinput) parameters ordersummaryid type: string id of the ordersummary. 1355apex reference guide ordersummary" "class ensurerefundsinput type: connectapi.ensurerefundsasyncinputrepresentation id of a credit memo to ensure refunds for, an amount of excess funds to refund, or both. at least one is required. also includes any invoices for fees that reduce the refund amount, such as return fees. if multiple payment methods are available, you can specify how to distribute the refund. return value type: connectapi.ensurerefundsasyncoutputrepresentation usage this method applies the refund to the orderpaymentsummaries associated with the specified ordersummary following this logic. note: if multiple orderpaymentsummaries have equal availabletorefund amounts, their order of selection is random. 1. verify that the creditmemo balance and excess funds amount don't exceed the total availabletorefund amount of all the orderpaymentsummaries associated with the ordersummary. 2. if sequences is specified, follow these steps. a. traverse the sequences list in order and apply the specified refund amounts to the specified orderpaymentsummaries. b. if the specified creditmemo and excess funds are fully refunded, or if isallowpartial is true, then the action stops here. 3. if a creditmemo is specified, follow these steps. a. if an orderpaymentsummary has an availabletorefund amount matching the creditmemo’s remaining balance, apply the refund to that payment. b. if no exact match was found, apply the refund to the orderpaymentsummary with the largest availabletorefund amount. c. if the creditmemo has any remaining balance, repeat steps a and b until that balance is fully refunded. 4. if an excess funds amount is specified, follow these steps. a. examine those orderpaymentsummaries. if one has an availabletorefund amount matching the excess funds amount, apply the refund to that orderpaymentsummary. b. if no exact match was found, apply the refund to the orderpaymentsummary with the largest availabletorefund amount. c. if any excess funds amount remains, repeat steps a and b until it’s fully refunded. note: if the method creates a refund, the refund record’s clientcontext value isn’t predictable. don't use it in custom logic. see also: createreturnorder(returnorderinput) returnitems(returnorderid, returnitemsinput) createmultipleinvoices(invoicesinput) 1356apex reference guide ordersummary class multipleensurefundsasync(multipleensurefundsinput) ensure and apply funds for one or more invoices. if needed, capture authorized funds by sending a request to a payment provider. this method inserts a background operation into an asynchronous job queue and returns the id of that operation so you can track its status. payment gateway responses appear in the payment gateway log and do not affect the background operation status. api version 56.0 requires chatter no signature public static connectapi.multipleasyncoutputrepresentation multipleensurefundsasync(connectapi.multipleensurefundsasyncinputrepresentation multipleensurefundsinput) parameters multipleensurefundsinput type: connectapi.multipleensurefundsasyncinputrepresentation list of invoices and the associated ordersummaries. return value type: connectapi.multipleasyncoutputrepresentation usage for each invoice in the request, this method checks the orderpaymentsummaries associated with the specified ordersummary for funds to apply to the invoice balance following this logic. note: if multiple orderpaymentsummaries have equal balanceamount values, their order of selection is random. 1. verify that the invoice balance doesn’t exceed the total balanceamount of all the orderpaymentsummaries associated with the ordersummary. 2. if an orderpaymentsummary has a balanceamount equal to the invoice balance, apply the funds from that orderpaymentsummary. 3. if no exact match was found, apply funds from the orderpaymentsummary with the largest balanceamount. 4. if the invoice still has a balance to ensure, repeat steps 2 and 3 until the full balance is ensured or no captured funds remain. 5. if the invoice still has a balance, look for an orderpaymentsummary with an authorized amount equal to the remaining invoice balance. if one exists, capture and apply the funds from that orderpaymentsummary. 6. if no exact match was found, capture and apply funds from the orderpaymentsummary with the largest authorized amount." "7. if the invoice still has a balance to ensure, repeat steps 5 and 6 until the full balance is ensured. 1357apex reference guide ordersummary class note: if the method creates a payment, the payment record’s clientcontext value isn’t predictable. don't use it in custom logic. see also: ensurefundsasync(ordersummaryid, ensurefundsinput) previewcancel(ordersummaryid, changeinput) retrieve the expected change order values for canceling one or more orderitemsummaries from an ordersummary, without actually executing the cancel. api version 48.0 requires chatter no signature public static connectapi.previewcanceloutputrepresentation previewcancel(string ordersummaryid, connectapi.changeinputrepresentation changeinput) parameters ordersummaryid type: string id of the ordersummary. changeinput type: connectapi.changeinputrepresentation a list of changes to orderitemsummaries that make up an order change, such as a cancel or return. return value type: connectapi.previewcanceloutputrepresentation see also: createcreditmemo(ordersummaryid, creditmemoinput) ensurerefundsasync(ordersummaryid, ensurerefundsinput) submitcancel(ordersummaryid, changeinput) previewreturn(ordersummaryid, changeinput) retrieve the expected change order values for a simple return of one or more orderitemsummaries from an ordersummary, without actually executing the return. 1358apex reference guide ordersummary class api version 48.0 requires chatter no signature public static connectapi.previewreturnoutputrepresentation previewreturn(string ordersummaryid, connectapi.changeinputrepresentation changeinput) parameters ordersummaryid type: string id of the ordersummary. changeinput type: connectapi.changeinputrepresentation a list of changes to orderitemsummaries that make up an order change, such as a cancel or return. return value type: connectapi.previewreturnoutputrepresentation see also: createcreditmemo(ordersummaryid, creditmemoinput) ensurerefundsasync(ordersummaryid, ensurerefundsinput) submitreturn(ordersummaryid, changeinput) submitcancel(ordersummaryid, changeinput) cancel one or more orderitemsummaries from an ordersummary, and create a corresponding change order. api version 48.0 requires chatter no signature public static connectapi.submitcanceloutputrepresentation submitcancel(string ordersummaryid, connectapi.changeinputrepresentation changeinput) 1359apex reference guide ordersummary class parameters ordersummaryid type: string id of the ordersummary. changeinput type: connectapi.changeinputrepresentation a list of changes to orderitemsummaries that make up an order change, such as a cancel or return. return value type: connectapi.submitcanceloutputrepresentation see also: createcreditmemo(ordersummaryid, creditmemoinput) ensurerefundsasync(ordersummaryid, ensurerefundsinput) previewcancel(ordersummaryid, changeinput) submitreturn(ordersummaryid, changeinput) return one or more orderitemsummaries from an ordersummary, and create a corresponding change order. this return is a simple return that creates a change order but not a returnorder. api version 48.0 requires chatter no signature public static connectapi.submitreturnoutputrepresentation submitreturn(string ordersummaryid, connectapi.changeinputrepresentation changeinput) parameters ordersummaryid type: string id of the ordersummary. changeinput type: connectapi.changeinputrepresentation a list of changes to orderitemsummaries that make up an order change, such as a cancel or return. return value type: connectapi.submitreturnoutputrepresentation 1360apex reference guide ordersummarycreation class usage after submitting a return, process a refund. pass the changeorderid from the output representation to the createcreditmemo() method, then pass the credit memo to the ensurerefundsasync() method. see also: createcreditmemo(ordersummaryid, creditmemoinput) ensurerefundsasync(ordersummaryid, ensurerefundsinput) previewreturn(ordersummaryid, changeinput) order" "summarycreation class create order summaries in order management. namespace connectapi ordersummarycreation methods the following are methods for ordersummarycreation. all methods are static. in this section: createordersummary(ordersummaryinput) create an ordersummary based on an order. that order is considered the original order for the ordersummary. subsequent change orders that apply to the ordersummary are also represented as orders. you can specify whether the order is managed in salesforce order management or by an external system. most salesforce order management apis can run only on orders that it manages. createordersummary(ordersummaryinput) create an ordersummary based on an order. that order is considered the original order for the ordersummary. subsequent change orders that apply to the ordersummary are also represented as orders. you can specify whether the order is managed in salesforce order management or by an external system. most salesforce order management apis can run only on orders that it manages. api version 48.0 requires chatter no signature public static connectapi.ordersummaryoutputrepresentation createordersummary(connectapi.ordersummaryinputrepresentation ordersummaryinput) 1361apex reference guide organization class parameters ordersummaryinput type: connectapi.ordersummaryinputrepresentation input object that wraps the id of the source order. return value type: connectapi.ordersummaryoutputrepresentation organization class access information about an org. namespace connectapi organization methods the following are methods for organization. all methods are static. in this section: getsettings() get information about the context user and the org, including which features are enabled. getsettings() get information about the context user and the org, including which features are enabled. api version 28.0 requires chatter no signature public static connectapi. organizationsettings getsettings() return value type: connectapi.organizationsettings pardotbusinessunitcontext class get the pardot business units the context user has access to. 1362apex reference guide pardotbusinessunitcontext class namespace connectapi pardotbusinessunitcontext methods the following are methods for pardotbusinessunitcontext. all methods are static. in this section: getbusinessunitcontext() get the pardot business units the context user has access to. getbusinessunitcontextbyiscurrentstatus(iscurrent) get the pardot business units the context user has access to by specifying the current status. getbusinessunitcontext() get the pardot business units the context user has access to. api version 55.0 requires chatter no signature public static connectapi.pardotbusinessunitcontextoutput getbusinessunitcontext() return value type: connectapi.pardotbusinessunitcontextoutput getbusinessunitcontextbyiscurrentstatus(iscurrent) get the pardot business units the context user has access to by specifying the current status. api version 55.0 requires chatter no 1363apex reference guide payments class signature public static connectapi.pardotbusinessunitcontextoutput getbusinessunitcontextbyiscurrentstatus(boolean iscurrent) parameters iscurrent type: boolean specifies whether to return only the business unit that’s selected as the context user's current business unit context in the business unit switcher of the pardot lightning app (true) or to return only the business units that aren’t selected as the context user's current business unit context (false). return value type: connectapi.pardotbusinessunitcontextoutput payments class authorize a payment, capture an authorized payment, and refund an authorized payment. namespace connectapi payments methods the following are methods for payments. all methods are static. in this section: authorize(authorizepayment) authorize a payment. postauth(postauthorizepayment) confirms that the merchant is ready to capture payment of an existing pre-authorized transaction. reverseauthorization(authreversalinput, authorizationid) reverses a payment authorization. capture(authcaptureinput, authorizationid) capture an authorized payment. refund(referencedrefundinput, paymentid) refund an authorized payment. sale(sale) captures a payment without any prior authorization and creates a payment entity. the payment sale transaction is a combination of an authorize transaction and capture transaction. this payment sale method allows merchants to request that the funds are trans" "ferred to the merchant account in a single command, with no further action (such as charging a credit card) from the merchant. 1364apex reference guide payments class tokenizepaymentmethod(tokenizepaymentmethodinput) method to take the input parameters of the payment method you want to tokenize and then pass them to the payment gateway's tokenization service. the results of the tokenization request are returned as a response from the payment gateway. authorize(authorizepayment) authorize a payment. api version 51.0 requires chatter no signature global static connectapi.authorizationresponse authorize(connectapi.authorizationrequest authorizepayment) parameters authorizepayment type: connectapi.authorizationrequest represents a payment authorization. return value type: connectapi.authorizationresponse postauth(postauthorizepayment) confirms that the merchant is ready to capture payment of an existing pre-authorized transaction. api version 54.0 requires chatter no signature global static connectapi.postauthorizationresponse postauth(connectapi.postauthrequest postauthorizepayment) 1365apex reference guide payments class parameters postauthorizepayment type: connectapi.postauthrequest information about the payment, payment method, and payment gateway from the original payment authorization. return value type: connectapi.postauthorizationresponse reverseauthorization(authreversalinput, authorizationid) reverses a payment authorization. api version 51.0 requires chatter no signature global static connectapi.authorizationreversalresponse reverseauthorization(connectapi.authorizationreversalrequest authreversalinput, string authorizationid) parameters authreversalinput type: connectapi.authorizationreversalrequest input information for the payment authorization reversal. authorizationid type: string the id of the payment authorization to be reversed. return value type: connectapi.authorizationreversalresponse capture(authcaptureinput, authorizationid) capture an authorized payment. to access payments methods, you need the following permissions. • salesforce order management license • paymentsapiuser user permission. this permission is available with the salesforce order management license. your salesforce admin assigns it to your profile. 1366apex reference guide payments class api version 50.0 requires chatter no signature global static connectapi.captureresponse capture(connectapi.capturerequest authcaptureinput, string authorizationid) parameters authcaptureinput type: connectapi.capturerequest a connectapi.capturerequest object with information about the payment capture. authorizationid type: string id of the payment authorization. required. return value type: connectapi.captureresponse refund(referencedrefundinput, paymentid) refund an authorized payment. to access payments methods, you need the following permissions. • salesforce order management license • paymentsapiuser user permission. this permission is available with the salesforce order management license. your salesforce admin assigns it to your profile. api version 50.0 requires chatter no signature global static connectapi.referencedrefundresponse refund(connectapi.referencedrefundrequest referencedrefundinput, string paymentid) 1367apex reference guide payments class parameters referencedrefundinput type: connectapi.referencedrefundrequest a connectapi.referencedrefundrequest object with information about the refund. paymentid type: string id of the payment to be refunded. required. return value type: connectapi.referencedrefundresponse sale(sale) captures a payment without any prior authorization and creates a payment entity. the payment sale transaction is a combination of an authorize transaction and capture transaction. this payment sale method allows merchants to request that the funds are transferred to the merchant account in a single command, with no further action (such as charging a credit card) from the merchant. api version 54.0 requires chatter no signature global static connectapi.saleresponse sale(connectapi.salerequest sale) parameters sale type: connectapi.salerequest payment sale input class. return value type: connectapi.saleresponse tokenizepaymentmethod(tokenizepaymentmethodinput) method to take the input parameters" "of the payment method you want to tokenize and then pass them to the payment gateway's tokenization service. the results of the tokenization request are returned as a response from the payment gateway. api version 52.0 1368apex reference guide personalization class requires chatter no signature global static connectapi.paymentmethodtokenizationresponse tokenizepaymentmethod(connectapi.paymentmethodtokenizationrequest tokenizepaymentmethodinput) parameters tokenizepaymentmethodinput type: connectapi.paymentmethodtokenizationrequest information about the payment method to be tokenized. return value type: connectapi.paymentmethodtokenizationresponse usage accepts input parameters representing a payment method and passes them in a tokenization request to the payment gateway. the results of the tokenization request are returned as a response from the payment gateway. if the tokenization was successful, the response contains the tokenized value and details about the tokenization process. otherwise, the response contains an error message and details about the error. example connectapi.paymentmethodtokenizationrequest request = new connectapi.paymentmethodtokenizationrequest(); request.paymentgatewayid = ‘0b0xx0000001ja5aae’; connectapi.cardpaymentmethodrequest cpmrequest = new connectapi.cardpaymentmethodrequest(); cpmrequest.cardholdername = ‘jo manager’; cpmrequest.expirymonth = 11; cpmrequest.expiryyear = 2222; cpmrequest.cardnumber = ‘4111111111111111’; cpmrequest.cvv = ‘111’; cpmrequest.cardcategory = connectapi.cardcategory.creditcard; cpmrequest.cardtype = connectapi.cardtype.visa.name(); request.cardpaymentmethod = cpmrequest; connectapi.paymentmethodtokenizationresponse response = connectapi.payments.tokenizepaymentmethod(request); personalization class get assigned personalization audiences that match the user context. create, get, update, and delete an audience. get personalization targets that match the user context, based on the assigned audiences that include the user. create and update targets. get and delete a target. 1369apex reference guide personalization class namespace connectapi note: personalization varies what the user can see in the browser but doesn’t secure data in any way. to prevent users accessing sensitive data, use standard salesforce security features, such as sharing rules and permission sets. personalization methods the following are methods for personalization. all methods are static. in this section: createaudience(communityid, audience) create an audience. createtargets(communityid, target) create targets. deleteaudience(communityid, audienceid) delete an audience. deletetarget(communityid, targetid) delete a target. getaudience(communityid, audienceid, includeaudiencecriteria) get an audience. getaudiencebatch(communityid, audienceids) get audience information for a comma-separated list of audience ids. getaudiences(communityid, ipaddress, domain, userid, publishstatus, includeaudiencecriteria, targettypes, recordid) get a list of assigned audiences that match the user context and record information. getaudiences(communityid, ipaddress, domain, userid, publishstatus, includeaudiencecriteria, targettypes) get a list of assigned audiences that match the user context. gettarget(communityid, targetid) get a target. gettargetbatch(communityid, targetids) get target information for a comma-separated list of target ids. gettargets(communityid, ipaddress, domain, userid, publishstatus, recordid, targettypes, includeaudience, includeallmatchingtargetswithingroup, groupnames) get a list of targets that match the user context, based on the assigned audiences that include the user. updateaudience(communityid, audienceid, audience) update an audience. updatetargets(communityid, target) update targets. createaudience(communityid, audience) create an audience. 1370apex reference guide personalization class api version 48.0 requires chatter no signature public static connectapi.audience createaudience(string communityid, connectapi.audienceinput audience)" "parameters communityid type: string id of the experience cloud site. audience type: connectapi.audienceinput a connectapi.audienceinput object that defines the audience. return value type: connectapi.audience createtargets(communityid, target) create targets. api version 48.0 requires chatter no signature public static connectapi.targetcollection createtargets(string communityid, connectapi.targetcollectioninput target) parameters communityid type: string id of the experience cloud site. 1371apex reference guide personalization class target type: connectapi.targetcollectioninput a connectapi.targetcollectioninput object that defines the targets. return value type: connectapi.targetcollection deleteaudience(communityid, audienceid) delete an audience. api version 48.0 requires chatter no signature public static void deleteaudience(string communityid, string audienceid) parameters communityid type: string id of the experience cloud site. audienceid type: string id of the audience. return value type: void deletetarget(communityid, targetid) delete a target. api version 48.0 requires chatter no 1372apex reference guide personalization class signature public static void deletetarget(string communityid, string targetid) parameters communityid type: string id of the experience cloud site. targetid type: string id of the target. return value type: void getaudience(communityid, audienceid, includeaudiencecriteria) get an audience. api version 48.0 available to guest users 48.0 requires chatter no signature public static connectapi.audience getaudience(string communityid, string audienceid, boolean includeaudiencecriteria) parameters communityid type: string id of the experience cloud site. audienceid type: string id of the audience. includeaudiencecriteria type: boolean 1373apex reference guide personalization class specifies whether to include audience criteria (true) or not (false). if unspecified, defaults to false. return value type: connectapi.audience getaudiencebatch(communityid, audienceids) get audience information for a comma-separated list of audience ids. api version 48.0 available to guest users 48.0 requires chatter no signature public static connectapi.batchresult[] getaudiencebatch(string communityid, list audienceids) parameters communityid type: string id of the experience cloud site. audienceids type: list comma-separated list of audience ids. return value type: connectapi.batchresult[] the connectapi.batchresult.getresult() method returns a connectapi.audience object and errors for audiences that didn’t load. getaudiences(communityid, ipaddress, domain, userid, publishstatus, includeaudiencecriteria, targettypes, recordid) get a list of assigned audiences that match the user context and record information. 1374apex reference guide personalization class api version 51.0 available to guest users 51.0 requires chatter no signature public static connectapi.audiencecollection getaudiences(string communityid, string ipaddress, string domain, string userid, connectapi.publishstatus publishstatus, boolean includeaudiencecriteria, list targettypes, string recordid) parameters communityid type: string id for an experience cloud site, internal, or null. ipaddress type: string ip address of the user. if null, no audiences with location criteria are returned. domain type: string name of the user’s salesforce custom domain. if null, no audiences with domain criteria are returned. userid type: string id of the user. if null, defaults to the id of the context user. publishstatus type: connectapi.publishstatus publish status of the audience. values are: • draft • live if null, defaults to live. includeaudiencecriteria type: boolean specifies whether to include audience criteria (true) or not (false). if unspecified, defaults to false. targettypes type: list" "comma-separated list of target types to filter the results. supported values include: • experiencevariation (version 48.0 and later) 1375apex reference guide personalization class • custom object api names, such as customobjectname__c (version 48.0 and later) • navigationlinkset (version 49.0 and later) • topic (version 49.0 and later) • collaborationgroup (version 49.0 and later) • knowledgearticle (version 49.0 and later) • contentdocument (version 49.0 and later) • managedcontent (version 49.0 and later) • report (version 49.0 and later) • dashboard (version 49.0 and later) if null, all target types are returned. recordid type: string id of the record for field based criteria. if null, all applicable audiences with field based criteria are returned. return value type: connectapi.audiencecollection getaudiences(communityid, ipaddress, domain, userid, publishstatus, includeaudiencecriteria, targettypes) get a list of assigned audiences that match the user context. api version 48.0 available to guest users 48.0 requires chatter no signature public static connectapi.audiencecollection getaudiences(string communityid, string ipaddress, string domain, string userid, connectapi.publishstatus publishstatus, boolean includeaudiencecriteria, list targettypes) parameters communityid type: string id of the experience cloud site. 1376apex reference guide personalization class ipaddress type: string ip address of the user. if null, no audiences with location criteria are returned. domain type: string name of the user’s salesforce custom domain. if null, no audiences with domain criteria are returned. userid type: string id of the user. if null, defaults to the id of the context user. publishstatus type: connectapi.publishstatus publish status of the audience. values are: • draft • live if null, defaults to live. includeaudiencecriteria type: boolean specifies whether to include audience criteria (true) or not (false). if unspecified, defaults to false. targettypes type: list comma-separated list of target types to filter the results. supported values include: • experiencevariation (version 48.0 and later) • custom object api names, such as customobjectname__c (version 48.0 and later) • navigationlinkset (version 49.0 and later) • topic (version 49.0 and later) • collaborationgroup (version 49.0 and later) • knowledgearticle (version 49.0 and later) • contentdocument (version 49.0 and later) • managedcontent (version 49.0 and later) • report (version 49.0 and later) • dashboard (version 49.0 and later) if null, all target types are returned. return value type: connectapi.audiencecollection gettarget(communityid, targetid) get a target. 1377apex reference guide personalization class api version 48.0 available to guest users 48.0 requires chatter no signature public static connectapi.target gettarget(string communityid, string targetid) parameters communityid type: string id of the experience cloud site. targetid type: string id of the target. return value type: connectapi.target gettargetbatch(communityid, targetids) get target information for a comma-separated list of target ids. api version 48.0 available to guest users 48.0 requires chatter no signature public static connectapi.batchresult[] gettargetbatch(string communityid, list targetids) 1378apex reference guide personalization class parameters communityid type: string id for an experience cloud site, internal, or null. targetids type: list comma-separated list of target ids. return value type: connectapi.batchresult the connectapi.batchresult.getresult() method returns a connectapi.target object and errors for targets that didn’t load. gettargets(communityid, ipaddress, domain, userid, publishstatus, recordid, targettypes, includeaudience, include" "allmatchingtargetswithingroup, groupnames) get a list of targets that match the user context, based on the assigned audiences that include the user. api version 48.0 available to guest users 48.0 requires chatter no signature public static connectapi.targetcollection gettargets(string communityid, string ipaddress, string domain, string userid, connectapi.publishstatus publishstatus, string recordid, list targettypes, boolean includeaudience, boolean includeallmatchingtargetswithingroup, list groupnames) parameters communityid type: string id of the experience cloud site. ipaddress type: string ip address of the user. if null, no audiences with location criteria are returned. 1379apex reference guide personalization class domain type: string name of the user’s salesforce custom domain. if null, no audiences with domain criteria are returned. userid type: string id of the user. if null, the default is the id of the context user. publishstatus type: connectapi.publishstatus publish status of the target. values are: • draft • live recordid type: string id of the record, if you want to specify field based criteria in audiences. targettypes type: list comma-separated list of target types to filter the results. supported values include: • experiencevariation (version 48.0 and later) • custom object api names, such as customobjectname__c (version 48.0 and later) • navigationlinkset (version 49.0 and later) • topic (version 49.0 and later) • collaborationgroup (version 49.0 and later) • knowledgearticle (version 49.0 and later) • contentdocument (version 49.0 and later) • managedcontent (version 49.0 and later) • report (version 49.0 and later) • dashboard (version 49.0 and later) if null, all target types are returned. includeaudience type: boolean specifies whether to include the matching audience (true) or not (false). if null, the default is false. includeallmatchingtargetswithingroup type: boolean specifies whether to include all the matching targets within a target group (true) or not (false). if null, the default is false. if false, the first matching target within each group, based on priority within the group, is returned. groupnames type: list a comma-separated list of group names. groups bundle related target and audience pairs. 1380apex reference guide personalization class return value type: connectapi.targetcollection updateaudience(communityid, audienceid, audience) update an audience. api version 48.0 requires chatter no signature public static connectapi.audience updateaudience(string communityid, string audienceid, connectapi.audienceinput audience) parameters communityid type: string id of the experience cloud site. audienceid type: string id of the audience. audience type: connectapi.audienceinput a connectapi.audienceinput object that defines the updates to the audience. return value type: connectapi.audience updatetargets(communityid, target) update targets. api version 48.0 requires chatter no 1381apex reference guide pick ticket class signature public static connectapi.targetcollection updatetargets(string communityid, connectapi.targetcollectionupdateinput target) parameters communityid type: string id of the experience cloud site. target type: connectapi.targetcollectionupdateinput a connectapi.targetcollectionupdateinput object that defines the updates for the targets. return value type: connectapi.targetcollection pick ticket class create tickets to fulfill orders. namespace connectapi pick ticket methods these methods are for pick tickets. all methods are static. in this section: distributepickedquantities(distributepickedquantitiesinput) distribute picked quantities among orders in a pick ticket. distributepickedquantities(distributepickedquantitiesinput) distribute picked quantities among orders in a pick ticket. api version 58.0 requires chatter no 1382" "apex reference guide questionandanswers class signature public static connectapi.distributepickedquantitiesoutputrepresentation distributepickedquantities(connectapi.distributepickedquantitiesinputrepresentation distributepickedquantitiesinput) parameters distributepickedquantitiesinput type: connectapi.distributepickedquantitiesinputrepresentation input to distribute picked quantities. return value type: connectapi.distributepickedquantitiesoutputrepresentation questionandanswers class access question and answers suggestions. namespace connectapi in this section: questionandanswers methods questionandanswers methods the following are methods for questionandanswers. all methods are static. in this section: getsuggestions(communityid, q, subjectid, includearticles, maxresults) get question and answers suggestions. settestgetsuggestions(communityid, q, subjectid, includearticles, maxresults, result) register a connectapi.questionandanswerssuggestions object to be returned when getsuggestions is called with matching parameters in a test context. use the method with the same parameters or the code throws an exception. updatequestionandanswers(communityid, feedelementid, questionandanswerscapability) choose or change the best answer for a question. getsuggestions(communityid, q, subjectid, includearticles, maxresults) get question and answers suggestions. api version 32.0 1383apex reference guide questionandanswers class requires chatter no signature public static connectapi.questionandanswerssuggestions getsuggestions(string communityid, string q, string subjectid, boolean includearticles, integer maxresults) parameters communityid type: string id for an experience cloud site, internal, or null. q type: string required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. subjectid type: string specify a subject id to search only questions on that object. if the id is a topic or a user, the id is ignored. includearticles type: boolean specify true to include knowledge articles in the search results. to return only questions, specify false. maxresults type: integer the maximum number of results to return for each type of item. possible values are 1–10. the default value is 5. return value type: connectapi.questionandanswerssuggestions usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestgetsuggestions(communityid, q, subjectid, includearticles, maxresults, result) apex developer guide: testing connectapi code settestgetsuggestions(communityid, q, subjectid, includearticles, maxresults, result) register a connectapi.questionandanswerssuggestions object to be returned when getsuggestions is called with matching parameters in a test context. use the method with the same parameters or the code throws an exception. 1384apex reference guide questionandanswers class api version 32.0 signature public static void settestgetsuggestions(string communityid, string q, string subjectid, boolean includearticles, integer maxresults, connectapi.questionandanswerssuggestions result) parameters communityid type: string id for an experience cloud site, internal, or null. q type: string required and can’t be null. specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. subjectid type: string specify a subject id to search only questions on that object. if the id is a topic or a user, the id is ignored. includearticles type: boolean specify true to include knowledge articles in the search results. to return only questions, specify false. maxresults type: integer the maximum number of results to return for each type of item. possible values are 1–10. the default value is 5. result type: connectapi.questionandanswerssuggestions object containing test data. return value type: void see also: getsuggestions(communityid, q, subjectid, includearticles, maxresults) apex developer guide: testing connectapi code updatequestionandanswers(" "communityid, feedelementid, questionandanswerscapability) choose or change the best answer for a question. 1385apex reference guide recommendations class api version 32.0 requires chatter yes signature public static connectapi.questionandanswerscapability updatequestionandanswers(string communityid, string feedelementid, connectapi.questionandanswerscapabilityinput questionandanswerscapability) parameters communityid type: string id for an experience cloud site, internal, or null. feedelementid type: string id of the feed element. questionandanswerscapability type: connectapi.questionandanswerscapabilityinput specify the best answer (comment id) for the question. return value type: connectapi.questionandanswerscapability if the feed element doesn’t support this capability, the return value is connectapi.notfoundexception. example connectapi.questionandanswerscapabilityinput qainput = new connectapi.questionandanswerscapabilityinput(); qainput.bestanswerid = '0d7d00000000lmakay'; connectapi.questionandanswerscapability qa = connectapi.questionandanswers.updatequestionandanswers(null, '0d5d0000000xzjj', qainput); recommendations class get and reject chatter, custom, and static recommendations. create, get, update, and delete custom recommendation audiences, custom recommendation definitions, and scheduled custom recommendations. for next best action recommendations, see nextbestaction class. 1386apex reference guide recommendations class namespace connectapi recommendations methods the following are methods for recommendations. all methods are static. in this section: createrecommendationaudience(communityid, recommendationaudience) create an audience for a custom recommendation. createrecommendationaudience(communityid, name) create an audience for a custom recommendation. createrecommendationdefinition(communityid, recommendationdefinition) create a custom recommendation definition. createrecommendationdefinition(communityid, name, title, actionurl, actionurlname, explanation) create a custom recommendation definition with the specified parameters. createscheduledrecommendation(communityid, scheduledrecommendation) create a scheduled custom recommendation. createscheduledrecommendation(communityid, recommendationdefinitionid, rank, enabled, recommendationaudienceid, channel) create a scheduled custom recommendation with the specified parameters. deleterecommendationaudience(communityid, recommendationaudienceid) delete a custom recommendation audience. deleterecommendationdefinition(communityid, recommendationdefinitionid) delete a custom recommendation definition. deleterecommendationdefinitionphoto(communityid, recommendationdefinitionid) delete a custom recommendation definition photo. deletescheduledrecommendation(communityid, scheduledrecommendationid, deletedefinitioniflast) delete a scheduled custom recommendation. getrecommendationaudience(communityid, recommendationaudienceid) get information about a custom recommendation audience. getrecommendationaudiencemembership(communityid, recommendationaudienceid) get the members of a custom recommendation audience. getrecommendationaudiencemembership(communityid, recommendationaudienceid, pageparam, pagesize) get a page of custom recommendation audience members. getrecommendationaudiences(communityid) get custom recommendation audiences. getrecommendationaudiences(communityid, pageparam, pagesize) get a page of custom recommendation audiences. getrecommendationdefinition(communityid, recommendationdefinitionid) get a custom recommendation definition. 1387apex reference guide recommendations class getrecommendationdefinitionphoto(communityid, recommendationdefinitionid) get a custom recommendation definition photo. getrecommendationdefinitions(communityid) get custom recommendation definitions. getrecommendationforuser(communityid, userid, action, objectid) get the chatter, custom, or static recommendation for the context user for the specified action and object id. getrecommendationsforuser(communityid, userid, contextaction, contextobjectid, channel, maxresults) get the chatter recommendations, such as user, group, file, article, record, and topic recommendations for the context user. get the custom and static recommendations for the context user. getrecommendationsforuser(communityid, userid, action, contextaction, contextobjectid, channel, maxresults) get the chatter, custom, and static recommendations for the context user for the specified action. getrecommendationsforuser(communityid, userid, action, objectcategory, contextaction, contextobjectid, channel," "maxresults) get the chatter, custom, and static recommendations for the context user for the specified action and object category. getscheduledrecommendation(communityid, scheduledrecommendationid) get a scheduled custom recommendation. getscheduledrecommendations(communityid, channel) get scheduled custom recommendations. rejectrecommendationforuser(communityid, userid, action, objectid) reject a chatter, custom, or static recommendation for the context user for the specified action and object id. rejectrecommendationforuser(communityid, userid, action, objectenum) reject a static recommendation for the context user. updaterecommendationaudience(communityid, recommendationaudienceid, recommendationaudience) update a custom recommendation audience. updaterecommendationdefinition(communityid, recommendationdefinitionid, name, title, actionurl, actionurlname, explanation) update a custom recommendation definition with the specified parameters. updaterecommendationdefinition(communityid, recommendationdefinitionid, recommendationdefinition) update a custom recommendation definition. updaterecommendationdefinitionphoto(communityid, recommendationdefinitionid, fileupload) update a custom recommendation definition photo with a file that hasn’t been uploaded. updaterecommendationdefinitionphoto(communityid, recommendationdefinitionid, fileid, versionnumber) update a custom recommendation definition photo with an uploaded file. updaterecommendationdefinitionphotowithattributes(communityid, recommendationdefinitionid, photo) update a custom recommendation definition photo with an uploaded file that requires cropping. updaterecommendationdefinitionphotowithattributes(communityid, recommendationdefinitionid, photo, fileupload) update a custom recommendation definition photo with a file that hasn’t been uploaded and requires cropping. updatescheduledrecommendation(communityid, scheduledrecommendationid, scheduledrecommendation) update a scheduled custom recommendation. updatescheduledrecommendation(communityid, scheduledrecommendationid, rank, enabled, recommendationaudienceid) update a scheduled custom recommendation with the specified parameters. 1388apex reference guide recommendations class createrecommendationaudience(communityid, recommendationaudience) create an audience for a custom recommendation. api version 35.0 requires chatter no signature public static connectapi.recommendationaudience createrecommendationaudience(string communityid, connectapi.recommendationaudienceinput recommendationaudience) parameters communityid type: string id for an experience cloud site, internal, or null. recommendationaudience type: connectapi.recommendationaudienceinput a connectapi.recommendationaudienceinput object. return value type: connectapi.recommendationaudience usage community managers can access, create, and delete audiences, definitions, and schedules for custom recommendations. (community managers are users with the create and set up experiences or manage experiences permission.) users with the modify all data permission can also access, create, and delete custom recommendation audiences, custom recommendation definitions, and scheduled custom recommendations. createrecommendationaudience(communityid, name) create an audience for a custom recommendation. api version 35.0 requires chatter no 1389apex reference guide recommendations class signature public static connectapi.recommendationaudience createrecommendationaudience(string communityid, string name) parameters communityid type: string id for an experience cloud site, internal, or null. name type: string name of the audience. return value type: connectapi.recommendationaudience usage community managers can access, create, and delete audiences, definitions, and schedules for custom recommendations. (community managers are users with the create and set up experiences or manage experiences permission.) users with the modify all data permission can also access, create, and delete custom recommendation audiences, custom recommendation definitions, and scheduled custom recommendations. createrecommendationdefinition(communityid, recommendationdefinition) create a custom recommendation definition. api version 35.0 requires chatter no signature public static connectapi.recommendationdefinition createrecommendationdefinition(string communityid, connectapi.recommendationdefinitioninput recommendationdefinition) parameters communityid type: string id for an experience cloud site, internal, or null. recommendationdefinition type: connectapi.recommendationdefinitioninput 1390apex reference guide recommendations class a connectapi.recommendationdefinitioninput object. return value type: connectapi.recommendationdefinition usage recommendation definitions allow you to create custom recommendations that appear in experience cloud sites, encouraging users to watch videos" ", take training and more. community managers can access, create, and delete audiences, definitions, and schedules for custom recommendations. (community managers are users with the create and set up experiences or manage experiences permission.) users with the modify all data permission can also access, create, and delete custom recommendation audiences, custom recommendation definitions, and scheduled custom recommendations. these recommendations appear by default on the customer service template. they appear on the home and question detail pages and in the feed in salesforce mobile web. they also appear anywhere community managers add recommendations using experience builder in the customer service template. so that users don’t see the same recommendations all the time, salesforce periodically removes and brings back custom recommendations that haven’t been accepted or dismissed. createrecommendationdefinition(communityid, name, title, actionurl, actionurlname, explanation) create a custom recommendation definition with the specified parameters. api version 35.0 requires chatter no signature public static connectapi.recommendationdefinition createrecommendationdefinition(string communityid, string name, string title, string actionurl, string actionurlname, string explanation) parameters communityid type: string id for an experience cloud site, internal, or null. name type: string name of the custom recommendation definition. the name is displayed in setup. 1391apex reference guide recommendations class title type: string title of the custom recommendation definition. actionurl type: string url for acting on the custom recommendation, for example, the url to join a group. actionurlname type: string text label for the action url in the user interface, for example, “launch.” explanation type: string explanation, or body, of the custom recommendation. return value type: connectapi.recommendationdefinition usage recommendation definitions allow you to create custom recommendations that appear in experience cloud sites, encouraging users to watch videos, take training and more. community managers can access, create, and delete audiences, definitions, and schedules for custom recommendations. (community managers are users with the create and set up experiences or manage experiences permission.) users with the modify all data permission can also access, create, and delete custom recommendation audiences, custom recommendation definitions, and scheduled custom recommendations. these recommendations appear by default on the customer service template. they appear on the home and question detail pages and in the feed in salesforce mobile web. they also appear anywhere community managers add recommendations using experience builder in the customer service template. so that users don’t see the same recommendations all the time, salesforce periodically removes and brings back custom recommendations that haven’t been accepted or dismissed. createscheduledrecommendation(communityid, scheduledrecommendation) create a scheduled custom recommendation. api version 35.0 requires chatter no 1392apex reference guide recommendations class signature public static connectapi.scheduledrecommendation createscheduledrecommendation(string communityid, connectapi.scheduledrecommendationinput scheduledrecommendation) parameters communityid type: string id for an experience cloud site, internal, or null. scheduledrecommendation type: connectapi.scheduledrecommendationinput a connectapi.scheduledrecommendationinput object. return value type: connectapi.scheduledrecommendation usage community managers can access, create, and delete audiences, definitions, and schedules for custom recommendations. (community managers are users with the create and set up experiences or manage experiences permission.) users with the modify all data permission can also access, create, and delete custom recommendation audiences, custom recommendation definitions, and scheduled custom recommendations. createscheduledrecommendation(communityid, recommendationdefinitionid, rank, enabled, recommendationaudienceid, channel) create a scheduled custom recommendation with the specified parameters. api version 36.0 requires chatter no signature public static connectapi.scheduledrecommendation createscheduledrecommendation(string communityid, string recommendationdefinitionid, integer rank, boolean enabled, string recommendationaudienceid, connectapi.recommendationchannel channel) parameters communityid type: string id for an experience cloud site, internal, or null. 1393apex reference guide recommendations class recommendationdefinitionid type: string id of the custom recommendation definition. rank type: integer relative rank of the scheduled custom recommendation indicated by ascending whole numbers starting with 1. setting the rank" "is comparable to an insertion into an ordered list. the scheduled custom recommendation is inserted into the position specified by the rank. the rank of all the scheduled custom recommendations after it is pushed down. see ranking scheduled custom recommendations example. if the specified rank is larger than the size of the list, the scheduled custom recommendation is put at the end of the list. the rank of the scheduled custom recommendation is the size of the list, instead of the one specified. if a rank is not specified, the scheduled custom recommendation is put at the end of the list. enabled type: boolean indicates whether scheduling is enabled. if true, the custom recommendation is enabled and appears in experience cloud sites. if false, custom recommendations in feeds in salesforce mobile web aren’t removed, but no new custom recommendations appear. in customer service and partner central sites, disabled custom recommendations no longer appear. recommendationaudienceid type: string id of the custom recommendation definition that this scheduled recommendation schedules. channel type: connectapi.recommendationchannel a way to tie custom recommendations together. for example, display recommendations in specific places in the ui or show recommendations based on time of day or geographic locations. values are: • customchannel1—custom recommendation channel. not used by default. work with your community manager to define custom channels. for example, community managers can use experience builder to determine where recommendations appear. • customchannel2—custom recommendation channel. not used by default. work with your community manager to define custom channels. • customchannel3—custom recommendation channel. not used by default. work with your community manager to define custom channels. • customchannel4—custom recommendation channel. not used by default. work with your community manager to define custom channels. • customchannel5—custom recommendation channel. not used by default. work with your community manager to define custom channels. • defaultchannel—default recommendation channel. recommendations appear by default on the home and question detail pages of customer service and partner central experience builder templates. they also appear in the feed in the salesforce mobile web and anywhere community managers add recommendations using experience builder. use these channel values; you can’t rename or create other channels. return value type: connectapi.scheduledrecommendation 1394apex reference guide recommendations class usage community managers can access, create, and delete audiences, definitions, and schedules for custom recommendations. (community managers are users with the create and set up experiences or manage experiences permission.) users with the modify all data permission can also access, create, and delete custom recommendation audiences, custom recommendation definitions, and scheduled custom recommendations. ranking scheduled custom recommendations example if you have these scheduled custom recommendations: scheduled recommendations rank scheduledrecommendationa 1 scheduledrecommendationb 2 scheduledrecommendationc 3 and you include this information in the scheduled custom recommendation input: scheduled recommendation rank scheduledrecommendationd 2 the result is: scheduled recommendation rank scheduledrecommendationa 1 scheduledrecommendationd 2 scheduledrecommendationb 3 scheduledrecommendationc 4 deleterecommendationaudience(communityid, recommendationaudienceid) delete a custom recommendation audience. api version 35.0 requires chatter no 1395apex reference guide recommendations class signature public static void deleterecommendationaudience(string communityid, string recommendationaudienceid) parameters communityid type: string id for an experience cloud site, internal, or null. recommendationaudienceid type: string id of the custom recommendation audience. return value type: void usage community managers can access, create, and delete audiences, definitions, and schedules for custom recommendations. (community managers are users with the create and set up experiences or manage experiences permission.) users with the modify all data permission can also access, create, and delete custom recommendation audiences, custom recommendation definitions, and scheduled custom recommendations. deleterecommendationdefinition(communityid, recommendationdefinitionid) delete a custom recommendation definition. api version 35.0 requires chatter no signature public static void deleterecommendationdefinition(string communityid, string recommendationdefinitionid) parameters communityid type: string id for an experience cloud site, internal, or null. recommendationdefinitionid type: string 1396apex reference guide recommendations class id of the custom recommendation definition. return value type: void usage community managers can access, create" ", and delete audiences, definitions, and schedules for custom recommendations. (community managers are users with the create and set up experiences or manage experiences permission.) users with the modify all data permission can also access, create, and delete custom recommendation audiences, custom recommendation definitions, and scheduled custom recommendations. deleterecommendationdefinitionphoto(communityid, recommendationdefinitionid) delete a custom recommendation definition photo. api version 35.0 requires chatter yes signature public static void deleterecommendationdefinitionphoto(string communityid, string recommendationdefinitionid) parameters communityid type: string id for an experience cloud site, internal, or null. recommendationdefinitionid type: string id of the custom recommendation definition. return value type: void usage community managers can access, create, and delete audiences, definitions, and schedules for custom recommendations. (community managers are users with the create and set up experiences or manage experiences permission.) users with the modify all data permission can also access, create, and delete custom recommendation audiences, custom recommendation definitions, and scheduled custom recommendations. 1397apex reference guide recommendations class deletescheduledrecommendation(communityid, scheduledrecommendationid, deletedefinitioniflast) delete a scheduled custom recommendation. api version 35.0 requires chatter no signature public static void deletescheduledrecommendation(string communityid, string scheduledrecommendationid, boolean deletedefinitioniflast) parameters communityid type: string id for an experience cloud site, internal, or null. scheduledrecommendationid type: string id of the scheduled custom recommendation. deletedefinitioniflast type: boolean if true and if this is the last scheduled custom recommendation of a custom recommendation definition, deletes the custom recommendation definition. default is false. return value type: void usage community managers can access, create, and delete audiences, definitions, and schedules for custom recommendations. (community managers are users with the create and set up experiences or manage experiences permission.) users with the modify all data permission can also access, create, and delete custom recommendation audiences, custom recommendation definitions, and scheduled custom recommendations. deleting a scheduled custom recommendation is comparable to a deletion in an ordered list. all scheduled custom recommendations after the deleted scheduled custom recommendation receive a new, higher rank automatically. getrecommendationaudience(communityid, recommendationaudienceid) get information about a custom recommendation audience. 1398apex reference guide recommendations class api version 35.0 requires chatter no signature public static connectapi.recommendationaudience getrecommendationaudience(string communityid, string recommendationaudienceid) parameters communityid type: string id for an experience cloud site, internal, or null. recommendationaudienceid type: string id of the custom recommendation audience. return value type: connectapi.recommendationaudience usage community managers can access, create, and delete audiences, definitions, and schedules for custom recommendations. (community managers are users with the create and set up experiences or manage experiences permission.) users with the modify all data permission can also access, create, and delete custom recommendation audiences, custom recommendation definitions, and scheduled custom recommendations. getrecommendationaudiencemembership(communityid, recommendationaudienceid) get the members of a custom recommendation audience. api version 35.0 requires chatter no signature public static connectapi.userreferencepage getrecommendationaudiencemembership(string communityid, string recommendationaudienceid) 1399apex reference guide recommendations class parameters communityid type: string id for an experience cloud site, internal, or null. recommendationaudienceid type: string id of the custom recommendation audience. return value type: connectapi.userreferencepage usage community managers can access, create, and delete audiences, definitions, and schedules for custom recommendations. (community managers are users with the create and set up experiences or manage experiences permission.) users with the modify all data permission can also access, create, and delete custom recommendation audiences, custom recommendation definitions, and scheduled custom recommendations. getrecommendationaudiencemembership(communityid, recommendationaudienceid, pageparam, pagesize) get a page of custom recommendation audience members. api version 35.0 requires chatter no signature public static connectapi.userreferencepage get" "recommendationaudiencemembership(string communityid, string recommendationaudienceid, integer pageparam, integer pagesize) parameters communityid type: string id for an experience cloud site, internal, or null. recommendationaudienceid type: string id of the custom recommendation audience. pageparam type: integer 1400apex reference guide recommendations class number of the page you want returned. starts at 0. if you pass in null or 0, the first page is returned. pagesize type: integer specifies the number of members per page. return value type: connectapi.userreferencepage usage community managers can access, create, and delete audiences, definitions, and schedules for custom recommendations. (community managers are users with the create and set up experiences or manage experiences permission.) users with the modify all data permission can also access, create, and delete custom recommendation audiences, custom recommendation definitions, and scheduled custom recommendations. getrecommendationaudiences(communityid) get custom recommendation audiences. api version 35.0 requires chatter no signature public static connectapi.recommendationaudiencepage getrecommendationaudiences(string communityid) parameters communityid type: string id for an experience cloud site, internal, or null. return value type: connectapi.recommendationaudiencepage usage community managers can access, create, and delete audiences, definitions, and schedules for custom recommendations. (community managers are users with the create and set up experiences or manage experiences permission.) users with the modify all data permission can also access, create, and delete custom recommendation audiences, custom recommendation definitions, and scheduled custom recommendations. 1401apex reference guide recommendations class getrecommendationaudiences(communityid, pageparam, pagesize) get a page of custom recommendation audiences. api version 35.0 requires chatter no signature public static connectapi.recommendationaudiencepage getrecommendationaudiences(string communityid, integer pageparam, integer pagesize) parameters communityid type: string id for an experience cloud site, internal, or null. pageparam type: integer number of the page you want returned. starts at 0. if you pass in null or 0, the first page is returned. pagesize type: integer specifies the number of audiences per page. return value type: connectapi.recommendationaudiencepage usage community managers can access, create, and delete audiences, definitions, and schedules for custom recommendations. (community managers are users with the create and set up experiences or manage experiences permission.) users with the modify all data permission can also access, create, and delete custom recommendation audiences, custom recommendation definitions, and scheduled custom recommendations. getrecommendationdefinition(communityid, recommendationdefinitionid) get a custom recommendation definition. api version 35.0 1402apex reference guide recommendations class requires chatter no signature public static connectapi.recommendationdefinition getrecommendationdefinition(string communityid, string recommendationdefinitionid) parameters communityid type: string id for an experience cloud site, internal, or null. recommendationdefinitionid type: string id of the custom recommendation definition. return value type: connectapi.recommendationdefinition usage community managers can access, create, and delete audiences, definitions, and schedules for custom recommendations. (community managers are users with the create and set up experiences or manage experiences permission.) users with the modify all data permission can also access, create, and delete custom recommendation audiences, custom recommendation definitions, and scheduled custom recommendations. getrecommendationdefinitionphoto(communityid, recommendationdefinitionid) get a custom recommendation definition photo. api version 35.0 requires chatter yes signature public static connectapi.photo getrecommendationdefinitionphoto(string communityid, string recommendationdefinitionid) parameters communityid type: string 1403apex reference guide recommendations class id for an experience cloud site, internal, or null. recommendationdefinitionid type: string id of the custom recommendation definition. return value type: connectapi.photo usage community managers can access, create, and delete audiences, definitions, and schedules for custom recommendations. (community managers are users with the create and set up experiences or manage experiences permission.) users with the modify all data permission can also access, create, and delete custom recommendation audiences, custom" "recommendation definitions, and scheduled custom recommendations. getrecommendationdefinitions(communityid) get custom recommendation definitions. api version 35.0 requires chatter no signature public static connectapi.recommendationdefinitionpage getrecommendationdefinitions(string communityid) parameters communityid type: string id for an experience cloud site, internal, or null. return value type: connectapi.recommendationdefinitionpage usage community managers can access, create, and delete audiences, definitions, and schedules for custom recommendations. (community managers are users with the create and set up experiences or manage experiences permission.) users with the modify all data permission can also access, create, and delete custom recommendation audiences, custom recommendation definitions, and scheduled custom recommendations. 1404apex reference guide recommendations class getrecommendationforuser(communityid, userid, action, objectid) get the chatter, custom, or static recommendation for the context user for the specified action and object id. api version 33.0 requires chatter yes signature public static connectapi.recommendationcollection getrecommendationforuser(string communityid, string userid, connectapi.recommendationactiontype action, string objectid) parameters communityid type: string id for an experience cloud site, internal, or null. userid type: string id for the context user or the keyword me. action type: connectapi.recommendationactiontype specifies the action to take on a recommendation. • follow—follow a file, record, topic, or user. • join—join a group. • view—view a file, group, article, record, user, custom, or static recommendation. objectid type: string specifies the object to act on. • if action is follow, objectid is a user id, file id, record id, or topic id (version 36.0 and later). • if action is join, objectid is a group id. • if action is view, objectid is a user id, file id, group id, record id, custom recommendation id (version 34.0 and later), the enum today for static recommendations (version 35.0 and later), or an article id (version 37.0 and later). return value type: connectapi.recommendationcollection 1405apex reference guide recommendations class usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestgetrecommendationforuser(communityid, userid, action, objectid, result) apex developer guide: testing connectapi code getrecommendationsforuser(communityid, userid, contextaction, contextobjectid, channel, maxresults) get the chatter recommendations, such as user, group, file, article, record, and topic recommendations for the context user. get the custom and static recommendations for the context user. api version 36.0 available to guest users 38.0 note: only article and file recommendations are available to guest users. requires chatter yes signature public static connectapi.recommendationcollection getrecommendationsforuser(string communityid, string userid, connectapi.recommendationactiontype contextaction, string contextobjectid, connectapi.recommendationchannel channel, integer maxresults) parameters communityid type: string id for an experience cloud site, internal, or null. userid type: string id for the context user or the keyword me. contextaction type: connectapi.recommendationactiontype action that the context user just performed. supported values are: • follow 1406apex reference guide recommendations class • view use contextaction and contextobjectid together to get new recommendations based on the action just performed. if you don’t want recommendations based on a recent action, specify null. contextobjectid type: string id of the object that the context user just performed an action on. • if contextaction is follow, contextobjectid is a user id, file id, record id, or topic id. • if contextaction is view, contextobjectid is a user id, file id, group id, record id, or article id (version 37.0 and later). use contextaction and contextobjectid together to get new recommendations based on the action just performed. if you don’t want recommendations based on a recent action, specify null." "channel type: connectapi.recommendationchannel a way to tie custom recommendations together. for example, display recommendations in specific places in the ui or show recommendations based on time of day or geographic locations. values are: • customchannel1—custom recommendation channel. not used by default. work with your community manager to define custom channels. for example, community managers can use experience builder to determine where recommendations appear. • customchannel2—custom recommendation channel. not used by default. work with your community manager to define custom channels. • customchannel3—custom recommendation channel. not used by default. work with your community manager to define custom channels. • customchannel4—custom recommendation channel. not used by default. work with your community manager to define custom channels. • customchannel5—custom recommendation channel. not used by default. work with your community manager to define custom channels. • defaultchannel—default recommendation channel. recommendations appear by default on the home and question detail pages of customer service and partner central experience builder templates. they also appear in the feed in the salesforce mobile web and anywhere community managers add recommendations using experience builder. maxresults type: integer maximum number of recommendation results; default is 10. values must be from 1 to 99. return value type: connectapi.recommendationcollection usage if you want to get recommendations based on a recent action performed, such as following a user, use contextaction and contextobjectid together. for example, if you just followed pam, you specify follow for contextaction and pam’s user id for contextobjectid. this method only recommends users who are followed by people who follow pam. in this example, john follows pam so the method returns a recommendation for you to follow suzanne since john also follows suzanne. 1407apex reference guide recommendations class to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestgetrecommendationsforuser(communityid, userid, contextaction, contextobjectid, channel, maxresults, result) apex developer guide: testing connectapi code getrecommendationsforuser(communityid, userid, action, contextaction, contextobjectid, channel, maxresults) get the chatter, custom, and static recommendations for the context user for the specified action. api version 36.0 available to guest users 38.0 note: only article and file recommendations are available to guest users. requires chatter yes signature public static connectapi.recommendationcollection getrecommendationsforuser(string communityid, string userid, connectapi.recommendationactiontype action, connectapi.recommendationactiontype contextaction, string contextobjectid, connectapi.recommendationchannel channel, integer maxresults) 1408apex reference guide recommendations class parameters communityid type: string id for an experience cloud site, internal, or null. userid type: string id for the context user or the keyword me. action type: connectapi.recommendationactiontype specifies the action to take on a recommendation. • follow—follow a file, record, topic, or user. • join—join a group. • view—view a file, group, article, record, user, custom, or static recommendation. contextaction type: connectapi.recommendationactiontype action that the context user just performed. supported values are: • follow • view use contextaction and contextobjectid together to get new recommendations based on the action just performed. if you don’t want recommendations based on a recent action, specify null. contextobjectid type: string id of the object that the context user just performed an action on. • if contextaction is follow, contextobjectid is a user id, file id, record id, or topic id. • if contextaction is view, contextobjectid is a user id, file id, group id, record id, or article id (version 37.0 and later). use contextaction and contextobjectid together to get new recommendations based on the action just performed. if you don’t want recommendations based on a recent action, specify null. channel type: connectapi.recommendationchannel a way to tie custom recommendations together. for example, display recommendations in specific places in the ui or show recommendations based on time of day or geographic locations. values are: • customchannel1—custom recommendation channel. not used by default. work with your community manager to" "define custom channels. for example, community managers can use experience builder to determine where recommendations appear. • customchannel2—custom recommendation channel. not used by default. work with your community manager to define custom channels. • customchannel3—custom recommendation channel. not used by default. work with your community manager to define custom channels. • customchannel4—custom recommendation channel. not used by default. work with your community manager to define custom channels. 1409apex reference guide recommendations class • customchannel5—custom recommendation channel. not used by default. work with your community manager to define custom channels. • defaultchannel—default recommendation channel. recommendations appear by default on the home and question detail pages of customer service and partner central experience builder templates. they also appear in the feed in the salesforce mobile web and anywhere community managers add recommendations using experience builder. maxresults type: integer maximum number of recommendation results; default is 10. values must be from 1 to 99. return value type: connectapi.recommendationcollection usage if you want to get recommendations based on a recent action performed, such as following a user, use contextaction and contextobjectid together. for example, if you just followed pam, you specify follow for contextaction and pam’s user id for contextobjectid. this method only recommends users who are followed by people who follow pam. in this example, john follows pam so the method returns a recommendation for you to follow suzanne since john also follows suzanne. to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestgetrecommendationsforuser(communityid, userid, action, contextaction, contextobjectid, channel, maxresults, result) apex developer guide: testing connectapi code 1410apex reference guide recommendations class getrecommendationsforuser(communityid, userid, action, objectcategory, contextaction, contextobjectid, channel, maxresults) get the chatter, custom, and static recommendations for the context user for the specified action and object category. api version 36.0 available to guest users 38.0 note: only article and file recommendations are available to guest users. requires chatter yes signature public static connectapi.recommendationcollection getrecommendationsforuser(string communityid, string userid, connectapi.recommendationactiontype action, string objectcategory, connectapi.recommendationactiontype contextaction, string contextobjectid, connectapi.recommendationchannel channel, integer maxresults) parameters communityid type: string id for an experience cloud site, internal, or null. userid type: string id for the context user or the keyword me. action type: connectapi.recommendationactiontype specifies the action to take on a recommendation. • follow—follow a file, record, topic, or user. • join—join a group. • view—view a file, group, article, record, user, custom, or static recommendation. objectcategory type: string • if action is follow, objectcategory is users, files, topics, or records. • if action is join, objectcategory is groups. • if action is view, objectcategory is users, files, groups, records, custom, apps, or articles (version 37.0 and later). 1411apex reference guide recommendations class you can also specify a key prefix, the first three characters of the object id, as the objectcategory. valid values are: • if action is follow, objectcategory is 005 (users), 069 (files), 0to (topics), or 001 (accounts), for example. • if action is join, objectcategory is 0f9 (groups). • if action is view, objectcategory is 005 (users), 069 (files), 0f9 (groups), 0rd (custom recommendations), t (static recommendations), 001 (accounts), or ka0 (articles), for example, (version 370 and later). contextaction type: connectapi.recommendationactiontype action that the context user just performed. supported values are: • follow • view use contextaction and contextobjectid together to get new recommendations based on the action just performed. if you don’t want recommendations based on a recent action, specify null. contextobjectid type: string id of the object that the context user just performed an action on. • if contextaction is follow, contextobject" "id is a user id, file id, record id, or topic id. • if contextaction is view, contextobjectid is a user id, file id, group id, record id, or article id (version 37.0 and later). use contextaction and contextobjectid together to get new recommendations based on the action just performed. if you don’t want recommendations based on a recent action, specify null. channel type: connectapi.recommendationchannel a way to tie custom recommendations together. for example, display recommendations in specific places in the ui or show recommendations based on time of day or geographic locations. values are: • customchannel1—custom recommendation channel. not used by default. work with your community manager to define custom channels. for example, community managers can use experience builder to determine where recommendations appear. • customchannel2—custom recommendation channel. not used by default. work with your community manager to define custom channels. • customchannel3—custom recommendation channel. not used by default. work with your community manager to define custom channels. • customchannel4—custom recommendation channel. not used by default. work with your community manager to define custom channels. • customchannel5—custom recommendation channel. not used by default. work with your community manager to define custom channels. • defaultchannel—default recommendation channel. recommendations appear by default on the home and question detail pages of customer service and partner central experience builder templates. they also appear in the feed in the salesforce mobile web and anywhere community managers add recommendations using experience builder. maxresults type: integer maximum number of recommendation results; default is 10. values must be from 1 to 99. 1412apex reference guide recommendations class return value type: connectapi.recommendationcollection usage if you want to get recommendations based on a recent action performed, such as following a user, use contextaction and contextobjectid together. for example, if you just followed pam, you specify follow for contextaction and pam’s user id for contextobjectid. this method only recommends users who are followed by people who follow pam. in this example, john follows pam so the method returns a recommendation for you to follow suzanne since john also follows suzanne. to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestgetrecommendationsforuser(communityid, userid, action, objectcategory, contextaction, contextobjectid, channel, maxresults, result) apex developer guide: testing connectapi code getscheduledrecommendation(communityid, scheduledrecommendationid) get a scheduled custom recommendation. api version 35.0 requires chatter no 1413apex reference guide recommendations class signature public static connectapi.scheduledrecommendation getscheduledrecommendation(string communityid, string scheduledrecommendationid) parameters communityid type: string id for an experience cloud site, internal, or null. scheduledrecommendationid type: string id of the scheduled custom recommendation. return value type: connectapi.scheduledrecommendation usage community managers can access, create, and delete audiences, definitions, and schedules for custom recommendations. (community managers are users with the create and set up experiences or manage experiences permission.) users with the modify all data permission can also access, create, and delete custom recommendation audiences, custom recommendation definitions, and scheduled custom recommendations. getscheduledrecommendations(communityid, channel) get scheduled custom recommendations. api version 36.0 requires chatter no signature public static connectapi.scheduledrecommendationpage getscheduledrecommendations(string communityid, connectapi.recommendationchannel channel) parameters communityid type: string id for an experience cloud site, internal, or null. channel type: connectapi.recommendationchannel 1414apex reference guide recommendations class a way to tie custom recommendations together. for example, display recommendations in specific places in the ui or show recommendations based on time of day or geographic locations. values are: • customchannel1—custom recommendation channel. not used by default. work with your community manager to define custom channels. for example, community managers can use experience builder to determine where recommendations appear. • customchannel2—custom recommendation channel. not used by default. work with your community manager to define custom channels. • customchannel3—custom recommendation channel. not" "used by default. work with your community manager to define custom channels. • customchannel4—custom recommendation channel. not used by default. work with your community manager to define custom channels. • customchannel5—custom recommendation channel. not used by default. work with your community manager to define custom channels. • defaultchannel—default recommendation channel. recommendations appear by default on the home and question detail pages of customer service and partner central experience builder templates. they also appear in the feed in the salesforce mobile web and anywhere community managers add recommendations using experience builder. return value type: connectapi.scheduledrecommendationpage usage community managers can access, create, and delete audiences, definitions, and schedules for custom recommendations. (community managers are users with the create and set up experiences or manage experiences permission.) users with the modify all data permission can also access, create, and delete custom recommendation audiences, custom recommendation definitions, and scheduled custom recommendations. rejectrecommendationforuser(communityid, userid, action, objectid) reject a chatter, custom, or static recommendation for the context user for the specified action and object id. api version 33.0 requires chatter yes signature public static rejectrecommendationforuser(string communityid, string userid, connectapi.recommendationactiontype action, string objectid) parameters communityid type: string 1415apex reference guide recommendations class id for an experience cloud site, internal, or null. userid type: string id for the context user or the keyword me. action type: connectapi.recommendationactiontype specifies the action to take on a recommendation. supported values are: • follow—follow a file, record, topic, or user. • join—join a group. • view—view a file, group, article, record, user, custom, or static recommendation. objectid type: string specifies the object to take action on. • if action is follow, objectid is a user id, file id, record id, or topic id (version 36.0 and later). • if action is join, objectid is a group id. • if action is view, objectid is a custom recommendation id, the enum today for static recommendations, or an article id (version 37.0 and later). return value type: void rejectrecommendationforuser(communityid, userid, action, objectenum) reject a static recommendation for the context user. api version 34.0 requires chatter yes signature public static rejectrecommendationforuser(string communityid, string userid, connectapi.recommendationactiontype action, connectapi.recommendedobjecttype objectenum) parameters communityid type: string id for an experience cloud site, internal, or null. userid type: string 1416apex reference guide recommendations class id for the context user or the keyword me. action type: connectapi.recommendationactiontype specifies the action to take on a recommendation. supported values are: • view—view a static recommendation. objectenum type: connectapi.recommendedobjecttype specifies the object type to take action on. • today—static recommendations that don’t have an id, for example, the today app recommendation. return value type: void updaterecommendationaudience(communityid, recommendationaudienceid, recommendationaudience) update a custom recommendation audience. api version 35.0 requires chatter no signature public static connectapi.recommendationaudience updaterecommendationaudience(string communityid, string recommendationaudienceid, connectapi.recommendationaudienceinput recommendationaudience) parameters communityid type: string id for an experience cloud site, internal, or null. recommendationaudienceid type: string id of the custom recommendation audience. recommendationaudience type: connectapi.recommendationaudienceinput a connectapi.recommendationaudienceinput object. 1417apex reference guide recommendations class return value type: connectapi.recommendationaudience usage community managers can access, create, and delete audiences, definitions, and schedules for custom recommendations. (community managers are users with the create and set up experiences or manage experiences permission.) users with the modify all data permission can also access, create, and delete custom recommendation audiences, custom recommendation definitions, and scheduled custom recommendations." "updaterecommendationdefinition(communityid, recommendationdefinitionid, name, title, actionurl, actionurlname, explanation) update a custom recommendation definition with the specified parameters. api version 35.0 requires chatter no signature public static connectapi.recommendationdefinition updaterecommendationdefinition(string communityid, string recommendationdefinitionid, string name, string title, string actionurl, string actionurlname, string explanation recommendationdefinition) parameters communityid type: string id for an experience cloud site, internal, or null. recommendationdefinitionid type: string id of the custom recommendation definition. name type: string name of the custom recommendation definition. the name is displayed in setup. title type: string title of the custom recommendation definition. actionurl type: string url for acting on the custom recommendation, for example, the url to join a group. 1418apex reference guide recommendations class actionurlname type: string text label for the action url in the user interface, for example, “launch.” explanation type: string explanation, or body, of the custom recommendation. return value type: connectapi.recommendationdefinition usage community managers can access, create, and delete audiences, definitions, and schedules for custom recommendations. (community managers are users with the create and set up experiences or manage experiences permission.) users with the modify all data permission can also access, create, and delete custom recommendation audiences, custom recommendation definitions, and scheduled custom recommendations. updaterecommendationdefinition(communityid, recommendationdefinitionid, recommendationdefinition) update a custom recommendation definition. api version 35.0 requires chatter no signature public static connectapi.recommendationdefinition updaterecommendationdefinition(string communityid, string recommendationdefinitionid, connectapi.recommendationdefinitioninput recommendationdefinition) parameters communityid type: string id for an experience cloud site, internal, or null. recommendationdefinitionid type: string id of the custom recommendation definition. recommendationdefinition type: connectapi.recommendationdefinitioninput 1419apex reference guide recommendations class a connectapi.recommendationdefinitioninput object containing the properties to update. return value type: connectapi.recommendationdefinition usage community managers can access, create, and delete audiences, definitions, and schedules for custom recommendations. (community managers are users with the create and set up experiences or manage experiences permission.) users with the modify all data permission can also access, create, and delete custom recommendation audiences, custom recommendation definitions, and scheduled custom recommendations. updaterecommendationdefinitionphoto(communityid, recommendationdefinitionid, fileupload) update a custom recommendation definition photo with a file that hasn’t been uploaded. api version 35.0 requires chatter yes signature public static connectapi.photo updaterecommendationdefinitionphoto(string communityid, string recommendationdefinitionid, connectapi.binaryinput fileupload) parameters communityid type: string id for an experience cloud site, internal, or null. recommendationdefinitionid type: string id of the custom recommendation definition. fileupload type: connectapi.binaryinput file to use as the photo. the content type must be usable as an image. return value type: connectapi.photo 1420apex reference guide recommendations class usage community managers can access, create, and delete audiences, definitions, and schedules for custom recommendations. (community managers are users with the create and set up experiences or manage experiences permission.) users with the modify all data permission can also access, create, and delete custom recommendation audiences, custom recommendation definitions, and scheduled custom recommendations. updaterecommendationdefinitionphoto(communityid, recommendationdefinitionid, fileid, versionnumber) update a custom recommendation definition photo with an uploaded file. api version 35.0 requires chatter yes signature public static connectapi.photo updaterecommendationdefinitionphoto(string communityid, string recommendationdefinitionid, string fileid, integer versionnumber) parameters communityid type: string id for an experience cloud site, internal, or null. recommendationdefinitionid type: string id of the custom recommendation definition. fileid type: string id of a file already uploaded. the file must be an image, and be smaller than 2 gb. versionnumber type: integer version number of the existing file" ". specify either an existing version number, or null to get the latest version. return value type: connectapi.photo usage community managers can access, create, and delete audiences, definitions, and schedules for custom recommendations. (community managers are users with the create and set up experiences or manage experiences permission.) users with the modify all data permission 1421apex reference guide recommendations class can also access, create, and delete custom recommendation audiences, custom recommendation definitions, and scheduled custom recommendations. updaterecommendationdefinitionphotowithattributes(communityid, recommendationdefinitionid, photo) update a custom recommendation definition photo with an uploaded file that requires cropping. api version 35.0 requires chatter yes signature public static connectapi.photo updaterecommendationdefinitionphotowithattributes(string communityid, string recommendationdefinitionid, connectapi.photoinput photo) parameters communityid type: string id for an experience cloud site, internal, or null. recommendationdefinitionid type: string id of the custom recommendation definition. photo type: connectapi.photoinput a connectapi.photoinput object specifying the file id, version number, and cropping parameters. return value type: connectapi.photo usage community managers can access, create, and delete audiences, definitions, and schedules for custom recommendations. (community managers are users with the create and set up experiences or manage experiences permission.) users with the modify all data permission can also access, create, and delete custom recommendation audiences, custom recommendation definitions, and scheduled custom recommendations. updaterecommendationdefinitionphotowithattributes(communityid, recommendationdefinitionid, photo, fileupload) update a custom recommendation definition photo with a file that hasn’t been uploaded and requires cropping. 1422apex reference guide recommendations class api version 35.0 requires chatter yes signature public static connectapi.photo updaterecommendationdefinitionphotowithattributes(string communityid, string recommendationdefinitionid, connectapi.photoinput photo, connectapi.binaryinput fileupload) parameters communityid type: string id for an experience cloud site, internal, or null. recommendationdefinitionid type: string id of the custom recommendation definition. photo type: connectapi.photoinput a connectapi.photoinput object specifying the cropping parameters. fileupload type: connectapi.binaryinput file to use as the photo. the content type must be usable as an image. return value type: connectapi.photo usage community managers can access, create, and delete audiences, definitions, and schedules for custom recommendations. (community managers are users with the create and set up experiences or manage experiences permission.) users with the modify all data permission can also access, create, and delete custom recommendation audiences, custom recommendation definitions, and scheduled custom recommendations. updatescheduledrecommendation(communityid, scheduledrecommendationid, scheduledrecommendation) update a scheduled custom recommendation. api version 35.0 1423apex reference guide recommendations class requires chatter no signature public static connectapi.scheduledrecommendation updatescheduledrecommendation(string communityid, string scheduledrecommendationid, connectapi.scheduledrecommendationinput scheduledrecommendation) parameters communityid type: string id for an experience cloud site, internal, or null. scheduledrecommendationid type: string id of the scheduled custom recommendation. scheduledrecommendation type: connectapi.scheduledrecommendationinput a connectapi.scheduledrecommendationinput object containing the properties to update. return value type: connectapi.scheduledrecommendation usage community managers can access, create, and delete audiences, definitions, and schedules for custom recommendations. (community managers are users with the create and set up experiences or manage experiences permission.) users with the modify all data permission can also access, create, and delete custom recommendation audiences, custom recommendation definitions, and scheduled custom recommendations. ranking scheduled custom recommendations example if you have these scheduled custom recommendations: scheduled recommendations rank scheduledrecommendationa 1 scheduledrecommendationb 2 scheduledrecommendationc 3 and you include this information in the scheduled custom recommendation input: scheduled recommendation rank scheduledrecommendationd 2 1424apex reference guide recommend" "ations class the result is: scheduled recommendation rank scheduledrecommendationa 1 scheduledrecommendationd 2 scheduledrecommendationb 3 scheduledrecommendationc 4 updatescheduledrecommendation(communityid, scheduledrecommendationid, rank, enabled, recommendationaudienceid) update a scheduled custom recommendation with the specified parameters. api version 35.0 requires chatter no signature public static connectapi.scheduledrecommendation updatescheduledrecommendation(string communityid, string scheduledrecommendationid, integer rank, boolean enabled, string recommendationaudienceid) parameters communityid type: string id for an experience cloud site, internal, or null. scheduledrecommendationid type: string id of the scheduled custom recommendation. rank type: integer relative rank of the scheduled custom recommendation indicated by ascending whole numbers starting with 1. setting the rank is comparable to an insertion into an ordered list. the scheduled custom recommendation is inserted into the position specified by the rank. the rank of all the scheduled custom recommendations after it is pushed down. see ranking scheduled custom recommendations example. if the specified rank is larger than the size of the list, the scheduled custom recommendation is put at the end of the list. the rank of the scheduled custom recommendation is the size of the list, instead of the one specified. if a rank is not specified, the scheduled custom recommendation is put at the end of the list. 1425apex reference guide recommendations class enabled type: boolean indicates whether scheduling is enabled. if true, the custom recommendation is enabled and appears in experience cloud sites. if false, custom recommendations in feeds in salesforce mobile web aren’t removed, but no new custom recommendations appear. in customer service and partner central sites, disabled custom recommendations no longer appear. recommendationaudienceid type: string id of the custom recommendation definition that this scheduled recommendation schedules. return value type: connectapi.scheduledrecommendation usage community managers can access, create, and delete audiences, definitions, and schedules for custom recommendations. (community managers are users with the create and set up experiences or manage experiences permission.) users with the modify all data permission can also access, create, and delete custom recommendation audiences, custom recommendation definitions, and scheduled custom recommendations. ranking scheduled custom recommendations example if you have these scheduled custom recommendations: scheduled recommendations rank scheduledrecommendationa 1 scheduledrecommendationb 2 scheduledrecommendationc 3 and you include this information in the scheduled custom recommendation input: scheduled recommendation rank scheduledrecommendationd 2 the result is: scheduled recommendation rank scheduledrecommendationa 1 scheduledrecommendationd 2 scheduledrecommendationb 3 scheduledrecommendationc 4 1426apex reference guide recommendations class recommendations test methods the following are the test methods for recommendations. all methods are static. for information about using these methods to test your connectapi code, see testing connectapi code. in this section: settestgetrecommendationforuser(communityid, userid, action, objectid, result) register a connectapi.recommendationcollection object to be returned when getrecommendationforuser is called with matching parameters in a test context. use the method with the same parameters or the code throws an exception. settestgetrecommendationsforuser(communityid, userid, contextaction, contextobjectid, channel, maxresults, result) register a connectapi.recommendationcollection object to be returned when getrecommendationsforuser is called with matching parameters in a test context. use the method with the same parameters or the code throws an exception. settestgetrecommendationsforuser(communityid, userid, action, contextaction, contextobjectid, channel, maxresults, result) register a connectapi.recommendationcollection object to be returned when getrecommendationsforuser is called with matching parameters in a test context. use the method with the same parameters or the code throws an exception. settestgetrecommendationsforuser(communityid, userid, action, objectcategory, contextaction, contextobjectid, channel, maxresults, result) register a connectapi.recommendationcollection object to be returned when getrecommendationsforuser is called with matching parameters in a test context. use the method with the same parameters or the code throws an exception. settestgetrecommendationforuser(communityid, userid, action, objectid" ", result) register a connectapi.recommendationcollection object to be returned when getrecommendationforuser is called with matching parameters in a test context. use the method with the same parameters or the code throws an exception. api version 33.0 requires chatter yes signature public static void settestgetrecommendationforuser(string communityid, string userid, connectapi.recommendationactiontype action, string objectid, connectapi.recommendationcollection result) parameters communityid type: string id for an experience cloud site, internal, or null. userid type: string 1427apex reference guide recommendations class id for the context user or the keyword me. action type: connectapi.recommendationactiontype specifies the action to take on a recommendation. • follow—follow a file, record, topic, or user. • join—join a group. • view—view a file, group, article, record, user, custom, or static recommendation. objectid type: string specifies the object to take action on. • if action is follow, objectid is a user id, file id, record id, or topic id (version 36.0 and later). • if action is join, objectid is a group id. • if action is view, objectid is a user id, file id, group id, record id, custom recommendation id, the enum today for static recommendations, or an article id (version 37.0 and later). result type: connectapi.recommendationcollection object containing test data. return value type: void see also: getrecommendationforuser(communityid, userid, action, objectid) apex developer guide: testing connectapi code settestgetrecommendationsforuser(communityid, userid, contextaction, contextobjectid, channel, maxresults, result) register a connectapi.recommendationcollection object to be returned when getrecommendationsforuser is called with matching parameters in a test context. use the method with the same parameters or the code throws an exception. api version 36.0 requires chatter yes signature public static void settestgetrecommendationsforuser(string communityid, string userid, connectapi.recommendationactiontype contextaction, string contextobjectid, 1428apex reference guide recommendations class connectapi.recommendationchannel channel, integer maxresults, connectapi.recommendationcollection result) parameters communityid type: string id for an experience cloud site, internal, or null. userid type: string id for the context user or the keyword me. contextaction type: connectapi.recommendationactiontype action that the context user just performed. supported values are: • follow • view use contextaction and contextobjectid together to get new recommendations based on the action just performed. if you don’t want recommendations based on a recent action, specify null. contextobjectid type: string id of the object that the context user just performed an action on. • if contextaction is follow, contextobjectid is a user id, file id, record id, or topic id. • if contextaction is view, contextobjectid is a user id, file id, group id, record id, or article id (version 37.0 and later). use contextaction and contextobjectid together to get new recommendations based on the action just performed. if you don’t want recommendations based on a recent action, specify null. channel type: connectapi.recommendationchannel a way to tie custom recommendations together. for example, display recommendations in specific places in the ui or show recommendations based on time of day or geographic locations. values are: • customchannel1—custom recommendation channel. not used by default. work with your community manager to define custom channels. for example, community managers can use experience builder to determine where recommendations appear. • customchannel2—custom recommendation channel. not used by default. work with your community manager to define custom channels. • customchannel3—custom recommendation channel. not used by default. work with your community manager to define custom channels. • customchannel4—custom recommendation channel. not used by default. work with your community manager to define custom channels. • customchannel5—custom recommendation channel. not used by default. work with your community manager to define custom channels. • defaultchannel—default recommendation channel. recommendations appear by default on the home and question detail pages of customer service and partner central experience builder templates. they also appear in" "the feed in the salesforce mobile web and anywhere community managers add recommendations using experience builder. 1429apex reference guide recommendations class maxresults type: integer maximum number of recommendation results; default is 10. values must be from 1 to 99. result type: connectapi.recommendationcollection object containing test data. return value type: void see also: getrecommendationsforuser(communityid, userid, contextaction, contextobjectid, channel, maxresults) apex developer guide: testing connectapi code settestgetrecommendationsforuser(communityid, userid, action, contextaction, contextobjectid, channel, maxresults, result) register a connectapi.recommendationcollection object to be returned when getrecommendationsforuser is called with matching parameters in a test context. use the method with the same parameters or the code throws an exception. api version 36.0 requires chatter yes signature public static void settestgetrecommendationsforuser(string communityid, string userid, connectapi.recommendationactiontype action, connectapi.recommendationactiontype contextaction, string contextobjectid, connectapi.recommendationchannel channel, integer maxresults, connectapi.recommendationcollection result) parameters communityid type: string id for an experience cloud site, internal, or null. userid type: string id for the context user or the keyword me. action type: connectapi.recommendationactiontype 1430apex reference guide recommendations class specifies the action to take on a recommendation. • follow—follow a file, record, topic, or user. • join—join a group. • view—view a file, group, article, record, user, custom, or static recommendation. contextaction type: connectapi.recommendationactiontype action that the context user just performed. supported values are: • follow • view use contextaction and contextobjectid together to get new recommendations based on the action just performed. if you don’t want recommendations based on a recent action, specify null. contextobjectid type: string id of the object that the context user just performed an action on. • if contextaction is follow, contextobjectid is a user id, file id, record id, or topic id. • if contextaction is view, contextobjectid is a user id, file id, group id, record id, or article id (version 37.0 and later). use contextaction and contextobjectid together to get new recommendations based on the action just performed. if you don’t want recommendations based on a recent action, specify null. channel type: connectapi.recommendationchannel a way to tie custom recommendations together. for example, display recommendations in specific places in the ui or show recommendations based on time of day or geographic locations. values are: • customchannel1—custom recommendation channel. not used by default. work with your community manager to define custom channels. for example, community managers can use experience builder to determine where recommendations appear. • customchannel2—custom recommendation channel. not used by default. work with your community manager to define custom channels. • customchannel3—custom recommendation channel. not used by default. work with your community manager to define custom channels. • customchannel4—custom recommendation channel. not used by default. work with your community manager to define custom channels. • customchannel5—custom recommendation channel. not used by default. work with your community manager to define custom channels. • defaultchannel—default recommendation channel. recommendations appear by default on the home and question detail pages of customer service and partner central experience builder templates. they also appear in the feed in the salesforce mobile web and anywhere community managers add recommendations using experience builder. maxresults type: integer maximum number of recommendation results; default is 10. values must be from 1 to 99. result type: connectapi.recommendationcollection 1431apex reference guide recommendations class object containing test data. return value type: void see also: getrecommendationsforuser(communityid, userid, action, contextaction, contextobjectid, channel, maxresults) apex developer guide: testing connectapi code settestgetrecommendationsforuser(communityid, userid, action, objectcategory, contextaction, contextobjectid, channel, maxresults, result) register a connectapi.recommendationcollection object to be returned when getrecommendationsforuser is called with matching parameters in a test context. use the method with the same" "parameters or the code throws an exception. api version 36.0 requires chatter yes signature public static void settestgetrecommendationsforuser(string communityid, string userid, connectapi.recommendationactiontype action, string objectcategory, connectapi.recommendationactiontype contextaction, string contextobjectid, connectapi.recommendationchannel channel, integer maxresults, connectapi.recommendationcollection result) parameters communityid type: string id for an experience cloud site, internal, or null. userid type: string id for the context user or the keyword me. action type: connectapi.recommendationactiontype specifies the action to take on a recommendation. • follow—follow a file, record, topic, or user. • join—join a group. • view—view a file, group, article, record, user, custom, or static recommendation. 1432" "apex reference guide recommendations class objectcategory type: string • if action is follow, objectcategory is users, files, records, or topics. • if action is join, objectcategory is groups. • if action is view, objectcategory is users, files, groups, records,custom, apps, or articles (version 37.0 and later). you can also specify a key prefix, the first three characters of the object id, as the objectcategory. valid values are: • if action is follow, objectcategory is 005 (users), 069 (files), 0to (topics), or 001 (accounts), for example. • if action is join, objectcategory is 0f9 (groups). • if action is view, objectcategory is 005 (users), 069 (files), 0f9 (groups), 0rd (custom recommendations), t (static recommendations), 001 (accounts), or ka0 (articles), for example, (version 370 and later). contextaction type: connectapi.recommendationactiontype action that the context user just performed. supported values are: • follow • view use contextaction and contextobjectid together to get new recommendations based on the action just performed. if you don’t want recommendations based on a recent action, specify null. contextobjectid type: string id of the object that the context user just performed an action on. • if contextaction is follow, contextobjectid is a user id, file id, record id, or topic id. • if contextaction is view, contextobjectid is a user id, file id, group id, record id, or article id (version 37.0 and later). use contextaction and contextobjectid together to get new recommendations based on the action just performed. if you don’t want recommendations based on a recent action, specify null. channel type: connectapi.recommendationchannel a way to tie custom recommendations together. for example, display recommendations in specific places in the ui or show recommendations based on time of day or geographic locations. values are: • customchannel1—custom recommendation channel. not used by default. work with your community manager to define custom channels. for example, community managers can use experience builder to determine where recommendations appear. • customchannel2—custom recommendation channel. not used by default. work with your community manager to define custom channels. • customchannel3—custom recommendation channel. not used by default. work with your community manager to define custom channels. • customchannel4—custom recommendation channel. not used by default. work with your community manager to define custom channels. • customchannel5—custom recommendation channel. not used by default. work with your community manager to define custom channels. 1433apex reference guide recommendations class • defaultchannel—default recommendation channel. recommendations appear by default on the home and question detail pages of customer service and partner central experience builder templates. they also appear in the feed in the salesforce mobile web and anywhere community managers add recommendations using experience builder. maxresults type: integer maximum number of recommendation results; default is 10. values must be from 1 to 99. result type: connectapi.recommendationcollection object containing test data. return value type: void see also: getrecommendationsforuser(communityid, userid, action, objectcategory, contextaction, contextobjectid, channel, maxresults) apex developer guide: testing connectapi code retired recommendations methods the following methods for recommendations are retired. in this section: createscheduledrecommendation(communityid, recommendationdefinitionid, rank, enabled, recommendationaudienceid) create a scheduled custom recommendation with the specified parameters. getrecommendationsforuser(communityid, userid, contextaction, contextobjectid, maxresults) get the chatter recommendations, such as user, group, file, and record recommendations for the context user. get the custom and static recommendations for the context user. getrecommendationsforuser(communityid, userid, action, contextaction, contextobjectid, maxresults) get the chatter, custom, and static recommendations for the context user for the specified action. getrecommendationsforuser(communityid, userid, action, objectcategory, contextaction, contextobjectid, maxresults) get the chatter, custom, and static recommendations for the context user for the specified action and object category. getscheduledrecommendations(communityid) get scheduled custom recommendations. settestgetrecommendationsforuser(communityid, userid, contextaction, contextobjectid, maxresults, result)" "register a connectapi.recommendationcollection object to be returned when getrecommendationsforuser is called with matching parameters in a test context. use the method with the same parameters or the code throws an exception. settestgetrecommendationsforuser(communityid, userid, action, contextaction, contextobjectid, maxresults, result) register a connectapi.recommendationcollection object to be returned when getrecommendationsforuser is called with matching parameters in a test context. use the method with the same parameters or the code throws an exception. 1434apex reference guide recommendations class settestgetrecommendationsforuser(communityid, userid, action, objectcategory, contextaction, contextobjectid, maxresults, result) register a connectapi.recommendationcollection object to be returned when getrecommendationsforuser is called with matching parameters in a test context. use the method with the same parameters or the code throws an exception. createscheduledrecommendation(communityid, recommendationdefinitionid, rank, enabled, recommendationaudienceid) create a scheduled custom recommendation with the specified parameters. api version 35.0 only important: in version 36.0 and later, use createscheduledrecommendation(communityid, recommendationdefinitionid, rank, enabled, recommendationaudienceid, channel). requires chatter no signature public static connectapi.scheduledrecommendation createscheduledrecommendation(string communityid, string recommendationdefinitionid, integer rank, boolean enabled, string recommendationaudienceid) parameters communityid type: string id for an experience cloud site, internal, or null. recommendationdefinitionid type: string id of the custom recommendation definition. rank type: integer relative rank of the scheduled custom recommendation indicated by ascending whole numbers starting with 1. setting the rank is comparable to an insertion into an ordered list. the scheduled custom recommendation is inserted into the position specified by the rank. the rank of all the scheduled custom recommendations after it is pushed down. see ranking scheduled custom recommendations example. if the specified rank is larger than the size of the list, the scheduled custom recommendation is put at the end of the list. the rank of the scheduled custom recommendation is the size of the list, instead of the one specified. if a rank is not specified, the scheduled custom recommendation is put at the end of the list. enabled type: boolean 1435apex reference guide recommendations class indicates whether scheduling is enabled. if true, the custom recommendation is enabled and appears in experience cloud sites. if false, custom recommendations in feeds in salesforce mobile web aren’t removed, but no new custom recommendations appear. in customer service and partner central sites, disabled custom recommendations no longer appear. recommendationaudienceid type: string id of the custom recommendation definition that this scheduled recommendation schedules. return value type: connectapi.scheduledrecommendation usage community managers can access, create, and delete audiences, definitions, and schedules for custom recommendations. (community managers are users with the create and set up experiences or manage experiences permission.) users with the modify all data permission can also access, create, and delete custom recommendation audiences, custom recommendation definitions, and scheduled custom recommendations. ranking scheduled custom recommendations example if you have these scheduled custom recommendations: scheduled recommendations rank scheduledrecommendationa 1 scheduledrecommendationb 2 scheduledrecommendationc 3 and you include this information in the scheduled custom recommendation input: scheduled recommendation rank scheduledrecommendationd 2 the result is: scheduled recommendation rank scheduledrecommendationa 1 scheduledrecommendationd 2 scheduledrecommendationb 3 scheduledrecommendationc 4 1436apex reference guide recommendations class getrecommendationsforuser(communityid, userid, contextaction, contextobjectid, maxresults) get the chatter recommendations, such as user, group, file, and record recommendations for the context user. get the custom and static recommendations for the context user. api version 33.0–35.0 important: in version 36.0 and later, use getrecommendationsforuser(communityid, userid, contextaction, contextobjectid, channel, maxresults). requires chatter yes signature public static connectapi.recommendationcollection getrecommendationsforuser(string communityid, string userid, connectapi.recommendationactiontype contextaction, string contextobjectid, integer maxresults)" "parameters communityid type: string id for an experience cloud site, internal, or null. userid type: string id for the context user or the keyword me. contextaction type: connectapi.recommendationactiontype action that the context user just performed. supported values are: • follow • view use contextaction and contextobjectid together to get new recommendations based on the action just performed. if you don’t want recommendations based on a recent action, specify null. contextobjectid type: string id of the object that the context user just performed an action on. • if contextaction is follow, contextobjectid is a user id, file id, or record id. • if contextaction is view, contextobjectid is a user id, file id, group id, or record id. use contextaction and contextobjectid together to get new recommendations based on the action just performed. if you don’t want recommendations based on a recent action, specify null. 1437apex reference guide recommendations class maxresults type: integer maximum number of recommendation results; default is 10. values must be from 1 to 99. return value type: connectapi.recommendationcollection usage if you want to get recommendations based on a recent action performed, such as following a user, use contextaction and contextobjectid together. for example, if you just followed pam, you specify follow for contextaction and pam’s user id for contextobjectid. this method only recommends users who are followed by people who follow pam. in this example, john follows pam so the method returns a recommendation for you to follow suzanne since john also follows suzanne. to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestgetrecommendationsforuser(communityid, userid, contextaction, contextobjectid, maxresults, result) apex developer guide: testing connectapi code getrecommendationsforuser(communityid, userid, action, contextaction, contextobjectid, maxresults) get the chatter, custom, and static recommendations for the context user for the specified action. api version 33.0–35.0 1438apex reference guide recommendations class important: in version 36.0 and later, use getrecommendationsforuser(communityid, userid, action, contextaction, contextobjectid, channel, maxresults). requires chatter yes signature public static connectapi.recommendationcollection getrecommendationsforuser(string communityid, string userid, connectapi.recommendationactiontype action, connectapi.recommendationactiontype contextaction, string contextobjectid, integer maxresults) parameters communityid type: string id for an experience cloud site, internal, or null. userid type: string id for the context user or the keyword me. action type: connectapi.recommendationactiontype specifies the action to take on a recommendation. • follow—follow a file, record, topic, or user. • join—join a group. • view—view a file, group, article, record, user, custom, or static recommendation. contextaction type: connectapi.recommendationactiontype action that the context user just performed. supported values are: • follow • view use contextaction and contextobjectid together to get new recommendations based on the action just performed. if you don’t want recommendations based on a recent action, specify null. contextobjectid type: string id of the object that the context user just performed an action on. • if contextaction is follow, contextobjectid is a user id, file id, or record id. • if contextaction is view, contextobjectid is a user id, file id, group id, or record id. use contextaction and contextobjectid together to get new recommendations based on the action just performed. if you don’t want recommendations based on a recent action, specify null. 1439apex reference guide recommendations class maxresults type: integer maximum number of recommendation results; default is 10. values must be from 1 to 99. return value type: connectapi.recommendationcollection usage if you want to get recommendations based on a recent action performed, such as following a user, use contextaction and contextobjectid together. for example, if you just followed pam, you specify follow for contextaction and pam’s user id for contextobject" "id. this method only recommends users who are followed by people who follow pam. in this example, john follows pam so the method returns a recommendation for you to follow suzanne since john also follows suzanne. to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestgetrecommendationsforuser(communityid, userid, action, contextaction, contextobjectid, maxresults, result) apex developer guide: testing connectapi code getrecommendationsforuser(communityid, userid, action, objectcategory, contextaction, contextobjectid, maxresults) get the chatter, custom, and static recommendations for the context user for the specified action and object category. api version 33.0–35.0 1440apex reference guide recommendations class important: in version 36.0 and later, use getrecommendationsforuser(communityid, userid, action, objectcategory, contextaction, contextobjectid, channel, maxresults). requires chatter yes signature public static connectapi.recommendationcollection getrecommendationsforuser(string communityid, string userid, connectapi.recommendationactiontype action, string objectcategory, connectapi.recommendationactiontype contextaction, string contextobjectid, integer maxresults) parameters communityid type: string id for an experience cloud site, internal, or null. userid type: string id for the context user or the keyword me. action type: connectapi.recommendationactiontype specifies the action to take on a recommendation. • follow—follow a file, record, topic, or user. • join—join a group. • view—view a file, group, article, record, user, custom, or static recommendation. objectcategory type: string • if action is follow, objectcategory is users, files, or records. • if action is join, objectcategory is groups. • if action is view, objectcategory is users, files, groups, records, custom, or apps. you can also specify a key prefix, the first three characters of the object id, as the objectcategory. valid values are: • if action is follow, objectcategory is 005 (users), 069 (files), or 001 (accounts), for example. • if action is join, objectcategory is 0f9 (groups). • if action is view, objectcategory is 005 (users), 069 (files), 0f9 (groups), 0rd (custom recommendations), t (static recommendations), or 001 (accounts), for example. contextaction type: connectapi.recommendationactiontype action that the context user just performed. supported values are: • follow • view 1441apex reference guide recommendations class use contextaction and contextobjectid together to get new recommendations based on the action just performed. if you don’t want recommendations based on a recent action, specify null. contextobjectid type: string id of the object that the context user just performed an action on. • if contextaction is follow, contextobjectid is a user id, file id, or record id. • if contextaction is view, contextobjectid is a user id, file id, group id, or record id. use contextaction and contextobjectid together to get new recommendations based on the action just performed. if you don’t want recommendations based on a recent action, specify null. maxresults type: integer maximum number of recommendation results; default is 10. values must be from 1 to 99. return value type: connectapi.recommendationcollection usage if you want to get recommendations based on a recent action performed, such as following a user, use contextaction and contextobjectid together. for example, if you just followed pam, you specify follow for contextaction and pam’s user id for contextobjectid. this method only recommends users who are followed by people who follow pam. in this example, john follows pam so the method returns a recommendation for you to follow suzanne since john also follows suzanne. 1442apex reference guide recommendations class to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestgetrecommendationsforuser(communityid, userid, action, objectcategory, contextaction, contextobjectid, maxresults, result) a" "pex developer guide: testing connectapi code getscheduledrecommendations(communityid) get scheduled custom recommendations. api version 35.0 only important: in version 36.0 and later, use getscheduledrecommendations(communityid, channel). requires chatter no signature public static connectapi.scheduledrecommendationpage getscheduledrecommendations(string communityid) parameters communityid type: string id for an experience cloud site, internal, or null. return value type: connectapi.scheduledrecommendationpage usage community managers can access, create, and delete audiences, definitions, and schedules for custom recommendations. (community managers are users with the create and set up experiences or manage experiences permission.) users with the modify all data permission can also access, create, and delete custom recommendation audiences, custom recommendation definitions, and scheduled custom recommendations. settestgetrecommendationsforuser(communityid, userid, contextaction, contextobjectid, maxresults, result) register a connectapi.recommendationcollection object to be returned when getrecommendationsforuser is called with matching parameters in a test context. use the method with the same parameters or the code throws an exception. 1443apex reference guide recommendations class api version 33.0–35.0 requires chatter yes signature public static void settestgetrecommendationsforuser(string communityid, string userid, connectapi.recommendationactiontype contextaction, string contextobjectid, integer maxresults, connectapi.recommendationcollection result) parameters communityid type: string id for an experience cloud site, internal, or null. userid type: string id for the context user or the keyword me. contextaction type: connectapi.recommendationactiontype action that the context user just performed. supported values are: • follow • view use contextaction and contextobjectid together to get new recommendations based on the action just performed. if you don’t want recommendations based on a recent action, specify null. contextobjectid type: string id of the object that the context user just performed an action on. • if contextaction is follow, contextobjectid is a user id, file id, or record id. • if contextaction is view, contextobjectid is a user id, file id, group id, or record id. use contextaction and contextobjectid together to get new recommendations based on the action just performed. if you don’t want recommendations based on a recent action, specify null. maxresults type: integer maximum number of recommendation results; default is 10. values must be from 1 to 99. result type: connectapi.recommendationcollection object containing test data. 1444apex reference guide recommendations class return value type: void see also: getrecommendationsforuser(communityid, userid, contextaction, contextobjectid, maxresults) apex developer guide: testing connectapi code settestgetrecommendationsforuser(communityid, userid, action, contextaction, contextobjectid, maxresults, result) register a connectapi.recommendationcollection object to be returned when getrecommendationsforuser is called with matching parameters in a test context. use the method with the same parameters or the code throws an exception. api version 33.0–35.0 requires chatter yes signature public static void settestgetrecommendationsforuser(string communityid, string userid, connectapi.recommendationactiontype action, connectapi.recommendationactiontype contextaction, string contextobjectid, integer maxresults, connectapi.recommendationcollection result) parameters communityid type: string id for an experience cloud site, internal, or null. userid type: string id for the context user or the keyword me. action type: connectapi.recommendationactiontype specifies the action to take on a recommendation. • follow—follow a file, record, topic, or user. • join—join a group. • view—view a file, group, article, record, user, custom, or static recommendation. contextaction type: connectapi.recommendationactiontype action that the context user just performed. supported values are: 1445apex reference guide recommendations class • follow • view use contextaction and contextobjectid together to get new recommendations based on the action just performed. if you don’t want recommendations based on a recent" "action, specify null. contextobjectid type: string id of the object that the context user just performed an action on. • if contextaction is follow, contextobjectid is a user id, file id, or record id. • if contextaction is view, contextobjectid is a user id, file id, group id, or record id. use contextaction and contextobjectid together to get new recommendations based on the action just performed. if you don’t want recommendations based on a recent action, specify null. maxresults type: integer maximum number of recommendation results; default is 10. values must be from 1 to 99. result type: connectapi.recommendationcollection object containing test data. return value type: void see also: getrecommendationsforuser(communityid, userid, action, contextaction, contextobjectid, maxresults) apex developer guide: testing connectapi code settestgetrecommendationsforuser(communityid, userid, action, objectcategory, contextaction, contextobjectid, maxresults, result) register a connectapi.recommendationcollection object to be returned when getrecommendationsforuser is called with matching parameters in a test context. use the method with the same parameters or the code throws an exception. api version 33.0–35.0 requires chatter yes signature public static void settestgetrecommendationsforuser(string communityid, string userid, connectapi.recommendationactiontype action, string objectcategory, 1446apex reference guide recommendations class connectapi.recommendationactiontype contextaction, string contextobjectid, integer maxresults, connectapi.recommendationcollection result) parameters communityid type: string id for an experience cloud site, internal, or null. userid type: string id for the context user or the keyword me. action type: connectapi.recommendationactiontype specifies the action to take on a recommendation. • follow—follow a file, record, topic, or user. • join—join a group. • view—view a file, group, article, record, user, custom, or static recommendation. objectcategory type: string • if action is follow, objectcategory is users, files, or records. • if action is join, objectcategory is groups. • if action is view, objectcategory is users, files, groups, records,custom, or apps. you can also specify a key prefix, the first three characters of the object id, as the objectcategory. valid values are: • if action is follow, objectcategory is 005 (users), 069 (files), or 001 (accounts), for example. • if action is join, objectcategory is 0f9 (groups). • if action is view, objectcategory is 005 (users), 069 (files), 0f9 (groups), 0rd (custom recommendations), t (static recommendations), or 001 (accounts), for example. contextaction type: connectapi.recommendationactiontype action that the context user just performed. supported values are: • follow • view use contextaction and contextobjectid together to get new recommendations based on the action just performed. if you don’t want recommendations based on a recent action, specify null. contextobjectid type: string id of the object that the context user just performed an action on. • if contextaction is follow, contextobjectid is a user id, file id, or record id. • if contextaction is view, contextobjectid is a user id, file id, group id, or record id. use contextaction and contextobjectid together to get new recommendations based on the action just performed. if you don’t want recommendations based on a recent action, specify null. 1447apex reference guide records class maxresults type: integer maximum number of recommendation results; default is 10. values must be from 1 to 99. result type: connectapi.recommendationcollection object containing test data. return value type: void see also: getrecommendationsforuser(communityid, userid, action, objectcategory, contextaction, contextobjectid, maxresults) apex developer guide: testing connectapi code records class access information about record motifs, which are small icons used to distinguish record types in the salesforce ui. namespace connectapi records methods the following are methods for records. all methods are static. in this section: getmotif(communityid, idorprefix) get" "a motif that contains the urls for a set of small, medium, and large motif icons for a record. it can also contain a base color for the record. getmotifbatch(communityid, idorprefixlist) get a motif for a list of objects. getmotif(communityid, idorprefix) get a motif that contains the urls for a set of small, medium, and large motif icons for a record. it can also contain a base color for the record. api version 28.0 requires chatter no 1448apex reference guide records class signature public static connectapi.motif getmotif(string communityid, string idorprefix) parameters communityid type: string id for an experience cloud site, internal, or null. idorprefix type: string an id or key prefix. return value type: connectapi.motif usage each salesforce record type has its own set of motif icons. getmotifbatch(communityid, idorprefixlist) get a motif for a list of objects. api version 31.0 requires chatter no signature public static connectapi.batchresult[] getmotifbatch(string communityid, list idorprefixlist) parameters communityid type: string id for an experience cloud site, internal, or null. idorprefixlist type: list a list of object ids or prefixes. 1449apex reference guide repricing class return value type: connectapi.batchresult[] the connectapi.batchresult.getresult() method returns a connectapi.motif object and errors for motifs that didn’t load. example string communityid = null; list prefixids = new list { '001', '01z', '069' }; // get info about the motifs of all records in the list. connectapi.batchresult[] batchresults = connectapi.records.getmotifbatch(communityid, prefixids); for (connectapi.batchresult batchresult : batchresults) { if (batchresult.issuccess()) { // operation was successful. // print the color of each motif. connectapi.motif motif; if(batchresult.getresult() instanceof connectapi.motif) { motif = (connectapi.motif) batchresult.getresult(); } system.debug('success'); system.debug(motif.color); } else { // operation failed. print errors. system.debug('failure'); system.debug(batchresult.geterrormessage()); } } repricing class perform functions related to repricing orders in order management. namespace connectapi repricing methods the following are methods for repricing. all methods are static. in this section: productdetails(webstoreid, skuorproductid, effectiveaccountid, currencycode, locale) get details of a product in a web store. 1450apex reference guide repricing class productdetails(webstoreid, skuorproductid, effectiveaccountid, currencycode, locale) get details of a product in a web store. api version 55.0 requires chatter no signature public static connectapi.productdetailsoutputrepresentation productdetails(string webstoreid, string skuorproductid, string effectiveaccountid, string currencycode, string locale) parameters webstoreid type: string id of the webstore. skuorproductid type: string sku or id of the product. effectiveaccountid type: string effective account id. required for b2b stores. for other stores, pass null. currencycode type: string iso currency code. if you pass null, the default store value is used. locale type: string locale. if you pass null, the default store value is used. excludeattributesetinfo type: string specifies whether the attribute set information for the product is returned. excludemedia type: string specifies whether the media groups and default images of the product are returned. excludequantityrule type: string specifies whether the quantity rule information for the product is returned. 1451apex reference guide returnorder class excludevariationinfo" "type: string specifies whether the variation information for the product is returned. excludeprices type: string specifies whether the prices for the product is returned. return value type: connectapi.productdetailsoutputrepresentation returnorder class process returnorders in order management. namespace connectapi returnorder methods the following are methods for returnorder. all methods are static. in this section: createreturnorder(returnorderinput) create a returnorder and returnorderlineitems for items belonging to an ordersummary. returnitems(returnorderid, returnitemsinput) process returnorderlineitems belonging to a returnorder. processing a returnorderlineitem generates a change order and makes that returnorderlineitem read-only. the change order for a returned item or delivery charge has a positive amount and should be used to create a credit memo. the change order for a return fee has a negative amount and should be used to create an invoice. if a processed returnorderlineitem has any remaining expected quantity, then the api creates a separate returnorderlineitem representing that quantity. createreturnorder(returnorderinput) create a returnorder and returnorderlineitems for items belonging to an ordersummary. api version 50.0 requires chatter no 1452apex reference guide returnorder class signature public static connectapi.returnorderoutputrepresentation createreturnorder(connectapi.returnorderinputrepresentation returnorderinput) parameters returnorderinput type: connectapi.returnorderinputrepresentation data for creating a returnorder and returnorderlineitems. return value type: connectapi.returnorderoutputrepresentation see also: returnitems(returnorderid, returnitemsinput) returnitems(returnorderid, returnitemsinput) process returnorderlineitems belonging to a returnorder. processing a returnorderlineitem generates a change order and makes that returnorderlineitem read-only. the change order for a returned item or delivery charge has a positive amount and should be used to create a credit memo. the change order for a return fee has a negative amount and should be used to create an invoice. if a processed returnorderlineitem has any remaining expected quantity, then the api creates a separate returnorderlineitem representing that quantity. api version 52.0 requires chatter no signature public static connectapi.returnitemsoutputrepresentation returnitems(string returnorderid, connectapi.returnitemsinputrepresentation returnitemsinput) parameters returnorderid type: string id of the returnorder. returnitemsinput type: connectapi.returnitemsinputrepresentation data about products and delivery charges to return, as well as associated return fees. 1453apex reference guide routing class return value type: connectapi.returnitemsoutputrepresentation see also: createmultipleinvoices(invoicesinput) ensurerefundsasync(ordersummaryid, ensurerefundsinput) createreturnorder(returnorderinput) routing class route orders to inventory locations in order management. namespace connectapi routing methods the following are methods for routing. all methods are static. in this section: confirmheldfocapacity(confirmheldfocapacityinput) confirm held fulfillment order capacity at one or more locations. this call decreases a location’s held capacity and increases its assigned fulfillment order count. confirm held capacity when you assign a fulfillment order to a location. findrouteswithfewestsplits(findrouteswithfewestsplitsinputrepresentation) returns combinations of inventory locations that can fulfill an order within a specified limit of shipment splits. by default, checks up to 1,000,000 potential routes, returning a maximum of 10,000 results. findrouteswithfewestsplitsusingoci(findrouteswithfewestsplitsusingociinput) for one or more order summaries, find inventory availability using omnichannel inventory and identify the fulfillment routes with fewest splits. by default, checks up to 1,000,000 potential routes, returning a maximum of 10,000 results. this method combines the functionality of the getinventoryavailability() and findrouteswithfewestsplits() methods. getfocapacityvalues(getfocapacityvaluesinput) get information about the current fulfillment order capacity of one or more locations. holdfocapacity(holdfocapacityinput) hold fulfillment order capacity at a location. holding capacity at a location reserves a" "space for a fulfillment order that you’ll assign to it. rankaveragedistance(rankaveragedistanceinputrepresentation) calculates the average distance from sets of inventory locations to an order recipient, and ranks them. use this method to compare the average shipping distances for different sets of locations that can fulfill an order. releaseheldfocapacity(releaseheldfocapacityinput) release held fulfillment order capacity at one or more locations. this call decreases a location’s held capacity without changing its assigned fulfillment order count. release held capacity when you cancel the assignment of a fulfillment order to a location. 1454apex reference guide routing class confirmheldfocapacity(confirmheldfocapacityinput) confirm held fulfillment order capacity at one or more locations. this call decreases a location’s held capacity and increases its assigned fulfillment order count. confirm held capacity when you assign a fulfillment order to a location. api version 55.0 requires chatter no signature public static connectapi.confirmheldfocapacityoutputrepresentation confirmheldfocapacity(connectapi.confirmheldfocapacityinputrepresentation confirmheldfocapacityinput) parameters confirmheldfocapacityinput type: connectapi.confirmheldfocapacityinputrepresentation the input includes, for each fulfillment order, the location where capacity is held for it. return value type: connectapi.confirmheldfocapacityoutputrepresentation findrouteswithfewestsplits(findrouteswithfewestsplitsinputrepresentation) returns combinations of inventory locations that can fulfill an order within a specified limit of shipment splits. by default, checks up to 1,000,000 potential routes, returning a maximum of 10,000 results. api version 51.0 requires chatter no signature public static connectapi.findrouteswithfewestsplitsoutputrepresentation findrouteswithfewestsplits(connectapi.findrouteswithfewestsplitsinputrepresentation findrouteswithfewestsplitsinputrepresentation) 1455apex reference guide routing class parameters findrouteswithfewestsplitsinputrepresentation type: connectapi.findrouteswithfewestsplitsinputrepresentation the input includes the ordered item quantities, data about available inventory, and, optionally, a maximum allowable number of shipment splits. return value type: connectapi.findrouteswithfewestsplitsoutputrepresentation findrouteswithfewestsplitsusingoci(findrouteswithfewestsplitsusingociinput) for one or more order summaries, find inventory availability using omnichannel inventory and identify the fulfillment routes with fewest splits. by default, checks up to 1,000,000 potential routes, returning a maximum of 10,000 results. this method combines the functionality of the getinventoryavailability() and findrouteswithfewestsplits() methods. api version 54.0 requires chatter no signature public static connectapi.findrouteswithfewestsplitsusingocioutputrepresentation findrouteswithfewestsplitsusingoci(connectapi.findrouteswithfewestsplitsusingociinputrepresentation findrouteswithfewestsplitsusingociinput) parameters findrouteswithfewestsplitsusingociinput type: connectapi.findrouteswithfewestsplitsusingociinputrepresentation the input includes, for each order, the ordered item quantities, the assigned location group or locations, and, optionally, a maximum allowable number of shipment splits and a list of locations to exclude from the calculation. return value type: connectapi.findrouteswithfewestsplitsusingocioutputrepresentation see also: getinventoryavailability(inventoryavailabilityinputrepresentation) findrouteswithfewestsplits(findrouteswithfewestsplitsinputrepresentation) getfocapacityvalues(getfocapacityvaluesinput) get information about the current fulfillment order capacity of one or more locations. 1456apex reference guide routing class api version 55.0 requires chatter no signature public static connectapi.getfocapacityvaluesoutputrepresentation getfocapacityvalues(connectapi.getfocapacityvaluesrequestinputrepresent" "ation getfocapacityvaluesinput) parameters getfocapacityvaluesinput type: connectapi.getfocapacityvaluesrequestinputrepresentation locations to get fulfillment order capacity information about. return value type: connectapi.getfocapacityvaluesoutputrepresentation holdfocapacity(holdfocapacityinput) hold fulfillment order capacity at a location. holding capacity at a location reserves a space for a fulfillment order that you’ll assign to it. api version 55.0 requires chatter no signature public static connectapi.holdfocapacityoutputrepresentation holdfocapacity(connectapi.holdfocapacityinputrepresentation holdfocapacityinput) parameters holdfocapacityinput type: connectapi.holdfocapacityinputrepresentation the input includes, for each fulfillment order, the location to hold capacity for it. return value type: connectapi.holdfocapacityoutputrepresentation 1457apex reference guide routing class rankaveragedistance(rankaveragedistanceinputrepresentation) calculates the average distance from sets of inventory locations to an order recipient, and ranks them. use this method to compare the average shipping distances for different sets of locations that can fulfill an order. api version 51.0 requires chatter no signature public static connectapi.rankaveragedistanceoutputrepresentation rankaveragedistance(connectapi.rankaveragedistanceinputrepresentation rankaveragedistanceinputrepresentation) parameters rankaveragedistanceinputrepresentation type: connectapi.rankaveragedistanceinputrepresentation an order recipient’s geographic location and information about sets of inventory locations that can fulfill the order. return value type: connectapi.rankaveragedistanceoutputrepresentation releaseheldfocapacity(releaseheldfocapacityinput) release held fulfillment order capacity at one or more locations. this call decreases a location’s held capacity without changing its assigned fulfillment order count. release held capacity when you cancel the assignment of a fulfillment order to a location. api version 55.0 requires chatter no signature public static connectapi.releaseheldfocapacityoutputrepresentation releaseheldfocapacity(connectapi.releaseheldfocapacityinputrepresentation releaseheldfocapacityinput) 1458apex reference guide salesforceinbox class parameters releaseheldfocapacityinput type: connectapi.releaseheldfocapacityinputrepresentation the input includes, for each fulfillment order, the location that holds the capacity to release. return value type: connectapi.releaseheldfocapacityoutputrepresentation salesforceinbox class access information about automated activity capture, which is available in einstein and salesforce inbox. namespace connectapi salesforceinbox methods the following are methods for salesforceinbox. all methods are static. in this section: shareactivity(activityid, sharinginfo) share emails or events with certain groups of users. shareactivity(activityid, sharinginfo) share emails or events with certain groups of users. api version 39.0 requires chatter no signature public static connectapi.activitysharingresult shareactivity(string activityid, connectapi.activitysharinginput sharinginfo) parameters activityid type: string the id of the activity. 1459apex reference guide sites class sharinginfo type: connectapi.activitysharinginput a connectapi.activitysharinginput object. return value type: connectapi.activitysharingresult usage this method is a feature of both sales cloud einstein and inbox. it lets users connect their email and calendar to salesforce. then, their emails and events are automatically added to related salesforce records. users can specify who their individual emails and events are shared with. sites class search an experience cloud site. namespace connectapi sites methods the following are methods for sites. all methods are static. in this section: searchsite(siteid, queryterm, pagetoken, pagesize, language) search an experience cloud site. searchsite(siteid, queryterm, pagetoken, pagesize, language) search an experience cloud site. api version 54.0 available to guest users 54.0 requires chatter no 1460apex reference guide smartdatadiscovery class signature public static connectapi.sitesearch" "result searchsite(string siteid, string queryterm, string pagetoken, integer pagesize, string language) parameters siteid type: string id for the experience cloud site. queryterm type: string white-space separated words used to search for relevant content. provide a maximum of 1024 characters, composed of up to 32 words and white spaces. logical operators aren’t supported. pagetoken type: string specifies the base64 encoded page token. page tokens are returned as part of the response. if unspecified, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 through 240. if you pass in null, the default size is 25. language type: string language locale for the context user. if unspecified or if the specified language locale isn’t available, the default value is en_us. return value type: connectapi.sitesearchresult smartdatadiscovery class get predictions on salesforce objects. use the connectapi.smartdatadiscovery.predict method to get predictions on salesforce objects. for more information, see get predictions in apex. socialengagement class manage information about social accounts or fan pages for social networks. namespace connectapi socialengagement methods the following are methods for socialengagement. all methods are static. 1461apex reference guide socialengagement class in this section: deletesocialpost(socialpostid, socialaccountid) delete a social post from its social network. followsocialpersona(socialpersonaid, socialaccountid) follow a social persona in its social network. followsocialpostpersona(socialpostid, socialaccountid) follow a social persona on a social post in its social network. getintents(socialpostid) get available intents for a social post. getmanagedsocialaccount(id) get a managed social account that is in the org and assigned to the user. getmanagedsocialaccounts() gets a list of managed social accounts that are in the org and assigned to the user. getmanagedsocialaccounts(socialnetwork) get a list of managed social accounts that are in the org and assigned to the user. getrelationship(id, socialpersonaid) get the follow relationship between a managed social account and a social persona. hidesocialpost(socialpostid, socialaccountid) hide a social post in its social network. likesocialpost(socialpostid, socialaccountid) like a social post in its social network. massapprove(massapproval) approve or reject the publishing of a large number of social posts. recallapproval(socialpostid) recall an approval request to publish a social post. unfollowsocialpersona(socialpersonaid, socialaccountid) stop following a social persona in its social network. unfollowsocialpostpersona(socialpostid, socialaccountid) stop following a social persona of a social post in its social network. unhidesocialpost(socialpostid, socialaccountid) unhide a social post in its social network. unlikesocialpost(socialpostid, socialaccountid) unlike a social post in its social network. deletesocialpost(socialpostid, socialaccountid) delete a social post from its social network. note: deleting a social post from its social network doesn’t delete the record from salesforce. 1462apex reference guide socialengagement class api version 46.0 requires chatter no signature public static connectapi.deletesocialpostintent deletesocialpost(string socialpostid, string socialaccountid) parameters socialpostid type: string id of the social post to delete. socialaccountid type: string id of the social account that deletes the post. return value type: connectapi.deletesocialpostintent followsocialpersona(socialpersonaid, socialaccountid) follow a social persona in its social network. api version 45.0 requires chatter no signature public static connectapi.followsocialpersonaintent followsocialpersona(string socialpersonaid, string socialaccountid) parameters socialpersonaid type: string id of the social persona to follow. 1463apex reference guide socialengagement class socialaccountid type: string id of the social account that follows the social persona. return value type: connectapi.followsocialpersonaintent" "followsocialpostpersona(socialpostid, socialaccountid) follow a social persona on a social post in its social network. api version 45.0 requires chatter no signature public static connectapi.followsocialpersonaintent followsocialpostpersona(string socialpostid, string socialaccountid) parameters socialpostid type: string id of the social post authored by the social persona to follow. socialaccountid type: string id of the social account that follows the social persona. return value type: connectapi.followsocialpersonaintent getintents(socialpostid) get available intents for a social post. api version 45.0 requires chatter no 1464apex reference guide socialengagement class signature public static connectapi.socialpostintents getintents(string socialpostid) parameters socialpostid type: string id of a social post. return value type: connectapi.socialpostintents getmanagedsocialaccount(id) get a managed social account that is in the org and assigned to the user. api version 44.0 requires chatter no signature public static connectapi.managedsocialaccount getmanagedsocialaccount(string id) parameters id type: string description: internal sfdc id for this managed social account. return value type: connectapi.managedsocialaccount getmanagedsocialaccounts() gets a list of managed social accounts that are in the org and assigned to the user. api version 44.0 requires chatter no 1465apex reference guide socialengagement class signature public static connectapi.managedsocialaccounts getmanagedsocialaccounts() return value type: connectapi.managedsocialaccounts getmanagedsocialaccounts(socialnetwork) get a list of managed social accounts that are in the org and assigned to the user. api version 44.0 requires chatter no signature public static connectapi.managedsocialaccounts getmanagedsocialaccounts(connectapi.socialnetworkprovider socialnetwork) parameters socialnetwork type: connectapi.socialnetworkprovider description: filters results based on the social network. values are: • facebook • googleplus • instagram • instagrambusiness • kakaotalk • kik • line • linkedin • messenger • other • pinterest • qq • rypple • sinaweibo • sms • snapchat 1466apex reference guide socialengagement class • telegram • twitter • vkontakte • wechat • whatsapp • youtube return value type: connectapi.managedsocialaccounts getrelationship(id, socialpersonaid) get the follow relationship between a managed social account and a social persona. api version 46.0 requires chatter no signature public static connectapi.socialaccountrelationship getrelationship(string id, string socialpersonaid) parameters id type: string id of the managed social account. socialpersonaid type: string id of the social persona. return value type: connectapi.socialaccountrelationship hidesocialpost(socialpostid, socialaccountid) hide a social post in its social network. api version 46.0 1467apex reference guide socialengagement class requires chatter no signature public static connectapi.hidesocialpostintent hidesocialpost(string socialpostid, string socialaccountid) parameters socialpostid type: string id of the social post to hide. socialaccountid type: string id of the social account that hides the post. return value type: connectapi.hidesocialpostintent likesocialpost(socialpostid, socialaccountid) like a social post in its social network. api version 46.0 requires chatter no signature public static connectapi.likesocialpostintent likesocialpost(string socialpostid, string socialaccountid) parameters socialpostid type: string id of the social post to like. socialaccountid type: string id of the social account that likes the post. 1468apex reference guide socialengagement class return value type: connectapi.likesocialpostintent massapprove(massapproval) approve or reject the publishing of a" "large number of social posts. api version 46.0 requires chatter no signature public static connectapi.socialpostmassapprovaloutput massapprove(connectapi.socialpostmassapprovalinput massapproval) parameters massapproval type: connectapi.socialpostmassapprovalinput a connectapi.socialpostmassapprovalinput body that includes a list of social post ids and the action to approve or reject publishing them. return value type: connectapi.socialpostmassapprovaloutput recallapproval(socialpostid) recall an approval request to publish a social post. api version 46.0 requires chatter no signature public static void recallapproval(string socialpostid) 1469apex reference guide socialengagement class parameters socialpostid type: string id of the social post. return value type: void unfollowsocialpersona(socialpersonaid, socialaccountid) stop following a social persona in its social network. api version 45.0 requires chatter no signature public static void unfollowsocialpersona(string socialpersonaid, string socialaccountid) parameters socialpersonaid type: string id of the social persona to stop following. socialaccountid type: string id of the social account that stops following the social persona. return value type: void unfollowsocialpostpersona(socialpostid, socialaccountid) stop following a social persona of a social post in its social network. api version 45.0 requires chatter no 1470apex reference guide socialengagement class signature public static void unfollowsocialpostpersona(string socialpostid, string socialaccountid) parameters socialpostid type: string id of the social post authored by the social persona to stop following. socialaccountid type: string id of the social account that stops following the social persona. return value type: void unhidesocialpost(socialpostid, socialaccountid) unhide a social post in its social network. api version 46.0 requires chatter no signature public static void unhidesocialpost(string socialpostid, string socialaccountid) parameters socialpostid type: string id of the social post to unhide. socialaccountid type: string id of the social account that unhides the post. return value type: void unlikesocialpost(socialpostid, socialaccountid) unlike a social post in its social network. 1471apex reference guide surveys class api version 46.0 requires chatter no signature public static void unlikesocialpost(string socialpostid, string socialaccountid) parameters socialpostid type: string id of the social post to unlike. socialaccountid type: string id of the social account that unlikes the post. return value type: void surveys class send survey invitations by email. namespace connectapi surveys methods these methods are for surveys. all methods are static. in this section: sendsurveyinvitationemail(surveyid, surveyemailinput) email survey invitations to up to 300 participants. you can email either leads, contacts, or users in your org. either a link to launch the survey or a question can be embedded in the email invitations. sendsurveyinvitationemail(surveyid, surveyemailinput) email survey invitations to up to 300 participants. you can email either leads, contacts, or users in your org. either a link to launch the survey or a question can be embedded in the email invitations. 1472apex reference guide taxplatform class api version 50.0 requires chatter no signature public static connectapi.surveyinvitationemailoutput sendsurveyinvitationemail(string surveyid, connectapi.surveyinvitationemailinput surveyemailinput) parameters surveyid type: string id of the survey. surveyemailinput type: connectapi.surveyinvitationemailinput a connectapi.surveyinvitationemailinput object. return value type: connectapi.surveyinvitationemailoutput taxplatform class apply or cancel tax. namespace connectapi taxplatform methods the following are methods for taxplatform. all methods are static. in this section: calculatetax(calculatetax" ") apply tax or cancel tax. calculatetax(calculatetax) apply tax or cancel tax. 1473apex reference guide topics class api version 55.0 requires chatter no signature global static connectapi.calculatetaxresponse calculatetax(connectapi.calculatetaxrequest calculatetax) parameters calculatetax type: connectapi.calculatetaxrequest represents a request to calculate tax for one or more line items. return value type: connectapi.calculatetaxresponse topics class access information about topics, such as their descriptions, the number of people talking about them, related topics, and information about groups contributing to the topic. update a topic’s name or description, merge topics, and add and remove topics from records and feed items. namespace connectapi topics methods the following are methods for topics. all methods are static. in this section: assigntopic(communityid, recordid, topicid) assign a topic to a record or feed item. assigntopicbyname(communityid, recordid, topicname) assign a topic to a record or feed item. createtopic(communityid, name, description) create a topic. createtopicdatacategoryrules(communityid, datacategorygroup, datacategory, topicnames) create topic and article assignment rules by data category. 1474apex reference guide topics class deletetopic(communityid, topicid) delete a topic. getgroupsrecentlytalkingabouttopic(communityid, topicid) get information about the five groups that most recently contributed to a topic. getrecentlytalkingabouttopicsforgroup(communityid, groupid) get up to five topics most recently used in a group. getrecentlytalkingabouttopicsforuser(communityid, userid) get up to five topics most recently used by a user. getrelatedtopics(communityid, topicid) get up to five topics most closely related to a topic. gettopic(communityid, topicid) get a topic. gettopicdatacategoryrules(communityid, datacategorygroup, datacategory) get topic and article assignment rules by data category. gettopics(communityid, recordid) get the first page of topics assigned to a record or feed item. gettopics(communityid) get the first page of topics for the org or experience cloud site. gettopics(communityid, sortparam) get the first page of sorted topics for the org or community. gettopics(communityid, pageparam, pagesize) get a page of topics. gettopics(communityid, pageparam, pagesize, sortparam) get a page of sorted topics. gettopics(communityid, q, sortparam) get the sorted topics that match the search criteria. gettopics(communityid, q, pageparam, pagesize) get a page of topics that match the search criteria. gettopics(communityid, q, pageparam, pagesize, sortparam) get a page of sorted topics that match the search criteria. gettopics(communityid, q, exactmatch) get the topic that matches the exact, case-insensitive name. gettopicsorfallbacktorenamedtopics(communityid, q, exactmatch, fallbacktorenamedtopics) get the most recent renamed topic match, if there isn’t an exact match. gettopicsuggestions(communityid, recordid, maxresults) get up to a specified number of suggested topics for a record or feed item. gettopicsuggestions(communityid, recordid) get suggested topics for a record or feed item. gettopicsuggestionsfortext(communityid, text, maxresults) get up to a specified number of suggested topics for a string of text. 1475apex reference guide topics class gettopicsuggestionsfortext(communityid, text) get suggested topics for a string of text. gettrendingtopics(communityid) get trending topics for the org or experience cloud site. gettrendingtopics(communityid, maxresults) get up to a specified number of trending topics for the org or experience cloud site. mergetopics(communityid, topicid, idstomerge) merge up to five secondary topics with a primary topic. reassigntopicdatacategoryrules(communityid, datacategorygroup, datacategory, topicnames) reassign topic and article assignment rules by data category by deleting the existing rules and creating new rules. reassigntopicsbyname(communityid, recordid, topicnames" ") reassign all the topics on a record or feed item, that is, remove all the assigned topics on a record or feed item and add topics. optionally, provide a list of suggested topics to assign to a record or feed item to improve future topic suggestions. unassigntopic(communityid, recordid, topicid) remove a topic from a record or feed item. updatetopic(communityid, topicid, topic) update the description or name of a topic or merge up to five secondary topics with a primary topic. updatetopicsforarticlesindatacategory(communityid, datacategorygroup, datacategory, articletopicassignmentjob) assign topics to articles and unassign topics from articles in a data category. assigntopic(communityid, recordid, topicid) assign a topic to a record or feed item. api version 29.0 requires chatter no signature public static connectapi.topic assigntopic(string communityid, string recordid, string topicid) parameters communityid type: string id for an experience cloud site, internal, or null. recordid type: string id for a record or feed item. 1476apex reference guide topics class topicid type: string id for a topic. return value type: connectapi.topic usage only users with the assign topics permission can add existing topics to records or feed items. administrators must enable topics for objects before users can add topics to records of that object type. assigntopicbyname(communityid, recordid, topicname) assign a topic to a record or feed item. api version 29.0 requires chatter no signature public static connectapi.topic assigntopicbyname(string communityid, string recordid, string topicname) parameters communityid type: string id for an experience cloud site, internal, or null. recordid type: string the id of the record or feed item to which to assign the topic. topicname type: string the name of a new or existing topic. return value type: connectapi.topic 1477apex reference guide topics class usage only users with the assign topics permission can add existing topics to records or feed items. only users with the create topics permission can add new topics to records or feed items. administrators must enable topics for objects before users can add topics to records of that object type. createtopic(communityid, name, description) create a topic. api version 36.0 requires chatter no signature public static connectapi.topic createtopic(string communityid, string name, string description) parameters communityid type: string id for an experience cloud site, internal, or null. name type: string the name of the topic. description type: string the description of the topic. return value type: connectapi.topic usage only users with the create topics permission can create a topic. createtopicdatacategoryrules(communityid, datacategorygroup, datacategory, topicnames) create topic and article assignment rules by data category. 1478apex reference guide topics class api version 40.0 requires chatter no signature public static connectapi.topicpage createtopicdatacategoryrules(string communityid, string datacategorygroup, string datacategory, connectapi.topicnamesinput topicnames) parameters communityid type: string id for an experience cloud site, internal, or null. datacategorygroup type: string the data category group used by articles. datacategory type: string the data category used by articles. topicnames type: connectapi.topicnamesinput a connectapi.topicnamesinput object with the names of topics to assign to articles in a data category. return value type: connectapi.topicpage deletetopic(communityid, topicid) delete a topic. api version 29.0 requires chatter no signature public static void deletetopic(string communityid, string topicid) 1479apex reference guide topics class parameters communityid type: string, id for an experience cloud site, internal, or null. topicid type: string id for a topic. return value type: void usage only users with the delete topics or modify all data permission can delete topics. topic deletion is asynchronous. if a topic is requested before the deletion completes, the response is successful and the isbeingdeleted property of connecta" "pi.topic is true in version 33.0 and later. if a topic is requested after the deletion completes, the response is connectapi.notfoundexception. getgroupsrecentlytalkingabouttopic(communityid, topicid) get information about the five groups that most recently contributed to a topic. api version 29.0 available to guest users 32.0 requires chatter yes signature public static connectapi.chattergroupsummarypage getgroupsrecentlytalkingabouttopic(string communityid, string topicid) parameters communityid type: string id for an experience cloud site, internal, or null. topicid type: string id for a topic. 1480apex reference guide topics class return value type: connectapi.chattergroupsummarypage usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestgetgroupsrecentlytalkingabouttopic(communityid, topicid, result) apex developer guide: testing connectapi code getrecentlytalkingabouttopicsforgroup(communityid, groupid) get up to five topics most recently used in a group. api version 29.0 available to guest users 32.0 requires chatter yes signature public static connectapi.topicpage getrecentlytalkingabouttopicsforgroup(string communityid, string groupid) parameters communityid type: string id for an experience cloud site, internal, or null. groupid type: string id for a group. return value type: connectapi.topicpage 1481apex reference guide topics class usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestgetrecentlytalkingabouttopicsforgroup(communityid, groupid, result) apex developer guide: testing connectapi code getrecentlytalkingabouttopicsforuser(communityid, userid) get up to five topics most recently used by a user. api version 29.0 available to guest users 32.0 requires chatter yes signature public static connectapi.topicpage getrecentlytalkingabouttopicsforuser(string communityid, string userid) parameters communityid type: string id for an experience cloud site, internal, or null. userid type: string id for a user. return value type: connectapi.topicpage 1482" "apex reference guide topics class usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestgetrecentlytalkingabouttopicsforuser(communityid, userid, result) apex developer guide: testing connectapi code getrelatedtopics(communityid, topicid) get up to five topics most closely related to a topic. two topics that are assigned to the same feed item at least three times are related. api version 29.0 available to guest users 32.0 requires chatter no signature public static connectapi.topicpage getrelatedtopics(string communityid, string topicid) parameters communityid type: string id for an experience cloud site, internal, or null. topicid type: string id for a topic. return value type: connectapi.topicpage 1483apex reference guide topics class usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestgetrelatedtopics(communityid, topicid, result) apex developer guide: testing connectapi code gettopic(communityid, topicid) get a topic. api version 29.0 available to guest users 32.0 requires chatter no signature public static connectapi.topic gettopic(string communityid, string topicid) parameters communityid type: string id for an experience cloud site, internal, or null. topicid type: string id for a topic. return value type: connectapi.topic gettopicdatacategoryrules(communityid, datacategorygroup, datacategory) get topic and article assignment rules by data category. api version 40.0 1484apex reference guide topics class requires chatter no signature public static connectapi.topicpage gettopicdatacategoryrules(string communityid, string datacategorygroup, string datacategory) parameters communityid type: string id for an experience cloud site, internal, or null. datacategorygroup type: string the data category group used by articles. datacategory type: string the data category used by articles. return value type: connectapi.topicpage gettopics(communityid, recordid) get the first page of topics assigned to a record or feed item. api version 29.0 available to guest users 32.0 requires chatter no signature public static connectapi.topicpage gettopics(string communityid, string recordid) parameters communityid type: string 1485apex reference guide topics class id for an experience cloud site, internal, or null. recordid type: string id for a record or feed item. return value type: connectapi.topicpage usage administrators must enable topics for objects before users can add topics to records of that object type. gettopics(communityid) get the first page of topics for the org or experience cloud site. api version 29.0 available to guest users 32.0 requires chatter no signature public static connectapi.topicpage gettopics(string communityid) parameters communityid type: string id for an experience cloud site, internal, or null. return value type: connectapi.topicpage gettopics(communityid, sortparam) get the first page of sorted topics for the org or community. api version 29.0 1486apex reference guide topics class available to guest users 32.0 requires chatter no signature public static connectapi.topicpage gettopics(string communityid, connectapi.topicsort sortparam) parameters communityid type: string id for an experience cloud site, internal, or null. sortparam type: connectapi.topicsort values are: • populardesc—sorts topics by popularity with the most popular first. this value is the default. • alphaasc—sorts topics alphabetically. return value type: connectapi.topicpage gettopics(communityid, pageparam, pagesize) get a page of topics. api version 29.0 available to guest users 32.0 requires chatter no signature public static connectapi.topicpage get" "topics(string communityid, integer pageparam, integer pagesize) 1487apex reference guide topics class parameters communityid type: string id for an experience cloud site, internal, or null. pageparam type: integer number of the page you want returned. starts at 0. if you pass in null or 0, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. return value type: connectapi.topicpage gettopics(communityid, pageparam, pagesize, sortparam) get a page of sorted topics. api version 29.0 available to guest users 32.0 requires chatter no signature public static connectapi.topicpage gettopics(string communityid, integer pageparam, integer pagesize, connectapi.topicsort sortparam) parameters communityid type: string id for an experience cloud site, internal, or null. pageparam type: integer number of the page you want returned. starts at 0. if you pass in null or 0, the first page is returned. pagesize type: integer 1488apex reference guide topics class specifies the number of items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.topicsort values are: • populardesc—sorts topics by popularity with the most popular first. this value is the default. • alphaasc—sorts topics alphabetically. return value type: connectapi.topicpage gettopics(communityid, q, sortparam) get the sorted topics that match the search criteria. api version 29.0 available to guest users 32.0 requires chatter no signature public static connectapi.topicpage gettopics(string communityid, string q, connectapi.topicsort sortparam) parameters communityid type: string id for an experience cloud site, internal, or null. q type: string specifies the string to search. the string must contain at least two characters, not including wildcards. sortparam type: connectapi.topicsort values are: • populardesc—sorts topics by popularity with the most popular first. this value is the default. • alphaasc—sorts topics alphabetically. 1489apex reference guide topics class return value type: connectapi.topicpage gettopics(communityid, q, pageparam, pagesize) get a page of topics that match the search criteria. api version 29.0 available to guest users 32.0 requires chatter no signature public static connectapi.topicpage gettopics(string communityid, string q, integer pageparam, integer pagesize) parameters communityid type: string id for an experience cloud site, internal, or null. q type: string specifies the string to search. the string must contain at least two characters, not including wildcards. pageparam type: integer number of the page you want returned. starts at 0. if you pass in null or 0, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. return value type: connectapi.topicpage gettopics(communityid, q, pageparam, pagesize, sortparam) get a page of sorted topics that match the search criteria. 1490apex reference guide topics class api version 29.0 available to guest users 32.0 requires chatter no signature public static connectapi.topicpage gettopics(string communityid, string q, integer pageparam, integer pagesize, connectapi.topicsort sortparam) parameters communityid type: string id for an experience cloud site, internal, or null. q type: string specifies the string to search. the string must contain at least two characters, not including wildcards. pageparam type: integer number of the page you want returned. starts at 0. if you pass in null or 0, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. sortparam type: connectapi.topicsort values" "are: • populardesc—sorts topics by popularity with the most popular first. this value is the default. • alphaasc—sorts topics alphabetically. return value type: connectapi.topicpage gettopics(communityid, q, exactmatch) get the topic that matches the exact, case-insensitive name. 1491apex reference guide topics class api version 33.0 available to guest users 33.0 requires chatter no signature public static connectapi.topicpage gettopics(string communityid, string q, boolean exactmatch) parameters communityid type: string id for an experience cloud site, internal, or null. q type: string specifies the string to search. the string must contain at least two characters, not including wildcards. exactmatch type: boolean specify true to find a topic by its exact, case-insensitive name. return value type: connectapi.topicpage gettopicsorfallbacktorenamedtopics(communityid, q, exactmatch, fallbacktorenamedtopics) get the most recent renamed topic match, if there isn’t an exact match. api version 35.0 available to guest users 35.0 requires chatter no 1492apex reference guide topics class signature public static connectapi.topicpage gettopicsorfallbacktorenamedtopics(string communityid, string q, boolean exactmatch, boolean fallbacktorenamedtopics) parameters communityid type: string id for an experience cloud site, internal, or null. q type: string specifies the string to search. the string must contain at least two characters, not including wildcards. exactmatch type: boolean specify true to find a topic by its exact, case-insensitive name or to find the most recent renamed topic match if there isn’t an exact match. fallbacktorenamedtopics type: boolean specify true and if there isn’t an exact match, the most recent renamed topic match is returned. if there are multiple renamed topic matches, only the most recent is returned. if there are no renamed topic matches, an empty collection is returned. return value type: connectapi.topicpage gettopicsuggestions(communityid, recordid, maxresults) get up to a specified number of suggested topics for a record or feed item. api version 29.0 requires chatter no signature public static connectapi.topicsuggestionpage gettopicsuggestions(string communityid, string recordid, integer maxresults) parameters communityid type: string id for an experience cloud site, internal, or null. 1493apex reference guide topics class recordid type: string id for a record or feed item. maxresults type: integer maximum number of topic suggestions that get returned. the default is 5. value must be greater than 0 and less than or equal to 25. return value type: connectapi.topicsuggestionpage usage administrators must enable topics for objects before users can see suggested topics for records of that object type. to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestgettopicsuggestions(communityid, recordid, maxresults, result) apex developer guide: testing connectapi code gettopicsuggestions(communityid, recordid) get suggested topics for a record or feed item. api version 29.0 requires chatter no signature public static connectapi.topicsuggestionpage gettopicsuggestions(string communityid, string recordid) parameters communityid type: string id for an experience cloud site, internal, or null. recordid type: string id for a record or feed item. 1494apex reference guide topics class return value type: connectapi.topicsuggestionpage usage administrators must enable topics for objects before users can see suggested topics for records of that object type. to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestgettopicsuggestions(communityid, recordid, result) apex developer guide: testing connectapi code gettopicsuggestionsfortext(communityid, text, maxresults)" "get up to a specified number of suggested topics for a string of text. api version 29.0 requires chatter no signature public static connectapi.topicsuggestionpage gettopicsuggestionsfortext(string communityid, string text, integer maxresults) parameters communityid type: string id for an experience cloud site, internal, or null. text type: string string of text. maxresults type: integer maximum number of topic suggestions that get returned. the default is 5. value must be greater than 0 and less than or equal to 25. return value type: connectapi.topicsuggestionpage 1495apex reference guide topics class usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestgettopicsuggestionsfortext(communityid, text, maxresults, result) apex developer guide: testing connectapi code gettopicsuggestionsfortext(communityid, text) get suggested topics for a string of text. api version 29.0 requires chatter no signature public static connectapi.topicsuggestionpage gettopicsuggestionsfortext(string communityid, string text) parameters communityid type: string id for an experience cloud site, internal, or null. text type: string string of text. return value type: connectapi.topicsuggestionpage usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestgettopicsuggestionsfortext(communityid, text, result) apex developer guide: testing connectapi code 1496apex reference guide topics class gettrendingtopics(communityid) get trending topics for the org or experience cloud site. api version 29.0 available to guest users 32.0 requires chatter no signature public static connectapi.topicpage gettrendingtopics(string communityid) parameters communityid type: string id for an experience cloud site, internal, or null. return value type: connectapi.topicpage usage the more frequently people add a specific topic to their posts and comments and comment on or like posts with the same topic over a short period, the more likely it is to become a trending topic. for example, if your coworkers are attending the upcoming dreamforce conference and have started discussing it in chatter, you might see a trending topic for dreamforce. a trending topic is not solely based on popularity and usually relates to a one-time or infrequent event that has a spike in activity, such as a conference or a project deadline. to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestgettrendingtopics(communityid, result) apex developer guide: testing connectapi code gettrendingtopics(communityid, maxresults) get up to a specified number of trending topics for the org or experience cloud site. api version 29.0 1497apex reference guide topics class available to guest users 32.0 requires chatter no signature public static connectapi.topicpage gettrendingtopics(string communityid, integer maxresults) parameters communityid type: string id for an experience cloud site, internal, or null. maxresults type: integer maximum number of topic suggestions that get returned. the default is 5. value must be greater than 0 and less than or equal to 25. return value type: connectapi.topicpage usage the more frequently people add a specific topic to their posts and comments and comment on or like posts with the same topic over a short period, the more likely it is to become a trending topic. for example, if your coworkers are attending the upcoming dreamforce conference and have started discussing it in chatter, you might see a trending topic for dreamforce. a trending topic is not solely based on popularity and usually relates to a one-time or infrequent event that has a spike in activity, such as a conference or a project deadline. to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see" "also: settestgettrendingtopics(communityid, maxresults, result) apex developer guide: testing connectapi code mergetopics(communityid, topicid, idstomerge) merge up to five secondary topics with a primary topic. api version 33.0 1498apex reference guide topics class requires chatter no signature public static connectapi.topic mergetopics(string communityid, string topicid, list idstomerge) parameters communityid type: string id for an experience cloud site, internal, or null. topicid type: string the id for the primary topic for the merge. if this topic is a managed topic, it retains its topic type, topic images, and children topics. idstomerge type: list a list of up to five comma-separated secondary topic ids to merge with the primary topic. if any of the secondary topics are navigational or featured topics, they lose their topic type, topic images, and children topics. their feed items are reassigned to the primary topic. if you merge a topic with a content topic, the content associations are preserved. if you merge a topic with an inactive endorsee, the endorsement isn’t mapped to the primary topic. return value type: connectapi.topic usage only users with the delete topics or modify all data permission can merge topics. reassigntopicdatacategoryrules(communityid, datacategorygroup, datacategory, topicnames) reassign topic and article assignment rules by data category by deleting the existing rules and creating new rules. api version 40.0 requires chatter no signature public static connectapi.topicpage reassigntopicdatacategoryrules(string communityid, string datacategorygroup, string datacategory, connectapi.topicnamesinput topicnames) 1499apex reference guide topics class parameters communityid type: string id for an experience cloud site, internal, or null. datacategorygroup type: string the data category group used by articles. datacategory type: string the data category used by articles. topicnames type: connectapi.topicnamesinput a connectapi.topicnamesinput object with the names of topics to reassign to articles in a data category. return value type: connectapi.topicpage reassigntopicsbyname(communityid, recordid, topicnames) reassign all the topics on a record or feed item, that is, remove all the assigned topics on a record or feed item and add topics. optionally, provide a list of suggested topics to assign to a record or feed item to improve future topic suggestions. api version 35.0 requires chatter no signature public static connectapi.topicpage reassigntopicsbyname(string communityid, string recordid, connectapi.topicnamesinput topicnames) parameters communityid type: string id for an experience cloud site, internal, or null. recordid type: string the id of the record or feed item to which to assign the topic. topicnames type: connectapi.topicnamesinput 1500apex reference guide topics class a list of topics to replace the currently assigned topics. optionally, a list of suggested topics to assign to improve future topic suggestions. return value type: connectapi.topicpage usage only users with the assign topics permission can remove topics from records or feed items and add existing topics to records or feed items. only users with the create topics permission can add new topics to records or feed items. administrators must enable topics for objects before users can add topics to records of that object type. unassigntopic(communityid, recordid, topicid) remove a topic from a record or feed item. api version 29.0 requires chatter no signature public static void unassigntopic(string communityid, string recordid, string topicid) parameters communityid type: string id for an experience cloud site, internal, or null. recordid type: string id for a record or feed item. topicid type: string id for a topic. return value type: void usage only users with the assign topics permission can remove topics from feed items or records. administrators must enable topics for objects before users can add topics to records of that object type. 1501apex reference guide topics class updatetopic(communityid, topicid, topic) update the description or name of a topic or merge" "up to five secondary topics with a primary topic. api version 29.0 requires chatter no signature public static connectapi.topic updatetopic(string communityid, string topicid, connectapi.topicinput topic) parameters communityid type: string id for an experience cloud site, internal, or null. topicid type: string id for a topic. topic type: connectapi.topicinput a connectapi.topicinput object containing the name and description of the topic or up to five comma-separated secondary topic ids to merge with the primary topic. return value type: connectapi.topic usage only users with the edit topics or modify all data permission can update topic names and descriptions. only users with the delete topics or modify all data permission can merge topics. updatetopicsforarticlesindatacategory(communityid, datacategorygroup, datacategory, articletopicassignmentjob) assign topics to articles and unassign topics from articles in a data category. api version 40.0 1502apex reference guide topics class requires chatter no signature public static connectapi.topicpage updatetopicsforarticlesindatacategory(string communityid, string datacategorygroup, string datacategory, connectapi.articletopicassignmentjobinput articletopicassignmentjob) parameters communityid type: string id for an experience cloud site, internal, or null. datacategorygroup type: string the data category group used by articles. datacategory type: string the data category used by articles. articletopicassignmentjob type: connectapi.articletopicassignmentjobinput a connectapi.articletopicassignmentjobinput object that indicates the operation to take on which topics. return value type: connectapi.topicpage topics test methods the following are the test methods for topics. all methods are static. for information about using these methods to test your connectapi code, see testing connectapi code. settestgetgroupsrecentlytalkingabouttopic(communityid, topicid, result) register a connectapi.chattergroupsummarypage object to be returned when the matching connectapi.getgroupsrecentlytalkingabouttopic method is called in a test context. use the method with the same parameters or you receive an exception. api version 29.0 signature public static void settestgetgroupsrecentlytalkingabouttopic(string communityid, string topicid, connectapi.chattergroupsummarypage result) 1503apex reference guide topics class parameters communityid type: string id for an experience cloud site, internal, or null. topicid type: string id for a topic. result type: connectapi.chattergroupsummarypage object containing test data. return value type: void see also: getgroupsrecentlytalkingabouttopic(communityid, topicid) apex developer guide: testing connectapi code settestgetrecentlytalkingabouttopicsforgroup(communityid, groupid, result) register a connectapi.topicpage object to be returned when the matching connectapi.getrecentlytalkingabouttopicsforgroup method is called in a test context. use the method with the same parameters or you receive an exception. api version 29.0 signature public static void settestgetrecentlytalkingabouttopicsforgroup(string communityid, string groupid, connectapi.topicpage result) parameters communityid type: string id for an experience cloud site, internal, or null. groupid type: string id for a group. result type: connectapi.topicpage object containing test data. 1504apex reference guide topics class return value type: void see also: getrecentlytalkingabouttopicsforgroup(communityid, groupid) apex developer guide: testing connectapi code settestgetrecentlytalkingabouttopicsforuser(communityid, userid, result) register a connectapi.topicpage object to be returned when the matching connectapi.getrecentlytalkingabouttopicsforuser method is called in a test context. use the method with the same parameters or you receive an exception. api version 29.0 signature public static void settestgetrecentlytalkingabouttopicsforuser(string communityid, string userid, connectapi.topicpage result) parameters communityid type: string id for an experience cloud site, internal, or null. userid type: string id for a user." "result type: connectapi.topicpage specify the test topics page. return value type: void see also: getrecentlytalkingabouttopicsforuser(communityid, userid) apex developer guide: testing connectapi code settestgetrelatedtopics(communityid, topicid, result) register a connectapi.topicpage object to be returned when the matching connectapi.getrelatedtopics method is called in a test context. use the method with the same parameters or you receive an exception. 1505apex reference guide topics class api version 29.0 signature public static void settestgetrelatedtopics(string communityid, string topicid, connectapi.topicpage result) parameters communityid type: string id for an experience cloud site, internal, or null. topicid type: string id for a topic. result type: connectapi.topicpage object containing test data. return value type: void see also: getrelatedtopics(communityid, topicid) apex developer guide: testing connectapi code settestgettopicsuggestions(communityid, recordid, maxresults, result) register a connectapi.topicsuggestionpage object to be returned when the matching connectapi.gettopicsuggestions method is called in a test context. use the method with the same parameters or you receive an exception. api version 29.0 signature public static void settestgettopicsuggestions(string communityid, string recordid, integer maxresults, connectapi.topicsuggestionpage result) parameters communityid type: string 1506apex reference guide topics class id for an experience cloud site, internal, or null. recordid type: string id for a record or feed item. maxresults type: integer maximum number of topic suggestions that get returned. the default is 5. value must be greater than 0 and less than or equal to 25. result type: connectapi.topicsuggestionpage specify the test topic suggestions page. return value type: void see also: gettopicsuggestions(communityid, recordid, maxresults) apex developer guide: testing connectapi code settestgettopicsuggestions(communityid, recordid, result) register a connectapi.topicsuggestionpage object to be returned when the matching connectapi.gettopicsuggestions method is called in a test context. use the method with the same parameters or you receive an exception. api version 29.0 signature public static void settestgettopicsuggestions(string communityid, string recordid, connectapi.topicsuggestionpage result) parameters communityid type: string id for an experience cloud site, internal, or null. recordid type: string id for a record or feed item. result type: connectapi.topicsuggestionpage 1507apex reference guide topics class object containing test data. return value type: void see also: gettopicsuggestions(communityid, recordid) apex developer guide: testing connectapi code settestgettopicsuggestionsfortext(communityid, text, maxresults, result) register a connectapi.topicsuggestionpage object to be returned when the matching connectapi.gettopicsuggestionsfortext method is called in a test context.use the method with the same parameters or you receive an exception. api version 29.0 signature public static void settestgettopicsuggestionsfortext(string communityid, string text, integer maxresults, connectapi.topicsuggestionpage result) parameters communityid type: string id for an experience cloud site, internal, or null. text type: string string of text. maxresults type: integer maximum number of topic suggestions that get returned. the default is 5. value must be greater than 0 and less than or equal to 25. result type: connectapi.topicsuggestionpage object containing test data. 1508apex reference guide topics class return value type: void see also: gettopicsuggestionsfortext(communityid, text, maxresults) apex developer guide: testing connectapi code settestgettopicsuggestionsfortext(communityid, text, result) register a connectapi.topicsuggestionpage object to be returned when the matching connectapi.gettopicsuggestionsfortext method is called in a test context.use the method with the same parameters or" "you receive an exception. api version 29.0 signature public static void settestgettopicsuggestionsfortext(string communityid, string text, connectapi.topicsuggestionpage result) parameters communityid type: string id for an experience cloud site, internal, or null. text type: string string of text. result type: connectapi.topicsuggestionpage object containing test data. return value type: void see also: gettopicsuggestionsfortext(communityid, text) apex developer guide: testing connectapi code settestgettrendingtopics(communityid, result) register a connectapi.topicpage object to be returned when the matching connectapi.gettrendingtopics method is called in a test context. use the method with the same parameters or you receive an exception. 1509apex reference guide topics class api version 29.0 signature public static void settestgettrendingtopics(string communityid, connectapi.topicpage result) parameters communityid type: string id for an experience cloud site, internal, or null. result type: connectapi.topicpage object containing test data. return value type: void see also: gettrendingtopics(communityid) apex developer guide: testing connectapi code settestgettrendingtopics(communityid, maxresults, result) register a connectapi.topicpage object to be returned when the matching connectapi.gettrendingtopics method is called in a test context. use the method with the same parameters or you receive an exception. api version 29.0 signature public static void settestgettrendingtopics(string communityid, integer maxresults, connectapi.topicpage result) parameters communityid type: string id for an experience cloud site, internal, or null. maxresults type: integer 1510apex reference guide userprofiles class maximum number of topic suggestions that get returned. the default is 5. value must be greater than 0 and less than or equal to 25. result type: connectapi.topicpage object containing test data. return value type: void see also: gettrendingtopics(communityid, maxresults) apex developer guide: testing connectapi code userprofiles class access user profile data. the user profile data populates the profile page (also called the chatter profile page). this data includes user information (such as address, manager, and phone number), some user capabilities (permissions), and a set of subtab apps, which are custom tabs on the profile page. namespace connectapi userprofiles methods the following are methods for userprofiles. all methods are static. in this section: deletebannerphoto(communityid, userid) delete a user’s banner photo. deletephoto(communityid, userid) delete a user’s photo. getbannerphoto(communityid, userid) get a user’s banner photo. getphoto(communityid, userid) get a user’s photo. getuserprofile(communityid, userid) get the user profile of the context user. setbannerphoto(communityid, userid, fileid, versionnumber) set an uploaded file as a user’s banner photo. setbannerphoto(communityid, userid, fileupload) set a file that hasn’t been uploaded as a user’s banner photo. 1511apex reference guide userprofiles class setbannerphotowithattributes(communityid, userid, bannerphoto) set and crop an uploaded file as a user’s banner photo. setbannerphotowithattributes(communityid, userid, bannerphoto, fileupload) set and crop a file that hasn’t been uploaded as a user’s banner photo. setphoto(communityid, userid, fileid, versionnumber) set an uploaded file as a user’s photo. setphoto(communityid, userid, fileupload) set a file that hasn’t been uploaded as a user’s photo. setphotowithattributes(communityid, userid, photo) set and crop an uploaded file as a user’s photo. setphotowithattributes(communityid, userid, photo, fileupload) set and crop a file that hasn’t been uploaded as a user’s photo. deletebannerphoto(communityid, userid" ") delete a user’s banner photo. api version 36.0 requires chatter no signature public static void deletebannerphoto(string communityid, string userid) parameters communityid type: string id for an experience cloud site, internal, or null. userid type: string id of the user. return value type: void deletephoto(communityid, userid) delete a user’s photo. 1512apex reference guide userprofiles class api version 35.0 requires chatter no signature public static void deletephoto(string communityid, string userid) parameters communityid type: string id for an experience cloud site, internal, or null. userid type: string id for the context user or the keyword me. return value type: void getbannerphoto(communityid, userid) get a user’s banner photo. api version 36.0 requires chatter no signature public static connectapi.bannerphoto getbannerphoto(string communityid, string userid) parameters communityid type: string id for an experience cloud site, internal, or null. userid type: string id of the user. 1513apex reference guide userprofiles class return value type: connectapi.bannerphoto getphoto(communityid, userid) get a user’s photo. api version 35.0 available to guest users 35.0 requires chatter no signature public static connectapi.photo getphoto(string communityid, string userid) parameters communityid type: string id for an experience cloud site, internal, or null. userid type: string id for a user. return value type: connectapi.photo getuserprofile(communityid, userid) get the user profile of the context user. api version 29.0 requires chatter yes 1514apex reference guide userprofiles class signature public static connectapi.userprofile getuserprofile(string communityid, string userid) parameters communityid type: string id for an experience cloud site, internal, or null. userid type: string id for a user. return value type: connectapi.userprofile setbannerphoto(communityid, userid, fileid, versionnumber) set an uploaded file as a user’s banner photo. api version 36.0 requires chatter no signature public static connectapi.bannerphoto setbannerphoto(string communityid, string userid, string fileid, integer versionnumber) parameters communityid type: string id for an experience cloud site, internal, or null. userid type: string id of the user. fileid type: string id of the uploaded file to use as the user banner. the key prefix must be 069, and the image must be smaller than 8 mb. versionnumber type: integer 1515apex reference guide userprofiles class version number of the file. specify an existing version number or, to get the latest version, specify null. return value type: connectapi.bannerphoto usage photos are processed asynchronously and might not be visible right away. setbannerphoto(communityid, userid, fileupload) set a file that hasn’t been uploaded as a user’s banner photo. api version 36.0 requires chatter no signature public static connectapi.bannerphoto setbannerphoto(string communityid, string userid, connectapi.binaryinput fileupload) parameters communityid type: string id for an experience cloud site, internal, or null. userid type: string id of the user. fileupload type: connectapi.binaryinput file to use as the photo. the content type must be usable as an image. return value type: connectapi.bannerphoto usage photos are processed asynchronously and might not be visible right away. 1516apex reference guide userprofiles class setbannerphotowithattributes(communityid, userid, bannerphoto) set and crop an uploaded file as a user’s banner photo. api version 36.0 requires chatter no signature public static connectapi.bannerphoto setbannerphotowithattributes(string community" "id, string userid, connectapi.bannerphotoinput bannerphoto) parameters communityid type: string id for an experience cloud site, internal, or null. userid type: string id of the user. bannerphoto type: connectapi.bannerphotoinput a connectapi.bannerphotoinput object that specifies the id and version of the file, and how to crop the file. return value type: connectapi.bannerphoto usage photos are processed asynchronously and might not be visible right away. setbannerphotowithattributes(communityid, userid, bannerphoto, fileupload) set and crop a file that hasn’t been uploaded as a user’s banner photo. api version 36.0 requires chatter no 1517apex reference guide userprofiles class signature public static connectapi.bannerphoto setbannerphotowithattributes(string communityid, string userid, connectapi.bannerphotoinput bannerphoto, connectapi.binaryinput fileupload) parameters communityid type: string id for an experience cloud site, internal, or null. userid type: string id of the user. bannerphoto type: connectapi.bannerphotoinput a connectapi.bannerphotoinput object specifying the cropping parameters. fileupload type: connectapi.binaryinput file to use as the photo. the content type must be usable as an image. return value type: connectapi.bannerphoto usage photos are processed asynchronously and might not be visible right away. setphoto(communityid, userid, fileid, versionnumber) set an uploaded file as a user’s photo. api version 35.0 requires chatter no signature public static connectapi.photo setphoto(string communityid, string userid, string fileid, integer versionnumber) 1518apex reference guide userprofiles class parameters communityid type: string id for an experience cloud site, internal, or null. userid type: string id for the context user or the keyword me. fileid type: string id of an uploaded file. the file must be an image, and be smaller than 2 gb. versionnumber type: integer version number of the existing file. specify either an existing version number, or null to get the latest version. return value type: connectapi.photo usage photos are processed asynchronously and might not be visible right away. setphoto(communityid, userid, fileupload) set a file that hasn’t been uploaded as a user’s photo. api version 35.0 requires chatter no signature public static connectapi.photo setphoto(string communityid, string userid, connectapi.binaryinput fileupload) parameters communityid type: string id for an experience cloud site, internal, or null. userid type: string 1519apex reference guide userprofiles class id for the context user or the keyword me. fileupload type: connectapi.binaryinput file to use as the photo. the content type must be usable as an image. return value type: connectapi.photo usage photos are processed asynchronously and might not be visible right away. setphotowithattributes(communityid, userid, photo) set and crop an uploaded file as a user’s photo. api version 35.0 requires chatter no signature public static connectapi.photo setphotowithattributes(string communityid, string userid, connectapi.photoinput photo) parameters communityid type: string id for an experience cloud site, internal, or null. userid type: string id for the context user or the keyword me. photo type: connectapi.photoinput a connectapi.photoinput object specifying the file id, version number, and cropping parameters. return value type: connectapi.photo 1520apex reference guide zones class usage photos are processed asynchronously and might not be visible right away. setphotowithattributes(communityid, userid, photo, fileupload) set and crop a file that hasn’t been uploaded as a user’s photo. api version 35.0 requires chatter no signature public static connectapi.photo setphotowithattributes(string" "communityid, string userid, connectapi.photoinput photo, connectapi.binaryinput fileupload) parameters communityid type: string id for an experience cloud site, internal, or null. userid type: string id for the context user or the keyword me. photo type: connectapi.photoinput a connectapi.photoinput object specifying the cropping parameters. fileupload type: connectapi.binaryinput file to use as the photo. the content type must be usable as an image. return value type: connectapi.photo usage photos are processed asynchronously and might not be visible right away. zones class access information about chatter answers zones in your organization. zones organize questions into logical groups, with each zone having its own focus and unique questions. 1521apex reference guide zones class note: with the spring ’18 release, salesforce no longer supports chatter answers. users of chatter answers can post, answer, comment, or view existing chatter answers data, but support and updates are scheduled to end. we recommend transitioning to chatter questions. for more information, see end of support for chatter answers in spring ’18. namespace connectapi zones methods the following are methods for zones. all methods are static. in this section: getzone(communityid, zoneid) get a zone. getzones(communityid) get a list of zones. getzones(communityid, pageparam, pagesize) get a page of zones. searchinzone(communityid, zoneid, q, filter) search articles or questions in a zone. searchinzone(communityid, zoneid, q, filter, pageparam, pagesize) search a page of articles or questions in a zone. searchinzone(communityid, zoneid, q, filter, language) search articles or questions in a zone, and specify the language of the results. getzone(communityid, zoneid) get a zone. note: with the spring ’18 release, salesforce no longer supports chatter answers. users of chatter answers can post, answer, comment, or view existing chatter answers data, but support and updates are scheduled to end. we recommend transitioning to chatter questions. for more information, see end of support for chatter answers in spring ’18. api version 29.0 requires chatter no signature public static connectapi.zone getzone(string communityid, string zoneid) 1522apex reference guide zones class parameters communityid type: string id for an experience cloud site, internal, or null. zoneid type: string the id of a zone. return value type: connectapi.zone getzones(communityid) get a list of zones. note: with the spring ’18 release, salesforce no longer supports chatter answers. users of chatter answers can post, answer, comment, or view existing chatter answers data, but support and updates are scheduled to end. we recommend transitioning to chatter questions. for more information, see end of support for chatter answers in spring ’18. api version 29.0 requires chatter no signature public static connectapi.zonepage getzones(string communityid) parameters communityid type: string id for an experience cloud site, internal, or null. return value type: connectapi.zonepage getzones(communityid, pageparam, pagesize) get a page of zones. note: with the spring ’18 release, salesforce no longer supports chatter answers. users of chatter answers can post, answer, comment, or view existing chatter answers data, but support and updates are scheduled to end. we recommend transitioning to chatter questions. for more information, see end of support for chatter answers in spring ’18. 1523apex reference guide zones class api version 29.0 requires chatter no signature public static connectapi.zone getzones(string communityid, integer pageparam, integer pagesize) parameters communityid type: string id for an experience cloud site, internal, or null. pageparam type: integer number of the page you want returned. starts at 0. if you pass in null or 0, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 through 100. if" "you pass in null, the default size is 25. return value type: connectapi.zonepage searchinzone(communityid, zoneid, q, filter) search articles or questions in a zone. note: with the spring ’18 release, salesforce no longer supports chatter answers. users of chatter answers can post, answer, comment, or view existing chatter answers data, but support and updates are scheduled to end. we recommend transitioning to chatter questions. for more information, see end of support for chatter answers in spring ’18. api version 29.0 available to guest users 37.0 requires chatter no 1524apex reference guide zones class signature public static connectapi.zonesearchpage searchinzone(string communityid, string zoneid, string q, connectapi.zonesearchresulttype filter) parameters communityid type: string id for an experience cloud site, internal, or null. zoneid type: string id of a zone. q type: string specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. filter type: connectapi.zonesearchresulttype a zonesearchresulttype enum value. one of the following: • article—search results contain only articles. • question—search results contain only questions. return value type: connectapi.zonesearchpage usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestsearchinzone(communityid, zoneid, q, filter, result) apex developer guide: testing connectapi code searchinzone(communityid, zoneid, q, filter, pageparam, pagesize) search a page of articles or questions in a zone. note: with the spring ’18 release, salesforce no longer supports chatter answers. users of chatter answers can post, answer, comment, or view existing chatter answers data, but support and updates are scheduled to end. we recommend transitioning to chatter questions. for more information, see end of support for chatter answers in spring ’18. api version 29.0 1525apex reference guide zones class available to guest users 37.0 requires chatter no signature public static connectapi.zonesearchpage searchinzone(string communityid, string zoneid, string q, connectapi.zonesearchresulttype filter, string pageparam, integer pagesize) parameters communityid type: string id for an experience cloud site, internal, or null. zoneid type: string id of a zone. q type: string specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. filter type: connectapi.zonesearchresulttype a zonesearchresulttype enum value. one of the following: • article—search results contain only articles. • question—search results contain only questions. pageparam type: string specifies the page token to use to view a page of information. page tokens are returned as part of the response class, such as currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. return value type: connectapi.zonesearchpage 1526apex reference guide zones class usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestsearchinzone(communityid, zoneid, q, filter, pageparam, pagesize, result) apex developer guide: testing connectapi code searchinzone(communityid, zoneid, q, filter, language) search articles or questions in a zone, and specify the language of the results. note: with the spring ’18 release, salesforce no longer supports chatter answers. users of chatter answers can post, answer, comment, or view existing chatter answers data, but support and updates are scheduled to end. we recommend transitioning to chatter questions. for more information, see end of support for chatter answers in spring ’18. api version 36.0" "available to guest users 37.0 requires chatter no signature public static connectapi.zonesearchpage searchinzone(string communityid, string zoneid, string q, connectapi.zonesearchresulttype filter, string language) parameters communityid type: string id for an experience cloud site, internal, or null. zoneid type: string id of a zone. q type: string specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. filter type: connectapi.zonesearchresulttype • article—search results contain only articles. 1527apex reference guide zones class • question—search results contain only questions. language type: string the language of the articles or questions. the value must be a salesforce supported locale code. return value type: connectapi.zonesearchpage usage to test code that uses this method, use the matching set test method (prefix the method name with settest). use the set test method with the same parameters or the code throws an exception. see also: settestsearchinzone(communityid, zoneid, q, filter, language, result) zones test methods the following are the test methods for zones. all methods are static. for information about using these methods to test your connectapi code, see testing connectapi code. settestsearchinzone(communityid, zoneid, q, filter, result) register a connectapi.zonesearchpage object to be returned when searchinzone(communityid, zoneid, q, filter) is called in a test context. use the method with the same parameters or you receive an exception. note: with the spring ’18 release, salesforce no longer supports chatter answers. users of chatter answers can post, answer, comment, or view existing chatter answers data, but support and updates are scheduled to end. we recommend transitioning to chatter questions. for more information, see end of support for chatter answers in spring ’18. api version 29.0 signature public static void settestsearchinzone(string communityid, string zoneid, string q, connectapi.zonesearchresulttype filter, connectapi.zonesearchpage result) parameters communityid type: string use either the id for an experience cloud site, internal, or null. zoneid type: string the id of a zone. 1528apex reference guide zones class q type: string specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. filter type: connectapi.zonesearchresulttype a zonesearchresulttype enum value. one of the following: • article—search results contain only articles. • question—search results contain only questions. result type: connectapi.zonesearchpage the object containing test data. return value type: void see also: searchinzone(communityid, zoneid, q, filter) apex developer guide: testing connectapi code settestsearchinzone(communityid, zoneid, q, filter, pageparam, pagesize, result) register a connectapi.zonesearchpage object to be returned when searchinzone(communityid, zoneid, q, filter, pageparam, pagesize) is called in a test context. use the method with the same parameters or you receive an exception. note: with the spring ’18 release, salesforce no longer supports chatter answers. users of chatter answers can post, answer, comment, or view existing chatter answers data, but support and updates are scheduled to end. we recommend transitioning to chatter questions. for more information, see end of support for chatter answers in spring ’18. api version 29.0 signature public static void settestsearchinzone(string communityid, string zoneid, string q, connectapi.zonesearchresulttype filter, string pageparam, integer pagesize, connectapi.zonesearchpage result) parameters communityid type: string use either the id for an experience cloud site, internal, or null. 1529apex reference guide zones class zoneid type: string the id of a zone. q type: string specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. filter type: connectapi.zonesearchresulttype a zonesearchresulttype enum" "value. one of the following: • article—search results contain only articles. • question—search results contain only questions. pageparam type: string specifies the page token to be used to view a page of information. page tokens are returned as part of the response class, such as currentpagetoken or nextpagetoken. if you pass in null, the first page is returned. pagesize type: integer specifies the number of items per page. valid values are from 1 through 100. if you pass in null, the default size is 25. result type: connectapi.zonesearchpage the object containing test data. return value type: void see also: searchinzone(communityid, zoneid, q, filter, pageparam, pagesize) apex developer guide: testing connectapi code settestsearchinzone(communityid, zoneid, q, filter, language, result) register a connectapi.zonesearchpage object to be returned when searchinzone(communityid, zoneid, q, filter, language) is called in a test context. use the method with the same parameters or you receive an exception. note: with the spring ’18 release, salesforce no longer supports chatter answers. users of chatter answers can post, answer, comment, or view existing chatter answers data, but support and updates are scheduled to end. we recommend transitioning to chatter questions. for more information, see end of support for chatter answers in spring ’18. api version 36.0 1530apex reference guide connectapi input classes signature public static void settestsearchinzone(string communityid, string zoneid, string q, connectapi.zonesearchresulttype filter, string language, connectapi.zonesearchpage result) parameters communityid type: string use either the id for an experience cloud site, internal, or null. zoneid type: string the id of a zone. q type: string specifies the string to search. the search string must contain at least two characters, not including wildcards. see wildcards. filter type: connectapi.zonesearchresulttype • article—search results contain only articles. • question—search results contain only questions. language type: string the language of the articles or questions. the value must be a salesforce supported locale code. in an , the default value is the language of the page. otherwise, the default value is the user's locale. result type: connectapi.zonesearchpage the object containing test data. return value type: void see also: searchinzone(communityid, zoneid, q, filter, language) apex developer guide: testing connectapi code connectapi input classes some connectapi methods take arguments that are instances of connectapi input classes. input classes are concrete unless marked abstract in this documentation. concrete input classes have public constructors that have no parameters. some methods have parameters that are typed with an abstract class. you must pass in an instance of a concrete child class for these parameters. 1531apex reference guide connectapi input classes most input class properties can be set. read-only properties are noted in this documentation. connectapi.actionlinkdefinitioninput the definition of an action link. an action link is a button on a feed element. clicking an action link can take a user to a web page, initiate a file download, or invoke an api call to salesforce or to an external server. an action link includes a url and an http method, and can include a request body and header information, such as an oauth token for authentication. use action links to integrate salesforce and third-party services into the feed so that users can drive productivity and accelerate innovation. usage you can use context variables in the actionurl, headers, and requestbody properties. use context variables to pass information about the user who executed the action link to your server-side code. salesforce substitutes the value when the action link is executed. the available context variables are: context variable description {!actionlinkid} the id of the action link the user executed. {!actionlinkgroupid} the id of the action link group containing the action link the user executed. {!communityid} the id of the site in which the user executed the action link. the value for your internal org is the empty key ""000000000000000000"". {!communityurl} the url of the site in which the user executed the action link. the value for your internal org is empty string" """"". {!orgid} the id of the org in which the user executed the action link. {!userid} the id of the user that executed the action link. property type description required or available version optional actiontype connectapi. defines the type of action link. values are: required 33.0 actionlinktype • api—the action link calls a can be defined in an synchronous api at the action url. action link template. salesforce sets the status to successfulstatus or failedstatus based on the http status code returned by your server. • apiasync—the action link calls an asynchronous api at the action url. the action remains in a pendingstatus state until a third party makes a request to /connect/action-links/actionlinkid to set the status to 1532" "apex reference guide connectapi input classes property type description required or available version optional successfulstatus or failedstatus when the asynchronous operation is complete. • download—the action link downloads a file from the action url. • ui—the action link takes the user to a web page at the action url. use ui if you need to load a page before the user performs an action, for example, to have the user provide input or view something before the action happens. note: invoking apiasync action links from an app requires a call to set the status. however, there isn’t currently a way to set the status of an action link using apex. to set the status, use connect rest api. see the action link resource in the connect rest api developer guide for more information. actionurl string the action link url. for example, a ui required 33.0 action link url is a web page. a can be defined in an download action link url is a link to the action link template. file to download. ui and download action link urls are provided to clients. an api or apiasync action link url is a rest resource. api and apiasync action link urls aren’t provided to clients. links to salesforce can be relative. all other links must be absolute and start with https://. tip: to avoid issues due to upgrades or changing functionality in your api, we recommend using a versioned api for actionurl, for example, https://www.example.com/ api/v1/exampleresource. if your api isn’t versioned, you can use the expirationdate property of the connectapi.actionlinkgroup definitioninput class to 1533apex reference guide connectapi input classes property type description required or available version optional avoid issues due to upgrades or changing functionality in your api. excludeduserid string id of a single user to exclude from optional 33.0 performing the action. if you specify an can be defined in an excludeduserid, you can’t specify a action link template userid. using the user visibility and custom user alias fields. groupdefault boolean true if this action is the default action link optional 33.0 in the action link group; false otherwise. can be defined in an there can be only one default action link action link template. per action link group. the default action link gets distinct styling in the salesforce ui. headers list see action links overview, authentication, action link template. and security. labelkey string key for the set of labels to show in the user required 33.0 interface. a set includes labels for these can be defined in an states: newstatus, pendingstatus, action link template. successstatus, failedstatus. for example, if you use the approve key, you get these labels: approve, pending, approved, failed. for a complete list of keys and labels, see action links labels. if none of the predefined labels work for your action link, use a custom label. to use a custom label, create an action link template. see create action link templates. method connectapi. one of these http methods: required 33.0 httprequest • httpdelete—returns http 204 on can be defined in an method success. response body or output class action link template. is empty. • httpget—returns http 200 on success. • httphead—returns http 200 on success. response body or output class is empty. 1534apex reference guide connectapi input classes property type description required or available version optional • httppatch—returns http 200 on success or http 204 if the response body or output class is empty. • httppost—returns http 201 on success or http 204 if the response body or output class is empty. exceptions are the batch posting resources and methods, which return http 200 on success. • httpput—return http 200 on success or http 204 if the response body or output class is empty. requestbody string the request body for api action links. optional 33.0 can be defined in an note: escape quotation mark action link template. characters in the request" "body value. requires boolean true to require the user to confirm the required 33.0 confirmation action; false otherwise. can be defined in an action link template. userid string the id of the user who can execute the optional 33.0 action. if not specified or null, any user can be defined in an can execute the action. if you specify a action link template userid, you can’t specify an using the user excludeduserid. visibility and custom user alias fields. see also: connectapi.actionlinkgroupdefinitioninput connectapi.actionlinkgroupdefinitioninput the definition of an action link group. all action links must belong to a group. action links in a group are mutually exclusive and share some properties. define standalone actions in their own action group. action link definition can be sensitive to a third party (for example, oauth bearer token headers). for this reason, only calls made from the apex namespace that created the action link definition can read, modify, or delete the definition. in addition, the user making the call must have created the definition or have view all data permission. 1535apex reference guide connectapi input classes property type description required or available version optional actionlinks list action link group displayed in the order listed in the without a template. actionlinks property of the connectapi.actionlinkgroup to instantiate from a definitioninput class. within a feed template, don’t item, action link groups are displayed in the specify a value. order specified in the actionlinkgroupids property of the connectapi.associatedactions capabilityinput class. you can create up to three action links in a primary group and up to four in an overflow group. category connectapi. indicates the priority and relative locations required to 33.0 platformaction of action links in an associated feed item. instantiate this groupcategory values are: action link group without a template. • primary—the action link group is displayed in the body of the feed to instantiate from a element. template, don’t specify a value. • overflow—the action link group is displayed in the overflow menu of the feed element. executions connectapi. defines the number of times an action link required to 33.0 allowed actionlink can be executed. values are: instantiate this executionsallowed action link group • once—an action link can be executed without a template. only once across all users. to instantiate from a • onceperuser—an action link can template, don’t be executed only once for each user. specify a value. • unlimited—an action link can be executed an unlimited number of times by each user. if the action link’s actiontype is api or apiasync, you can’t use this value. expirationdate datetime iso 8601 date string, for example, required to 33.0 2011-02-25t18:24:31.000z, that represents instantiate this action link group without a template. 1536apex reference guide connectapi input classes property type description required or available version optional the date and time this action link group is optional to removed from associated feed items and instantiate from a can no longer be executed. the template. expirationdate must be within one year of the creation date. if the action link group definition includes an oauth token, it is a good idea to set the expiration date of the action link group to the same value as the expiration date of the oauth token so that users can’t execute the action link and get an oauth error. to set a date when instantiating from a template, see set the action link group expiration time in design action link templates. templatebindings list alias from an action link template. to don’t specify a value. instantiate this action link group from an required to action link template that uses binding instantiate this variables, you must provide values for all the action link group variables. see def" "ine binding variables in from a template that design action link templates. uses binding variables. templateid string the id of the action link group template to instantiate 33.0 from which to instantiate this action link without a template, group. don’t specify a value. required to instantiate this action link group from a template. see also: define an action link and post with a feed element define an action link in a template and post with a feed element createactionlinkgroupdefinition(communityid, actionlinkgroup) connectapi.actionlinktemplatebindinginput a key-value pair to fill in a binding variable value from an action link template. 1537apex reference guide connectapi input classes property type description required or available version optional key string the name of the binding variable key required 33.0 specified in the action link template in setup. for example, if the binding variable in the template is {!binding.firstname}, the key is firstname value string the value of the binding variable key. for required 33.0 example, if the key is firstname, this value could be joan. see also: connectapi.actionlinkgroupdefinitioninput connectapi.activitysharinginput defines who a captured email or event is shared with. property type description required or available version optional groupsto list list of ids for the groups that you share the optional 39.0 sharewith activity with. valid only if sharingtype is mygroups. sharingtype connectapi. type of sharing operation. values are: required 39.0 activity • everyone—the activity is shared sharingtype with everyone. • mygroups—the activity is shared only with a selection of the context user’s groups. • onlyme—the activity is private. connectapi.addressrequest address input representation for a payment method or card payment method. name type description required or available version optional city string payment method city. optional 51.0 companyname string payment method company name. optional 51.0 country string payment method country. optional 51.0 1538apex reference guide connectapi input classes name type description required or available version optional postalcode string payment method postal code. optional 51.0 state string payment method state. optional 51.0 street string payment method street. optional 51.0 connectapi.adjustiteminputrepresentation a price adjustment to an orderitemsummary. it only supports discounts, not increases. property type description required or available version optional adjustmenttype string describes how the amount is calculated. it required 49.0 can have one of these values: • amountwithtax—value of amount is the adjustment, including tax. • amountwithouttax—value of amount is the adjustment, not including tax. tax is calculated on the value and added. • percentage—value of amount is a percentage discount. it is divided by 100, and then multiplied by the totalprice and totaltaxamount of the orderitemsummary to determine the adjustment amount. amount double value used to calculate the adjustment required 49.0 amount, as described by the adjustmenttype. it must be a negative value. description string description of the adjustment. optional 49.0 orderitem string id of the orderitemsummary. required 49.0 summaryid reason string reason for the adjustment. the value must required 49.0 match one of the picklist values on the reason field of the orderitemsummarychange object. connectapi.adjustorderitemsummaryinputrepresentation price adjustments to orderitemsummaries that together make up a price adjustment to an order, with options for adjusting items in the process of being fulfilled. 1539apex reference guide connectapi input classes property type description required or available version optional adjustitems list allocateditems string process to use for orderitemsummary optional 55.0 changeordertype quantities that are currently being fulfilled, defined as quantityallocated - quantityfulfilled. values are: • disallowed—when distributing the adjustment, ignore any quantities being fulfilled. if an orderitemsummary’s entire quantity is being fulfilled, return an error. this is the default value. • infulfillment—when distributing the adjustment, include quantities being fulfilled. create a separate change order for the adjustments made" "to those quantities. • prefulfillment—when distributing the adjustment, include quantities being fulfilled. include the adjustments made to those quantities in the change order for pre-fulfillment quantity adjustments. connectapi.alternativeinput alternative representation for an extension on a feed element. property type description required or available version optional text string text representation of the extension. required 40.0 representation thumbnailurl string thumbnail url to the extension. optional 40.0 title string title of the extension. optional 40.0 connectapi.announcementinput an announcement. 1540apex reference guide connectapi input classes property type description required or available optional body connectapi.message text of the announcement. required for 31.0 bodyinput creating an announcement if feeditemid isn’t specified don’t specify for updating an announcement. expirationdate datetime the salesforce ui displays an announcement required for 31.0 until 11:59 p.m. on this date unless another creating an announcement is posted first. the salesforce announcement ui ignores the time value in the optional for expirationdate. however, you can use updating an the time value to create your own display announcement logic in your own ui. feeditemid string id of an advancedtextpost feed item required for 36.0 that is the body of the announcement. creating an announcement if body isn’t specified don’t specify for updating an announcement. isarchived boolean specifies whether the announcement is optional 36.0 archived. parentid string id of the parent entity for the announcement, required for 36.0 that is, a group id when the announcement creating an appears in a group. announcement if feeditemid isn’t specified don’t specify for updating an announcement. 1541apex reference guide connectapi input classes property type description required or available optional sendemails boolean specifies whether the announcement is sent optional for 36.0 as an email to all group members regardless creating an of their email setting for the group. if chatter announcement emails aren’t enabled for the organization, don’t specify for announcement emails aren’t sent. default updating an value is false. announcement see also: postannouncement(communityid, groupid, announcement) connectapi.articletopicassignmentjobinput an article and topic assignment job. property type description required or available version optional operation connectapi. type of operation to perform on articles and required 40.0 articletopicjobtype topics. values are: • assigntopicstoarticle—assign topics to articles in a data category. • unassigntopicsfromarticle—unassign topics from articles in a data category. topicnames connectapi. list of topic names to assign to or unassign required 40.0 topicnamesinput from articles. connectapi.associatedactionscapabilityinput a list of action link groups to associate with a feed element. to associate an action link group with a feed element, the call must be made from the apex namespace that created the action link definition. in addition, the user making the call must have created the definition or have view all data permission. an action link is a button on a feed element. clicking an action link can take a user to a web page, initiate a file download, or invoke an api call to salesforce or to an external server. an action link includes a url and an http method, and can include a request body and header information, such as an oauth token for authentication. use action links to integrate salesforce and third-party services into the feed so that users can drive productivity and accelerate innovation. 1542apex reference guide connectapi input classes property type description required or available version optional actionlink list the action link group ids to associate with required 33.0 groupids the feed element. associate one primary and up to 10 total action link groups to a feed item. action link groups are returned in the order specified in this property. an action link group id is returned from a call to connectapi.actionlinks. createactionlinkgroupdefinition (communityid, actionlinkgroup). see also: connectapi.feedelementcapabilitiesinput connectapi.associaterecordswithrecipientinput records associated" "with the survey invitation. property type description required or available version optional associaterecord list id of the associated records. required 50.0 ids recipientid string participant id with whose invitation the required 50.0 record should be associated. see also: connectapi.surveyinvitationemailinput connectapi.audiencecriteriainput custom recommendation audience criteria type. this class is abstract and has no public constructor. you can make an instance only of a subclass. superclass for: • connectapi.customlistaudiencecriteriainput • connectapi.newuseraudiencecriteriainput 1543apex reference guide connectapi input classes property type description required or available version optional type connectapi. specifies the custom recommendation optional 36.0 recommendation audience criteria type. one of these values: if not specified, audience • customlist—a custom list of users defaults to criteriatype makes up the audience. customlist. • maxdaysincommunity—new members make up the audience. see also: connectapi.recommendationaudienceinput connectapi.audiencecriterioninput personalization audience criterion. property type description required or available version optional criterion list optional when updating an audience criterionnumber integer number associated with the audience optional 48.0 criterion in a formula. for example, (1 and 2) or 3. if unspecified, criteria are assigned numbers in the order that they’re added. criterionoperator connectapi. operator used in the personalization required when 48.0 audiencecriteria audience criterion. values are: creating an audience operator • contains optional when updating an • equal audience • greaterthan • greaterthanorequal • includes • lessthan • lessthanorequal • notequal • notincludes • startswith 1544apex reference guide connectapi input classes property type description required or available version optional criteriontype connectapi. type of personalization audience criterion. required when 48.0 audiencecriteria values are: creating an audience type • audience—criterion based on optional when audience. updating an audience • default—audience has no criteria. • domain—criterion based on domain. • fieldbased—criterion based on object fields. • geolocation—criterion based on location. • permission—criterion based on standard or custom permissions. • profile—criterion based on profile. see also: connectapi.audienceinput connectapi.audiencecriterionvalueinput audience criterion value. property type description required or available version optional audienceid string id of an audience. required if creating 53.0 or updating an audience with the audience criterion type. city string city of a user. optional if creating 48.0 or updating an audience with the geolocation criterion type country string country of a user. required if creating 48.0 or updating an audience with the geolocation criterion type domainid string domain id of a user. required if creating 48.0 or updating an audience with the 1545apex reference guide connectapi input classes property type description required or available version optional domain criterion type entityfield string field of an object. required if creating 48.0 or updating an audience with the fieldbased criterion type entitytype string type of object. required if creating 48.0 or updating an audience with the fieldbased criterion type fieldvalue string value of a field. required if creating 48.0 or updating an audience with the fieldbased criterion type isenabled boolean specifies whether the permission is enabled required if creating 48.0 (true) or not (false) for a user. or updating an audience with the permission criterion type permission string valid api name of a standard user or custom required if creating 48.0 permission. or updating an audience with the permission criterion type profileid string profile id of a user. required if creating 48.0 or updating an audience with the profile criterion type 1546apex reference guide connectapi input classes property type description required" "or available version optional subdivision string subdivision of a user. required if creating 48.0 or updating an audience with the geolocation criterion type and using the city property see also: connectapi.audiencecriterioninput connectapi.audienceinput a personalization audience. property type description required or available version optional criteria list optional when updating an audience customformula string custom formula for the audience criteria. required when 48.0 for example, (1 and 2) or 3. creating an audience with the formulafiltertype set to customlogicmatches optional, otherwise formulafiltertype connectapi. formula filter type for the personalization required when 48.0 formulafiltertype audience. values are: creating an audience • allcriteriamatch—all audience optional when criteria are true (and operation). updating an audience • anycriterionmatches—any audience criterion is true (or operation). • customlogicmatches—audience criteria match the custom formula (for example, (1 and 2) or 3). 1547apex reference guide connectapi input classes property type description required or available version optional name string name of the audience. required when 48.0 creating an audience optional when updating an audience connectapi.auditparamsrequest audit parameters input. this class is abstract. superclass of connectapi.baserequest. property type description required or available version optional email string email of the client that made the request. optional 50.0 ipaddress string ip address of the client that made the optional 50.0 request. macaddress string mac address of the client that made the optional 50.0 request. phone string phone number of the client that made the optional 50.0 request. connectapi.authapipaymentmethodrequest payment method input representation for payment authorizations. subclass of connectapi.baseapipaymentmethodrequest. property type description required or available version optional card connectapi.card card payment method information. required 51.0 paymentmethod paymentmethodrequest connectapi.authorizationreversalrequest authorization reversal input consumed by authorization reversal service. subclass of connectapi.baserequest. 1548apex reference guide connectapi input classes property type description required or available version optional accountid string account for the payment authorization 51.0 reversal. must match the payment authorization's account. amount double amount of adjustment applied to the 51.0 payment authorization. comments string users can add comments to provide 51.0 additional details about a record. maximum of 1,000 characters. effectivedate datetime date that the adjustment takes effect on the 51.0 authorization. connectapi.authorizationrequest payment authorization input consumed by payment authorization service. subclass of connectapi.baserequest. property type description required or available version optional accountid string salesforce account that contains the required 51.0 payment transaction being authorized. amount double authorization amount. required 51.0 comments string optional comments for the payment optional 51.0 authorization. currencyisocode string three-letter iso 4217 currency code required 51.0 associated with the payment group record. effectivedate datetime date that the authorization will be applied required 51.0 to the transaction. paymentgatewayid string payment gateway that processes the required 51.0 authorization. paymentgroup connectapi. payment group for the authorization. the optional 51.0 paymentgroup payload must reference either a request paymentgroup or a paymentgroupid, but not both. paymentmethod connectapi. payment method used in the payment required 51.0 authapipayment gateway for the authorization transaction. methodrequest 1549apex reference guide connectapi input classes connectapi.bannerphotoinput a banner photo. property type description required or available version optional cropheight integer height of the crop rectangle in pixels. optional 36.0 cropwidth integer width of the crop rectangle in pixels. optional 36.0 cropx integer x position of the crop rectangle from the optional 36.0 left edge of the image in pixels. top left is position (0,0). cropy integer y position of the crop rectangle from the optional 36." "0 top edge of the image in pixels. top left is position (0,0). fileid string 18 character id of an existing file. the key required 36.0 prefix must be 069 and the file must be an image and be smaller than 2 gb. note: images uploaded on the group page and on the user page don’t have file ids and therefore can’t be used. versionnumber integer version number of an existing file. if not optional 36.0 provided, the latest version is used. connectapi.baserequest base parameters for making a request to the payment gateway. this class is abstract. subclass of connectapi.auditparamsrequest. superclass of: • connectapi.authorizationrequest • connectapi.authorizationreversalrequest • connectapi.capturerequest • connectapi.paymentmethodtokenizationrequest • connectapi.postauthrequest • connectapi.refundrequest • connectapi.salerequest 1550apex reference guide connectapi input classes property type description required or available version optional additionaldata map an optional map of additional parameters optional 50.0 to be sent to the payment gateway. idempotencykey string idempotency key. optional 50.0 connectapi.baseapipaymentmethodrequest payment method api input representation. this class is abstract. superclass of: • connectapi.authapipaymentmethodrequest • connectapi.postauthapipaymentmethodrequest • connectapi.saleapipaymentmethodrequest . property type description required or available version optional address connectapi. payment method address. required 51.0 addressrequest id string payment method record id. used in required 51.0 payment transactions. saveforfuture boolean shows whether salesforce saves the required 51.0 payment method for future use. connectapi.basepaymentmethodrequest base payment method input representation. this class is abstract. superclass of: • connectapi.alternativepaymentmethod • connectapi.cardpaymentmethodrequest no additional properties. connectapi.batchinput construct a set of inputs to be passed into a method at the same time. use this constructor when there isn’t a binary input: connectapi.batchinput(object input) 1551apex reference guide connectapi input classes use this constructor to pass one binary input: connectapi.batchinput(object input, connectapi.binaryinput binary) use this constructor to pass multiple binary inputs: connectapi.batchinput(object input, list binaries) the constructors takes these parameters: argument type description available version input object an individual input object to be used in the batch 32.0 operation. for example, for postfeedelementbatch(), this should be connectapi.feedelementinput. binary connectapi.binaryinput a binary file to associate with the input object. 32.0 binaries list a list of binary files to associate with the input 32.0 object. see also: post a batch of feed elements post a batch of feed elements with a new (binary) file connectapi.binaryinput create a connectapi.binaryinput object to attach files to feed items and comments and to add repository files. the constructor is: connectapi.binaryinput(blob, contenttype, filename) the constructor takes these arguments: argument type description available version blob blob contents of the file to be used for input 28.0 contenttype string mime type description of the content, such as image/jpg 28.0 filename string file name with the file extension, such as userphoto.jpg 28.0 see also: post a feed element with a new file (binary) attachment post a comment with a new file connectapi.batchinput 1552apex reference guide connectapi input classes connectapi.bookmarkscapabilityinput create or update a bookmark on a feed element. this class is a subclass of connectapi.feedelementcapabilityinput. property type description required or available version optional isbookmarked boolean specifies if the feed element should be no 32.0 bycurrentuser bookmarked for the user (true) or not (false). see also: connectapi.feedelement" "capabilitiesinput connectapi.botversionactivationinput activation status of the bot version. property type description required or available version optional status connectapi. activation status of the bot version. values optional 50.0 botversion are: activationstatus • active • inactive activation status must be specified in the status or postbody parameter. connectapi.canvascapabilityinput create or update a canvas app associated with a feed element. this class is a subclass of connectapi.feedelementcapabilityinput. property type description required or available version optional description string a description of the canvas app. the optional 32.0 maximum size is 255 characters. developername string the api name (developer name) of the required 32.0 connected app. height string the height of the canvas app in pixels. optional 32.0 namespaceprefix string a unique namespace prefix for the canvas optional 32.0 app. parameters string json parameters passed to the canvas app. optional 32.0 1553apex reference guide connectapi input classes property type description required or available version optional thumbnailurl string a thumbnail url to a preview image. the optional 32.0 maximum thumbnail size is 120 pixels by 120 pixels. title string a title for the canvas link. required 32.0 see also: connectapi.feedelementcapabilitiesinput connectapi.capacityrequestinputrepresentation request related to a location’s fulfillment order capacity. property type description required or available version optional actionrequestid string unique string that identifies the request. required 55.0 can be a uuid. use the action request ids in response data to identify which requests succeeded or failed. locationid string id of the location associated with the required 55.0 request. connectapi.capturerequest payment capture input consumed by the payment capture service. subclass of connectapi.baserequest. property type description required or available version optional accountid string id of the account linked to the capture optional 50.0 request. amount double amount captured from the previous required 50.0 authorization. clientcontext string context for payment apis. used for a optional 50.0 payment caller to re-establish context. comments string comments for the payment capture. optional 50.0 effectivedate datetime date when the payment becomes effective. optional 50.0 paymentgroup connectapi. details about the payment group record optional 50.0 paymentgrouprequest associated with the payment request. 1554apex reference guide connectapi input classes connectapi.alternativepaymentmethod a payment method that doesn't have a defined salesforce entity such as cardpaymentmethod or digitalwallet. common examples of alternative payment methods include cashondeliver, klarna, and direct debit. alternativepaymentmethod functions the same as any other type of payment method for processing transactions in the payment gateway. subclass of connectapi.basepaymentmethodrequest property type description required or available version optional accountid string salesforce payments account to which this required 54.0 payment method is linked. comments string details about a record added by a user. optional 54.0 maximum of 1,000 characters. email string email address of the card holder. optional 54.0 gatewaytoken string a unique, alphanumeric id, called a token, required 54.0 that a payment gateway generates when it first processes a payment. the token replaces the actual payment data so that the data is kept secure. this token is stored as encrypted text, and can be used for recurring payments. gatewaytoken string detailed information about the gateway required 54.0 details token. name string name that you assign to the payment optional 54.0 method object. connectapi.cardpaymentmethodrequest card payment method input representation. subclass of connectapi.basepaymentmethodrequest. property type description required or available optional version accountid string salesforce payments account to which this required 51.0 payment method is linked. autopay boolean indicates whether a token for recurring optional 55.0 payments is being requested (true) or not (false). the token lets the payment method be used for recurring payments. cardcategory connectapi. card processing type. valid values are: required 51.0 cardcategory • creditcard • debitcard 1555apex reference guide connectapi input classes property type description required or available optional version cardholder string first name of the card holder. required 51.0 firstname cardholder" "string last name of the card holder. required 51.0 lastname cardholdername string full name of the card holder. required 51.0 cardnumber string card number. required 51.0 cardtype string card network type. valid values are: required 51.0 • americanexpress • dinersclub • jcb • mastercard • maestro • visa comments string optional comments for the card payment optional 51.0 method. cvv string card verification value. required 51.0 email string email address of the card holder. required 51.0 expirymonth integer card expiration month. required 51.0 expiryyear integer card expiration year. required 51.0 nickname string optional nickname for the card. optional 51.0 startmonth integer month the card becomes active. optional 51.0 startyear integer year the card becomes active. optional 51.0 connectapi.cartinput a cart. property type description required or available version optional currencyisocode string currency iso code of the cart. optional 57.0 effective string id of the buyer account or guest buyer optional 49.0 accountid profile for which the request is made. if unspecified, the default value is determined from context. 1556apex reference guide connectapi input classes property type description required or available version optional issecondary boolean specifies whether the cart is secondary optional 53.0 (true) or not (false). if unspecified, defaults to false. name string name of the cart. the name can have up to optional 49.0 250 unicode characters. if unspecified, defaults to the generated name. orderownerid string id of the owner of the order. optional 58.0 type connectapi. type of cart.value is cart. if unspecified, optional 49.0 carttype defaults to cart. connectapi.cartcouponinput cart coupon input. property type description required or available version optional couponcode string the coupon code. required 54.0 connectapi.cartinventoryreservationinputrepresentation (developer preview) input representation to create or update a reservation. note: this feature is available as a developer preview. it isn’t generally available unless or until salesforce announces its general availability in documentation or in press releases or public statements. all commands, parameters, and other features are subject to change or deprecation at any time, with or without notice. property type description required or available version optional durationin integer reservation duration in seconds. required 58.0 seconds connectapi.cartiteminput an item in a cart. 1557apex reference guide connectapi input classes property type description required or available version optional productid string id of the product. required when 49.0 adding an item to a cart not supported when updating a cart item quantity string quantity of the cart item.use a value that required 49.0 can be converted to bigdecimal. type connectapi. type of item in a cart.value is product. required when 49.0 cartitemtype adding an item to a cart not supported when updating a cart item connectapi.cartitempromotioncollectioninputrepresentation promotions for a cart item. property type description required or available version optional items list connectapi.cartmessagesvisibilityinput set the visibility for cart messages. property type description required or available version optional visibility boolean specifies whether to set cart messages as required 50.0 visible (true) or not (false). connectapi.carttowishlistinput copy products from a cart to a wishlist. property type description required or available version optional wishlistid string id of the wishlist to copy cart products to. required 50.0 1558apex reference guide connectapi input classes connectapi.cdpcalculatedinsightinput input representation for a calculated insight. property type description required or available version optional apiname string api name of the calculated insight with required for creating 57.0 suffix __cio. a calculated insight optional for updating a calculated insight createdfrom boolean specifies whether the calculated insight was optional 57.0 package created from an installed package (true) or not (false). dataspacename string name of the data space. optional 57.0 definitiontype connectapi. definition type of the calculated insight. required for creating 57.0" "calculatedinsight values are: a calculated insight definitiontypeenum • calculatedmetric optional for updating a • externalmetric calculated insight • streamingmetric description string calculated insight description. optional 57.0 displayname string calculated insight display name. required for creating 57.0 a calculated insight optional for updating a calculated insight draft boolean specifies whether to save the calculated optional 57.0 insight as draft (true) or not (false). expression string calculated insight ansi sql expression. required for creating 57.0 a calculated insight optional for updating a calculated insight packagedcalculated string api name of the packaged calculated optional 57.0 insightapiname insight. connectapi.cdpidentityresolutionconfiginput input representation for creating an identity resolution ruleset. 1559apex reference guide connectapi input classes property type description required or available version optional configurationtype connectapi. source object for an identity resolution required 57.0 cdpidentityresolution ruleset. values are: configurationtype • account • individual description string description of the identity resolution ruleset. optional 57.0 doesrun boolean specifies whether automatic job run optional 57.0 automatically scheduling is enabled for the ruleset (true) or not (false). if unspecified, defaults to false. label string user friendly name of the identity resolution required 57.0 ruleset. matchrules list reconciliationrules list rulesetid string extended id of the ruleset used to optional 57.0 differentiate between rulesets created for comparison. the ruleset id must be unique and can't be longer than 4 characters. connectapi.cdpidentityresolutionconfigpatchinput input representation for updating an identity resolution ruleset. property type description required or available version optional description string description of the identity resolution ruleset. optional 57.0 doesrun boolean specifies whether automatic job run optional 57.0 automatically scheduling is enabled for the ruleset (true) or not (false). if unspecified, defaults to false. label string user friendly name of the identity resolution required 57.0 ruleset. matchrules list 1560apex reference guide connectapi input classes property type description required or available version optional reconciliationrules list connectapi.cdpidentityresolutionmatchcriterion input representation for an identity resolution ruleset's match rule criterion. property type description required or available version optional entityname string api name of the data model object the required 57.0 match rule applies to. fieldname string name of the field the criterion applies to. required 57.0 matchmethodtype connectapi. match method for a match rule criterion. required 57.0 cdpidentityresolution values are: matchmethodtype • exact—exact match. • exactnormalized—exact normalized match. • fuzzy—fuzzy match with medium precision. • fuzzyhigh—fuzzy match with high precision. • fuzzylow—fuzzy match with low precision. partyidentification connectapi. party identifier information. optional 57.0 info cdpidentityresolution matchcriterionparty identificationinfo shouldmatch boolean specifies whether blank fields can be used required 57.0 onblank for matching (true) or not (false). see also: connectapi.cdpidentityresolutionmatchrule connectapi.cdpidentityresolutionmatchcriterionpartyidentificationinfo input representation for information when party identification is used in an identity resolution ruleset's match rule criterion. 1561apex reference guide connectapi input classes property type description required or available version optional partyname string party identification name. required if the 57.0 match rule criterion uses party identification for matching partytype string party identification type. optional 57.0" "see also: connectapi.cdpidentityresolutionmatchcriterion connectapi.cdpidentityresolutionmatchrule input representation for an identity resolution ruleset’s match rule. property type description required or available version optional criteria list label string user friendly name for the identity required 57.0 resolution match rule. see also: connectapi.cdpidentityresolutionconfiginput connectapi.cdpidentityresolutionconfigpatchinput connectapi.cdpidentityresolutionreconciliationfieldrule input representation for an identity resolution ruleset's reconciliation rule for a field. property type description required or available version optional fieldname string the field that this reconciliation rule applies required 57.0 to. ruletype connectapi. default reconciliation rule applied to fields required 57.0 cdpidentityresolution in the object the reconciliation rule applies reconciliationruletype to. values are: • lastupdated • mostfrequent • sourcesequence 1562apex reference guide connectapi input classes property type description required or available version optional shouldignore boolean specifies whether to ignore an empty value required 57.0 emptyvalue (true) or not (false). sources list sourcesequence see also: connectapi.cdpidentityresolutionreconciliationrule connectapi.cdpidentityresolutionreconciliationrule input representation for an identity resolution ruleset's default reconciliation rule for an object. property type description required or available version optional entityname string api name of the data model object the required 57.0 reconciliation rule applies to. fields list ruletype connectapi. default reconciliation rule applied to fields required 57.0 cdpidentityresolution in the object the reconciliation rule applies reconciliationruletype to. values are: • lastupdated • mostfrequent • sourcesequence shouldignore boolean specifies whether to ignore an empty value required 57.0 emptyvalue (true) or not (false). sources list sourcesequence see also: connectapi.cdpidentityresolutionconfiginput connectapi.cdpidentityresolutionconfigpatchinput 1563apex reference guide connectapi input classes connectapi.cdpidentityresolutionreconciliationsource input representation for an identity resolution default reconciliation rule or field-specific rule using the sourcesequence match method. property type description required or available version optional name string if the ruletype for a reconciliation rule required if 57.0 is sourcesequence, api name of a ruletype is source data lake object. sourcesequence see also: connectapi.cdpidentityresolutionreconciliationrule connectapi.cdpidentityresolutionreconciliationfieldrule connectapi.cdpidentityresolutionreconciliationfieldrule connectapi.cdpidentityresolutionrunnowinput input representation for running an identity resolution ruleset job on demand. property type description required or available version optional callingapp string calling application. optional 57.0 callingappinfo string calling application information. optional 57.0 connectapi.cdpqueryinput data query input. property type description required or available version optional sql string ansi-standard sql query. required 52.0 connectapi.cdpsegmentdbtinput segment dbt input. 1564apex reference guide connectapi input classes property type description required or available version optional models list see also: connectapi.cdpsegmentinput connectapi.cdpsegmentdbtmodelinput segment" "dbt model input. property type description required or available version optional name string dbt model name. required 55.0 sql string dbt sql. required 55.0 dbt sql date strings must be in iso 8601 format , for example, 2011-02-25t18:24:31.000z. for details about supported validations, see supported validations for segment data build tool model sql. see also: connectapi.cdpsegmentdbtinput connectapi.cdpsegmentinput segment input. property type description required or available version optional additionalmetadata map map of additional metadata. optional for creating 55.0 a segment not supported for updating a segment dataspace string segment data space. optional 57.0 description string segment description. optional 55.0 1565apex reference guide connectapi input classes property type description required or available version optional developername string segment developer name. required for creating 55.0 a segment not supported for updating a segment displayname string segment display name. optional 57.0 includedbt connectapi. segment data build tool. required 55.0 cdpsegment dbtinput publishschedule connectapi. publish refresh schedule. values are: optional 55.0 publishschedule • twelve—refreshes every twelve hours. • twentyfour—refreshes every twenty-four hours. publishschedule string date indicating the end of the publish optional if 55.0 enddate schedule. publishschedule isn’t specified publishschedule string datetime indicating the start of the publish optional if 55.0 startdatetime schedule. publishschedule isn’t specified segmentonapiname string api name of the segmenton entity. optional 57.0 segmenttype connectapi. type of segment. value is: required for creating 55.0 segmenttype a segment • dbt—data build tool not supported for after a segment is created, the segment updating a segment type can’t be changed. connectapi.changeinputrepresentation a list of changes to orderitemsummaries that make up an order change, such as a cancel or return. 1566apex reference guide connectapi input classes property type description required or available version optional changeitems list see also: previewcancel(ordersummaryid, changeinput) previewreturn(ordersummaryid, changeinput) submitcancel(ordersummaryid, changeinput) submitreturn(ordersummaryid, changeinput) connectapi.changeiteminputrepresentation change to an orderitemsummary, such as a return or cancel. you specify whether to prorate the associated shipping charge based on the price change. the orderitemsummary can’t be a shipping charge. property type description required or available version optional changeitemfees lst the order item being returned or canceled. orderitem string id of the orderitemsummary. required 48.0 summaryid quantity double quantity to change. use a positive value. required 48.0 for example, a value of 2 means “cancel or return 2 units.” reason string reason for the change. the value must required 48.0 match one of the picklist values on the reason field of the orderitemsummarychange object. shipping boolean specifies whether to prorate the shipping required 48.0 reductionflag charge. see also: connectapi.changeinputrepresentation previewcancel(ordersummaryid, changeinput) previewreturn(ordersummaryid, changeinput) submitcancel(ordersummaryid, changeinput) submitreturn(ordersummaryid, changeinput) 1567apex reference guide connectapi input classes connectapi.changeitemfeeinputrepresentation input representation for change item fee input property type description required or available version optional amount double positive value used to calculate the fee required 57.0 amount, as described by the amounttype. amounttype string describes how the fee amount is calculated. required 57.0 valid values are: • amountwithtax—value of amount is the fee amount, including tax. • amountwithouttax" "—value of amount is the fee amount, not including tax. tax is calculated on the value and added. • percentage—value of amount is a percentage. to determine the fee amount, amount is divided by 100, and then multiplied by the totalprice and totaltaxamount of the associated orderitemsummary, prorated for the quantity being returned. • percentagegross—value of amount is a percentage. to determine the fee amount, amount is divided by 100, and then multiplied by the totallineamountwithtax of the associated orderitemsummary, prorated for the quantity being returned. description string description of the fee. optional 57.0 pricebookentryid string id of the price book entry associated with required unless 57.0 the fee product. price books are optional in the org product2id string id of the product representing the fee. required 57.0 1568apex reference guide connectapi input classes property type description required or available version optional reason string reason for the fee. the value must match required 57.0 an entry in the orderproductsummarychange object’s reason picklist. see also: connectapi.changeinputrepresentation connectapi.changeiteminputrepresentation previewcancel(ordersummaryid, changeinput) previewreturn(ordersummaryid, changeinput) submitcancel(ordersummaryid, changeinput) submitreturn(ordersummaryid, changeinput) connectapi.chattergroupinput property type description available announcement string the 18-character id of an announcement. 31.0 an announcement displays in a designated location in the salesforce ui until 11:59 p.m. on its expiration date, unless it’s deleted or replaced by another announcement. canhave boolean true if this group allows chatter customers, false otherwise. 29.0 chatterguests after this property is set to true, it cannot be set to false. description string the “description” section of the group. 29.0 information connectapi. the “information” section of a group. if the group is private, this 28.0 group section is visible only to members. information input isarchived boolean true if the group is archived, false otherwise. defaults to 29.0 false. isauto boolean true if automatic archiving is turned off for the group, false 29.0 archivedisabled otherwise. defaults to false. name string the name of the group. 29.0 owner string the id of the group owner. this property is available for patch 29.0 requests only. 1569apex reference guide connectapi input classes property type description available visibility connectapi. group visibility type. 29.0 groupvisibilitytype • privateaccess—only members of the group can see posts to this group. • publicaccess—all users within the experience cloud site can see posts to this group. • unlisted—reserved for future use. see also: creategroup(communityid, groupinput) updategroup(communityid, groupid, groupinput) connectapi.chatterstreaminput a chatter feed stream. property type description required or available version optional description string description of the stream, up to 1,000 optional 39.0 characters. name string name of the stream, up to 120 characters. required when 39.0 creating a stream optional when updating a stream subscriptions list results in no operation. including the same entity in subscriptionstoadd and subscriptionstoremove results in no operation. subscriptions list results in no operation. including the same creating a stream entity in subscriptionstoadd and subscriptionstoremove results in no operation. 1570apex reference guide connectapi input classes connectapi.commentcapabilitiesinput a container for all capabilities that can be included with a comment. property type description required or available version optional content connectapi. content to attach to the comment. optional 32.0 contentcapability input feedentityshare connectapi. feed entity to share to the comment. optional 42." "0 feedentityshare capabilityinput record connectapi. existing knowledge article to attach to the optional 42.0 recordcapability comment. input see also: connectapi.commentinput connectapi.commentinput a comment. used to add rich comments, for example, comments that include mentions or file attachments. property type description required or available optional version attachment connectapi.feed specifies an attachment for the comment. valid optional 28.0–31.0 itemattachment values are: input • contentattachmentinput • newfileattachmentinput linkattachmentinput is not permitted for comments. important: as of version 32.0, use the capabilities property. body connectapi. description of message body. the body can required 28.0 messagebodyinput contain up to 10,000 characters and 25 mentions. because the character limit can change, clients should make a describesobjects() call on the feeditem or feedcomment object and look at the length of the body or commentbody field to determine the maximum number of allowed characters. 1571apex reference guide connectapi input classes property type description required or available optional version to edit this property in a comment, use updatecomment(communityid, commentid, comment). editing comments is supported in version 34.0 and later. rich text and inline images are supported in comment bodies in version 35.0 and later. entity links are supported in version 43.0 and later. capabilities connectapi. specifies any capabilities for the comment, such optional 32.0 commentcapabilities as a file attachment. input threadparentid string id of the parent comment for a threaded optional 44.0 comment. see also: post a comment with a mention post a comment with a new file post a comment with an existing file post a rich-text comment with inline image post a rich-text feed comment with a code block edit a comment postcommenttofeedelement(communityid, feedelementid, comment, feedelementfileupload) connectapi.commerceaddressinput commerce address input. property type description required or available version optional addresstype string type of address, for example, shipping optional 54.0 or billing. city string the address city. optional 54.0 commerceaddressfieldinputlist a list of custom address fields, if any. optional 54.0 companyname string the address company name. optional 57.0 country string the address country. optional 54.0 countrycode string two-character country code. optional 54.0 firstname string the address first name. optional 57.0 1572apex reference guide connectapi input classes property type description required or available version optional isdefault boolean indicates whether a contact’s address is the optional 54.0 preferred method of communication (true) or not (false). the default value is false. lastname string the address last name. optional 57.0 middlename string the address middle name. optional 57.0 name string name of the contact. required 54.0 phonenumber string the address phone number. optional 57.0 postalcode string zip code or postal code for the address. optional 54.0 region string the address state. optional 54.0 regioncode string the address state code. optional 54.0 street string the address street. optional 54.0 connectapi.commerceaddressfieldinput commerce address field input. this is used to reference custom fields for the address. property type description required or available version optional dataname string the name of the custom address field. required 54.0 text string the value of the custom address field. optional 54.0 connectapi.confirmheldfocapacityinputrepresentation request to confirm held fulfillment order capacity at one or more locations. can correspond to one action call. property type description required or available version optional confirmheldfo list connectapi.confirmheldfocapacityrequestinputrepresentation request to confirm held fulfillment order capacity at one or more locations. 1573apex reference guide connectapi input classes property type description required or available version optional allornothing boolean controls whether a single failed request optional 55.0 cancels all other requests in the list (true) or whether some" "requests can succeed if others fail (false). the default value is false. capacityrequests list fulfillment order assigned to one location. connectapi.contentcapabilityinput attach or update a file on a comment. use this class to attach a new file or update a file that has already been uploaded to salesforce. this class is a subclass of connectapi.feedelementcapabilityinput. to attach or remove files from a feed post (instead of a comment) in version 36.0 and later, use connectapi. filescapabilityinput. property type description required or available version optional content string id of the existing content. required for existing 32.0 documentid content description string description of the file to be uploaded. optional 32.0 sharingoption connectapi. sharing option of the file. values are: optional 35.0 filesharing • allowed—resharing of the file is option allowed. • restricted—resharing of the file is restricted. title string title of the file. this value is used as the file required for new 32.0 name for new content. for example, if the content title is my title, and the file is a .txt file, the file name is my title.txt. see also: connectapi.feedelementcapabilitiesinput connectapi.contenthubfieldvalueinput the fields of the item type. 1574apex reference guide connectapi input classes property type description required or available version optional name string name of the item field. required 39.0 when updating the metadata of a repository file, only the name field can be updated. value string value of the item field. required 39.0 see also: connectapi.contenthubiteminput connectapi.contenthubiteminput the item type id and fields of the item type. property type description required or available version optional fields list the file name is required; otherwise optional itemtypeid string id of the item type. required to create a 39.0 file in a repository connectapi.contractinputrepresentation input to create and update contract. property type description required or available version optional isautodocgenrequired boolean specifies whether automatic document required 56.0 generation is required or not. recordtypename string contract record type name. optional 56.0 sourceobjectid string source record id. required 56.0 templatename string document template name for document optional 56.0 generation. connectapi.couponcoderedemptioninput input representation for coupon code redemption. 1575apex reference guide connectapi input classes property type description required or available version optional couponcodes list input representation for all coupon codes required 58.0 effectiveaccountid string id of the account required 58.0 transactionid string id of the transaction, which must be a valid required 58.0 cart id connectapi.couponcoderedemptioninput input representation for coupon code redemption. property type description required or available version optional couponcodes list input representation for all coupon codes required 58.0 effectiveaccountid string id of the account required 58.0 transactionid string id of the transaction, which must be a valid required 58.0 cart id connectapi.createcreditmemoinputrepresentation a list of change orders used to create a credit memo. property type description required or available version optional changeorderids list list of ids of the change orders. required 48.0 see also: createcreditmemo(ordersummaryid, creditmemoinput) connectapi.createinvoicefromchangeordersinputrepresentation ordersummary and associated change orders to create invoices for. property type description required or available version optional changeorderids list list of ids of change orders to create required 56.0 invoices for. 1576apex reference guide connectapi input classes property type description required or available version optional ordersummaryid string id of the associated order summary. required 56.0 see also: createmultipleinvoices(invoicesinput) connectapi.createmultipleinvoicesfromchangeordersinputrepresentation connectapi.createmultipleinvoices" "fromchangeordersinputrepresentation data about the change orders to create invoices for. property type description required or available version optional invoicesfrom list one invoice, which combines the change orders in that entry. see also: createmultipleinvoices(invoicesinput) connectapi.createorderpaymentsummaryinputrepresentation an ordersummary for which to create an orderpaymentsummary, with the payment authorization or payments to include in it. property type description required or available version optional ordersummaryid string id of the ordersummary. required 48.0 payment string id of the payment authorization. either a payment 48.0 authorizationid authorization or at least one payment is required. paymentids list list of ids of the payments. either a payment 48.0 authorization or at least one payment is required. see also: createorderpaymentsummary(orderpaymentsummaryinput) 1577apex reference guide connectapi input classes connectapi.createserviceappointmentinput contains information to create a service appointment. property type description required or available version optional assignedresources represents the service resources to be optional 53.0 assigned to a service appointment. note: when creating an appointment, use extendedfields to add values to any of the fields, including custom fields, in assignedresources as long as you have edit access to those fields. lead connectapi.leadinput represents a prospect or lead. required if 53.0 serviceappointment note: required to create a service isn’t provided. appointment for unauthenticated guest users. schedulingpolicyid string the id of the optional 53.0 appointmentschedulingpolicy object. if no scheduling policy is passed in the request body, the default configurations are used. the only scheduling policy configuration that is used in determining time slots is the enforcement of account visiting hours. serviceappointment connectapi.serviceappointmentinput represents the service appointment details required if lead 53.0 to book an appointment. isn’t provided. note: when creating an appointment, use extendedfields to add values to any of the fields, including custom fields, in assignedresources as long as you have edit access to those fields. connectapi.credentialinput credential input. 1578apex reference guide connectapi input classes property type description required or available version optional authentication connectapi. authentication protocol of the external required 56.0 protocol credential credential. values are: authentication • awssv4 protocol • custom • noauth • oauth authentication connectapi. authentication protocol variant of the optional 57.0 protocolvariant credential external credential. values are: authentication • awssv4_sts—aws signature protocolvariant version 4 with security token service. • jwtbearer—oauth 2.0 json web token bearer flow. • rolesanywhere—aws signature version 4 with identity and access management (iam) roles anywhere. if specified, the authentication protocol variant must match the actual protocol variant of the external credential. credentials map • awssv4—awsaccesskeyid (not encrypted), awssecretaccesskey (encrypted), awsrolearn (not encrypted) • custom—any credential name is valid (user sets encryption rules) externalcredential string fully qualified developer name of the required 56.0 external credential. principalname string name of the external credential named required if 56.0 principal. principaltype is namedprincipal principaltype connectapi. type of credential principal. values are: required 56.0 credential • awsstsprincipal principaltype • namedprincipal • peruserprincipal 1579apex reference guide connectapi input classes connect" "api.credentialcustomheaderinput credential custom header input. property type description required or available version optional headername string header name. required 58.0 headervalue string header value. required 58.0 id string header id. optional 58.0 sequencenumber integer sequence number. required 58.0 see also: connectapi.externalcredentialinput connectapi.namedcredentialinput connectapi.credentialvalueinput credential value input. authentication protocols have credential allowlists and encryption rules. • awssv4—awsaccesskeyid (not encrypted), awssecretaccesskey (encrypted), awsrolearn (not encrypted) • custom—any credential name is valid (user sets encryption rules) property type description required or available version optional encrypted boolean specifies whether the value of the credential required 56.0 is encrypted (true) or not (false). revision integer revision number of a short-lived credential, optional 58.0 such as oauthtoken. if the provided revision isn’t the latest version, the authentication endpoint refreshes the credential. value string value of the credential. required 56.0 see also: connectapi.credentialinput connectapi.customlistaudiencecriteriainput criteria for the custom list type of custom recommendation audience. subclass of connectapi.audiencecriteriainput. 1580apex reference guide connectapi input classes property type description required or available version optional member connectapi. the operation to carry out on the audience required to update 36.0 operationtype recommendation members. values are: a recommendation audiencemember audience • add—adds specified members to the operationtype audience. don’t use or specify null to create a • remove—removes specified recommendation members from the audience. audience members list a collection of user ids. required to update 36.0 a recommendation when updating an audience, you can audience include up to 100 members. an audience can have up to 100,000 members, and each don’t use or specify experience cloud site can have up to 100 null to create a audiences. recommendation audience connectapi.directmessagecapabilityinput create or update the members of a direct message. property type description required or available version optional memberstoadd list list of user ids for members to include in required when 39.0 the direct message. creating a direct message (post) optional when updating a direct message (patch) memberstoremove list list of user ids for members to remove from optional when 40.0 the direct message. updating a direct message (patch) not supported when creating a direct message (post) 1581apex reference guide connectapi input classes property type description required or available version optional subject string subject of the direct message. optional when 39.0 creating a direct message (post) not supported when updating a direct message (patch) see also: connectapi.feedelementcapabilitiesinput connectapi.distinctvaluerefinementinput attribute-based refinement with distinct values for product search. this class is a subclass of connectapi.refinementinput. property type description required or available version optional values list comma-separated list of attribute values. required 52.0 connectapi.ensurefundsasyncinputrepresentation id of an invoice to ensure funds for and apply them to. property type description required or available version optional invoiceid string id of the invoice. required 48.0 see also: ensurefundsasync(ordersummaryid, ensurefundsinput) connectapi.ensurerefundsasyncinputrepresentation id of a credit memo to ensure refunds for, an amount of excess funds to refund, or both. at least one is required. also includes any invoices for fees that reduce the refund amount, such as return fees. if multiple payment methods are available, you can specify how to distribute the refund. property type description required or available version optional creditmemoid string id of the credit memo that represents a either 48.0 refund amount. creditmemoid 1582" "apex reference guide connectapi input classes property type description required or available version optional or excessfunds amount is required excessfunds double amount of excess funds to refund. either 49.0 amount excessfunds amount or creditmemoid is required invoicestopay list isallowpartial boolean this value controls the behavior when the optional 56.0 amounts included in the sequences list don’t cover the entire refund amount. if this value is false, then the default refund logic is applied to ensure the remaining refund amount. if this value is true, then the unrefunded balance remains on the credit memo. if you don’t specify a sequences list, this value is ignored and the default refund logic is applied. the default value is false. sequences list stops when it’s refunded the full amount. see also: ensurerefundsasync(ordersummaryid, ensurerefundsinput) connectapi.entitylinksegmentinput an entity link segment. subclass of connectapi.messagesegmentinput property type description required or available version optional entityid string id of the entity to link to. required 43.0 only users with access to the entity see it. it’s hidden for users without access. 1583apex reference guide connectapi input classes connectapi.extendedfieldinput contains information about the extended field. property type description required or available version optional name string the name of the field, including custom optional 53.0 field. value string the value of the field. optional 53.0 connectapi.extensioninput an extension. property type description required or available version optional alternative connectapi. alternative representation of the extension. required 40.0 representation alternativeinput extensionid string id of the extension. required 40.0 payload string payload associated with the extension. required 40.0 payloadversion string payload version that identifies the structure optional 40.0 of the payload associated with the extension. see also: connectapi.extensionscapabilityinput connectapi.extensionscapabilityinput create or update extensions associated with a feed element. this class is a subclass of connectapi.feedelementcapabilityinput. property type description required or available version optional itemstoadd list element. an extension optional for updating an extension 1584apex reference guide connectapi input classes property type description required or available version optional itemstoremove list list of attachment ids to remove from the optional for 41.0 feed element. updating an extension don’t specify for creating an extension see also: connectapi.feedelementcapabilitiesinput connectapi.externalcredentialinput input used to create or update an external credential. important: where possible, we changed noninclusive terms to align with our company value of equality. we maintained certain terms to avoid any effect on customer implementations. property type description required or available version optional authentication connectapi. authentication protocol of the external required 58.0 protocol credential credential. values are: authentication • awssv4 protocol • custom • noauth • oauth authentication connectapi. authentication protocol variant of the optional 58.0 protocolvariant credential external credential. values are: authentication • awssv4_sts—aws signature protocolvariant version 4 with security token service. • jwtbearer—oauth 2.0 json web token bearer flow. • rolesanywhere—aws signature version 4 with identity and access management (iam) roles anywhere. if specified, the authentication protocol variant must match the actual protocol variant of the external credential. customheaders list 1585apex reference guide connectapi" "input classes property type description required or available version optional developername string fully qualified developer name of the required for creating 58.0 external credential. an external credential optional for updating an external credential masterlabel string external credential label. required 58.0 parameters list authenticationprotocol and authenticationvariant principals list connectapi.externalcredentialparameterinput external credential parameter input. property type description required or available version optional id string parameter id. optional 58.0 parameter string parameter description. optional 58.0 description parametername string parameter name of the external credential. required 58.0 parametertype connectapi. parameter type of the external credential. required 58.0 externalcredential values are: parametertype • authparameter • authprovider • authproviderurl • authproviderurlqueryparameter • jwtbodyclaim • jwtheaderclaim • signingcertificate 1586apex reference guide connectapi input classes property type description required or available version optional parametervalue string parameter value of the external credential. required 58.0 see also: connectapi.externalcredentialinput connectapi.externalcredentialprincipalinput connectapi.externalcredentialprincipalinput external credential principal input. property type description required or available version optional id string id of the principal external credential optional 58.0 parameter. parameters list principalname string principal name. required 58.0 principaltype connectapi. type of credential principal. values are: required 58.0 credentialprincipal • awsstsprincipal type • namedprincipal • peruserprincipal sequencenumber integer sequence number. required 58.0 see also: connectapi.externalcredentialinput connectapi.namedcredentialinput connectapi.feedelementcapabilitiesinput a container for all capabilities that can be included when creating a feed element. property type description required or available version optional associated connectapi. describes actions added to the feed optional 33.0 actions associatedactions element. capabilityinput 1587apex reference guide connectapi input classes property type description required or available version optional bookmarks connectapi. describes bookmarks added to the feed optional 32.0 bookmarkscapability element. input canvas connectapi. describes a canvas app added to the feed optional 32.0 canvascapability element. input content connectapi. describes content added to the feed optional 32.0–35.0 contentcapability element. input important: this class isn’t available for feed posts in version 36.0 and later. in version 36.0 and later, use connectapi.filescapabilityinput. directmessage connectapi. describes the direct message. optional 39.0 directmessage capabilityinput extensions connectapi. describes the extensions associated with optional 40.0 extensions the feed element. capabilityinput feedentityshare connectapi. describes the feed entity shared with the optional 39.0 feedentityshare feed element. capabilityinput files connectapi. describes files attached to the feed element. optional 36.0 filescapabilityinput link connectapi. describes a link added to the feed element. optional 32.0 linkcapabilityinput poll connectapi. describes a poll added to the feed element. optional 32.0 pollcapabilityinput questionand connectapi. describes a question and answer capability optional 32.0 answers questionandanswers added to the feed element. capabilityinput status connectapi. describes the status of the feed element. optional 44.0 statuscapabilityinput topics connectapi. describes topics assigned to the feed optional 38.0 topicscapability element. input see also: connectapi.feedelementinput 1588apex reference guide connectapi input classes connectapi.feedelementcapabilityinput a feed element capability. in api version 30.0 and earlier, most feed items can have comments, likes" ", topics, and so on. in version 31.0 and later, every feed item (and feed element) can have a unique set of capabilities. if a capability property exists on a feed element, that capability is available, even if the capability property doesn’t have a value. for example, if the chatterlikes capability property exists on a feed element (with or without a value), the context user can like that feed element. if the capability property doesn’t exist, it isn’t possible to like that feed element. a capability can also contain associated data. for example, the moderation capability contains data about moderation flags. this class is abstract and has no public constructor. you can make an instance only of a subclass. this class is a superclass of: • connectapi.associatedactionscapabilityinput • connectapi.bookmarkscapabilityinput • connectapi.canvascapabilityinput • connectapi.contentcapabilityinput • connectapi.directmessagecapabilityinput • connectapi.extensionscapabilityinput • connectapi.feedentitysharecapabilityinput • connectapi.filescapabilityinput • connectapi.linkcapabilityinput • connectapi.mutecapabilityinput • connectapi.pollcapabilityinput • connectapi.questionandanswerscapabilityinput • connectapi.readbycapabilityinput • connectapi.recordcapabilityinput • connectapi.statuscapabilityinput • connectapi.topicscapabilityinput connectapi.feedelementinput feed elements are the top-level items that a feed contains. feeds are feed element containers. this class is abstract and has no public constructor. you can make an instance only of a subclass. superclass of connectapi.feediteminput. property type description required or available version optional capabilities connectapi. the capabilities that define auxiliary optional 31.0 feedelement information on this feed element. capabilitiesinput 1589apex reference guide connectapi input classes property type description required or available version optional feedelementtype connectapi. the type of feed element this input required when 31.0 feedelementtype represents. creating a feed element optional when updating a feed element subjectid string the id of the parent this feed element is required 31.0 being posted to. this value can be the id of a user, group, or record, or the string me to indicate the context user. in version 45.0 and later, you can move a feed element from one public group to another by setting this property to the id of the new public group. you can’t include or change any other properties when moving a feed element. see also: post a feed element with a mention post a feed element with existing content post a feed element with a new file (binary) attachment define an action link and post with a feed element define an action link in a template and post with a feed element share a feed element (in version 39.0 and later) edit a feed element edit a question title and post post a rich-text feed element with inline image connectapi.feedentitysharecapabilityinput share a feed entity with a feed post or comment. this class is a subclass of connectapi.feedelementcapabilityinput. 1590apex reference guide connectapi input classes property type description required or available version optional feedentityid string id of the feed entity to share with the feed required 39.0 post or comment. see also: connectapi.feedelementcapabilitiesinput connectapi.feediteminput used to create rich feed items, for example, feed items that include @mentions or files. subclass of connectapi.feedelementinput as of version 31.0. property type description required or available optional version attachment connectapi.feed specifies the attachment for the feed item. the feed optional 28.0–31.0 itemattachment item type is inferred based on the provided attachment. input important: as of api version 32.0, use the inherited capabilities property. body connectapi. message body. the body can contain up to 10,000 required unless 28.0 messagebody characters and 25 mentions. because the character the feed item input limit can change, clients should make a has a link describesobjects() call on the feeditem or capability or a feedcomment object and look at the length of the content body or commentbody field to determine the capability." "maximum number of allowed characters. if you specify originalfeedelementid to share a feed item, use the body property to add the first comment to the feed item. to edit this property in a feed item, use updatefeedelement(communityid, feedelementid, feedelement). editing feed posts is supported in version 34.0 and later. isbookmarked boolean specifies if the new feed item should be bookmarked optional 28.0–31.0 bycurrentuser for the user (true) or not (false). important: as of api version 32.0, use the capabilities.bookmarks.isbookmarkedbycurrentuser property. 1591apex reference guide connectapi input classes property type description required or available optional version original string to share a feed element, specify its 18-character id. optional 31.0–38.0 feedelementid important: as of api version 39.0, use the capabilities.feedentity share.feedentityid property. original string to share a feed item, specify its 18-character id. optional 28.0–31.0 feeditemid important: in api version 32.0–38.0, use the originalfeedelementid property. in api version 39.0 and later, use the capabilities.feedentity share.feedentityid property. visibility connectapi. type of users who can see a feed item. optional 28.0 feeditem • allusers—visibility is not limited to internal visibilitytype users. enum • internalusers—visibility is limited to internal users. default values: • for external users, the default value is allusers. external users must use this value to see their posts. • for internal users, the default value is internalusers. internal users can accept this value or use the value allusers to allow external users to see their posts. if the parent of the feed item is a user, group, or direct message, the visibility of the feed item must be allusers. connectapi.fileidinput attach a file that has already been uploaded or remove a file from a feed element. property type description required or available version optional id string id of a file that has already been uploaded. required 36.0 1592apex reference guide connectapi input classes property type description required or available version optional operationtype connectapi. operation to carry out on the file. values are: optional 36.0 operationtype • add—adds the file to the feed if not specified, element. defaults to add. • remove—removes the file from the feed element. remove operations are processed before add operations. adding content that is already added and removing content that is already removed result in no operation. see also: connectapi.filescapabilityinput connectapi.findrouteswithfewestsplitsinputrepresentation data used to calculate order fulfillment routes involving the fewest number of shipment splits. property type description required or available version optional locationavailable list location. maximumnumber integer the maximum allowable number of optional 51.0 ofsplits shipment splits. routing options that involve more than this number of splits are not returned. note: each split represents an additional shipment. specifying a maximum of 0 returns only locations that can fulfill the entire order in a single shipment. a maximum of 1 returns combinations of locations that can fulfill the order in one or two shipments, and so on. orderedquantities list see also: findrouteswithfewestsplits(findrouteswithfewestsplitsinputrepresentation) 1593apex reference guide connectapi input classes connectapi.findrouteswithfewestsplitsgroupusingociinputrepresentation data used to calculate inventory availability and fulfillment routes for one order involving the fewest number of shipment splits. property type description required or available version optional excludelocations list list of locations to exclude from the routing optional 55.0 calculations. maximumnumber integer maximum allowable number of shipment optional 54.0 ofsplits splits. routing options that involve more than this number of splits are not" "returned. note: each split represents an additional shipment. specifying a maximum of 0 returns only locations that can fulfill the entire order in a single shipment. a maximum of 1 returns combinations of locations that can fulfill the order in one or two shipments, and so on. ordereditems list see also: findrouteswithfewestsplitsusingoci(findrouteswithfewestsplitsusingociinput) connectapi.findrouteswithfewestsplitsusingociinputrepresentation connectapi.findrouteswithfewestsplitsusingociinputrepresentation data used to calculate order fulfillment routes involving the fewest number of shipment splits, taking into account inventory availability. property type description required or available version optional findrouteswith list see also: findrouteswithfewestsplitsusingoci(findrouteswithfewestsplitsusingociinput) 1594apex reference guide connectapi input classes connectapi.findrouteswithfewestsplitsusingociiteminputrepresentation a quantity of a product and a location group or location assigned to fulfill it. property type description required or available version optional locationgroup string the external reference of the location group required 54.0 identifier or location assigned to the order item. if you specify a location group, inventory is considered for all locations belonging to that group. quantity double quantity of the product. required 54.0 stockkeepingunit string sku of the product. required 54.0 see also: findrouteswithfewestsplitsusingoci(findrouteswithfewestsplitsusingociinput) connectapi.findrouteswithfewestsplitsusingociinputrepresentation connectapi.findrouteswithfewestsplitsgroupusingociinputrepresentation connectapi.filescapabilityinput attach up to 10 files that have already been uploaded or remove one or more files from a feed element. this class is a subclass of connectapi.feedelementcapabilityinput. property type description required or available version optional items list out on those files. see also: connectapi.feedelementcapabilitiesinput connectapi.formfieldinput marketing integration form field. property type description required or available version optional name string name of the marketing integration form required 53.0 field. 1595apex reference guide connectapi input classes property type description required or available version optional type connectapi. type of marketing integration form field. required 53.0 formfieldtype values are: • boolean • date • emailaddress • number • text see also: connectapi.forminput connectapi.forminput marketing integration form. property type description required or available version optional formfieldslist list formname string name of the marketing integration form. required 53.0 member string marketing cloud's member identification required 53.0 identification code (mid) associated with the marketing code integration form. connectapi.formsubmissionfieldinput marketing integration form field submission. property type description required or available version optional name string name of the marketing integration form required 53.0 field. value string value of the marketing integration form required 53.0 field. see also: connectapi.formsubmissioninput 1596apex reference guide connectapi input classes connectapi.formsubmissioninput marketing integration form submission. property type description required or available version optional formfieldslist list connectapi.fulfillmentgroupinputrepresentation a list of orderitemsummaries to be fulfilled together, and the fulfillment location to handle them. the fulfillment type" "is one of the values defined for the type field on the fulfillmentorder object, such as “warehouse” or “retail store.” the specified type is assigned to the fulfillmentorder for this fulfillment group. property type description required or available version optional fulfilledfrom string id of the fulfillment location. required 48.0 locationid fulfillmenttype string fulfillment type. one of the type field values required 48.0 defined for fulfillmentorders. orderitem list referenceid string reference to this input for use in optional 50.0 troubleshooting failures. this value is only used by the apis for creating fulfillment orders for multiple order delivery group summaries. see also: connectapi.fulfillmentorderinputrepresentation createfulfillmentorders(fulfillmentorderinput) connectapi.fulfillmentorderinputrepresentation an orderdeliverygroupsummary that defines a delivery method and recipient, and a list of fulfillment groups to assign to fulfillmentorders. each fulfillment group is a set of orderitemsummaries that match the orderdeliverygroupsummary and share the same fulfillment location. the method creates a fulfillmentorder for each fulfillment group and a fulfillmentorderlineitem for each orderitemsummary. 1597apex reference guide connectapi input classes property type description required or available version optional fulfillmentgroups list orderdelivery string id of the orderdeliverygroupsummary. required 48.0 groupsummaryid ordersummaryid string id of the ordersummary. required 48.0 see also: createfulfillmentorders(fulfillmentorderinput) connectapi.fulfillmentorderinvoiceinputrepresentation instantiate and include this object with no properties when creating an invoice. this input class has no properties. see also: createinvoice(fulfillmentorderid, invoiceinput) connectapi.fulfillmentorderlineiteminputrepresentation a fulfillmentorderlineitem and quantity to cancel. you can cancel less than the full quantity, in which case you reallocate the canceled quantity to a different fulfillmentorder. property type description required or available version optional fulfillmentorder string id of the fulfillmentorderlineitem. required 48.0 lineitemid quantity double quantity to cancel. required 48.0 see also: connectapi.fulfillmentorderlineitemstocancelinputrepresentation cancelfulfillmentorderlineitems(fulfillmentorderid, cancelfulfillmentorderlineitemsinput) connectapi.fulfillmentorderlineitemstocancelinputrepresentation a list of fulfillmentorderlineitems and quantities to cancel. 1598apex reference guide connectapi input classes property type description required or available version optional fulfillment list see also: cancelfulfillmentorderlineitems(fulfillmentorderid, cancelfulfillmentorderlineitemsinput) connectapi.baserequest base parameters for making a request to the payment gateway. this class is abstract. subclass of connectapi.auditparamsrequest. superclass of: • connectapi.authorizationrequest • connectapi.authorizationreversalrequest • connectapi.capturerequest • connectapi.paymentmethodtokenizationrequest • connectapi.postauthrequest • connectapi.refundrequest • connectapi.salerequest property type description required or available version optional additionaldata map an optional map of additional parameters optional 50.0 to be sent to the payment gateway. idempotencykey string idempotency key. optional 50.0 connectapi.getfocapacityvaluesrequestinputrepresentation locations to get fulfillment order capacity information for. property type description required or available version optional locationids list list of ids of the locations to get fulfillment required 55.0 order capacity information for. 1599a" "pex reference guide connectapi input classes connectapi.groupinformationinput property type description available version text string the text in the “information” section of a group. 28.0 title string the title of the “information” section of a group. 28.0 see also: connectapi.chattergroupinput connectapi.hashtagsegmentinput include a hashtag in a feed item or comment. subclass of connectapi.messagesegmentinput property type description available version tag string text of the hash tag without the # (hash tag) prefix 28.0 note: closing square brackets ( ] ) are not supported in hash tag text. if the text contains a closing square bracket ( ] ), the hash tag ends at the bracket. see also: connectapi.messagebodyinput connectapi.holdfocapacityinputrepresentation request to hold fulfillment order capacity at one or more locations. can correspond to one action call. property type description required or available version optional holdfocapacity list connectapi.holdfocapacityrequestinputrepresentation request to hold fulfillment order capacity at one or more locations. 1600apex reference guide connectapi input classes property type description required or available version optional allornothing boolean controls whether a single failed request optional 55.0 cancels all other requests in the list (true) or whether some requests can succeed if others fail (false). the default value is false. capacityrequests list order at one location. connectapi.inlineimagesegmentinput an inline image segment. subclass of connectapi.messagesegmentinput property type description required or available version optional alttext string alt text for the inline image. optional 35.0 if not specified, the title of the inline image file is used as the alt text. fileid string id of the inline image file. required 35.0 see also: post a rich-text feed element with inline image connectapi.messagebodyinput connectapi.innerensurefundsasyncinputrepresentation id of an invoice and id of the associated ordersummary. property type description required or available version optional invoiceid string id of the invoice to ensure funds for. required 56.0 1601apex reference guide connectapi input classes property type description required or available version optional ordersummaryid string id of the ordersummary associated with required 56.0 the invoice. see also: multipleensurefundsasync(multipleensurefundsinput) connectapi.multipleensurefundsasyncinputrepresentation connectapi.inviteinput an invitation. property type description required or available version optional invitees list list of email addresses to send the invitation required 39.0 to. message string message to include in the invitation. optional 39.0 connectapi.invoicetopayinputrepresentation invoice for a fee. property type description required or available version optional invoiceid string id of the invoice for a fee. required 56.0 see also: ensurerefundsasync(ordersummaryid, ensurerefundsinput) connectapi.ensurerefundsasyncinputrepresentation connectapi.leadinput contains information about a lead or guest user. property type description required or available version optional company string the company of the lead. optional 53.0 email string the email address of the lead. optional 53.0 extendedfields use to add values to any of the fields, optional 53.0 including custom fields. 1602apex reference guide connectapi input classes property type description required or available version optional firstname string the first name of the lead. optional 53.0 lastname string the last name of the lead. optional 53.0 phone string the phone number of the lead. optional 53.0 connectapi.linkcapabilityinput create or update a link on a feed element. this class is a subclass of connectapi.feedelementcapabilityinput. property type description required or available version optional url string link url. the url can be to an external site. required" "32.0 urlname string description of the link. optional 32.0 see also: connectapi.feedelementcapabilitiesinput connectapi.linksegmentinput include a link segment in a feed item or comment. subclass of connectapi.messagesegmentinput property type description available version url string url to be used for the link 28.0 see also: connectapi.messagebodyinput connectapi.locationinputrepresentation inventory location data used to calculate shipping distance. property type description required or available version optional countrycode string the country code of the location. required 51.0 locationidentifier string the identifier of the location. required 51.0 postalcode string the postal code of the location. required 51.0 1603apex reference guide connectapi input classes connectapi.locationavailabilityinputrepresentation the available quantity of a product at an inventory location. property type description required or available version optional externalreferenceid string the external reference id of the inventory optional 51.0 location. quantity double the available quantity of the product. required 51.0 stockkeepingunit string the stock keeping unit of the product. required 51.0 connectapi.managedtopicpositioncollectioninput a collection of relative positions of managed topics. property type description required or available version optional managedtopic list navigational managed topics and doesn’t need to include all managed topics. for more information about reordering managed topics, see the example in reordermanagedtopics(communityid, managedtopicpositioncollection). connectapi.managedtopicpositioninput relative position of a managed topic. property type description required or available version optional managedtopicid string id of existing managed topic. required 32.0 position integer relative position of the managed topic, required 32.0 indicated by zero-indexed, ascending whole numbers. see also: connectapi.managedtopicpositioncollectioninput connectapi.markupbeginsegmentinput the beginning tag for rich text markup. 1604apex reference guide connectapi input classes subclass of connectapi.messagesegmentinput property type description required or available version optional alttext string alternative text for the hyperlink optional 45.0 segment. markuptype connectapi. type of rich text markup. required 35.0 markuptype • bold—bold tag. • code—code tag. • hyperlink—hyperlink anchor tag. • italic—italic tag. • listitem—list item tag. • orderedlist—ordered list tag. • paragraph—paragraph tag. • strikethrough—strikethrough tag. • underline—underline tag. • unorderedlist—unordered list tag. markup segments with a markuptype of code can include only text segments. url string url for the hyperlink segment. required for 45.0 supported hyperlink urls start with hyperlink http:// or https://. see also: post a rich-text feed element with inline image connectapi.messagebodyinput connectapi.markupendsegmentinput the end tag for rich text markup. subclass of connectapi.messagesegmentinput 1605apex reference guide connectapi input classes property type description required or available version optional markuptype connectapi. type of rich text markup. required 35.0 markuptype • bold—bold tag. • code—code tag. • hyperlink—hyperlink anchor tag. • italic—italic tag. • listitem—list item tag. • orderedlist—ordered list tag. • paragraph—paragraph tag. • strikethrough—strikethrough tag. • underline—underline tag. • unorderedlist—unordered list tag. see also: post a rich-text feed element with inline image connectapi.messagebodyinput connectapi.mentionsegmentinput include an @mention of a user or group in a feed post or comment. when creating a feed post or comment, you can include up to 25 mentions. subclass of connectapi.messagesegmentinput property type description available version id string id of the user or group to mention. 28.0 to mention a user, use either id" "or username. you can’t include groups are available in 29.0. both. to mention a group, you must use id. username string user name of the user to mention. 38.0 to mention a user, use either id or username. you can’t include both. see also: connectapi.messagebodyinput 1606apex reference guide connectapi input classes connectapi.messagebodyinput add rich messages to feed items and comments. property type description available version messagesegments list see also: connectapi.feediteminput connectapi.commentinput connectapi.announcementinput connectapi.messagesegmentinput used to add rich message segments to feed items and comments. this class is abstract and has no public constructor. you can make an instance only of a subclass. superclass for: • connectapi.entitylinksegmentinput • connectapi.hashtagsegmentinput • connectapi.inlineimagesegmentinput • connectapi.linksegmentinput • connectapi.markupbeginsegmentinput • connectapi.markupendsegmentinput • connectapi.mentionsegmentinput • connectapi.textsegmentinput use the connectapihelper repository on github to simplify many of the tasks accomplished with connectapi.messagesegmentinput, such as posting with inline images, rich text, and mentions. 1607apex reference guide connectapi input classes property type description required or available version optional type connectapi. the type of message segment. values are: required 23.0 messagesegment • entitylink type • fieldchange • fieldchangename • fieldchangevalue • hashtag • inlineimage • link • markupbegin • markupend • mention • morechanges • resourcelink • text see also: edit a comment edit a feed element edit a question title and post post a rich-text feed element with inline image connectapi.messagebodyinput connectapi.multipleensurefundsasyncinputrepresentation list of invoices and the associated ordersummaries. property type description required or available version optional asyncinputs list see also: multipleensurefundsasync(multipleensurefundsinput) connectapi.multiplefulfillmentorderinputrepresentation list of inputs for creating fulfillment orders. 1608apex reference guide connectapi input classes property type description required or available version optional fulfillmentorders list connectapi.multiplefulfillmentorderinvoicesinputrepresentation the fulfillmentorders to create invoices for. property type description required or available version optional fulfillmentorderids list list of ids of fulfillmentorders to create at least one id is 52.0 invoices for. required. connectapi.mutecapabilityinput mute or unmute a feed element. this class is a subclass of connectapi.feedelementcapabilityinput. property type description required or available version optional ismutedbyme boolean indicates whether the feed element is required 35.0 muted for the context user. default value is false. see also: setismutedbyme(communityid, feedelementid, ismutedbyme) connectapi.namedcredentialinput input used to create or update a named credential. property type description required or available version optional calloutoptions connectapi. callout options. required 58.0 namedcredential calloutoptionsinput callouturl string url of the named credential in a callout. required 58.0 customheaders list 1609apex reference guide connectapi input classes property type description required or available version optional developername string named credential developer name. required for creating 58.0 a named credential optional for updating a named credential external list<" "connectapi. external credentials used by the named required 58.0 credentials externalcredential credential. in version 58.0 and later only one input> external credential is supported. masterlabel string named credential label. required 58.0 network connectapi. privateconnect outbound network optional depending 58.0 connection networkconnection connection. on type input parameters list type connectapi. type of named credential. values are: required 58.0 namedcredential • privateendpoint type • securedendpoint connectapi.namedcredentialcalloutoptionsinput named credential callout options input. property type description required or available version optional allowmergefields boolean specifies whether to allow merge fields in required 58.0 inbody the http body (true) or not (false). allowmergefields boolean specifies whether to allow merge fields in required 58.0 inheader the http header (true) or not (false). generate boolean specifies whether to generate an required 58.0 authorization authorization header (true) or not header (false). see also: connectapi.namedcredentialinput 1610apex reference guide connectapi input classes connectapi.namedcredentialparameterinput named credential parameter input. property type description required or available version optional id string id of the parameter. optional 58.0 parameter string description of the parameter. optional 58.0 description parametername string name of the parameter. required 58.0 parametertype connectapi. type of named credential parameter. values required 58.0 namedcredential are: parametertype • allowedmanagedpackagenamespaces • clientcertificate parametervalue string value of the parameter. required 58.0 see also: connectapi.namedcredentialinput connectapi.networkconnectioninput network connection input. property type description required or available version optional developername string developer name of the network connection. required 58.0 namespace string namespace of the network connection. optional 58.0 see also: connectapi.namedcredentialinput connectapi.nbastrategyinput a recommendation strategy. property type description required or available version optional contextrecordid string id of the context record. for example, if the optional 45.0 next best action is on a case detail page, the id of the case. 1611apex reference guide connectapi input classes property type description required or available version optional maxresults integer maximum number of results. valid values optional 45.0 are from 1 to 25. the default is 3. strategycontext map variable and value mappings for the optional 45.0 strategy. debugtrace boolean specifies whether to return trace and debug optional 45.0 information in the response (true) or not (false). if unspecified, the default is false. connectapi.newuseraudiencecriteriainput criteria for the new members type of custom recommendation audience. subclass of connectapi.audiencecriteriainput. property type description required or available version optional value double the maximum number of days since a user required 36.0 became a site member. for example, if you specify 30, anyone who became a site member in the last 30 days is included in the new members audience. connectapi.oauthcredentialauthurlinput oauth authentication flow. property type description required or available version optional external string fully qualified developer name of the required 56.0 credential external credential. principalname string name of the external credential named required if 56.0 principal. principaltype is namedprincipal principaltype connectapi. type of credential principal. values are: required 56.0 credentialprincipal • awsstsprincipal type • namedprincipal • peruserprincipal 1612apex reference guide connectapi input classes property type description required or available version optional returnurl string return url to apply to the authentication optional 56.0 url. connectapi.ocicreatereservationinputrepresentation data to reserve inventory at one or more omnichannel inventory locations or location groups. property type description required or available version optional actionrequestid string a uuid that identifies the request. use the required 51.0 action request ids in response data" "to identify which requests succeeded or failed. allowpartial boolean when true, if the system can’t create the optional 51.0 reservations entire reservation, then it attempts to create a partial reservation. createrecords list expirationseconds integer a length of time in seconds. if the optional 51.0 reservation isn’t fulfilled within this amount of time after the reservationtime, then it expires. the maximum value is 14400. externalrefid string external reference id. optional 51.0 reservationtime string the time at which to record the reservation. optional 51.0 example: 2020-07-24t21:13:00z connectapi.ocicreatereservationsingleinputrepresentation a quantity of a product and an omnichannel inventory location or location group at which to reserve it. property type description required or available version optional locationgroupidentifier string identifier of the location group at which to either 51.0 reserve inventory. locationgroupidentifier or locationidentifier is required, but not both 1613apex reference guide connectapi input classes property type description required or available version optional locationidentifier string identifier of the location at which to reserve either 51.0 inventory. locationgroupidentifier or locationidentifier is required, but not both quantity double the quantity of the product to reserve. required 51.0 stockkeepingunit string the sku of the product to reserve. required 51.0 connectapi.ocifulfillreservationinputrepresentation a list of inventory reservations to fulfill. property type description required or available version optional fulfillmentrecords list connectapi.ocifulfillreservationsingleinputrepresentation an inventory reservation to fulfill. property type description required or available version optional actionrequestid string a uuid that identifies the request. use the required 51.0 action request ids in response data to identify which requests succeeded or failed. externalrefid string the external reference id of the location optional 51.0 that’s fulfilling the reservation. locationidentifier string the identifier of the location that’s fulfilling required 51.0 the reservation. quantity double the quantity being fulfilled. required 51.0 stockkeepingunit string the sku of the product being fulfilled. required 51.0 connectapi.ocigetinventoryavailabilityinputrepresentation details of a request to retrieve inventory availability. 1614apex reference guide connectapi input classes property type description required or available version optional locationgroup string the external reference of a location group optional; can’t 51.0 identifier to retrieve inventory availability data for. combine with specifying this value retrieves inventory data locationgroupidentifiers for all locations belonging to this group. or locationidentifiers locationgroup list a list of up to 100 external references of optional; can’t 51.0 identifiers location groups to retrieve inventory combine with availability data for. locationgroupidentifier or locationidentifiers locationidentifiers list a list of up to 100 external references of optional; can’t 51.0 locations to retrieve inventory availability combine with data for. locationgroupidentifier or locationgroupidentifiers stockkeepingunit string the sku of a product to retrieve inventory optional; can’t 51.0 availability data for. specifying a sku with combine with no locations or location groups returns stockkeepingunits availability data for that sku at all inventory locations that are not assigned to location groups. stockkeepingunits list a list of up to 100 skus of products to optional; can’t 51.0 retrieve inventory availability data for. combine with stockkeepingunit usecache boolean whether to fetch the inventory data from optional 51.0 the cache. default value is . connectapi.ocireleasereservationinputrepresentation details of one or more inventory reservations to release. property type description required or available version optional releaserecords list connectapi.ocireleasereservationsingleinputrepresentation a single inventory reservation to release. 1615apex reference guide connectapi input classes property type description required or available version optional actionrequestid string a uuid that identifies the request. use the required 51.0 action request ids in response data to identify which requests succeeded or failed. externalrefid string the external reference id of the location or optional 51.0 location group that has the reservation. locationgroupidentifier string the identifier of the location group that has the identifier for a 51.0 the reservation. location or location group, but not both, is required. locationidentifier string the identifier of the location that has the the identifier for a 51.0 reservation. location or location group, but not both, is required. quantity double the quantity of reserved inventory to required 51.0 release. stockkeepingunit string the sku of the product to release. required 51.0 connectapi.ocitransferreservationinputrepresentation a list of inventory reservation transfers and specifies whether a single failure cancels the entire list. property type description required or available version optional allornothing string controls whether a single failed transfer optional 51.0 transferid cancels all other transfers in the transferrecords list. • to allow some transfers in the transferrecords list to succeed when others fail, don’t include this property. • to cancel all the transfers in the transferrecords list when any of them fail, set this property to a uuid. the id must be unique, but isn’t otherwise used in this version. transferrecords list 1616apex reference guide connectapi input classes connectapi.ocitransferreservationsingleinputrepresentation an inventory reservation transfer. property type description required or available version optional actionrequestid string a uuid that identifies the request. use the required 51.0 action request ids in response data to identify which requests succeeded or failed. externalrefid string the external reference id of the location optional 51.0 receiving the transfer. fromlocationgroupidentifier string the identifier of the location group sending the identifier for a 51.0 the reservation. sending location or location group, but not both, is required fromlocationidentifier string the identifier of the location sending the the identifier for a 51.0 reservation. sending location or location group, but not both, is required ignoreavailabilitycheck boolean if true, force the transfer even if the receiving optional 52.0 location doesn’t have sufficient available inventory. the default value is false. quantity double the quantity of inventory being transferred. required 51.0 stockkeepingunit string the sku of the product being transferred. required 51.0 tolocationgroupidentifier string the identifier of the location group receiving the identifier for a 51.0 the reservation. receiving location or location group, but not both, is required tolocationidentifier string the identifier of the location receiving the the identifier for a 51.0 reservation. receiving location or location group, but not both, is required connectapi.orderitemsummaryinputrepresentation an orderitemsummary and quantity. property type description required or available version optional orderitem string id of the orderitemsummary. required 48.0 summaryid 1617apex reference guide connectapi input classes property type description required or available version optional quantity double quantity to include. required 48.0 see also: connectapi.fulfillmentgroupinputrepresentation connectapi.fulfillmentorderinputrepresentation createfulfillmentorders(fulfillmentorderinput) connectapi.orderitemsummaryadjustmentinput order item summary. property type description required or available version optional orderitem string id of the order item summary. required 53.0 summaryid see also: connectapi.orderitemsummaryadjustmentcollectioninput connectapi.orderitemsummaryadjustmentcollectioninput collection of order item summaries. property type description required or available version optional orderitem list connectapi.ordersummaryinputrepresentation an order from which to create an ordersummary." "optionally, you can specify ordersummary-specific information such as its status and whether it is managed in salesforce order management. property type description required or available version optional businessmodel string the order’s business model. it can have one optional 53.0 of these values: • b2b • b2c 1618apex reference guide connectapi input classes property type description required or available version optional externalreference string used internally to prevent duplicate records. optional 56.0 identifier this value is case-sensitive. name string specifies an ordernumber to assign to the optional 50.0 order summary. orderid string id of the original order. required 48.0 orderlifecycletype string specifies whether the order is managed in optional 49.0 salesforce order management or by an external system. it can have one of these values: • managed—managed in salesforce order management. • unmanaged—managed by an external system. if no value is specified, the default is managed. sourceprocess string describes the order process creating the optional 57.0 ordersummary. it can have one of these values: • orderonbehalf—an order on behalf of process. • standard—any process other than order on behalf of. if no value is specified, the default is standard. status string specifies a status to assign to the order optional 50.0 summary. the value must match one of the picklist values on the status field of the ordersummary object. see also: createordersummary(ordersummaryinput) connectapi.ordersummaryadjustmentaggregatesasyncinput order summary ids for calculating adjustment aggregates. property type description required or available version optional ordersummaryids list< string> list of order summary ids. required 55.0 1619apex reference guide connectapi input classes connectapi.ordertocartinput input for action adding an order to a cart. property type description required or available version optional cartstateorid string cart state (active or current) or the required 57.0 id of the cart to which the products from an order are to be copied. connectapi.paymentgrouprequest payment group input consumed by a payment group service. property type description required or available version optional createpaymentgroup boolean specifies whether salesforce needs to create optional 50.0 a payment group (true) or not (false). currencyisocode string three-letter iso 4217 currency code optional 50.0 associated with the payment group record. id string id of the payment group record. optional 50.0 sourceobjectid string source object id of the payment group optional 50.0 record. supports only orderid. connectapi.paymentmethodtokenizationrequest payment method tokenization input consumed by the payment tokenization service. subclass of connectapi.baserequest. property type description required or available version optional address connectapi. address of the payment method. required 52.0 addressrequest cardpaymentmethod connectapi. object representation of the card payment required 52.0 cardpaymentmethodrequest method. paymentgatewayid string id of the card payment method's payment required 52.0 gateway. connectapi.photoinput specify how to crop a photo that has already been uploaded. 1620apex reference guide connectapi input classes property type description available version cropsize integer the length, in pixels, of any edge of the crop square. 29.0 cropx integer the position x, in pixels, from the left edge of the image to the start of 29.0 the crop square. top left is position (0,0). cropy integer the position y, in pixels, from the top edge of the image to the start of 29.0 the crop square. top left is position (0,0). fileid string 18 character id of an existing file. the key prefix must be 069 and the file 25.0 must be an image and be smaller than 2 gb. note: images uploaded on the group page and on the user page don’t have file ids and therefore can’t be used. versionnumber integer version number of the existing content. if not provided, the latest version 25.0 is used. see also: setphotowithattributes(communityid, groupid, photo) setphotowithattributes(communityid, groupid, photo, fileupload) updaterecommendationdefinitionphotowithattributes(communityid, recommendationdefinitionid, photo) updaterecommend" "ationdefinitionphotowithattributes(communityid, recommendationdefinitionid, photo, fileupload) setphotowithattributes(communityid, userid, photo) setphotowithattributes(communityid, userid, photo, fileupload) connectapi.pincapabilityinput pin or unpin a feed element to a feed. property type description required or available version optional entityid string id of the entity to pin or unpin. in version required 41.0 41.0 and later, entityid must be a feed item id. in version 41.0–42.0, only one feed item can be pinned per feed. in version 43.0 and later, three feed items can be pinned per feed. ispinned boolean specifies whether to pin (true) or unpin required 41.0 (false) the entity. connectapi.pollcapabilityinput create, update, or vote on a poll on a feed element. this class is a subclass of connectapi.feedelementcapabilityinput. 1621apex reference guide connectapi input classes property type description required or available version optional choices list the choices used to create a new poll. you required for creating 32.0 must specify 2–10 poll choices for each poll. a poll mychoiceid string id of an existing choice on the feed poll. required for voting 32.0 used to vote on an existing poll. on a poll see also: connectapi.feedelementcapabilitiesinput connectapi.postauthrequest payment post authorization input consumed by the payment post authorization service. subclass of connectapi.baserequest property type description required or available version optional accountid string id of the account of the customer for the required 54.0 authorized payment. amount double amount of the post authorization. required 54.0 comments string comments for payment post authorization. optional 54.0 maximum of 1000 characters. currencyisocode string three-letter iso 4217 currency code optional 54.0 associated with the payment group record. effectivedate datetime date that the payment post authorization required 54.0 occurs. paymentgatewayid string payment gateway that evaluates the post required 54.0 authorization. paymentgroup connectapi. payment group associated with or to be optional 54.0 paymentgrouprequest created for the request. request must contain either a paymentgroupid or paymentgroup, but not both. paymentmethod connectapi. payment method sent for the post required. 54.0 postauthapi authorization. paymentmethodrequest connectapi.postauthapipaymentmethodrequest payment method input for post authorization. subclass of connectapi.baseapipaymentmethodrequest 1622apex reference guide connectapi input classes property type description required or available version optional alternativepaymentmethod connectapi. alternative payment method. required 54.0 alternativepayment method cardpaymentmethod connectapi. card payment method. required 54.0 cardpayment methodrequest connectapi.pricinginput pricing for multiple products. property type description required or available version optional pricinglineitems list connectapi.pricinglineiteminput pricing line item. property type description required or available version optional productid string id of the product to price. required 49.0 see also: connectapi.pricinginput connectapi.productsearchgroupinginput grouping information for product search results. property type description required or available version optional groupingoption connectapi. grouping option for search results. values required 52.0 commercesearch are: groupingoption • nogrouping—search results aren’t grouped. • variationparent—search results are grouped by the variation parent. 1623apex reference guide connectapi input classes property type description required or available version optional topproducttype connectapi. type of the top product to return for each optional 52.0 commercesearch product group in search results. value is: topproducttype • variationparent if nogrouping is specified for groupingoption, topproducttype is ignored. connectapi.productsearchinput product search. property type description required or available version optional categoryid string category id returns results for products in required if 52.0 this category or its subcategories. searchterm isn’t specified fields list" "product fields to return in search results. optional 52.0 search results include fields you have access to. if unspecified, all accessible fields are returned. grouping connectapi. specifies whether to group products in optional 52.0 productsearch search results and how to group them. if groupinginput unspecified, the default is the value specified in search > results display settings > results grouping. includeprices boolean specifies whether to include prices for optional 52.0 products in search results (true) or not (false). if unspecified, defaults to false. includequantity boolean specifies whether to include purchase optional 52.0 rule quantity rule information for products in search results (true) or not (false). if unspecified, defaults to false. page integer number of the page you want returned. optional 52.0 starts at 0. if you pass in null or 0, the first page is returned. pagesize integer specifies the number of items per page. optional 52.0 valid values are from 1 through 200. if unspecified, the default is the value specified in results per page in search > results display settings. 1624apex reference guide connectapi input classes property type description required or available version optional refinements list search results. buyers or shoppers can select up to 20 values for each refinement. searchterm string list of up to 32 space-separated search required if 52.0 terms. categoryid isn’t specified sortruleid string id of the sort rule that specifies the order of optional 52.0 products in the search results. connectapi.promotioncartinput cart during promotion evaluation. property type description required or available version optional cartitems list currencyisocode string three-letter iso 4217 currency code required for 57.0 associated with the cart. multi-currency orgs id string id of the cart. optional 57.0 see also: connectapi.promotionevaluateinput evaluate(salestransaction) connectapi.promotioncartdeliverygroupinput ids of the cart delivery group and its delivery method. property type description required or available version optional cartdelivery string id of the cart delivery group. required 57.0 groupid deliverymethodid string id of the order delivery method. required 57.0 see also: connectapi.promotionevaluateinput evaluate(salestransaction) 1625apex reference guide connectapi input classes connectapi.promotioncartiteminput item in a cart during promotion evaluation. property type description required or available version optional cartdelivery string id of the cart delivery group. required when 57.0 groupid evaluating shipping promotions cartid string id of the cart. optional 57.0 id string id of the cart item. must be unique across required 57.0 all items in the cart. itemdescription string description of the cart item. optional 57.0 itemname string name of the cart item. optional 57.0 listprice string list price of the cart item. optional 57.0 product2id string product id of the cart item. required if sku isn’t 57.0 specified quantity string number of items in the cart. required 57.0 salesprice string sales price of the cart item. this is the price required if 57.0 per quantity and the value used to compute totallinebaseamount the discount. if salesprice and isn’t specified totallinebaseamount are specified, totallinebaseamount is used. sku string stock keeping unit (sku) of the cart item. required if 57.0 product2id isn’t specified totallinebase string total amount for the cart item, equal to sales required if 57.0 amount price multiplied by quantity. this value is salesprice isn’t used to compute the discount. if specified salesprice and totallinebaseamount are specified, totallinebaseamount is used. totallistbase string total amount for the cart item based on list optional 57.0 amount price and quantity. 1626apex reference guide connectapi input classes property type description required or available version optional type connectapi. type of item in a cart. values are: required when 57.0 cartitemtype evaluating shipping • deliverycharge promotions • product see also: connectapi" ".promotioncartinput connectapi.promotionevaluateinput evaluate(salestransaction) connectapi.promotionevaluateinput find promotions that the customer is eligible for and compute their discounts. property type description required or available version optional cart connectapi.promotioncart cart and its items. required 57.0 input cartdelivery list promotions are enabled. promotions couponcodes list list of coupon codes to enable promotions. optional 57.0 a customer can apply a maximum of two coupons per cart. effectiveaccount string id of the account for which the request is required if 57.0 id made. segments isn’t specified isitemizeheader boolean specifies whether order-level adjustments optional 57.0 adjustments are itemized (true) or not (false). if unspecified, the default value is false. parentproducts list productcategories list segments list all promotions associated with promotion optional 57.0 segments specified in this list are active and can be evaluated against the cart. additionally, any segments associated with 1627apex reference guide connectapi input classes property type description required or available version optional a store or buyer group are also still evaluated against the cart. if this field is not present, only the promotions associated with a store or buyer group are evaluated. webstoreid string id of the store for which the request is optional 57.0 made. if unspecified, defined segments must be used instead. see also: evaluate(salestransaction) connectapi.promotionparentproductsinput ids of a parent product and variation product. property type description required or available version optional childproductid string id of the variation product. required 57.0 parentproductid string id of the parent product. required 57.0 see also: connectapi.promotionevaluateinput evaluate(salestransaction) connectapi.promotionproductcategoriesinput ids of a product and associated category. property type description required or available version optional categoryid string id of the category. required 57.0 productid string id of the product. required 57.0 see also: connectapi.promotionevaluateinput evaluate(salestransaction) 1628apex reference guide connectapi input classes connectapi.quantitywithskuinputrepresentation a quantity of a product. property type description required or available version optional quantity double quantity of the product. required 51.0 stockkeepingunit string sku of the product. required 51.0 connectapi.questionandanswerscapabilityinput create or edit a question feed element or set the best answer of the existing question feed element. this class is a subclass of connectapi.feedelementcapabilityinput. property type description required or available version optional bestanswerid string a comment id to use as a best answer for a required to update 32.0 question feed element. the best answer a feed element. comment must already exist on the not supported when question feed element. posting a feed element. questiontitle string title for a question feed element. required to post a 32.0 feed element. to edit the title of a question, use updatefeedelement(communityid, not supported when feedelementid, feedelement). updating a feed editing question titles is supported in element. version 34.0 and later. see also: edit a question title and post connectapi.feedelementcapabilitiesinput connectapi.rankaveragedistanceinputrepresentation an order recipient’s geographic location and information about sets of inventory locations that can fulfill the order. property type description required or available version optional deliverycountrycode string the country code of the order recipient. required 51.0 deliverypostalcode string the postal code of the order recipient. required 51.0 1629apex reference guide connectapi input classes property type description required or available version optional distanceunit string specify mi or km to return average 51.0 distances in miles or kilometers, respectively. sortresult string specify asc or desc to rank the results 51" ".0 by average shipping distance in ascending or descending order, respectively. targetlocations list connectapi.readbycapabilityinput mark feed elements as read by the context user. this class is a subclass of connectapi.feedelementcapabilityinput. property type description required or available version optional isreadbyme boolean specifies to mark the feed element as read required 40.0 (true) for the context user. lastreaddatebyme datetime specifies the last date, in iso 8601 format, optional 40.0 when the feed element is marked as read for the context user. if you don’t specify a date or you specify a future date, the current system date is used. see also: connectapi.feedelementcapabilitiesinput connectapi.sequenceorderpaymentsummaryinputrepresentation amount to apply to specified orderpaymentsummary as part of a payment or refund. property type description required or available version optional amount double amount to apply to the optional 56.0 orderpaymentsummary. 1630apex reference guide connectapi input classes property type description required or available version optional orderpayment string id of the orderpaymentsummary to apply required 56.0 summaryid the amount to. see also: ensurerefundsasync(ordersummaryid, ensurerefundsinput) connectapi.ensurerefundsasyncinputrepresentation connectapi.recipientengagementcontextinput context based on which the survey invitation is sent to a participant. property type description required or available version optional recipient map map each recipient with the context based required 50.0 engagement on which the survey invitation is emailed. context recipientid string participant id with whom the engagement required 50.0 context should be associated. see also: connectapi.surveyinvitationemailinput connectapi.recommendationaudienceinput a custom recommendation audience. property type description required or available version optional criteria connectapi. the criteria for the custom recommendation optional 36.0 audiencecriteria audience type. if not specified when input creating a recommendation audience, the audience criteria type defaults to custom list. 1631apex reference guide connectapi input classes property type description required or available version optional memberoperation connectapi. required to update 35.0 only important: this property is type recommendation a recommendation available only in version 35.0. in audiencemember audience version 36.0 and later, use operationtype don’t use or specify connectapi. null to create a customlistaudiencecriteriainput. recommendation the operation to carry out on the audience audience members. • add—adds specified members to the audience. • remove—removes specified members from the audience. members list required to update 35.0 only important: this property is a recommendation available only in version 35.0. in audience version 36.0 and later, use don’t use or specify connectapi. null to create a customlistaudiencecriteriainput. recommendation a collection of user ids. audience when updating an audience, you can include up to 100 members. an audience can have up to 100,000 members, and each experience cloud site can have up to 100 audiences. name string the unique name of the custom optional to update a 35.0 recommendation audience. recommendation audience required to create a recommendation audience see also: createrecommendationaudience(communityid, recommendationaudience) connectapi.recommendationdefinitioninput a custom recommendation definition. 1632" "apex reference guide connectapi input classes property type description required or available version optional actionurl string url for acting on the custom required to create a 35.0 recommendation, for example, the url to recommendation join a group. definition optional to update a recommendation definition actionurlname string text label for the action url in the user required to create a 35.0 interface, for example, “launch.” recommendation definition optional to update a recommendation definition explanation string explanation, or body, of the custom required to create a 35.0 recommendation. recommendation definition optional to update a recommendation definition name string name of the custom recommendation required to create a 35.0 definition. the name is displayed in setup. recommendation definition optional to update a recommendation definition title string title of the custom recommendation optional 35.0 definition. see also: createrecommendationdefinition(communityid, recommendationdefinition) connectapi.recommendationreactioninput a reaction to a recommendation produced by a recommendation strategy. property type description required or available version optional aimodel string reserved for future use. optional 47.0 1633apex reference guide connectapi input classes property type description required or available version optional contextrecordid string id of the context record. for example, if the optional 45.0 next best action is on a case detail page, the id of the case. executionid string id of the original recommendation strategy optional 45.0 execution. externalid string external id of the recommendation. this id optional 46.0 doesn’t need to be a salesforce 18-character id. for example, it can be a product number from an external system. onbehalfofid string id of the user or entity for which the optional 45.0 reaction took place. reactiontype connectapi. type of reaction to a recommendation. required 45.0 recommendation values are: reactiontype • accepted • rejected recommendation string reserved for future use. optional 46.0 mode recommendation double reserved for future use. optional 46.0 score strategyname string name of the recommendation strategy. required 45.0 targetactionid string id of the target action. optional 45.0 targetactionname string name of the target action. required 45.0 targetid string id of the recommendation that is being required 45.0 reacted to. connectapi.recordcapabilityinput attach an existing knowledge article to a comment. this class is a subclass of connectapi.feedelementcapabilityinput. property type description required or available version optional recordid string id of the existing knowledge article to required 42.0 attach. 1634apex reference guide connectapi input classes connectapi.recordsetfiltercriteriainput a set of recordset filter criteria applied to records, such as service appointment records. property type description required or available version optional criteriaids list recordset filter criteria ids. required 53.0 enforcesharing boolean determines whether record sharing checks optional 53.0 are enforced (true) or not (false) during the execution of this call. filteredobjectname string object that the filter is applied to. required 53.0 recordids list list of record ids of the filtered object. required 53.0 connectapi.referencedrefundrequest referenced refund input. subclass of connectapi.refundrequest. property type description required or available version optional accountid string id of the account linked to the referenced optional 50.0 refund request. amount double amount refunded. required 50.0 clientcontext string context for payment apis. used for a optional 50.0 payment caller to re-establish context. comments string optional comments for the refund. optional 50.0 effectivedate datetime date when the refund becomes effective. optional 50.0 paymentgroup connectapi. payment group details associated with the optional 50.0 paymentgrouprequest refund request. connectapi.refinementinput attribute-based refinement input for product search. this class is abstract and is a superclass of connectapi.distinctvaluerefinementinput. property type description required or available version optional attributetype connectapi. search attribute type. required 52.0 commercesearch • custom attributetype • productattribute 1635apex reference guide connectapi input classes property type description required or available version optional • standard nameorid string developer name" "of the attribute. in version required 52.0 52.0 and later, the id of the attribute isn’t supported. type connectapi. search facet type. value is: required 52.0 commercesearch • distinctvalue facettype connectapi.refundrequest refund input. this class is abstract. subclass of connectapi.baserequest. no additional properties. superclass of connectapi.referencedrefundrequest. connectapi.releaseheldfocapacityinputrepresentation request to release held fulfillment order capacity at one or more locations. can correspond to one action call. property type description required or available version optional releaseheldfo list connectapi.releaseheldfocapacityrequestinputrepresentation request to release held fulfillment order capacity at one or more locations. property type description required or available version optional allornothing boolean controls whether a single failed request optional 55.0 cancels all other requests in the list (true) or whether some requests can succeed if others fail (false). the default value is false. 1636apex reference guide connectapi input classes property type description required or available version optional capacityrequests list for one fulfillment order held at one location. connectapi.requestheaderinput an http request header name and value pair. property type description required or available version optional name string the name of the request header. required 33.0 value string the value of the request header. required 33.0 see also: define an action link and post with a feed element connectapi.returnitemsinputrepresentation data about products and delivery charges to return, as well as associated return fees. property type description required or available version optional returnorderitem list returnorderitemfees list returnorderitems list how to process them. see also: returnitems(returnorderid, returnitemsinput) connectapi.returnorderinputrepresentation data for creating a returnorder and returnorderlineitems. 1637apex reference guide connectapi input classes property type description required or available version optional ordersummaryid string id of the ordersummary containing the required 50.0 items to be returned. the ordersummary’s orderlifecycletype must be managed. returnorder string the lifecycletype of the returnorder. required 51.0 lifecycletype possible values are: • managed—process the returnorder using the apis and actions. it can generate change orders and affects financial fields and rollup calculations. • unmanaged—the returnorder is for tracking purposes only. it isn’t involved in any financial calculations and doesn’t generate any change orders. the system doesn’t prevent the creation of duplicate returnorderlineitems in an unmanaged returnorder for the same orderitem. returnorderlineitems list status string status to assign the returnorder. this value required 51.0 must match an entry in the returnorder object’s status picklist. see also: createreturnorder(returnorderinput) connectapi.returnorderiteminputrepresentation id of a returnorderlineitem and instructions for updating it. after the update, the returnorderlineitem is read-only. any remaining quantity to be returned is added to a new returnorderlineitem. property type description required or available version optional quantityreceived double the quantity of the returnorderlineitem required 52.0 that has been received. the value must be zero or greater. this value isn’t used by any" "standard features, but is provided for use in customizations. quantityrejected double the quantity of the returnorderlineitem required 52.0 that has been rejected for return. the value 1638apex reference guide connectapi input classes property type description required or available version optional must be zero or greater. this value isn’t used by any standard features, but is provided for use in customizations. quantityreturned double the quantity of the returnorderlineitem required 52.0 that has been returned. the value must be greater than zero. if this value plus quantitytocancel is less than the expected return quantity, then the remaining quantity to be returned is added to a new returnorderlineitem. quantitytocancel double the quantity of the returnorderlineitem to required 52.0 remove because it’s not being returned. the value must be zero or greater. if this value plus quantityreturned is less than the expected return quantity, then the remaining quantity to be returned is added to a new returnorderlineitem. reasonforrejection string the reason why the rejected quantity, if any, optional 52.0 was rejected. this value isn’t used by any standard features, but is provided for use in customizations. returnorder string the id of the returnorderlineitem. required 52.0 lineitemid see also: connectapi.returnitemsinputrepresentation returnitems(returnorderid, returnitemsinput) connectapi.returnorderitemdeliverychargeinputrepresentation id of a returnorderlineitem representing a delivery charge. property type description required or available version optional returnorder string id of a returnorderlineitem to return. required 52.0 lineitemid see also: connectapi.returnitemsinputrepresentation returnitems(returnorderid, returnitemsinput) 1639apex reference guide connectapi input classes connectapi.returnorderitemfeeinputrepresentation id of a returnorderlineitem representing a return fee, and instructions for updating it. after the update, the returnorderlineitem is read-only. any remaining quantity of the fee to be processed is added to a new returnorderlineitem. property type description required or available version optional quantityreturned double quantity of the returnorderlineitem to required 56.0 process. when the fee is a fixed amount, the charge is determined by multiplying the total fee amount by this value divided by the expected quantity. for example, if the fee amount is $10 and the expected quantity is 2, then if the quantityreturned is 1, $5 is charged. this value normally equals the quantity returned of the returnorderlineitem for the returned item that the fee applies to. the value must be greater than zero. if this value plus quantitytocancel is less than the expected quantity, then the remaining quantity to be returned is added to a new returnorderlineitem. quantitytocancel double quantity of the returnorderlineitem to required 56.0 remove. this value normally equals the quantity canceled of the returnorderlineitem for the returned item that the fee applies to. this value can also be used to cancel a portion of the fee. the value must be zero or greater. if this value plus quantityreturned is less than the expected quantity, then the remaining quantity to be returned is added to a new returnorderlineitem. returnorder string id of the returnorderlineitem representing required 56.0 lineitemid the return fee. see also: connectapi.returnitemsinputrepresentation returnitems(returnorderid, returnitemsinput) connectapi.returnorderlineiteminputrepresentation data for creating a returnorderlineitem for an order item being returned, including data to create returnorderlineitems representing any return fees associated with it. 1640apex reference guide connectapi input classes property type description required or available version optional canreduceshipping boolean whether to refund any associated shipping required 50.0 charge. orderitemsummaryid string id of the associated orderitemsummary. if required 50.0 the orderitemsummary already has an associated returnorderlineitem, then you must specify a different reasonforreturn. duplicating the reason breaks the financial calculations. quantityexpected double quantity expected to be returned. this value required 50.0 also applies to any fees specified in returnorderlineitemfees. quantityreceived double quantity already physically returned. optional 50.0 reasonforreturn string" "reason for the return. the value must match required if the 50.0 an entry in both the ordersummarychange returnorder reason field and the returnorderlineitem lifecycletype object’s reasonforreturn picklist. is managed. returnorder list to represent each fee. see also: connectapi.returnorderinputrepresentation createreturnorder(returnorderinput) connectapi.returnorderlineitemfeeinputrepresentation data for creating a returnorderlineitem that represents a return fee. property type description required or available version optional amount double value used to calculate the fee amount, as required 56.0 described by the amounttype. it must be a positive value. amounttype string describes how the fee amount is calculated. required 56.0 it can have one of these values: • amountwithtax—value of amount is the fee amount, including tax. 1641apex reference guide connectapi input classes property type description required or available version optional • amountwithouttax—value of amount is the fee amount, not including tax. tax is calculated on the value and added. • percentage—value of amount is a percentage. to determine the fee amount, amount is divided by 100, and then multiplied by the totalprice and totaltaxamount of the associated orderitemsummary, prorated for the quantity being returned. • percentagegross—value of amount is a percentage. to determine the fee amount, amount is divided by 100, and then multiplied by the totallineamountwithtax of the associated orderitemsummary, prorated for the quantity being returned. description string description of the fee. required 56.0 product2id string id of the product representing the fee. required 56.0 reason string reason for the fee. the value must match required 56.0 an entry in the returnorderlineitem object’s reasonforreturn picklist. see also: connectapi.returnorderinputrepresentation createreturnorder(returnorderinput) connectapi.returnorderlineiteminputrepresentation connectapi.salerequest payment sale input consumed by the payment sale service. subclass of connectapi.baserequest. property type description required or available version optional accountid string reference to account. required 54.0 amount double the amount of the sale request. required 54.0 comments string optional comment for the sale request. optional 54.0 1642apex reference guide connectapi input classes property type description required or available version optional currencyisocode string three-letter iso 4217 currency code required 54.0 associated with the payment output. effectivedate datetime date that the sale request takes effect. required 54.0 paymentgatewayid string the payment gateway that receives the sale required 54.0 request. paymentgroup connectapi.paymentgrouprequest payment group information for the sale optional 54.0 request. paymentmethod connectapi.saleapipaymentmethodrequest payment method used within the sale reqiured 54.0 request. connectapi.saleapipaymentmethodrequest payment method request for sale. subclass of connectapi.baseapipaymentmethodrequest. property type description required or available version optional cardpaymentmethod connectapi.cardpaymentmethodrequest payment method used in a sale request. required 54.0 connectapi.scheduledrecommendationinput a scheduled custom recommendation. property type description required or available version optional channel connectapi. a way to tie custom recommendations optional for creating 36.0 recommendation together. for example, display a scheduled channel recommendations in specific places in the recommendation ui or show recommendations based on time if not specified, of day or geographic locations. values are: defaults to • customchannel1—custom defaultchannel. recommendation channel. not used by don’t use when default. work with your community updating a manager to define custom channels. scheduled for example, community managers can recommendation use experience builder to determine where recommendations appear. • customchannel2—custom recommendation channel. not used by default. work with your community manager to define custom channels. 1643apex reference guide connectapi input classes property type description required or available" "version optional • customchannel3—custom recommendation channel. not used by default. work with your community manager to define custom channels. • customchannel4—custom recommendation channel. not used by default. work with your community manager to define custom channels. • customchannel5—custom recommendation channel. not used by default. work with your community manager to define custom channels. • defaultchannel—default recommendation channel. recommendations appear by default on the home and question detail pages of customer service and partner central experience builder templates. they also appear in the feed in the salesforce mobile web and anywhere community managers add recommendations using experience builder. use these channel values; you can’t rename or create other channels. enabled boolean indicates whether scheduling is enabled. if optional 35.0 true, the custom recommendation is enabled and appears in experience cloud sites. if false, custom recommendations in feeds in salesforce mobile web aren’t removed, but no new custom recommendations appear. in customer service and partner central sites, disabled custom recommendations no longer appear. rank integer relative rank of the scheduled custom optional 35.0 recommendation indicated by ascending whole numbers starting with 1. setting the rank is comparable to an insertion into an ordered list. the scheduled custom recommendation is inserted into the position specified by the rank. the rank of all the scheduled custom recommendations after it is pushed down. 1644apex reference guide connectapi input classes property type description required or available version optional see ranking scheduled custom recommendations example. if the specified rank is larger than the size of the list, the scheduled custom recommendation is put at the end of the list. the rank of the scheduled custom recommendation is the size of the list, instead of the one specified. if a rank is not specified, the scheduled custom recommendation is put at the end of the list. recommendation string id of the audience for this scheduled custom optional 35.0 audienceid recommendation.when updating a scheduled custom recommendation, specify all to remove the association between a custom recommendation audience and a scheduled custom recommendation. recommendation string id of the custom recommendation required to create a 35.0 definitionid definition that this scheduled scheduled recommendation schedules. recommendation you can’t specify a recommendation definitionid when updating a scheduled recommendation. ranking scheduled custom recommendations example if you have these scheduled custom recommendations: scheduled recommendations rank scheduledrecommendationa 1 scheduledrecommendationb 2 scheduledrecommendationc 3 and you include this information in the scheduled custom recommendation input: scheduled recommendation rank scheduledrecommendationd 2 1645apex reference guide connectapi input classes the result is: scheduled recommendation rank scheduledrecommendationa 1 scheduledrecommendationd 2 scheduledrecommendationb 3 scheduledrecommendationc 4 see also: createscheduledrecommendation(communityid, scheduledrecommendation) connectapi.sellerdetailsrequest seller details for the tax calculation property type description required or available version optional code string code used to identify the seller of the taxed 55.0 items. connectapi.serviceappointmentinput contains information about the service appointment. property type description required or available version optional additionalinformation string the extra information about the service optional 53.0 appointment. appointmenttype string the type of the appointment. optional 53.0 city string the name of the city. optional 53.0 comments string the comments about the appointment. optional 53.0 contactid string the id of the contact associated with the optional 53.0 parent record. country string the name of the country. optional 53.0 description string the description of the appointment. optional 53.0 1646apex reference guide connectapi input classes property type description required or available version optional engagementchanneltypeid string id of the engagement channel type to optional 56.0 associate with the appointment. you can use engagement channel type only if: • schedule appointments using engagement channels is enabled in salesforce scheduler settings in your salesforce org. • shifts are defined in the scheduling policy. for more information on setting up shifts in the scheduling policy, see define shift rules in scheduling policy. note: engagement channel" "types are not supported with operating hours rules in the scheduling policy. extendedfields use to add values to any of the fields, optional 53.0 including custom fields. parentrecordid string the id of the parent record associated with required if lead 53.0 the account. isn’t provided. postalcode string the postal code of the city. optional 53.0 schedendtime datetime the time at which the appointment is optional 53.0 scheduled to end. schedstarttime datetime the time at which the appointment is optional 53.0 scheduled to start. serviceterritoryid string the id of the service territory associated optional 53.0 with the service appointment. state string the name of the state. optional 53.0 street string the name of the street. optional 53.0 subject string the short phrase describing the optional 53.0 appointment. worktypeid string the id of the work type associated with the optional 53.0 service appointment. if specified, it is added to the service appointment record. connectapi.shiftsfrompatterninput shifts from a pattern. 1647apex reference guide connectapi input classes property type description required or available version optional schedulingend string scheduling end date in yyyy-mm-dd required if 51.0 date format. scheduling occurrences provide schedulingenddate or isn’t provided schedulingoccurrences. don’t provide both. scheduling integer number of scheduling occurrences. required if 51.0 occurrences schedulingend provide schedulingenddate or date isn’t provided schedulingoccurrences. don’t provide both. schedulingstart string scheduling start date in yyyy-mm-dd required 51.0 date format. serviceresourceid string id of the service resource to assign shifts to. optional 51.0–52.0 in version 53.0 and later, use serviceresourceidlist. serviceresourceid list list of service resource ids to assign shifts optional 53.0 list to. serviceterritoryid string id of the service territory to assign shifts to. optional 51.0 shiftstatus string status of the shifts. default values are: optional 52.0 • confirmed • published • tentative additional status values can be created. connectapi.socialpostmassapprovalinput list of social post ids and the action to approve or reject publishing them. property type description required or available version optional isapproved boolean specifies whether to approve (true) or optional 46.0 reject (false) publishing the social posts. if unspecified, defaults to false. socialpost list a list of up to 200 social post ids. required 46.0 idlist 1648apex reference guide connectapi input classes connectapi.statuscapabilityinput change the status of a feed post or comment. this class is a subclass of connectapi.feedelementcapabilityinput. property type description required or available version optional feedentitystatus connectapi. status of the feed post or comment. values required 37.0 feedentitystatus are: • draft—the feed post isn’t published but is visible to the author and users with modify all data or view all data permission. comments can’t be drafts. • pendingreview—the feed post or comment isn’t approved yet and therefore isn’t published or visible. • published—the feed post or comment is approved and visible. posts that have a status of pendingreview or published can’t be changed to a status of draft and vice versa. see also: connectapi.feedelementcapabilitiesinput connectapi.streamsubscriptioninput an entity to subscribe to for a chatter feed stream. property type description required or available version optional entityid string the id of any feed-enabled entity, such as required 39.0 a group, record, or user, that the context user can access. when subscribed, the entity’s feed is included in the feed stream. see also: connectapi.chatterstreaminput connectapi.surveyinvitationemailinput survey invitation email. 1649apex reference guide connectapi input classes property type description required or available version optional allowguest boolean specifies whether participants who don't required 50.0" "userresponse have a salesforce account can respond (true) or not (false). allowparticipants boolean specifies whether participants can see their required 50.0 accesstheirresponse responses (true) or not (false). associaterecords list survey invitation. body string content of the email. specify the email body optional 50.0 in case you don't specify an email template. the email body must contain one of the following merge fields: • to embed a link to launch the survey: [[survey_invitation_url]] • to embed a survey question: {{{surveyquestion.questionname}}} and {{{surveyquestion.questionhtmlcontent}}} collectanonymous boolean specifies whether participants can respond required 50.0 response anonymously (true) or not (false). communityid string id of the site that's used to open the survey optional 50.0 for users outside your org. emailtemplateid string id of the lightning email template that's optional 50.0 used to send the survey invitation. the template must contain the required merge fields that embed either the survey link or a question in the email. only lightning email templates are used to send survey invitations. fromemailaddress string email id of the user or the org-wide email required 50.0 address associated with the user's profile. invitation datetime date on which the survey invitation expires. optional 50.0 expirationdate invitationowner string id of the owner of the survey invitation optional 50.0 records. ispersonal boolean specifies whether an unique invitation is required 50.0 invitation created for each participant (true) or not (false). when a participant responds using a personal invitation, the response record is associated with the participant's salesforce record. 1650apex reference guide connectapi input classes property type description required or available version optional recipient list recipients list list of up to 300 ids of leads, contacts, or required 50.0 users to whom the survey invitation is emailed. shareinvitations list ids of the users with whom the survey optional 50.0 with invitation records must be shared. the invitation records are shared with read access. subject string subject of the email. specify the subject in optional 50.0 case you don't specify an email template. surveyquestion list ids of the questions that are embedded in optional 50.0 ids the email. you can send an email invitation for questions of the following types: net promoter score (nps), rating, and score. connectapi.targetcollectioninput collection of targets to create. property type description required or available version optional targets list connectapi.targetcollectionupdateinput collection of targets to update. property type description required or available version optional targets list connectapi.targetlocationinputrepresentation a set of inventory locations that together can fulfill an order. 1651apex reference guide connectapi input classes property type description required or available version optional locations list their country and postal codes. connectapi.targetinput target to create. property type description required or available version optional audienceid string id of the audience to assign to the target. required 48.0 groupname string group name of the target. groups bundle required 48.0 related target and audience pairs.you can have up to 2,000 groups and 500 targets per group.to determine the group name for targets of type experiencevariation, see personalization target developer and group names in the experience cloud developer guide. priority integer priority of the target. within a group, priority optional 48.0 determines which target is returned if the user matches more than one audience. publishstatus connectapi. the publish status of the target. values are: optional 48.0 publishstatus • draft • live we recommend setting the publish status to draft." "if you specify live, your changes revert after you publish the site. targettype string type of target, indicating the nature of the required 48.0 data being targeted.supported values include: • experiencevariation (version 48.0 and later) • custom object api names, such as customobjectname__c (version 48.0 and later) • navigationlinkset (version 49.0 and later) • topic (version 49.0 and later) 1652apex reference guide connectapi input classes property type description required or available version optional • collaborationgroup (version 49.0 and later) • knowledgearticle (version 49.0 and later) • contentdocument (version 49.0 and later) • managedcontent (version 49.0 and later) • report (version 49.0 and later) • dashboard (version 49.0 and later) you can have up to 2,500 experiencevariation targets and 25,000 record targets. targetvalue string value of the target.if targettype is required 48.0 experiencevariation, targetvalue is the developer name of the experience variation. if targettype is customobjectname__c, targetvalue is the id of the custom object.to determine the developer name for targets of type experiencevariation, see personalization target developer and group names in the experience cloud developer guide. see also: connectapi.targetcollectioninput connectapi.targetupdateinput target to update. property type description required or available version optional audienceid string id of the audience to assign to the target. required if 48.0 priority isn’t specified. otherwise, optional 1653apex reference guide connectapi input classes property type description required or available version optional priority integer priority of the target. within a group, priority required if 48.0 determines which target is returned if the audienceid isn’t user matches more than one audience. specified. otherwise, optional targetid string id of the target to update. required 48.0 see also: connectapi.targetcollectionupdateinput connectapi.calculatetaxrequest request to sent through the tax adapter to the external tax engine. inputs with a taxtransactiontype of debit represent a tax calculation request. inputs with a taxtransactiontype of credit represent a tax cancellation request. subclass of connectapi.taxtransactionrequest. property type description required or available version optional iscommit boolean commits the transaction for tax calculation. required 55.0 taxengineid string id of the salesforce tax engine entity used required 55.0 to represent the external tax engine. taxtransactiontype connectapi. type of tax transaction. values are: required 55.0 taxtransaction • credit—transaction is a credit type transaction. • debit—transaction is a debit transaction. taxtype connectapi. type of tax calculation. values are: required 55.0 calculatetax • actual—calculated tax represents type the final taxed amount for the transaction. • estimated—calculated tax represents only an estimated value before the transaction is finalized. connectapi.taxaddressrequest address input representation for tax calculation. 1654apex reference guide connectapi input classes name type description required or available version optional city string city. optional 55.0 country string country. optional 55.0 latitude double latitude. optional 55.0 locationcode string location code. optional 55.0 longitude double longitude. optional 55.0 postalcode string postal code. optional 55.0 state string state. optional 55.0 street string street. optional 55.0 connectapi.taxaddressesrequest addresses, including the bill to address, ship from address, ship to address, and sold to address. name type description required or available version optional billto connectapi. bill to address. optional 55.0 taxaddress request shipfrom connectapi. ship from address. optional 55.0 taxaddress request shipto connectapi. ship to address. optional 55.0 taxaddress request soldto connectapi. sold to address. optional 55.0 taxaddress request connectapi.taxcustomerdetailsrequest customer details for the tax calculation. property type description required or available version optional accountid string id of the customer's account. optional 55.0 code string customer code. optional 55.0 exemptionno string tax exemption number. optional" "55.0 1655apex reference guide connectapi input classes property type description required or available version optional exemptionreason string tax exemption reason. optional 55.0 connectapi.taxlineitemrequest a list of line items passed to the tax engine for tax calculation. property type description required or available version optional addresses connectapi. addresses, including the bill to address, ship optional 55.0 taxaddresses from address, ship to address, and sold to request address. amount double amount of the line item. optional 55.0 description string description of the line item. optional 55.0 effectivedate datetime date to apply the tax calculation to the line optional 55.0 item. linenumber string line number of the line item. optional 55.0 productcode string product code of the line item. optional 55.0 quantity double quantity of the line item. optional 55.0 taxcode string tax code for the line item. optional 55.0 connectapi.taxtransactionrequest information about the tax transaction sent to the tax adapter as part of a tax calculation request. this class is abstract. superclass of connectapi.calculatetaxrequest. property type description required or available version optional addresses connectapi. addresses, including the bill to address, ship optional 55.0 taxaddresses from address, ship to address, and sold to request address. currencyisocode string three-letter iso 4217 currency code optional 55.0 associated with the payment group record. customerdetails connectapi. customer details for the tax calculation. optional 55.0 taxcustomer detailsrequest 1656apex reference guide connectapi input classes property type description required or available version optional description string information about whether the tax optional 55.0 transaction failed or was successful. documentcode string document code. optional 55.0 effectivedate datetime the date that tax is applied to the taxed required 55.0 entity. lineitems list referencedocumentcode string the original document code. used in case optional 55.0 of subsequent transactions such as credit tax. referenceentityid string id of the reference entity used during tax optional 55.0 calculation. transactiondate datetime the date that the tax transaction occurred. optional 53.0 connectapi.textsegmentinput include a text segment in a feed item or comment. subclass of connectapi.messagesegmentinput property type description available version text string plain text for this segment. if hashtags or links are detected in text, 28.0 they’re included in the comment as hashtag and link segments. mentions aren’t detected in text and aren’t separated out of the text. mentions require connectapi.mentionsegmentinput. see also: edit a comment edit a feed element edit a question title and post post a rich-text feed element with inline image connectapi.messagebodyinput connectapi.topicinput update a topic’s name or description or merge topics. 1657apex reference guide connectapi input classes property type description available version description string description of the topic 29.0 idstomerge list list of up to five secondary topic ids to merge with the primary topic 33.0 if any of the secondary topics are navigational or featured topics, they lose their topic type, topic images, and children topics. their feed items are reassigned to the primary topic. if you merge a topic with a content topic, the content associations are preserved. if you merge a topic with an inactive endorsee, the endorsement isn’t mapped to the primary topic. name string name of the topic 29.0 use this property to change only the capitalization and spacing of the topic name. see also: updatetopic(communityid, topicid, topic) connectapi.topicnamesinput a list of topic names to replace currently assigned topics. also a list of suggested topics to assign. property type description required or available version optional topicnames list a list of up to 10 topic names for a feed item required 35.0 or 100 topic names for a record. topicsuggestions list a list of suggested topics to assign to a optional 37.0 record or feed item to improve future topic suggestions. see also: reassigntopicsbyname(communityid, recordid, topicnames) connectapi.articletopicassignmentjobinput" "connectapi.topicscapabilityinput assign topics to a feed element. property type description required or available version optional contexttopic string name of the parent topic in the site to optional 38.0 name which the feed element belongs. 1658apex reference guide connectapi input classes property type description required or available version optional topics list list of topics to assign to the feed element. required 38.0 see also: connectapi.feedelementcapabilitiesinput connectapi.updownvotecapabilityinput upvote or downvote a feed element or a comment. property type description required or available version optional vote connectapi. type of vote for a feed element or comment. required 41.0 updownvotevalue values are: • down • none • up connectapi.updateserviceappointmentinput contains information to update a service appointment. property type description required or available version optional serviceappointmentid string the id of the service appointment to be required 53.0 modified. assignedresources represents the service resources who are optional 53.0 assigned to a service appointment. when updating an appointment, pass the complete list of required resources. if you don’t pass a resource who is already assigned to the appointment, the api deletes that assigned resource. for example, suppose that an existing service appointment has assigned resources: a and b and you pass b and c in assigned resources in the patch request. the api checks the resource availability of b and c for existing work type and service territory, and if both are available, the service appointment gets updated with: • resource a—deleted 1659apex reference guide connectapi input classes property type description required or available version optional • resourceb—updated • resourcec—created however, if you don’t pass any of the assigned resources, the api assumes there’s no change. note: when creating an appointment, use extendedfields to add values to any of the fields, including custom fields, in assignedresources as long as you have edit access to those fields. lead connectapi.leadinput represents a prospect or lead. required if 53.0 serviceappointment note: required to create a service isn’t provided. appointment for unauthenticated guest users. schedulingpolicyid string the id of the optional 53.0 appointmentschedulingpolicy object. if no scheduling policy is passed in the request body, the default configurations are used. the only scheduling policy configuration that is used in determining time slots is the enforcement of account visiting hours. serviceappointment connectapi.serviceappointmentinput represents the service appointment details required if lead 53.0 to book an appointment. when updating isn’t provided. an appointment, pass only the fields that must be updated. note: when creating an appointment, use extendedfields to add values to any of the fields, including custom fields, in assignedresources as long as you have edit access to those fields. connectapi.userinput update a user’s about me information. 1660apex reference guide connectapi input classes property type description available version aboutme string the aboutme property of a connectapi.userdetail output 29.0 object. this property populates the about me section of the user profile, which is visible to all members of an experience cloud site or org. see also: updateuser(communityid, userid, userinput) connectapi.wishlistinput wishlist to create. property type description required or available version optional name string name of the wishlist. required 49.0 products list connectapi.wishlistiteminput item to update or add to a wishlist. property type description required or available version optional productid string id of the product to update or add to the required 49.0 wishlist. see also: connectapi.wishlistinput connectapi.wishlistupdateinput wishlist name to update. property type description required or available version optional name string wishlist name to update. required 50.0 retired connectapi input classes these connectapi input classes are retired" ". 1661apex reference guide connectapi input classes in this section: connectapi.canvasattachmentinput used to attach a canvas app to a feed item. connectapi.contentattachmentinput used to attach existing content to a comment or feed item. connectapi.datacloudorderinput input representation for a datacloud order to purchase contacts or companies and retrieve purchase information. connectapi.feeditemattachmentinput used to attach a file to a feed item. connectapi.linkattachmentinput add links to a feed item. connectapi.newfileattachmentinput attach a new file to a feed item. connectapi.pollattachmentinput attach a poll to a feed item. connectapi.canvasattachmentinput used to attach a canvas app to a feed item. important: this class isn’t available in version 32.0 and later. in version 32.0 and later, use connectapi.canvascapabilityinput. subclass of connectapi.feeditemattachmentinput. property type description available version description string optional. the description of the canvas app. 29.0–31.0 developername string the developer name (api name) of the canvas app 29.0–31.0 height string optional. the height of the canvas app in pixels. default height is 200 29.0–31.0 pixels. namespaceprefix string optional. the namespace prefix of the developer edition organization in 29.0–31.0 which the canvas app was created. parameters string optional. parameters passed to the canvas app in json format. example: 29.0–31.0 {'isupdated'='true'} thumbnailurl string optional. a url to a thumbnail image for the canvas app. maximum 29.0–31.0 dimensions are 120x120 pixels. title string the title of the link used to call the canvas app. 29.0–31.0 connectapi.contentattachmentinput used to attach existing content to a comment or feed item. 1662apex reference guide connectapi input classes important: this class isn’t available in version 32.0 and later. in version 32.0 and later, use connectapi.contentcapabilityinput. subclass of connectapi.feeditemattachmentinput property type description available version contentdocumentid string id of the existing content. 28.0–31.0 connectapi.datacloudorderinput input representation for a datacloud order to purchase contacts or companies and retrieve purchase information. property type description required or available optional version companyids string a comma-separated list of required to 32.0 identification numbers for the purchase companies to be purchased. companies you can’t include any contact ids or your purchase fails. contactids string a comma-separated list of required to 32.0 identification numbers for the purchase contacts to be purchased. contacts you can’t include any company ids or your purchase fails. usertype connectdatacloudusertypeenum indicates the data.com user type to optional 32.0 be used. there are two user types. • monthly (default) • listpool see also: postorder(orderinput) connectapi.feeditemattachmentinput used to attach a file to a feed item. important: this class isn’t available in version 32.0 and later. in version 32.0 and later, use connectapi.feedelementcapabilityinput. this class is abstract and has no public constructor. you can make an instance only of a subclass. superclass for: • connectapi.canvasattachmentinput • connectapi.contentattachmentinput • connectapi.linkattachmentinput 1663apex reference guide connectapi output classes • connectapi.newfileattachmentinput • connectapi.pollattachmentinput connectapi.linkattachmentinput add links to a feed item. important: this class isn’t available in version 32.0 and later. in version 32.0 and later, use connectapi.linkcapabilityinput. subclass of connectapi.feeditemattachmentinput property type description available version url string url to be used for the link 28.0–31.0 urlname string title of the link 28.0–31.0 connectapi.newfileattachmentinput attach a new file to a feed item. important: this class isn’t" "available in version 32.0 and later. in version 32.0 and later, use connectapi.contentcapabilityinput. the actual binary file, that is the attachment, is provided as part of the binaryinput in the method that takes this attachment input, such as postfeeditem or postcomment. subclass of connectapi.feeditemattachmentinput property type description available version description string description of the file to be uploaded. 28.0–31.0 title string the title of the file. this value is required and is also used as the file 28.0–31.0 name. for example, if the title is my title, and the file is a .txt file, the file name is my title.txt. connectapi.pollattachmentinput attach a poll to a feed item. important: this class isn’t available in version 32.0 and later. in version 32.0 and later, use connectapi.pollcapabilityinput. subclass of connectapi.feeditemattachmentinput property type description available version pollchoices list the text labels for the poll items. polls must contain between 2 to 10 poll 28.0–31.0 choices. connectapi output classes most connectapi methods return instances of connectapi output classes. 1664apex reference guide connectapi output classes all properties are read-only, except for instances of output classes created within test code. all output classes are concrete unless marked abstract in this documentation. all concrete output classes have no-argument constructors that you can invoke only from test code. see testing connectapi code. connectapi.abstractcartitem a cart item. this class is abstract. superclass of: • connectapi.cartitem • connectapi.cartitemwithoutprice property name type description available version cartid string id of the cart. 49.0 cartitemid string id of the item. 49.0 messagessummary connectapi. messages summary for the item. 49.0 cartmessagessummary name string name of the item. productdetails connectapi. summary of the product details. 49.0 cartitemproduct productid string id of the product. 49.0 quantity string quantity of the item. 49.0 type connectapi. type of item in a cart. values are: 49.0 cartitemtype • deliverycharge • product see also: connectapi.cartitemresult connectapi.abstractcontenthubitemtype an item type associated with a repository folder. this class is abstract. superclass of: • connectapi.contenthubitemtypedetail • connectapi.contenthubitemtypesummary 1665apex reference guide connectapi output classes property name type description available version contentstream connectapi. support for content streaming. values are: 39.0 support contenthub • contentstreamallowed streamsupport • contentstreamnotallowed • contentstreamrequired description string description of the item type. 39.0 displayname string display name of the item type. 39.0 id string id of the item type. 39.0 isversionable boolean indicates whether the item type can have versions. 39.0 url string url to the detailed information of the item type. 39.0 connectapi.abstractdirectoryentrysummary a directory entry with summary information. this class is abstract. superclass of: • connectapi.repositorygroupsummary • connectapi.repositoryusersummary property name type description available version domain string domain of the directory entry. 39.0 email string email of the directory entry. 39.0 id string id of the directory entry. 39.0 type connectapi. type of directory entry. values are: 39.0 contenthub • groupentry directoryentry • userentry type connectapi.abstractextensioninformation extension information. this class is abstract. superclass of .connectapi.lightningextensioninformation property name type description available version extension connectapi. information type of the extension. values are: 40.0 informationtype extensioninformation • lightning type 1666apex reference guide connectapi output classes connectapi.abstractgatewaycommonresponse payment gateway response fields commonly used in payment services. this class is abstract. superclass of connectapi.abstractgatewayresponse. property name type description available version gatewayavscode string used to verify the address mapped to a payment 50.0 method when the payments platform requests tokenization" "from the payment gateway. gatewaydate datetime date when the notification occurred. some gateways 50.0 don’t send this value. gatewaymessage string error messages that the gateway returned for the 50.0 notification request. maximum length of 255 characters. gatewayresultcode string gateway-specific result code. you can map the result 50.0 code to a salesforce-specific result code. maximum length of 64 characters. gatewayresultcodedescription string a description of the gateway-specific result code that 50.0 a payment gateway returned. maximum length of 1,000 characters. salesforceresultcode string the salesforce result code for the gateway result 50.0 code. connectapi.abstractgatewayresponse payment gateway response fields used in sale, authorization, and capture services. this class is abstract. subclass of connectapi.abstractgatewaycommonresponse. super class of: • connectapi.authreversalgatewayresponse • connectapi.authorizationgatewayresponse • connectapi.authorizationreversalresponse • connectapi.capturegatewayresponse • connectapi.paymentmethodtokenizationgatewayresponse • connectapi.postauthgatewayresponse • connectapi.refundgatewayresponse • connectapi.salegatewayresponse 1667apex reference guide connectapi output classes property name type description available version gatewayreferencedetails string provides information about the gateway 50.0 communication. gatewayreferencenumber string unique transaction id created by the payment 50.0 gateway. connectapi.abstractmanagedcontentdeliverydocument managed content delivery document. this class is abstract. superclass of: • connectapi.managedcontentdeliverydocument • connectapi.managedcontentdeliverydocumentsummary property name type description available version contentkey string globally unique identifier (guid) for the managed 55.0 content. contenttype connectapi. type of managed content. 55.0 managedcontent typesummary language string language locale of the managed content. 55.0 managedcontentid string id of the managed content. 55.0 publisheddate datetime most recent publish date of the managed content. 55.0 resourceurl string url to the single content delivery resource. 55.0 title string title of the managed content. 55.0 unauthenticatedurl string public url for the managed content. 55.0 urlname string url name of the managed content. 55.0 see also: connectapi.managedcontentdeliverydocumentcollection connectapi.abstractmanagedcontentreference managed content reference. this class is abstract. superclass of: • connectapi.managedcontentreference • connectapi.managedcontentreferencesummary 1668apex reference guide connectapi output classes property name type description available version contentkey string unique identifier for the managed content reference. 54.0 managedcontentid string id of the managed content reference. 54.0 resourceurl string url to the single content delivery resource. 55.0 see also: connectapi.managedcontentdeliverydocumentcollection connectapi.abstractmessagebody this class is abstract. superclass of: • connectapi.feedbody • connectapi.messagebody name type description available version isrichtext boolean indicates whether the body is rich text. 35.0 messagesegments list text string display-ready text. use this text if you don’t want to process 28.0 the message segments. connectapi.abstractnbaaction a recommended action of recommendation strategy. this class is abstract. superclass of connectapi.nbaflowaction. property name type description available version parameters list type connectapi. type of action. values are: 45.0 nbaactiontype • flow—automated process tool with multiple subtypes. see also: connectapi.nbarecommendation 1669apex reference guide connectapi output classes connectapi.abstractnbatarget a recommendation target of a recommendation strategy. this class is abstract. superclass of connectapi.nbanativerecommendation. property name type description available version type connectapi. type of target. values are: 45.0 nbatargettype • recommendation see also: connectapi.nbarecomm" "endation connectapi.abstractrecommendation a chatter, custom, or static recommendation. this class is abstract. superclass of: • connectapi.entityrecommendation • connectapi.nonentityrecommendation connectapi.nonentityrecommendation isn’t used in version 34.0 and later. in version 34.0 and later, connectapi.entityrecommendation is used for all recommendations. property name type description available version explanation connectapi. the chatter, custom, or static recommendation 32.0 recommendation explanation. explanation platformaction connectapi. a platform action group instance with state 34.0 group platformaction appropriate for the context user. group recommendation connectapi. specifies the type of record being recommended. 32.0 type recommendationtype url string url for the chatter, custom, or static 34.0 recommendation. see also: connectapi.recommendationscapability connectapi.recommendationcollection 1670apex reference guide connectapi output classes connectapi.abstractrecommendationexplanation explanation for a chatter recommendation. this class is abstract. superclass of connectapi.recommendationexplanation. property name type description available version summary string summary explanation for the chatter 32.0 recommendation. type connectapi. indicates the reason for the chatter recommendation. 32.0 recommendation • articlehasrelatedcontent—articles explanationtype with related content to a context article. • articleviewedtogether—articles often viewed together with the article that the context user just viewed. • articleviewedtogetherwithviewers—articles often viewed together with other records that the context user views. • custom—custom recommendations. • filepopular—files with many followers or views. • fileviewedtogether—files often viewed at the same time as other files that the context user views. • followedtogetherwithfollowees—users often followed together with other records that the context user follows. • groupmembersfollowed—groups with members that the context user follows. • groupnew—recently created groups. • grouppopular—groups with many active members. • itemviewedtogether—records often viewed at the same time as other records that the context user views. • popularapp—applications that are popular. • recordowned—records that the context user owns. • recordparentoffollowed—parent records of records that the context user follows. • recordviewed—records that the context user recently viewed. 1671apex reference guide connectapi output classes property name type description available version • topicfollowedtogether—topics often followed together with the record that the context user just followed. • topicfollowedtogetherwithfollowees—topics often followed together with other records that the context user follows. • topicpopularfollowed—topics with many followers. • topicpopularliked—topics on posts that have many likes. • userdirectreport—users who report to the context user. • userfollowedtogether—users often followed together with the record that the context user just followed. • userfollowssameusers—users who follow the same users as the context user. • usermanager—the context user’s manager. • usernew—recently created users. • userpeer—users who report to the same manager as the context user. • userpopular—users with many followers. • userviewingsamerecords—users who view the same records as the context user. connectapi.abstractrecordfield a field on a record. this class is abstract. superclass of: • connectapi.blankrecordfield • connectapi.labeledrecordfield message segments in a feed item are typed as connectapi.messagesegment. feed item capabilities are typed as connectapi.feeditemcapability. record fields are typed as connectapi.abstractrecordfield. these classes are all abstract and have several concrete subclasses. at runtime you can use instanceof to check the concrete types of these objects and then safely proceed with the corresponding downcast. when you downcast, you must have a default case that handles unknown subclasses. important: the composition of a feed can change between releases. write your code to handle instances of unknown subclasses. 1672apex reference guide connectapi output classes name type description available version" "type string type of the field. one of these values: 29.0 • address • blank • boolean • compound • createdby • date • datetime • email • lastmodifiedby • location • name • number • percent • phone • picklist • reference • text • time see also: connectapi.recordviewsection connectapi.abstractrecordview a view of any record in the org, including a custom object record. this object is used if a specialized object, such as user or chattergroup, isn’t available for the record type. this class is abstract. subclass of connectapi.actorwithid superclass of: • connectapi.recordsummary • connectapi.recordview name type description available version name string the localized name of the record. 29.0 1673apex reference guide connectapi output classes connectapi.abstractrepositoryfile a repository file. this class is abstract. subclass of connectapi.abstractrepositoryitem. superclass of: • connectapi.repositoryfiledetail • connectapi.repositoryfilesummary property name type description available version checkincomment string checkin comment of the file. 39.0 contentbody string text of the file’s content if available, otherwise null. 43.0 contentsize integer length in bytes of the content of the file. 39.0 downloadurl string url to the repository file content. 39.0 external string url of this file’s content in the external system. 39.0 contenturl external string url of this file in the external system. 39.0 documenturl external connectapi. external file permission information, such as available 39.0 filepermission externalfile groups, available permission types, and current information permissioninformation sharing status, or null if includeexternalfilepermissionsinfo is false. mimetype string mime type of the file. 39.0 previewurl string url to the thumbnail preview (240 x 180 png). 39.0 thumbnail previewurl string url to the big thumbnail preview (720 x 480 png). 39.0 thumbnailbig previewurl string url to the tiny thumbnail preview (120 x 90 png). 39.0 thumbnailtiny previewsurl string url to the previews. 39.0 title string title of the file. 39.0 versionid string id of the file version in the external system. 39.0 connectapi.abstractrepositoryfolder a repository folder. this class is abstract. 1674apex reference guide connectapi output classes subclass of connectapi.abstractrepositoryitem. superclass of: • connectapi.repositoryfolderdetail • connectapi.repositoryfoldersummary property name type description available version externalfolderurl string url of this folder in the external system. 39.0 folderitemsurl string url that lists the files and folders in this folder. 39.0 path string absolute path of the folder in the external system. 39.0 connectapi.abstractrepositoryitem a repository item. this class is abstract. superclass of: • connectapi.abstractrepositoryfile • connectapi.abstractrepositoryfolder property name type description available version createdby string name of the user who created the item. 39.0 createddate datetime date the item was created. 39.0 description string description of the item. 39.0 id string id of the item. 39.0 itemtypeurl string url to the item type information. 39.0 modifiedby string name of the user who last modified the item. 39.0 modifieddate datetime date the item was last modified. 39.0 motif connectapi.motif motif of the item. 39.0 name string name of the item. 39.0 repository connectapi. item external repository. 39.0 reference type string item type, file or folder. 39.0 url string the url to the item. 39.0 connectapi.abstractusermissionactivity user activity associated with missions. this class is abstract. 1675apex reference guide connectapi output classes superclass of: • connectapi.usermission • connectapi.usermissionactivity property name type description available version activitycount integer number of mission activities of the specified type for 45.0 the user. activitytype string type of mission activity for a user. values are: 45.0 • feeditemansweraquestion—user" "answered a question. • feeditemlikesomething—user liked a post or comment. • feeditemmarkanswerasbest—user marked an answer as the best answer. • feeditempostquestion—user posted a question. • feeditemreceiveacomment—user received a comment on a post. • feeditemreceivealike—user received a like on a post or comment. • feeditemreceiveananswer—user received an answer to a question. • feeditemwriteacomment—user commented on a post. • feeditemwriteapost—user made a post. • feeditemyouranswermarkedbest— user’s answer was marked as the best answer. see also: connectapi.usermissionactivitycollection connectapi.actionlinkdefinition the definition of an action link. action link definition can be sensitive to a third party (for example, oauth bearer token headers). for this reason, only calls made from the apex namespace that created the action link definition can read, modify, or delete the definition. in addition, the user making the call must have created the definition or have view all data permission. property name type description available version actionurl string the action link url. for example, a ui action link 33.0 url is a web page. a download action link url is a link to the file to download. ui and download action link urls are provided to clients. an api or 1676apex reference guide connectapi output classes property name type description available version apiasync action link url is a rest resource. api and apiasync action link urls aren’t provided to clients. links to salesforce can be relative. all other links must be absolute and start with https://. createddate datetime iso 8601 format date string, for example, 33.0 2011-02-25t18:24:31.000z. excludeduserid string id of a single user to exclude from performing the 33.0 action. if you specify an excludeduserid, you can’t specify a userid. groupdefault boolean true if this action is the default action link in the 33.0 action link group; false otherwise. there can be only one default action link per action link group. the default action link gets distinct styling in the salesforce ui. headers list action link types. id string the 18-character id for the action link definition. 33.0 label string a custom label to display on the action link button. 34.0 a label value can be set only in an action link template. action links have four statuses: newstatus, pendingstatus, successstatus, and failedstatus. these strings are appended to the label for each status: • label • label pending • label success • label failed for example, if the value of label is “see example,” the values of the four action link states are: see example, see example pending, see example success, and see example failed. an action link can use either label or labelkey to generate label names, it can’t use both. if label has a value, the value of labelkey is none. if labelkey has a value other than none, the value of label is null. labelkey string key for the set of labels to show in the user interface. 33.0 a set includes labels for these states: newstatus, pendingstatus, successstatus, failedstatus. for example, if you use the approve key, you get these labels: approve, pending, approved, failed. 1677apex reference guide connectapi output classes property name type description available version for a complete list of label keys, see action links labels in the connect rest api developer guide. method connectapi. the http method. one of these values: 33.0 httprequestmethod • httpdelete—returns http 204 on success. response body or output class is empty. • httpget—returns http 200 on success. • httphead—returns http 200 on success. response body or output class is empty. • httppatch—returns http 200 on success or http 204 if the response body or output class is empty. • httppost—returns http 201 on success or http 204 if the response body or output class is empty. exceptions are the batch posting resources and methods, which return http 200" "on success. • httpput—return http 200 on success or http 204 if the response body or output class is empty. modifieddate datetime iso 8601 format date string, for example, 33.0 2011-02-25t18:24:31.000z. requestbody string the request body for api and apiasync action 33.0 link types. note: escape quotation mark characters in the requestbody value. requires boolean true to require the user to confirm the action; 33.0 confirmation false otherwise. templateid string the id of the action link template from which to 33.0 instantiate this action link. if the action link isn’t associated with a template, the value is null. type connectapi. defines the type of action link. values are: 33.0 actionlinktype • api—the action link calls a synchronous api at the action url. salesforce sets the status to successfulstatus or failedstatus based on the http status code returned by your server. • apiasync—the action link calls an asynchronous api at the action url. the action remains in a pendingstatus state until a third party makes a request to 1678apex reference guide connectapi output classes property name type description available version /connect/action-links/actionlinkid to set the status to successfulstatus or failedstatus when the asynchronous operation is complete. • download—the action link downloads a file from the action url. • ui—the action link takes the user to a web page at the action url. note: invoking apiasync action links from an app requires a call to set the status. however, there isn’t currently a way to set the status of an action link using apex. to set the status, use connect rest api. see the action link resource in the connect rest api developer guide for more information. userid string the id of the user who can execute the action. if not 33.0 specified or null, any user can execute the action. if you specify a userid, you can’t specify an excludeduserid. see also: connectapi.actionlinkgroupdefinition connectapi.actionlinkdiagnosticinfo any diagnostic information that may exist for an executed action link. diagnostic info is provided only for users who can access the action link. property name type description available version diagnosticinfo string any diagnostic information returned when an action 33.0 link is executed. diagnostic information is provided only for users who can access the action link. url string the url for this action link diagnostic information. 33.0 connectapi.actionlinkgroupdefinition the definition of an action link group. information in the action link group definition can be sensitive to a third party (for example, oauth bearer token headers). for this reason, only calls made from the apex namespace that created the action link group definition can read, modify, or delete the definition. in addition, the user making the call must have created the definition or have view all data permission. 1679apex reference guide connectapi output classes property name type description available version actionlinks list the action link group. within an action link group, action links are displayed in the order listed in the actionlinks property of the connectapi.actionlinkgroupdefinitioninput class. within a feed item, action link groups are displayed in the order specified in the actionlinkgroupids property of the connectapi.associatedactionscapabilityinput class. category connectapi. indicates the priority and location of the action links. 33.0 platformaction values are: groupcategory • primary—the action link group is displayed in the body of the feed element. • overflow—the action link group is displayed in the overflow menu of the feed element. createddate datetime iso 8601 date string, for example, 33.0 2011-02-25t18:24:31.000z. executions connectapi. defines the number of times an action link can be 33.0 allowed actionlink executed. values are: executionsallowed • once—an action link can be executed only once across all users. • onceperuser—an action link can be executed only once for each user. • unlimited—an action link can be executed an unlimited number of times by each user. if the action link" "’s actiontype is api or apiasync, you can’t use this value. expirationdate datetime iso 8601 date string, for example, 33.0 2011-02-25t18:24:31.000z, that represents the date and time this action group expires and can no longer be executed. if the value is null, there isn’t an expiration date. id string 18-character id of the action link group definition. 33.0 modifieddate datetime iso 8601 date string, for example, 33.0 2011-02-25t18:24:31.000z. templateid string the id of the action link group template from which 33.0 to instantiate this action link group, or null if this group isn’t associated with a template. url string the url for this action link group definition. 33.0 1680apex reference guide connectapi output classes connectapi.activitysharingresult the results of sharing a captured email or event. property name type description available version success boolean whether the share operation succeeded or not. 39.0 connectapi.actor actor. this class is abstract. superclass of: • connectapi.actorwithid • connectapi.recommendedobject • connectapi.unauthenticateduser name type description available version name string name of the actor, such as the group name. 28.0 type string one of the following: 28.0 • file • group • recommendedobject (version 34.0 and later) • unauthenticateduser • user • record type name—the name of the record type, such as mycustomobject__c or account see also: connectapi.casecommentcapability connectapi.entityrecommendation connectapi.editcapability connectapi.feedentitysummary connectapi.feeditem connectapi.feeditemsummary connectapi.subscription connectapi.actorwithid actor with id. this class is abstract. 1681apex reference guide connectapi output classes subclass of: connectapi.actor superclass of: • connectapi.abstractrecordview • connectapi.articlesummary • connectapi.chattergroup • connectapi.contenthubrepository • connectapi.file • connectapi.relatedfeedpost • connectapi.user name type description available version id string actor’s 18-character id 28.0 motif connectapi. an icon that identifies the actor as a user, group, file, or custom 28.0 motif object. the icon isn’t the user or group photo, and it isn’t a preview of the file. the motif can also contain the object’s base color. mysubscription connectapi. if the context user is following the item, this contains information 28.0 reference about the subscription, else returns null. url string connect rest api url for the resource 28.0 see also: connectapi.feedelement connectapi.feedentitysummary connectapi.grouprecord connectapi.mentionsegment connectapi.recordsummarylist connectapi.address name type description available version city string name of the city 28.0 country string name of the country 28.0 formattedaddress string formatted address per the locale of the context user 28.0 state string name of the state, province, or so on 28.0 street string street number 28.0 1682" "apex reference guide connectapi output classes name type description available version zip string zip or postal code 28.0 see also: connectapi.datacloudcompany connectapi.datacloudcontact connectapi.userdetail connectapi.adjustordersummaryoutputrepresentation output representation of the financial changes for an adjust items action. for a preview action, these values are the expected output. for a submit action, these values are the actual output. subclass of connectapi.baseoutputrepresentation. property name type description available version changebalances connectapi. expected (for preview) or actual (for submit) financial 49.0 changeitem values for the price adjustment action. most of the outputrepresentation values match the change order values. if two change orders are returned, then these values combine them. the sign of a value in this output is the opposite of the corresponding value on a change order record. for example, a discount is a positive value in changebalances and a negative value on a change order record. infulfillment string id of the change order that holds the financial 55.0 changeorderid changes applicable to orderitemsummary quantities that are in the process of being fulfilled. this change order is only created for a request that specified an allocateditemschangeordertype of infulfillment. for an adjustpreview call, this value is always null. ordersummaryid string id of the ordersummary. 49.0 postfulfillment string id of the change order that holds the financial 49.0 changeorderid changes applicable to orderitemsummary quantities that have been fulfilled. for an adjustpreview call, this value is always null. prefulfillment string id of the change order that holds the financial 49.0 changeorderid changes applicable to orderitemsummary quantities that have not been fulfilled. if the request specified an allocateditemschangeordertype of prefulfillment, this change order also includes the changes applicable to orderitemsummary quantities 1683apex reference guide connectapi output classes property name type description available version that are in the process of being fulfilled. for an adjustpreview call, this value is always null. connectapi.alternative alternative representation for an extension on a feed element. property name type description available version text string text representation of the extension. 40.0 representation thumbnailurl string thumbnail url to the extension. 40.0 title string title of the extension. 40.0 connectapi.alternativepaymentmethodoutput alternative payment method details output. property name type description available version accountid string salesforce payments account to which this payment 56.0 method is linked. comments string details about a record added by a user. maximum of 56.0 1,000 characters. email string email address of the card holder. 56.0 gatewaytoken string a unique, alphanumeric id, called a token, that a 56.0 payment gateway generates when it first processes a payment. the token replaces the actual payment data so that the data is kept secure. this token is stored as encrypted text, and can be used for recurring payments. gatewaytoken string detailed information about the gateway token. 56.0 details name string name that you assign to the payment method object. 56.0 connectapi.announcement an announcement displays in a designated location in the salesforce ui until 11:59 p.m. on its expiration date, unless it’s deleted or replaced by another announcement. 1684apex reference guide connectapi output classes name type description available version expirationdate datetime the salesforce ui displays an announcement until 11:59 31.0 p.m. on this date unless another announcement is posted first. the salesforce ui ignores the time value in the expirationdate. however, you can use the time value to create your own display logic in your own ui. feedelement connectapi. the feed element that contains the body of the 31.0 feedelement announcement and its associated comments, likes, and so on. id string 18-character id of the announcement. 31.0 isarchived boolean specifies whether the announcement is archived. 36.0 sendemails boolean specifies whether the announcement is sent as an email 36.0 to all group members. url string the url to the announcement. 33.0 see also: connectapi.announcementpage connectapi.chattergroup connectapi.announcementpage a collection of announcements. name type description available version announcements" "list currentpageurl string connect rest api url identifying the current page. 31.0 nextpageurl string connect rest api url identifying the next page, or null 31.0 if there isn’t a next page. previouspageurl string connect rest api url identifying the previous page, or 31.0 null if there isn’t a previous page. connectapi.approvalcapability if a feed element has this capability, it includes information about an approval. subclass of connectapi.feedelementcapability. 1685apex reference guide connectapi output classes property name type description available version id string the work item id. the work item id is null if there 32.0 isn’t a pending work item associated with the approval record. posttemplate list processinstance string the process instance step id. the associated record 32.0 stepid represents one step in an approval process. status connectapi. the status of the approval. 32.0 workflowprocess status see also: connectapi.feedelementcapabilities connectapi.approvalintent approval intent for a social post. property name type description available version isrecallable boolean specifies whether the social post can be recalled 45.0 (true) or not (false). see also: connectapi.socialpostintents connectapi.approvalposttemplatefield name type description available version displayname string the field name. 28.0 displayvalue string the field value or null if the field is set to null. 28.0 record connectapi. a record id. 28.0 reference if no record exists or if the reference is null, this value is null. see also: connectapi.approvalcapability 1686apex reference guide connectapi output classes connectapi.articleitem article item in question and answers suggestions. property name type description available version id string id of the article. 32.0 rating double the rating of the article. 32.0 title string title of the article. 32.0 urllink string link url of the article. 32.0 viewcount integer number of votes given to the article. 32.0 see also: connectapi.questionandanswerssuggestions connectapi.articlesummary a knowledge article summary. subclass of connectapi.actorwithid property name type description available version articletype string type of the knowledge article. 37.0 knowledgearticle string id of the knowledge article version. 39.0 versionid lastpublisheddate datetime last published date of the knowledge article. 37.0 rating double the rating of the article. 37.0 summary string summary of the knowledge article contents. 37.0 title string title of the knowledge article. 37.0 urlname string url name of the knowledge article. 37.0 viewcount integer number of times the knowledge article has been 38.0 viewed. connectapi.associatedactionscapability if a feed element has this capability, it has platform actions associated with it. 1687apex reference guide connectapi output classes property name type description available version platformaction list element. platform action groups are returned in the order specified in the connectapi.associatedactions capabilityinput class. see also: connectapi.feedelementcapabilities connectapi.asyncoutputrepresentation output representation of the async operation. subclass of connectapi.baseasyncoutputrepresentation. no additional properties. see also: multipleensurefundsasync(multipleensurefundsinput) connectapi.multipleasyncoutputrepresentation connectapi.audience a personalization audience. property name type description available version criteria list customformula string custom formula for the audience criteria. for 48.0 example, (1 and 2) or 3. formulafiltertype connectapi. formula filter type for the personalization audience. 48.0 formulafiltertype values are: • allcriteriamatch—all audience criteria are true (and operation). • anycriterionmatches—any audience crit" "erion is true (or operation). • customlogicmatches—audience criteria match the custom formula (for example, (1 and 2) or 3). id string id of the audience. 48.0 name string name of the audience. 48.0 1688apex reference guide connectapi output classes property name type description available version targets list url string url to this audience. 48.0 see also: connectapi.audiencecollection connectapi.audiencecollection collection of personalization audiences. property name type description available version audiences list connectapi.audiencecriteria custom recommendation audience criteria. this class is abstract. this class is a superclass of: • connectapi.customlistaudiencecriteria • connectapi.newuseraudiencecriteria property name type description available version type connectapi. specifies the custom recommendation audience 36.0 recommendationaudience criteria type. one of these values: criteriatype • customlist—a custom list of users makes up the audience. • maxdaysincommunity—new members make up the audience. see also: connectapi.recommendationaudience connectapi.audiencecriteriadetail personalization audience criteria. 1689apex reference guide connectapi output classes property name type description available version criterion list criterionnumber integer number associated with the audience criterion in a 48.0 formula. for example, (1 and 2) or 3. if unspecified, criteria are assigned numbers in the order that they’re added. criterionoperator connectapi. operator used in the personalization audience 48.0 audiencecriteria criterion. values are: operator • contains • equal • greaterthan • greaterthanorequal • includes • lessthan • lessthanorequal • notequal • notincludes • startswith criteriontype connectapi. type of personalization audience criterion. values 48.0 audiencecriteria are: type • audience—criterion based on audience. • default—audience has no criteria. • domain—criterion based on domain. • fieldbased—criterion based on object fields. • geolocation—criterion based on location. • permission—criterion based on standard or custom permissions. • profile—criterion based on profile. see also: connectapi.audience connectapi.audiencecriteriondetail audience criterion information. 1690apex reference guide connectapi output classes property name type description available version value map mapping of an audience criterion value and field. 48.0 see also: connectapi.audiencecriteriadetail connectapi.audiencetarget personalization audience assigned to a target. property name type description available version audiencename string name of the audience assigned to the target. 48.0 id string id of the audience assigned to the target. 48.0 url string url to the audience assigned to the target. 48.0 see also: connectapi.target connectapi.audiencetargetassignment target assignments for a personalization audience. property name type description available version formulascope connectapi. formula scope of the target. 51.0 formulascope groupname string group name of the target. groups bundle related 48.0 target and audience pairs. id string id of the target. 48.0 ismatch boolean specifies whether the target matches the current 48.0 context (true) or doesn’t (false). priority integer priority of the target. within a group, priority 48.0 determines which target is returned if the user matches more than one audience. publishstatus connectapi. publish status of the target. values are: 48.0 publishstatus • draft • live targettype string type of target, indicating the nature of the data being 48.0 targeted. 1691apex reference guide connectapi output classes property name type description available version targetvalue string value of the target. 48.0 url string url to the target. 48.0 see also: connectapi." "audience connectapi.availablelocationoutputrepresentation a set of inventory locations that can combine to fulfill an order. property name type description available version locations list a list of inventory locations. 51.0 see also: findrouteswithfewestsplits(findrouteswithfewestsplitsinputrepresentation) findrouteswithfewestsplitsusingoci(findrouteswithfewestsplitsusingociinput) connectapi.findrouteswithfewestsplitsoutputrepresentation connectapi.findrouteswithfewestsplitsusingocioutputrepresentation connectapi.averagedistanceresultoutputrepresentation wraps inventory location shipping distance calculation results. property name type description available version distancecalculation connectapi. results of the shipping distance calculations. 51.0 distancecalculation outputrepresentation connectapi.paymentauthadjustmentresponse authorization adjustment output representation. property name type description available version accountid string id of the account containing the payment 51.0 authorization being adjusted. amount double amount of the payment authorization adjustment. 51.0 currencyisocode string three-letter iso 4217 currency code associated with 51.0 the payment authorization adjustment. 1692apex reference guide connectapi output classes property name type description available version effectivedate datetime date when the authorization adjustment becomes 51.0 effective. id string id of the paymentauthadjustment record. 51.0 paymentauthadjustmentnumber string system-defined reference number. 51.0 requestdate datetime date when the authorization adjustment transaction 51.0 occurred. status string status of the payment authorization 51.0 adjustment.possible values are: • canceled: the payment authorization reversal has been canceled. the parent authorization has returned to its pre-reversal balance. • draft: the payment authorization reversal can be edited before applying it against the parent authorization. • processed: the payment authorization reversal has been finalized. users can change the status as follows: • draft to processed • processed to canceled • draft to canceled connectapi.authreversalgatewayresponse authorization reversal gateway response representation. subclass of connectapi.abstractgatewayresponse. no additional properties. connectapi.authorizationreversalresponse authorization reversal output representation. property name type description available version error connectapi. error response representation for the authorization 51.0 errorresponse reversal. gatewayresponse connectapi. gateway response representation for authorization 51.0 authreversal reversal. gatewayresponse 1693apex reference guide connectapi output classes property name type description available version paymentauthadjustment connectapi. payment authorization adjustment response 51.0 paymentauth representation for the authorization reversal. adjustmentresponse paymentgatewaylogs list authorization reversal. connectapi.authorizationgatewayresponse payment gateway authorization response representation. subclass of connectapi.abstractgatewayresponse. property name type description available version gatewayauthorizationcode string gateway authorization code. 51.0 connectapi.authorizationresponse payment authorization output representation. property name type description available version error connectapi. error representation for the payment authorization. 51.0 errorresponse gatewayresponse connectapi. gateway response representation for the payment 51.0 authorizationgateway authorization. response paymentauthorization connectapi. payment authorization representation. 51.0 paymentauthorization response paymentgatewaylogs list authorization. paymentgroup connectapi. payment group representation for the payment 51.0 paymentgroupresponse authorization. paymentmethod connectapi. payment method representation for the payment 51.0 paymentmethodresponse authorization. connectapi.bannercapability if a feed element has this capability, it has a banner motif and style. subclass of connectapi.feedelementcapability. 1694apex reference guide connectapi output classes property name type description available version motif connectapi.motif a banner motif. 31.0 style connectapi.bannerstyle decorates a feed item with a color and set of icons. 31.0 possible value: • announcement—an announcement displays in a designated location in the salesforce ui until 11:59 p.m." "on its expiration date, unless it’s deleted or replaced by another announcement. see also: connectapi.feedelementcapabilities connectapi.bannerphoto a banner photo. property name type description available version bannerphotourl string url to the banner photo in a large format. this url 36.0 is available only to authenticated users. bannerphoto string 18-character version id of the banner photo. 36.0 versionid url string url to the banner photo. 36.0 see also: connectapi.chattergroup connectapi.userdetail connectapi.basemanagedsocialaccount base information describing a managed social account or fan page of a social network. this class is abstract. superclass of connectapi.managedsocialaccount property name type description available version defaultresponse string default response account to use when replying to 44.0 accountid posts sent to this account. displayname string real name (or user name if real name not available) 44.0 for this account on the social network. externalpictureurl string url to the account's avatar image. 44.0 1695apex reference guide connectapi output classes property name type description available version id string internal sfdc id for this managed social account. 44.0 label string label for the social account. 44.0 profileurl string url to the account's profile. 44.0 socialnetwork connectapi. social network that this account belongs to. values 44.0 socialnetworkprovider are: • facebook • googleplus • instagram • instagrambusiness • kakaotalk • kik • line • linkedin • messenger • other • pinterest • qq • rypple • sinaweibo • sms • snapchat • telegram • twitter • vkontakte • wechat • whatsapp • youtube uniquename string unique name used for distinguishing same name fan 44.0 pages; acts like a user name for a fan page. username string unique user name or handle for this account on the 44.0 social network. connectapi.baseasyncoutputrepresentation base order management async output class. this class is abstract. subclass of connectapi.baseoutputrepresentation. 1696apex reference guide connectapi output classes superclass of: • connectapi.asyncoutputrepresentation • connectapi.ensurefundsasyncoutputrepresentation • connectapi.ensurerefundsasyncoutputrepresentation property name type description available version background string id of the background operation. 48.0 operationid connectapi.baseinvoiceoutputrepresentation base order management invoice output class. this class is abstract. subclass of connectapi.baseoutputrepresentation. superclass of: • connectapi.changeordersinvoiceoutputrepresentation property name type description available version invoiceid string id of the created invoice. 56.0 connectapi.baseoutputrepresentation base order management output class. this class is abstract. superclass of: • connectapi.adjustordersummaryoutputrepresentation • connectapi.baseasyncoutputrepresentation • connectapi.baseinvoiceoutputrepresentation • connectapi.confirmheldfocapacityoutputrepresentation • connectapi.createcreditmemooutputrepresentation • connectapi.createmultipleinvoicesfromchangeordersoutputrepresentation • connectapi.createorderpaymentsummaryoutputrepresentation • connectapi.ensurefundsasyncoutputrepresentation • connectapi.ensurerefundsasyncoutputrepresentation • connectapi.findrouteswithfewestsplitsoutputrepresentation • connectapi.findrouteswithfewestsplitsusingocioutputrepresentation • connectapi.findrouteswithfewestsplitswithinventoryoutputrepresentation • connectapi.fulfillmentgroupoutputrepresentation • connectapi.fulfillmentordercancellineitemsoutputrepresentation • connectapi.fulfillmentorderinvoiceoutputrepresentation 1697apex reference guide connectapi output classes • connectapi.fulfillmentorderoutputrepresentation • connectapi.getfocapacityvaluesoutputrepresentation • connectapi.holdfocapacityoutputrepresentation • connectapi.multipleasyncoutputrepresentation • connectapi.multiplefulfillmentorderinvoicesoutputrepresentation • connectapi.multiplefulfillmentorderoutputrepresentation • connect" "api.ordersummaryoutputrepresentation • connectapi.previewcanceloutputrepresentation • connectapi.previewreturnoutputrepresentation • connectapi.productdetailsoutputrepresentation • connectapi.rankaveragedistanceoutputrepresentation • connectapi.releaseheldfocapacityoutputrepresentation • connectapi.returnitemsoutputrepresentation • connectapi.returnorderitemsplitlineoutputrepresentation • connectapi.returnorderoutputrepresentation • connectapi.submitcanceloutputrepresentation • connectapi.submitreturnoutputrepresentation property name type description available version errors list success boolean indicates whether the transaction was successful. 48.0 connectapi.batchresult the result of an operation returned by a batch method. namespace connectapi usage calls to batch methods return a list of batchresult objects. each element in the batchresult list corresponds to the strings in the list parameter passed to the batch method. the first element in the batchresult list matches the first string passed in the list parameter, the second element corresponds with the second string, and so on. if only one string is passed, the batchresult list contains a single element. example the following example shows how to obtain and iterate through the returned connectapi.batchresult objects. the code adds two group ids to a list. one of group ids is incorrect, which causes a failure when the code calls the batch method. after it calls the batch method, it iterates through the results to determine whether the operation was successful or not for each group id in the list. the 1698apex reference guide connectapi output classes code writes the id of every group that was processed successfully to the debug log. the code writes an error message for every failed group. this example generates one successful operation and one failure. list mylist = new list(); // add one correct group id. mylist.add('0f9d00000000oot'); // add one incorrect group id. mylist.add('0f9d00000000izf'); connectapi.batchresult[] batchresults = connectapi.chattergroups.getgroupbatch(null, mylist); // iterate through each returned result. for (connectapi.batchresult batchresult : batchresults) { if (batchresult.issuccess()) { // operation was successful. // print the group id. connectapi.chattergroupsummary groupsummary; if(batchresult.getresult() instanceof connectapi.chattergroupsummary) { groupsummary = (connectapi.chattergroupsummary) batchresult.getresult(); } system.debug('success'); system.debug(groupsummary.id); } else { // operation failed. print errors. system.debug('failure'); system.debug(batchresult.geterrormessage()); } } in this section: batchresult methods batchresult methods the following are instance methods for batchresult. in this section: geterror() if an error occurred, returns a connectapi.connectapiexception object providing the error code and description. geterrormessage() returns a string that contains an error message. geterrortypename() returns a string that contains the name of the error type. 1699apex reference guide connectapi output classes getresult() returns an object that contains the results of the batch operation. the object is typed according to the batch method. for example, if you call getmembershipbatch(), a successful call to batchresult getresult() returns a connectapi.groupmembership object. issuccess() returns a boolean that is set to true if the batch operation was successful for this object, false otherwise. geterror() if an error occurred, returns a connectapi.connectapiexception object providing the error code and description. signature public connectapi.connectapiexception geterror() return value type: connectapi.connectapiexception geterrormessage() returns a string that contains an error message. signature public string geterrormessage() return value type: string usage the error message doesn’t make a round trip through a visualforce view state, because exceptions can’t be serialized. geterrortypename() returns a string that contains the name of the error type. signature public string geterrortypename" "() return value type: string 1700apex reference guide connectapi output classes getresult() returns an object that contains the results of the batch operation. the object is typed according to the batch method. for example, if you call getmembershipbatch(), a successful call to batchresult getresult() returns a connectapi.groupmembership object. signature public object getresult() return value type: object issuccess() returns a boolean that is set to true if the batch operation was successful for this object, false otherwise. signature public boolean issuccess() return value type: boolean connectapi.blankrecordfield record field displayed as a place holder in a grid of fields. subclass of connectapi.abstractrecordfield connectapi.bookmarkscapability if a feed element has this capability, the context user can bookmark it. subclass of connectapi.feedelementcapability. property name type description available version isbookmarked boolean indicates whether the feed element has been 32.0 bycurrentuser bookmarked by the context user (true) or not (false). see also: connectapi.feedelementcapabilities connectapi.bookmarksummary summary of a bookmark. 1701apex reference guide connectapi output classes subclass of connectapi.userfeedentityactivitysummary no additional properties. connectapi.botinforepresentation information about the bot associated with the conversation application. property name type description available version botid string id of the bot. 54.0 botname string name of the bot. 54.0 lastmodifieddate datetime last modified date of the bot definition. 54.0 connectapi.botversionactivationinfo success or failure information of the bot version activation. property name type description available version isactivated boolean indicates whether the bot is active or not. 51.0 messages list failure messages. 50.0 success boolean indicates whether the activation was successful or 50.0 not. connectapi.bundlecapability if a feed element has this capability, it has a container of feed elements called a bundle. this class is abstract. subclass of connectapi.feedelementcapability. superclass of: • connectapi.genericbundlecapability • connectapi.trackedchangebundlecapability . property name type description available version bundletype connectapi.bundletype defines this feed element's bundle type. the bundle 31.0 type determines what additional information appears in the bundle. page connectapi. a collection of feed elements. 31.0 feedelementpage 1702apex reference guide connectapi output classes property name type description available version totalelements integer the total number of feed elements that this bundle 31.0 aggregates. see also: connectapi.feedelementcapabilities connectapi.callcollaborationcapability if a feed element has this capability, it has a recording comment. subclass of connectapi.feedelementcapability. property name type description available version commentendtime integer end time of the comment on the media player, in 51.0 seconds. commentstarttime integer start time of the comment on the media player, in 51.0 seconds. see also: connectapi.feedelementcapabilities connectapi.candidateanswersstatus the status of candidate answers on a feed element. property name type description available version hascandidate boolean indicates whether candidate answers are available 41.0 answers for a question. hascandidate boolean indicates whether any candidate answers are 41.0 answerspublished published. hascandidate boolean indicates whether any candidate answers are rated. 41.0 answersrated see also: connectapi.questionandanswerscapability connectapi.canvascapability if a feed element has this capability, it renders a canvas app. subclass of connectapi.feedelementcapability. 1703apex reference guide connectapi output classes property name type description available version description string a description of the canvas app. the maximum size 32.0 is 255 characters. developername string the api name (developer name) of the connected 32.0 app. height string the height of the canvas app in pixels. 32.0 icon connectapi.icon the icon for the canvas app. 32.0 namespaceprefix string a unique namespace prefix for the canvas app. 32.0 parameters string json parameters passed to the canvas app. 32" ".0 thumbnailurl string a thumbnail url to a preview image. the maximum 32.0 thumbnail size is 120 pixels by 120 pixels. title string a title for the canvas link. 32.0 see also: connectapi.feedelementcapabilities connectapi.capacityresponseoutputrepresentation response to a request related to a location’s fulfillment capacity. property name type description available version actionrequestid string unique string that identifies the original capacity 55.0 request. error connectapi. error returned by the request, if any. 55.0 errorresponse success boolean indicates whether the request was successful. 55.0 connectapi.capturegatewayresponse gateway capture response. subclass of connectapi.abstractgatewayresponse. no additional properties. connectapi.captureresponse capture output. 1704apex reference guide connectapi output classes property name type description available version error connectapi. error response representation for an authorization 50.0 errorresponse capture. gatewayresponse connectapi. gateway log response containing details about 50.0 capturegatewayresponse gateway logs created during the process of the capture request. payment connectapi. payment response object for the capture request. 50.0 paymentresponse contains the information related to a payment object created during request processing. paymentgatewaylogs list paymentgroup connectapi. payment group associated with the capture request. 50.0 paymentgroupresponse connectapi.cardpaymentmethodoutput card payment method details output. property name type description available version accountid string salesforce payments account to which this payment 56.0 method is linked. autopay boolean indicates whether a token for recurring payments is 56.0 being requested (true) or not (false). the token lets the payment method be used for recurring payments. cardbin string bank identification number (bin). the bin is the first 56.0 4-6 numbers on a payment card that identifies the card issuer. cardcategory connectapi. 56.0 • creditcard cardcategory • debitcard cardholderfirstname string first name of the card holder 56.0 cardholderlastname string last name of the card holder 56.0 cardholdername string full name of card holder 56.0 cardlastfour string last four digits on a card. 56.0 cardtype connectapi.cardtype credit card issuer. 56.0 • americanexpress • dinersclub • jcb 1705apex reference guide connectapi output classes property name type description available version • maestro • mastercard • visa comments string details about a record added by a user. maximum of 56.0 1,000 characters. displaycardnumber string card displayed number 56.0 email string email address of the card holder. 56.0 expirymonth integer card expiration month 56.0 expiryyear integer card expiration year 56.0 nickname string optional card nickname 56.0 startmonth integer month when card becomes active 56.0 startyear integer year when card becomes active 56.0 connectapi.cartcoupon cart coupon representation. property name type description available version cartcouponid string id of the cart coupon code. 54.0 couponcode string the coupon code a buyer can use to manually apply 54.0 a promotion to the cart. connectapi.cartcouponcollection collection of coupons related to a cart. property name type description available version cartcoupons lsit collection of coupons. 54.0 cartid string id of the cart. 54.0 cartstatus connectapi. status of the cart. values are: 54.0 cartstatus • active—cart is active. • checkout—cart is in checkout. • closed—cart is closed. • pendingdelete—cart is pending delete, for example, a user deleted the cart but the job hasn’t completed yet. 1706apex reference guide connectapi output classes property name type description available version • processing—cart is processing. ownerid string id of the user who owns the cart. 54.0 connectapi.cartcouponlist list of coupons for a cart. property name type description available version coupons lsit list of coupons associated with a cart. 54.0 connectapi" ".cartinventoryitemreservationoutputrepresentation (developer preview) inventory item reservation. note: this feature is available as a developer preview. it isn’t generally available unless or until salesforce announces its general availability in documentation or in press releases or public statements. all commands, parameters, and other features are subject to change or deprecation at any time, with or without notice. property name type description available version errorcode string error code for this reservation item. 58.0 errormessage string error message for this reservation item. 58.0 id string id for this reservation item. 58.0 itemreservation string item reservation source id for this reservation item. 58.0 sourceid productid string product id for this reservation item. 58.0 quantity double quantity for this reservation item. 58.0 reservedat string reserved at location or group id for this reservation 58.0 locationid item. stockkeepingunit string stock keeping unit for this reservation item. 58.0 connectapi.cartinventoryreservationoutputrepresentation (developer preview) inventory reservation note: this feature is available as a developer preview. it isn’t generally available unless or until salesforce announces its general availability in documentation or in press releases or public statements. all commands, parameters, and other features are subject to change or deprecation at any time, with or without notice. 1707apex reference guide connectapi output classes property name type description available version errorcode string error code for this reservation. 58.0 errormessage string error message for this reservation. 58.0 inventoryitem list reservation string reservation identifier. 58.0 identifier success boolean indicates whether the transaction was successful. 58.0 connectapi.cartitem an item in a cart. subclass of connectapi.abstractcartitem property name type description available version currencyisocode string currency iso code of the cart. 57.0 itemizedadjustment string total itemized adjustment amount for the item, 52.0 amount including promotions and excluding taxes. listprice string list price for the item. 49.0 salesprice string sales price for the item. 49.0 totaladjustment string total adjustment amount for the item. 50.0 amount totalamount string total amount for the item. 49.0 totallistprice string total list price for the item. 49.0 totalprice string total price for the item including adjustments but 49.0 excluding taxes. totaltax string total tax for the item. 49.0 unitadjustedprice string unit price, including adjustments, for the item. this 50.0 value is informational only and isn’t used in pricing calculations. unitadjustment string adjustments made to the unit price for the item. this 50.0 amount value is informational only and isn’t used in pricing calculations. 1708apex reference guide connectapi output classes connectapi.cartitemcollection cart item collection. property name type description available version cartitems list cartsummary connectapi. summary of the cart. 49.0 cartsummary currentpagetoken string token identifying the current page. 49.0 currentpageurl string connect rest api url identifying the current page. 49.0 haserrors boolean specifies whether at least one of the results contains 49.0 an error. nextpagetoken string token identifying the next page, or null if there 49.0 isn’t a next page. nextpageurl string connect rest api url identifying the next page, or 49.0 null if there isn’t a next page. previouspagetoken string token identifying the previous page, or null if 49.0 there isn’t a previous page. previouspageurl string connect rest api url identifying the previous page, 49.0 or null if there isn’t a previous page. connectapi.cartitemproduct product summary for a cart item. property name type description available version fields map map of product fields and values. 49.0 name string name of the product. 49.0 productid string id of the product. 49.0 purchasequantityrule connectapi. if one exists, purchase quantity rule for the product. 52.0 purchasequantity rule sku string sku of the product. 49.0 thumbnailimage connectapi." "thumbnail image of the product. 49.0 productmedia 1709apex reference guide connectapi output classes property name type description available version variationattributes map see also: connectapi.abstractcartitem connectapi.wishlistitem connectapi.cartitempromotioncollectionoutputrepresentation promotions for the items in a cart. property name type description available version currencyisocode string currency code associated with the cart. 53.0 items map connectapi.cartitemresult result after requesting a cart item. property name type description available version cartitem connectapi. cart item. 49.0 abstractcartitem message string message when the request isn’t successful. 49.0 status string status for the request. 49.0 see also: connectapi.cartitemcollection connectapi.wishlisttocartresult connectapi.cartitemwithoutprice an item without price information in a cart. subclass of connectapi.abstractcartitem no additional properties. 1710apex reference guide connectapi output classes connectapi.cartmessage cart message. property name type description available version message string cart message. 49.0 messageid string id of the object supplying the message. 49.0 relatedentityid string id of the entity, for example, cart, cart item, or cart 49.0 tax, associated with the message. severity connectapi. severity of cart message. values are: 49.0 cartmessageseverity • error • info • warning type string type of message. standard values include 49.0 inventory, taxes, pricing, shipping, entitlement, systemerror, and other. visible boolean specifies whether the message is visible (true) or 49.0 dismissed (false). see also: connectapi.cartmessagessummary connectapi.cartmessagessummary cart messages summary. property name type description available version errorcount integer in connectapi.cartitemresult, the count 49.0 of messages with the error severity level. haserrors boolean specifies whether there are messages related to the 49.0 entity (true) or not (false). limitedmessages list list of messages related to the cart item. in connectapi.cartsummary, each message can be related to the cart or to another cart-related entity. relatedentityid string in connectapi.cartitemresult, the id of 49.0 the related cart item. in connectapi.cartsummary, each message can be related to the cart or to another cart-related entity. 1711apex reference guide connectapi output classes property name type description available version totallineitems integer in connectapi.cartitemresult, either 50.0 witherrors null if the cart item has no errors or 1 if the cart item has errors. in connectapi.cartsummary, the total number of product line items that contain errors. see also: connectapi.abstractcartitem connectapi.cartmessagesvisibilityresult result of setting the visibility for cart messages. property name type description available version visibility boolean specifies whether cart messages are set to visible 50.0 (true) or not (false). connectapi.cartproductattribute product attribute for a cart item. property name type description available version label string label or display name of the attribute. 50.0 sequence integer sequence of the attribute within the attribute set. 50.0 value string display value of the attribute. 50.0 see also: connectapi.cartitemproduct connectapi.cartpromotioncollection all the promotions associated with the cart. property name type description available version cartid string id of the cart. 53.0 cartstatus connectapi. status of the cart. values are: 53.0 cartstatus • active—cart is active. • checkout—cart is in checkout. • closed—cart is closed. 1712apex reference guide connectapi output classes property name type description available version • pendingdelete—cart is pending delete, for example, a user deleted the cart but the job hasn’t completed yet. • processing—" "cart is processing. currencyisocode string currency iso code of the cart. 53.0 promotions list connectapi.cartpromotionlist a list of promotions for a cart. property name type description available version promotions list connectapi.cartpromotionoutputrepresentation a promotion associated with a cart. property name type description available version adjustmentamount string adjustment amount out of the promotion. 53.0 couponcode string coupon code for a promotion. a coupon code is 54.0 available only for manual promotions, not for automatic promotions. currencyisocode string currency iso code associated with the cart. 57.0 displayname string localized display name of the promotion. 52.0 promotionid string id of the promotion. 53.0 targettype connectapi. promotion target type. values are: 53.0 cartpromotion • cart—promotion targets a cart. type • item—promotion targets an item in a cart. termsandconditions string localized terms and conditions for the promotion. 53.0 connectapi.cartsummary a cart summary. 1713apex reference guide connectapi output classes property name type description available version accountid string id of the account for the cart. 49.0 cartid string id of the cart. 49.0 currencyisocode string three-letter iso 4217 currency code associated with 49.0 the cart. grandtotalamount string grand total amount including shipping and tax for 49.0 items in the cart, in the currency of the cart. issecondary boolean specifies whether the cart is secondary (true) or 53.0 not (false). name string name of the cart. 49.0 ownerid string id of the owner of the cart. 49.0 ownerorderid string id of the owner of the order. 58.0 purchaseordernumber string purchase order for the cart. 50.0 status connectapi. status of the cart. values are: 49.0 cartstatus • active—cart is active. • checkout—cart is in checkout. • closed—cart is closed. • pendingdelete—cart is pending delete, for example, a user deleted the cart but the job hasn’t completed yet. • processing—cart is processing. taxtype string tax type of the cart. 55.0 • gross—gross taxation policy. • net—net taxation policy. totalchargeamount string total amount for shipping and other charges in the 49.0 currency of the cart. totallistprice string total list price for the cart. 49.0 totalproductamount string total amount including discounts, but excluding 49.0 shipping and tax, for product items in the cart. totalproductamount string total product amount, including promotions. 52.0 afteradjustments totalproductcount string total count of items in the cart. 49.0 totalpromotional string total promotional adjustment amount for items in 52.0 adjustmentamount the cart. totaltaxamount string total tax amount for the cart, including tax on 49.0 shipping, if applicable. 1714apex reference guide connectapi output classes property name type description available version type connectapi. type of cart.value is cart. 49.0 carttype uniqueproductcount integer total count of unique items, or skus, in the cart. 49.0 webstoreid string id of the webstore of the cart. 49.0 see also: connectapi.cartitemcollection connectapi.carttowishlistresult result of copying products from a cart to a wishlist. property name type description available version productsaddedcount integer number of products copied from the cart to the 50.0 wishlist. wishlistid string id of the wishlist that cart products were copied to. 50.0 connectapi.casecommentcapability if a feed element has this capability, it has a case comment on the case feed. subclass of connectapi.feedelementcapability. property name type description available version actortype connectapi. specifies the type of user who made the comment. 32.0 caseactortype createdby connectapi.actor information about the user who created the 32.0 comment. createddate datetime iso 8601 date string, for example, 32.0 2011-02-25t18:24:31.000" "z. eventtype connectapi. specifies an event type for a comment in the case 32.0 casecomment feed. eventtype id string 18-character id of case comment. 32.0 published boolean specifies whether the comment has been published. 32.0 1715apex reference guide connectapi output classes property name type description available version text string text of the case comment. 32.0 see also: connectapi.feedelementcapabilities connectapi.cdpactionresponse customer data platform action response. this class is abstract. superclass of: • connectapi.cdpcalculatedinsightstandardactionresponserepresentation property name type description available version errors list success boolean indicates whether the call was successful (true) or 57.0 not (false). connectapi.cdpcalculatedinsightpage collection of calculated insights. property name type description available version collection connectapi. collection of calculated insights. 57.0 cdpcalculated insightpagedata connectapi.cdpcalculatedinsightpagedata calculated insight collection data. property name type description available version count integer number of results returned in the page. 57.0 currentpagetoken string token identifying the current page. 57.0 currentpageurl string connect rest api url identifying the current page. 57.0 items list 1716apex reference guide connectapi output classes property name type description available version nextpagetoken string token identifying the next page, or null if there 57.0 isn’t a next page. nextpageurl string connect rest api url identifying the next page, or 57.0 null if there isn’t a next page. previouspagetoken string token identifying the previous page, or null if 57.0 there isn’t a previous page. previouspageurl string connect rest api url identifying the previous page, 57.0 or null if there isn’t a previous page. total integer total row count of calculated insights. 57.0 see also: connectapi.cdpcalculatedinsightpage connectapi.cdpcalculatedinsightdatasource calculated insight data source. property name type description available version sourceapiname string data source api name. 57.0 type string data source type. 57.0 see also: connectapi.cdpcalculatedinsightdimension connectapi.cdpcalculatedinsightmeasure connectapi.cdpcalculatedinsightdimension calculated insight dimension. property name type description available version apiname string api name of the dimension. 57.0 creationtype string creation type of the dimension. 57.0 datasource connectapi. data source of the dimension. 57.0 cdpcalculated insightdatasource datatype string data type of the dimension. 57.0 dategranularity string date granularity of the dimension. 57.0 1717apex reference guide connectapi output classes property name type description available version displayname string display name of the dimension. 57.0 fieldrole string field role of the dimension. 57.0 formula string formula of the dimension. 57.0 see also: connectapi.cdpcalculatedinsightoutput connectapi.cdpcalculatedinsightmeasure calculated insight measure. property name type description available version apiname string api name of the measure. 57.0 creationtype string creation type of the measure. 57.0 datasource connectapi. data source of the measure. 57.0 cdpcalculated insightdatasource datatype string data type of the measure. 57.0 displayname string display name of the measure. 57.0 fieldaggregationtype string field aggregation type of the measure. 57.0 fieldrole string field role of the measure. 57.0 formula string formula of the measure. 57.0 see also: connectapi.cdpcalculatedinsightoutput connectapi.cdpcalculatedinsightoutput calculated insight. property name type description available version apiname string api name of the calculated insight. 57.0 calculatedinsight string status of the calculated insight. 57.0 status creationtype string creation type of the calculated insight. 57.0 dataspace string data space of the calculated insight. 57.0 1718apex reference" "guide connectapi output classes property name type description available version definitionstatus string definition status of the calculated insight. 57.0 definitiontype string definition type of the calculated insight. 57.0 description string description of the calculated insight. 57.0 dimensions list displayname string display name of the calculated insight. 57.0 expression string expression of the calculated insight. 57.0 isenabled boolean specifies whether the calculated insight is enabled 57.0 (true) or not (false). lastcalcinsight string last calculated insight status date and time. 57.0 statusdatetime lastcalcinsight string last calculated insight status error code. 57.0 statuserrorcode lastrundatetime string last run date and time of the calculated insight. 57.0 lastrunstatus string last run status of the calculated insight. 57.0 lastrunstatus string last run status date and time of the calculated insight. 57.0 datetime lastrunstatus string last run status error code of the calculated insight. 57.0 errorcode measures list see also: connectapi.cdpcalculatedinsightpagedata connectapi.cdpcalculatedinsightstandardactionresponserepresentation response of the calculated insight run action. subclass of connectapi.cdpactionresponse. no additional properties. connectapi.cdperrorresponse error response. 1719apex reference guide connectapi output classes property name type description available version errorcode string error code. 57.0 message string message stating the reason for the error, if any. 57.0 see also: connectapi.cdpactionresponse connectapi.cdpidentityresolutionmatchcriterionoutput identity resolution ruleset's match rule criterion. property name type description available version entityname string api name of the data model object the match rule 57.0 applies to. fieldname string name of the field the criterion applies to. 57.0 matchmethodtype connectapi. match method for a match rule criterion. values are: 57.0 cdpidentityresolution • exact—exact match. matchmethodtype • exactnormalized—exact normalized match. • fuzzy—fuzzy match with medium precision. • fuzzyhigh—fuzzy match with high precision. • fuzzylow—fuzzy match with low precision. partyidentification connectapi. party identifier information. 57.0 info cdpidentityresolution matchcriterionparty identificationinfooutput shouldmatchonblank boolean specifies whether blank fields can be used for 57.0 matching (true) or not (false). see also: connectapi.cdpidentityresolutionmatchruleoutput connectapi.cdpidentityresolutionmatchcriterionpartyidentificationinfooutput information when party identification is used in an identity resolution ruleset's match rule criterion. property name type description available version partyname string party identification name. 57.0 1720apex reference guide connectapi output classes property name type description available version partytype string party identification type. 57.0 see also: connectapi.cdpidentityresolutionmatchcriterionoutput connectapi.cdpidentityresolutionmatchruleoutput identity resolution ruleset’s match rule. property name type description available version criteria list label string user friendly name for the identity resolution match 57.0 rule. see also: connectapi.cdpidentityresolutionoutput connectapi.cdpidentityresolutionoutput identity resolution ruleset. property name type description available version anonymousunified long count of anonymous unified profiles created by 57.0 profiles running the identity resolution ruleset. configurationtype connectapi. source object for an identity resolution ruleset. values 57.0 cdpidentityresolution are: configurationtype • account • individual consolidationrate double consolidation rate resulting from the run of an 57.0 identity resolution ruleset. dataspacename string data space used as source data for an identity 57.0 resolution ruleset. description string description of the identity resolution ruleset. 57." "0 doesrun boolean specifies whether automatic job run scheduling is 57.0 automatically enabled for the ruleset (true) or not (false). if unspecified, defaults to false. 1721apex reference guide connectapi output classes property name type description available version id string identity resolution ruleset's id. this is not the identity 57.0 resolution's extended ruleset id (rulesetid). knownunified long count of known unified profiles created by running 57.0 profiles the identity resolution ruleset. label string user friendly name of the identity resolution ruleset. 57.0 lastjobcompleted datetime date and time the last job completed. 57.0 lastjobstatus string last job's status. possible values are: 57.0 • success • in_progress • fail • scheduled • skipped matchrules list matchedsource long count of matched source profiles identified by 57.0 profiles running the identity resolution ruleset. objectapiname string object name of the identity resolution ruleset. 57.0 reconciliationrules list rulesetid string extension id of a ruleset. the ruleset id must be 57.0 unique and no longer than 4 characters. this id is not the identifying id for the ruleset. rulesetstatus string status of a ruleset job. possible values are: 57.0 • new • publishing • published • error • deleting • delete_failed sourceprofiles long count of source profiles that were processed by a 57.0 ruleset job. 1722apex reference guide connectapi output classes property name type description available version totalunifiedprofiles long count of unified profiles created by running the 57.0 identity resolution ruleset. see also: connectapi.cdpidentityresolutionsoutput connectapi.cdpidentityresolutionreconciliationfieldruleoutput identity resolution ruleset's reconciliation rule for a field. property name type description available version fieldname string the field that this reconciliation rule applies to. 57.0 ruletype connectapi. default reconciliation rule applied to fields in the 57.0 cdpidentityresolution object the reconciliation rule applies to. values are: reconciliationruletype • lastupdated • mostfrequent • sourcesequence shouldignore boolean specifies whether to ignore an empty value (true) 57.0 emptyvalue or not (false). sources list see also: connectapi.cdpidentityresolutionreconciliationruleoutput connectapi.cdpidentityresolutionreconciliationruleoutput identity resolution ruleset’s reconciliation rule for an object. property name type description available version entityname string api name of the data model object the reconciliation 57.0 rule applies to. fields list linkdmoname string api name of the unified link object created by the 57.0 identity resolution process. 1723apex reference guide connectapi output classes property name type description available version ruletype connectapi. default reconciliation rule applied to fields in the 57.0 cdpidentityresolution object the reconciliation rule applies to. values are: reconciliationruletype • lastupdated • mostfrequent • sourcesequence shouldignore boolean specifies whether to ignore an empty value (true) 57.0 emptyvalue or not (false). sources list unifieddmoname string api name of the unified data model object created 57.0 by the identity resolution process. see also: connectapi.cdpidentityresolutionoutput connectapi.cdpidentityresolutionreconciliationsourceoutput source for an identity resolution default reconciliation rule or field-specific rule using the" "sourcesequence match method. property name type description available version name string if the ruletype for a reconciliation rule is 57.0 sourcesequence, api name of a source data lake object. see also: connectapi.cdpidentityresolutionreconciliationruleoutput connectapi.cdpidentityresolutionreconciliationfieldruleoutput connectapi.cdpidentityresolutionrunnowoutput identity resolution ruleset run now output. property name type description available version resultcode connectapi. result of an identity resolution ruleset job run. values 57.0 cdpidentityresolution are: runnowresultcode • exceededmaximumnumberof successfulrunsallowedin24hours 1724apex reference guide connectapi output classes property name type description available version • identityresolutionjobisalready running • nopendingchangesjobrunskipped • successfullysubmittedidentity resolutionjobrunrequest connectapi.cdpidentityresolutionsoutput identity resolution rulesets. property name type description available version identityresolutions list connectapi.cdpquerydataoutput query data output. property name type description available version data list result data set. 54.0 connectapi.cdpquerymetadataitem metadata item. property name type description available version placeinorder integer attribute place order in the result. 55.0 type string metadata type for column. 55.0 typecode integer metadata type code. 55.0 see also: connectapi.cdpqueryoutputv2 connectapi.cdpquerymetadataoutput query metadata result. 1725apex reference guide connectapi output classes property name type description available version metadata list metadata set. 52.0 connectapi.cdpqueryoutput query result. property name type description available version data list result data set. 52.0 done boolean specifies whether the query is done (true) or not 52.0 (false). endtime string query end time. 52.0 metadata map result metadata set. 52.0 queryid string query id. 52.0 rowcount integer number of rows in the result data set. 52.0 starttime string query start time. 52.0 connectapi.cdpqueryoutputv2 query output for the v2 api. property name type description available version data list (in version 55.0 and later) list (version 54.0 only) done boolean specifies whether the query is done (true) or not 54.0 (false). endtime string query end time. 54.0 metadata map (version 55.0 and later) map (version 54.0 only) 1726apex reference guide connectapi output classes property name type description available version nextbatchid string next batch id. 54.0 use this property as the nextbatchid parameter in the nextbatchansisqlv2(nextbatchid) method to get the next batch of data. queryid string query id. 54.0 rowcount integer number of rows in the result data set. 54.0 starttime string query start time. 54.0 connectapi.cdpqueryv2row row in the query output for the v2 api. property name type description available version rowdata list row values. 55.0 see also: connectapi.cdpqueryoutputv2 connectapi.cdpsegmentactionoutput segment action. property name type description available version errorcode string error code associated with the action, if any. 57.0 errormessage string error message associated with the action, if any. 57.0 jobid string job id for the publish job. 56.0 partitionid string id of the partition. 56.0 publishstatus string publish status of the segment. 57.0 segmentid string id of the segment. 56.0 connectapi.cdpsegmentcontaineroutput segment container. property name type description available version batchsize integer number of items returned. 56" ".0 1727apex reference guide connectapi output classes property name type description available version offset integer number of rows skipped before returning results. 56.0 orderbyexpression string expression indicating how results are ordered. 56.0 segments list connectapi.cdpsegmentdbtmodel segment dbt model. property name type description available version name string dbt model name. 55.0 sql string dbt model sql. 55.0 see also: connectapi.cdpsegmentdbtpipeline connectapi.cdpsegmentdbtpipeline segment dbt pipeline. property name type description available version models list see also: connectapi.cdpsegmentoutput connectapi.cdpsegmentoutput segment. property name type description available version apiname string api name of the segment. 56.0 dataspace string data space of the segment. 57.0 description string segment description. 55.0 developername string segment developer name. 55.0 displayname string segment display name. 57.0 1728apex reference guide connectapi output classes property name type description available version excludecriteria string segment exclude criteria. 57.0 includecriteria string segment include criteria. 57.0 includedbt connectapi. segment dbt pipeline. 55.0 cdpsegment dbtpipeline lookalikecriteria reserved for future use. 56.0 marketsegment string id of the market segment definition. 55.0 definitionid marketsegmentid string id of the market segment. 56.0 nextpublish string date and time of the next segment publish. 57.0 datetime publishinterval string segment publish interval. 55.0 publishschedule string publish schedule end date. 55.0 enddate publishschedule string publish schedule start date time. 55.0 startdatetime publishstatus string segment publish status. 55.0 segmentmembership string name of the segment membership table. 56.0 table segmentonapiname string api name of the segmenton entity. 56.0 segmentonid string id of the dmo segment. 55.0 segmentstatus string segment status. 55.0 segmenttype string type of segment. 56.0 see also: connectapi.cdpsegmentcontaineroutput connectapi.changeitemoutputrepresentation the financial changes resulting from a change to one or more orderitemsummaries. most of the values represent the deltas of the values on the associated ordersummary. the sign of each value is the opposite of the corresponding value on a change order record. for example, a discount is a positive value here and a negative value on a change order record. property name type description available version grandtotalamount double change to the grandtotalamount field. 48.0 1729apex reference guide connectapi output classes property name type description available version totaladjdelivery double change to the totaladjdeliveryamtwithtax field. 49.0 amtwithtax totaladjdist double change to the totaladjdistamountwithtax field. 49.0 amountwithtax totaladjproduct double change to the totaladjproductamtwithtax field. 49.0 amtwithtax totaladjusted double change to the totaladjusteddeliveryamount field. 48.0 deliveryamount totaladjusted double change to the totaladjusteddeliverytaxamount field. 48.0 deliverytaxamount totaladjusted double change to the totaladjustedproductamount field. 48.0 productamount totaladjusted double change to the totaladjustedproducttaxamount field. 48.0 producttaxamount totaladjustment double change to the totaladjustmentdistributedamount 48.0 distributedamount field. totaladjustment double change to the 48.0 distributedtaxamount totaladjustmentdistributedtaxamount field. totalamount double change to the totalamount field. 48.0 totalexcess double amount of excess funds available on the 48.0 fundsamount orderpaymentsummaries related to the ordersummary. it is equal to the captured amount that is owed as a refund but is not associated with an invoice or credit memo. excess funds normally occur when order items are canceled before fulfillment but after payment has" "been captured. this situation is not common in the us, where funds are normally authorized but not captured until the fulfillment process begins. this value includes all current excess funds related to the ordersummary, not only the funds related to the current change. totalfeeamount double total amount of the fees charged for the change. 57.0 totalfeetaxamount double total amount of tax on the fees charged for the 57.0 change. totalrefundable double total amount available to be refunded. it is the sum 48.0 amount of the excess funds and any outstanding change order grand total amounts that apply to post-fulfillment changes. this value includes all current refundable amounts related to the 1730apex reference guide connectapi output classes property name type description available version ordersummary, not only the amount related to the current change. totalrequired double the required funds associated with added order 54.0 fundsamount items. totaltaxamount double change to the totaltaxamount field. 48.0 see also: connectapi.previewcanceloutputrepresentation connectapi.previewreturnoutputrepresentation connectapi.submitcanceloutputrepresentation connectapi.submitreturnoutputrepresentation connectapi.chatteractivity chatter activity. name type description available version commentcount integer total number of comments in the org or site made by the user. 28.0 commentreceived integer total number of comments in the org or site received by the user. 28.0 count likereceived integer total number of likes and upvotes (in version 45.0 and later) on posts 28.0 count and comments in the org or site received by the user. postcount integer total number of posts in the org or site made by the user. 28.0 see also: connectapi.userdetail connectapi.chatteractivitysummary summary of chatter activity. subclass of connectapi.userfeedentityactivitysummary property name type description available version commentcount integer total number of comments in the org or site made 42.0 by the user. commentreceived integer total number of comments in the org or site received 42.0 count by the user. 1731apex reference guide connectapi output classes property name type description available version likereceived integer total number of likes and upvotes (in version 45.0 42.0 count and later) on posts and comments in the org or site received by the user. postcount integer total number of posts in the org or site made by the 42.0 user. connectapi.chatterconversation chatter conversation. name type description available version conversationid string id for the conversation. 29.0 conversationurl string connect rest api url identifying the conversation. 29.0 members list messages connectapi. content of the conversation. 29.0 chatter messagepage read boolean specifies if the conversation is read (true) or not read 29.0 (false). connectapi.chatterconversationpage chatter conversation page. name type description available version conversations list currentpagetoken string token identifying the current page. 29.0 currentpageurl string connect rest api url identifying the current page. 29.0 nextpagetoken string token identifying the next page, or null if there isn’t 29.0 a next page. nextpageurl string connect rest api url identifying the next page, or 29.0 null if there isn’t a next page. connectapi.chatterconversationsummary chatter conversation summary. 1732" "apex reference guide connectapi output classes name type description available version id string id for the conversation summary. 29.0 latestmessage connectapi.chattermessage contents of the latest message. 29.0 members list list of members in the conversation. 29.0 read boolean specifies if the conversation is read (true) or not read 29.0 (false). url string connect rest api url to the conversation summary. 29.0 see also: connectapi.chatterconversationpage connectapi.chattergroup chatter group. this class is abstract. subclass of connectapi.actorwithid superclass of: • connectapi.chattergroupdetail • connectapi.chattergroupsummary name type description available version additional string an extra label for the group, for example, “archived,” “private,” or “private with 30.0 label customers.” if there isn’t an extra label, the value is null. announcement connectapi. the current announcement for this group.an announcement displays in a 31.0 announcement designated location in the salesforce ui until 11:59 p.m. on its expiration date, unless it’s deleted or replaced by another announcement. bannerphoto connectapi. the banner photo for the group. 36.0 bannerphoto canhave boolean true if this group allows chatter guests. 28.0 chatterguests community connectapi. information about the experience cloud site the group is in. 28.0 reference description string group’s description. 28.0 emailto string group’s email address for posting to this group by email. 30.0 chatteraddress returns null if chatter emails and posting to chatter by email aren’t both enabled in your organization. 1733apex reference guide connectapi output classes name type description available version isarchived boolean specifies whether the group is archived (true) or not (false). 29.0 isauto boolean specifies whether automatic archiving is disabled for the group (true) or 29.0 archivedisabled not (false). isbroadcast boolean specifies whether the group is a broadcast group (true) or not (false). 36.0 in a broadcast group, only group owners and managers can post to the group. lastfeedelement datetime iso 8601 date string, for example, 2011-02-25t18:24:31.000z, of the most 31.0 postdate recent feed element posted to the group. lastfeeditem datetime iso 8601 date string, for example, 2011-02-25t18:24:31.000z, of the most 28.0–30.0 postdate recent feed item posted to the group. use lastfeedelementposted. membercount integer total number of group members. 28.0 myrole connectapi. type of membership the user has with the group. 28.0 groupmembershiptype • groupowner • groupmanager • notamember • notamemberprivaterequested • standardmember mysubscription connectapi. if the context user is a member of this group, contains information about that 28.0 reference subscription; otherwise, returns null. name string name of the group. 28.0 owner connectapi. information about the owner of the group. 28.0 usersummary photo connectapi.photo information about the group photo. 28.0 visibility connectapi. group visibility type. valid values are: 28.0 groupvisibility • privateaccess—only members of the group can see posts to this type group. • publicaccess—all users within the experience cloud site can see posts to this group. • unlisted—reserved for future use. connectapi.chattergroupdetail chatter group details. subclass of connectapi.chattergroup. 1734apex reference guide connectapi output classes name type description available version filecount integer the number of files posted to the group. 28.0 information connectapi. describes the information section of the group. if the group is private, this 28.0 group section is visible only to members. if the context user is not a member of information the group or does not have modify all data or view all data permission, this value is null. pending integer the number of requests to join a group that are in a pending state. 29.0 requests see also:" "connectapi.chattergrouppage connectapi.usergroupdetailpage connectapi.chattergrouppage page of groups. name type description available version currentpageurl string connect rest api url identifying the current page. 28.0 groups list nextpageurl string connect rest api url identifying the next page, or null if there isn’t a 28.0 next page. previous string connect rest api url identifying the previous page, or null if there isn’t 28.0 pageurl a previous page. connectapi.chattergroupsummary subclass of connectapi.chattergroup. name type description available version filecount integer the number of files posted to the group. 28.0 see also: connectapi.chattergroupsummarypage connectapi.usergrouppage 1735apex reference guide connectapi output classes connectapi.chattergroupsummarypage page of group summaries. name type description available version currentpageurl string connect rest api url identifying the current page. 29.0 groups list nextpageurl string connect rest api url identifying the next page, or null if 29.0 there isn’t a next page. previouspageurl string connect rest api url identifying the previous page, or null 29.0 if there isn’t a previous page. connectapi.chatterlike chatter like information. name type description available version id string like’s 18-character id 28.0 likeditem connectapi. a reference to the liked comment or feed element. 28.0 reference url string like’s connect rest api url 28.0 user connectapi.user like’s creator 28.0 summary see also: connectapi.chatterlikepage connectapi.chatterlikepage page of chatter likes. name type description available version currentpagetoken integer token identifying the current page. 28.0 currentpageurl string connect rest api url identifying the current page. 28.0 items list 1736apex reference guide connectapi output classes name type description available version likes list important: as of api version 32.0, use the items property. nextpagetoken integer token identifying the next page, or null if there isn’t a next 28.0 page. nextpageurl string connect rest api url identifying the next page, or null if there 28.0 isn’t a next page. previouspagetoken integer token identifying the previous page, or null if there isn’t a 28.0 previous page. previouspageurl string connect rest api url identifying the previous page, or null if 28.0 there isn’t a previous page. total integer total number of likes across all pages. 28.0 see also: connectapi.chatterlikescapability connectapi.comment connectapi.chatterlikescapability if a feed element has this capability, the context user can like it. exposes information about existing likes. subclass of connectapi.feedelementcapability. property name type description available version islikedby boolean indicates whether the feed element is liked by the 32.0 currentuser context user (true) or not (false). page connectapi. likes information for this feed element. 32.0 chatterlikepage likesmessage connectapi. a message body that describes who likes the feed 32.0 messagebody element. mylike connectapi. if the context user has liked the feed element, this 32.0 reference property is a reference to the specific like, null otherwise. see also: connectapi.feedelementcapabilities 1737apex reference guide connectapi output classes connectapi.chattermessage chatter message. name type description available version body connectapi.messagebody contents of the message. 29.0 conversationid string id for the conversation. 29.0 conversationurl string connect rest api url identifying the conversation. 29.0 id string id of the message. 29.0 recipients list list of" "the recipients of the message. 29.0 sender connectapi.usersummary sender of the message. 29.0 sendingcommunity connectapi.reference information about the experience cloud site from 32.0 which the message was sent. returns null for the default site or if digital experiences isn’t enabled. sentdate datetime the date and time the message was sent. 29.0 url string connect rest api url identifying the current page 29.0 of the conversation. see also: connectapi.chatterconversationsummary connectapi.chattermessagepage connectapi.chattermessagepage chatter message page. name type description available version currentpagetoken string token identifying the current page. 29.0 currentpageurl string connect rest api url identifying the current page. 29.0 messages list messages on the current page. 29.0 nextpagetoken string token identifying the next page, or null if there 29.0 isn’t a next page. 1738apex reference guide connectapi output classes name type description available version nextpageurl string connect rest api url identifying the next page, or 29.0 null if there isn’t a next page. see also: connectapi.chatterconversation connectapi.chatterstream a chatter feed stream. property name type description available version community connectapi. experience cloud site where the stream is. 41.0 communitysummary createddate datetime date the stream was created. 39.0 description string description of the stream. 39.0 id string 18-character id of the stream. 39.0 name string name of the stream. 39.0 subscriptions list url string url to the stream. 39.0 see also: connectapi.chatterstreampage connectapi.chatterstreampage a collection of chatter feed streams. property name type description available version currentpageurl string url to the current page of streams. 39.0 items list nextpageurl string url to the next page of streams. 39.0 in version 39.0, all streams are included in currentpageurl and nextpageurl is null. 1739apex reference guide connectapi output classes property name type description available version total integer total number of streams in the collection. 39.0 connectapi.clientinfo client information. name type description available version applicationname string name of the connected app used for authentication. 28.0 applicationurl string value from the info url field of the connected app used for 28.0 authentication. see also: connectapi.comment connectapi.feeditem connectapi.closecapability if a feed element has this capability, users with permission can close it. users can’t edit (specifically the feed item body or title), comment on, or delete a closed feed element. if the closed feed element is a poll, users can’t vote on it. users can’t edit (specifically the comment body) or delete a comment on a closed feed element or select or remove it as best answer. admins and moderators can edit and delete closed feed elements and comments on closed feed elements. admins and moderators can select or remove the best answer status on comments on closed feed elements. property name type description available version cancontextuser boolean specifies whether the context user has permission 43.0 updateisclosed to set the feed element to closed (true) or not (false). isclosed boolean specifies whether the feed element is closed (true) 43.0 or not (false). see also: connectapi.feedelementcapabilities connectapi.comment a comment. 1740apex reference guide connectapi output classes name type description available version attachment connectapi.feeditem if the comment contains an attachment, property value is 28.0–31.0 attachment contentattachment. if the comment does not contain an attachment, it is null. important: as of version 32.0, use the capabilities property. body connectapi.feedbody body of the comment. 28.0 capabilities connectapi. capabilities associated with the comment, such as any file 32.0 commentcapabilities attachments. clientinfo connectapi. information about the connected app used" "to authenticate 28.0 clientinfo the connection. createddate datetime iso 8601 date string, for example, 2011-02-25t18:24:31.000z. 28.0 feedelement connectapi. feed element on which the comment is posted. reference feeditem connectapi. feed item on which the comment is posted. 28.0–31.0 reference important: as of version 32.0, use the feedelement property. id string comment’s 18–character id. 28.0 isdelete boolean if this property is true, the context user can’t delete the 28.0 restricted comment. if this property is false, the context user might be able to delete the comment. likes connectapi.chatter the first page of likes for the comment. 28.0 likepage this property has no information for comments on direct messages. likesmessage connectapi.message a message body that describes who likes the comment. 28.0 body this property is null for comments on direct messages. moderation connectapi. information about the moderation flags on a comment. if 29.0 flags moderationflags connectapi.features.communitymoderation is false, this property is null. mylike connectapi. if the context user liked the comment, this property is a 28.0 reference reference to the specific like, null otherwise. this property is null for comments on direct messages. parent connectapi. information about the parent feed-item for this comment. 28.0 reference 1741apex reference guide connectapi output classes name type description available version relativecreateddate string the created date formatted as a relative, localized string, for 28.0 example, “17m ago” or “yesterday.” threadlevel integer level of nesting for a comment. 0 indicates a standard 44.0 comment with a parent post. 1 indicates a threaded comment with a parent comment and a parent post. 2 indicates a threaded comment with two parent comments and a parent post. the ui is limited to these three levels. threadparentid string id of the parent comment for a threaded comment. 44.0 type connectapi. type of comment. 28.0 commenttype enum • contentcomment—comment holds a content capability. • textcomment—comment contains only text. url string connect rest api url to this comment. 28.0 user connectapi.user information about the comment author. 28.0 summary see also: connectapi.commentpage connectapi.questionandanswerscapability connectapi.commentcapabilities a set of capabilities on a comment. property name type description available version comments connectapi. if a comment has this capability, it has threaded 44.0 commentscapability comments. content connectapi. if a comment has this capability, it has a file 32.0 contentcapability attachment. most connectapi.contentcapability properties are null if the content has been deleted from the feed element or if the access has changed to private. edit connectapi. if a comment has this capability, users who have 34.0 editcapability permission can edit it. feedentityshare connectapi. if a comment has this capability, a feed entity is 42.0 feedentity shared with it. sharecapability 1742apex reference guide connectapi output classes property name type description available version record connectapi. if a comment has this capability, it has a record 42.0 recordcapability attachment. status connectapi. if a comment has this capability, it has a status that 38.0 statuscapability determines its visibility. updownvote connectapi. if a comment has this capability, users can upvote or 41.0 updownvotecapability downvote it. verified connectapi. if a comment has this capability, users with 41.0 verifiedcapability permission can mark it as verified or unverified. see also: connectapi.comment connectapi.commentpage a page of comments. name type description available version comments list important: as of version 32.0, use the items property. currentpagetoken string token identifying the current page. 28.0 currentpageurl string connect rest api url identifying the current page. 28.0 items list nextpagetoken string token identifying the next" "page, or null if there isn’t a next page. 28.0 if you want to read more of the comments in search results, all the comments in the thread are refreshed, not just the ones that match the search term. avoid using nextpagetoken until the comments are refreshed. nextpageurl string connect rest api url identifying the next page, or null if there isn’t 28.0 a next page. if you want to read more of the comments in search results, all the comments in the thread are refreshed, not just the ones that match the search term. avoid using nextpageurl until the comments are refreshed. previouspagetoken string token identifying the previous page, or null if there isn’t a previous 44.0 page. 1743apex reference guide connectapi output classes name type description available version previouspageurl string connect rest api url identifying the previous page, or null if there 44.0 isn’t a previous page. total integer total number of published comments for the parent feed element. 28.0 see also: connectapi.commentscapability connectapi.commentsummary summary of the comment. subclass of connectapi.useractivitysummary property name type description available version commentid string id of the comment. 42.0 connectapi.commentscapability if a feed element or comment has this capability, the context user can add a comment to it. subclass of connectapi.feedelementcapability. property name type description available version page connectapi. the comments information for this feed element or 32.0 commentpage comment. threaded comments are supported in version 44.0 and later. see also: connectapi.feedelementcapabilities connectapi.commerceactionresult result of executing a commerce action. property name type description available version issuccess boolean specifies whether the action is a success (true) or 53.0 not (false). message string action result message. 53.0 1744apex reference guide connectapi output classes connectapi.commerceaddresscollection a collection of commerce addresses. property name type description available version count integer count of addresses. 54.0 currentpagetoken string token to the current page of addresses. 54.0 currentpageurl string url to the current page of addresses. 54.0 items address details 54.0 nextpagetoken string token to the next page of addresses. 54.0 nextpageurl string url to the next page of addresses. 54.0 pagesize integer page size for addresses. 54.0 previouspagetoken string token to previous page of addresses. 54.0 previouspageurl string url to the previous page of addresses. 54.0 sortorder connectapi.commerceaddresssort sort order for commerce addresses. 54.0 • createddateasc—sort in ascending order of created date. • createddatedesc—sort in descending order of created date. • nameasc—sort in ascending order of name. • namedesc—sort in descending order of name. connectapi.commerceaddressoutput address for a commerce account. property name type description available version addressid string id of the address. 54.0 addresstype string type of address (for example, “shipping” or “billing”). 54.0 city string the address city. 54.0 companyname string the address company name. 57.0 country string the address country. 54.0 countrycode string two-character country code. 54.0 fields map firstname string the address first name. 57.0 1745apex reference guide connectapi output classes property name type description available version isdefault boolean indicates whether a contact’s address is the preferred 54.0 method of communication (true) or not (false). the default value is false. lastname string the address last name. 57.0 middlename string the address middle name. 57.0 name string name of the contact. 54.0 phonenumber string the address phone number. 57.0 postalcode string zip code or postal code for the address. 54.0 region string the address state. 54.0 regioncode string the address state code. 54.0 street string the address street. 54.0 connectapi.commercesearchindex index information. property name type description available version completiondate datetime completion date and time of" "the index. 52.0 createddate datetime creation date of the index. 52.0 creationtype connectapi. creation type of the index. values are: 52.0 commercesearch • manual indexcreationtype • scheduled id string id of the index. 52.0 indexbuildtype connectapi. build type of the index. values are: 57.0 commercesearch • full indexbuildtype • incremental indexstatus connectapi. status of the index. values are: 52.0 commercesearch • completed indexstatus • failed • inprogress indexusage connectapi. usage of the index. values are: 52.0 commercesearch • live indexusage • outofuse 1746apex reference guide connectapi output classes property name type description available version isincrementable boolean specifies whether the index allows incremental 57.0 indexing (true) or not (false). lastcatalogsnapshottime datetime catalog snapshot time of the index. 57.0 message string detailed message for the index status. 52.0 see also: connectapi.commercesearchindexcollection connectapi.commercesearchindexcollection collection of indexes. property name type description available version indexes list the most-recently-failed, out-of-use index. connectapi.commercesearchindexlog search index log information. property name type description available version catalog datetime catalog snapshot time of the index build. 57.0 snapshottime completiondate datetime completion date of the index build. 57.0 createdbyid string id of the user who initiated the index build. 57.0 indexbuildstatus connectapi. status of the index. values are: 57.0 commercesearch • completed indexstatus • failed • inprogress indexbuildtype connectapi. build type of the index. values are: 57.0 commercesearch • full indexbuildtype • incremental indexid string id of the index build. 57.0 message string detailed message for the index build status. 57.0 numberofproducts integer number of new or changed products in the index 57.0 build. 1747apex reference guide connectapi output classes connectapi.commercesearchindexlogcollection collection of search index logs for a webstore. property name type description available version indexlogs list connectapi.community experience cloud site. name type description available version allowchatter boolean specifies if guest users can access public groups without logging in. 31.0 accesswithoutlogin allowmembers boolean specifies if members can flag content. 30.0 toflag builderbased boolean specifies whether the service not available page is an auto-generated 52.0 snaenabled experience builder-based page (true) or a static resource page that’s set in workspaces > administration > pages (false). builderurl string experience builder url for the site. 56.0 description string site description. 28.0 guestmember boolean specifies whether guest members can see other members (true) or not 47.0 visibilityenabled (false). id string site id. 28.0 imageoptimization boolean specifies whether images are optimized for guest users on all devices for 56.0 cdnenabled sites using salesforce's cdn for digital experiences (true) or not (false). invitationsenabled boolean specifies whether users can invite other external users. 28.0 knowledgeable boolean specifies whether knowledgeable people and endorsements are available 30.0 enabled for topics (true), or not (false). loginurl string login url for the site. 36.0 membervisibility boolean specifies whether members can see other members (true) or not 45.0 enabled (false). name string site name. 28.0 nicknamedisplay boolean specifies whether nicknames are displayed. 32.0 enabled 1748apex reference guide connectapi output classes name type description available version privatemessages boolean specifies whether members can send and receive private messages to 30.0 enabled and from other members (true) or not (false). reputationenabled boolean specifies whether reputation is calculated and displayed for members. 31.0 sendwelcomeemail boolean specifies whether emails are sent" "to all new users when they join. 28.0 siteascontainer boolean specifies whether the site is an experience builder site (true) or a 41.0 enabled salesforce tabs + visualforce site (false). siteurl string url for the site, which is your experience cloud sites domain plus a url 30.0 prefix. for example, mydomainname.my.site.com/customers. note: if you’re not using enhanced domains, your org’s experience cloud sites url is different. for details, see my domain url formats in salesforce help. status connectapi. status of the experience cloud site. 28.0 communitystatus • live enum • inactive • underconstruction templatename string name of the experience builder template. 46.0 url string connect rest api url to the site. 28.0 urlpathprefix string site-specific url prefix. for example, in the site url 28.0 mydomainname.my.site.com/customers, customers is the urlpathprefix. see also: connectapi.communitypage connectapi.communitypage page of experience cloud sites. name type description available version communities list to. total integer total number of experience cloud sites. 28.0 connectapi.communitysummary summary of an experience cloud site. 1749apex reference guide connectapi output classes property name type description available version id string 18-character id of the site. 41.0 name string localized name of the site. 41.0 see also: connectapi.useractivitysummary connectapi.companyverifysummary company verify summary. subclass of connectapi.userfeedentityactivitysummary no additional properties. connectapi.complexsegment complex segments of field changes. this class is abstract. subclass of connectapi.messagesegment superclass of connectapi.fieldchangesegment name type description available version segments list connectapi.compoundrecordfield record field that is a composite of subfields. subclass of connectapi.labeledrecordfield name type description available version fields list connectapi.confirmheldfocapacityoutputrepresentation response to a request to confirm held fulfillment order capacity at one or more locations. can correspond to one action call. subclass of connectapi.baseoutputrepresentation. 1750apex reference guide connectapi output classes property name type description available version confirmheldfo list connectapi.confirmheldfocapacityresponseoutputrepresentation response to a request to confirm held fulfillment order capacity at one or more locations. property name type description available version capacityresponses list connectapi.content a file attached to a feed item. property name type description available version checksum string md5 checksum for the file. 36.0 contenturl string url of the content for links. 36.0 description string description of the attachment. 36.0 downloadurl string url to the content. 36.0 fileextension string extension of the file. 36.0 filesize string size of the file in bytes. if size can’t be determined, 36.0 returns unknown. filetype string type of file, such as pdf. 36.0 haspdfpreview boolean true if the file has a pdf preview available; false 36.0 otherwise. id string 18-character id of the content. 36.0 imagedetails connectapi. image details, or null if the file isn’t an image. 40.0 contentimage filedetails isinmyfilesync boolean true if the file is synced with salesforce files sync. 36.0 note: salesforce files sync was retired on may 25, 2018. mimetype string mime type of the file. 36.0 1751apex reference guide connectapi output classes" "property name type description available version renditionurl string url to the rendition resource for the file. for shared 36.0 files, renditions process asynchronously after upload. for private files, renditions process when the first file preview is requested, and aren’t available immediately after the file is uploaded. renditionurl string url to the 240 x 180 pixel rendition resource for the 36.0 240by180 file. for shared files, renditions process asynchronously after upload. for private files, renditions process when the first file preview is requested, and aren’t available immediately after the file is uploaded. renditionurl string url to the 720 x 480 pixel rendition resource for the 36.0 720by480 file. for shared files, renditions process asynchronously after upload. for private files, renditions process when the first file preview is requested, and aren’t available immediately after the file is uploaded. sharingoption connectapi. sharing option of the file. values are: 36.0 filesharingoption • allowed—resharing of the file is allowed. • restricted—resharing of the file is restricted. textpreview string text preview of the file if available; null otherwise. 36.0 thumb120by90 string specifies the rendering status of the 120 x 90 preview 36.0 renditionstatus image of the file. one of these values: • processing—image is being rendered. • failed—rendering process failed. • success—rendering process was successful. • na—rendering is not available for this image. thumb240by180 string specifies the rendering status of the 240 x 180 36.0 renditionstatus preview image of the file. one of these values: • processing—image is being rendered. • failed—rendering process failed. • success—rendering process was successful. • na—rendering is not available for this image. thumb720by480 string specifies the rendering status of the 720 x 480 36.0 renditionstatus preview image of the file. one of these values: • processing—image is being rendered. • failed—rendering process failed. • success—rendering process was successful. 1752apex reference guide connectapi output classes property name type description available version • na—rendering is not available for this image. title string title of the file. 36.0 versionid string version id of the file. 36.0 see also: connectapi.filescapability connectapi.contentcapability if a comment has this capability, it has a file attachment. subclass of connectapi.feedelementcapability. for files attached to a feed post (instead of a comment) in version 36.0 and later, use connectapi.filescapability. if content is deleted from a feed element after it’s posted or if the access to the content is changed to private, the connectapi. contentcapability exists, however most of its properties are null. property name type description available version checksum string md5 checksum for the file. 32.0 contenturl string url of the content for links and google docs. 32.0 description string description of the attachment. 32.0 downloadurl string url to the content. 32.0 fileextension string extension of the file. 32.0 filesize string size of the file in bytes. if size cannot be determined, 32.0 returns unknown. filetype string type of file. 32.0 haspdfpreview boolean true if the file has a pdf preview available, false 32.0 otherwise. id string 18-character id of the content. 32.0 isinmyfilesync boolean true if the file is synced with salesforce files sync; 32.0 false otherwise. note: salesforce files sync was retired on may 25, 2018. mimetype string mime type of the file. 32.0 renditionurl string url to the rendition resource for the file. renditions 32.0 are processed asynchronously and may not be 1753apex reference guide connectapi output classes property name type description available version available immediately after the file has been uploaded. renditionurl240by180 string url to the 240x180 size rendition resource for the 32.0 file. renditions are processed asynchronously and may not be available immediately after the file has been uploaded. renditionurl720by480 string url to the 720x480 size rendition resource for" "the 32.0 file. renditions are processed asynchronously and may not be available immediately after the file has been uploaded. sharingoption connectapi. sharing option of the file. values are: 35.0 filesharingoption • allowed—resharing of the file is allowed. • restricted—resharing of the file is restricted. textpreview string text preview of the file if available, null otherwise. 32.0 the maximum number of characters is 200. thumb120by90 string the status of the rendering of the 120x90 pixel sized 32.0 renditionstatus preview image of the file. should be either processing, failed, success, or na if unavailable. thumb240by180 string the status of the rendering of the 240x180 pixel sized 32.0 renditionstatus preview image of the file. should be either processing, failed, success, or na if unavailable. thumb720by480 string the status of the rendering of the 720x480 pixel sized 32.0 renditionstatus preview image of the file. should be either processing, failed, success, or na if unavailable. title string title of the file. 32.0 versionid string version id of the file. 32.0 see also: connectapi.commentcapabilities connectapi.contenthuballoweditemtypecollection the item types that the context user is allowed to create in a repository folder. property name type description available version alloweditemtypes list 1754apex reference guide connectapi output classes connectapi.contenthubfielddefinition a field definition. property name type description available version displayname string label or caption of this field. 39.0 ismandatory boolean specifies whether this field is mandatory for the item 39.0 type. maxlength integer maximum length of the value of this field. 39.0 name string name of the field. 39.0 type connectapi. data type of the value of the field. values are: 39.0 contenthub • booleantype variabletype • datetimetype • decimaltype • htmltype • idtype • integertype • stringtype • uritype • xmltype see also: connectapi.contenthubitemtypedetail connectapi.contenthubitemtypedetail the details of an item type associated with a repository folder. subclass of connectapi.abstractcontenthubitemtype property name type description available version fields list connectapi.contenthubitemtypesummary the summary of an item type associated with a repository folder. subclass of connectapi.abstractcontenthubitemtype 1755apex reference guide connectapi output classes no additional properties. see also: connectapi.contenthuballoweditemtypecollection connectapi.contenthubpermissiontype a permission type. property name type description available version id string internal id of the permission type in the repository. 39.0 label string label as returned by the repository. 39.0 see also: connectapi.externalfilepermissioninformation connectapi.contenthubprovidertype the type of repository. property name type description available version label string localized label of the provider type. 39.0 type string provider type. one of these values: 39.0 • contenthubbox • contenthubgdrive • contenthubsharepoint • contenthubsharepointoffice365 • contenthubsharepointonedrive • simpleurl see also: connectapi.contenthubrepository connectapi.contenthubrepository a repository. subclass of connectapi.actorwithid 1756apex reference guide connectapi output classes property name type description available version authentication connectapi. repository authentication information. 40.0 contenthub repository authentication features connectapi. repository features. 39.0 contenthub repositoryfeatures label string repository label. 39.0 name string repository name. 39.0 providertype connectapi. repository provider type. 39.0 contenthub providertype rootfolderitemsurl string url to the list of items in the repository root folder. 39.0 see also: connectapi.contenthubrepositorycollection" "connectapi.contenthubrepositoryauthentication authentication information for a repository. property name type description available version authflowurl string 40.0 depends on the authprotocol. • noauthentication—null. • oauth—url to start the oauth flow. • password—url to the authentication settings for external systems. authprotocol connectapi. authentication protocol used for the repository. 40.0 contenthub values are: authentication • noauthentication—repository doesn’t protocol require authentication. • oauth—repository uses oauth authentication protocol. • password—repository uses user name and password authentication protocol. 1757apex reference guide connectapi output classes property name type description available version userhas boolean specifies whether the user has credentials or the 40.0 authsettings administrator configured the external data source to use the same set of credentials for every user (true). otherwise, false. see also: connectapi.contenthubrepository connectapi.contenthubrepositorycollection a collection of repositories. property name type description available version currentpageurl string url to the current page of repositories. 39.0 nextpageurl string url to the next page of repositories, or null if there 39.0 isn’t a next page. previouspageurl string url to the previous page of repositories, or null 39.0 if there isn’t a previous page. repositories list connectapi.contenthubrepositoryfeatures the features of a repository. property name type description available version canbrowse boolean specifies whether the repository’s folder hierarchy 39.0 can be browsed (true) or not (false). cansearch boolean specifies whether the repository can be searched 39.0 (true) or not (false). see also: connectapi.contenthubrepository connectapi.contentimagefiledetails image file details. 1758apex reference guide connectapi output classes property name type description available version height integer image’s height in pixels. 40.0 imageformat string image’s format. 40.0 orientation string image’s exif orientation value, if present. 40.0 width integer image’s width in pixels. 40.0 see also: connectapi.inlineimagesegment connectapi.contractoutputrepresentation contract list. property name type description available version data list record ids of the contacts. 56.0 connectapi.conversationapplicationdefinitiondetailrespresentation information about the conversation application definition. property name type description available version botinfo connectapi.botinfo basic information of the bot associated with this 54.0 representation conversation application. errormessage string error message for the failed get operation. 54.0 integration connectapi. conversation application integration types. 54.0 application conversation values are: application • api integrationtype • slack integrationname string name of the conversation application. 54.0 issuccess boolean success indicator of the get operation. 54.0 runtimeurl string base url of the bot runtime api. 54.0 connectapi.couponcoderedemptionresult coupon code redemption result. property name type description available version availableredemptions integer number of coupon code redemptions available. 58.0 1759apex reference guide connectapi output classes property name type description available version couponcode string coupon code. 58.0 errormsg string error message when coupon code redemption isn’t 58.0 successful. issuccess boolean specifies whether increasing or decreasing the 58.0 coupon code redemption is successful (true) or not (false). redemptionlimit integer number of coupon code redemptions allowed. 58.0 connectapi.couponcoderedemptioncollection collection of coupon code redemption results. property name type description available version couponcode list connectapi.createcreditmemooutputrepresentation id of a created credit memo. subclass of connectapi.baseoutputrepresentation. property name type description available version creditmemoid string id of the created credit memo. 48.0 connectapi.changeordersinvoiceoutputrepresentation list of ids of invoices created for change orders" ". subclass of connectapi.baseinvoiceoutputrepresentation. no additional properties. see also: createmultipleinvoices(invoicesinput) connectapi.createmultipleinvoicesfromchangeordersoutputrepresentation connectapi.createmultipleinvoicesfromchangeordersoutputrepresentation list of lists of invoices created from change orders for fees. subclass of connectapi.baseoutputrepresentation. 1760apex reference guide connectapi output classes property name type description available version invoices list refunds for the return that the fees applied to. see also: createmultipleinvoices(invoicesinput) connectapi.createorderpaymentsummaryoutputrepresentation id of the created order payment summary. subclass of connectapi.baseoutputrepresentation. property name type description available version orderpayment string id of the order payment summary. 48.0 summaryid connectapi.credential credential. property name type description available version authentication connectapi. authentication protocol of the external credential. 56.0 protocol credentialauthentication values are: protocol • awssv4 • custom • noauth • oauth authentication connectapi. authentication protocol variant of the external 57.0 protocolvariant credentialauthentication credential. values are: protocolvariant • awssv4_sts—aws signature version 4 with security token service. • jwtbearer—oauth 2.0 json web token bearer flow. • rolesanywhere—aws signature version 4 with identity and access management (iam) roles anywhere. authentication connectapi. status of the credential authentication. values are: 56.0 status credentialauthentication • configured—credential has all required status credentials for at least one principal. 1761apex reference guide connectapi output classes property name type description available version • notconfigured—credential isn’t configured. • unknown—credential status can’t be determined because the authentication protocol is custom. credentials map externalcredential string fully qualified developer name of the external 56.0 credential. principalname string name of the external credential named principal. 56.0 principaltype connectapi. type of credential principal. values are: 56.0 credentialprincipal • awsstsprincipal type • namedprincipal • peruserprincipal connectapi.credentialcustomheader credential custom header. property name type description available version headername string header name. 57.0 headervalue string header value that can contain formulas. 57.0 id string id of the customer header parameter. 58.0 sequencenumber integer sequence number of the header. the sequence 57.0 number determines the order of the header. see also: connectapi.externalcredential connectapi.namedcredential connectapi.credentialvalue credential value. property name type description available version encrypted boolean specifies whether the credential value is encrypted 56.0 (true) or not (false). 1762apex reference guide connectapi output classes property name type description available version revision integer revision number of a short-lived credential. 58.0 value string value of the credential. 56.0 see also: connectapi.credential connectapi.currencyrecordfield record field containing a currency value. subclass of connectapi.labeledrecordfield connectapi.customlistaudiencecriteria criteria for the custom list type of custom recommendation audience. subclass of connectapi.audiencecriteria. property name type description available version membercount integer total number of members in the custom 36.0 recommendation audience. members connectapi. members of the custom recommendation audience. 36.0 userreferencepage connectapi.dashboardcomponentsnapshot represents both dashboard component snapshots and alerts you receive when a dashboard component value crosses a threshold. property name type description available version componentid string 18-character id of the dashboard component. 32" ".0 componentname string the dashboard component name. 32.0 dashboardbodytext string display this text next to the actor in the feed 32.0 element.use this text in place of the default body text. dashboardid string 18-character id of the dashboard. 32.0 dashboardname string the name of the dashboard. 32.0 fullsizeimageurl string the source url to retrieve the full-size image of a 32.0 snapshot. access this url with oauth credentials. lastrefreshdate datetime iso 8601 date specifying when this dashboard 32.0 component was last refreshed. 1763apex reference guide connectapi output classes property name type description available version lastrefresh string display text for the last refresh date, for example, “last 32.0 datedisplaytext refreshed on october 31, 2013.” runninguser connectapi. the running user of the dashboard at the time the 32.0 usersummary snapshot was posted. this value may be null. each dashboard has a running user, whose security settings determine which data to display in a dashboard. thumbnailurl string the source url to retrieve the thumbnail image of a 32.0 snapshot. access this url with oauth credentials. see also: connectapi.dashboardcomponentsnapshotcapability connectapi.datacloudcompanies connectapi.dashboardcomponentsnapshotcapability if a feed element has this capability, it has a dashboard component snapshot. a snapshot is a static image of a dashboard component at a specific point in time. subclass of connectapi.feedelementcapability. property name type description available version dashboardcomponent connectapi. the dashboard component snapshot. 32.0 snapshot dashboardcomponent snapshot see also: connectapi.feedelementcapabilities connectapi.daterecordfield record field containing a date. subclass of connectapi.labeledrecordfield name type description available version datevalue datetime date that a machine can read. 29.0 ignore the trailing 00:00:00.000z characters. connectapi.deleteintent delete intent for a social post. 1764apex reference guide connectapi output classes property name type description available version managedsocialaccount connectapi. managed social account that deletes the social post. 45.0 managedsocialaccount see also: connectapi.deleteintents connectapi.deleteintents list of delete intents for a social post. property name type description available version deletes list see also: connectapi.socialpostintents connectapi.deletesocialpostintent delete intent for the social post. property name type description available version socialaccountid string id of the social account that deletes the social post. 46.0 socialpostid string id of the social post to delete. 46.0 connectapi.digestjob represents a successfully enqueued api digest job request. property name type description available version period connectapi. time period that’s included in a chatter email digest. 37.0 digestperiod values are: • dailydigest—the email includes up to the 50 latest posts from the previous day. • weeklydigest—the email includes up to the 50 latest posts from the previous week. connectapi.directmessagecapability if a feed element has this capability, it’s a direct message. 1765apex reference guide connectapi output classes property name type description available version memberchanges connectapi. member activities of the direct message, with the 40.0 directmessage most recent activity first. memberactivitypage members connectapi. members included in the direct message. 39.0 directmessage memberpage originalmembers connectapi. original members of the direct message. 40.0 directmessage memberpage subject string subject of the direct message. 39.0 see also: connectapi.feedelementcapabilities connectapi.directmessagememberactivity direct message member activity. property name type description available version activitydate datetime direct message member activity date. 40.0 actor connectapi. user who changed the direct message membership. 40.0 usersummary membersadded connectapi. members added to the direct message as part of the 40.0 directmessage activity. memberpage membersremoved connectapi. members removed from the direct message as part 40.0 directmessage of" "the activity. memberpage see also: connectapi.directmessagememberactivitypage connectapi.directmessagememberactivitypage a page of direct message member activities. property name type description available version activities list 1766apex reference guide connectapi output classes property name type description available version currentpagetoken string token identifying the current page. 40.0 currentpageurl string connect rest api url identifying the current page. 40.0 nextpagetoken string token identifying the next page, or null if there 40.0 isn’t a next page. nextpageurl string connect rest api url identifying the next page, or 40.0 null if there isn’t a next page. see also: connectapi.directmessagecapability connectapi.directmessagememberpage a collection of direct message members. property name type description available version currentpagetoken string page token to access the current page of direct 39.0 message members. currentpageurl string url to the current page of direct message members. 39.0 nextpagetoken string page token to access the next page of direct message 39.0 members. nextpageurl string url to the next page of direct message members. 39.0 users list see also: connectapi.directmessagecapability connectapi.directmessagecapability connectapi.directmessagememberactivity connectapi.distancecalculationoutputrepresentation shipping distance data for a set of inventory locations. property name type description available version averagedistance double the average distance from the locations to the order 51.0 recipient. 1767apex reference guide connectapi output classes property name type description available version locations list rank integer this result’s rank among all results by average 51.0 distance to the order recipient. connectapi.distinctfacetvalue distinct facet value. this class is a subclass of connectapi.facetvalue. property name type description available version displayname string display name of the facet value. 52.0 nameorid string developer name of the attribute. 52.0 productcount long number of products in the search result that match 52.0 the facet value. see also: connectapi.distinctvaluesearchfacet connectapi.distinctvaluesearchfacet facet with distinct values in product search results. this class is a subclass of connectapi.searchfacet. property name type description available version values list by display name in alphabetical order. connectapi.downvotesummary summary of a downvote. subclass of connectapi.userfeedentityactivitysummary no additional properties. connectapi.editcapability if a feed element or comment has this capability, users who have permission can edit it. 1768apex reference guide connectapi output classes property name type description available version iseditrestricted boolean specifies whether editing this feed element or 34.0 comment is restricted. if true, the context user can’t edit this feed element or comment. if false, the context user may or may not have permission to edit this feed element or comment. to determine if the context user can edit a feed element or comment, use the isfeedelementeditablebyme(communityid, feedelementid) or iscommenteditablebyme(communityid, commentid) method. iseditable string the url to check if the context user is able to edit 34.0 bymeurl this feed element or comment. lasteditedby connectapi.actor who last edited this feed element or comment. 34.0 lastediteddate datetime the most recent edit date of this feed element or 34.0 comment. latestrevision integer the most recent revision of this feed element or 34.0 comment. relativelast string relative last edited date, for example, “2h ago.” 34.0 editeddate see also: connectapi.commentcapabilities connectapi.feedelementcapabilities connectapi.emailaddress email address. name type description available version displayname string the display name for the email address. 29.0 emailaddress string" "the email address. 29.0 relatedrecord connectapi. the summary of a related record, for example, a contact or user 36.0 recordsummary summary. see also: connectapi.emailmessagecapability 1769apex reference guide connectapi output classes connectapi.emailattachment an email attachment in an email message. property name type description available version attachment connectapi. record summary of the attachment. 36.0 recordsummary contenttype string type of attachment. 36.0 filename string name of the attachment. 36.0 see also: connectapi.emailmessagecapability connectapi.emailmergefieldcollectioninfo the merge fields for an object. property name type description available version mergefields list list of merge fields for a single object. 39.0 see also: connectapi.emailmergefieldinfo connectapi.emailmergefieldinfo the map for objects and their merge fields. property name type description available version entitytomerge map connectapi.emailmessagecapability if a feed element has this capability, it has an email message from a case. subclass of connectapi.feedelementcapability. property name type description available version attachments list 1770apex reference guide connectapi output classes property name type description available version bccaddresses list body string body of the email message. 36.0 ccaddresses list direction connectapi. direction of the email message. values are: 32.0 emailmessagedirection • inbound—an inbound message (sent by a customer). • outbound—an outbound message (sent to a customer by a support agent). emailmessageid string id of the email message. 32.0 fromaddress connectapi. from address for the email message. 36.0 emailaddress htmlexpand integer start location of previous email thread. 47.0 emailthread isrichtext boolean indicates whether the body of the email message is 36.0 in rich text format. status connectapi. status of an email message on a case. values are: 47.0 emailmessagestatus • draftstatus • forwardedstatus • newstatus • readstatus • repliedstatus • sentstatus subject string subject of the email message. 32.0 textbody string body of the email message. 32.0–35.0 important: in version 36.0 and later, use the body property. toaddresses list totalattachments integer total number of attachments in the email message. 38.0 see also: connectapi.feedelementcapabilities 1771apex reference guide connectapi output classes connectapi.emoji an emoji. property name type description available version category string emoji category. 39.0 shortcut string emoji shortcut. 39.0 unicodecharacter string emoji’s unicode character. 39.0 see also: connectapi.emojicollection connectapi.emojicollection a collection of emoji. property name type description available version emojis list see also: connectapi.supportedemojis connectapi.enhancedlinkcapability if a feed element has this capability, it has a link that may contain supplemental information like an icon, a title, and a description. subclass of connectapi.feedelementcapability. property name type description available version description string a description with a 500 character limit. 32.0 icon connectapi.icon a icon. 32.0 linkrecordid string a id associated with the link if the link url refers to 32.0 a salesforce record. linkurl string a link url to a detail page if available content can’t 32.0 display inline. title string a title to a detail page. 32.0 see also: connectapi.feedelementcapabilities 1772apex reference guide connectapi output classes" "connectapi.ensurefundsasyncoutputrepresentation id of the asynchronous background operation. this output only includes the operation id, regardless of whether a call is made to an external payment gateway. it doesn’t include any errors from the operation. subclass of connectapi.baseasyncoutputrepresentation. no additional properties. see also: ensurefundsasync(ordersummaryid, ensurefundsinput) connectapi.ensurerefundsasyncoutputrepresentation id of the asynchronous background operation. this output only includes the operation id, regardless of whether a call is made to an external payment gateway. it doesn’t include any errors from the operation. subclass of connectapi.baseasyncoutputrepresentation. no additional properties. see also: ensurerefundsasync(ordersummaryid, ensurerefundsinput) connectapi.entitylabel an entity's label. property name type description available version label string localized singular label of the entity. 40.0 labelplural string localized plural label of the entity. 40.0 see also: connectapi.recordsummary connectapi.entitylinksegment entity link segment. subclass of connectapi.messagesegment name type description available version motif connectapi.motif a set of small, medium, and large icons that indicate whether 28.0 class the entity is a file, group, record, or user. the motif can also contain the object’s base color. reference connectapi. a reference to the link object if applicable, otherwise, null. 28.0 reference 1773apex reference guide connectapi output classes connectapi.entityrecommendation a chatter, custom, or static recommendation. subclass of connectapi.abstractrecommendation. property name type description available version actonurl string for user, file, group, topic, and record entity 32.0 types, use this connect rest url with a post request to take action on the recommendation. for connectapi.recommendedobject entity types, such as custom recommendations, use the actionurl property of the connectapi.platformaction to take action on the recommendation. action connectapi. specifies the action to take on a recommendation. 32.0 recommendation • follow—follow a file, record, topic, or user. actiontype • join—join a group. • view—view a file, group, article, record, user, custom, or static recommendation. entity connectapi.actor the entity with which the receiver is recommended 32.0 to take action. connectapi.errorresponse base error response. property name type description available version errorcode string error code. 48.0 message string more error detail, if available. 48.0 see also: connectapi.baseoutputrepresentation connectapi.extension an extension. property name type description available version alternative connectapi. alternative representation of the extension. 40.0 representation alternative attachmentid string attachment id of the extension. 41.0 1774apex reference guide connectapi output classes property name type description available version extensionid string id of the extension. 40.0 payload string payload associated with the extension. 40.0 payloadversion string payload version that identifies the structure of the 40.0 payload associated with the extension. see also: connectapi.extensionscapability connectapi.extensiondefinition an extension's definition. property name type description available version canaccess boolean indicates whether users can access the extension 40.0 when it’s associated with a feed element. cancreate boolean indicates whether users can create a feed element 40.0 with the extension in the org. createddate datetime date when the extension was created. 40.0 description string description of the extension. 40.0 iconurl string url to the icon for the extension. 40.0 id string id of the extension. 40.0 information list isenabled boolean indicates whether the extension is enabled in the 40.0 only incommunity site. isenabled boolean indicates whether the extension is enabled in the 40.0 only inlightningpublisher lightning publisher. name string name of the extension. 40.0 position integer position in which the extension is displayed in the 41.0 publisher. see also: connectapi.extensiondefinitions 1775apex reference" "guide connectapi output classes connectapi.extensiondefinitions a collection of extension definitions. property name type description available version currentpagetoken string token identifying the current page. 40.0 currentpageurl string connect rest api url identifying the current page. 40.0 extension list nextpagetoken string token identifying the next page, or null if there 40.0 isn’t a next page. nextpageurl string connect rest api url identifying the next page, or 40.0 null if there isn’t a next page. total integer total number of extensions returned. 40.0 connectapi.extensionscapability if a feed element has this capability, it has one or more extension attachments. subclass of connectapi.feedelementcapability. property name type description available version items list see also: connectapi.feedelementcapabilities connectapi.externalcredential external credential, including the named credentials and principals associated with it and the type and status of each principal. if you don’t have the view setup and configuration permission, some properties are empty or show limited information. important: where possible, we changed noninclusive terms to align with our company value of equality. we maintained certain terms to avoid any effect on customer implementations. property name type description available version authenticationprotocol connectapi. authentication protocol of the external credential. 56.0 credentialauthentication values are: protocol • awssv4 • custom • noauth 1776apex reference guide connectapi output classes property name type description available version • oauth authenticationprotocol connectapi. authentication protocol variant of the external 57.0 variant credentialauthentication credential. values are: protocolvariant • awssv4_sts—aws signature version 4 with security token service. • jwtbearer—oauth 2.0 json web token bearer flow. • rolesanywhere—aws signature version 4 with identity and access management (iam) roles anywhere. authenticationstatus connectapi. status of the credential authentication. values are: 56.0 credentialauthentication • configured—credential has all required status credentials for at least one principal. • notconfigured—credential isn’t configured. • unknown—credential status can’t be determined because the authentication protocol is custom. customheaders list developername string fully qualified developer name of the external 56.0 credential. id string external credential id. 58.0 masterlabel string external credential label. 56.0 parameters list principals list relatednamed list credential. 1777apex reference guide connectapi output classes property name type description available version url string connect rest api url for the external credential. 58.0 see also: connectapi.externalcredentiallist connectapi.namedcredential connectapi.externalcredentiallist list of external credentials. property name type description available version external list connectapi.externalcredentialparameter external credential parameter. property name type description available version id string parameter id. 58.0 parameterdescription string parameter description. 58.0 parametername string parameter name. if the parametertype is 57.0 authparameter, valid values are: • awsaccountid—valid for awssv4. • awsprofilearn—valid for awssv4 with rolesanywhere. • awsregion—valid for awssv4. • awsservice—valid for awssv4. • awsstsduration—valid for awssv4 with sts or rolesanywhere. • awss" "tsexternalid—valid for awssv4 with sts. • awstrustanchorarn—valid for awssv4 with rolesanywhere. • scope—valid for oauth. other parameter types can be any value. parametertype connectapi. parameter type of the external credential. values are: 57.0 externalcredential • authparameter parametertype • authprovider 1778apex reference guide connectapi output classes property name type description available version • authproviderurl • authproviderurlqueryparameter • jwtbodyclaim • jwtheaderclaim • signingcertificate parametervalue string parameter value. if the parametertype is 57.0 jwtbodyclaim or jwtheaderclaim, the parameter value can contain formulas. if the parametertype is authprovider or signingcertificate, the parameter value is the fully qualified entity name of the corresponding entity. see also: connectapi.externalcredential connectapi.externalcredentialprincipal external credential principal. if you don’t have the view setup and configuration permission, some properties are empty or show limited information. property name type description available version authenticationstatus connectapi. status of the credential authentication. values are: 56.0 credentialauthentication • configured—credential has all required status credentials for at least one principal. • notconfigured—credential isn’t configured. • unknown—credential status can’t be determined because the authentication protocol is custom. id string id of the external credential principal. 58.0 parameters list principalaccess list principalname string name of the external credential named principal. 56.0 1779apex reference guide connectapi output classes property name type description available version principaltype connectapi. type of credential principal. values are: 56.0 credentialprincipal • awsstsprincipal type • namedprincipal • peruserprincipal sequencenumber integer sequence number of the external credential principal. 58.0 see also: connectapi.externalcredential connectapi.externalcredentialprincipalaccess external credential principal access. property name type description available version developername string developer name of the associated access entity. 58.0 id string id of the associated access entity. 58.0 type connectapi. access type of the external credential principal. values 58.0 externalcredential are: principalaccesstype • permissionset • permissionsetgroup • profile see also: connectapi.externalcredentialprincipal connectapi.externalfilepermissioninformation external file permission information. property name type description available version external list when includeexternalfilepermissionsinfo is false. external boolean true if the retrieval of external file information failed 39.0 filepermissions or if failure includeexternalfilepermissionsinfo is false; false otherwise. 1780apex reference guide connectapi output classes property name type description available version external string explanation of the failure if a failure occurred and 39.0 filepermissions includeexternalfilepermissionsinfo infofailurereason is true; null otherwise. external connectapi. sharing status for the external file. values are: 39.0 filesharing contenthub • domainsharing—file is shared with the status externalitem domain. sharingtype • privatesharing—file is private or shared only with individuals. • publicsharing—file is publicly shared. value is null for non-external files or when includeexternalfilepermissionsinfo is false. repository list null for non-external files or when includeexternalfilepermissionsinfo is false. see also: connectapi.abstractrepositoryfile connectapi.externalmanagedaccountaddressoutput default shipping address for an externally managed account. property name type description available version city string city of the" external managed account record. 53.0 country string country of the external managed account record. 53.0 geolocationaccuracy string geolocation accuracy of the external managed 53.0 account record. latitude string latitude of the external managed account record. 53.0 longitude string longitude of the external managed account record. 53.0 state string state of the external managed account record. 53.0 street string street of the external managed account record. 53.0 zip string postal code of the external managed account record. 53.0 see also: connectapi.externalmanagedaccountoutput 1781apex reference guide connectapi output classes connectapi.externalmanagedaccountcollectionoutput collection of externally managed accounts. property name type description available version externalmanaged list totalexternal integer total number of externally managed accounts. 49.0 managedaccounts connectapi.externalmanagedaccountoutput externally managed account. property name type description available version accountid string id of the account managed by another account. 49.0 accountname string name of the external managed account record. 53.0 address connectapi. default shipping address of the external managed 53.0 externalmanagedaccount account. addressoutput externalmanaged string id of the external managed account record. 49.0 accountid ismyaccount boolean specifies whether the account is the context user’s 53.0 account (true) or not (false). see also: connectapi.externalmanagedaccountcollectionoutput connectapi.facetvalue facet value. this class is abstract and is a superclass of connectapi.distinctfacetvalue. property name type description available version type connectapi. search facet type. value is: 52.0 commercesearch • distinctvalue facettype connectapi.features features available to the context user in the org. 1782 "apex reference guide connectapi output classes property type description available version activityreminder boolean reserved for future use. 37.0 notifications enabled chatter boolean specifies whether chatter is enabled. 28.0 chatteractivity boolean specifies whether user details include information about chatter activity. 28.0 chatteranswers boolean specifies whether chatter answers is enabled. 29.0 note: with the spring ’18 release, salesforce no longer supports chatter answers. users of chatter answers can post, answer, comment, or view existing chatter answers data, but support and updates are scheduled to end. we recommend transitioning to chatter questions. for more information, see end of support for chatter answers in spring ’18. chatter boolean specifies whether user details include global chatter activity. 28.0 globalinfluence chattergroup boolean specifies whether chatter groups can have records associated with them. 30.0 records chattergroup boolean specifies whether chatter records are implicitly shared among group 30.0 recordsharing members when records are added to groups. chatter boolean specifies whether chatter messages are enabled. 28.0 messages chattertopics boolean specifies whether topics are enabled. 28.0 communities boolean specifies whether digital experiences is enabled. 31.0 enabled community boolean specifies whether moderation is enabled. 29.0 moderation community boolean specifies whether reputation is enabled. 32.0 reputation dashboard boolean specifies whether the user can post dashboard component snapshots. 28.0 component snapshots default string iso code of the default currency. applicable only when 28.0 currency multicurrency is false. isocode einstein boolean reserved for future use. 46.0 voiceenabled 1783apex reference guide connectapi output classes property type description available version einstein boolean reserved for future use. 46.0 voiceinpilot enabled einstein boolean reserved for future use. 46.0 voicelogging enabled einstein integer reserved for future use. 46.0 voiceproviderid favorites boolean specifies whether favorites in lightning are enabled. 41.0 enabled feedpolling boolean reserved for future use. 28.0 feedstream boolean specifies whether chatter feed streams are enabled. 39.0 enabled files boolean specifies whether files can act as resources for connect rest api. 28.0 filesoncomments boolean specifies whether files can be attached to comments. 28.0 forecasting3 boolean specifies whether aggregated forecasting is enabled for mobile clients. 38.0 aggregated enabled forecasting boolean specifies whether forecasting is enabled. 38.0 enabled forecasting integer range of the forecasting period. 38.0 periodrange forecasting integer start index for the forecasting period. 38.0 periodstart forecasting connectapi. time period used for forecasting. values are: 38.0 periodtype periodtype • month • quarter • week • year groupscanfollow boolean reserved for future use. 28.0–29.0 ideas boolean specifies whether ideas is enabled. 29.0 liveagent string live agent host name configured for the org. 41.0 hostname managedtopics boolean specifies whether managed topics are enabled. 32.0 enabled 1784apex reference guide connectapi output classes property type description available version maxentity integer specifies the maximum number of feed-enabled entities that can be 39.0 subscriptions subscribed to in a chatter stream. perstream maxfiles integer specifies the maximum number of files that can be added to a feed item. 36.0 perfeeditem maxstreams integer specifies the maximum number of chatter streams that a user can have. 39.0 perperson mobile boolean reserved for future use. 29.0 notifications enabled multicurrency boolean specifies whether the org uses multiple currencies (true) or not 28.0 (false). when false, the defaultcurrencyisocode indicates the iso code of the default currency. offlineedit boolean specifies whether the offline object permissions are enabled for salesforce 37.0 enabled for android and salesforce for ios mobile clients. publisheractions boolean specifies whether actions in the publisher are enabled. 28.0 storedata boolean specifies whether the salesforce for android and salesforce for ios can 30.0 ondevices use secure, persistent storage on mobile devices to cache data. enabled thanksallowed boolean reserved for future use. 28.0 trendingtopics boolean specifies whether trending topics are enabled" ". 28.0 usernav boolean specifies whether users can customize the navigation bar in lightning. 41.0 itemsenabled viralinvites boolean specifies whether existing chatter users can invite people in their 28.0 allowed company to use chatter. wave boolean specifies whether crm analytics is enabled. 36.0 see also: getsettings() connectapi.organizationsettings connectapi.feed chatter feed. 1785apex reference guide connectapi output classes name type description available version feedelement string connect rest api url to post feed elements to this subject. 31.0 posturl feedelements connectapi. page of feed elements for the feed specified in 40.0 feedelement redirectedfeedtype. otherwise, null. page feedelementsurl string connect rest api url to feed elements. 31.0 feeditemsurl string connect rest api url to feed items. 28.0–31.0 ismodifedurl string connect rest api url with a since request parameter that contains 28.0 an opaque token that describes when the feed was last modified. returns null if the feed isn’t a news feed. use this url to poll a news feed for updates. important: this feature is available through a feed polling pilot program. this pilot program is closed and not accepting new participants. pinnedfeed string url to pinned feed items. 41.0 elementsurl redirected connectapi. filter for the feed specified in redirectedfeedtype. otherwise, 42.0 feedfilter feedfilter null. redirected connectapi. sort order for the feed specified in redirectedfeedtype. 42.0 feedsort feedsort otherwise, null. order redirected connectapi. specifies which feed is returned if pagesize is specified. otherwise, 40.0 feedtype feedtype null. respectsmute boolean indicates whether the feed respects the mute feature. if true, the feed 35.0 shows the ability to mute or unmute each element, depending on the value of ismutedbyme; null if the mute feature is disabled for the organization. connectapi.feedbody feed body. subclass of connectapi.abstractmessagebody no additional properties. see also: connectapi.comment connectapi.feedelement connectapi.feedentitysummary 1786apex reference guide connectapi output classes connectapi.feeddirectory directory of feeds and favorites. name type description available version favorites list feeds list a list of feeds 30.0 connectapi.feeddirectoryitem definition of a feed. name type description available version feedelementsurl string connect rest api resource url for the feed elements. feeditemsurl string connect rest api resource url for the feed items of a specific feed. 30.0–31.0 feedtype connectapi the feed type. one of these values: 30.0 .feedtype • bookmarks—contains all feed items saved as bookmarks by the enum context user. • company—contains all feed items except feed items of type trackedchange. to see the feed item, the user must have sharing access to its parent. • directmessagemoderation—contains all direct messages that are flagged for moderation. the direct message moderation feed is available only to users with moderate experiences chatter messages permissions. • directmessages—contains all feed items of the context user’s direct messages. • draft—contains all the feed items that the context user drafted. • files—contains all feed items that contain files posted by people or groups that the context user follows. • filter—contains the news feed filtered to contain feed items whose parent is a specified object type. • groups—contains all feed items from all groups the context user either owns or is a member of. • home—contains all feed items associated with any managed topic in an experience cloud site. • landing—contains all feed items that best drive user engagement when the feed is requested. allows clients to avoid an empty feed when there aren’t many personalized feed items. 1787apex reference guide connectapi output classes name type description available version • moderation—contains all feed items that are flagged for moderation, except direct messages. the moderation feed is available only to users with moderate experiences feeds permissions. • mute—contains all" "feed items that the context user muted. • news—contains all updates for people the context user follows, groups the user is a member of, and files and records the user is following. contains all updates for records whose parent is the context user. • pendingreview—contains all feed items and comments that are pending review. • people—contains all feed items posted by all people the context user follows. • record—contains all feed items whose parent is a specified record, which could be a group, user, object, file, or any other standard or custom object. when the record is a group, the feed also contains feed items that mention the group. when the record is a user, the feed contains only feed items on that user. you can get another user’s record feed. • streams—contains all feed items for any combination of up to 25 feed-enabled entities that the context user subscribes to in a stream. examples of feed-enabled entities include people, groups, and records, • to—contains all feed items with mentions of the context user. contains feed items the context user commented on and feed items created by the context user that are commented on. • topics—contains all feed items that include the specified topic. • userprofile—contains feed items created when a user changes records that can be tracked in a feed. contains feed items whose parent is the user and feed items that @mention the user. this feed is different than the news feed, which returns more feed items, including group updates. you can get another user’s user profile feed. feedurl string connect rest api resource url for a specific feed 30.0 keyprefix string a key prefix is the first three characters of a record id, which specifies the 30.0 object type. for filter feeds, this value is the key prefix associated with the object type used to filter this feed. all feed items in this feed have a parent whose object type matches this key prefix value. for non-filter feeds, this value is null. 1788apex reference guide connectapi output classes name type description available version label string localized label of the feed 30.0 see also: connectapi.feeddirectory connectapi.feedelement feed elements are the top-level items that a feed contains. feeds are feed element containers. this class is abstract. superclass of: • connectapi.feeditem • connectapi.genericfeedelement property name type description available version body connectapi. information about the feed element. 22.0 feedbody important: use the header.text property as the default value for rendering text because the body.text property can be null. capabilities connectapi. a container for all capabilities that can be included 31.0 feedelement with a feed element. capabilities createddate datetime iso 8601 format date string, for example, 31.0 2011-02-25t18:24:31.000z. feedelementtype connectapi. feed elements are the top-level objects that a feed 31.0 feedelementtype contains. the feed element type describes the characteristics of that feed element. one of these values: • bundle—a container of feed elements. a bundle also has a body made up of message segments that can always be gracefully degraded to text-only values. • feeditem—a feed item has a single parent and is scoped to oneexperience cloud site or across all experience cloud sites. a feed item can have capabilities such as bookmarks, canvas, content, comment, link, poll. feed items have a body made up of message segments that can always be gracefully degraded to text-only values. 1789apex reference guide connectapi output classes property name type description available version • recommendation—a recommendation is a feed element with a recommendations capability. a recommendation suggests records to follow, groups to join, or applications that are helpful to the context user. header connectapi. the header is the title of the post. this property 31.0 messagebody contains renderable plain text for all the segments of the message. if a client doesn’t know how to render a feed element type, it should render this text. id string 18-character id of the feed element. 22.0 modifieddate datetime iso 8601 format date string, for example, 31.0 2011-02-25t18:24:31.000z. parent connectapi. feed element’s" "parent 28.0 actorwithid relativecreated string the created date formatted as a relative, localized 31.0 date string, for example, “17m ago” or “yesterday.” url string connect rest api url to this feed element. 22.0 see also: connectapi.announcement connectapi.feedelementpage connectapi.pinnedfeedelements connectapi.questionandanswerssuggestions connectapi.feedelementcapabilities a container for all capabilities that can be included with a feed element. property name type description available version approval connectapi. if a feed element has this capability, it includes 32.0 approvalcapability information about an approval. associated connectapi. if a feed element has this capability, it has platform 33.0 actions associatedactions actions associated with it. capability banner connectapi. if a feed element has this capability, it has a banner 31.0 bannercapability motif and style. bookmarks connectapi. if a feed element has this capability, the context user 31.0 bookmarks can bookmark it. capability 1790apex reference guide connectapi output classes property name type description available version bundle connectapi. if a feed element has this capability, it has a container 31.0 bundlecapability of feed elements called a bundle. callcollaboration connectapi. if a feed element has this capability, it has a recording 51.0 callcollaboration comment. capability canvas connectapi.canvas if a feed element has this capability, it renders a 32.0 capability canvas app. casecomment connectapi.case if a feed element has this capability, it has a case 32.0 commentcapability comment on the case feed. chatterlikes connectapi. if a feed element has this capability, the context user 31.0 chatterlikes can like it. exposes information about existing likes. capability close connectapi. if a feed element has this capability, users with 43.0 closecapability permission can close it. comments connectapi. if a feed element or comment has this capability, the 31.0 commentscapability context user can add a comment to it. content connectapi. if a comment has this capability, it has a file 32.0–35.0 contentcapability attachment. most connectapi.contentcapability properties are null if the content has been deleted from the feed element or if the access has changed to private. important: in version 36.0 and later, use the files property. dashboardcomponent connectapi. if a feed element has this capability, it has a 32.0 snapshot dashboardcomponent dashboard component snapshot. a snapshot is a snapshotcapability static image of a dashboard component at a specific point in time. directmessage connectapi. if a feed element has this capability, it’s a direct 39.0 directmessage message. capability edit connectapi. if a feed element has this capability, users who have 34.0 editcapability permission can edit it. emailmessage connectapi. if a feed element has this capability, it has an email 32.0 emailmessage message from a case. capability enhancedlink connectapi. if a feed element has this capability, it has a link that 32.0 enhancedlink may contain supplemental information like an icon, capability a title, and a description. 1791apex reference guide connectapi output classes property name type description available version extensions connectapi. if a feed element has this capability, it has one or 40.0 extensionscapability more extension attachments. feedentityshare connectapi. if a feed element or comment has this capability, a 39.0 feedentity feed entity is shared with it. sharecapability files connectapi. if a feed element has this capability, it has one or 36.0 filescapability more file attachments. interactions connectapi. if a feed element has this capability, it has information 37.0 interactions about user interactions. capability link connectapi. if a feed element has this capability, it has a link. 32.0 linkcapability mediareferences connectapi. if a feed element has this capability, it has one or 41.0 mediareference more media references. capability moderation connectapi. if a feed element has this capability, users in an 31.0 moderation experience cloud site can flag it for" "moderation. capability mute connectapi. if a feed element has this capability, users can mute 35.0 mutecapability it. origin connectapi. if a feed element has this capability, it was created 33.0 origincapability by a feed action. pin connectapi. if a feed element has this capability, users who have 41.0 pincapability permission can pin it to a feed. poll connectapi. if a feed element has this capability, it includes a poll. 31.0 pollcapability questionandanswers connectapi. if a feed element has this capability, it has a question 31.0 questionandanswers and comments on the feed element are answers to capability the question. readby connectapi. if a feed element has this capability, the context user 40.0 readbycapability can mark it as read. recommendations connectapi. if a feed element has this capability, it has a 32.0 recommendations recommendation. capability recordsnaphot connectapi. if a feed element has this capability, it contains all the 32.0 recordsnapshot snapshotted fields of a record for a single create capability record event. 1792apex reference guide connectapi output classes property name type description available version socialpost connectapi. if a feed element has this capability, it can interact 36.0 socialpostcapability with a social post on a social network. status connectapi. if a feed post or comment has this capability, it has 37.0 statuscapability a status that determines its visibility. topics connectapi. if a feed element has this capability, the context user 31.0 topicscapability can add topics to it. topics help users organize and discover conversations. trackedchanges connectapi. if a feed element has this capability, it contains all 32.0 trackedchanges changes to a record for a single tracked change event. capability updownvote connectapi. if a feed post or comment has this capability, users 41.0 updownvotecapability can upvote or downvote it. see also: connectapi.feedelement connectapi.feeditemsummary connectapi.feedelementcapability a feed element capability, which defines the characteristics of a feed element. in api version 30.0 and earlier, most feed items can have comments, likes, topics, and so on. in version 31.0 and later, every feed item (and feed element) can have a unique set of capabilities. if a capability property exists on a feed element, that capability is available, even if the capability property doesn’t have a value. for example, if the chatterlikes capability property exists on a feed element (with or without a value), the context user can like that feed element. if the capability property doesn’t exist, it isn’t possible to like that feed element. a capability can also contain associated data. for example, the moderation capability contains data about moderation flags. this class is abstract. this class is a superclass of: • connectapi.associatedactionscapability • connectapi.approvalcapability • connectapi.bannercapability • connectapi.bookmarkscapability • connectapi.bundlecapability • connectapi.callcollaborationcapability • connectapi.canvascapability • connectapi.casecommentcapability • connectapi.chatterlikescapability • connectapi.closecapability • connectapi.commentscapability 1793apex reference guide connectapi output classes • connectapi.contentcapability • connectapi.dashboardcomponentsnapshotcapability • connectapi.directmessagecapability • connectapi.emailmessagecapability • connectapi.enhancedlinkcapability • connectapi.extensionscapability • connectapi.feedentitysharecapability • connectapi.filescapability • connectapi.interactionscapability • connectapi.linkcapability • connectapi.mediareferencecapability • connectapi.moderationcapability • connectapi.mutecapability • connectapi.origincapability • connectapi.pincapability • connectapi.pollcapability • connectapi.questionandanswerscapability • connectapi.readbycapability • connectapi.recommendationscapability • connectapi.recordcapability • connectapi.recordsnapshot" "capability • connectapi.socialpostcapability • connectapi.statuscapability • connectapi.topicscapability • connectapi.trackedchangescapability • connectapi.updownvotecapability • connectapi.verifiedcapability this class doesn’t have any properties. connectapi.feedelementpage a paged collection of connectapi.feedelement objects. property name type description available version currentpagetoken string token identifying the current page. 31.0 currentpageurl string connect rest api url identifying the current page. 31.0 elements list ismodifiedtoken string opaque polling token to use in the since 31.0 parameter of the chatterfeeds.ismodified 1794apex reference guide connectapi output classes property name type description available version method. the token describes when the feed was last modified. important: this feature is available through a feed polling pilot program. this pilot program is closed and not accepting new participants. ismodifiedurl string connect rest api url with a since request 31.0 parameter that contains an opaque token that describes when the feed was last modified. returns null if the feed isn’t a news feed. use this url to poll a news feed for updates. important: this feature is available through a feed polling pilot program. this pilot program is closed and not accepting new participants. nextpagetoken string token identifying the next page, or null if there 31.0 isn’t a next page. nextpageurl string connect rest api url identifying the next page, or 31.0 null if there isn’t a next page. updatestoken string a token to use in a request to the 31.0 connectapi.chatterfeeds.getfeedelementsupdatedsince method. updatesurl string connect rest api feed resource containing the feed 31.0 elements that have been updated since the feed was refreshed. if the feed doesn’t support this feature, the value is null. see also: connectapi.bundlecapability connectapi.feed connectapi.feedenabledentity an entity that can have feeds associated with it. property name type description available version id string the 18-character id of the record. 39.0 motif connectapi.motif small, medium, and large icons indicating the 39.0 record's type. 1795apex reference guide connectapi output classes property name type description available version name string the localized name of the record. 39.0 type string the type of the record. 39.0 url string url to the record. 39.0 see also: connectapi.chatterstream connectapi.feedentityiseditable indicates if the context user can edit a feed element or comment. property name type description available version areattachments boolean true if the context user can add and remove 36.0 editablebyme attachments on the feed element or comment, false otherwise. feedentityurl string url of the feed element or comment. 34.0 iseditablebyme boolean true if the context user can edit the feed element 34.0 or comment, false otherwise. connectapi.feedentitynotavailablesummary a summary when the feed entity isn’t available. subclass of connectapi.feedentitysummary. no additional properties. connectapi.feedentityreadsummary summary of the feed post or comment that was read. subclass of connectapi.userfeedentityactivitysummary. no additional properties. connectapi.feedentitysharecapability if a feed element or comment has this capability, a feed entity is shared with it. subclass of connectapi.feedelementcapability. 1796apex reference guide connectapi output classes property name type description available version feedentity connectapi. the summary of the feed entity that is shared with 39.0 feedentity the feed element or comment. summary see also: connectapi.feedelementcapabilities connectapi.feedentitysummary the summary of a feed entity that is shared with a feed element. this class is abstract. superclass of: • connectapi.feeditemsummary • connectapi.feedentitynotavailablesummary property name type description available version actor connectapi.actor entity that created the feed entity. 39.0 body connectapi. information about the feed entity. 39.0" "feedbody createddate datetime iso 8601 date string, for example, 39.0 2011-02-25t18:24:31.000z, when the entity was created. feedelementtype connectapi. type of feed entity. 39.0 feedelementtype • bundle—a container of feed elements. a bundle also has a body made up of message segments that can always be gracefully degraded to text-only values. • feeditem—a feed item has a single parent and is scoped to oneexperience cloud site or across all experience cloud sites. a feed item can have capabilities such as bookmarks, canvas, content, comment, link, poll. feed items have a body made up of message segments that can always be gracefully degraded to text-only values. • recommendation—a recommendation is a feed element with a recommendations capability. a recommendation suggests records to follow, groups to join, or applications that are helpful to the context user. id string 18-character id of the feed entity. 39.0 1797apex reference guide connectapi output classes property name type description available version isentityavailable boolean specifies whether the entity is available. if false, 39.0 either the user doesn’t have access to the entity or the entity was deleted. parent connectapi. parent of the feed entity. 39.0 actorwithid relativecreateddate string relative created date, for example, “2h ago.” 39.0 url string url to the feed entity. 39.0 see also: connectapi.feedentitysharecapability connectapi.feedfavorite feed favorite. name type description available version community connectapi.reference information about the experience cloud site that 28.0 contains the favorite. createdby connectapi.user favorite’s creator. 28.0 summary feedurl string connect rest api url identifying the feed item for 28.0 this favorite. id string favorite’s 18–character id. 28.0 lastviewdate datetime iso 8601 date string, for example, 28.0 2011-02-25t18:24:31.000z. name string favorite’s name. 28.0 searchtext string if the favorite is from a search, contains the search text, 28.0 otherwise, an empty string. target connectapi.reference a reference to the topic if applicable, null otherwise. 28.0 type connectapi. an empty string or one of the following values: 28.0 feedfavoritetype enum • listview • search • topic url string connect rest api url to this favorite. 28.0 1798apex reference guide connectapi output classes name type description available version user connectapi.user information about the user who saved this favorite. 28.0 summary see also: connectapi.feeddirectory connectapi.feedfavorites connectapi.feedfavorites feed favorites. name type description available version favorites list total integer total number of favorites. 28.0 connectapi.feeditem subclass of connectapi.feedelement class as of 31.0. name type description available version actor connectapi.actor the entity that created the feed item. 28.0 attachment connectapi.feeditem information about the attachment. if there is no 28.0–31.0 attachment attachment, returns null. important: as of version 32.0, use the inherited capabilities property. canshare boolean indicates whether the feed item can be shared. 28.0–38.0 if a feed item has multiple file attachments and at least one attachment has been deleted or is inaccessible, the feed item can’t be shared. the canshare value is incorrectly set to true in these cases. important: as of version 39.0, use the issharable property. clientinfo connectapi.clientinfo information about the connected app used to 28.0 authenticate the connection. 1799apex reference guide connectapi output classes name type description available version comments connectapi.commentpage first page of comments for this feed item. 28.0–31.0 important: as of version 32.0, use the inherited capabilities.comments.page property. event boolean true if feed item is created due to an event change, 22.0 false otherwise. hasverified boolean true if" "the feed item has a verified comment, 41.0 comment otherwise false. isbookmarked boolean true if the context user has bookmarked this feed 28.0–31.0 bycurrentuser item, otherwise, false. important: as of version 32.0, use the inherited capabilities.bookmarks.isbookmarkedbycurrentuser property. isdelete boolean if this property is true the comment cannot be 28.0 restricted deleted by the context user. if it is false, it might be possible for the context user to delete the comment, but it is not guaranteed. islikedby boolean true if the context user has liked this feed item, 28.0–31.0 currentuser otherwise, false. important: as of version 32.0, use the inherited capabilities.chatterlikes.islikedbycurrentuser property. issharable boolean indicates whether the feed item can be shared. 39.0 likes connectapi.chatterlike first page of likes for this feed item. 28.0–31.0 page important: as of version 32.0, use the inherited capabilities.chatterlikes.page property. likesmessage connectapi.messagebody a message body the describes who likes the feed item. 28.0–31.0 important: as of version 32.0, use the inherited capabilities.chatterlikes.likesmessage property. 1800apex reference guide connectapi output classes name type description available version moderationflags connectapi. information about the moderation flags on a feed 29.0–30.0 moderationflags item. if connectapi.features.communitymoderation is false, this property is null. important: as of version 31.0, use the inherited capabilities.moderation.moderationflags property. mylike connectapi.reference if the context user has liked the feed item, this 28.0–31.0 property is a reference to the specific like, otherwise, null. important: as of version 32.0, use the inherited capabilities.chatterlikes.mylike property. originalfeeditem connectapi.reference a reference to the original feed item if this feed item 28.0 is a shared feed item, otherwise, null. originalfeed connectapi.actor if this feed item is a shared feed item, returns 28.0 itemactor information about the original poster of the feed item, otherwise, returns null. photourl string url of the photo associated with the feed item 28.0 preamble connectapi.messagebody a collection of message segments, including the 28.0-30.0 unformatted text of the message that you can use as the title of a feed item. message segments include name, link, and motif icon information for the actor that created the feed item. important: for api versions 29.0 and 30.0, use the connectapi.feeditem.preamble.text property as the default case to render text. for api versions 31.0 and later, use the connectapi.feedelement.header.text property as the default case to render text. topics connectapi.feeditemtopicpage topics for this feed item. 28.0–31.0 important: as of version 31.0, use the inherited capabilities.topics.items property. 1801apex reference guide connectapi output classes name type description available version type connectapi.feeditemtype type of feed item. 28.0 important: as of api version 32.0, use the capabilities property to determine what can be done with a feed item. see working with feeds and feed elements. one of these values: • activityevent—feed item generated in case feed when an event or task associated with a parent record with a feed enabled is created or updated. • advancedtextpost—a feed item with advanced text formatting, such as a group announcement post. • approvalpost—feed item with an approval capability. approvers can act on the feed item parent. • attacharticleevent—feed item generated when an article is attached to a case in case feed. • basictemplatefeeditem—feed item with an enhanced link capability. • calllogpost—feed item generated when a call log is saved to a case in case feed." "• canvaspost—feed item generated by a canvas app in the publisher or from connect rest api or connect in apex. the post itself is a link to a canvas app. • casecommentpost—feed item generated when a case comment is saved in case feed. • changestatuspost—feed item generated when the status of a case is changed in case feed. • chattranscriptionpost—feed item generated in case feed when a live agent chat transcript is saved to a case. • collaborationgroupcreated—feed item generated when a new public group is created. contains a link to the new group. • collaborationgroupunarchived—deprecated. feed item generated when an archived group is activated. • contentpost—feed item with a content capability. 1802apex reference guide connectapi output classes name type description available version • createrecordevent—feed item that describes a record created in the publisher. • dashboardcomponentalert—feed item with a dashboard alert. • dashboardcomponentsnapshot—feed item with a dashboard component snapshot capability. • emailmessageevent—feed item generated when an email is sent from a case in case feed. • facebookpost—deprecated. feed item generated when a facebook post is created from a case in case feed. • linkpost—feed item with a link capability. • milestoneevent—feed item generated when a case milestone is either completed or reaches a violation status. contains a link to the case milestone. • pollpost—feed item with a poll capability. viewers of the feed item are allowed to vote on the options in the poll. • profileskillpost—feed item generated when a skill is added to a user’s profile. • questionpost—feed item generated when a question is asked. as of api version 33.0, a feed item of this type can have a content capability and a link capability. • replypost—feed item generated by a chatter answers reply. • rypplepost—feed item generated when a user posts thanks. • socialpost—feed item generated when a social post is created from a case in case feed. • textpost—feed item containing text only. • trackedchange—feed item created when one or more fields on a record have been changed. • userstatus—deprecated. a user's post to their own profile. visibility connectapi.feeditem type of users who can see a feed item. 28.0 visibilitytype • allusers—visibility is not limited to internal users. 1803apex reference guide connectapi output classes name type description available version • internalusers—visibility is limited to internal users. connectapi.feeditemsummary a feed item summary. subclass of connectapi.feedentitysummary. property name type description available version capabilities connectapi. container for all capabilities that can be included 39.0 feedelement with a feed item. capabilities header connectapi. title of the post. this property contains renderable 39.0 messagebody plain text for all the message segments. if a client doesn’t know how to render a feed element type, it should render this text. modifieddate datetime when the feed item was modified in the form of an 39.0 iso 8601 date string, for example, 2011-02-25t18:24:31.000z. originalfeeditem connectapi. reference to the original feed item if this feed item 39.0 reference is a shared feed item; otherwise, null. originalfeed connectapi.actor if this feed item is a shared feed item, information 39.0 itemactor about the original poster of the feed item; otherwise, null. photourl string url of the photo associated with the feed item. 39.0 visibility connectapi. specifies who can see a feed item. 39.0 feeditemvisibility • allusers—visibility is not limited to internal users. • internalusers—visibility is limited to internal users. connectapi.feedmodifiedinfo important: this feature is available through a feed polling pilot program. this pilot program is closed and not accepting new participants. 1804apex reference guide connectapi output classes name type description available version ismodified boolean true if the news feed has been modified since the last time it was 28.0 polled; false otherwise. returns null if the feed is not a news feed. ismodified" "token string opaque polling token to use in the since parameter of the 28.0 chatterfeeds.ismodified method. the token describes when the feed was last modified. nextpollurl string connect rest api url with a since request parameter that contains 28.0 an opaque token that describes when the feed was last modified. returns null if the feed isn’t a news feed. use this url to poll a news feed for updates. connectapi.feedpollchoice feed poll choice. name type description available version id string poll choice id. 28.0 position integer the location in the poll where this poll choice exists. the first poll 28.0 choice starts at 1. text string label text associated with the poll choice. 28.0 votecount integer total number of votes for this poll choice. 28.0 votecountratio double the ratio of total number of votes for this poll choice to all votes cast 28.0 in the poll. multiply the ratio by 100 to get the percentage of votes cast for this poll choice. see also: connectapi.pollcapability connectapi.feedpostsummary summary of the post. subclass of connectapi.useractivitysummary. property name type description available version feeditemid string id of the post. 42.0 connectapi.feedreadsummary summary of the feed that was read. 1805apex reference guide connectapi output classes subclass of connectapi.useractivitysummary. property name type description available version containerid string id of the parent of the feed. 42.0 feedtype connectapi.feedtype type of feed. 42.0 • bookmarks—contains all feed items saved as bookmarks by the context user. • company—contains all feed items except feed items of type trackedchange. to see the feed item, the user must have sharing access to its parent. • directmessagemoderation—contains all direct messages that are flagged for moderation. the direct message moderation feed is available only to users with moderate experiences chatter messages permissions. • directmessages—contains all feed items of the context user’s direct messages. • draft—contains all the feed items that the context user drafted. • files—contains all feed items that contain files posted by people or groups that the context user follows. • filter—contains the news feed filtered to contain feed items whose parent is a specified object type. • groups—contains all feed items from all groups the context user either owns or is a member of. • home—contains all feed items associated with any managed topic in an experience cloud site. • landing—contains all feed items that best drive user engagement when the feed is requested. allows clients to avoid an empty feed when there aren’t many personalized feed items. • moderation—contains all feed items that are flagged for moderation, except direct messages. the moderation feed is available only to users with moderate experiences feeds permissions. • mute—contains all feed items that the context user muted. • news—contains all updates for people the context user follows, groups the user is a member of, and files and records the user is following. 1806apex reference guide connectapi output classes property name type description available version contains all updates for records whose parent is the context user. • pendingreview—contains all feed items and comments that are pending review. • people—contains all feed items posted by all people the context user follows. • record—contains all feed items whose parent is a specified record, which could be a group, user, object, file, or any other standard or custom object. when the record is a group, the feed also contains feed items that mention the group. when the record is a user, the feed contains only feed items on that user. you can get another user’s record feed. • streams—contains all feed items for any combination of up to 25 feed-enabled entities that the context user subscribes to in a stream. examples of feed-enabled entities include people, groups, and records, • to—contains all feed items with mentions of the context user. contains feed items the context user commented on and feed items created by the context user that are commented on. • topics—contains all feed items that include the specified topic. • userprofile—contains feed items created when a user changes" "records that can be tracked in a feed. contains feed items whose parent is the user and feed items that @mention the user. this feed is different than the news feed, which returns more feed items, including group updates. you can get another user’s user profile feed. connectapi.fieldchangesegment field change segment. subclass of connectapi.complexsegment. no additional properties. see also: connectapi.morechangessegment 1807apex reference guide connectapi output classes connectapi.fieldchangenamesegment field change name segment. subclass of connectapi.messagesegment. no additional properties. connectapi.fieldchangevaluesegment field change value segment. subclass of connectapi.messagesegment. name type description available version valuetype connectapi. value type of a field change. 28.0 fieldchange • newvalue—a new value valuetype enum • oldvalue—an old value url string url value if the field change is to a url field (such as 28.0 a web address) connectapi.fieldvalue field's value in product search results. property name type description available version value string value of the field. 52.0 see also: connectapi.productsummary connectapi.file file. this class is abstract. subclass of connectapi.actorwithid. superclass of connectapi.filesummary. name type description available version checksum string md5 checksum for the file. 28.0 content datetime iso 8601 format date string, for example, 32.0 modifieddate 2011-02-25t18:24:31.000z. file-specific modified date, which is updated only for direct file operations, such as rename. 1808apex reference guide connectapi output classes name type description available version modifications to the file from outside of salesforce can update this date. contentsize integer size of the file in bytes. 28.0 contenturl string if the file is a link, returns the url, otherwise, the string null. 28.0 createddate datetime iso 8601 date string when the file was created. 41.0 description string description of the file. 28.0 downloadurl string url to the file, that can be used for downloading the file. 28.0 fileextension string extension of the file. 28.0 filetype string type of file, such as pdf, powerpoint. 28.0 flashrendition string specifies if a flash preview version of the file has been 28.0 status rendered. note: flash renditions were retired on july 16, 2021. isfileasset boolean specifies whether the file is an asset. 46.0 isinmyfilesync boolean true if the file is synced with salesforce files sync; false 28.0 otherwise. note: salesforce files sync was retired on may 25, 2018. ismajorversion boolean true if the file is a major version; false if the file is a 31.0 minor version. major versions can’t be replaced. mimetype string file’s mime type. 28.0 moderationflags connectapi. information about the moderation flags on a file. if 30.0 moderationflags connectapi.features.communitymoderation is false, this property is null. modifieddate datetime iso 8601 format date string, for example, 28.0 2011-02-25t18:24:31.000z. modifications to the file from within salesforce update this date. name string name of the file. 28.0 origin string specifies the file source. valid values are: 28.0 • chatter—file came from chatter • content—file came from content owner connectapi.user file’s owner. 28.0 summary pdfrendition string specifies if a pdf preview version of the file has been 28.0 status rendered. 1809apex reference guide connectapi output classes name type description available version publishstatus connectapi. specifies the publish status of the file. 28.0 filepublishstatus • pendingaccess—file is pending publishing. • privateaccess—file is private. • publicaccess—file is public. renditionurl string url to the rendition for the file. 28.0 renditionurl string url to the 240 x 180 rendition resource for the file.for shared 29.0 240by180 files, rend" "itions process asynchronously after upload. for private files, renditions process when the first file preview is requested, and aren’t available immediately after the file is uploaded. renditionurl string url to the 720 x 480 rendition resource for the file.for shared 29.0 720by480 files, renditions process asynchronously after upload. for private files, renditions process when the first file preview is requested, and aren’t available immediately after the file is uploaded. sharingoption connectapi. sharing option of the file. values are: 35.0 filesharingoption • allowed—resharing of the file is allowed. • restricted—resharing of the file is restricted. sharingprivacy connectapi. sharing privacy of a file. values are: 41.0 filesharingprivacy • none—file is visible to anyone with record access. • privateonrecords—file is private on records. sharingrole connectapi. sharing role of the file. 28.0 filesharingtype • admin—owner permission, but doesn’t own the file. • collaborator—viewer permission, and can edit, change permissions, and upload a new version of a file. • owner—collaborator permission, and can make a file private, and delete a file. • viewer—can view, download, and share a file. • workspacemanaged—permission controlled by the library. systemmodstamp datetime iso 8601 date string indicating when a user or any automated 41.0 system process, such as a trigger, updated the file. textpreview string text preview of the file if available; null otherwise. 30.0 thumb120by90 string specifies the rendering status of the 120 x 90 preview image 28.0 renditionstatus of the file. one of these values: • processing—image is being rendered. • failed—rendering process failed. 1810apex reference guide connectapi output classes name type description available version • success—rendering process was successful. • na—rendering is not available for this image. thumb240by180 string specifies the rendering status of the 240 x 180 preview image 28.0 renditionstatus of the file. one of these values: • processing—image is being rendered. • failed—rendering process failed. • success—rendering process was successful. • na—rendering is not available for this image. thumb720by480 string specifies the rendering status of the 720 x 480 preview image 28.0 renditionstatus of the file. one of these values: • processing—image is being rendered. • failed—rendering process failed. • success—rendering process was successful. • na—rendering is not available for this image. title string title of the file. 28.0 versionnumber string file’s version number. 28.0 connectapi.fileasset an asset file. property name type description available version baseasseturl string base download url of the asset. 45.0 baseunauthenticated string base download url of the asset for unauthenticated 45.0 asseturl users if isvisiblebyexternalusers is true, otherwise null. id string id of the asset. 45.0 isvisibleby boolean indicates whether unauthenticated users can see the 45.0 externalusers asset file (true) or not (false). masterlabel string label of the asset. 45.0 name string unique name of the asset. 45.0 namespaceprefix string namespace prefix of the package containing the 45.0 asset. 1811apex reference guide connectapi output classes property name type description available version type string type of asset. 45.0 see also: connectapi.recommendation connectapi.nbanativerecommendation connectapi.filepreview a file preview. property name type description available version format connectapi. the format of the preview. values are: 39.0 filepreviewformat • jpg—preview format is jpg. • pdf—preview format is pdf. • svg—preview format is compressed svg. • thumbnail—preview format is 240 x 180 png. • thumbnailbig—preview format is 720 x 480 png. • thumbnailtiny—preview format is 120 x 90 png. previewurlcount integer the total number of preview urls for this preview 39.0 format. previewurls list status connectapi. the availability status of the preview. values are: 39.0 filepreviewstatus • available—preview is available. • inprogress—preview is being processed. • notavailable—preview is unavailable. • notscheduled—generation of the preview isn’t scheduled yet. url string the url for the file preview. 39.0 see also: connectapi.filepreviewcollection connectapi.filepreviewcollection a collection of file previews. 1812apex reference guide connectapi output classes property name type description available version fileid string id of the file. 39.0 previews list url string url to the current page of file previews. 39.0 versionnumber string version number of the file. 40.0 see also: connectapi.inlineimagesegment connectapi.filepreviewurl a url to a file preview. property name type description available version pagenumber integer preview page number starting from zero, or null 39.0 for pdf files. previewurl string file preview url. 39.0 see also: connectapi.filepreview connectapi.filescapability if a feed element has this capability, it has one or more file attachments. subclass of connectapi.feedelementcapability. property name type description available version items list see also: connectapi.feedelementcapabilities connectapi.filesummary a file summary. subclass of connectapi.file. no additional properties. 1813apex reference guide connectapi output classes connectapi.findrouteswithfewestsplitsoutputrepresentation a list of inventory location combinations that can fulfill an order without exceeding the maximum number of shipments. subclass of connectapi.baseoutputrepresentation. property name type description available version targetlocations list see also: findrouteswithfewestsplits(findrouteswithfewestsplitsinputrepresentation) connectapi.findrouteswithfewestsplitsusingocioutputrepresentation a list of order fulfillment routes with inventory availability information. subclass of connectapi.baseoutputrepresentation. property name type description available version results list see also: findrouteswithfewestsplitsusingoci(findrouteswithfewestsplitsusingociinput) connectapi.findrouteswithfewestsplitswithinventoryoutputrepresentation sets of inventory locations that can combine to fulfill an order, with availability data for those locations. subclass of connectapi.baseoutputrepresentation. property name type description available version inventory connectapi. inventory availability data for the location groups and 54.0 ocigetinventoryavailability locations specified in the input. outputrepresentation 1814apex reference guide connectapi output classes property name type description available version targetlocations list see also: findrouteswithfewestsplitsusingoci(findrouteswithfewestsplitsusingociinput) connectapi.findrouteswithfewestsplitsusingocioutputrepresentation connectapi.followerpage name type description available version currentpageurl string connect rest api url identifying the current page. 28.0 followers list nextpageurl string connect rest api url identifying the next page, or null 28.0 if there isn’t a next page. previouspageurl string connect rest api url identifying the previous page, or 28.0 null if there isn’t a previous page. total integer total number of followers across all pages. 28.0 connectapi.followingcounts name type description available version people integer number of people user is following. 28.0 records integer number of" "records user is following. 28.0 topics are a type of record that can be followed as of version 29.0. total integer total number of items user is following. 28.0 see also: connectapi.userdetail connectapi.followingpage name type description available version currentpageurl string connect rest api url identifying the current page. 28.0 1815apex reference guide connectapi output classes name type description available version following list nextpageurl string connect rest api url identifying the next page, or 28.0 null if there isn’t a next page. previouspageurl string connect rest api url identifying the previous page, 28.0 or null if there isn’t a previous page. total integer total number of records being followed across all 28.0 pages. connectapi.followintents a list of follow intents for a social persona. property name type description available version follows list see also: connectapi.socialpostintents connectapi.followsocialpersonaintent follow intent on a social persona. property name type description available version managedsocialaccount connectapi. managed social account that follows the social 45.0 managedsocialaccount persona. socialpersonaid string id of the social persona to follow. 45.0 see also: connectapi.followintents connectapi.form marketing integration form. property name type description available version dataextensionid string id of the data extension associated with the 53.0 marketing integration form. 1816apex reference guide connectapi output classes property name type description available version formfieldslist connectapi. list of form fields associated with the marketing 53.0 formfields integration form. formid string id of the marketing integration form. 53.0 formname string name of the marketing integration form. 53.0 connectapi.formfield marketing integration form field. property name type description available version name string name of the marketing integration form field. 53.0 type connectapi. type of marketing integration form field. values are: 53.0 formfieldtype • boolean • date • emailaddress • number • text see also: connectapi.formfields connectapi.formfields list of marketing integration form fields. property name type description available version formfields list integration form. see also: connectapi.form connectapi.formsubmission marketing integration form submission. property name type description available version formsubmissionid string id of the form submission, representing the 53.0 submission data that was saved. 1817apex reference guide connectapi output classes connectapi.formulascope formula scope for a target. property name type description available version contextvalues map map of context values for the scope. 50.0–51.0 note: in version 52.0 and later, use the contextvaluesmap property. contextvaluesmap map map of context values for the scope. 52.0 fields list list of fields of the scope. 50.0 formula string formula of the scope. 50.0 see also: connectapi.target connectapi.fulfillmentgroupoutputrepresentation information about one fulfillmentorder from a request to create fulfillment orders from multiple orderdeliverygroupsummaries. if the fulfillmentorder was created, then its id is returned. if it failed, then data from the input is returned so you can resubmit it. subclass of connectapi.baseoutputrepresentation. property name type description available version fulfilledfromlocationid string (creation failed) the input fulfilledfromlocationid. 50.0 fulfillmentorderid string the fulfillmentorderid from the successfully created 50.0 fulfillmentorder. fulfillmenttype string (creation failed) the input fulfillmenttype. 50.0 orderdeliverygroup string (creation failed) the input 50.0 summaryid orderdeliverygroupsummaryid. orderitemsummaries list ordersummaryid string (creation failed) the input ordersummaryid. 50.0 referenceid string the referenceid from the fulfillmentgroup input 50.0 representation. use this value to troubleshoot a failure. connectapi.fulfillmentordercancellineitemsoutputrepresentation wraps the base output. 1818apex reference guide connectapi output classes subclass of connectapi.baseoutputrepresentation. no additional properties. connectapi.fulfillmentorderinvoiceoutputrepresentation id of the created invoice. subclass of connectapi.baseoutputrepresentation. property name type description available version invoiceid string id of the created invoice. 48.0 connectapi.fulfillmentorderoutputrepresentation a list of ids of the created fulfillmentorders. subclass of connectapi.baseoutputrepresentation. property name type description available version fulfillment list a list of ids of created fulfillment orders. 48.0 orderids connectapi.gatewaylogresponse gateway log output. property name type description available version createddate datetime date when the gateway log was created. 50.0 gatewayresultcode string result codes that show the status of a transaction as 50.0 it is passed to the financial institution and then returned to the client. id string id of the gateway log record. 50.0 interactionstatus string gateway interaction status. it can be success, 50.0 failed, or timeout. connectapi.genericbundlecapability if a feed element has this capability, the feed element has a group of other feed elements condensed into one feed element. this group is called a bundle. subclass of connectapi.bundlecapability. connectapi.genericfeedelement a concrete implementation of the abstract connectapi.feedelement class. 1819apex reference guide connectapi output classes subclass of connectapi.feedelement connectapi.getfocapacityvaluesoutputrepresentation response to a request for fulfillment order capacity values for one or more locations. subclass of connectapi.baseoutputrepresentation. property name type description available version locations list connectapi.globalinfluence chatter influence. name type description available version percentile string percentile value for the user’s influence rank within the org or 28.0 experience cloud site. rank integer number indicating the user’s influence rank, relative to all other 28.0 users within the org or experience cloud site. see also: connectapi.userdetail connectapi.groupchattersettings a user’s chatter settings for a specific group. name type description available version emailfrequency connectapi. the frequency with which a group member receives 28.0 groupemailfrequency email from a group. enum connectapi.groupinformation describes the information section of the group. if the group is private, this section is visible only to members. name type description available version text string the text of the “information” section of the group. 28.0 1820apex reference guide connectapi output classes name type description available version title string the title of the “information” section of the group. 28.0 see also: connectapi.chattergroupdetail connectapi.groupmember member of a group. name type description available version id string user’s 18-character id. 28.0 lastfeed datetime the date and time at which the group member last 31.0 accessdate accessed the group feed. role connectapi. type of membership the user has with the group. 28.0 groupmembership • groupowner type enum • groupmanager • notamember • notamemberprivaterequested • standardmember url string connect rest api url to this membership. 28.0 user connectapi.user information about the user who is subscribed to this 28.0 summary group. see also: connectapi.groupmemberpage connectapi.groupmemberpage page of group members. name type description available version currentpageurl string connect rest api url identifying the current page. 28.0 members list mymembership connect" "api. if the context user is a member of this group, returns 28.0 reference information about that membership, otherwise, null. 1821apex reference guide connectapi output classes name type description available version nextpageurl string connect rest api url identifying the next page, or null if 28.0 there isn’t a next page. previouspageurl string connect rest api url identifying the previous page, or null 28.0 if there isn’t a previous page. totalmembercount integer total number of group members across all pages. 28.0 connectapi.groupmembershiprequest request to become a group member. name type description available version createddate datetime iso 8601 date string, for example, 2011-02-25t18:24:31.000z. 28.0 id string id for the group membership request object. 28.0 lastupdatedate datetime iso 8601 date string, for example, 2011-02-25t18:24:31.000z. 28.0 requestedgroup connectapi. information about the group the context user is requesting 28.0 reference to join. responsemessage string a message for the user if their membership request is 28.0 declined. the value of this property is used only when the value of the status property is declined. the maximum length is 756 characters. status connectapi. status of a request to join a private group. values are: 28.0 groupmembership • accepted requeststatus • declined enum • pending url string url of the group membership request object. 28.0 user connectapi.user information about the user requesting membership in a 28.0 summary group. see also: connectapi.groupmembershiprequests connectapi.groupmembershiprequests requests to become group members. 1822apex reference guide connectapi output classes name type description available version requests list total integer the total number of requests. 28.0 connectapi.grouprecord a record associated with a group. property type description available version id string record’s 18-character id. 33.0 record connectapi. information about the record associated with the group. 33.0 actorwithid url string record url. 33.0 see also: connectapi.grouprecordpage connectapi.grouprecordpage a paginated list of connectapi.grouprecord objects. property type description available version currentpageurl string connect rest api url identifying the current page. 33.0 nextpageurl string connect rest api url identifying the next page, or null if 33.0 there isn’t a next page. previous string connect rest api url identifying the previous page, or null 33.0 pageurl if there isn’t a previous page. records list totalrecord integer total number of records associated with the group. 33.0 count connectapi.hashtagsegment subclass of connectapi.messagesegment. 1823apex reference guide connectapi output classes name type description available version tag string text of the topic without the hash symbol (#). 28.0 topicurl string connect rest api topics resource that searches for the topic: 28.0 /services/data/v58.0/chatter /topics?exactmatch=true&q=topic url string connect rest api feed items resource url that searches for the topic 28.0 in all feed items in an organization: /services/data/v58.0/chatter/feed-items?q=topic connectapi.hidesocialpostintent hide intent for a social post. property name type description available version ishidden boolean specifies whether the managed social account hid 45.0 the social post (true) or not (false). managedsocialaccount connectapi. managed social account that hides the social post. 45.0 managedsocialaccount see also: connectapi.socialpostintents connectapi.holdfocapacityoutputrepresentation response to a request to hold fulfillment order capacity at one or more locations. can correspond to one action call. subclass of connectapi.baseoutputrepresentation. property name type description available version holdfocapacity list connectapi.holdfocapacityresponseoutputrepresentation response to a request to hold fulfillment order capacity at one or more locations. 1824apex reference guide connectapi output classes property name type description available version capacityresponses list connectapi.icon icon. property type description available version height integer the height of the icon in pixels. 28.0 width integer the width of the icon in pixels. 28.0 url string the url of the icon. this url is available to unauthenticated users. this 28.0 url does not expire. see also: connectapi.canvascapability connectapi.enhancedlinkcapability connectapi.socialpostcapability connectapi.inlineimagesegment an inline image in the feed body. subclass of connectapi.messagesegment property name type description available version alttext string alt text for the inline image. 35.0 contentsize integer size of the file in bytes. 35.0 fileextension string extension of the file, such as gif. 37.0 thumbnails connectapi.file information about the available thumbnails for the 35.0 previewcollection image. url string url to the latest version of the inline image. 35.0 connectapi.interactionscapability if a feed element has this capability, it has information about user interactions. subclass of connectapi.feedelementcapability. 1825apex reference guide connectapi output classes property name type description available version count long the number of individual views, likes, and comments 37.0 on a feed post. note: this count appears in the ui under the feed post as the number of views, for example, “5 views.” see also: connectapi.feedelementcapabilities connectapi.relatedquestion connectapi.invitation an invitation. property name type description available version email string email address of the user. 39.0 status connectapi. specifies the status of an invitation to join a group. 39.0 groupviral values are: invitationsstatus • acteduponuser—the user was added to the group. an email was sent asking the user to visit the group. • invited—an email was sent asking the user to sign up for the org. • maxedoutusers—the group has the maximum allowed members. • multipleerror—the user wasn’t invited due to multiple errors. • noactionneededuser—the user is already a member of the group. • notvisibletoexternalinviter—the user is not accessible to the user sending the invitation. • unhandled—the user couldn’t be added to the group for an unknown reason. userid string id of the user. 39.0 see also: connectapi.invitations 1826apex reference guide connectapi output classes connectapi.invitations a collection of invitations. property name type description available version invitations list connectapi.knowledgearticleversion a knowledge article version. property name type description available version articletype string type of the knowledge article. 36.0 id string id of the knowledge article version. 36.0 knowledgearticleid string id of the corresponding knowledge article. 36.0 lastpublisheddate datetime last published date of the knowledge article. 36.0 summary string summary of the knowledge article contents. 36.0 title string title of the knowledge article. 36.0 urlname string url name of the knowledge article. 36.0 see also: connectapi.knowledgearticleversioncollection connectapi.knowledgearticleversioncollection a collection of knowledge article versions. property name type description available version items list connectapi.labeledrecordfield this class is abstract. subclass of connectapi.abstractrecordfield. superclass of: • connectapi.compoundrecordfield • connectapi.currencyrecordfield 1827apex reference guide connectapi output classes • connectapi.daterecordfield • connectapi.percentrecordfield • connectapi.picklistrecordfield" "• connectapi.recordfield • connectapi.referencerecordfield • connectapi.referencewithdaterecordfield record field containing a label and a text value. important: the composition of a feed can change between releases. write your code to handle instances of unknown subclasses. name type description available version label string localized string describing the record field. 29.0 text string text value of the record field. all record fields have a text value. to 29.0 ensure that all clients can consume new content, inspect the record field’s type property. if it isn’t recognized, render the text value as the default case. connectapi.lightningextensioninformation lightning extension information. subclass of connectapi.abstractextensioninformation. property name type description available version compositioncomponent string component to use in compose state. 40.0 headertextlabel string label for the extension’s header. 40.0 hovertextlabel string label for hovering over the extension. 40.0 rendercomponent string component to use in render or preview state. 40.0 see also: connectapi.extensiondefinition connectapi.likeintent like intent for a social post. property name type description available version isliked boolean specifies whether the managed social account liked 45.0 the social post (true) or not (false). 1828apex reference guide connectapi output classes property name type description available version managedsocialaccount connectapi. managed social account that likes the social post. 45.0 managedsocialaccount see also: connectapi.likeintents connectapi.likeintents list of like intents for a social post. property name type description available version likes list see also: connectapi.socialpostintents connectapi.likesocialpostintent like intent on a social post. property name type description available version socialaccountid string id of the social account that likes the social post. 46.0 socialpostid string id of the social post to like. 46.0 connectapi.likesummary summary of a like. subclass of connectapi.userfeedentityactivitysummary property name type description available version likeid string id of the like. 42.0 connectapi.linkcapability if a feed element has this capability, it has a link. subclass of connectapi.feedelementcapability. 1829apex reference guide connectapi output classes property name type description available version url string link url. the url can be to an external site. 32.0 urlname string description of the link. 32.0 see also: connectapi.feedelementcapabilities connectapi.linkmetadata metadata for a link. property name type description available version description string description of the link. 42.0 framesource string html required to display the resource. 42.0 height integer height required to display the html. 42.0 originalurl string original url that was used to request the metadata. 42.0 providerurl string url of the provider that the information is retrieved 42.0 from. source connectapi. source of the link metadata. values are: 42.0 linkmetadatasource • none—link metadata wasn’t retrieved. • sfdc—salesforce is the source. thumbnailurl string thumbnail of the resource. 42.0 title string title of the link. 42.0 type connectapi. type of link that the metadata represents. values are: 42.0 linkmetadatatype • error—link metadata couldn’t be retrieved. • link—represents a link. • none—link metadata wasn’t retrieved because the link isn’t an allowed domain. • photo—represents a photo. • rich—represents rich content, typically html content. • unknown—link metadata was retrieved, but the type is unknown. • video—represents a video. url string url of the image to display, if one is available. 42.0 1830apex reference guide connectapi output classes property name type description available version width integer width required to display the html. 42.0 see also: connectapi.linkmetadatacollection connectapi.linkmetadatacollection collection of link metadata. property name type description available version linkmetadatalist list connectapi.linksegment link segment. subclass of connectapi.messagesegment. name type description available version url string the link url. 28.0 connectapi.locationoutputrepresentation an inventory location’s distance to an order recipient. property name type description available version distance double the distance from the location to the order recipient. 51.0 locationidentifier string the location identifier. 51.0 connectapi.locationcapacityoutputrepresentation fulfillment order capacity values for a location. property name type description available version assigned integer value of the location’s assigned fulfillment order 55.0 count. capacity integer value of the location’s fulfillment order capacity. 55.0 this property represents the location’s maximum capacity. 1831apex reference guide connectapi output classes property name type description available version error connectapi. error returned by the request, if any. 55.0 errorresponse heldcapacity integer number of fulfillment orders that the location is 55.0 holding capacity for. locationid string id of the location. 55.0 connectapi.maintenanceinfo information about the upcoming scheduled maintenance for the organization. property name type description available version description string description of the maintenance. 34.0 maintenancetitle string title of the maintenance. 34.0 maintenancetype connectapi. type of maintenance. values are: 34.0 maintenancetype • downtime—downtime maintenance. • generallyavailable—maintenance with generally available mode. • maintenancewithdowntime—scheduled maintenance with downtime. • readonly—maintenance with read-only mode. message datetime effective time when users start seeing the 34.0 effectivetime maintenance message. message datetime expiration time of the maintenance message. 34.0 expirationtime scheduledend datetime scheduled end of downtime. null for 34.0 downtime generallyavailable and readonly maintenance types. scheduledend datetime scheduled end of maintenance. null for 34.0 maintenancetime downtime maintenance type. scheduledstart datetime scheduled start of downtime. null for 34.0 downtime generallyavailable and readonly maintenance types. scheduledstart datetime scheduled start time of maintenance. null for 34.0 maintenancetime downtime maintenance type. see also: connectapi.organizationsettings 1832" "apex reference guide connectapi output classes connectapi.managedcontentassociations content topics associated with managed content. property name type description available version topics list content. see also: connectapi.managedcontentversion connectapi.managedcontentchannel managed content channel. property name type description available version cachecontrolmaxage long http cache control max age response header for 55.0 content delivered from the channel. channelid string id of the managed content channel. 48.0 channelname string name of the managed content channel. 48.0 channeltype connectapi. type of managed content channel. values are: 48.0 managedcontent • cloudtocloud channeltype • community • connectedapp • publicunauthenticated domain string id or name of the domain assigned to the channel. 52.0 domainid string id of the domain assigned to the channel. 50.0–51.0 in version 52.0 and later, this information is returned in the domain property. domainname string name of the domain assigned to the channel. 50.0 ischannelsearchable boolean specifies whether the text contents of the channel 48.0 are searchable (true) or not (false). isdomainlocked boolean specifies whether the domain is locked and can’t be 50.0 changed (true) or not (false). 1833apex reference guide connectapi output classes property name type description available version mediacachecontrol long http cache control max age response header for 57.0 maxage media delivered from the channel. see also: connectapi.managedcontentchannelcollection connectapi.managedcontentchannelcollection collection of managed content channels. property name type description available version channels list currentpageurl string connect rest api url identifying the current page. 48.0 nextpageurl string connect rest api url identifying the next page, or 48.0 null if there isn’t a next page. previouspageurl string connect rest api url identifying the previous page, 48.0 or null if there isn’t a previous page. totalchannels integer total number of managed content channels. 48.0 connectapi.managedcontentchanneldetail managed content channel detail. property name type description available version channelid string id of the managed content channel. 54.0 channelname string name of the managed content channel. 54.0 channeltype connectapi. type of managed content channel. values are: 54.0 managedcontent • cloudtocloud channeltype • community • connectedapp • publicunauthenticated domain string domain assigned to the managed content channel. 54.0 domainname string name of the domain assigned to the managed 54.0 content channel. 1834apex reference guide connectapi output classes property name type description available version ischannelsearchable boolean specifies whether the text of the channel's contents 54.0 is searchable (true) or not (false). isdomainlocked boolean specifies whether the channel’s domain is locked and 54.0 can’t be changed (true) or not (false). connectapi.managedcontentchannelsummary managed content channel. property name type description available version domainurl string domain url of the channel. 55.0 name string name of the managed content channel. 54.0 resourceurl string resource url to complete information of the 54.0 channel. target connectapi. target site associated with the channel. 54.0 managedcontent channeltarget summary see also: connectapi.managedcontentdeliverydocument connectapi.managedcontentcollectionitems connectapi.managedcontentdeliverydocumentcollection connectapi.managedcontentchanneltargetsummary target site associated with the channel. property name type description available version id string id of the site associated with the channel. 54.0 see also: connectapi.managedcontentchannelsummary connectapi.managedcontentcollectionitem managed content collection item. 1835apex reference guide connectapi output classes property name type description available version body map map of properties of the collection item with their 56.0 values. contenttype connectapi. type of collection item. 56.0 managedcontent collectionitem typesummary id string id of the collection item. 56.0 name string" "name or title for collection item. 56.0 see also: connectapi.managedcontentcollectionitems connectapi.managedcontentcollectionitems managed content collection items. property name type description available version channelinfo connectapi. information about the managed content channel. 56.0 managedcontent channelsummary collectionkey string unique identifier for the collection. 56.0 collectiontype connectapi. type of collection. 56.0 managedcontent typesummary id string id of the collection. 56.0 items list language string language locale of the collection. 56.0 publisheddate datetime most recent publish date of the collection. 56.0 title string title of the collection. 56.0 total integer total number of items in the current collection detail 56.0 page. urlname string url name of the collection. 56.0 connectapi.managedcontentcollectionitemtypesummary summary of a collection item type. 1836apex reference guide connectapi output classes property name type description available version fullyqualifiedname string fully qualified name of the collection item type. 56.0 name string name of the collection item type. 56.0 see also: connectapi.managedcontentcollectionitem connectapi.managedcontentdateandtimenodevalue managed content node of date and time type. subclass of connectapi.managedcontentnodevalue property name type description available version datetimevalue datetime utc date and time value of the managed content 48.0 node. timezone string time zone in which the date and time is authored. 48.0 connectapi.managedcontentdatenodevalue managed content node of date type. subclass of connectapi.managedcontentnodevalue property name type description available version value datetime date value of the managed content node. 48.0 connectapi.managedcontentdeliverydocument managed content in delivery scope. subclass of connectapi.abstractmanagedcontentdeliverydocument in version 55.0 and later. properties with an available version of 54.0 only are included in connectapi.abstractmanagedcontentdeliverydocument in version 55.0 and later. property name type description available version channelinfo connectapi. information about the managed content channel. 54.0 managedcontent channelsummary contentbody map map of properties of the managed content with their 54.0 values. contentkey string globally unique identifier (guid) for the managed 54.0 only content. 1837apex reference guide connectapi output classes property name type description available version contenttype connectapi. type of managed content. 54.0 only managedcontent typesummary language string language locale of the managed content. 54.0 only managedcontentid string id of the managed content. 54.0 only publisheddate datetime most recent publish date of the managed content. 54.0 only references map referenceslist list title string title of the managed content. 54.0 only unauthenticatedurl string public url for the managed content. 54.0 only urlname string url name of the managed content. 54.0 only see also: connectapi.managedcontentdeliverydocumentcollection connectapi.managedcontentdeliverydocumentcollection managed content delivery document collection. property name type description available version channelinfo connectapi. information about the managed content channel. 55.0 managedcontent channelsummary contents list currentpageurl string url to the current page of managed content records. 55.0 nextpageurl string url to the next page of managed content records. 55.0 previouspageurl string url to the previous page of managed content 55.0 records. references map referenceslist list connectapi.managedcontentdeliverydocumentsummary managed content delivery document summary. subclass" "of connectapi.abstractmanagedcontentdeliverydocument no additional properties. connectapi.managedcontentmedianodevalue managed content node of media type. subclass of connectapi.managedcontentnodevalue property name type description available version alttext string alternative text for the managed content node. 47.0 alturl string alternative url to the managed content node. 47.0–48.0 in version 49.0 and later, this information is returned in the thumbnailurl property. contentkey string content key of the managed content. 51.0 filename string file name of the managed content node. 48.0 mediatype connectapi. type of managed content media. value is image. 47.0 managedcontent mediatype mimetype string mime type of the managed content node. 47.0 resourceurl string resource url to the image. 48.0 in version 48.0, the resource url is available if referencing asset files and is null if referencing media. in version 49.0 and later, the resource url is available if referencing asset files or media. thumbnailurl string url to the thumbnail of the media. 49.0 title string title of the managed content node. 47.0 unauthenticatedurl string unauthenticated url to the image or null if the 48.0 image isn’t visible to external users. 1839apex reference guide connectapi output classes property name type description available version url string url to the image. 47.0 connectapi.managedcontentmediasourcenodevalue source of managed content media. property name type description available version filename string file name of the media source. 49.0 isexternal boolean specifies whether the media source is referenced via 49.0 an external url (true) or uploaded (false). mediatype connectapi. type of managed content media. values are: 49.0 managedcontent • document mediatype • image mimetype string mime type of the media source. 49.0 referenceid string reference id of the uploaded media source. 49.0 resourceurl string resource url of the media source. 49.0 unauthenticatedurl string url to the media source for unauthenticated users, 49.0 or null if the media source isn’t available to external users. url string url to the media source for authenticated users. 49.0 connectapi.managedcontentnodetype managed content node type. property name type description available version label string label of the managed content node type. 47.0 name string developer name of the managed content node type. 47.0 1840apex reference guide connectapi output classes property name type description available version nodetype connectapi. type of managed content node. values are: 47.0 managedcontent • date nodetypeenum • datetime • media • mediasource • multilinetext • namefield • richtext • text • url see also: connectapi.managedcontenttype connectapi.managedcontentnodevalue managed content node. this class is abstract. superclass of: • connectapi.managedcontentdateandtimenodevalue • connectapi.managedcontentdatenodevalue • connectapi.managedcontentmedianodevalue • connectapi.managedcontentmediasourcenodevalue • connectapi.managedcontenttextnodevalue 1841apex reference guide connectapi output classes property name type description available version nodetype connectapi. type of managed content node. values are: 47.0 managedcontent • date nodetype • datetime • media • mediasource • multilinetext • namefield • richtext • text • url see also: connectapi.managedcontentversion connectapi.managedcontentreference managed content reference. subclass of connectapi.abstractmanagedcontentreference property name type description available version contentbody map map of properties of the managed content reference 54.0 with their values. title string title of the managed content reference. 54.0 see also: connectapi.managedcontentreferencesummary connectapi.managedcontentreferencesummary summary of the managed content reference. subclass of connectapi.abstractmanagedcontentreference property name type description available version title string title of the managed content reference. 54.0 connectapi.managedcontentspace managed content space. 1842apex reference guide connecta" "pi output classes property name type description available version createdby string id of the user who created the managed content 55.0 space. createddate datetime date when the managed content space was created. 55.0 defaultlanguage string default language of the managed content space. 55.0 description string description of the managed content space. 55.0 id string id of the managed content space. 55.0 lastmodifiedby string id of the user who last modified the managed 55.0 content space. lastmodifieddate datetime date when the managed content space was last 55.0 modified. name string name of the managed content space. 55.0 rootfolderid string id of the root folder of the managed content space. 55.0 connectapi.managedcontenttextnodevalue managed content node of text type. subclass of connectapi.managedcontentnodevalue property name type description available version value string text value of the managed content node. 47.0 connectapi.managedcontenttype managed content type. property name type description available version label string label of the managed content type. 47.0 name string developer name of the managed content type. 47.0 nodetypes map see also: connectapi.managedcontentversioncollection 1843apex reference guide connectapi output classes connectapi.managedcontenttypesummary managed content type. property name type description available version fullyqualified string fully qualified name of the managed content type. 54.0 name name string reserved for future use. 55.0 see also: connectapi.managedcontentdeliverydocument connectapi.managedcontentcollectionitems connectapi.managedcontentversion managed content version. property name type description available version associations connectapi. content topics associated with the managed content. 47.0 managedcontent associations contentkey string content key of the managed content. 51.0 contentnodes map contenturlname string content url name of the managed content version. 48.0 language string language of the managed content version. 48.0 managedcontentid string id of the managed content. 47.0 publisheddate datetime date when the managed content version was last 47.0 published. title string title of the managed content version. 47.0 type string type of managed content version. 47.0 typelabel string type label of the managed content type. 47.0 unauthenticatedurl string unauthenticated delivery url. 50.0 see also: connectapi.managedcontentversioncollection 1844apex reference guide connectapi output classes connectapi.managedcontentversioncollection collection of managed content versions. property name type description available version currentpageurl string connect rest api url identifying the current page. 47.0 items list managedcontent map nextpageurl string connect rest api url identifying the next page, or 47.0 null if there isn’t a next page. total integer total number of managed content versions. 47.0 totaltypes integer total number of managed content types. 47.0 connectapi.managedsocialaccount information describing a managed social account or fan page of a social network. subclass of connectapi.basemanagedsocialaccount no additional properties. connectapi.managedsocialaccounts a list of managed social accounts. property name type description available version managedsocial list connectapi.managedtopic represents a managed topic in an experience cloud site. property name type description available version children list null if the depth request parameter isn’t specified or is 1. id string id of managed topic. 32.0 1845apex reference guide connectapi output classes property name type description available version managedtopictype connectapi.managed type of managed topic. 32.0 topictype • content—topics that are associated with native content. • featured—topics that are featured, for example," "on the experience cloud site home page, but don’t provide overall navigation. • navigational—topics that display in a navigational menu in the experience cloud site. parent connectapi. parent managed topic of the managed topic. 35.0 reference topic connectapi.topic information about the topic. 32.0 url string connect rest api url to the managed topic. 32.0 see also: connectapi.managedtopiccollection connectapi.managedtopiccollection a collection of managed topics. property name type description available version currentpageurl string connect rest api url identifying the current page. 32.0 managedtopics list nextpageurl string connect rest api url identifying the next page, or 44.0 null if there isn’t a next page. connectapi.markupbeginsegment the beginning of rich text markup. subclass of connectapi.messagesegment property name type description available version alttext string alternative text for the segment, if available. 45.0 htmltag string the html tag for this markup. 35.0 markuptype connectapi. type of rich text markup. 35.0 markuptype • bold—bold tag. • code—code tag. 1846apex reference guide connectapi output classes property name type description available version • hyperlink—hyperlink anchor tag. • italic—italic tag. • listitem—list item tag. • orderedlist—ordered list tag. • paragraph—paragraph tag. • strikethrough—strikethrough tag. • underline—underline tag. • unorderedlist—unordered list tag. url string url to the segment, if available. 45.0 connectapi.markupendsegment the end of rich text markup. subclass of connectapi.messagesegment property name type description available version htmltag string the html tag for this markup. 35.0 markuptype connectapi. type of rich text markup. 35.0 markuptype • bold—bold tag. • code—code tag. • hyperlink—hyperlink anchor tag. • italic—italic tag. • listitem—list item tag. • orderedlist—ordered list tag. • paragraph—paragraph tag. • strikethrough—strikethrough tag. • underline—underline tag. • unorderedlist—unordered list tag. connectapi.mediareference a media reference. property name type description available version mediaurl string url to stream or download the media. 41.0 1847apex reference guide connectapi output classes property name type description available version thumbnailurl string if one exists, url of the media’s thumbnail. 41.0 see also: connectapi.feedelementcapabilities connectapi.mediareferencecapability connectapi.mediareferencecapability if a feed element has this capability, it has one or more media references. subclass of connectapi.feedelementcapability. property name type description available version media list connectapi.mentioncompletion information about a record that could be used to @mention a user or group. name type description available version additionallabel string if one exists, an additional label for the record represented by this 29.0 completion, for example, “(customer)” or “(acme corporation)”. description string a description of the record represented by this completion. 29.0 name string the name of the record represented by this completion. the name 29.0 is localized, if possible. outofoffice connectapi. if the record represented by this completion is a user, an additional 40.0 outofoffice out-of-office message, if one exists, for the user. photourl string a url to the photo or icon of the record represented by this 29.0 completion. recordid string the id of the record represented by this completion. 29.0 1848apex reference guide connectapi output classes name type description available version usertype connectapi. if the record represented by this completion is a user, this value is 30.0 usertype the user type associated with that user; otherwise the value is null. enum one of these values: • chatterguest—user is an external user" "in a private group. • chatteronly—user is a chatter free customer. • guest—user is unauthenticated. • internal—user is a standard org member. • portal—user is an external user in an experience cloud site. • system—user is chatter expert or a system user. • undefined—user is a user type that is a custom object. see also: connectapi.mentioncompletionpage connectapi.mentioncompletionpage paginated list of mention completion response bodies. name type description available version currentpageurl string connect rest api url identifying the current page. 29.0 mentioncompletions list to build a feed post body. nextpageurl string connect rest api url identifying the next page, or null 29.0 if there isn’t a next page. previouspageurl string connect rest api url identifying the previous page, or 29.0 null if there isn’t a previous page. connectapi.mentionsegment mention segment. subclass of connectapi.messagesegment. name type description available version accessible boolean specifies whether the mentioned user or group can see 28.0 the post in which they are mentioned (true) or not (false). name string name of the mentioned user or group. 28.0 1849apex reference guide connectapi output classes name type description available version record connectapi. information about the mentioned user or group. 29.0 actorwithid user connectapi.user information about the mentioned user. 28.0 only summary important: in versions 29.0 and later, use the in versions before record property. 29.0, if the mention is not a user, the mention is in a connectapi.textsegment object. connectapi.mentionvalidation information about whether a proposed mention is valid for the context user. name type description available version recordid string the id of the mentioned record. 29.0 validationstatus connectapi. type of validation error for a proposed mention, if any. 29.0 mentionvalidation • disallowed—the proposed mention is invalid status enum and is rejected because the context user is trying to mention something that is not allowed. for example, a user who is not a member of a private group is trying to mention the private group. • inaccessible—the proposed mention is allowed, but the user or record being mentioned isn’t notified. they don't have access to the parent record that’s being discussed. • ok—there is no validation error for this proposed mention. see also: connectapi.mentionvalidations connectapi.mentionvalidations information about whether a set of mentions is valid for the context user. name type description available version haserrors boolean indicates whether at least one of the proposed 29.0 mentions has an error (true), or not (false). for example, context users can’t mention private groups 1850apex reference guide connectapi output classes name type description available version they don’t belong to. if such a group is included in the list of mention validations, haserrors is true and the group has a validationstatus of disallowed in its mention validation. mentionvalidations list order as the provided record ids. connectapi.messagebody message body. subclass of connectapi.abstractmessagebody no additional properties. see also: connectapi.chatterlikescapability connectapi.chattermessage connectapi.comment connectapi.feedelement connectapi.feeditemsummary connectapi.messagesegment message segment. this class is abstract. superclass of: • connectapi.complexsegment • connectapi.entitylinksegment • connectapi.fieldchangesegment • connectapi.fieldchangenamesegment • connectapi.fieldchangevaluesegment • connectapi.hashtagsegment • connectapi.inlineimagesegment • connectapi.linksegment • connectapi.markupbeginsegment • connectapi.markupendsegment • connectapi.mentionsegment • connectapi." "morechangessegment • connectapi.resourcelinksegment • connectapi.textsegment 1851apex reference guide connectapi output classes message segments in a feed item are typed as connectapi.messagesegment. feed item capabilities are typed as connectapi.feeditemcapability. record fields are typed as connectapi.abstractrecordfield. these classes are all abstract and have several concrete subclasses. at runtime you can use instanceof to check the concrete types of these objects and then safely proceed with the corresponding downcast. when you downcast, you must have a default case that handles unknown subclasses. important: the composition of a feed can change between releases. write your code to handle instances of unknown subclasses. name type description available version text string text-only rendition of this segment. if a client encounters an 28.0 unknown message segment type, it can render this value. type connectapi. the message segment type. one of these values: 28.0 messagesegment • entitylink type enum • fieldchange • fieldchangename • fieldchangevalue • hashtag • inlineimage • link • markupbegin • markupend • mention • morechanges • resourcelink • text see also: connectapi.abstractmessagebody connectapi.moderationcapability if a feed element has this capability, users in an experience cloud site can flag it for moderation. subclass of connectapi.feedelementcapability. property name type description available version moderationflags connectapi. the moderation flags for this feed element. 31.0 moderationflags moderators can view and take action on flagged items. see also: connectapi.feedelementcapabilities 1852apex reference guide connectapi output classes connectapi.moderationflagitemdetail flag details on a feed item, comment, or file. property name type description available version createdby string id of the user who flagged the item. 40.0 createddate datetime date when the item was flagged. 40.0 id string id of the moderation flag. 40.0 moderationtype connectapi. type of moderation flag. values are: 40.0 communityflagtype • flagasinappropriate—flag for inappropriate content. • flagasspam—flag for spam. note string note from user who flagged the item. 40.0 visibility connectapi. visibility behavior of a flag for various user types. 40.0 communityflag values are: visibility • moderatorsonly—the flag is visible only to users with moderation permissions on the flagged element or item. • selfandmoderators—the flag is visible to the creator of the flag and to users with moderation permissions on the flagged element or item. see also: connectapi.moderationflagscollection connectapi.moderationflags information about the moderation flags on a feed item, comment, or file. name type description available version flagcount integer number of moderation flags on this feed item, comment, or file. if 29.0 the context user is not a moderator, the property is null. flagcount map • flaggedbysystem—einstein flagged the item. • flaggedbyuserasinappropriate—user flagged the item as inappropriate. • flaggedbyuserasspam—user flagged the item as spam. 1853apex reference guide connectapi output classes name type description available version flaggedbyme boolean true if the context user flagged the feed item, comment, or file 29.0 for moderation; false otherwise. flags connectapi. collection of flags. 40.0 moderationflags collection see also: connectapi.comment connectapi.file connectapi.moderationcapability connectapi.moderationflagscollection a collection of flags on a feed item, comment, or file. property name type description available version currentpagetoken string token identifying the current page. 40.0 currentpageurl string connect rest api url identifying the current page. 40.0 flags list nextpagetoken string token identifying the next page, or null if there" "40.0 isn’t a next page. nextpageurl string connect rest api url identifying the next page, or 40.0 null if there isn’t a next page. pagesize integer number of items per page. 40.0 see also: connectapi.moderationflags connectapi.morechangessegment in feed items with a large number of tracked changes, the message is formatted as: “changed a, b, and made x more changes.” the morechangessegment contains the “x more changes.” subclass of connectapi.messagesegment. 1854apex reference guide connectapi output classes name type description available version morechanges list morechangescount integer number of additional changes. 28.0 connectapi.motif the motif properties contain urls for small, medium, and large icons that indicate the salesforce record type. common record types are files, users, and groups, but all record types have a set of motif icons. custom object records use their tab style icon. all icons are available to unauthenticated users so that, for example, you can display the motif icons in an email. the motif can also contain the record type’s base color. the motif images are icons, not user uploaded images or photos. for example, every user has the same set of motif icons. custom object records use their tab style icon, for example, the following custom object uses the “boat” tab style: ""motif"": { ""color: ""8c004c"", ""largeiconurl"": ""/img/icon/custom51_100/boat64.png"", ""mediumiconurl"": ""/img/icon/custom51_100/boat32.png"", ""smalliconurl"": ""/img/icon/custom51_100/boat16.png"", ""svgiconurl"": null }, users use the following icons: ""motif"": { ""color: ""1797c0"", ""largeiconurl"": ""/img/icon/profile64.png"", ""mediumiconurl"": ""/img/icon/profile32.png"", ""smalliconurl"": ""/img/icon/profile16.png"", ""svgiconurl"": null }, groups use the following icons: ""motif"": { ""color: ""1797c0"", ""largeiconurl"": ""/img/icon/groups64.png"", ""mediumiconurl"": ""/img/icon/groups32.png"", ""smalliconurl"": ""/img/icon/groups16.png"", ""svgiconurl"": null }, files use the following icons: ""motif"": { ""color: ""1797c0"", ""largeiconurl"": ""/img/content/content64.png"", ""mediumiconurl"": ""/img/content/content32.png"", ""smalliconurl"": ""/img/icon/files16.png"", ""svgiconurl"": null }, 1855apex reference guide connectapi output classes note: to view the icons in the previous examples, preface the url with https://instance_name. for example, https://instance_name/img/icon/profile64.png. name type description available version color string a hex value representing the base color of the record type, or null. 29.0 largeiconurl string a large icon indicating the record type. 28.0 mediumiconurl string a medium icon indicating the record type. 28.0 smalliconurl string a small icon indicating the record type. 28.0 svgiconurl string an icon in svg format indicating the record type, or null if the icon 34.0 doesn’t exist. connectapi.multipleasyncoutputrepresentation ids of the asynchronous background operations. this output only includes the operation ids, regardless of whether calls are made to an external payment gateway. it doesn’t include any errors from the operations. subclass of connectapi.baseoutputrepresentation. property name type description available version asyncoutputs list see also: multipleensurefundsasync(multipleensurefundsinput) connectapi.multiplefulfillmentorderinvoicesoutputrepresentation ids of the created invoices. subclass of connectapi.baseoutputrepresentation. property name type description available version invoiceids list list of ids of the" "created invoices. 52.0 connectapi.multiplefulfillmentorderoutputrepresentation list of responses for the individual fulfillmentorder creation attempts from a create multiple fulfillment orders request. subclass of connectapi.baseoutputrepresentation. 1856apex reference guide connectapi output classes property name type description available version fulfillmentorders list connectapi.mutecapability if a feed element has this capability, users can mute it. muted feed elements are visible in the muted feed, and invisible in all other feeds that respect mute. subclass of connectapi.feedelementcapability. property name type description available version ismutedbyme boolean indicates whether the context user muted the feed 35.0 element. see also: connectapi.feedelementcapabilities connectapi.mutesummary summary of a mute. subclass of connectapi.userfeedentityactivitysummary no additional properties. connectapi.namedcredential named credential associated with an external credential. important: where possible, we changed noninclusive terms to align with our company value of equality. we maintained certain terms to avoid any effect on customer implementations. property name type description available version calloutoptions connectapi. callout options for the named credential. 58.0 namedcredential calloutoptions callouturl string url of the named credential in a callout. 58.0 customheaders list developername string fully qualified developer name of the named 56.0 credential. 1857apex reference guide connectapi output classes property name type description available version externalcredentials list id string named credential id. 58.0 masterlabel string named credential label. 56.0 networkconnection connectapi. privateconnect outbound network connection for 58.0 networkconnection the named credential. parameters list type connectapi. type of named credential. values are: 58.0 namedcredentialtype • privateendpoint • securedendpoint url string connect rest api url of the named credential. 58.0 see also: connectapi.externalcredential connectapi.namedcredentiallist connectapi.namedcredentialcalloutoptions named credential callout options. property name type description available version allowmergefields boolean specifies whether to allow merge fields in the http 58.0 inbody body (true) or not (false). allowmergefields boolean specifies whether to allow merge fields in the http 58.0 inheader header (true) or not (false). generate boolean specifies whether to generate an authorization 58.0 authorizationheader header (true) or not (false). see also: connectapi.namedcredential connectapi.namedcredentiallist list of named credentials. 1858apex reference guide connectapi output classes property name type description available version namedcredentials list connectapi.namedcredentialparameter named credential parameter. property name type description available version id string id of the parameter. 58.0 parametername string name of the parameter. 58.0 parametertype connectapi. type of named credential parameter. values are: 58.0 namedcredential • allowedmanagedpackagenamespaces parametertype • clientcertificate parametervalue string value of the parameter. 58.0 see also: connectapi.namedcredential connectapi.navigationmenuitem navigation menu item. property name type description available version actiontype connectapi. event, url type, or modal navigation menu item. 52.0 navigationmenuitem values are: actiontype • event—event-based navigation. note: event is internal only and can’t be used in custom components. • externallink—url outside of your experience cloud site. • internallink—relative url inside your experience cloud site." "• modal—modal, such as account switcher. actionvalue string for event action type, the event fully qualified 52.0 name for the navigation menu item. for externallink and internallink action types, the route url for the navigation menu item. 1859apex reference guide connectapi output classes property name type description available version for modal action type, the component fully qualified name for the navigation menu item. imageurl string url to the image of the navigation menu item. 52.0 label string label for the navigation menu item. 52.0 submenu list target connectapi. target for the navigation menu item. values are: 52.0 navigationmenuitem • currentwindow—navigation menu item opentarget opens in the current window. • newwindow—navigation menu item opens in a new window. see also: connectapi.navigationmenuitemcollection connectapi.navigationmenuitemcollection collection of navigation menu items. property name type description available version menuitems list connectapi.nbaactionparameter a parameter for an action. property name type description available version name string name of the parameter. 45.0 type string type of the parameter. 45.0 value string value of the parameter. 45.0 connectapi.nbaflowaction a recommended flow. subclass of connectapi.abstractnbaaction. 1860apex reference guide connectapi output classes property name type description available version flowlabel string label of the recommended flow. 47.0 flowtype connectapi. type of recommended flow. values are: 47.0 nbaflowtype • autolaunchedflow—autolaunched flow that runs in the background. • flow—screen flow that accepts user inputs. id string id of the flow. 45.0 name string name of the flow. 45.0 connectapi.nbanativerecommendation a record the user is recommended to take action on. subclass of connectapi.abstractnbatarget. property name type description available version id string id of the recommendation. 45.0 name string name of the recommendation. 45.0 url string url to the recommendation. 45.0 connectapi.nbarecommendation a recommendation returned by a recommendation strategy. property name type description available version aimodel string reserved for future use. 47.0 acceptancelabel string text indicating user acceptance of the 45.0 recommendation. description string description of the recommendation. 45.0 externalid string external id of the recommendation. this id doesn’t 46.0 need to be a salesforce 18-character id. for example, it can be a product number from an external system. imageurl string url to the asset file to display. 45.0 recommendation string reserved for future use. 46.0 mode recommendation double reserved for future use. 46.0 score rejectionlabel string text indicating user rejection of the recommendation. 45.0 1861apex reference guide connectapi output classes property name type description available version target connectapi. target to act on. 45.0 abstractnbatarget targetaction connectapi. action to recommend. 45.0 abstractnbaaction see also: connectapi.nbarecommendations connectapi.nbarecommendations recommendations returned by a recommendation strategy. property name type description available version debug string runtime debug information recorded during 45.0 recommendation strategy execution. errors string runtime errors that occurred during recommendation 45.0 strategy execution. executionid string id of the recommendation strategy execution. 45.0 onbehalfofid string id of the user or entity for which the 45.0 recommendation strategy was executed. recommendations list recommendation strategy. trace connectapi. trace information for the recommendation strategy 45.0 strategytrace execution, if requested. connectapi.networkconnection external network connection. important: where possible, we changed noninclusive terms to align with our company value of equality. we maintained certain terms to avoid any effect on customer implementations. property name type description available version developername string name of the network connection. 58.0 id string id of the network connection. 58.0" "masterlabel string label of the network connection. 58.0 1862apex reference guide connectapi output classes property name type description available version namespaceprefix string namespace prefix of the network connection. 58.0 see also: connectapi.namedcredential connectapi.newuseraudiencecriteria criteria for the new members type of custom recommendation audience. subclass of connectapi.audiencecriteria. property name type description available version maxdaysincommunity double the maximum number of days since a user became 36.0 a site member. connectapi.oauthcredentialauthurl oauth authentication url for a credential. property name type description available version authenticationurl string authentication url for the user external credential. 56.0 authentication urls have encoded and escaped special characters. before using the url, undo the encoded and escaped characters. external string fully qualified developer name of the external 56.0 credential credential. principalname string name of the external credential named principal. 56.0 principaltype connectapi. type of credential principal. values are: 56.0 credentialprincipal • awsstsprincipal type • namedprincipal • peruserprincipal connectapi.oauthproviderinfo name type description available version authorizationurl string the url used for authorization. 37.0 1863apex reference guide connectapi output classes name type description available version name string the name of the oauth service provider. 37.0 see also: connectapi.useroauthinfo connectapi.ocibaseoutputrepresentation base omnichannel inventory output class. this class is abstract. superclass of: • connectapi.ocigetinventoryavailabilityoutputrepresentation • connectapi.ocipublishlocationstructureoutputrepresentation • connectapi.ocipublishlocationstructurestatusoutputrepresentation • connectapi.ociuploadinventoryavailabilityoutputrepresentation • connectapi.ociuploadinventoryavailabilitystatusoutputrepresentation property name type description available version errors list success boolean indicates whether the request was successful. 51.0 connectapi.ocicreatereservationerroroutputrepresentation error returned from an attempt to create an omnichannel inventory reservation. property name type description available version errorcode string the error code. 51.0 message string details of the error, if available. 51.0 connectapi.ocicreatereservationoutputrepresentation result of an omnichannel inventory reservation creation request. property name type description available version details list 1864apex reference guide connectapi output classes property name type description available version errors list expirationtime string the time at which the reservation would expire. 51.0 reservationtime string the time when the reservation was recorded. 51.0 success boolean indicates whether the reservation was successfully 51.0 created. connectapi.ocicreatereservationsingleoutputrepresentation details of an inventory reservation for one product. property name type description available version errorcode string the error code, if any. 51.0 locationgroupidentifier string identifier of the location group where the inventory 51.0 is reserved. locationidentifier string identifier of the location where the inventory is 51.0 reserved. quantity double the reserved quantity of the product. 51.0 stockkeepingunit string the sku of the reserved product. 51.0 connectapi.ocifulfillreservationerroroutputrepresentation response to a request to fulfill one inventory reservation. property name type description available version details connectapi. details of the fulfilled reservation, if successful. 51.0 ocifulfillreservation singleoutputrepresentation errorcode string error code, if any. 51.0 message string details of the error, if available. 51.0 connectapi.ocifulfillreservationoutputrepresentation response to a request to fulfill one or more inventory reservations. 1865apex reference guide connectapi output classes property name type description available version errors list success boolean indicates whether the request was successful. 51.0 connectapi.ocifulfillreservationsingleoutputrepresentation details of a single fulfilled reservation. property name type description available version actionrequestid string the uuid that identifies the original fulfill reservation 51.0 request. externalrefid string the external reference id of the location that fulfilled 51.0 the reservation. locationidentifier string the identifier of the location that fulfilled the 51.0 reservation. quantity double the fulfilled quantity. 51.0 stockkeepingunit string the sku of the fulfilled product. 51.0 connectapi.ocifutureinventoryoutputrepresentation an expected future inventory restock. property name type description available version expecteddate datetime date when the future inventory is expected. 51.0 quantity double quantity of the future inventory. 51.0 connectapi.ocigetinventoryavailabilityoutputrepresentation response to a request for inventory availability data. subclass of connectapi.ocibaseoutputrepresentation. property name type description available version locationgroups list 1866apex reference guide connectapi output classes property name type description available version locations list see also: getinventoryavailability(inventoryavailabilityinputrepresentation) findrouteswithfewestsplitsusingoci(findrouteswithfewestsplitsusingociinput) connectapi.findrouteswithfewestsplitsusingocioutputrepresentation connectapi.ociinventoryrecordoutputrepresentation inventory availability data for a product. property name type description available version availabletofulfill double the available to fulfill quantity. 51.0 availabletoorder double the available to order quantity. 51.0 effectivedate datetime the effective date of the inventory. 51.0 futures list onhand double the on hand quantity. 51.0 reserved double the reserved quantity. 51.0 safetystockcount double the safety stock count. 51.0 stockkeepingunit string the sku of the product. 51.0 connectapi.ocilocationavailabilityoutputrepresentation a set of inventory availability data for one inventory location. property name type description available version inventoryrecords list locationidentifier string the identifier of the location. 51.0 connectapi.ocilocationgroupavailabilityoutputrepresentation a set of inventory availability data for one inventory location group. 1867apex reference guide connectapi output classes property name type description available version inventoryrecords list belonging to this location group. locationgroup string the identifier of the location group. 51.0 identifier connectapi.ocipublishlocationstructureoutputrepresentation response to a publish location structure request. subclass of connectapi.ocibaseoutputrepresentation. property name type description available version uploadid string identifier of the publish job. use this value to retrieve 51.0 the status of the job. connectapi.ocipublishlocationstructurestatusoutputrepresentation detailed status of a publish location structure job. subclass of connectapi.ocibaseoutputrepresentation. property name type description available version endtimeutc string the utc time when the job finished. (for example: 51.0 ""2020-07-06t22:54:08.012z"") recordsprocessedcount integer the number of records processed by the job. 51.0 recordsreadcount integer the number of records read by the job. 51.0 recordsskippedcount integer the number of records skipped by the job. 51.0 starttimeutc string the utc time when the job started. (for example: 51.0 ""2020-07-06t22:53:06.788z"") status string the status of the job. (e.g., ""pending,"" ""completed,"" 51.0 etc.). uploadid string identifier" "of the job. 51.0 validationerrors list list of any validation errors returned by the job. 51.0 validationstatus string the validation status of the job. 51.0 connectapi.ocireleasereservationerroroutputrepresentation response to a request to release one inventory reservation. 1868apex reference guide connectapi output classes property name type description available version details connectapi. details of the released reservation, if successful. 51.0 ocireleasereservation singleoutputrepresentation errorcode string error code, if any. 51.0 message string details of the error, if available. 51.0 connectapi.ocireleasereservationoutputrepresentation response to a request to release one or more inventory reservations. property name type description available version errors list success boolean indicates whether the request was successful. 51.0 connectapi.ocireleasereservationsingleoutputrepresentation details of a single released reservation. property name type description available version actionrequestid string the uuid that identifies the original release 51.0 reservation request. externalrefid string the external reference id of the location that released 51.0 the reservation. locationgroupidentifier string the identifier of the location group that released the 51.0 reservation. locationidentifier string the identifier of the location that released the 51.0 reservation. quantity double the released quantity. 51.0 stockkeepingunit string the sku of the released product. 51.0 connectapi.ocitransferreservationerroroutputrepresentation response to a request to fulfill one inventory reservation. 1869apex reference guide connectapi output classes property name type description available version details connectapi. details of the transferred reservation, if successful. 51.0 ocitransferreservation singleoutputrepresentation errorcode string error code, if any. 51.0 message string details of the error, if available. 51.0 connectapi.ocitransferreservationoutputrepresentation response to a request to transfer one or more inventory reservations. property name type description available version errors list success boolean indicates whether the request was successful. 51.0 connectapi.ocitransferreservationsingleoutputrepresentation details of a single transferred reservation. property name type description available version actionrequestid string the uuid that identifies the original transfer 51.0 reservation request. externalrefid string the external reference id of the location that received 51.0 the reservation. fromlocationgroupidentifier string the identifier of the location group that sent the 51.0 reservation. fromlocationidentifier string the identifier of the location that sent the reservation. 51.0 ignoreavailabilitycheck boolean whether this call ignored availability data at the 52.0 location that received the reservation. quantity double the quantity of transferred inventory. 51.0 stockkeepingunit string the sku of the transferred product. 51.0 tolocationgroupidentifier string the identifier of the location group that received the 51.0 reservation. tolocationidentifier string the identifier of the location that received the 51.0 reservation. 1870apex reference guide connectapi output classes connectapi.ociuploadinventoryavailabilityoutputrepresentation response to an upload inventory availability job. subclass of connectapi.ocibaseoutputrepresentation. property name type description available version uploadid string identifier of the upload job. use this value to retrieve 51.0 the status of the job. connectapi.ociuploadinventoryavailabilitystatusoutputrepresentation detailed status of an upload inventory availability job. subclass of connectapi.ocibaseoutputrepresentation. property name type description available version endtimeutc string the utc time when the job finished. (for example: 51.0 ""2020-07-06t22:54:08.012z"") recordsprocessedcount integer the number of records processed by the job. 51.0 recordsreadcount integer the number of records read by the job. 51.0 recordsskippedcount integer the number of records skipped by the job. 51.0 starttimeutc string the utc time when the job started. (for example: 51.0 ""2020-07-06t22:53:06.788z"") status string" "the status of the job. (e.g., ""pending,"" ""completed,"" 51.0 etc.). uploadid string identifier of the job. 51.0 validationerrors list list of any validation errors returned by the job. 51.0 validationstatus string the validation status of the job. 51.0 connectapi.orchestrationinstance orchestration instance. property name type description available version flowdefinition string developer name of the flow definition. 54.0 developername flowdefinitionid string id of the flow definition. 54.0 flowdefinitionname string name of the flow definition. 54.0 id string id of the orchestration instance. 54.0 interviewid string id of the interview to resume. 54.0 1871apex reference guide connectapi output classes property name type description available version stageinstances list status connectapi. status of the orchestration instance. values are: 54.0 orchestration • completed status • inprogress • notstarted see also: connectapi.orchestrationinstancecollection connectapi.orchestrationinstancecollection collection of orchestration instances. property name type description available version instances list connectapi.orchestrationstageinstance orchestration stage instance. property name type description available version id string id of the orchestration stage instance. 54.0 label string orchestration stage instance label. 54.0 name string orchestration stage instance name. 54.0 status connectapi. status of the orchestration instance. values are: 54.0 orchestration • completed status • inprogress • notstarted stepinstances list see also: connectapi.orchestrationinstance 1872apex reference guide connectapi output classes connectapi.orchestrationstepinstance orchestration step instance. property name type description available version id string id of the orchestration step instance. 54.0 label string orchestration step instance label. 54.0 name string orchestration step instance name. 54.0 status connectapi. status of the orchestration instance. values are: 54.0 orchestration • completed status • inprogress • notstarted steptype connectapi. type of orchestration step. values are: 54.0 orchestration • asynchronousbackgroundstep steptype • backgroundstep • interactivestep • managedcontentroleinteractivestep • managedcontentvariantsetlock backgroundstep • managedcontentvariantsetready backgroundstep workitems list see also: connectapi.orchestrationstageinstance connectapi.orchestrationworkitem orchestration work item. property name type description available version assigneeid string id of the assignee for the orchestration work item. 54.0 description string description of the orchestration work item. 54.0 id string id of the orchestration work item. 54.0 label string label key for the orchestration work item. 54.0 1873apex reference guide connectapi output classes property name type description available version relatedrecordid string id of the record the orchestration work item is related 54.0 to. screenflow string developer name of the screen flow to start when 54.0 developername assignees work on the orchestration work item. screenflowid string id of the screen flow to start when assignees work 54.0 on the orchestration work item. screenflowinputs string input parameters for the screen flow. 54.0 status connectapi. status of the orchestration work item. values are: 54.0 orchestrationwork • assigned itemstatus • completed see also: connectapi.orchestrationstepinstance connectapi.orderdeliverygroupsummary order delivery group summary. property name type description available version fields map see also: connectapi.orderdeliverygroupsummarycollection connectapi.orderdeliverygroupsummarycollection collection of order delivery group summaries. property name type description" "available version currentpagetoken string token identifying the current page of order delivery 51.0 group summaries. currentpageurl string url to the current page of order delivery group 51.0 summaries. nextpagetoken string token identifying the next page of order delivery 51.0 group summaries. 1874apex reference guide connectapi output classes property name type description available version nextpageurl string url to the next page of order delivery group 51.0 summaries. orderdeliverygroups list previouspagetoken string token identifying previous page of order delivery 51.0 group summaries. previouspageurl string url to the previous page of order delivery group 51.0 summaries. connectapi.orderitemsummary order item summary. property name type description available version adjustmentaggregates connectapi. adjustment aggregates associated with an order item 55.0 orderitemsummary summary. adjustmentaggregates fields map orderitem string id of the order item summary. 51.0 summaryid ordersummaryid string id of the order summary. 51.0 product connectapi. associated product item information. 51.0 orderitemsummary product see also: connectapi.orderitemsummarycollection connectapi.orderitemsummaryadjustmentaggregates adjustment aggregates associated with an order item summary. property name type description available version available boolean indicates whether adjustment aggregates are 55.0 available (true) or not (false). 1875apex reference guide connectapi output classes property name type description available version status connectapi. order summary adjustment aggregate job status. 55.0 ordersummaryadjustment • failed—the adjustment aggregate data job aggregatesstatus for the order summary failed. • inprogress—the adjustment aggregate data job for the order summary is in progress. • notinitiated—the adjustment aggregate data job for the order summary is not initiated. • submitted—the adjustment aggregate data job for the order summary is submitted. totalline string total of all line item promotions applied to this 55.0 promotionamount specific product. totalpromotion string total of all order level promotions applied to this 55.0 distamount specific product. connectapi.orderitemsummaryadjustmentcollection collection of adjustments for order item summaries. property name type description available version orderitemsummaries map connectapi.orderitemsummaryadjustmentlist representation for list of adjustments for an order item summary. property name type description available version adjustments list see also: connectapi.orderitemsummaryadjustmentcollection connectapi.orderitemsummarycollection collection of order item summaries. 1876apex reference guide connectapi output classes property name type description available version currentpagetoken string token identifying the current page of items. 51.0 currentpageurl string url to the current page of items. 51.0 items list nextpagetoken string token identifying the next page of items. 51.0 nextpageurl string url to the next page of items. 51.0 previouspagetoken string token identifying the previous page of items. 51.0 previouspageurl string url to the previous page of items. 51.0 connectapi.orderitemsummaryoutputrepresentation details of an orderitemsummary from a failed fulfillmentorder in a create multiple fulfillment orders request. property name type description available version errors list any. orderitemsummaryid string id of the orderitemsummary. 50.0 quantity double quantity of the orderitemsummary. 50.0 connectapi.orderitemsummaryproduct product item mapped to the order item summary. property name type description available version canviewproduct boolean specifies whether the context user can view the 51.0 product (true) or not (false). errorcode string error code for the product with errors. 51.0 errormessage string error message for the product with" "errors. 51.0 fields map media connectapi. associated product media. 51.0 productmedia productattributes connectapi. summary of the product attributes. 51.0 productattributeset summary 1877apex reference guide connectapi output classes property name type description available version productid string id of the product. 51.0 see also: connectapi.orderitemsummary connectapi.ordershipment order shipment. property name type description available version expecteddeliverydate datetime expected delivery date for the shipment. 52.0 fields map ordersummaryid string id of the order summary. 52.0 shipmentid string id of the shipment. 52.0 shipmentnumber string number of the shipment. 52.0 status string status of the shipment. 52.0 see also: connectapi.ordershipmentcollection connectapi.ordershipmentcollection collection of order shipments. property name type description available version count integer total number of records returned in the collection. 52.0 currentpagetoken string token identifying the current page of order 52.0 shipments. currentpageurl string url to the current page of order shipments. 52.0 nextpagetoken string token identifying the next page of order shipments. 52.0 nextpageurl string url to the next page of order shipments. 52.0 previouspagetoken string token identifying the previous page of order 52.0 shipments. previouspageurl string url to the previous page of order shipments. 52.0 1878apex reference guide connectapi output classes property name type description available version shipments list sortorder connectapi. sort order for order shipments. values are: 52.0 ordershipmentsort • expecteddeliverydateasc—sorts by the oldest expected delivery date. • expecteddeliverydatedesc—sorts by the most recent expected delivery date. • shipmentnumberasc—sorts by shipment number in ascending order (0–9). • shipmentnumberdesc—sorts by shipment number in descending order (9–0). connectapi.ordershipmentitem shipment item. property name type description available version fields map orderitemsummaryid string id of the order item summary. 52.0 product connectapi. product mapped to an order item summary. 52.0 orderitem summaryproduct productid string id of the product. 52.0 quantity double quantity of the product. 52.0 shipmentid string id of the shipment. 52.0 shipmentitemid string id of the shipment item. 52.0 connectapi.ordershipmentitemcollection collection of order shipment items. property name type description available version count integer total number of records returned in a page. 52.0 currentpagetoken string token identifying the current page of order shipment 52.0 items. currentpageurl string url to the current page of order shipment items. 52.0 1879apex reference guide connectapi output classes property name type description available version items list nextpagetoken string token identifying the next page of order shipment 52.0 items. nextpageurl string url to the next page of order shipment items. 52.0 previouspagetoken string token identifying the previous page of order 52.0 shipment items. previouspageurl string url to the previous page of order shipment items. 52.0 sortorder connectapi. sort order for order shipment items. values are: 52.0 ordershipment • idasc—sorts by id in ascending alphanumeric itemsort order (a–z, 0–9). • iddesc—sorts by id in descending alphanumeric order (z–a, 9–0). connectapi.ordersummaryoutputrepresentation id of the created order summary. subclass of connectapi.baseoutputrepresentation. property name type description available version ordersummaryid string id of the order summary. 48.0 connectapi.ordersummaryrepresentation order summary. property name type description available version adjustmentaggregates connectapi. adjustment aggregates associated with the order 55.0" "ordersummary summary. adjustmentaggregates createddate datetime created date of the order summary. 51.0 fields map< string, map of requested order summary fields. 51.0 connectapi. recordfield > ordernumber string order number of the order summary. 51.0 ordersummaryid string id of the order summary. 51.0 ordereddate datetime ordered date of the order summary. 51.0 1880apex reference guide connectapi output classes property name type description available version ownerid string id of the owner of the order summary. 51.0 status string status of the order summary. 51.0 totalamount string total amount of the order summary. 51.0 see also: connectapi.ordersummarycollectionrepresentation connectapi.ordersummaryadjustment adjustment associated with an order summary. property name type description available version amount string amount associated with the adjustment. 53.0 basisreferencedisplayname string display name for secondary cause of the adjustment 54.0 (for example, null or the couponcode that’s associated with a coupon) currencyisocode string three-letter iso 4217 currency code associated with 53.0 the adjustment. displayname string display name for the primary cause of the adjustment 53.0 (for example, display name of the promotion) targettype connectapi. type of price adjustment in promotions. values are: 56.0 ordersummary • splitline—price adjustment on an order adjustmenttarget item. type • header—price adjustment on the entire order. type string type of adjustment (for example, promotion, other). 53.0 see also: connectapi.ordersummaryadjustmentcollection connectapi.orderitemsummaryadjustmentlist connectapi.ordersummaryadjustmentaggregates adjustment aggregates associated with an order summary. property name type description available version available boolean indicates if adjustment aggregate values are available 55.0 (true) or not (false). 1881apex reference guide connectapi output classes property name type description available version status connectapi. order summary adjustment aggregate job status. 55.0 ordersummaryadjustment values are: aggregatesstatus • failed—the adjustment aggregate data job for the order summary failed. • inprogress—the adjustment aggregate data job for the order summary is in progress. • notinitiated—the adjustment aggregate data job for the order summary is not initiated. • submitted—the adjustment aggregate data job for the order summary is submitted. totaldelivery string total distributed delivery promotion amounts 55.0 promotiondistamount associated with an order summary. totaldelivery string total delivery promotion line amounts associated 55.0 promotionlineamount with an order summary. totaldelivery string total delivery promotion amount associated with an 55.0 promotion order summary. totalamount totalproduct string total distributed product promotion amounts 55.0 promotiondistamount associated with an order summary. totalproduct string total product promotion line amount associated with 55.0 promotionlineamount an order summary. totalproduct string total product promotion amount associated with an 55.0 promotion order summary. totalamount connectapi.ordersummaryadjustmentaggregatesasyncoutput async adjustment aggregates output. property name type description available version statusurl string status url. 55.0 connectapi.ordersummaryadjustmentcollection collection of adjustments for an order summary. property name type description available version adjustments list 1882" "apex reference guide connectapi output classes connectapi.ordersummarycollectionrepresentation collection of order summaries. property name type description available version count integer total count of order summaries returned on the 51.0 current page. currentpagetoken string token identifying the current page. 51.0 currentpageurl string connect rest api url identifying the current page. 51.0 nextpagetoken string token identifying the next page, or null if there 51.0 isn’t a next page. nextpageurl string connect rest api url identifying the next page, or 51.0 null if there isn’t a next page. ordersummaries list previouspagetoken string token identifying the previous page, or null if 51.0 there isn’t a previous page. previouspageurl string connect rest api url identifying the previous page, 51.0 or null if there isn’t a previous page. sortorder connectapi. sort order for order summaries. values are: 51.0 ordersummary • createddateasc—sorts by the oldest sortorder created date. • createddatedesc—sorts by the most recent created date. • ordereddateasc—sorts by the oldest ordered date. • ordereddatedesc—sorts by the most recent ordered date. connectapi.ordertocartfailedproduct product that could not be added to the cart from an order, with error information. property name type description available version errorcode string error code. 57.0 errormessage string error message about the cause of the failure. 57.0 productid string id of the product. 57.0 productname string name of the product. 57.0 1883apex reference guide connectapi output classes property name type description available version productsku string sku of the product. 57.0 connectapi.ordertocartresult result of action adding an order to a cart. property name type description available version cartid string id of the cart. 57.0 totalfailedproductcount integer number of products that could not be successfully 57.0 added to the cart from the order. totalsucceededproductcount integer number of products successfully added to the cart 57.0 from the order. unaddedproducts list of products not successfully added to the cart. 57.0 connectapi.organizationsettings org settings. name type description available version accesstimeout integer amount of time after which the system prompts users 28.0 who have been inactive to log out or continue working. features connectapi.features information about features available in the org. 28.0 maintenanceinfo list maintenances for the org. name string org name. 28.0 orgid string 18-character id for the org. 28.0 usersettings connectapi.usersettings information about the org permissions for the user. 28.0 connectapi.origincapability if a feed element has this capability, it was created by a feed action. subclass of connectapi.feedelementcapability. property name type description available version actor connectapi.user the user who executed the feed action. 33.0 summary 1884apex reference guide connectapi output classes property name type description available version originrecord connectapi.reference a reference to the feed element containing the feed 33.0 action. see also: connectapi.feedelementcapabilities connectapi.outofoffice user's out-of-office message. property name type description available version message string out-of-office message for the user. 40.0 see also: connectapi.user connectapi.mentioncompletion connectapi.pardotbusinessunitcontextitem pardot business unit context item. important: where possible, we changed noninclusive terms to align with our company value of equality. we maintained certain terms to avoid any effect on customer implementations. property name type description available version id string id of the pardottenant record. 55.0 iscurrent boolean specifies whether the business unit is selected as the 55.0 context user's current business unit context in the business unit switcher of the pardot lightning app (true) or not (false). name string name of the pardot business unit as it is" "specified in 55.0 the masterlabel of the pardottenant record. see also: connectapi.pardotbusinessunitcontextoutput connectapi.pardotbusinessunitcontextoutput pardot business unit context. 1885apex reference guide connectapi output classes property name type description available version businessunits list issuccess boolean indicates whether the requested resource was 55.0 successfully provided. totalbusinessunits integer indicates the total number of pardot business units 55.0 that the context user has access to. connectapi.paymentauthorizationresponse payment authorization output representation. property name type description available version accountid string salesforce account for the payment authorization. 51.0 amount double amount that the gateway authorized for the payment 51.0 transaction. currencyisocode string three-letter iso 4217 currency code associated with 51.0 the payment group record. effectivedate datetime date that the authorization becomes effective. 51.0 expirationdate datetime date that the authorization expires. 51.0 id string id of the payment authorization record. 51.0 paymentauthorizationnumber string system-defined number for the payment 51.0 authorization record. requestdate datetime date that the authorization occurred. 51.0 status string status of the payment authorization as returned by 51.0 the gateway. connectapi.paymentgroupresponse payment group. property name type description available version currencyisocode string three-letter iso 4217 currency code associated with 50.0 the payment group record. id string id of the payment group record. 50.0 sourceobjectid string source object id of the payment group record. 50.0 supports only orderid. 1886apex reference guide connectapi output classes connectapi.paymentmethoddetails details about the payment method. property name type description available version alternative connectapi. alternative payment method details. 56.0 paymentmethod alternativepayment methodoutput cardpaymentmethod connectapi.cardpayment card payment method details. 56.0 methodoutput connectapi.paymentmethodresponse payment method information response. property name type description available version accountid string salesforce payments account to which this payment 51.0 method is linked. id string id of the payment method. 51.0 paymentmethod connectapi. details about the payment method. details paymentmethoddetails status string status of the payment method. 51.0 connectapi.paymentmethodtokenizationgatewayresponse payment method tokenization gateway response representation. subclass of connectapi.abstractgatewayresponse. property name type description available version gatewaytoken string the payment method token sent from the gateway. 52.0 connectapi.paymentmethodtokenizationresponse payment method tokenization output representation. property name type description available version error connectapi. error representation for the payment method 52.0 errorresponse tokenization process. sent only if the tokenization process encounters an error in the gateway. gatewayresponse connectapi. response containing the tokenized payment method 52.0 paymentmethodtokenization value from the payment gateway. gatewayresponse 1887apex reference guide connectapi output classes property name type description available version paymentgatewaylogs list process that occurred in the gateway. paymentmethod connectapi.paymentmethod object representation of the payment method object 52.0 response that was tokenized. connectapi.paymentresponse payment output. property name type description available version accountid string id of the account related the payment record. 50.0 amount double total amount of the payment transaction performed 50.0 in the payment request. currencyisocode string three-letter iso 4217 currency code associated with 50.0 the payment output. effectivedate datetime date that the payment becomes effective. 50.0 id string id of the payment record. 50.0 paymentnumber string number of the payment record created as a result of 50.0 the request processing. requestdate datetime date when the payment transaction occurred. 50.0 status string status of the new payment record. can be draft, 50.0 processed or cancelled. connectapi.percentrecordfield record field containing a percentage value. subclass of connect" "api.labeledrecordfield. name type description available version value double value of the percentage. 29.0 connectapi.phonenumber phone number. name type description available version label string a localized string indicating the phone type. 30.0 phonenumber string phone number. 28.0 1888apex reference guide connectapi output classes name type description available version phonetype string phone type. values are: 30.0 • fax • mobile • work these values are not localized. type string 28.0–29.0 note: this property is not available after version 29.0. use the phonetype property instead. values are: • fax • mobile • work these values are not localized. see also: connectapi.datacloudcompany connectapi.datacloudcontact connectapi.userdetail connectapi.photo profile photo. name type description available version fullemailphotourl string a temporary url to the large profile picture. the url expires after 28.0 30 days and is available to unauthenticated users. largephotourl string url to the large profile picture. the default width is 200 pixels, and 28.0 the height is scaled so the original image proportions are maintained. if a user hasn’t uploaded a photo, this url points to a default photo. if the user hasn’t uploaded a photo and the request header included x-connect-theme: salesforce1, this url points to a default photo based on a theme that the admin selected for the org. mediumphotourl string url to the medium profile picture. the default width is 160 pixels, 37.0 and the height is scaled so the original image proportions are maintained. if a user hasn’t uploaded a photo, this url points to a default photo. if the user hasn’t uploaded a photo and the request header included 1889apex reference guide connectapi output classes name type description available version x-connect-theme: salesforce1, this url points to a default photo based on a theme that the admin selected for the org. photoversionid string 18–character id to that version of the photo 28.0 smallphotourl string url to the small profile picture. the default size is 64x64 pixels. 28.0 if a user hasn’t uploaded a photo, this url points to a default photo. if the user hasn’t uploaded a photo and the request header included x-connect-theme: salesforce1, this url points to a default photo based on a theme that the admin selected for the org. standardemail string a temporary url to the small profile. the url expires after 30 days 28.0 photourl and is available to unauthenticated users. url string a resource that returns a photo object: for example, 28.0 /services/data/v58.0/chatter/users/005d0000001ll8oiaw/photo. see also: connectapi.chattergroup connectapi.recommendationdefinition connectapi.user connectapi.picklistrecordfield record field containing an enumerated value. subclass of connectapi.labeledrecordfield. connectapi.pincapability if a feed element has this capability, users who have permission can pin it to a feed. subclass of connectapi.feedelementcapability. property name type description available version ispinnablebyme boolean specifies whether the context user can pin or unpin 41.0 the entity to the feed (true) or not (false). ispinned boolean specifies whether the entity is pinned (true) or not 41.0 pinned (false) to the feed. see also: connectapi.feedelementcapabilities 1890apex reference guide connectapi output classes connectapi.pinnedfeedelements list of pinned feed elements for a feed. property name type description available version elements list note: in the ui, pinned feed elements don’t show all auxiliary information, such as comments, likes, interaction counts, or read by information. as a result, the connectapi.pinnedfeedelements output class doesn’t include all the information for these capabilities. connectapi.platformaction a platform action instance with state information for the context user. property name type description available version actionurl string for action links of subtype ui or download, 33." "0 direct the user to download or visit the ui from this link. salesforce issues a javascript redirect for the link in this format: /action-link-redirect/communityid /actionlinkid?_bearer=bearertoken. for api action links and for all platform actions, this value is null and salesforce handles the call. apiname string the api name. the value may be null. 33.0 confirmation string if this action requires a confirmation and has a status 33.0 message of newstatus, this is a default localized message that should be shown to an end user prior to invoking the action. otherwise, this is null. executinguser connectapi.user the user who initiated execution of this platform 33.0 summary action. groupdefault boolean true if this platform action is the default or primary 33.0 platform action in the platform action group; false otherwise. there can be only one default platform action per platform action group. iconurl string the url of the icon for the platform action. this value 33.0 may be null. 1891apex reference guide connectapi output classes property name type description available version id string the id for the platform action. 33.0 if the type is quickaction and the subtype is create, this value is null. label string the localized label for this platform action. 33.0 modifieddate datetime iso 8601 format date string, for example, 33.0 2011-02-25t18:24:31.000z. platformaction connectapi. a reference to the platform action group containing 33.0 group reference this platform action. status connectapi. the execution status of the platform action. values 33.0 platformaction are: status • failedstatus—the action link execution failed. • newstatus—the action link is ready to be executed. available for download and ui action links only. • pendingstatus—the action link is executing. choosing this value triggers the api call for api and apiasync action links. • successfulstatus—the action link executed successfully. subtype string the subtype of a platform action or null. 33.0 if the type property is actionlink, possible values are: • api—the action link calls a synchronous api at the action url. salesforce sets the status to successfulstatus or failedstatus based on the http status code returned by your server. • apiasync—the action link calls an asynchronous api at the action url. the action remains in a pendingstatus state until a third party makes a request to /connect/action-links/actionlinkid to set the status to successfulstatus or failedstatus when the asynchronous operation is complete. • download—the action link downloads a file from the action url. • ui—the action link takes the user to a web page at the action url. 1892apex reference guide connectapi output classes property name type description available version note: invoking apiasync action links from an app requires a call to set the status. however, there isn’t currently a way to set the status of an action link using apex. to set the status, use connect rest api. see the action link resource in the connect rest api developer guide for more information. type connectapi. the type of platform action. values are: 33.0 platformactiontype • actionlink—an indicator on a feed element that targets an api, a web page, or a file, represented by a button in the salesforce ui. • custombutton—when clicked, opens a url or a visualforce page in a window or executes javascript. • productivityaction—productivity actions are predefined and attached to a limited set of objects. productivity actions include send email, call, map, view website, and read news. except for the call action, you can’t edit productivity actions. • quickaction—a global or object-specific action. • standardbutton—a predefined salesforce button such as new, edit, or delete. url string the url for this platform action. 33.0 if the type is quickaction and the subtype is create, this value is null. see also: connectapi.platformactiongroup connectapi.platformactiongroup a platform action group instance with state appropriate for the context user. action link groups are one type of platform action group and are therefore represented as connectapi.platformaction" "group output classes. 1893apex reference guide connectapi output classes property name type description available version category connectapi. indicates the priority and relative locations of platform 33.0 platformaction actions. values are: groupcategory • primary—the action link group is displayed in the body of the feed element. • overflow—the action link group is displayed in the overflow menu of the feed element. id string the 18-character id or an opaque string id of the 33.0 platform action group. if the connectapi.platformactiontype is quickaction and the subtype is create, this value is null. modifieddate datetime iso 8601 date string, for example, 33.0 2014-02-25t18:24:31.000z. platformactions list within an action link group, action links are displayed in the order listed in the actionlinks property of the connectapi.actionlinkgroup definitioninput class. within a feed item, action link groups are displayed in the order specified in the actionlinkgroupids property of the connectapi.associatedactions capabilityinput class. url string the url for this platform action group. 33.0 if the connectapi.platformactiontype is quickaction and the subtype is create, this value is null. see also: connectapi.abstractrecommendation connectapi.associatedactionscapability connectapi.pollcapability if a feed element has this capability, it includes a poll. subclass of connectapi.feedelementcapability. property name type description available version choices list 1894apex reference guide connectapi output classes property name type description available version mychoiceid string 18-character id of the poll choice that the context 32.0 user has voted for in this poll. returns null if the context user has not voted. totalvotecount integer total number of votes cast on the feed poll element. 32.0 see also: connectapi.feedelementcapabilities connectapi.postauthorizationresponse gateway response following a post authorization request. property name type description available version error connectapi. information about errors that occurred in the 54.0 errorresponse payment gateway while evaluating the post authorization request. gatewayresponse connectapi. payment gateway's response to the post 54.0 postauth authorization request. gatewayresponse paymentauthorization connectapi. payment gateway's response to the original payment 54.0 paymentauthorization authorization request. response paymentgatewaylogs list gateways. gateway logs can also record payloads from external payment entities. paymentgroup connectapi. payment group, consisting of one or more payments, 54.0 paymentgroup sent to the gateway for the post authorization response request. paymentmethod connectapi. payment method used in the post authorization 54.0 paymentmethod request. response connectapi.postauthgatewayresponse gateway response after confirmation that the merchant is ready to capture payment of an existing pre-authorized transaction. sublass of connectapi.abstractgatewayresponse 1895apex reference guide connectapi output classes property name type description available version gateway string code used to authorize the payment that the 54.0 authorizationcode payment gateway is processing. paymentmethod connectapi. details about the payment method. 54.0 details paymentmethoddetails connectapi.previewcanceloutputrepresentation expected financial values for a proposed cancel action. subclass of connectapi.baseoutputrepresentation. property name type description available version changebalances connectapi. expected financial values for the proposed cancel 48.0 changeitem action. outputrepresentation ordersummaryid string id of the ordersummary. 48.0 connectapi.previewreturnoutputrepresentation expected financial values for a proposed return action. subclass of connectapi.baseoutputrepresentation. property name type description available version changebalances connectapi. expected financial values for the proposed return 48.0 changeitem action. outputrepresentation ordersummaryid string id of the ordersummary. 48.0 connectapi.priceadjustmentschedule price adjustment schedule. property name type description available version id string id" "of the price adjustment schedule. 49.0 priceadjustment list see also: connectapi.productprice 1896apex reference guide connectapi output classes connectapi.priceadjustmenttier price adjustment tier. property name type description available version adjustmenttype connectapi. type of price adjustment for the tier. values are: 49.0 priceadjustment • amountbasedadjustment—price is tiertype adjusted by a specified amount. • percentagebasedadjustment—price is adjusted by a specified percentage. adjustmentvalue string adjustment value of the tier. 49.0 id string id of the price adjustment tier. 49.0 lowerbound string lower limit of the tier. 49.0 tierunitprice string unit price of the tier. 49.0 upperbound string upper limit of the tier. 49.0 see also: connectapi.priceadjustmentschedule connectapi.pricingresult product pricing result. property name type description available version currencyisocode string three-letter iso 4217 currency code associated with 49.0 the product. error connectapi. error code and message. 49.0 errorresponse pricingline list success boolean specifies whether the execution was successful 49.0 (true) or not (false). connectapi.pricingresultlineitem pricing result line item. property name type description available version error connectapi. error code and message. 49.0 errorresponse 1897apex reference guide connectapi output classes property name type description available version listprice string list price for the product. 49.0 pricebookentryid string id of the pricebook entry. 49.0 productid string id of the product to price. 49.0 success boolean specifies whether the execution was successful 49.0 (true) or not (false). unitprice string unit price for the product. 49.0 see also: connectapi.pricingresult connectapi.productsummary connectapi.productattributeinfo product attribute metadata. property name type description available version allowablevalues list active attribute picklist values that can be used to 50.0 create variations. these values are determined by the order of the picklist values in object manager. apiname string api name of the attribute. 50.0 availablevalues list attribute picklist values that are available for the 50.0 product in the store. these values are sorted by the order of values in the allowablevalues property. fieldenumorid string field id for custom fields or enumeration value for 50.0 standard fields. label string label of the attribute. 50.0 objectname string name of the object that contains the field. 50.0 sequence integer sequence value determined by the order of the 50.0 attributes under commerce setup for the attribute set. see also: connectapi.productdetail connectapi.productattributesetinfo connectapi.productvariationinfo 1898apex reference guide connectapi output classes connectapi.productattributeselectioninfo product attribute. property name type description available version apiname string api name of the attribute. 50.0 label string label of the attribute. 50.0 sequence integer sequence value determined by the order of the 50.0 attributes under commerce setup for the attribute set. value string display value of the attribute. 50.0 see also: connectapi.productattributestoproductentry connectapi.productattributeset product attribute set data. property name type description available version attributes map map of the attributes that are members of the 50.0 attribute set. developername string name of the attribute set. 50.0 id string id of the product attribute record that represents the 50.0 product attribute set. connectapi.productattributesetinfo attribute set metadata. important: where possible, we changed noninclusive terms to align with our company value of equality. we maintained certain terms to avoid any effect on customer implementations. property name type description available version attributeinfo map description string description of the attribute set. 50.0 developername string developer name of the attribute set. 50.0" "id string id of the attribute set. 50.0 masterlabel string label of the attribute set. 50.0 1899apex reference guide connectapi output classes property name type description available version sequence integer sequence of the attribute set for the product. 50.0 see also: connectapi.productdetail connectapi.productattributesetsummary summary of a product attribute set. property name type description available version apiname string api name of the attribute set. 51.0 attributes list label string display label of the attribute set. 51.0 see also: connectapi.orderitemsummaryproduct connectapi.productsummary connectapi.productattributesummary summary of a product attribute. property name type description available version apiname string api name of the attribute. 51.0 label string display label of the attribute. 51.0 sequence integer sequence of the attribute in the attribute set. 51.0 value string display value of the attribute. 51.0 see also: connectapi.productattributesetsummary connectapi.productattributestoproductentry mapping of an attribute value combination to a variation product id. 1900apex reference guide connectapi output classes property name type description available version canonicalkey string attribute api values concatenated with an underscore 50.0 (_) based on the sequence number of the attributes in the attribute set. productid string variation product id for the selection of attributes. 50.0 selectedattributes list see also: connectapi.productvariationinfo connectapi.productcategorydata product category. property name type description available version description string description of the category. 49.0 id string id of the category. 49.0 name string name of the category. 49.0 see also: connectapi.productcategorypath connectapi.searchcategory connectapi.productcategorydetail details of a product category. property name type description available version bannerimage connectapi. banner image of the product category. 49.0 productcategorymedia fields map list of fields for the product category. 49.0 id string id of the product category. 49.0 mediagroups list 1901apex reference guide connectapi output classes property name type description available version tileimage connectapi. tile image of the product category. 49.0 productcategorymedia see also: connectapi.productcategorydetailcollection connectapi.productcategorydetailcollection collection of product category details. property name type description available version productcategories list connectapi.productcategorymedia media associated with a product category. property name type description available version alternatetext string alternative text for the product category media. 49.0 contentversionid string id of the latest published content version if the media 49.0 is stored as a contentdocument. if the image is a customer-provided external url, the value is null. not supported in enhanced cms workspaces. id string id of the product category image. 49.0 mediatype connectapi. type of product media. values are: 49.0 productmediatype • document • image • video sortorder integer sort order of a media item inside a media group. 49.0 thumbnailurl string url of the thumbnail for product media. if a value 49.0 exists, it should be used for the thumbnail whether the image is natively uploaded or hosted externally. not supported in enhanced cms workspaces. title string title of the product category media. 49.0 1902apex reference guide connectapi output classes property name type description available version url string url of the product category media. 49.0 see also: connectapi.productcategorymediagroup connectapi.productcategorydetail connectapi.productcategorymediagroup media group associated with a product category. property name type description available version developername string api name of the product category media group. 49.0 id string id of the product category media group. 49.0 mediaitems list group. name string name of the product category media group. 49.0 usagetype connectapi. usage type of a product media item within a media 49.0 productmedia group. values are: usagetype • attachment—product media group with product documents as attachments. • banner—product category media group with banner images of the product. • listing—product media group with listing images of the product. • standard—product media group with standard images and videos of the product. • tile—product category media group with tile images of the product. connectapi.productcategorypath list of product categories in a path. property name type description available version path list see also: connectapi.productdetail 1903apex reference guide connectapi output classes connectapi.productchild child product related to a parent product. property name type description available version defaultquantity string default quantity of child products to be ordered. 57.0 productinfo connectapi. product details of the child product. 57.0 productdetail connectapi.productchildcollection collection of child products related to a parent product. property name type description available version count integer number of child products returned on this page. 57.0 currentpagetoken string current page token, if any. 57.0 currentpageurl string url of the current page in the response. 57.0 items list the child products are sorted by their configured sequence values, in ascending order, with null values sorted last. if there are no configured sequence values, the child products are sorted by createddate, in ascending order. nextpagetoken string token for the next page, if any. a value is included in 57.0 the response only if a value is returned for nextpageurl. nextpageurl string url of the next page, if any. 57.0 previouspagetoken string token for the previous page, if any. a value is 57.0 included in the response only if a value is returned for previouspageurl. previouspageurl string url of the previous page, if any. 57.0 total integer total number of child products in the collection. 57.0 connectapi.productdetail details of a product. 1904apex reference guide connectapi output classes property name type description available version attributesetinfo map defaultimage connectapi. default image of the product. 49.0 productmedia entitlement connectapi. entitlement details for the product. 49.0–56.0 productentitlement to get pricing information for products in version 57 and later, use the commercestorepricing class. fields map list of fields for the product. 49.0 id string id of the product. 49.0 mediagroups list primaryproduct connectapi. primary category path of the product. 49.0 categorypath productcategorypath productclass connectapi. class of product. values are: 50.0 productclass • simple • variation • variationparent productselling list purchasequantity connectapi. if one exists, purchase quantity rule for the product. 52.0 rule purchasequantity rule variationattribute connectapi. variation attribute set for the product. 50.0 set productattributeset variationinfo connectapi. available and allowable values for variation attributes 50.0 productvariationinfo and a map to resolve variation product ids from attribute value combinations. variationparentid string id of the variation parent. 50.0 connectapi.productdetailsoutputrepresentation details about a product. subclass of connectapi.baseoutputrepresentation. 1905apex reference guide connectapi output classes property name type description available version attributes lsit currencyisocode string currency iso code. 55.0 description" "string description of the product. 55.0 fields map list of the product’s fields. 55.0 imagegroups list listprice double list price. 55.0 name string name. 55.0 productquantityrule purchase quantity rule if one exists, purchase quantity rule for the product. 55.0 productid string product id. 55.0 stockkeepingunit string stock keeping unit. 55.0 unitprice double unit price. 55.0 variants list connectapi.productentitlement entitlements for a product. property name type description available version canviewprice boolean specifies whether the product's price can be viewed 49.0 (true) or not (false). see also: connectapi.productdetail connectapi.productimageoutputrepresentation details about a product image. 1906apex reference guide connectapi output classes property name type description available version alternatetext string alternate text for accessibility. 55.0 mediatype string media type. 55.0 thumbnailurl string url of the thumbnail version of the product image. 55.0 title string title. 55.0 url string url of the product image. 55.0 connectapi.productimagegroupoutputrepresentation details about a product image group. property name type description available version images list viewtype string the type of product images in the group. 55.0 connectapi.productmedia media associated with a product. property name type description available version alternatetext string alternative text for the product media. 49.0 contentversionid string id of the latest published content version if the media 49.0 is stored as a contentdocument. if the image is a customer-provided external url, the value is null. not supported in enhanced cms workspaces. id string id of the product image. 49.0 mediatype connectapi. type of product media. values are: 49.0 productmediatype • document • image • video sortorder integer sort order of a media item within a media group. 49.0 thumbnailurl string url of the thumbnail for product media. if a value 49.0 exists, it should be used for the thumbnail whether the image is natively uploaded or hosted externally. not supported in enhanced cms workspaces. title string title of the product media. 49.0 1907apex reference guide connectapi output classes property name type description available version url string url of the product media. 49.0 see also: connectapi.cartitemproduct connectapi.productdetail connectapi.productmediagroup connectapi.orderitemsummaryproduct connectapi.productsummary connectapi.productmediagroup media group associated with a product. property name type description available version developername string api name of the product media group. 49.0 id string id of the product media group. 49.0 mediaitems list name string name of the product media group. 49.0 usagetype connectapi. usage type of a product media item within a media 49.0 productmedia group. values are: usagetype • attachment—product media group with product documents as attachments. • banner—product category media group with banner images of the product. • listing—product media group with listing images of the product. • standard—product media group with standard images and videos of the product. • tile—product category media group with tile images of the product. see also: connectapi.productdetail connectapi.productcategorydetail connectapi.productoverview overview of a product, with summary information about prices, selected fields, and the product’s default image. 1908apex reference guide connectapi output classes property name type description available version defaultimage connectapi. media representation of the product's default image. 54.0 productmedia error connectapi. error code and error message. 54.0 errorresponse fields map map of fields belonging to the product. 54.0 id string id of the product. 54.0" "prices connectapi. price of the product. 54.0–57.0 pricingresult to get pricing information for products in version 58 lineitem and later, use the commercestorepricing class. sku string sku of the product. 54.0 success boolean represents whether execution was successful and 54.0 product overview information was retrieved without error. connectapi.productoverviewcollection collection of product overviews. property name type description available version products list total integer total number of products returned. 54.0 connectapi.productprice pricing information for a product. property name type description available version currencyisocode string three-letter iso 4217 currency code associated with 49.0 the product. products are priced using the currency for the buyer account or guest buyer profile. if your store doesn’t support the currency for the buyer account or guest buyer profile, products are priced using the default currency for your store. listprice string list price for the product. 49.0 1909apex reference guide connectapi output classes property name type description available version priceadjustment connectapi. price adjustment schedule for the product. if a 49.0 priceadjustment product selling model id is specified in a request schedule parameter, this property is empty. pricebookentryid string id of the price book entry. if a product selling model 49.0 id is specified in a request parameter, this property is empty. productpriceentries ls list of line item prices for the product. 56.0 unitprice string unit price for the product. if a product selling model 49.0 id is specified in a request parameter, this property is empty. connectapi.productpriceentry line item price for the product. property name type description available version error connectapi. error code and error message. 56.0 errorresponse listprice string list price for the product entry. 56.0 priceadjustment connectapi. price adjustment schedule. 56.0 priceadjustment schedule pricebookentryid string id of the pricebook entry. 56.0 productselling string id of the product selling model. if no product selling 56.0 modelid model id is specified in a request parameter, this property is empty. success boolean specifies whether execution was successful (true) 56.0 or not (false). unitprice string unit price for the product entry. 56.0 connectapi.productvariationinfo product variation attributes, metadata, and mappings of attribute combinations to variation product ids. property name type description available version attributesto list map the attribute value combinations to the variation product id. 1910apex reference guide connectapi output classes property name type description available version variationattributeinfo map see also: connectapi.productdetail connectapi.productsearchresults product search results. property name type description available version categories connectapi. categories from the search results. 52.0 searchcategory correlationid string reserved for future use. 55.0 facets list locale string locale of the search results. 52.0 productspage connectapi. page of products from the search results. 52.0 productsummarypage connectapi.productsearchsuggestionsresults product search suggestions results. property name type description available version recentsearch list connectapi.productsellingmodel product selling model for commerce subscriptions. property name type description available version id string id of the product selling model. 56.0 name string name of the product selling model. 56.0 pricingterm integer number of pricing term units in the pricing term. 56.0 used with pricingtermunit to define the length of the pricing term. for example, if 1911apex reference guide connectapi output classes property name type description available version pricingtermunit is months and this property is 1, the subscription is priced monthly. however, if the sellingmodeltype property is set to one" "time, the pricingterm property is empty, because the product isn’t sold as a subscription. the only allowed value for this property is 1. pricingtermunit connectapi. unit of time used to define a pricing term. value is: 56.0 pricingtermunit • months—product is priced on a monthly basis. • annual—product is priced on an annual basis. this unit of time is combined with a number (specified by the pricingterm property) to define the full term of the subscription. for example, if the unit of time is months and the pricingterm property is set to 1, the subscription is priced monthly. however, if the sellingmodeltype property is set to onetime, the pricingtermunit property is empty, because the product isn’t sold as a subscription. sellingmodeltype connectapi. type of product selling model. values are: 56.0 sellingmodeltype • evergreen—a subscription without an end date. an evergreen subscription continues until the shopper affirmatively cancels it. • onetime—a product that isn’t sold as a subscription. • termdefined—a subscription with a defined end date. the subscription continues for a specified time period. when the term ends, the subscription ends. connectapi.productsummary product summary. property name type description available version defaultimage connectapi. default image of the product. 52.0 productmedia fields map 1912apex reference guide connectapi output classes property name type description available version id string id of the product. 52.0 name string name of the product. 52.0 prices connectapi. prices of the product. 52.0 pricingresult lineitem productclass connectapi. class of product. values are: 52.0 productclass • simple • variation • variationparent purchasequantityrule connectapi. if one exists, purchase quantity rule for the product. 52.0 purchasequantity rule variationattributeset connectapi. variation attribute set that’s associated with the 52.0 productattribute product. setsummary see also: connectapi.productsummarypage connectapi.productsummarypage page of product summaries. property name type description available version currencyisocode string three-letter iso 4217 currency code associated with 52.0 the product. pagesize integer number of products per page in the search results. 52.0 products list total long total number of products in the search results. 52.0 see also: connectapi.productsearchresults connectapi.productvariantoutputrepresentation details about a product variation. 1913apex reference guide connectapi output classes property name type description available version listprice double list price. 55.0 price double price. 55.0 productid string product id. 55.0 stockkeepingunit string stock keeping unit. 55.0 unitprice double unit price. 55.0 variationvalues map the variation attribute values that define the variation. 55.0 connectapi.productvariationattributeoutputrepresentation details about a product variation attribute. property name type description available version apiname string api name of the attribute. 55.0 label string label of the attribute. 55.0 variationattribute list connectapi.productvariationattributevalueoutputrepresentation valid value for a product variation attribute. property name type description available version name string api name of the attribute this value belongs to. 55.0 orderable boolean whether the value defines an orderable product 55.0 variation. value string value of the value. 55.0 connectapi.promotioncart a cart, its items, and its adjustment groups. property name type description available version cartadjustment list 1914apex reference guide connectapi output classes property name type description available version cartitems list currencyisocode string currency code of the cart. 57" ".0 id string id of the cart. 57.0 totaladjustment string total adjustment base amount for the cart. 57.0 baseamount totalnetamount string total price of the cart, including adjustments. 57.0 totalproduct string total price of all cart items in the cart. 57.0 baseamount see also: connectapi.promotionevaluation evaluate(salestransaction) connectapi.promotioncartadjustmentgroup adjustment group associated with a cart. property name type description available version adjustmentbasis string id of the associated coupon, if applicable. 57.0 reference adjustment string description of the adjustment. 57.0 description adjustmenttype connectapi. how the price adjustment amount is calculated. 57.0 adjustmenttype values are: • adjustmentamount—the adjustment is a fixed amount. • adjustmentpercentage—the adjustment is a percentage. adjustmentvalue string price value of the adjustment. 57.0 baseamount string total amount of the adjustment. 57.0 cartid string id of the cart. 57.0 id string id of the cart adjustment group. 57.0 priceadjustment string id of the related promotion. 57.0 causeid 1915apex reference guide connectapi output classes property name type description available version priority integer where in the sequence of adjustments this 57.0 adjustment was applied. see also: connectapi.promotioncart connectapi.promotionevaluation evaluate(salestransaction) connectapi.promotioncartitem a cart item and its adjustments. property name type description available version cartdelivery string id of the associated cart delivery group. 57.0 groupid cartid string id of the associated cart. 57.0 cartitemprice list id string id of the cart item. 57.0 itemdescription string description of the cart item. 57.0 itemname string name of the cart item. 57.0 listprice string unit list price of the cart item. 57.0 product2id string id of the product. 57.0 quantity string quantity of the cart item. 57.0 salesprice string unit sales price of the cart item. 57.0 sku string stock keeping unit of the cart item. 57.0 totaladjustment string total adjustment amount for the cart item. 57.0 baseamount totalline string total amount for the cart item, based on sales price 57.0 baseamount and quantity, not including adjustments. totallist string total amount for the cart item, based on list price 57.0 baseamount and quantity, not including adjustments. totalnetamount string total amount for the cart item, based on list price 57.0 and quantity, including adjustments. 1916apex reference guide connectapi output classes property name type description available version type connectapi. type of item in a cart. values are: 57.0 cartitemtype • deliverycharge • product see also: connectapi.promotioncart connectapi.promotionevaluation evaluate(salestransaction) connectapi.promotioncartitempriceadjustment price adjustments applied to a cart item. property name type description available version adjustmentamount connectapi. scope of the price adjustment amount. values are: 57.0 scope adjustmentamount • total—the adjustment scope is the total price. scope • unit—the adjustment scope is the unit price. • unproratedtotal—the adjustment scope is the unprorated total price. adjustmentbasis string id of the associated coupon, if applicable. 57.0 reference adjustment string description of the adjustment. 57.0 description adjustmenttarget connectapi. level of the promotion target. values are: 57.0 type cartpromotiontype • cart—the target is cart-level. • item—the target is item-level. adjustmenttype connectapi. how the price adjustment amount is calculated. 57.0 adjustmenttype values are: • adjustmentamount—the adjustment is a fixed amount. • adjustmentpercentage—the adjustment is a percentage. adjustmentvalue string value of the price adjustment. 57.0 baseamount string total adjustment amount. 57.0 cartadjustment string id of the associated cart adjustment group. 57.0 groupid 1917apex reference guide connectapi output classes property name type description available version cartitemid string" "id of the associated cart item. 57.0 id string id of the cart item price adjustment. 57.0 priceadjustment string id of the associated promotion. 57.0 causeid priority integer where in the sequence of adjustments this 57.0 adjustment was applied. see also: connectapi.promotioncartitem connectapi.promotioncart connectapi.promotionevaluation evaluate(salestransaction) connectapi.promotioncoupon a coupon used in a promotion. property name type description available version couponcode string coupon code. 57.0 couponerrorcode string error code returned if the coupon is invalid. 57.0 id string id of the coupon. 57.0 isvalidcoupon boolean indicates whether the coupon is valid (true) or 57.0 invalid (false). see also: connectapi.promotionevaluation evaluate(salestransaction) connectapi.promotionevaluation results of a promotion evaluation. property name type description available version cart connectapi. cart and its items. 57.0 promotioncart 1918apex reference guide connectapi output classes property name type description available version coupons list customer can apply a maximum of two coupons. see also: evaluate(salestransaction) connectapi.purchasequantityrule rule that restricts the quantity of a product that can be purchased. property name type description available version increment string increment value of the quantity that can be 52.0 purchased. maximum string maximum quantity that can be purchased. 52.0 minimum string minimum quantity that can be purchased. 52.0 see also: connectapi.cartitemproduct connectapi.productdetail connectapi.productsummary connectapi.questionandanswerscapability if a feed element has this capability, it has a question and comments on the feed element are answers to the question. subclass of connectapi.feedelementcapability. property name type description available version bestanswer connectapi. comment selected as the best answer for the 32.0 comment question. bestanswer connectapi. user who selected the best answer for the question. 32.0 selectedby usersummary cancurrentuser boolean indicates whether the context user can select or 32.0 selectorremove remove a best answer (true) or not (false). bestanswer candidateanswers connectapi. status of candidate answers for the question. 41.0 candidateanswers status escalatedcase connectapi. if a question post is escalated, this is the case to which 33.0 reference it was escalated. 1919apex reference guide connectapi output classes property name type description available version questiontitle string title for the question. 32.0 see also: connectapi.feedelementcapabilities connectapi.questionandanswerssuggestions question and answers suggestions. property name type description available version articles list questions list connectapi.rankaveragedistanceoutputrepresentation the results of calculating the average distances from sets of inventory locations to an order recipient. subclass of connectapi.baseoutputrepresentation. property name type description available version distanceunit string the specified unit of distance (miles or kilometers). 51.0 results list connectapi.readby information about who read the feed element and when. property name type description available version lastreaddatebyuser datetime when the user last read the feed element in iso 8601 40.0 format. user connectapi. information about the user who read the feed 40.0 usersummary element. see also: connectapi.readbypage 1920apex reference guide connectapi output classes connectapi.readbycapability if a feed element has this capability, the context user can mark it as read. subclass of connectapi.feedelementcapability. property name type description available version isreadbyme boolean specifies whether the feed element has been read 40.0 (true) or not (false) by the context user. lastreaddatebyme datetime last date when the feed element was marked read 40.0 for the" "context user in iso 8601 format. otherwise, null. page connectapi. first page of information about who read the feed 40.0 readbypage element and when. see also: connectapi.feedelementcapabilities connectapi.readbypage a collection of information about who read the feed element and when. property name type description available version currentpagetoken string token identifying the current page. 40.0 currentpageurl string connect rest api url identifying the current page. 40.0 the default is 25 items per page. items list and when they last read the feed element. nextpagetoken string token identifying the next page, or null if there 40.0 isn’t a next page. nextpageurl string connect rest api url identifying the next page, or 40.0 null if there isn’t a next page. previouspagetoken string reserved for future use. 40.0 previouspageurl string reserved for future use. 40.0 1921apex reference guide connectapi output classes property name type description available version total integer total number of users who read the feed element. 40.0 note: this count appears in the ui under feed posts in private and unlisted chatter groups as the “seen by” number, for example, “seen by 48.” see also: connectapi.readbycapability connectapi.recommendation a next best action recommendation object. property name type description available version acceptancelabel string text indicating user acceptance of the 45.0 recommendation. actionreference string reference to the action to perform, for example, 45.0 launching a flow. description string description of the recommendation. 45.0 externalid string external id of the recommendation. this id doesn’t 46.0 need to be a salesforce 18-character id. for example, it can be a product number from an external system. id string id of the recommendation. 45.0 image connectapi. image to display. 45.0 fileasset name string name of the recommendation. 45.0 rejectionlabel string text indicating user rejection of the recommendation. 45.0 url string url to the recommendation. 45.0 connectapi.recommendationaudience a custom recommendation audience. property name type description available version criteria connectapi. the criteria for the custom recommendation audience 36.0 audiencecriteria type. id string 18-character id of the custom recommendation 35.0 audience. 1922apex reference guide connectapi output classes property name type description available version membercount integer 35.0 only important: this property is available only in version 35.0. in version 36.0 and later, this property is available in connectapi.customlistaudiencecriteria. number of members in the custom recommendation audience. members connectapi. 35.0 only important: this property is available only in userreferencepage version 35.0. in version 36.0 and later, this property is available in connectapi.customlistaudiencecriteria. members of the custom recommendation audience. modifiedby connectapi.user user who last modified the custom recommendation 36.0 audience. modifieddate datetime iso 8601 format date string, for example, 36.0 2011-02-25t18:24:31.000z. name string name of the custom recommendation audience. 35.0 url string url to the custom recommendation audience. 35.0 see also: connectapi.recommendationaudiencepage connectapi.recommendationaudiencepage a list of custom recommendation audiences. property name type description available version audiencecount integer the total number of custom recommendation 35.0 audiences. currentpageurl string url to the current page. 35.0 nextpageurl string url to the next page. 35.0 previouspageurl string url to the previous page. 35.0 recommendation list connectapi.recommendationcollection a list of chatter, custom, and static recommendations. 1923apex reference guide connectapi output classes property name type description available version recommendations list connectapi.recommendationdefinition represents a custom recommendation" "definition. property name type description available version actionurl string the url for acting on this custom recommendation. 35.0 actionurlname string the text label for the action url in the user interface. 35.0 explanation string explanation of the custom recommendation 35.0 definition. id string 18-character id of the custom recommendation 35.0 definition. name string name of the custom recommendation definition. 35.0 the name is displayed in setup. photo connectapi.photo photo of the custom recommendation definition. 35.0 title string title of the custom recommendation definition. 35.0 url string url to the connect rest api resource for the custom 35.0 recommendation definition. see also: connectapi.recommendationdefinitionpage connectapi.scheduledrecommendation connectapi.recommendationdefinitionpage a list of custom recommendation definitions. property name type description available version recommendation list url string url to the connect rest api resource for the 35.0 recommendation definition collection. 1924apex reference guide connectapi output classes connectapi.recommendationexplanation explanation for a chatter recommendation. subclass of connectapi.abstractrecommendationexplanation. property name type description available version detailsurl string url to explanation details or null if the chatter 32.0 recommendation doesn’t have a detailed explanation. see also: connectapi.abstractrecommendation connectapi.recommendationreaction a reaction to a recommendation produced by a recommendation strategy property name type description available version aimodel string reserved for future use. 47.0 contextrecord connectapi.reference reference to the context record. 45.0 createdby connectapi. reference to the reaction creator. 45.0 reference createddate datetime reaction creation date. 45.0 externalid string external target id of the recommendation reacted 46.0 on. this id doesn’t need to be a salesforce 18-character id. for example, it can be a product number from an external system. id string reaction record id. 45.0 onbehalfof connectapi. reference to the user or record that is indirectly 45.0 reference reacting to the recommendation. reactiontype connectapi. type of reaction to a recommendation. values are: 45.0 recommendationreaction • accepted type • rejected recommendation string reserved for future use. 46.0 mode recommendation double reserved for future use. 46.0 score strategy connectapi. strategy that recommended the target record. 45.0 recordsnapshot 1925apex reference guide connectapi output classes property name type description available version targetaction connectapi. target action that is recommended. 45.0 recordsnapshot targetrecord connectapi. reference to the target record. 45.0 reference url string url to the recommendation reaction. 45.0 see also: connectapi.recommendationreactions connectapi.recommendationreactions a list of recommendation reactions. property name type description available version currentpageurl string url to the current page of reactions in the collection. 45.0 nextpageurl string url to the next page of reactions in the collection. 45.0 reactions list connectapi.recommendationscapability if a feed element has this capability, it has a recommendation. subclass of connectapi.feedelementcapability. property name type description available version items list see also: connectapi.feedelementcapabilities connectapi.recommendedobject a recommended object, such as a custom or static recommendation. subclass of connectapi.actor 1926apex reference guide connectapi output classes property name type description available version idorenum string id of a recommendation definition for a custom 34.0 recommendation or the enum value today for static recommendations that don’t have an id (version 35.0 and later). motif connectapi.motif motif of the recommended object. 34.0 connectapi.recordcapability if a comment has this capability, it has a record attachment. subclass of connectapi.feedelementcapability. property name type description available version recordid string id of the record. 42.0 url string url to" "the record. 42.0 connectapi.recordfield generic record field containing a label and text value. subclass of connectapi.labeledrecordfield. no additional properties. see also: connectapi.compoundrecordfield connectapi.orderitemsummary connectapi.orderitemsummaryproduct connectapi.orderdeliverygroupsummary connectapi.ordersummaryrepresentation connectapi.recordsnapshot a record snapshot in a recommendation reaction. property name type description available version id string id of the record. 45.0 nameatsnapshot string name of the record when the id was recorded. 45.0 see also: connectapi.recommendationreaction 1927apex reference guide connectapi output classes connectapi.recordsnapshotcapability if a feed element has this capability, it contains all the snapshotted fields of a record for a single create record event. subclass of connectapi.feedelementcapability. property name type description available version recordview connectapi. a record representation that includes metadata and 32.0 recordview data so you can display the record easily. see also: connectapi.feedelementcapabilities connectapi.recordsummary record summary. subclass of connectapi.abstractrecordview. property name type description available version entitylabel connectapi. label of the record’s entity. 40.0 entitylabel see also: connectapi.emailaddress connectapi.emailattachment connectapi.referencerecordfield connectapi.referencewithdaterecordfield connectapi.recordsummarylist summary information about a list of records in the organization including custom objects. name type description available version records list a list of records. 30.0 url string the url to this list of records. 30.0 connectapi.recordview a view of any record in the org, including a custom object record. this object is used if a specialized object, such as user or chattergroup, isn’t available for the record type. subclass of connectapi.abstractrecordview. 1928apex reference guide connectapi output classes name type description available version sections list see also: connectapi.recordsnapshotcapability connectapi.recordviewsection section of record fields and values on a record detail. name type description available version columncount integer number of columns to use to lay out the fields in a record 29.0 section. columnorder connectapi. order of the fields to use in the fields property to lay out 29.0 recordcolumnorder the fields in a record section. enum • leftright—fields are rendered from left to right. • topdown—fields are rendered from the top down. fields connectapi. fields and values for the record contained in this section. 29.0 abstract recordfield heading string localized label to display when rendering this section of fields. 29.0 iscollapsible boolean indicates whether the section can be collapsed to hide all the 29.0 fields (true) or not (false). see also: connectapi.recordview connectapi.recordsetfiltercriteriacollection list of the recordset filters and records. property name type description available version recordsetfilters list record ids. connectapi.recordsetfiltercriteria recordset filter criteria and the filtered records. 1929apex reference guide connectapi output classes property name type description available version criteriaid string recordset filter criteria id. 53.0 recordids list list of filtered record ids. 53.0 see also: connectapi.recordsetfiltercriteriacollection connectapi.reference reference to a record. name type description available version id string the id of the record being referenced, which could be an 18-character 28.0 id or some other string identifier. url string the url to the resource endpoint. 28.0 connectapi.referencerecordfield record field with a label and text value. subclass of connectapi.labeledrecordfield. name type description available version reference connectapi. object referenced by the record field. 29.0 recordsummary connectapi.referencedrefundresponse refund comprehensive output. property name type" "description available version error connectapi. error response representation for the refund. 50.0 errorresponse gatewayresponse connectapi. gateway response received for the processed refund 50.0 refundgatewayresponse request. paymentgatewaylogs list paymentgroup connectapi. payment group associated with the refund. 50.0 paymentgroupresponse refund connectapi. refund response representation. 50.0 refundresponse 1930apex reference guide connectapi output classes connectapi.referencewithdaterecordfield record field containing a referenced object that acted at a specific time, for example, “created by...”. subclass of connectapi.labeledrecordfield. name type description available version datevalue datetime time at which the referenced object acted. 29.0 reference connectapi. object referenced by the record field. 29.0 recordsummary connectapi.refundgatewayresponse refund gateway response. subclass of connectapi.abstractgatewayresponse. no additional properties. connectapi.refundresponse refund output. property name type description available version accountid string id of the account related to the refund record. 50.0 amount double total amount of the refund transaction performed in 50.0 the payment request. currencyisocode string three-letter iso 4217 currency code associated with 50.0 the payment group record. effectivedate datetime date that the refund becomes effective. 50.0 id string id of the refund record. 50.0 refundnumber string number of the refund record that was created as a 50.0 result of the request processing. requestdate datetime date when the refund occurred. 50.0 status string indicates the results of processing the refund 50.0 transaction in the gateway. can be draft, processed or cancelled. connectapi.relatedfeedpost this class is abstract. subclass of: connectapi.actorwithid superclass of: connectapi.relatedquestion 1931apex reference guide connectapi output classes property name type description available version score double score of the related feed post that indicates how 37.0 closely related it is to the context feed post. title string title of the related feed post. 37.0 see also: connectapi.relatedfeedposts connectapi.relatedfeedposts a collection of related feed posts. property name type description available version relatedfeedposts list connectapi.relatedquestion a related question. subclass of: connectapi.relatedfeedpost property name type description available version hasbestanswer boolean indicates whether the question has a best answer. 37.0 interactions connectapi. the number of individual views, likes, and comments 38.0 interactions on a question. capability connectapi.releaseheldfocapacityoutputrepresentation response to a request to confirm held fulfillment order capacity at one or more locations. can correspond to one action call. subclass of connectapi.baseoutputrepresentation. property name type description available version releaseheldfo list connectapi.releaseheldfocapacityresponseoutputrepresentation response to a request to release held fulfillment order capacity at one or more locations. 1932" "apex reference guide connectapi output classes property name type description available version capacityresponses list connectapi.replyintent reply intent for a social post. property name type description available version managedsocialaccount connectapi. managed social account that replies to the social 45.0 managedsocialaccount post. see also: connectapi.replyintents connectapi.replyintents list of reply intents for a social post. property name type description available version replies list see also: connectapi.socialpostintents connectapi.repositoryfiledetail a detailed description of a repository file. subclass of connectapi.abstractrepositoryfile no additional properties. connectapi.repositoryfilesummary a summary of a repository file. subclass of connectapi.abstractrepositoryfile no additional properties. see also: connectapi.repositoryfolderitem 1933apex reference guide connectapi output classes connectapi.repositoryfolderdetail a detailed description of a repository folder. subclass of connectapi.abstractrepositoryfolder no additional properties. connectapi.repositoryfolderitem a folder item. property name type description available version file connectapi. if the folder item is a file, the file summary. if the folder 39.0 repository item is a folder, null. filesummary folder connectapi. if the folder item is a folder, the folder summary. if 39.0 repository the folder item is a file, null. foldersummary type connectapi. type of item in a folder. values are: 39.0 folderitemtype • file • folder see also: connectapi.repositoryfolderitemscollection connectapi.repositoryfolderitemscollection a collection of repository folder items. property name type description available version currentpageurl string url to the current page of items. 39.0 items list nextpageurl string url to the next page of items, or null if there isn’t 39.0 a next page. previouspageurl string url to the previous page of items, or null if there 39.0 isn’t a previous page. connectapi.repositoryfoldersummary a summary of a repository folder. 1934apex reference guide connectapi output classes subclass of connectapi.abstractrepositoryfolder no additional properties. see also: connectapi.repositoryfolderitem connectapi.repositorygroupsummary a group summary. subclass of connectapi.abstractdirectoryentrysummary property name type description available version grouptype connectapi. type of group. values are: 39.0 contenthub • everybody—group is public to everybody. grouptype • everybodyindomain—group is public to everybody in the same domain. • unknown—group type is unknown. name string name of the group. 39.0 see also: connectapi.externalfilepermissioninformation connectapi.repositoryusersummary a user summary. subclass of connectapi.abstractdirectoryentrysummary property name type description available version firstname string first name of the user. 39.0 lastname string last name of the user. 39.0 connectapi.reputation reputation for a user. property name type description available version reputationlevel connectapi. user’s reputation level. 32.0 reputationlevel reputationpoints double user's reputation points, which can be earned by 32.0 performing different activities. 1935apex reference guide connectapi output classes property name type description available version url string connect rest api url to the reputation. 32.0 see also: connectapi.user connectapi.reputationlevel reputation level for a user. property name type description available version levelimageurl string url to the reputation level image. 32.0 levelname string name of the reputation level. 32.0 levelnumber integer reputation level number, which is the numerical rank 32.0 of the level, with the lowest level at 1. administrators define the reputation level point ranges. see also: connectapi" ".reputation connectapi.requestheader an http request header name and value pair. property name type description available version name string the name of the request header. 33.0 value string the value of the request header. 33.0 see also: connectapi.actionlinkdefinition connectapi.resourcelinksegment resource link segment. name type description available version url string url to a resource not otherwise identified by an id field, for example, 28.0 a link to a list of users. 1936apex reference guide connectapi output classes connectapi.returnitemsoutputrepresentation output of return items. includes the id of the generated change order for items and delivery charges being returned, as well as the id of the generated change order for any charged return fees. also includes information about any returnorderlineitems that were created to represent remaining return quantities. subclass of connectapi.baseoutputrepresentation. property name type description available version changeorderid string id of the change order created by processing the 52.0 returnorderlineitems representing returned items and delivery charges. use this change order to create a credit memo. feechangeorderid string id of the change order created by processing the 56.0 returnorderlineitems representing return fees. use this change order to create an invoice. returnlineitem list fees. each element of the list includes the id of a split returnorderlineitem and the id of the partially processed returnorderlineitem whose remaining quantity it holds. see also: returnitems(returnorderid, returnitemsinput) connectapi.returnorderitemsplitlineoutputrepresentation after a change order is created for a returnorderlineitem, that returnorderlineitem is read-only. if the return items api is used to return a partial quantity, it creates a new “split” returnorderlineitem to hold the remaining quantity to be returned. in that case, it returns this output property, which contains the ids of the original and split returnorderlineitems. subclass of connectapi.baseoutputrepresentation. property name type description available version newreturnorderitemid string id of the new returnorderlineitem that holds the 52.0 remaining return quantity. original string id of the original returnorderlineitem. 52.0 returnorderitemid see also: connectapi.returnitemsoutputrepresentation returnitems(returnorderid, returnitemsinput) 1937apex reference guide connectapi output classes connectapi.returnorderoutputrepresentation id of the created returnorder. subclass of connectapi.baseoutputrepresentation. property name type description available version returnorderid string id of the created returnorder. 50.0 see also: createreturnorder(returnorderinput) connectapi.saleresponse payment sale response. property name type description available version error connectapi. error representation for the payment sale. 54.0 errorresponse gatewayresponse connectapi. information from the payment gateway following 54.0 salegatewayresponse the sale request. payment connectapi. information about the payment used in the sale 54.0 paymentresponse request. paymentgatewaylogs list the sale request. paymentgroup connectapi. payment group used in the sale request. 54.0 paymentgroupresponse paymentmethod connectapi. payment method used in the sale request. 54.0 paymentmethodresponse connectapi.salegatewayresponse sale gateway response. subclass of connectapi.abstractgatewayresponse. no additional properties. connectapi.scheduledrecommendation represents a scheduled custom recommendation. 1938apex reference guide connectapi output classes property name type description available version channel connectapi. a way to tie custom recommendations together. for 36.0 recommendation example, display recommendations in specific places channel in the ui or show recommendations based on time of day or geographic locations. values are: • customchannel1—custom recommendation channel. not used by default. work with your community manager to define custom channels. for example, community managers can use experience builder to determine where recommendations appear. • customchannel2—custom recommendation channel. not used by default" ". work with your community manager to define custom channels. • customchannel3—custom recommendation channel. not used by default. work with your community manager to define custom channels. • customchannel4—custom recommendation channel. not used by default. work with your community manager to define custom channels. • customchannel5—custom recommendation channel. not used by default. work with your community manager to define custom channels. • defaultchannel—default recommendation channel. recommendations appear by default on the home and question detail pages of customer service and partner central experience builder templates. they also appear in the feed in the salesforce mobile web and anywhere community managers add recommendations using experience builder. enabled boolean indicates whether scheduling is enabled. if true, 35.0 the custom recommendation is enabled and appears in experience cloud sites. if false, custom recommendations in feeds in salesforce mobile web aren’t removed, but no new custom recommendations appear. in customer service and partner central sites, disabled custom recommendations no longer appear. id string 18-character id of the scheduled custom 35.0 recommendation. 1939apex reference guide connectapi output classes property name type description available version rank integer the rank determining the order of this scheduled 35.0 custom recommendation. recommendation string id of the audience for the scheduled custom 35.0 audienceid recommendation. recommendation connectapi. custom recommendation definition that this 35.0 definition recommendation scheduled recommendation schedules. representation definition url string url to the connect rest api resource for the 35.0 scheduled custom recommendation. see also: connectapi.scheduledrecommendationpage connectapi.scheduledrecommendationpage a list of scheduled custom recommendations. property name type description available version scheduled list url string url to the connect rest api resource for the 35.0 scheduled custom recommendation collection. connectapi.scope scope information for a target. property name type description available version name string name of the scope for the target. 48.0–49.0 value string value of the scope for the target. 48.0–49.0 see also: connectapi.target connectapi.searchcategory search category. 1940apex reference guide connectapi output classes property name type description available version category connectapi. information about the category. 52.0 productcategorydata children list with non-empty search results. productcount long number of products in the search results that belong 52.0 to the category. see also: connectapi.productsearchresults connectapi.searchfacet search facet. this class is abstract and is a superclass of connectapi.distinctvaluesearchfacet. property name type description available version attributetype connectapi. search attribute type. values are: 52.0 commercesearch • custom attributetype • productattribute • productcategory • standard displayname string display name of the facet. 52.0 displayrank integer display rank of the facet. valid values are from 1 52.0 through 50. displaytype connectapi. display type of the facet. values are: 52.0 commercesearchfacet • categorytree displaytype • datepicker • multiselect • singleselect facettype connectapi. search facet type. value is: 52.0 commercesearch • distinctvalue facettype nameorid string developer name of the attribute. in version 52.0 and 52.0 later, the id of the attribute isn’t supported. see also: connectapi.productsearchresults 1941apex reference guide connectapi output classes connectapi.searchsuggestion search suggestion. property name type description available version value string search suggestion. 52.0 see also: connectapi.productsearchsuggestionsresults connectapi.serviceappointmentoutput output of the create service appointment request. property name type description available version result connectapi.serviceappointmentresult result of the create or update service appointment 53.0 request. connectapi.serviceappointmentresult contains result of the service appointment. property name type description available version assignedresourceids list the ids" "of the assigned resources. 53.0 parentrecordid string the id of the parent record. 53.0 serviceappointmentid string the id of the service appointment record. 53.0 connectapi.shiftsfrompattern shifts created from a pattern. property name type description available version count integer total count of created shifts. 51.0 error connectapi.shifts error details for shifts from a pattern. 53.0 frompatternerror issuccess boolean indicates if the request is successful (true) or not 53.0 (false). recordids list collection of created shift ids. 51.0 1942apex reference guide connectapi output classes connectapi.shiftsfrompatternerror shifts from pattern error response. property name type description available version code string error code. 53.0 invalidservice string id of invalid service resource. 53.0 resourceid message string error message. 53.0 connectapi.sitesearchitem site search result item. property name type description available version contentreference string content reference field, which is the route developer 54.0 name for a site page or a content key for a content detail page. contenttype string developer name of the content type of the site search 54.0 developername result item. highlightedsnippet string text snippet that contains the query term. 54.0 id string id of the site search result item. 54.0 pagetype connectapi. type of site search result item. values are: 54.0 sitespagetype • contentpage • sitepage title string title of the site search result item. 54.0 see also: connectapi.sitesearchresult connectapi.sitesearchresult site search result. property name type description available version currentpagetoken string token for the current page of search results. 54.0 currentpageurl string url to the current page of search results. 54.0 items list 1943apex reference guide connectapi output classes property name type description available version language string language of the search results. 54.0 nextpagetoken string token for the next page of search results. 54.0 nextpageurl string url to the next page of search results, or null if 54.0 there isn’t a next page. pagesize integer number of items per page in search results. 54.0 previouspagetoken string token for the previous page of search results. 54.0 previouspageurl string url to the previous page of search results, or null 54.0 if there isn’t a previous page. totalitems integer total number of items in the search results across all 54.0 pages. connectapi.socialaccount a social account on a social network. property name type description available version externalsocial string id of the external social account, if available. 38.0 accountid handle string social handle, screen name, or alias that identifies 36.0 this account. name string name of the account as defined by the account's 36.0 owner. profileurl string url to the account's profile. 36.0 socialpersonaid string id of the social persona account, if the external social 39.0 account id isn’t available. see also: connectapi.socialpostcapability connectapi.socialaccountrelationship follow relationship between a managed social account and a social persona. property name type description available version isfollowed boolean specifies whether the social account is followed by 46.0 the social persona. isfollowing boolean specifies whether the social account is following the 46.0 social persona. 1944apex reference guide connectapi output classes property name type description available version socialaccountid string id of the social account. 46.0 socialpersonaid string id of the social persona. 46.0 connectapi.socialpostcapability if a feed element has this capability, it can interact with a social post on a social network. subclass of connectapi.feedelementcapabilities. property name type description available version author connectapi. social account that authored the social post. 36.0 socialaccount content string content body of the social post. 36.0 deletedby connectapi.user user who deleted the social post. 38.0 summary hiddenby connectapi.user user who hid the social post. 41.0 summary icon connectapi.icon icon of the social network. 36.0 id string id associated with the social" "post salesforce record. 36.0 isoutbound boolean if true, the social post originated from the 36.0 salesforce application. likedby string external social account who liked the social post. 40.0 messagetype connectapi. message type of the social post. values are: 38.0 socialpost • comment messagetype • direct • post • privatemessage • reply • retweet • tweet name string title or heading of the social post. 36.0 posturl string external url to the social post on the social network. 36.0 provider connectapi. social network that this social post belongs to. values 36.0 socialnetwork are: provider • facebook • googleplus • instagram 1945apex reference guide connectapi output classes property name type description available version • instagrambusiness • kakaotalk • kik • line • linkedin • messenger • other • pinterest • qq • rypple • sinaweibo • sms • snapchat • telegram • twitter • vkontakte • wechat • whatsapp • youtube recipient connectapi. social account that is the recipient of the social post. 36.0 socialaccount recipientid string id of the recipient of the social post. 38.0 reviewscale double review scale of the social post. 40.0 reviewscore double review score of the social post. 40.0 status connectapi. status of the social post. 36.0 socialpoststatus see also: connectapi.feedelementcapabilities connectapi.socialpostintents intents available for a social post. property name type description available version approvalintent connectapi. approval intent for the social post. 45.0 approvalintent 1946apex reference guide connectapi output classes property name type description available version deleteintent connectapi. delete intents for the social post. 45.0 deleteintents followintent connectapi. follow intents for the social persona. 45.0 followintents hideintent connectapi. hide intent for the social post. 45.0 hidesocial postintent likeintent connectapi. like intents for the social post. 45.0 likeintents replyintent connectapi. reply intents for the social post. 45.0 replyintents connectapi.socialpostmassapprovaloutput approval or rejection of a large number of social posts. property name type description available version isapproved boolean specifies whether the social posts were approved 46.0 (true) or rejected (false) for publishing. connectapi.socialpoststatus the status of a social post. property name type description available version message string status message. 36.0 1947apex reference guide connectapi output classes property name type description available version type connectapi. status type. values are: 36.0 socialpoststatustype • approvalpending • approvalrecalled • approvalrejected • deleted • failed • hidden • pending • sent • unknown see also: connectapi.socialpostcapability connectapi.stamp a user stamp. property name type description available version description string description of the stamp. 39.0–43.0 id string id of the stamp. 39.0–43.0 imageurl string image url of the stamp. 39.0–43.0 label string label of the stamp. 39.0–43.0 see also: connectapi.user connectapi.sortrule sort rule. property name type description available version direction connectapi. direction of the sort rule. values are: 52.0 commercesearch • ascending—sorts in ascending alphanumeric sortruledirection order (a–z, 0–9). • default—when no direction is defined, sorts by relevance. 1948apex reference guide connectapi output classes property name type description available version • descending—sorts in descending alphanumeric order (z–a, 9–0). label string label of the sort rule. 52.0 labelsuffix connectapi. label suffix of the sort rule.values are: 54.0 commercesearch • ascen—label suffix for 'asc' sortrulelabelsuffix • ascending—label suffix for 'ascending' • az—label suffix for 'a-z' • descen" "—label suffix for 'desc' • descending—label suffix for 'descending' • fewmany—label suffix for 'few-many' • heavylight—label suffix for 'heavy-light' • highlow—label suffix for 'high-low' • highestlowest—label suffix for 'highest-lowest' • lightheavy—label suffix for 'light-heavy' • lowhigh—label suffix for 'low-high' • lowesthighest—label suffix for 'lowest-highest' • manyfew—label suffix for 'many-few' • newold—label suffix for 'new-old' • newest—label suffix for 'newest' • newestoldest—label suffix for 'newest-oldest' • ninezero—label suffix for '9-0' • oldnew—label suffix for 'old-new' • oldest—label suffix for 'oldest' • oldestnewest—label suffix for 'oldest-newest' • pricedecreasing—label suffix for '$$-$' • priceincreasing—label suffix for '$-$$' • thickthin—label suffix for 'thick-thin' • thinthick—label suffix for 'thin-thick' • za—label suffix for 'z-a' • zeronine—label suffix for '0-9' nameorid string name of the sort rule field or, if the sort rule is based 52.0 on a custom field, id. 1949apex reference guide connectapi output classes property name type description available version sortorder integer sort order for the rule. a lower number has higher 54.0 precedence. the first sort option is called when no other option is selected. sortruleid string id of the sort rule. 52.0 type connectapi. type of sort rule. values are: 52.0 commercesearch • productattributebased—sorts by sortruletype product attribute fields. • productbased—sorts by product field data. • relevancy—sorts by product and catalog term frequency. • sortbypricebook—sorts by product prices defined in the specified pricebook (version 55.0 and later). see also: connectapi.sortrulescollection connectapi.sortrulescollection collection of sort rules. property name type description available version sortrules list connectapi.statuscapability if a feed post or comment has this capability, it has a status that determines its visibility. subclass of connectapi.feedelementcapability. property name type description available version feedentitystatus connectapi. status of the feed post or comment. values are: 37.0 feedentitystatus • draft—the feed post isn’t published but is visible to the author and users with modify all data or view all data permission. comments can’t be drafts. • pendingreview—the feed post or comment isn’t approved yet and therefore isn’t published or visible. 1950apex reference guide connectapi output classes property name type description available version • published—the feed post or comment is approved and visible. isapprovablebyme boolean specifies whether the context user can change the 37.0 status of the feed post or comment. see also: connectapi.commentcapabilities connectapi.feedelementcapabilities connectapi.strategytrace messages and trace nodes for a recommendation strategy execution. property name type description available version messages list messages and errors from the strategy execution. 45.0 nodes list see also: connectapi.nbarecommendations connectapi.strategytracenode a trace node for a recommendation strategy execution. property name type description available version inputcount integer number of items put into the node. 45.0 messages list messages that occurred during node execution. 45.0 nodename string name of the node. 45.0 nodetime long time spent processing inside the node. 45.0 nodetype string type of node. 45.0 outputcount integer number of items returned from the node. 45.0 outputs list recommendations that are returned from the node. 45.0 1951apex reference guide connectapi output classes" "property name type description available version totaltime long total time spent processing. 45.0 see also: connectapi.strategytrace connectapi.submitcanceloutputrepresentation id of the change order created for a cancel action, and a set of its financial values. subclass of connectapi.baseoutputrepresentation. property name type description available version changebalances connectapi. financial values resulting from the cancel. 48.0 changeitem outputrepresentation changeorderid string id of the change order created for the canceled order 48.0 items and shipping charges. use this change order to create a credit memo. feechangeorderid string id of the change order created by canceling order 57.0 items with associated cancel fees. use this change order to create an invoice. connectapi.submitreturnoutputrepresentation id of the change order created for a return action, and a set of its financial values. subclass of connectapi.baseoutputrepresentation. property name type description available version changebalances connectapi. financial values resulting from the return. 48.0 changeitem outputrepresentation changeorderid string id of the change order created for the returned order 48.0 items and shipping charges. use this change order to create a credit memo. feechangeorderid string id of the change order created by returning order 57.0 items with associated return fees. use this change order to create an invoice. connectapi.subscription subscription. 1952apex reference guide connectapi output classes name type description available version community connectapi.reference information about the experience cloud site in 28.0 which the subscription exists. id string subscription’s 18–character id. 28.0 subject connectapi.actor information about the parent, that is, the thing 28.0 or person being followed. subscriber connectapi.actor information about the subscriber, that is, the 28.0 person following this item. url string connect rest api url to this specific 28.0 subscription. see also: connectapi.followerpage connectapi.followingpage connectapi.supportedemojis a collection of supported emojis. property name type description available version supportedemojis connectapi.emojicollection a collection of supported emojis. 39.0 connectapi.surveyinvitationemailoutput survey invitation email. property name type description available version errorcode integer error code for the failed call. 50.0 errormessage string details explaining why the call failed. 50.0 status connectapi. status of a survey invitation email. values are: 50.0 surveyemailstatus • failed—the survey invitation email wasn't enum sent. • queued—the survey invitation email is queued for sending. connectapi.target personalization target information. 1953apex reference guide connectapi output classes property name type description available version audience connectapi. audience assigned to the target. 48.0 audiencetarget formulascope connectapi. formula scope of the target. 50.0 formulascope groupname string group name of the target. groups bundle related 48.0 target and audience pairs. id string id of the target. 48.0 priority integer priority of the target. within a group, priority 48.0 determines which target is returned if the user matches more than one audience. publishstatus connectapi. publish status of the target. values are: 48.0 publishstatus • draft • live scope list in version 50.0 and later, the formulascope property returns this information. targettype string type of target, indicating the nature of the data being 48.0 targeted. targetvalue string value of the target. 48.0 url string url to the target. 48.0 see also: connectapi.targetcollection connectapi.targetcollection list of personalization targets. property name type description available version targets list connectapi.calculatetaxresponse shows the results of a tax calculation request. subclass of connectapi.taxtransactionresponse. 1954apex reference guide connectapi output classes property name type description available version adaptererror connectapi. adapter error. 55.0 errorresponse" "status connectapi. status of a tax transaction. values are: 55.0 taxtransaction • committed—tax has been committed to the status transaction. • uncommitted—tax hasn’t been committed to the transaction. taxenginelogs list taxtransactiontype connectapi. type of tax transaction. values are: 55.0 taxtransaction • credit—transaction is a credit transaction. type • debit—transaction is a debit transaction. taxtype connectapi. type of tax calculation. values are: 55.0 calculatetaxtype • actual—calculated tax represents the final taxed amount for the transaction. • estimated—calculated tax represents only an estimated value before the transaction is finalized. connectapi.taxaddressresponse location code of an address. property name type description available version locationcode string location code of an address. 55.0 connectapi.taxaddressesresponse the ship from, ship to, and sold to addresses used during tax calculation. property name type description available version shipfrom connectapi. the ship from address used in tax calculation. 55.0 taxaddress response shipto connectapi. the ship to address used in tax calculation. 55.0 taxaddress response 1955apex reference guide connectapi output classes property name type description available version soldto connectapi. the sold to address used in tax calculation. 55.0 taxaddress response connectapi.taxamountdetailsresponse information about tax amount values on the line item. property name type description available version exemptamount double amount of the line item exempt from tax application. 55.0 taxamount double tax amount for the line item. 55.0 totalamount double total amount of the line item. 55.0 totalamountwithtax double the line item's total amount with tax. 55.0 connectapi.taxdetailsresponse tax details for each line item in a tax line item output. property name type description available version exemptamount double amount of the line item that is exempt from taxation. 55.0 exemptreason string the reason that any tax exemption applied to the 55.0 line item. imposition connectapi. the business justification for applying tax to a line 55.0 taximposition item. response jurisdiction connectapi. business address used to calculate the tax rate for the 55.0 taxjurisdiction line item. response rate double tax rate for the line item. 55.0 tax double total amount of tax on the line item. 55.0 taxid string id for the type of tax applied to the line item. 55.0 taxableamount double amount of line item that can be taxed. 55.0 connectapi.taxaddressresponse address output representation for tax calculation. 1956apex reference guide connectapi output classes property name type description available version locationcode string location code. 55.0 connectapi.taxenginelogresponse shows the results of the tax calculation request to the tax engine. property name type description available version createddate datetime the date that the gateway log was created. 55.0 id string id of the tax engine log record. 55.0 resultcode string result code sent from the external tax engine. review 55.0 the tax engine provider's documentation for more information about the code. connectapi.taximpositionresponse tax imposition output representation. property name type description available version name string name of the tax imposition. 55.0 type string type of the tax imposition. 55.0 connectapi.taxjurisdictionresponse represents the address or jurisdiction of the primary business used for calculating tax. property name type description available version country string country of the tax jurisdiction address. 55.0 id string id of the tax jurisdiction address. 55.0 level string level of the tax jurisdiction address. 55.0 name string name of the tax jurisdiction address. 55.0 region string region of the tax jurisdiction address. 55.0 stateassignedno string state-assigned number of the tax jurisdiction address. 55.0 connectapi.lineitemresponse response class that stores information about a list of one or more line items on which the tax engine has calculated tax. 1957apex reference guide connectapi output classes property name type description available version addresses connectapi. the ship from, ship to, and sold to addresses used 55.0 taxaddresses during tax calculation. response amountdetails connectapi. information" "about tax amount values on the line item. 55.0 taxamount detailsresponse effectivedate datetime the date that the tax calculation takes effect. 55.0 linenumber string system-generated number used to identify the tax 55.0 line. productcode string product code for the product related to the taxed 55.0 line item. quantity double quantity of the taxed line item. 55.0 taxcode string tax code for the taxed line item. 55.0 taxes list connectapi.taxtransactionresponse tax transaction output representation this class is abstract. superclass of connectapi.calculatetaxresponse property name type description available version addresses connectapi. the ship from, ship to, and sold to addresses used 55.0 taxaddresses during tax calculation. response amountdetails connectapi. information about tax amount values on the line item. 55.0 taxamount detailsresponse currencyisocode string three-letter iso 4217 currency code associated with 55.0 the payment group record. description string information about whether the tax transaction failed 55.0 or was successful. documentcode string document code. 55.0 effectivedate datetime the date that tax is applied to the taxed entity. 55.0 1958apex reference guide connectapi output classes property name type description available version lineitems list referencedocumentcode string the original document code. used in case of 55.0 subsequent transactions such as credit tax. referenceentityid string id of the reference entity used during tax calculation. 55.0 taxtransactionid string id of the tax transaction. 55.0 transactiondate datetime the date that the tax transaction occurred. 55.0 connectapi.textsegment text segment. subclass of connectapi.messagesegment. no additional properties. connectapi.timezone user's time zone as selected in the user’s personal settings in salesforce. this value doesn’t reflect a device's current location. name type description available version gmtoffset double signed offset, in hours, from gmt. 30.0 name string display name of this time zone. 30.0 see also: connectapi.usersettings connectapi.topic topic. name type description available version createddate datetime iso 8601 date string, for example, 2011-02-25t18:24:31.000z. 29.0 description string description of the topic. 29.0 id string 18-character id. 29.0 images connectapi. images associated with the topic. 32.0 topicimages 1959apex reference guide connectapi output classes name type description available version isbeingdeleted boolean true if the topic is currently being deleted; false otherwise. 33.0 after the topic is deleted, when attempting to retrieve the topic, the output is not_found. name string name of the topic. 29.0 nonlocalized string non-localized name of the topic. 36.0 name talkingabout integer number of people talking about this topic over the last two months, 29.0 based on factors such as topic additions and comments on posts with the topic. url string url to the topic detail page. 29.0 see also: connectapi.managedtopic connectapi.topicpage connectapi.topicendorsement. connectapi.topicendorsementcollection connectapi.topicsuggestion connectapi.topicscapability connectapi.topicendorsement. represents one user endorsing another user for a single topic. name type description available version endorsee connectapi.user user being endorsed. 30.0 summary endorsementid string 18-character id of the endorsement record. 30.0 endorser connectapi.user user performing the endorsement. 30.0 summary topic connectapi.topic topic the user is being endorsed for. 30.0 url string url to the resource for the endorsement record. 30.0 connectapi.topicendorsementcollection collection of topic endorsement response bodies. 1960apex reference guide connectapi output classes name type description available version currentpageurl string connect rest api url identifying the current page. 30.0 nextpageurl string connect rest api url identifying the next page, or null if 30.0 there isn’t a next page. pre" "viouspageurl string connect rest api url identifying the previous page, or null 30.0 if there isn’t a previous page. topicendorsements list connectapi.topicendorsementsummary topic endorsement summary. subclass of connectapi.useractivitysummary. property name type description available version endorsementid id id of the topic endorsement. 42.0 connectapi.topicimages. images associated with a topic. property name type description available version coverimageurl string url to a topic’s cover image, which appears on the 32.0 topic page. both topics and managed topics can have cover images. featuredimageurl string url to a managed topic’s featured image, which 32.0 appears wherever you feature it, for example, on your experience cloud site home page. see also: connectapi.topic connectapi.topicpage page of topics. name type description available version currentpageurl string connect rest api url identifying the current page. 29.0 1961apex reference guide connectapi output classes name type description available version nextpageurl string connect rest api url identifying the next page, or null 29.0 if there isn’t a next page. topics list connectapi.topicscapability if a feed element has this capability, the context user can add topics to it. topics help users organize and discover conversations. subclass of connectapi.feedelementcapability. property name type description available version canassigntopics boolean true if a topic can be assigned to the feed element, 32.0 false otherwise. items list element. see also: connectapi.feedelementcapabilities connectapi.topicsuggestion topic suggestion. name type description available version existingtopic connectapi.topic topic that already exists or null for a new topic 29.0 name string topic name 29.0 see also: connectapi.topicsuggestionpage connectapi.topicsuggestionpage page of topic suggestions. name type description available version topicsuggestions list 1962apex reference guide connectapi output classes connectapi.topicsummary summary of a topic. property name type description available version id string id of the topic. 47.0 name string name of the topic. 47.0 see also: connectapi.managedcontentassociations connectapi.trackedchangebundlecapability if a feed element has this capability, it has a group of other feed elements aggregated into one feed element called a bundle. this type of bundle aggregates feed tracked changes. subclass of connectapi.bundlecapability. property name type description available version changes list connectapi.trackedchangeitem tracked change item. name type description available version fieldname string the name of the field that was updated. 28.0 newvalue string the new value of the field or null if the field length is long. 28.0 oldvalue string the old value of the field or null if the field length is long. 28.0 see also: connectapi.trackedchangescapability connectapi.trackedchangebundlecapability connectapi.trackedchangescapability if a feed element has this capability, it contains all changes to a record for a single tracked change event. subclass of connectapi.feedelementcapability. 1963apex reference guide connectapi output classes property name type description available version changes list see also: connectapi.feedelementcapabilities connectapi.unauthenticateduser unauthenticated user. subclass of connectapi.actor. no additional properties. instances of this class are used as the actor for feed items and comments posted by chatter customers. connectapi.unreadconversationcount unread count for a conversation. name type description available version hasmore boolean specifies if there are more than 50 unread 29.0 messages (true) or not (false). unreadcount integer the total number of unread messages" ". 29.0 connectapi.updownvotecapability if a feed post or comment has this capability, users can upvote or downvote it. subclass of connectapi.feedelementcapability. property name type description available version downvotecount long number of downvotes. 41.0 myvote connectapi. specifies the context user’s vote. values are: 41.0 updownvotevalue • down • none • up 1964apex reference guide connectapi output classes property name type description available version upvotecount long number of upvotes. 41.0 see also: connectapi.commentcapabilities connectapi.feedelementcapabilities connectapi.upvotesummary summary of an upvote. subclass of connectapi.userfeedentityactivitysummary no additional properties. connectapi.user user. this class is abstract. subclass of connectapi.actionwithid. superclass of: • connectapi.userdetail • connectapi.usersummary name type description available version additional string if one exists, an extra label for the user, for example, 30.0 label “customer,” “partner,” or “acme corporation.” communitynickname string user’s nickname in the site. 32.0 companyname string name of the company. 28.0 if your experience cloud site allows access without logging in, the value is null for guest users. displayname string user’s name that is displayed in the site. if nicknames 32.0 are enabled, the nickname is displayed. if nicknames aren’t enabled, the full name is displayed. firstname string user's first name. in version 39.0 and later, if nicknames 28.0 are enabled, firstname is null. ischatterguest boolean true if user is a chatter customer; false otherwise. 28.0 isinthiscommunity boolean true if user is in the same site as the context user; 28.0 false otherwise. lastname string user's last name. in version 39.0 and later, if nicknames 28.0 are enabled, lastname is null. 1965apex reference guide connectapi output classes name type description available version outofoffice connectapi. if one exists, extra out-of-office message for the user. 40.0 outofoffice photo connectapi.photo information about the user's photos. 28.0 reputation connectapi.reputation reputation of the user. 32.0 stamps list collection of the user’s stamps. 39.0–43.0 in version 44.0 and later, use soql to get a user’s stamps. title string user’s title. 28.0 if your experience cloud site allows access without logging in, the value is null for guest users. usertype connectapi.usertype type of user. 28.0 enum • chatterguest—user is an external user in a private group. • chatteronly—user is a chatter free customer. • guest—user is unauthenticated. • internal—user is a standard org member. • portal—user is an external user in an experience cloud site. • system—user is chatter expert or a system user. • undefined—user is a user type that is a custom object. see also: connectapi.recommendationaudience connectapi.useractivitiesjob user activities job. property name type description available version jobtoken string token that identifies the user activities job. 42.0 jobtype string type of user activities job. value is export or 42.0 purge. 1966apex reference guide connectapi output classes property name type description available version message string message describing the status and expected outcome 42.0 of the job. when the job completes, you receive an email with information about the salesforce file that contains connectapi.useractivitycollection. connectapi.useractivitycollection user activity collection. property name type description available version activitytype string type of user activity. values are: 42.0 • bookmark—user bookmarked a post. • chatteractivity—total counts of posts and comments made and likes and comments received for a user. • chatterlike—user liked a post or comment. • comment—user commented on a post. • companyverify—user verified comment." "• downvote—user downvoted a post or comment. • feedentityread—user read a post. • feedread—user read a feed. • mute—user muted a post. • post—user made a post. • topicendorsement—user endorsed another user on a topic or received endorsement on a topic. • upvote—user upvoted a post or comment. useractivities list connectapi.useractivitysummary user activity summary. this class is abstract. superclass of: • connectapi.commentsummary 1967apex reference guide connectapi output classes • connectapi.feedpostsummary • connectapi.feedreadsummary • connectapi.topicendorsementsummary • connectapi.userfeedentityactivitysummary property name type description available version activitydate datetime date of the user activity. 42.0 activitytype string type of user activity. values are: 42.0 • bookmark—user bookmarked a post. • chatteractivity—total counts of posts and comments made and likes and comments received for a user. • chatterlike—user liked a post or comment. • comment—user commented on a post. • companyverify—user verified comment. • downvote—user downvoted a post or comment. • feedentityread—user read a post. • feedread—user read a feed. • mute—user muted a post. • post—user made a post. • topicendorsement—user endorsed another user on a topic or received endorsement on a topic. • upvote—user upvoted a post or comment. activityurl string url to the user activity. 42.0 community connectapi. experience cloud site in which the user performed 42.0 communitysummary the activity. see also: connectapi.useractivitycollection connectapi.usercapabilities capabilities associated with a user profile. name type description available version canchat boolean specifies if the context user can use chatter messenger with the 29.0 subject user (true) or not (false) 1968apex reference guide connectapi output classes name type description available version candirectmessage boolean specifies if the context user can direct message the subject user 29.0 (true) or not (false) canedit boolean specifies if the context user can edit the subject user’s account 29.0 (true) or not (false) canfollow boolean specifies if the context user can follow the subject user’s feed (true) 29.0 or not (false) canviewfeed boolean specifies if the context user can view the feed of the subject user 29.0 (true) or not (false) canviewfullprofile boolean specifies if the context user can view the full profile of the subject 29.0 user (true) or only the limited profile (false) ismoderator boolean specifies if the subject user is a chatter moderator or admin (true) 29.0 or not (false) see also: connectapi.userprofile connectapi.userchattersettings user’s global chatter settings. name type description available version defaultgroup connectapi.groupemail the default frequency with which a user receives email 28.0 emailfrequency frequency enum from a group when they join it. connectapi.userdetail details about a user in an org. subclass of connectapi.user. if the context user doesn’t have permission to see a property, its value is set to null. name type description available version aboutme string text from user's profile. 28.0 address connectapi.address user’s address. 28.0 bannerphoto connectapi. user’s banner photo. 36.0 bannerphoto 1969apex reference guide connectapi output classes name type description available version chatteractivity connectapi.chatter chatter activity statistics. 28.0 activity chatterinfluence connectapi.global user’s influence rank. 28.0 influence email string user's email address. 28.0 followerscount integer number of users following this user. 28.0 followingcounts connectapi.following information about items the user is following. 28.0 counts groupcount integer number of groups user is following. 28.0 haschatter boolean true if user has access to chatter" "; false otherwise. 31.0 isactive boolean true if user is active; false otherwise. 28.0 managerid string 18-character id of the user’s manager. 28.0 managername string locale-based concatenation of manager's first and last 28.0 names. phonenumbers list thanksreceived integer the number of times the user has been thanked. 29.0 username string username of the user, such as 28.0 admin@mycompany.com. see also: connectapi.userpage connectapi.userprofile connectapi.userfeedentityactivitysummary user feed entity activity summary. this class is abstract. subclass of connectapi.useractivitysummary superclass of: • connectapi.bookmarksummary • connectapi.chatteractivitysummary • connectapi.companyverifysummary • connectapi.downvotesummary • connectapi.feedentityreadsummary 1970apex reference guide connectapi output classes • connectapi.likesummary • connectapi.mutesummary • connectapi.upvotesummary property name type description available version feedentityid string id of the feed entity. 42.0 connectapi.usergroupdetailpage a page of groups that a user is a member of. property name type description available version currentpageurl string url to the current page. 45.0 groups list nextpageurl string url to the next page, or null if there is no next 45.0 page. previouspageurl string url to the previous page, or null if there is no 45.0 previous page. total integer total number of groups that the user is a member 45.0 of. connectapi.usergrouppage a paginated list of groups the context user is a member of. name type description available version currentpageurl string connect rest api url identifying the current page. 28.0 groups list nextpageurl string connect rest api url identifying the next page, or null 28.0 if there isn’t a next page. previouspageurl string connect rest api url identifying the previous page, or 28.0 null if there isn’t a previous page. total integer total number of groups across all pages. 28.0 1971apex reference guide connectapi output classes connectapi.usermission mission details for a user. subclass of connectapi.abstractusermissionactivity. property name type description available version missionname string name of the mission. 46.0 missionthreshold integer threshold of the mission. when a user reaches this 46.0 activity count, the mission is achieved. connectapi.usermissionactivitiesjob user mission activities job. property name type description available version jobtoken string token that identifies the mission user activities job. 45.0 jobtype string type of user activities job, either export or 45.0 purge. message string message describing the status and expected outcome 45.0 of the job. when the job completes, you receive an email with information about the salesforce file that contains connectapi.usermissionactivitycollection. connectapi.usermissionactivity user activity associated with missions. subclass of connectapi.abstractusermissionactivity. no additional properties. connectapi.usermissionactivitycollection list of mission activities for a user. property name type description available version community connectapi. experience cloud site in which the user performed 45.0 communitysummary activities. userid string id of the user. 45.0 usermission list 1972apex reference guide connectapi output classes property name type description available version username string name of the user. 45.0 see also: connectapi.usermissionactivitiesjob connectapi.usermissionactivitystatus status of mission activity for a user. property name type description available version message string success or error message. 45.0 status string status of mission activity for a user. 45.0 connectapi.useroauthinfo name type description available version availableexternal connect.oauth the available oauth service provider. 37.0 emailservice providerinfo isauthent" "icated boolean specifies whether the user is authenticated (true) or not (false). 37.0 connectapi.userpage page of users. name type description available version currentpagetoken integer token identifying the current page. 28.0 currentpageurl string connect rest api url identifying the current page. 28.0 nextpagetoken integer token identifying the next page, or null if there isn’t a next 28.0 page. nextpageurl string connect rest api url identifying the next page, or null if 28.0 there isn’t a next page. previouspagetoken integer token identifying the previous page, or null if there isn’t 28.0 a previous page. previouspageurl string connect rest api url identifying the previous page, or 28.0 null if there isn’t a previous page. 1973apex reference guide connectapi output classes name type description available version users list permission to see a property, the property is set to null. connectapi.userprofile details necessary to render a view of a user profile. name type description available version capabilities connectapi.usercapabilities the context user’s capabilities specific to the 29.0 subject user’s profile. id string the id of the user attached to the profile. 29.0 tabs list the tabs visible to the context user specific to the 29.0 subject user’s profile. url string the url of the user’s profile. 29.0 userdetail connectapi.userdetail the details about the user attached to the profile. 29.0 connectapi.userprofiletab information about a profile tab. name type descriptio available version id string the tab’s unique identifier or 18–character id 29.0 isdefault boolean specifies if the tab appears first when clicking the 29.0 user profile (true) or not (false) tabtype connectapi.userprofile specifies the type of tab 29.0 tabtype enum • customvisualforce—tab that displays data from a visualforce page. • customweb—tab that displays data from any external web-based application or web page. • element—tab that displays generic content inline. • feed—tab that displays the chatter feed. • overview—tab that displays user details. 1974apex reference guide connectapi output classes name type descriptio available version taburl string the current tab’s content url (for non built-in 29.0 tab types) see also: connectapi.userprofile connectapi.userreferencepage a list of user references. property name type description available version currentpageurl string url to the current page. 35.0 nextpageurl string url to the next page. 35.0 previouspageurl string url to the previous page. 35.0 usercount integer number of users in the collection. 35.0 users list see also: connectapi.customlistaudiencecriteria connectapi.usersettings settings specific to a user. property type description available version approvalposts boolean user can approve workflows from chatter posts. 28.0 canaccess boolean user can access personal stream feeds. 40.0 personalstreams canfollow boolean user can follow users and records. 28.0 canmodify boolean user has modify all data permission. 28.0 alldata canowngroups boolean user can own groups. 28.0 canviewalldata boolean user has view all data permission. 28.0 canviewallgroups boolean user has view all groups permission. 28.0 1975apex reference guide connectapi output classes property type description available version canviewallusers boolean user has view all users permission. 28.0 canviewcommunity boolean user can see the site switcher menu. 34.0 switcher canviewfull boolean user can see other user’s chatter profile. 28.0 userprofile canviewpublicfiles boolean user can see all files that are public. 28.0 currencysymbol string currency symbol to use for displaying currency values. applicable only when 28.0 the connectapi.features.multicurrency property is false. externaluser boolean user is a chatter customer. 28.0 filesynclimit integer maximum number of files user can" "sync. 32.0 filesync integer maximum storage for synced files, in megabytes (mb). 29.0 storagelimit foldersync integer maximum number of folders user can sync. 32.0 limit hasaccessto boolean user is a member of the internal org. 28.0 internalorg haschatter boolean user has access to chatter. 31.0 hasfilesync boolean user has sync files permission. 28.0 hasfieldservice boolean user has field service gps tracking enabled. 41.0 locationtracking hasfieldservice boolean user has access to the field service mobile app. 41.0 mobileaccess hasfilesync boolean administrator for the user’s org allows file sync clients to update automatically. 34.0 managedclient autoupdate hasrestdata boolean user has access to rest api. 29.0 apiaccess timezone connectapi. the user's time zone as selected in the user’s personal settings in salesforce. 30.0 timezone this value does not reflect a device's current location. userdefault string the iso code for the default currency. applicable only when the 28.0 currencyisocode connectapi.features.multicurrency property is true. userid string 18-character id of the user. 28.0 1976apex reference guide connectapi output classes property type description available version userlocale string locale of user. 28.0 see also: connectapi.organizationsettings connectapi.usersummary user summary. subclass of connectapi.user. name type description available version isactive boolean true if user is active; false otherwise. 28.0 see also: connectapi.chatterconversation connectapi.chatterconversationsummary connectapi.chattergroup connectapi.chatterlike connectapi.dashboardcomponentsnapshot connectapi.directmessagememberpage connectapi.groupmembershiprequest connectapi.groupmember connectapi.feedfavorite connectapi.origincapability connectapi.platformaction connectapi.directmessagememberpage connectapi.directmessagememberactivity connectapi.chattermessage connectapi.comment connectapi.file connectapi.mentionsegment connectapi.questionandanswerscapability connectapi.socialpostcapability connectapi.topicendorsement. 1977apex reference guide connectapi output classes connectapi.verifiedcapability if a comment has this capability, users with permission can mark it as verified or unverified. subclass of connectapi.feedelementcapability. property name type description available version isverifiablebyme boolean specifies whether the context user has permission 41.0 to mark comments as verified or unverified (true) or not (false). isverified boolean specifies whether the comment is marked as verified 41.0 (true) or not (false). isverifiedby boolean specifies whether the comment is marked as verified 43.0 anonymized by an anonymous user (true) or not (false).if the comment has never been marked as verified or unverified, null.also null if the context user doesn’t have permission to mark comments as verified or unverified. lastverifiedbyuser connectapi.user user who last marked the comment as verified or 41.0 summary unverified, otherwise null. also null if the context user doesn’t have permission to mark comments as verified or unverified. lastverifieddate datetime date when the comment was last marked as verified 41.0 or unverified, otherwise null. also null if the context user doesn’t have permission to mark comments as verified or unverified. see also: connectapi.commentcapabilities connectapi.vote an upvote or downvote on a feed element or comment. property name type description available version type connectapi. type of vote for a feed element or comment. 42.0 updownvotevalue • down • up user connectapi. user who voted on the feed element or comment. 42.0 usersummary 1978apex reference guide connectapi output classes property name type description available version voteditem connectapi. reference to the feed element or comment that was 42.0 reference voted on. see also: connectapi.votepage connectapi.votepage a page of upvotes or downvotes on a feed element or comment. property name type description available version currentpagetoken integer" "token identifying the current page. 42.0 currentpageurl string connect rest api url identifying the current page. 42.0 items list upvotes include likes and upvotes. for example, if a post receives five likes and three upvotes, the number of upvotes is eight. for this reason, the collection of users and their upvotes also includes users who liked the post or comment. if a user both liked and upvoted a post, they appear only once in the collection. nextpagetoken integer token identifying the next page, or null if there 42.0 isn’t a next page. nextpageurl string connect rest api url identifying the next page, or 42.0 null if there isn’t a next page. previouspagetoken integer token identifying the previous page, or null if 42.0 there isn’t a previous page. previouspageurl string connect rest api url identifying the previous page, 42.0 or null if there isn’t a previous page. total long total number of upvotes or downvotes for the feed 42.0 element or comment. the number of upvotes includes the number of likes and upvotes. for example, if a post receives five likes and three upvotes, the total number of upvotes is eight. if a user both liked and upvoted a post, we count that as two upvotes. connectapi.wishlist wishlist, including summary and items. 1979apex reference guide connectapi output classes property name type description available version page connectapi. page of wishlist items. 49.0 wishlistitem collection summary connectapi. summary of the wishlist. 49.0 wishlistsummary see also: connectapi.wishlistssummary connectapi.wishlistitem item in a wishlist. property name type description available version currencyisocode string three-letter iso 4217 currency code associated with 49.0 the product. error connectapi. error information. 49.0 errorresponse listprice double list price of the wishlist item. 49.0 productsummary connectapi. product summary for the wishlist item. 49.0 cartitemproduct salesprice double sales price of the wishlist item. 49.0 wishlistitemid string id of the wishlist item. 49.0 see also: connectapi.wishlistitemcollection connectapi.wishlistitemcollection collection of wishlist items. property name type description available version currencyisocode string three-letter iso 4217 currency code associated with 49.0 the product. currentpagetoken string token identifying the current page. 49.0 currentpageurl string connect rest api url identifying the current page. 49.0 haserrors boolean specifies whether at least one of the results contains 49.0 an error (true) or not (false). 1980apex reference guide connectapi output classes property name type description available version items list nextpagetoken string token identifying the next page, or null if there 49.0 isn’t a next page. nextpageurl string connect rest api url identifying the next page, or 49.0 null if there isn’t a next page. previouspagetoken string token identifying the previous page, or null if 49.0 there isn’t a previous page. previouspageurl string connect rest api url identifying the previous page, 49.0 or null if there isn’t a previous page. see also: connectapi.wishlist connectapi.wishlistssummary list of wishlist summaries and the displayed list for the context user. property name type description available version displayedlist connectapi. oldest wishlist displayed for the context user. 49.0 wishlist summaries list wishlistcount integer total number of wishlists belonging to the context 49.0 user. connectapi.wishlistsummary summary of a wishlist. property name type description available version createddate datetime created date for the wishlist in iso 8601 format, for 49.0 example, 2011-02-25t18:24:31.000z. id string id of the wishlist. 49.0" "modifieddate datetime last modified date of the wishlist in iso 8601 format, 49.0 for example, 2011-02-25t18:24:31.000z. name string name of the wishlist. 49.0 1981apex reference guide connectapi output classes property name type description available version wishlistproductcount integer unique product count in the wishlist. 49.0 see also: connectapi.wishlist connectapi.wishlistssummary connectapi.wishlisttocartresult result of adding a wishlist to a cart. property name type description available version cartid string id of the cart to which the products were added. 49.0 failedwishlist list cart. productsfailed integer total number of products that weren’t added to the 49.0 count cart. productsrequested integer total number of products requested to add to the 49.0 count cart. productssucceeded integer total number of products that were successfully 49.0 count added to the cart. succeededwishlist list cart. connectapi.zone information about a chatter answers zone. name type description available version description string the description of the zone. 29.0 id string the zone id. 29.0 isactive boolean indicates whether or not the zone is active. 29.0 ischatteranswers boolean indicates whether or not the zone is available for 29.0 chatter answers. name string name of the zone. 29.0 url string the url of the zone. 30.0 1982" "apex reference guide connectapi output classes name type description available version visibility connectapi.zoneshowin zone visibility type. 29.0 • community—available in an experience cloud site. • internal—available internally only. • portal—available in a portal. visibilityid string if the zone is available in a site, this property 29.0 contains the id of the site. if the zone is available to all sites, this property contains the value all. see also: connectapi.zonepage connectapi.zonepage page of zones. name type description available version zones list a list of one or more zones. 29.0 currentpageurl string connect rest api url identifying the current 29.0 page. nextpageurl string connect rest api url identifying the next page, 29.0 or null if there isn’t a next page. connectapi.zonesearchpage page of zone search results. name type description available version currentpagetoken string token identifying the current page. 29.0 currentpageurl string connect rest api url identifying the current 29.0 page. items list list of search results. 29.0 nextpagetoken string token identifying the next page, or null if there 29.0 isn’t a next page. nextpageurl string connect rest api url identifying the next page, 29.0 or null if there isn’t a next page. 1983apex reference guide connectapi output classes connectapi.zonesearchresult information about a specific zone search result. name type description available version hasbestanswer boolean indicates if the search result has a best answer. 29.0 id string id of the search result. the search result can be a 29.0 question or an article. title string title of the search result. 29.0 type connectapi.zonesearch specifies the zone search result type. 29.0 resulttype enum • article—search results contain only articles. • question—search results contain only questions. votecount string number of votes given to the search result. 29.0 see also: connectapi.zonesearchpage retired connectapi output classes these connectapi output classes are retired. in this section: connectapi.approvalattachment attach an approval to a feed item. connectapi.basictemplateattachment attachments in feed items with type basictemplate. connectapi.canvastemplateattachment attachments in feed items with type canvaspost. connectapi.casecomment attachments in feed items with type casecommentpost. connectapi.contentattachment attachments in feed items with the type contentpost. connectapi.dashboardcomponentattachment attachments in feed items with type dashboardsnapshot. connectapi.datacloudcompany information about a data.com company. 1984apex reference guide connectapi output classes connectapi.datacloudcompanies lists all companies that were purchased in a specific order, page urls, and the number of companies in the order. connectapi.datacloudcontact information about a data.com contact. connectapi.datacloudcontacts lists all contacts that were purchased in the specific order, page urls, and the number of contacts in the order. connectapi.datacloudorder represents a datacloud order. connectapi.datacloudpurchaseusage information about data.com point usage for monthly and list pool users. connectapi.emailmessage email message from a case. connectapi.feeditemattachment feed item attachment. connectapi.feeditempage a paged collection of connectapi.feeditem objects. connectapi.feeditemtopicpage feed item topic page. connectapi.feedpoll attachment of connectapi.feeditem objects where the type property is pollpost. connectapi.linkattachment link attached to a feed item. connectapi.nonentityrecommendation a recommendation for a non-salesforce entity, such as an application. connectapi.recordsnapshotattachment fields of a record at the point in time when the record was created. connectapi.trackedchangeattachment tracked change attachment to a feed item. connectapi.approvalattachment attach an approval to a feed item. important: this class isn’t available in version 32.0 and" "later. in version 32.0 and later, connectapi.approvalcapability is used. subclass of connectapi.feeditemattachment name type description available version id string a work item id. 28.0–31.0 posttemplatefields list collection of approval post template fields 28.0–31.0 1985apex reference guide connectapi output classes name type description available version process string an approval step id. 30.0–31.0 instancestepid status connectapi. status of a workflow process. 28.0–31.0 workflowprocess • approved status enum • fault • held • noresponse • pending • reassigned • rejected • removed • started connectapi.basictemplateattachment attachments in feed items with type basictemplate. important: this class isn’t available in version 32.0 and later. in version 32.0 and later, connectapi.enhancedlinkcapability is used. subclass of connectapi.feeditemattachment property type description available version description string an optional description with a 500 character limit. 28.0–31.0 icon connectapi.icon an optional icon. 28.0–31.0 linkrecordid string if linkurl refers to a salesforce record, linkrecordid 28.0–31.0 contains the id of the record. linkurl string an optional url to a detail page if there is more content that 28.0–31.0 can’t be displayed inline. do not specify linkurl unless you specify a title. title string an optional title to the detail page. if linkurl is specified, the 28.0–31.0 title links to linkurl. connectapi.canvastemplateattachment attachments in feed items with type canvaspost. important: this class isn’t available in version 32.0 and later. in version 32.0 and later, connectapi.canvascapability is used. subclass of connectapi.feeditemattachment 1986apex reference guide connectapi output classes property type description available version description string optional. description of the canvas app. the maximum length of this 29.0–31.0 field is 500 characters. developername string specifies the developer name (api name) of the canvas app. 29.0–31.0 height string optional. the height of the canvas app in pixels. default height is 200 29.0–31.0 pixels. icon connectapi.icon the canvas app icon. 29.0–31.0 namespaceprefix string optional. the namespace prefix of the developer edition organization 29.0–31.0 in which the canvas app was created. parameters string optional. parameters passed to the canvas app in json format. example: 29.0–31.0 {'isupdated'='true'} thumbnailurl string optional. a url to a thumbnail image for the canvas app. maximum 29.0–31.0 dimensions are 120x120 pixels. title string specifies the title of the link used to call the canvas app. 29.0–31.0 connectapi.casecomment attachments in feed items with type casecommentpost. important: this class isn’t available in version 32.0 and later. in version 32.0 and later, connectapi.casecommentcapability is used. subclass of connectapi.feeditemattachment name type description available version actortype connectapi. type of user who made the comment. 28.0–31.0 caseactortype • customer—if a chatter customer made the comment enum • customerservice—if a service representative made the comment createdby connectapi. comment’s creator 28.0–31.0 user summary createddate datetime iso 8601 date string, for example, 2011-02-25t18:24:31.000z 28.0–31.0 id string comment’s 18–character id 28.0–31.0 published boolean specifies whether the comment has been published 28.0–31.0 text string comment’s text 28.0–31.0 1987apex reference guide connectapi output classes connectapi.contentattachment attachments in feed items with the type contentpost. important: this class isn’t available in version 32.0 and later. in version 32." "0 and later, connectapi.contentcapability is used. subclass of connectapi.feeditemattachment name type description available version checksum string md5 checksum for the file. 28.0–31.0 contenturl string url for link files and google docs; otherwise the value is null. 31.0–31.0 description string description of the attachment. 28.0–31.0 downloadurl string file’s url. this value is null if the content is a link or a google doc. 28.0–31.0 fileextension string file’s extension. 28.0–31.0 filesize string size of the file in bytes. if size cannot be determined, returns 28.0–31.0 unknown. filetype string type of file. 28.0–31.0 hasimagepreview boolean true if the file has a preview image available, otherwise ,false. 28.0–29.0 haspdfpreview boolean true if the file has a pdf preview available, otherwise, false. 28.0–31.0 id string content’s 18-character id. 28.0–31.0 isinmyfilesync boolean true if the file is synced with salesforce files sync; false otherwise. 28.0–31.0 note: salesforce files sync was retired on may 25, 2018. mimetype string file’s mime type. 28.0–31.0 renditionurl string url to the file’s rendition resource. 28.0–31.0 renditionurl string url to the 240 x 180 rendition resource for the file.for shared files, 30.0–31.0 240by180 renditions process asynchronously after upload. for private files, renditions process when the first file preview is requested, and aren’t available immediately after the file is uploaded. renditionurl string url to the 720 x 480 rendition resource for the file.for shared files, 30.0–31.0 720by480 renditions process asynchronously after upload. for private files, renditions process when the first file preview is requested, and aren’t available immediately after the file is uploaded. textpreview string text preview of the file if available; null otherwise. 30.0–31.0 thumb120by90 string specifies the rendering status of the 120 x 90 preview image of the 30.0–31.0 renditionstatus file. one of these values: • processing—image is being rendered. • failed—rendering process failed. • success—rendering process was successful. 1988apex reference guide connectapi output classes name type description available version • na—rendering is not available for this image. thumb240by180 string specifies the rendering status of the 240 x 180 preview image of the 30.0–31.0 renditionstatus file. one of these values: • processing—image is being rendered. • failed—rendering process failed. • success—rendering process was successful. • na—rendering is not available for this image. thumb720by480 string specifies the rendering status of the 720 x 480 preview image of the 30.0–31.0 renditionstatus file. one of these values: • processing—image is being rendered. • failed—rendering process failed. • success—rendering process was successful. • na—rendering is not available for this image. title string title of the file. 28.0–31.0 versionid string 18-character id for this version of the content. 28.0–31.0 connectapi.dashboardcomponentattachment attachments in feed items with type dashboardsnapshot. important: this class isn’t available in version 32.0 and later. in version 32.0 and later, connectapi.dashboardcomponent snapshotcapability is used. subclass of connectapi.feeditemattachment name type description available version componentid string component’s 18–character id. 28.0–31.0 componentname string name of the component. if no name is saved with the component, 28.0–31.0 returns the localized string, “untitled component.”. dashboardbodytext string text displayed next to the actor in the body of a feed item. this is used 28.0–31.0 instead of the default body text. if no text is specified, and there is no default body text, returns null. dashboardid string dashboard’s" "18–character id. 28.0–31.0 dashboardname string name of the dashboard. 28.0–31.0 fullsizeimageurl string url of the full-sized dashboard image. 28.0–31.0 lastrefreshdate datetime iso8601 date string, for example, 2011-02-25t18:24:31.000z, 28.0–31.0 specifying when this dashboard was last refreshed. 1989apex reference guide connectapi output classes name type description available version lastrefreshdate string the text of the last refresh date to be displayed, such as, “last refreshed 28.0–31.0 displaytext on october 31, 2011.” runninguser connectapi. the user running the dashboard. 28.0–31.0 user summary thumbnailurl string url of the thumbnail-sized dashboard image. 28.0–31.0 connectapi.datacloudcompany information about a data.com company. all company information is visible for companies that you purchased and own. if you haven’t purchased a company, some of the fields are hidden. hidden fields are fully or partially hidden by asterisks “***.” property name type description available version activecontacts integer the number of active data.com contacts who 32.0 work in the company. address connectapi.address the postal address for the company. this is 32.0 typically a physical address that can include the city, state, street, and postal code. annualrevenue double the amount of money that the company makes 32.0 in one year. annual revenue is measured in us dollars. companyid string a unique numerical identifier for the company. 32.0 this is the data.com identifier for a company. description string a brief synopsis of the company that provides 32.0 a general overview of the company and what it does. dunsnumber string a randomly generated nine-digit number that’s 32.0 assigned by dun & bradstreet (d&b) to identify unique business establishments. industry string a description of the type of industry such as 32.0 “telecommunications,” “agriculture,” or “electronics.” isinactive boolean indicates whether this company is active (true) 32.0 or not (false). inactive companies have out-of-date information in data.com. isowned boolean 32.0 • true: you or your organization owns this company. 1990apex reference guide connectapi output classes property name type description available version • false: neither you nor your organization owns this company. naicscode string north american industry classification system 32.0 (naics) codes were created to provide more details about a business’s service orientation. the code descriptions are focused on what a business does. naicsdescription string a description of the naics classification. 32.0 name string the name of the company. 32.0 numberof integer the number of employees who are working for 32.0 employees the company. ownership string 32.0 the type of ownership of the company: • public • private • government • other phonenumbers connectapi.phonenumber 32.0 the list of telephone numbers for the company, including the type. here are some possible types of telephone numbers. • mobile • work • fax sic string standard industrial codes (sic) is a numbering 32.0 convention that indicates what type of service a business provides. it’s a four-digit value. sicdescription string a description of the sic classification. 32.0 site string company’s site. for example, hq, single 32.0 location, or branch. an organization status of the company. • branch: a secondary location to a headquarter location. • headquarter: the parent company has branches or subsidiaries. • single location: a single business with no subsidiaries or branches. 1991apex reference guide connectapi output classes property name type description available version tickersymbol string the symbol that uniquely identifies companies 32.0 that are traded on public stock exchanges. tradestyle string a legal name under which a company conducts 32.0 business. updateddate datetime the date of the most recent change to this 32.0 company’s information. website string the standard url for the company’s home page. 32.0 yearstarted string the year when the company was founded. 32.0" "connectapi.datacloudcompanies lists all companies that were purchased in a specific order, page urls, and the number of companies in the order. property name type description available version companies connectapi.datacloudcompany a detailed list of companies that were 32.0 part of a single order. currentpageurl string the url for the current page of a list of 32.0 companies. nextpageurl string connect rest api url identifying the 32.0 next page, or null if there isn’t a next page. previouspageurl string the url to the previous page of 32.0 companies that were viewed before the current page. if this value is null, there’s no previous page. total integer the number of companies in the order. 32.0 you can calculate the number of pages to display by dividing this number by your page size. the default page size is 25. connectapi.datacloudcontact information about a data.com contact. all contact information is visible for contacts that you purchased. if you have not purchased a contact, some of the fields will be hidden. hidden fields are fully or partially hidden by asterisks “***.” property name type description available version address connectapi.address the contact’s business address. 32.0 1992apex reference guide connectapi output classes property name type description available version companyid string a unique numerical identifier for the company where 32.0 the contact works. this is the data.com identifier for a company. companyname string the company name where the contact works. 32.0 contactid string a unique numerical identifier for the contact. this is 32.0 the data.com identifier for a contact. department string the department in the company where the contact 32.0 works. here are some possible departments. • engineering • it • marketing • sales email string the most current business email address for the 32.0 contact. firstname string the first name of the contact. 32.0 isinactive boolean whether this contact is active (true) or not (false). 32.0 inactive contacts have out-of-date information in data.com. isowned boolean whether this contact is owned (true) or not (false). 32.0 lastname string the last name of the contact. 32.0 level string a human resource label that designates a person’s 32.0 level in the company. here are some possible levels. • c-level • director • manager • staff phonenumbers connectapi.phonenumber telephone numbers for the contact, which can 32.0 include direct-dial business telephone numbers, mobile telephone numbers, and business headquarters telephone numbers. the type of telephone number is also indicated. title string the title of the contact, such as ceo or vice president. 32.0 updateddate datetime the date of the most recent change to this contact’s 32.0 information. see also: connectapi.datacloudcontacts 1993apex reference guide connectapi output classes connectapi.datacloudcontacts lists all contacts that were purchased in the specific order, page urls, and the number of contacts in the order. property name type description available version contacts a detailed list of purchased contacts. 32.0 list currentpageurl string url to the current page of contacts. 32.0 nextpageurl string connect rest api url identifying the next page, or 32.0 null if there isn’t a next page. previouspageurl string url to the previous page of contacts. this value is 32.0 null if there is no previous page. total integer number of contacts that are associated with this 32.0 order. can be greater than the number of contacts that are shown on a single page. connectapi.datacloudorder represents a datacloud order. property name type description available version entityurl string url to a list of contacts or companies that were 32.0 purchased with this order. id string unique number that’s used to track your order 32.0 information. purchasecount integer number of contacts or companies that were 32.0 purchased for this order. purchasedate datetime purchase date for this order. 32.0 url string get request url for this order. 32.0 connectapi.datacloudpurchaseusage information about data.com point usage for monthly and list pool users. property name type description available version" "listpoolcreditsavailable integer the points or credits that are available in a 32.0 pool of credits for your organization. this pool of credits can be used by any list pool user in your organization. 1994apex reference guide connectapi output classes property name type description available version listpoolcreditsused integer the points or credits that have been used 32.0 from a pool of credits that are used by list pool users to purchase records. monthlycreditsavailable integer the total credits that are assigned to a 32.0 monthly user. unused credits expire at the end of each month. monthlycreditsused integer the credits that are used by a monthly user 32.0 for the current month. connectapi.emailmessage email message from a case. important: this class isn’t available in version 32.0 and later. in version 32.0 and later, connectapi.emailmessagecapability is used. subclass of connectapi.feeditemattachment name type description available version direction connectapi.email the direction of the email message. 29.0–31.0 messagedirection • inbound—an inbound message (sent by a customer). enum • outbound—an outbound message (sent to a customer by a support agent). emailmessageid string the id of the email message. 29.0–31.0 subject string the subject of the email message. 29.0–31.0 textbody string the body of the email message. 29.0–31.0 toaddresses list a list of email addresses to send the message to. 29.0–31.0 connectapi.feeditemattachment feed item attachment. important: this class isn’t available in version 32.0 and later. in version 32.0 and later, connectapi.feedelementcapability is used. this class is abstract. subclasses: • connectapi.approvalattachment • connectapi.basictemplateattachment • connectapi.canvastemplateattachment • connectapi.emailmessage • connectapi.casecomment 1995apex reference guide connectapi output classes • connectapi.contentattachment • connectapi.dashboardcomponentattachment • connectapi.feedpoll • connectapi.linkattachment • connectapi.recordsnapshotattachment • connectapi.trackedchangeattachment message segments in a feed item are typed as connectapi.messagesegment. feed item capabilities are typed as connectapi.feeditemcapability. record fields are typed as connectapi.abstractrecordfield. these classes are all abstract and have several concrete subclasses. at runtime you can use instanceof to check the concrete types of these objects and then safely proceed with the corresponding downcast. when you downcast, you must have a default case that handles unknown subclasses. important: the composition of a feed can change between releases. write your code to handle instances of unknown subclasses. connectapi.feeditempage a paged collection of connectapi.feeditem objects. important: this class isn’t available in version 32.0 and later. in version 32.0 and later, connectapi.feedelementpage is used. name type description available version currentpagetoken string token identifying the current page. 28.0–31.0 currentpageurl string connect rest api url identifying the current page. 28.0–31.0 ismodifiedtoken string opaque polling token to use in the since parameter of the 28.0–31.0 chatterfeeds.ismodified method. the token describes when the feed was last modified. important: this feature is available through a feed polling pilot program. this pilot program is closed and not accepting new participants. ismodifiedurl string connect rest api url with a since request parameter 28.0–31.0 that contains an opaque token that describes when the feed was last modified. returns null if the feed isn’t a news feed. use this url to poll a news feed for updates. important: this feature is available through a feed polling pilot program. this pilot program is closed and not accepting new participants. items list list of feed items 28.0–31.0 nextpagetoken string token identifying the next page, or null if there isn’t a next 28.0–31.0 page. nextpageurl string connect rest api url identifying the next page, or null" "28.0–31.0 if there isn’t a next page. 1996apex reference guide connectapi output classes name type description available version updatestoken string token to use in an updatedsince parameter, or null 30.0–31.0 if not available. updatesurl string a connect rest api resource with a query string containing 30.0–31.0 the value of the updatestoken property. the resource returns the feed items that have been updated since the last request. use the url as it is—do not modify it. property is null if not available. connectapi.feeditemtopicpage feed item topic page. important: this class isn’t available in version 32.0 and later. in version 32.0 and later, connectapi.topicscapability is used. name type description available version canassigntopics boolean true if a topic can be assigned to the feed item, false 28.0–31.0 otherwise. topics list connectapi.feedpoll attachment of connectapi.feeditem objects where the type property is pollpost. important: this class isn’t available in version 32.0 and later. in version 32.0 and later, connectapi.pollcapability is used. subclass of connectapi.feeditemattachment. name type description available version choices list mychoiceid string id of the poll choice that the context user has voted for in this poll. 28.0–31.0 returns null if the context user hasn’t voted. totalvotecount integer total number of votes cast on the feed poll item. 28.0–31.0 connectapi.linkattachment link attached to a feed item. important: this class isn’t available in version 32.0 and later. in version 32.0 and later, connectapi.linkcapability is used. 1997apex reference guide connectapi output classes subclass of connectapi.feeditemattachment. name type description available version title string title given to the link if available, otherwise, null. 28.0–31.0 url string the link url. 28.0–31.0 connectapi.nonentityrecommendation a recommendation for a non-salesforce entity, such as an application. subclass of connectapi.abstractrecommendation. important: connectapi.nonentityrecommendation isn’t used in version 34.0 and later. in version 34.0 and later, connectapi.entityrecommendation is used for all recommendations. property name type description available version displaylabel string localized label of the non-entity object. 32.0 motif connectapi.motif motif for the non-entity object. 32.0 connectapi.recordsnapshotattachment fields of a record at the point in time when the record was created. important: this class isn’t available in version 32.0 and later. in version 32.0 and later, connectapi.recordsnapshotcapability is used. subclass of connectapi.feeditemattachment. name type description available version recordview connectapi. the representation of the record. 29.0–31.0 recordview connectapi.trackedchangeattachment tracked change attachment to a feed item. important: this class isn’t available in version 32.0 and later. in version 32.0 and later, connectapi.trackedchangescapability is used. name type description available version changes list 1998apex reference guide connectapi enums connectapi enums enums specific to the connectapi namespace. connectapi enums inherit all properties and methods of apex enums. enums are not versioned. enum values are returned in all api versions. clients should handle values they don't understand gracefully. enum description connectapi.actionlink number of times an action link can be executed. executionsallowed • once—an action link can be executed only once across all users. • onceperuser—an action link can be executed only once for each user. • unlimited—an action link can be executed an unlimited number of times by each user." "if the action link’s actiontype is api or apiasync, you can’t use this value. connectapi. type of action link. actionlinktype • api—the action link calls a synchronous api at the action url. salesforce sets the status to successfulstatus or failedstatus based on the http status code returned by your server. • apiasync—the action link calls an asynchronous api at the action url. the action remains in a pendingstatus state until a third party makes a request to /connect/action-links/actionlinkid to set the status to successfulstatus or failedstatus when the asynchronous operation is complete. • download—the action link downloads a file from the action url. • ui—the action link takes the user to a web page at the action url. connectapi. type of sharing operation. activitysharingtypeenum • everyone—the activity is shared with everyone. • mygroups—the activity is shared only with a selection of the context user’s groups. • onlyme—the activity is private. connectapi. scope of the price adjustment amount. adjustmentamountscope • total—the adjustment scope is the total price. • unit—the adjustment scope is the unit price. • unproratedtotal—the adjustment scope is the unprorated total price. connectapi. how the price adjustment amount is calculated. adjustmenttype • adjustmentamount—the adjustment is a fixed amount. • adjustmentpercentage—the adjustment is a percentage. connectapi. type of operation to perform on articles and topics. articletopicjobtype • assigntopicstoarticle—assign topics to articles in a data category. • unassigntopicsfromarticle—unassign topics from articles in a data category. 1999apex reference guide connectapi enums enum description connectapi. operator used in the personalization audience criterion. audiencecriteriaoperator • contains • equal • greaterthan • greaterthanorequal • includes • lessthan • lessthanorequal • notequal • notincludes • startswith connectapi. type of personalization audience criterion. audiencecriteriatype • audience—criterion based on audience. • default—audience has no criteria. • domain—criterion based on domain. • fieldbased—criterion based on object fields. • geolocation—criterion based on location. • permission—criterion based on standard or custom permissions. • profile—criterion based on profile. connectapi.bannerstyle decorates a feed item with a color and set of icons. • announcement—an announcement displays in a designated location in the salesforce ui until 11:59 p.m. on its expiration date, unless it’s deleted or replaced by another announcement. connectapi.botversion activation status of the bot version. activationstatus • active • inactive connectapi.bundletype type of bundle. • genericbundle—a bundle that contains no additional information and is just a collection of feed elements. • trackedchanges—a bundle that represents a collection of feed tracked changes. the bundle includes summary information about the feed tracked changes that make up the bundle. connectapi. definition type of the calculated insight. calculatedinsight • calculatedmetric definitiontypeenum • externalmetric • streamingmetric 2000apex reference guide connectapi enums enum description connectapi. type of tax calculation. calculatetaxtype • actual—calculated tax represents the final taxed amount for the transaction. • estimated—calculated tax represents only an estimated value before the transaction is finalized. connectapi.cardcategory indicates a credit card or debit card. • creditcard • debitcard connectapi.cardtype credit card issuer. • americanexpress • dinersclub • jcb • maestro • mastercard • visa connectapi. sort order for items in a cart. cartitemsortorder • createddateasc—sorts by oldest creation date. • createddatedesc—sorts by most recent creation date. • nameasc—sorts by name in ascending alphabetical order (a–z). • namedesc—sorts by name in descending alphabetical order (z–a). • salespriceasc—sorts from lowest to highest negotiated price. • salespricedesc" "—sorts from highest to lowest negotiated price. connectapi.cartitemtype type of item in a cart. • deliverycharge • product connectapi. severity of cart message. cartmessageseverity • error • info • warning connectapi. level of the promotion target. cartpromotiontype • cart—the target is cart-level. • item—the target is item-level. connectapi.cartstatus status of the cart. • active—cart is active. • checkout—cart is in checkout. 2001apex reference guide connectapi enums enum description • closed—cart is closed. • pendingdelete—cart is pending delete, for example, a user deleted the cart but the job hasn’t completed yet. • processing—cart is processing. connectapi.carttaxtype tax type of the cart. • gross—gross taxation policy. • net—net taxation policy. connectapi.carttype type of cart. • cart connectapi. type of user who made the comment. caseactortype • customer—if a chatter customer made the comment • customerservice—if a service representative made the comment connectapi.casecomment event type of a comment in case feed. eventtype • newinternal—a case comment that has newly been marked internal only. • newpublished—a newly published case comment. • newpublishedbycustomer—a case comment by a customer that was newly published. • publishexisting—an existing case comment that was republished. • publishexistingbycustomer—an existing case comment by a customer that was republished. • unpublishexistingbycustomer—an existing case comment by a customer that was unpublished. • unpublishexsiting—an existing case comment that was unpublished. note: unfortunately, this typo is in the code, not the documentation. use this spelling in your code. connectapi. source object for an identity resolution ruleset. cdpidentityresolution • account configurationtype • individual connectapi. match method for a match rule criterion. cdpidentityresolution • exact—exact match. matchmethodtype • exactnormalized—exact normalized match. • fuzzy—fuzzy match with medium precision. • fuzzyhigh—fuzzy match with high precision. • fuzzylow—fuzzy match with low precision. 2002apex reference guide connectapi enums enum description connectapi. default reconciliation rule applied to fields in the object the reconciliation rule applies to. cdpidentityresolution • lastupdated reconciliationruletype • mostfrequent • sourcesequence connectapi. result of an identity resolution ruleset job run. cdpidentityresolution • exceededmaximumnumberofsuccessfulrunsallowedin24hours runnowresultcode • identityresolutionjobisalreadyrunning • nopendingchangesjobrunskipped • successfullysubmittedidentityresolutionjobrunrequest connectapi.commenttype type of comment. • contentcomment—comment holds a content capability. • textcomment—comment contains only text. connectapi. sort order for commerce addresses. commerceaddresssort • createddateasc—sort in ascending order of created date. • createddatedesc—sort in descending order of created date. • nameasc—sort in ascending order of name. • namedesc—sort in descending order of name. connectapi. search attribute type. commercesearch • custom attributetype • productattribute • productcategory • standard connectapi. display type of the facet. commercesearchfacet • categorytree displaytype • datepicker • multiselect • singleselect connectapi. search facet type. commercesearchfacettype • distinctvalue connectapi. grouping option for search results. commercesearch • nogrouping—search results aren’t grouped. groupingoption • variationparent—search results are grouped by the variation parent. 2003apex reference guide connectapi enums enum description connectapi. build type of the index. commercesearch • full indexbuildtype • incremental connectapi. creation type of the index. commercesearch • manual indexcreationtype • scheduled connectapi. status of the index. commercesearch • completed indexstatus • failed • inprogress" "connectapi. usage of the index. commercesearch • live indexusage • outofuse connectapi. direction of the sort rule. commercesearch • ascending—sorts in ascending alphanumeric order (a–z, 0–9). sortruledirection • default—when no direction is defined, sorts by relevance. • descending—sorts in descending alphanumeric order (z–a, 9–0). connectapi. label suffix of the sort rule. commercesearchsortrule • ascen—label suffix for 'asc' labelsuffix • ascending—label suffix for 'ascending' • az—label suffix for 'a-z' • descen—label suffix for 'desc' • descending—label suffix for 'descending' • fewmany—label suffix for 'few-many' • heavylight—label suffix for 'heavy-light' • highlow—label suffix for 'high-low' • highestlowest—label suffix for 'highest-lowest' • lightheavy—label suffix for 'light-heavy' • lowhigh—label suffix for 'low-high' • lowesthighest—label suffix for 'lowest-highest' • manyfew—label suffix for 'many-few' • newold—label suffix for 'new-old' • newest—label suffix for 'newest' • newestoldest—label suffix for 'newest-oldest' • ninezero—label suffix for '9-0' 2004apex reference guide connectapi enums enum description • oldnew—label suffix for 'old-new' • oldest—label suffix for 'oldest' • oldestnewest—label suffix for 'oldest-newest' • pricedecreasing—label suffix for '$$-$' • priceincreasing—label suffix for '$-$$' • thickthin—label suffix for 'thick-thin' • thinthick—label suffix for 'thin-thick' • za—label suffix for 'z-a' • zeronine—label suffix for '0-9' connectapi. type of sort rule. commercesearch • productattributebased—sorts by product attribute fields. sortruletype • productbased—sorts by product field data. • relevancy—sorts by product and catalog term frequency. • sortbypricebook—sorts by product prices defined in the specified pricebook (version 55.0 and later). connectapi. type of the top product to return for each product group in search results. commercesearchtop • variationparent producttype connectapi.communityflag reason a post, comment, or file is flagged. reasontype • flaggedbyrule—moderation rule flagged the item. • flaggedbysystem—einstein flagged the item. • flaggedbyuserasinappropriate—user flagged the item as inappropriate. • flaggedbyuserasspam—user flagged the item as spam. connectapi. type of moderation flag. communityflagtype • flagasinappropriate—flag for inappropriate content. • flagasspam—flag for spam. connectapi. visibility behavior of a flag for various user types. communityflagvisibility • moderatorsonly—the flag is visible only to users with moderation permissions on the flagged element or item. • selfandmoderators—the flag is visible to the creator of the flag and to users with moderation permissions on the flagged element or item. connectapi. status of the experience cloud site. communitystatus • live • inactive • underconstruction 2005apex reference guide connectapi enums enum description connectapi.activitytype type of activity. • all • event • task connectapi.contenthub authentication protocol used for the repository. authenticationprotocol • noauthentication—repository doesn’t require authentication. • oauth—repository uses oauth authentication protocol. • password—repository uses user name and password authentication protocol. connectapi.contenthub type of directory entry. directoryentrytype • groupentry • userentry connectapi.contenthub sharing status for the external file. externalitemsharingtype • domainsharing—file is shared with the domain. • privatesharing—file is private or shared only with individuals. • publicsharing—file is publicly shared. connectapi.contenthub type of group. group" type • everybody—group is public to everybody. • everybodyindomain—group is public to everybody in the same domain. • unknown—group type is unknown. connectapi.contenthub item types. itemtype • any—includes files and folders. • filesonly—includes files only. • foldersonly—includes folders only. connectapi.contenthub support for content streaming. streamsupport • contentstreamallowed • contentstreamnotallowed • contentstreamrequired connectapi.contenthub data type of the value of the field. variabletype • booleantype • datetimetype • decimaltype • htmltype • idtype • integertype 2006apex reference guide connectapi enums enum description • stringtype • uritype • xmltype connectapi.conversation conversation application integration types. application • api integrationtype • slack connectapi. action to take when creating the credential. createcredentialaction • refresh connectapi. authentication protocol of the external credential. credentialauthentication • awssv4 protocol • custom • noauth • oauth connectapi. authentication protocol variant of the external credential. credentialauthentication • awssv4_sts—aws signature version 4 with security token service. protocolvariant • jwtbearer—oauth 2.0 json web token bearer flow. • rolesanywhere—aws signature version 4 with identity and access management (iam) roles anywhere. connectapi. status of the credential authentication. credentialauthentication • configured—credential has all required credentials for at least one principal. status • notconfigured—credential isn’t configured. • unknown—credential status can’t be determined because the authentication protocol is custom. connectapi. type of credential principal. credentialprincipaltype • awsstsprincipal • namedprincipal • peruserprincipal connectapi. type of user. datacloudusertype • monthly—a user type that’s assigned monthly point limits for purchasing data.com records. only the assigned user can use monthly points. points expire at the end of the month. monthly is the default setting for datacloudusertype. • listpool—a user type that allows users to draw from a pool of points to purchase data.com records. 2007apex reference guide connectapi enums enum description connectapi. status of the import. datacloudimport • success—indicates that selected records were added to the org’s crm. statustypeenum • duplicate—marks a record that is already in the org’s crm. the api determines whether an org allows the addition of duplicate records in its crm. • error—indicates that the selected records weren’t added to the org’s crm. connectapi.digestperiod time period that’s included in a chatter email digest. • dailydigest—the email includes up to the 50 latest posts from the previous day. • weeklydigest—the email includes up to the 50 latest posts from the previous week. connectapi.emailmessage direction of an email message on a case. direction • inbound—an inbound message (sent by a customer). • outbound—an outbound message (sent to a customer by a support agent). connectapi.emailmessage status of an email message on a case. status • draftstatus • forwardedstatus • newstatus • readstatus • repliedstatus • sentstatus connectapi. information type of the extension. extensioninformationtype • lightning connectapi. parameter type of the external credential. externalcredential • authparameter parametertype • authprovider • authproviderurl • authproviderurlqueryparameter • jwtbodyclaim • jwtheaderclaim • signingcertificate connectapi. access type of the external credential principal. externalcredential • permissionset principalaccesstype • permissionsetgroup • profile 2008apex reference guide connectapi enums enum description connectapi. order of comments. feedcommentsortorder • createddatelatestasc—sorts by most recently created comments in ascending order. • createddateoldestasc—sorts by oldest comments in "ascending order. • relevance—sorts by most relevant content. connectapi.feeddensity density of the feed. • allupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations. • fewerupdates—displays all updates from people and records the user follows and groups the user is a member of. also displays custom recommendations, but hides some system-generated updates from records. connectapi. capabilities of a feed element in api versions 31.0 and later. if a capability exists on a feed element, feedelementcapability the capability is available, even if the value doesn’t exist or is null. if the capability doesn’t type exist, it isn’t available. • associatedactions—the feed element includes information about actions associated with it. • approval—the feed element includes information about an approval. • banner—the body of the feed element has an icon and border. • bookmarks—the context user can bookmark the feed element. bookmarked feed elements are visible in the bookmarks feed. • bundle—the feed element has a group of other feed elements that display as a bundle in the feed. the bundle type determines the additional data associated with the bundle. • callcollaboration—the feed element has a recording comment. • canvas—the feed element renders a canvas app. • casecomment—the feed element has a case comment in the case feed. • chatterlikes—the context user can like the feed element. • close—the feed element can’t be edited, commented on, or deleted. if the feed element is a poll, it can’t be voted on. • comments—the context user can add comments to the feed element. • content—the feed element has a file. • dashboardcomponentsnapshot—the feed element has a dashboard component snapshot. • directmessage—the feed element is a direct message. • edit—users who have permission can edit the feed element. • emailmessage—the feed element has an email message from a case. • enhancedlink—the feed element has a link that can contain supplemental information like an icon, a title, and a description. • extensions—the feed element has one or more extension attachments. • feedentityshare—the feed element has a feed entity shared with it. 2009apex reference guide connectapi enums enum description • files—the feed element has one or more file attachments. • interactions—the feed element has information about user interactions. • link—the feed element has a url. • mediareferences—the feed element has one or more media references. • moderation—users in an experience cloud site can flag the feed element for moderation. • mute—the context user can mute the feed element. • origin—a feed action created the feed element. • pin—users who have permission can pin the feed element. • poll—the feed element has poll voting. • questionandanswers—the feed element has a question, and users can add answers to the feed element instead of comments. users can also select the best answer. • readby—the context user can mark the feed element as read. • recommendations—the feed element has a recommendation. • record—the comment has a record attachment. • recordsnapshot—the feed element has all the snapshot fields of a record for a single create record event. • socialpost—the feed element can interact with a social post on a social network. • status—the feed element has a status that determines its visibility. • topics—the context user can add topics to the feed element. • trackedchanges—the feed element has all changes to a record for a single tracked change event. • updownvote—users can upvote or downvote the feed element. • verified—users who have permission can mark a comment as verified or unverified. connectapi.feedelement feed elements are the top-level objects that a feed contains. the feed element type describes type the characteristics of that feed element. • bundle—a container of feed elements. a bundle also has a body made up of message segments that can always be gracefully degraded to text-only values. • feeditem—a feed item has a single parent and is scoped to oneexperience cloud site or across all experience cloud sites. a feed item can have capabilities such as bookmarks, canvas, content, comment, link, poll. feed items have a body made up of message segments that can always be gracefully degraded to text-only" "values. • recommendation—a recommendation is a feed element with a recommendations capability. a recommendation suggests records to follow, groups to join, or applications that are helpful to the context user. connectapi.feedentity status of the feed post or comment. status • draft—the feed post isn’t published but is visible to the author and users with modify all data or view all data permission. comments can’t be drafts. • pendingreview—the feed post or comment isn’t approved yet and therefore isn’t published or visible. 2010apex reference guide connectapi enums enum description • published—the feed post or comment is approved and visible. connectapi.feedfavorite origin of the feed favorite. type • listview • search • topic connectapi.feedfilter filter value for a feed. • allquestions—feed elements that are questions. • authoredby—feed elements authored by the user profile owner. this value is valid only for the userprofile feed. • communityscoped—feed elements that are scoped to experience cloud sites. currently, these feed elements have a user or a group parent record. however, other parent record types could be scoped to sites in the future. feed elements that are always visible in all sites are filtered out. this value is valid only for the userprofile feed. • questionswithcandidateanswers—feed elements that are questions that have candidate answers associated with them.this value is valid only for users with the access einstein-generated answers permission. • questionswithcandidateanswersreviewedpublished—feed elements that are questions that have candidate answers that have been reviewed or published. this value is valid only for users with the access einstein-generated answers permission. • read—feed elements that are older than 30 days or are marked as read for the context user. includes existing feed elements when the context user joined the group. this value is valid only for the record feed of a group. • solvedquestions—feed elements that are questions and that have a best answer. • unansweredquestions—feed elements that are questions and that don’t have any answers. • unansweredquestionswithcandidateanswers—feed elements that are questions that don’t have answers but have candidate answers associated with them. this value is valid only for users with the access einstein-generated answers permission. • unread—feed elements that are created in the past 30 days and aren’t marked as read for the context user. this value is valid only for the record feed of a group. • unsolvedquestions—feed elements that are questions and that don’t have a best answer. connectapi.feeditem attachment type for feed item output objects. attachmenttype • approval—a feed item requiring approval. • basictemplate—a feed item with a generic rendering of an image, link, and title. • canvas—a feed item that contains the metadata to render a link to a canvas app. • casecomment—a feed item created from a comment to a case record. • casecomment—a feed item created from a comment to a case record. • content—a feed item with a file attached. 2011apex reference guide connectapi enums enum description • dashboardcomponent—a feed item with a dashboard attached. • emailmessage—an email attached to a case record in case feed. • link—a feed item with a url attached. • poll—a feed item with a poll attached. • question—a feed item with a question attached. • recordsnapshot—the feed item attachment contains a view of a record at a single connectapi.feeditemtype.createrecordevent. • trackedchange—all changes to a record for a single connectapi.feeditemtype.trackedchange event. connectapi.feeditemtype type of feed item. • activityevent—feed item generated in case feed when an event or task associated with a parent record with a feed enabled is created or updated. • advancedtextpost—a feed item with advanced text formatting, such as a group announcement post. • approvalpost—feed item with an approval capability. approvers can act on the feed item parent. • attacharticleevent—feed item generated when an article is attached to a case in case feed. • basictemplatefeeditem—feed item with an enhanced link capability. • calllogpost—feed item generated when a call log is saved to a case in case feed. • canvaspost—feed item generated" "by a canvas app in the publisher or from connect rest api or connect in apex. the post itself is a link to a canvas app. • casecommentpost—feed item generated when a case comment is saved in case feed. • changestatuspost—feed item generated when the status of a case is changed in case feed. • chattranscriptionpost—feed item generated in case feed when a live agent chat transcript is saved to a case. • collaborationgroupcreated—feed item generated when a new public group is created. contains a link to the new group. • collaborationgroupunarchived—deprecated. feed item generated when an archived group is activated. • contentpost—feed item with a content capability. • createrecordevent—feed item that describes a record created in the publisher. • dashboardcomponentalert—feed item with a dashboard alert. • dashboardcomponentsnapshot—feed item with a dashboard component snapshot capability. • emailmessageevent—feed item generated when an email is sent from a case in case feed. • facebookpost—deprecated. feed item generated when a facebook post is created from a case in case feed. 2012apex reference guide connectapi enums enum description • linkpost—feed item with a link capability. • milestoneevent—feed item generated when a case milestone is either completed or reaches a violation status. contains a link to the case milestone. • pollpost—feed item with a poll capability. viewers of the feed item are allowed to vote on the options in the poll. • profileskillpost—feed item generated when a skill is added to a user’s profile. • questionpost—feed item generated when a question is asked. as of api version 33.0, a feed item of this type can have a content capability and a link capability. • replypost—feed item generated by a chatter answers reply. • rypplepost—feed item generated when a user posts thanks. • socialpost—feed item generated when a social post is created from a case in case feed. • textpost—feed item containing text only. • trackedchange—feed item created when one or more fields on a record have been changed. • userstatus—deprecated. a user's post to their own profile. connectapi.feeditem type of users who can see a feed item. visibilitytype • allusers—visibility is not limited to internal users. • internalusers—visibility is limited to internal users. connectapi. order of feed items in the feed. feedsortorder • createddateasc—sorts by oldest creation date. this sort order is available only for directmessagemoderation, draft, moderation, and pendingreview feeds. • createddatedesc—sorts by most recent creation date. • lastmodifieddatedesc—sorts by most recent activity. • mostviewed—sorts by most viewed content. this sort order is available only for home feeds when the connectapi.feedfilter is unansweredquestions. • relevance—sorts by most relevant content. this sort order is available only for company, home, and topics feeds. connectapi.feedtype type of feed. • bookmarks—contains all feed items saved as bookmarks by the context user. • company—contains all feed items except feed items of type trackedchange. to see the feed item, the user must have sharing access to its parent. • directmessagemoderation—contains all direct messages that are flagged for moderation. the direct message moderation feed is available only to users with moderate experiences chatter messages permissions. • directmessages—contains all feed items of the context user’s direct messages. 2013apex reference guide connectapi enums enum description • draft—contains all the feed items that the context user drafted. • files—contains all feed items that contain files posted by people or groups that the context user follows. • filter—contains the news feed filtered to contain feed items whose parent is a specified object type. • groups—contains all feed items from all groups the context user either owns or is a member of. • home—contains all feed items associated with any managed topic in an experience cloud site. • landing—contains all feed items that best drive user engagement when the feed is requested. allows clients to avoid an empty feed when there aren’t many personalized feed items. • moderation—contains all feed items that are flagged for moderation, except direct" "messages. the moderation feed is available only to users with moderate experiences feeds permissions. • mute—contains all feed items that the context user muted. • news—contains all updates for people the context user follows, groups the user is a member of, and files and records the user is following. contains all updates for records whose parent is the context user. • pendingreview—contains all feed items and comments that are pending review. • people—contains all feed items posted by all people the context user follows. • record—contains all feed items whose parent is a specified record, which could be a group, user, object, file, or any other standard or custom object. when the record is a group, the feed also contains feed items that mention the group. when the record is a user, the feed contains only feed items on that user. you can get another user’s record feed. • streams—contains all feed items for any combination of up to 25 feed-enabled entities that the context user subscribes to in a stream. examples of feed-enabled entities include people, groups, and records, • to—contains all feed items with mentions of the context user. contains feed items the context user commented on and feed items created by the context user that are commented on. • topics—contains all feed items that include the specified topic. • userprofile—contains feed items created when a user changes records that can be tracked in a feed. contains feed items whose parent is the user and feed items that @mention the user. this feed is different than the news feed, which returns more feed items, including group updates. you can get another user’s user profile feed. connectapi.fieldchange value type of a field change. valuetype • newvalue—a new value • oldvalue—an old value connectapi. format of the file preview. filepreviewformat • jpg—preview format is jpg. 2014apex reference guide connectapi enums enum description • pdf—preview format is pdf. • svg—preview format is compressed svg. • thumbnail—preview format is 240 x 180 png. • thumbnailbig—preview format is 720 x 480 png. • thumbnailtiny—preview format is 120 x 90 png. connectapi. availability status of the file preview. filepreviewstatus • available—preview is available. • inprogress—preview is being processed. • notavailable—preview is unavailable. • notscheduled—generation of the preview isn’t scheduled yet. connectapi. publish status of the file. filepublishstatus • pendingaccess—file is pending publishing. • privateaccess—file is private. • publicaccess—file is public. connectapi. sharing option of the file. filesharingoption • allowed—resharing of the file is allowed. • restricted—resharing of the file is restricted. connectapi. sharing privacy of a file. filesharingprivacy • none—file is visible to anyone with record access. • privateonrecords—file is private on records. connectapi. sharing role of the file. filesharingtype • admin—owner permission, but doesn’t own the file. • collaborator—viewer permission, and can edit, change permissions, and upload a new version of a file. • owner—collaborator permission, and can make a file private, and delete a file. • viewer—can view, download, and share a file. • workspacemanaged—permission controlled by the library. connectapi.folderitem type of item in a folder. type • file • folder connectapi.formfieldtype type of marketing integration form field. • boolean • date • emailaddress 2015apex reference guide connectapi enums enum description • number • text connectapi. formula filter type for the personalization audience. formulafiltertype • allcriteriamatch—all audience criteria are true (and operation). • anycriterionmatches—any audience criterion is true (or operation). • customlogicmatches—audience criteria match the custom formula (for example, (1 and 2) or 3). connectapi.grouparchive archive status of groups. status • all—all groups, including groups that are archived and groups that aren’t archived. • archived—groups that are archived. • notarchived—groups" "that aren’t archived. connectapi.groupemail frequency with which a user receives email. frequency • eachpost • dailydigest • weeklydigest • never • usedefault connectapi. type of membership the user has with the group. groupmembershiptype • groupowner • groupmanager • notamember • notamemberprivaterequested • standardmember connectapi. status of a request to join a private group. groupmembership • accepted requeststatus • declined • pending connectapi.groupviral status of an invitation to join a group. invitationsstatus • acteduponuser—the user was added to the group. an email was sent asking the user to visit the group. • invited—an email was sent asking the user to sign up for the org. • maxedoutusers—the group has the maximum allowed members. • multipleerror—the user wasn’t invited due to multiple errors. • noactionneededuser—the user is already a member of the group. 2016apex reference guide connectapi enums enum description • notvisibletoexternalinviter—the user is not accessible to the user sending the invitation. • unhandled—the user couldn’t be added to the group for an unknown reason. connectapi. group visibility type. groupvisibilitytype • privateaccess—only members of the group can see posts to this group. • publicaccess—all users within the experience cloud site can see posts to this group. • unlisted—reserved for future use. connectapi.httprequest http method. method • httpdelete—returns http 204 on success. response body or output class is empty. • httpget—returns http 200 on success. • httphead—returns http 200 on success. response body or output class is empty. • httppatch—returns http 200 on success or http 204 if the response body or output class is empty. • httppost—returns http 201 on success or http 204 if the response body or output class is empty. exceptions are the batch posting resources and methods, which return http 200 on success. • httpput—return http 200 on success or http 204 if the response body or output class is empty. connectapi. source of the link metadata. linkmetadatasource • none—link metadata wasn’t retrieved. • sfdc—salesforce is the source. connectapi. type of link that the metadata represents. linkmetadatatype • error—link metadata couldn’t be retrieved. • link—represents a link. • none—link metadata wasn’t retrieved because the link isn’t an allowed domain. • photo—represents a photo. • rich—represents rich content, typically html content. • unknown—link metadata was retrieved, but the type is unknown. • video—represents a video. connectapi. type of maintenance. maintenancetype • downtime—downtime maintenance. • generallyavailable—maintenance with generally available mode. • maintenancewithdowntime—scheduled maintenance with downtime. • readonly—maintenance with read-only mode. 2017apex reference guide connectapi enums enum description connectapi. type of managed content channel. managedcontent • cloudtocloud channeltype • community • connectedapp • publicunauthenticated connectapi. type of managed content media. managedcontentmediatype • document • image connectapi. type of managed content node. managedcontentnodetype • date • datetime • media • mediasource • multilinetext • namefield • richtext • text • url connectapi.managedtopic type of managed topic. type • content—topics that are associated with native content. • featured—topics that are featured, for example, on the experience cloud site home page, but don’t provide overall navigation. • navigational—topics that display in a navigational menu in the experience cloud site. connectapi.markuptype type of rich text markup. • bold—bold tag. • code—code tag. • hyperlink—hyperlink anchor tag. • italic—italic tag. • listitem—list item tag. • orderedlist—ordered list tag. • paragraph—paragraph tag. • strikethrough—strik" "ethrough tag. • underline—underline tag. • unorderedlist—unordered list tag. 2018apex reference guide connectapi enums enum description connectapi. type of mention completion. mentioncompletiontype • all—all mention completions, regardless of the type of record to which the mention refers. • group—mention completions for groups. • user—mention completions for users. connectapi. type of validation error for a proposed mention, if any. mentionvalidationstatus • disallowed—the proposed mention is invalid and is rejected because the context user is trying to mention something that is not allowed. for example, a user who is not a member of a private group is trying to mention the private group. • inaccessible—the proposed mention is allowed, but the user or record being mentioned isn’t notified. they don't have access to the parent record that’s being discussed. • ok—there is no validation error for this proposed mention. connectapi. type of message segment, such as text, link, field change name, or field change value. messagesegmenttype • entitylink • fieldchange • fieldchangename • fieldchangevalue • hashtag • inlineimage • link • markupbegin • markupend • mention • morechanges • resourcelink • text connectapi. type of named credential parameter. namedcredential • allowedmanagedpackagenamespaces parametertype • clientcertificate connectapi. type of named credential. namedcredentialtype • privateendpoint • securedendpoint connectapi. event, url type, or modal navigation menu item. navigationmenuitem • event—event-based navigation. actiontype note: event is internal only and can’t be used in custom components. 2019apex reference guide connectapi enums enum description • externallink—url outside of your experience cloud site. • internallink—relative url inside your experience cloud site. • modal—modal, such as account switcher. connectapi. target for the navigation menu item. navigationmenuitem • currentwindow—navigation menu item opens in the current window. opentarget • newwindow—navigation menu item opens in a new window. connectapi. type of navigation menu item. navigationmenuitemtype • datasourcedriven—menu items dynamically added from a data source. • event—event, such as logging in, logging out, or switching accounts. • externallink—url outside of your site. • globalaction—lets users create records that aren’t related to other records. • internallink—relative url inside your site. • menulabel—menu label. • modal—modal, such as account switcher. • navigationaltopic—dropdown list with links to the navigational topics in your site. • salesforceobject—objects such as accounts, cases, contacts, and custom objects. • systemlink—system link, such as a link to builder, workspaces, or setup. connectapi. type of action. nbaactiontype • flow—automated process tool with multiple subtypes. connectapi.nbaflowtype type of recommended flow. • autolaunchedflow—autolaunched flow that runs in the background. • flow—screen flow that accepts user inputs. connectapi. type of target. nbatargettype • recommendation connectapi. operation to carry out on the file. operationtype • add—adds the file to the feed element. • remove—removes the file from the feed element. connectapi. status of the orchestration instance. orchestrationinstancestatus • completed • inprogress • notstarted connectapi. type of orchestration step. orchestrationsteptype • asynchronousbackgroundstep 2020apex reference guide connectapi enums enum description • backgroundstep • interactivestep • managedcontentroleinteractivestep • managedcontentvariantsetlockbackgroundstep • managedcontentvariantsetreadybackgroundstep connectapi. status of the orchestration work item. orchestrationworkitemstatus • assigned • completed connectapi. sort order for order delivery group summaries. orderdeliverygroup • idasc—sorts by id in ascending alphanumeric order (a–z, 0–9). summarysort • iddesc" "—sorts by id in descending alphanumeric order (z–a, 9–0). connectapi. sort order for order item summaries. orderitemsummarysort • idasc—sorts by id in ascending alphanumeric order (a–z, 0–9). • iddesc—sorts by id in descending alphanumeric order (z–a, 9–0). connectapi. sort order for order shipment items. ordershipmentitemsort • idasc—sorts by id in ascending alphanumeric order (a–z, 0–9). • iddesc—sorts by id in descending alphanumeric order (z–a, 9–0). connectapi. sort order for order shipments. ordershipmentsort • expecteddeliverydateasc—sorts by the oldest expected delivery date. • expecteddeliverydatedesc—sorts by the most recent expected delivery date. • shipmentnumberasc—sorts by shipment number in ascending order (0–9). • shipmentnumberdesc—sorts by shipment number in descending order (9–0). connectapi.ordersummary order summary adjustment aggregate job status. adjustmentaggregates • failed—the adjustment aggregate data job for the order summary failed. status • inprogress—the adjustment aggregate data job for the order summary is in progress. • notinitiated—the adjustment aggregate data job for the order summary is not initiated. • submitted—the adjustment aggregate data job for the order summary is submitted. connectapi.ordersummary type of price adjustment in promotions. adjustmenttargettype • splitline—price adjustment on an order item. • header—price adjustment on the entire order. connectapi.ordersummary sort order for order summaries. sortorder • createddateasc—sorts by the oldest created date. 2021apex reference guide connectapi enums enum description • createddatedesc—sorts by the most recent created date. • ordereddateasc—sorts by the oldest ordered date. • ordereddatedesc—sorts by the most recent ordered date. connectapi.periodtype time period used for forecasting. • month • quarter • week • year connectapi. location of an action link group on an associated feed element. platformaction • primary—the action link group is displayed in the body of the feed element. groupcategory • overflow—the action link group is displayed in the overflow menu of the feed element. connectapi. status of the action. platformactionstatus • failedstatus—the action link execution failed. • newstatus—the action link is ready to be executed. available for download and ui action links only. • pendingstatus—the action link is executing. choosing this value triggers the api call for api and apiasync action links. • successfulstatus—the action link executed successfully. connectapi. type of platform action. platformactiontype • actionlink—an indicator on a feed element that targets an api, a web page, or a file, represented by a button in the salesforce ui. • custombutton—when clicked, opens a url or a visualforce page in a window or executes javascript. • productivityaction—productivity actions are predefined and attached to a limited set of objects. productivity actions include send email, call, map, view website, and read news. except for the call action, you can’t edit productivity actions. • quickaction—a global or object-specific action. • standardbutton—a predefined salesforce button such as new, edit, or delete. connectapi. type of price adjustment for the tier. priceadjustmenttiertype • amountbasedadjustment—price is adjusted by a specified amount. • percentagebasedadjustment—price is adjusted by a specified percentage. connectapi. unit of time used to define a pricing term. pricingtermunit • months—product is priced on a monthly basis. • annual—product is priced on an annual basis. 2022apex reference guide connectapi enums enum description connectapi.productclass class of product. • simple • variation • variationparent connectapi. type of product media. productmediatype • document • image • video connectapi. usage type of a product media item within a media group. productmediausagetype • attachment—product media group with product documents as attachments. • banner—product category media group with banner images of" "the product. • listing—product media group with listing images of the product. • standard—product media group with standard images and videos of the product. • tile—product category media group with tile images of the product. connectapi. publish refresh schedule. publishschedule • twelve—refreshes every twelve hours. • twentyfour—refreshes every twenty-four hours. connectapi. publish status of a personalization audience, target, or navigation menu item. publishstatus • draft • live connectapi. action to take on a recommendation. recommendationactiontype • follow—follow a file, record, topic, or user. • join—join a group. • view—view a file, group, article, record, user, custom, or static recommendation. connectapi. custom recommendation audience criteria type. recommendationaudience • customlist—a custom list of users makes up the audience. criteriatype • maxdaysincommunity—new members make up the audience. connectapi. operation to carry out on the custom recommendation audience members. recommendationaudience • add—adds specified members to the audience. memberoperationtype • remove—removes specified members from the audience. 2023apex reference guide connectapi enums enum description connectapi. a way to tie custom recommendations together. for example, display recommendations in recommendationchannel specific places in the ui or show recommendations based on time of day or geographic locations. • customchannel1—custom recommendation channel. not used by default. work with your community manager to define custom channels. for example, community managers can use experience builder to determine where recommendations appear. • customchannel2—custom recommendation channel. not used by default. work with your community manager to define custom channels. • customchannel3—custom recommendation channel. not used by default. work with your community manager to define custom channels. • customchannel4—custom recommendation channel. not used by default. work with your community manager to define custom channels. • customchannel5—custom recommendation channel. not used by default. work with your community manager to define custom channels. • defaultchannel—default recommendation channel. recommendations appear by default on the home and question detail pages of customer service and partner central experience builder templates. they also appear in the feed in the salesforce mobile web and anywhere community managers add recommendations using experience builder. connectapi. reason for a chatter recommendation. recommendationexplanationtype • articlehasrelatedcontent—articles with related content to a context article. • articleviewedtogether—articles often viewed together with the article that the context user just viewed. • articleviewedtogetherwithviewers—articles often viewed together with other records that the context user views. • custom—custom recommendations. • filepopular—files with many followers or views. • fileviewedtogether—files often viewed at the same time as other files that the context user views. • followedtogetherwithfollowees—users often followed together with other records that the context user follows. • groupmembersfollowed—groups with members that the context user follows. • groupnew—recently created groups. • grouppopular—groups with many active members. • itemviewedtogether—records often viewed at the same time as other records that the context user views. • popularapp—applications that are popular. • recordowned—records that the context user owns. • recordparentoffollowed—parent records of records that the context user follows. • recordviewed—records that the context user recently viewed. • topicfollowedtogether—topics often followed together with the record that the context user just followed. 2024apex reference guide connectapi enums enum description • topicfollowedtogetherwithfollowees—topics often followed together with other records that the context user follows. • topicpopularfollowed—topics with many followers. • topicpopularliked—topics on posts that have many likes. • userdirectreport—users who report to the context user. • userfollowedtogether—users often followed together with the record that the context user just followed. • userfollowssameusers—users who follow the same users as the context user. • usermanager—the context user’s manager. • usernew—recently created users. • userpeer—users who report to the same manager as the context user. • userpopular—users with many followers. • userviewingsamerecords—users who view the same records as the" "context user. connectapi. type of reaction to a recommendation. recommendationreactiontype • accepted • rejected connectapi. type of record being recommended. recommendationtype • apps • articles • files • groups • records • topics • users connectapi. type of object being recommended. recommendedobjecttype • today—static recommendations that don’t have an id, for example, the today app recommendation. connectapi. order in which fields are rendered in a grid. recordcolumnorder • leftright—fields are rendered from left to right. • topdown—fields are rendered from the top down. connectapi. data type of a record field. recordfieldtype • address • blank • boolean • compound 2025apex reference guide connectapi enums enum description • createdby • date • datetime • email • lastmodifiedby • location • name • number • percent • phone • picklist • reference • text • time connectapi. type of related feed post. relatedfeedposttype • answered—related questions that have at least one answer. • bestanswer—related questions that have a best answer. • generic—all types of related questions, including answered, with a best answer, and unanswered. • unanswered—related questions that don’t have answers. connectapi.segmenttype type of segment. • dbt—data build tool connectapi. type of product selling model. sellingmodeltype • evergreen—a subscription without an end date. an evergreen subscription continues until the shopper affirmatively cancels it. • onetime—a product that isn’t sold as a subscription. • termdefined—a subscription with a defined end date. the subscription continues for a specified time period. when the term ends, the subscription ends. connectapi. type of site search result item. sitespagetype • contentpage • sitepage connectapi. social network provider. socialnetworkprovider • facebook • googleplus • instagram 2026apex reference guide connectapi enums enum description • instagrambusiness • kakaotalk • kik • line • linkedin • messenger • other • pinterest • qq • rypple • sinaweibo • sms • snapchat • telegram • twitter • vkontakte • wechat • whatsapp • youtube connectapi.socialpost message type of the social post. messagetype • comment • direct • post • privatemessage • reply • retweet • tweet connectapi. state of the social post. socialpoststatustype • approvalpending • approvalrecalled • approvalrejected • deleted • failed • hidden • pending • sent • unknown 2027apex reference guide connectapi enums enum description connectapi.sortorder order for sorting. • ascending—items are in ascending alphabetical order (a-z). • descending—items are in descending alphabetical order (z-a). • mostrecentlyviewed—items are in descending chronological order by view. this sort order is valid only for chatter feed streams. connectapi. status of a survey invitation email. surveyemailstatusenum • failed—the survey invitation email wasn't sent. • queued—the survey invitation email is queued for sending. connectapi. status of a tax transaction. taxtransactionstatus • committed—tax has been committed to the transaction. • uncommitted—tax hasn’t been committed to the transaction. connectapi. type of tax transaction. taxtransactiontype • credit—transaction is a credit transaction. • debit—transaction is a debit transaction. connectapi.topicsort order returned by the sort. • populardesc—sorts topics by popularity with the most popular first. this value is the default. • alphaasc—sorts topics alphabetically. connectapi. type of vote for a feed element or comment. updownvotevalue • down • none • up connectapi.useractivitytype type of user activity. • bookmark—user bookmarked a post. • chatteractivity—total counts of posts and comments made and likes and comments received for a user. • chatterlike—user liked a post or comment. • comment" "—user commented on a post. • companyverify—user verified comment. • downvote—user downvoted a post or comment. • feedentityread—user read a post. • feedread—user read a feed. • mute—user muted a post. • post—user made a post. 2028apex reference guide connectapi enums enum description • topicendorsement—user endorsed another user on a topic or received endorsement on a topic. • upvote—user upvoted a post or comment. connectapi.usermission type of mission activity for a user. activitytype • feeditemansweraquestion—user answered a question. • feeditemlikesomething—user liked a post or comment. • feeditemmarkanswerasbest—user marked an answer as the best answer. • feeditempostquestion—user posted a question. • feeditemreceiveacomment—user received a comment on a post. • feeditemreceivealike—user received a like on a post or comment. • feeditemreceiveananswer—user received an answer to a question. • feeditemwriteacomment—user commented on a post. • feeditemwriteapost—user made a post. • feeditemyouranswermarkedbest—user’s answer was marked as the best answer. connectapi.userprofile type of user profile tab. tabtype • customvisualforce—tab that displays data from a visualforce page. • customweb—tab that displays data from any external web-based application or web page. • element—tab that displays generic content inline. • feed—tab that displays the chatter feed. • overview—tab that displays user details. connectapi.usertype type of user. • chatterguest—user is an external user in a private group. • chatteronly—user is a chatter free customer. • guest—user is unauthenticated. • internal—user is a standard org member. • portal—user is an external user in an experience cloud site. • system—user is chatter expert or a system user. • undefined—user is a user type that is a custom object. connectapi.wishlistitem sort order for wishlist items. sortorder • createddateasc—sorts by oldest creation date. • createddatedesc—sorts by most recent creation date. connectapi. status of a workflow process. workflowprocessstatus • approved • fault 2029apex reference guide connectapi exceptions enum description • held • noresponse • pending • reassigned • rejected • removed • started connectapi.zonesearch zone search result type. resulttype • article—search results contain only articles. • question—search results contain only questions. connectapi.zoneshowin zone search result location. • community—available in an experience cloud site. • internal—available internally only. • portal—available in a portal. connectapi exceptions the connectapi namespace contains exception classes. all exceptions classes support built-in methods for returning the error message and exception type. see exception class and built-in exceptions on page 3021. the connectapi namespace contains these exceptions: exception description connectapi.connectapiexception any logic error in the way your application is utilizing connectapi code. this is equivalent to receiving a 400 error from connect rest api. connectapi.notfoundexception any issues with the specified resource being found. this is equivalent to receiving a 404 error from connect rest api. connectapi.ratelimitexception when you exceed the rate limit. this is equivalent to receiving a 503 service unavailable error from connect rest api. connectapi utilities the connectapi namespace contains a utility class. utility description connectapi.connectutilities.unwrapapexwrapper() reserved for internal use. 2030apex reference guide connectapi release notes connectapi release notes use the salesforce release notes to learn about the most recent updates and changes to the connectapi namespace in apex. for updates and changes that impact apex, including connectapi, see the apex release notes. for new and changed connectapi classes and enums, see connectapi (connect in apex): new and changed classes and enums in the salesforce release notes. database namespace the database namespace provides classes used with dml operations. the following are the classes in the database namespace. in this section: batch" "able interface the class that implements this interface can be executed as a batch apex job. batchablecontext interface represents the parameter type of a batch job method and contains the batch job id. this interface is implemented internally by apex. deletedrecord class contains information about a deleted record. deleteresult class represents the result of a delete dml operation returned by the database.delete method. dmloptions class enables you to set options related to dml operations. dmloptions.assignmentruleheader class enables setting assignment rule options. dmloptions.duplicateruleheader class determines options for using duplicate rules to detect duplicate records. duplicate rules are part of the duplicate management feature. dmloptions.emailheader class enables setting email options. duplicateerror class contains information about an error that occurred when an attempt was made to save a duplicate record. use if your organization has set up duplicate rules, which are part of the duplicate management feature. emptyrecyclebinresult class the result of the emptyrecyclebin dml operation returned by the database.emptyrecyclebin method. error class represents information about an error that occurred during a dml operation when using a database method. getdeletedresult class contains the deleted records retrieved for a specific sobject type and time window. 2031apex reference guide batchable interface getupdatedresult class contains the result for the database.getupdated method call. leadconvert class contains information used for lead conversion. leadconvertresult class the result of a lead conversion. mergeresult class contains the result of a merge database method operation. querylocator class represents the record set returned by database.getquerylocator and used with batch apex. querylocatoriterator class represents an iterator over a query locator record set. saveresult class the result of an insert or update dml operation returned by a database method. undeleteresult class the result of an undelete dml operation returned by the database.undelete method. upsertresult class the result of an upsert dml operation returned by the database.upsert method. batchable interface the class that implements this interface can be executed as a batch apex job. namespace database see also: apex developer guide: using batch batchable methods the following are methods for batchable. in this section: execute(jobid, recordlist) gets invoked when the batch job executes and operates on one batch of records. contains or calls the main execution logic for the batch job. finish(jobid) gets invoked when the batch job finishes. place any clean up code in this method. start(jobid) gets invoked when the batch job starts. returns the record set as an iterable that will be batched for execution. 2032" "apex reference guide batchable interface start(jobid) gets invoked when the batch job starts. returns the record set as a querylocator object that will be batched for execution. execute(jobid, recordlist) gets invoked when the batch job executes and operates on one batch of records. contains or calls the main execution logic for the batch job. signature public void execute(database.batchablecontext jobid, list recordlist) parameters jobid type: database.batchablecontext contains the job id. recordlist type: list contains the batch of records to process. return value type: void finish(jobid) gets invoked when the batch job finishes. place any clean up code in this method. signature public void finish(database.batchablecontext jobid) parameters jobid type: database.batchablecontext contains the job id. return value type: void start(jobid) gets invoked when the batch job starts. returns the record set as an iterable that will be batched for execution. 2033apex reference guide batchablecontext interface signature public system.iterable start(database.batchablecontext jobid) parameters jobid type: database.batchablecontext contains the job id. return value type: system.iterable start(jobid) gets invoked when the batch job starts. returns the record set as a querylocator object that will be batched for execution. signature public database.querylocator start(database.batchablecontext jobid) parameters jobid type: database.batchablecontext contains the job id. return value type: database.querylocator batchablecontext interface represents the parameter type of a batch job method and contains the batch job id. this interface is implemented internally by apex. namespace database see also: batchable interface batchablecontext methods the following are methods for batchablecontext. 2034apex reference guide deletedrecord class in this section: getchildjobid() returns the id of the current batch job chunk that is being processed. getjobid() returns the batch job id. getchildjobid() returns the id of the current batch job chunk that is being processed. signature public id getchildjobid() return value type: id getjobid() returns the batch job id. signature public id getjobid() return value type: id deletedrecord class contains information about a deleted record. namespace database usage the getdeletedrecords method of the database.getdeletedresult class returns a list of database.deletedrecord objects. use the methods in the database.deletedrecord class to retrieve details about each deleted record. deletedrecord methods the following are methods for deletedrecord. all are instance methods. 2035apex reference guide deleteresult class in this section: getdeleteddate() returns the deleted date of this record. getid() returns the id of a record deleted within the time window specified in the database.getdeleted method. getdeleteddate() returns the deleted date of this record. signature public date getdeleteddate() return value type: date getid() returns the id of a record deleted within the time window specified in the database.getdeleted method. signature public id getid() return value type: id deleteresult class represents the result of a delete dml operation returned by the database.delete method. namespace database usage an array of database.deleteresult objects is returned with the delete database method. each element in the deleteresult array corresponds to the sobject array passed as the sobject[] parameter in the delete database method; that is, the first element in the deleteresult array matches the first element passed in the sobject array, the second element corresponds with the second element, and so on. if only one sobject is passed in, the deleteresult array contains a single element. 2036apex reference guide deleteresult class example the following example shows how to obtain and iterate through the returned database.deleteresult objects. it deletes some queried accounts using database.delete with a false second parameter to allow partial processing of records on failure. next, it iterates through the results to determine whether the operation was successful or not for each record. it writes the id of every" "record that was processed successfully to the debug log, or error messages and fields of the failed records. // query the accounts to delete account[] accts = [select id from account where name like 'acme%']; // delete the accounts database.deleteresult[] drlist = database.delete(accts, false); // iterate through each returned result for(database.deleteresult dr : drlist) { if (dr.issuccess()) { // operation was successful, so get the id of the record that was processed system.debug('successfully deleted account with id: ' + dr.getid()); } else { // operation failed, so get all errors for(database.error err : dr.geterrors()) { system.debug('the following error has occurred.'); system.debug(err.getstatuscode() + ': ' + err.getmessage()); system.debug('account fields that affected this error: ' + err.getfields()); } } } deleteresult methods the following are methods for deleteresult. all are instance methods. in this section: geterrors() if an error occurred, returns an array of one or more database error objects providing the error code and description. if no error occurred, returns an empty set. getid() returns the id of the sobject you were trying to delete. issuccess() a boolean value that is set to true if the dml operation was successful for this object, false otherwise. geterrors() if an error occurred, returns an array of one or more database error objects providing the error code and description. if no error occurred, returns an empty set. signature public database.error[] geterrors() 2037apex reference guide dmloptions class return value type: database.error[] getid() returns the id of the sobject you were trying to delete. signature public id getid() return value type: id issuccess() a boolean value that is set to true if the dml operation was successful for this object, false otherwise. signature public boolean issuccess() return value type: boolean dmloptions class enables you to set options related to dml operations. namespace database usage database.dmloptions is only available for apex saved against api versions 15.0 and higher. dmloptions settings take effect only for record operations performed using apex dml and not through the salesforce user interface. the dmloptions class has three child options. dml child options dmloptions.assignmentruleheader—enables setting assignment rule options. dmloptions.duplicateruleheader—determines options for using duplicate rules to detect duplicate records. duplicate rules are part of the duplicate management feature. dmloptions.emailheader—enables setting email options. 2038apex reference guide dmloptions class dmloptions properties the following are properties for dmloptions. in this section: allowfieldtruncation specifies the truncation behavior of large strings. assignmentruleheader specifies the assignment rule to be used when creating a case or lead. emailheader specifies additional information regarding the automatic email that gets sent when an events occurs. localeoptions specifies the language of any labels that are returned by apex. optallornone specifies whether the operation allows for partial success. allowfieldtruncation specifies the truncation behavior of large strings. signature public boolean allowfieldtruncation {get; set;} property value type: boolean usage in apex saved against api versions previous to 15.0, if you specify a value for a string and that value is too large, the value is truncated. for api version 15.0 and later, if a value is specified that is too large, the operation fails and an error message is returned. the allowfieldtruncation property allows you to specify that the previous behavior, truncation, be used instead of the new behavior in apex saved against api versions 15.0 and later. assignmentruleheader specifies the assignment rule to be used when creating a case or lead. signature public database.dmloptions.assignmentruleheader assignmentruleheader {get; set;} property value type: database.dmloptions.assignmentruleheader 2039apex reference guide dmloptions class usage note: the database.dmloptions object supports assignment rules for cases and leads, but not for accounts. emailheader specifies additional information regarding the automatic email that gets sent when an events" "occurs. signature public database.dmloptions.emailheader emailheader {get; set;} property value type: database.dmloptions.emailheader usage the salesforce user interface allows you to specify whether or not to send an email when the following events occur. • creation of a new case or task • conversion of a case email to a contact • new user email notification • lead queue email notification • password reset in apex saved against api version 15.0 or later, the database.dmloptions emailheader property enables you to specify additional information regarding the email that gets sent when one of the events occurs because of the code's execution. localeoptions specifies the language of any labels that are returned by apex. signature public database.dmloptions.localeoptions localeoptions {get; set;} property value type: database.dmloptions.localeoptions usage the value must be a valid user locale (language and country), such as de_de or en_gb. the value is a string, 2-5 characters long. the first two characters are always an iso language code, for example 'fr' or 'en.' if the value is further qualified by a country, then the string also has an underscore (_) and another iso country code, for example 'us' or 'uk'. for example, the string for the united states is 'en_us', and the string for french canadian is 'fr_ca'. optallornone specifies whether the operation allows for partial success. 2040apex reference guide dmloptions.assignmentruleheader class signature public boolean optallornone {get; set;} property value type: boolean usage if optallornone is set to true, all changes are rolled back if any record causes errors. the default for this property is false and successfully processed records are committed while records with errors aren't. this property is available in apex saved against salesforce api version 20.0 and later. dmloptions.assignmentruleheader class enables setting assignment rule options. namespace database example the following example uses the usedefaultrule option: database.dmloptions dmo = new database.dmloptions(); dmo.assignmentruleheader.usedefaultrule= true; lead l = new lead(company='abc', lastname='smith'); l.setoptions(dmo); insert l; the following example uses the assignmentruleid option: database.dmloptions dmo = new database.dmloptions(); dmo.assignmentruleheader.assignmentruleid= '01qd0000000eqan'; lead l = new lead(company='abc', lastname='smith'); l.setoptions(dmo); insert l; dmloptions.assignmentruleheader properties the following are properties for dmloptions.assignmentruleheader. in this section: assignmentruleid specifies the id of a specific assignment rule to run for the case or lead. the assignment rule can be active or inactive. 2041apex reference guide dmloptions.duplicateruleheader class usedefaultrule if specified as true for a case or lead, the system uses the default (active) assignment rule for the case or lead. if specified, do not specify an assignmentruleid. assignmentruleid specifies the id of a specific assignment rule to run for the case or lead. the assignment rule can be active or inactive. signature public id assignmentruleid {get; set;} property value type: id usage the id can be retrieved by querying the assignmentrule sobject. if specified, do not specify usedefaultrule. if the value is not in the correct id format (15-character or 18-character salesforce id), the call fails and an exception is returned. usedefaultrule if specified as true for a case or lead, the system uses the default (active) assignment rule for the case or lead. if specified, do not specify an assignmentruleid. signature public boolean usedefaultrule {get; set;} property value type: boolean usage if there are no assignment rules in the organization, in api version 29.0 and earlier, creating a case or lead with usedefaultrule set to true results in the case or lead being assigned to the predefined default owner. in api version 30.0 and later, the case or lead is unassigned and doesn't get assigned to the default owner. dmloptions.duplicateruleheader class determines options for using duplicate rules to detect duplicate records. duplicate rules are part of the duplicate" "management feature. namespace database 2042apex reference guide dmloptions.duplicateruleheader class example the following example shows how to save an account record that’s been identified as a duplicate. to learn how to iterate through duplicate errors, see duplicateerror class database.dmloptions dml = new database.dmloptions(); dml.duplicateruleheader.allowsave = true; dml.duplicateruleheader.runascurrentuser = true; account duplicateaccount = new account(name='dupe'); database.saveresult sr = database.insert(duplicateaccount, dml); if (sr.issuccess()) { system.debug('duplicate account has been inserted in salesforce!'); } in this section: dmloptions.duplicateruleheader properties dmloptions.duplicateruleheader properties the following are properties for dmloptions.duplicateruleheader. in this section: allowsave for a duplicate rule, when the alert option is enabled, bypass alerts and save duplicate records by setting this property to true. prevent duplicate records from being saved by setting this property to false. runascurrentuser make sure that sharing rules for the current user are enforced when duplicate rules run by setting this property to true. use the sharing rules specified in the class for the request by setting this property to false. if no sharing rules are specified, apex code runs in system context and sharing rules for the current user are not enforced. allowsave for a duplicate rule, when the alert option is enabled, bypass alerts and save duplicate records by setting this property to true. prevent duplicate records from being saved by setting this property to false. signature public boolean allowsave {get; set;} property value type: boolean 2043apex reference guide dmloptions.emailheader class example this example shows how to save an account record that’s been identified as a duplicate. dml.duplicateruleheader.allowsave = true means the user should be allowed to save the duplicate. to learn how to iterate through duplicate errors, see duplicateerror class. database.dmloptions dml = new database.dmloptions(); dml.duplicateruleheader.allowsave = true; dml.duplicateruleheader.runascurrentuser = true; account duplicateaccount = new account(name='dupe'); database.saveresult sr = database.insert(duplicateaccount, dml); if (sr.issuccess()) { system.debug('duplicate account has been inserted in salesforce!'); } runascurrentuser make sure that sharing rules for the current user are enforced when duplicate rules run by setting this property to true. use the sharing rules specified in the class for the request by setting this property to false. if no sharing rules are specified, apex code runs in system context and sharing rules for the current user are not enforced. signature public boolean runascurrentuser {get; set;} property value type: boolean usage if specified as true, duplicate rules run for the current user, which ensures users can’t view duplicate records that aren’t available to them. use runascurrentuser = true to detect duplicates when converting leads to contacts. typically, lead conversion apex code runs in a system context and does not enforce sharing rules for the current user. example this example shows how to set options so that duplicate rules run for the current user when saving a new account. database.dmloptions dml = new database.dmloptions(); dml.duplicateruleheader.allowsave = true; dml.duplicateruleheader.runascurrentuser = true; account duplicateaccount = new account(name='dupe'); database.saveresult sr = database.insert(duplicateaccount, dml); if (sr.issuccess()) { system.debug('duplicate account has been inserted in salesforce!'); } dmloptions.emailheader class enables setting email options. 2044apex reference guide dmloptions.emailheader class namespace database usage even though auto-sent emails can be triggered by actions in the salesforce user interface, the dmloptions settings for emailheader take effect only for dml operations carried out in apex code. example in the following example, the triggerautoresponseemail option is specified: account a = new account(name='acme plumbing'); insert a; contact c = new contact(email='jplumber@salesforce.com'," "firstname='joe',lastname='plumber', accountid=a.id); insert c; database.dmloptions dlo = new database.dmloptions(); dlo.emailheader.triggerautoresponseemail = true; case ca = new case(subject='plumbing problems', contactid=c.id); database.insert(ca, dlo); suppose that you use an after-insert or after-update trigger to change ownership of leads, contacts, or opportunities. if you use the api to change record ownership, or if a lightning experience user changes a record’s owner, no email notification is sent. to send email notifications to a record’s new owner, set the triggeruseremail property to true. dmloptions.emailheader properties the following are properties for dmloptions.emailheader. in this section: triggerautoresponseemail indicates whether to trigger auto-response rules (true) or not (false), for leads and cases. triggerotheremail indicates whether to trigger email outside the organization (true) or not (false). triggeruseremail indicates whether to trigger email that is sent to users in the organization (true) or not (false). triggerautoresponseemail indicates whether to trigger auto-response rules (true) or not (false), for leads and cases. 2045apex reference guide dmloptions.emailheader class signature public boolean triggerautoresponseemail {get; set;} property value type: boolean usage this email can be automatically triggered by a number of events, for example creating a case or resetting a user password. if this value is set to true, when a case is created, if there is an email address for the contact specified in contactid, the email is sent to that address. if not, the email is sent to the address specified in suppliedemail triggerotheremail indicates whether to trigger email outside the organization (true) or not (false). signature public boolean triggerotheremail {get; set;} property value type: boolean usage this email can be automatically triggered by creating, editing, or deleting a contact for a case. note: email sent through apex because of a group event includes additional behaviors. a group event is an event for which isgroupevent is true. the eventattendee object tracks the users, leads, or contacts that are invited to a group event. note the following behaviors for group event email sent through apex: • sending a group event invitation to a lead or contact respects the triggerotheremail option • email sent when updating or deleting a group event also respects the triggeruseremail and triggerotheremail options, as appropriate triggeruseremail indicates whether to trigger email that is sent to users in the organization (true) or not (false). signature public boolean triggeruseremail {get; set;} property value type: boolean 2046apex reference guide duplicateerror class usage this email can be automatically triggered by a number of events; resetting a password, creating a new user, or creating or modifying a task. note: adding comments to a case in apex doesn’t trigger email to users in the organization even if triggeruseremail is set to true. note: email sent through apex because of a group event includes additional behaviors. a group event is an event for which isgroupevent is true. the eventattendee object tracks the users, leads, or contacts that are invited to a group event. note the following behaviors for group event email sent through apex: • sending a group event invitation to a user respects the triggeruseremail option • email sent when updating or deleting a group event also respects the triggeruseremail and triggerotheremail options, as appropriate duplicateerror class contains information about an error that occurred when an attempt was made to save a duplicate record. use if your organization has set up duplicate rules, which are part of the duplicate management feature. namespace database example when you try to save a record that’s identified as a duplicate record by a duplicate rule, you’ll receive a duplicate error. if the duplicate rule contains the allow action, an attempt will be made to bypass the error. // try to save a duplicate account account duplicateaccount = new account(name='acme', billingcity='san francisco'); database.saveresult sr = database.insert(duplicateaccount, false); if (!sr.issuccess()) { // insertion failed due to duplicate detected for(database.error duplicateerror : sr.geterrors()){ datacloud.duplicateresult duplicateresult = ((database.dupl" "icateerror)duplicateerror).getduplicateresult(); system.debug('duplicate records have been detected by ' + duplicateresult.getduplicaterule()); system.debug(duplicateresult.geterrormessage()); } // if the duplicate rule is an alert rule, we can try to bypass it database.dmloptions dml = new database.dmloptions(); dml.duplicateruleheader.allowsave = true; database.saveresult sr2 = database.insert(duplicateaccount, dml); if (sr2.issuccess()) { system.debug('duplicate account has been inserted in salesforce!'); } } 2047apex reference guide duplicateerror class in this section: duplicateerror methods see also: saveresult class duplicateresult class error class duplicateerror methods the following are methods for duplicateerror. in this section: getduplicateresult() returns the details of a duplicate rule and duplicate records found by the duplicate rule. getfields() returns an array of one or more field names. identifies which fields in the object, if any, affected the error condition. getmessage() returns the error message text. getstatuscode() returns a code that characterizes the error. getduplicateresult() returns the details of a duplicate rule and duplicate records found by the duplicate rule. signature public datacloud.duplicateresult getduplicateresult() return value type: datacloud.duplicateresult example this example shows the code used to get the possible duplicates and related match information after saving a new contact. this code is part of a custom application that implements duplicate management when users add a contact. see duplicateresult class on page 2079 to check out the entire sample applicaton. datacloud.duplicateresult duplicateresult = duplicateerror.getduplicateresult(); getfields() returns an array of one or more field names. identifies which fields in the object, if any, affected the error condition. 2048apex reference guide emptyrecyclebinresult class signature public list getfields() return value type: list getmessage() returns the error message text. signature public string getmessage() return value type: string getstatuscode() returns a code that characterizes the error. signature public statuscode getstatuscode() return value type: statuscode emptyrecyclebinresult class the result of the emptyrecyclebin dml operation returned by the database.emptyrecyclebin method. namespace database usage a list of database.emptyrecyclebinresult objects is returned by the database.emptyrecyclebin method. each object in the list corresponds to either a record id or an sobject passed as the parameter in the database.emptyrecyclebin method. the first index in the emptyrecyclebinresult list matches the first record or sobject specified in the list, the second with the second, and so on. emptyrecyclebinresult methods the following are methods for emptyrecyclebinresult. all are instance methods. 2049apex reference guide error class in this section: geterrors() if an error occurred during the delete for this record or sobject, returns a list of one or more database.error objects. if no errors occurred, the returned list is empty. getid() returns the id of the record or sobject you attempted to delete. issuccess() returns true if the record or sobject was successfully removed from the recycle bin; otherwise false. geterrors() if an error occurred during the delete for this record or sobject, returns a list of one or more database.error objects. if no errors occurred, the returned list is empty. signature public database.errors[] geterrors() return value type: database.errors [] getid() returns the id of the record or sobject you attempted to delete. signature public id getid() return value type: id issuccess() returns true if the record or sobject was successfully removed from the recycle bin; otherwise false. signature public boolean issuccess() return value type: boolean error class represents information about an error that occurred during a dml operation when using a database method. 2050apex reference guide error class namespace database usage error class is part of" "saveresult, which is generated when a user attempts to save a salesforce record. see also: saveresult class duplicateerror class error methods the following are methods for error. all are instance methods. in this section: getfields() returns an array of one or more field names. identifies which fields in the object, if any, affected the error condition. getmessage() returns the error message text. getstatuscode() returns a code that characterizes the error. getfields() returns an array of one or more field names. identifies which fields in the object, if any, affected the error condition. signature public string[] getfields() return value type: string[] getmessage() returns the error message text. signature public string getmessage() return value type: string 2051apex reference guide getdeletedresult class getstatuscode() returns a code that characterizes the error. signature public statuscode getstatuscode() return value type: statuscode usage the full list of status codes is available in the wsdl file for your organization (see downloading salesforce wsdls and client authentication certificates in the salesforce online help.) getdeletedresult class contains the deleted records retrieved for a specific sobject type and time window. namespace database usage the database.getdeleted method returns the deleted record information as a database.getdeletedresult object. getdeletedresult methods the following are methods for getdeletedresult. all are instance methods. in this section: getdeletedrecords() returns a list of deleted records for the time window specified in the database.getdeleted method call. getearliestdateavailable() returns the date in coordinated universal time (utc) of the earliest physically deleted object for the sobject type specified in database.getdeleted. getlatestdatecovered() returns the date in coordinated universal time (utc) of the last date covered in the database.getdeleted call. getdeletedrecords() returns a list of deleted records for the time window specified in the database.getdeleted method call. 2052apex reference guide getupdatedresult class signature public list getdeletedrecords() return value type: list getearliestdateavailable() returns the date in coordinated universal time (utc) of the earliest physically deleted object for the sobject type specified in database.getdeleted. signature public date getearliestdateavailable() return value type: date getlatestdatecovered() returns the date in coordinated universal time (utc) of the last date covered in the database.getdeleted call. signature public date getlatestdatecovered() return value type: date usage if there is a value, it is less than or equal to the enddate argument of database.getdeleted. a value here indicates that, for safety, you should use this value for the startdate of your next call to capture the changes that started after this date but didn’t complete before enddate and were, therefore, not returned in the previous call. getupdatedresult class contains the result for the database.getupdated method call. namespace database 2053apex reference guide leadconvert class usage use the methods in this class to obtain detailed information about the updated records returned by database.getupdated for a specific time window. getupdatedresult methods the following are methods for getupdatedresult. all are instance methods. in this section: getids() returns the ids of records updated within the time window specified in the database.getupdated method. getlatestdatecovered() returns the date in coordinated universal time (utc) of the last date covered in the database.getupdated call. getids() returns the ids of records updated within the time window specified in the database.getupdated method. signature public list getids() return value type: list getlatestdatecovered() returns the date in coordinated universal time (utc) of the last date covered in the database.getupdated call. signature public date getlatestdatecovered() return value type: date leadconvert class contains information used for lead conversion. namespace database 2054apex reference guide leadconvert class usage the convertlead database method converts a lead into an account and contact or an account and person account, as well" "as (optionally) an opportunity. the convertlead takes an instance of the database.leadconvert class as a parameter. create an instance of this class and set the information required for conversion, such as setting the lead, and destination account and contact. note: the database.convertlead() method can take one leadconvert object or a list of leadconvert objects. example this example shows how to use the database.convertlead method to convert a lead. it inserts a new lead, creates a leadconvert object, sets its status to converted, then passes it to the database.convertlead method. finally, it verifies that the conversion was successful. lead mylead = new lead(lastname = 'fry', company='fry and sons'); insert mylead; database.leadconvert lc = new database.leadconvert(); lc.setleadid(mylead.id); leadstatus convertstatus = [select id, masterlabel from leadstatus where isconverted=true limit 1]; lc.setconvertedstatus(convertstatus.masterlabel); database.leadconvertresult lcr = database.convertlead(lc); system.assert(lcr.issuccess()); in this section: leadconvert constructors leadconvert methods leadconvert constructors the following are constructors for leadconvert. in this section: leadconvert() creates a new instance of the database.leadconvert class. leadconvert() creates a new instance of the database.leadconvert class. signature public leadconvert() 2055apex reference guide leadconvert class leadconvert methods the following are methods for leadconvert. all are instance methods. in this section: getaccountid() gets the id of the account into which the lead will be merged. getcontactid() gets the id of the contact into which the lead will be merged. getconvertedstatus() gets the lead status value for a converted lead. getleadid() gets the id of the lead to convert. getopportunityid() gets the id of the existing opportunity that will be related to the resulting contact. getopportunityname() gets the name of the opportunity to create. getownerid() gets the id of the person to own any newly created account, contact, and opportunity. getrelatedpersonaccountid() gets the id of the existing person account into which the lead will be converted. getrelatedpersonaccountrecord() gets the entity record of the new person account into which the lead will be converted. isdonotcreateopportunity() indicates whether an opportunity is created during lead conversion (false, the default) or not (true). isoverwriteleadsource() indicates whether the leadsource field on the target contact object is overwritten with the contents of the leadsource field in the source lead object (true), or not (false, the default). issendnotificationemail() indicates whether a notification email is sent to the owner specified by setownerid (true) or not (false, the default). setaccountid(accountid) sets the id of the account into which the lead is merged. this value is required only when updating an existing account, including person accounts. setcontactid(contactid) sets the id of the contact into which the lead will be merged (this contact must be associated with the account specified with setaccountid, and setaccountid must be specified). this value is required only when updating an existing contact. setconvertedstatus(status) sets the lead status value for a converted lead. this field is required. setdonotcreateopportunity(createopportunity) specifies whether to create an opportunity during lead conversion. the default value is false: opportunities are created by default. set this flag to true only if you do not want to create an opportunity from the lead. 2056apex reference guide leadconvert class setleadid(leadid) sets the id of the lead to convert. this field is required. setopportunityid(opportunityid) sets the id of the opportunity into which the lead is merged. this value is required only when updating an existing opportunity. setopportunityname(opportunityname) sets the name of the opportunity to create. if no name is specified, this value defaults to the company name of the lead. setoverwriteleadsource(overwriteleadsource) specifies whether to overwrite the leadsource field on the target contact object" "with the contents of the leadsource field in the source lead object. the default value is false, to not overwrite the field. if you specify this as true, you must also specify setcontactid for the target contact. setownerid(ownerid) specifies the id of the person to own any newly created account, contact, and opportunity. if the application does not specify this value, the owner of the new object will be the owner of the lead. setrelatedpersonaccountid(relatedpersonaccountid) sets the id of the existing person account into which to convert the lead. this value is required only when updating an existing person account. setrelatedpersonaccountrecord(entity relatedpersonaccountrecord) sets the entity record of the new person account into which to convert the lead. setsendnotificationemail(sendemail) specifies whether to send a notification email to the owner specified by setownerid. the default value is false, that is, to not send email. getaccountid() gets the id of the account into which the lead will be merged. signature public id getaccountid() return value type: id getcontactid() gets the id of the contact into which the lead will be merged. signature public id getcontactid() return value type: id 2057apex reference guide leadconvert class getconvertedstatus() gets the lead status value for a converted lead. signature public string getconvertedstatus() return value type: string getleadid() gets the id of the lead to convert. signature public id getleadid() return value type: id getopportunityid() gets the id of the existing opportunity that will be related to the resulting contact. signature public id getopportunityid() return value type: id getopportunityname() gets the name of the opportunity to create. signature public string getopportunityname() return value type: string getownerid() gets the id of the person to own any newly created account, contact, and opportunity. 2058apex reference guide leadconvert class signature public id getownerid() return value type: id getrelatedpersonaccountid() gets the id of the existing person account into which the lead will be converted. signature public id getrelatedpersonaccountid() return value type: id getrelatedpersonaccountrecord() gets the entity record of the new person account into which the lead will be converted. signature public id getrelatedpersonaccountrecord() return value type: id isdonotcreateopportunity() indicates whether an opportunity is created during lead conversion (false, the default) or not (true). signature public boolean isdonotcreateopportunity() return value type: boolean isoverwriteleadsource() indicates whether the leadsource field on the target contact object is overwritten with the contents of the leadsource field in the source lead object (true), or not (false, the default). 2059apex reference guide leadconvert class signature public boolean isoverwriteleadsource() return value type: boolean issendnotificationemail() indicates whether a notification email is sent to the owner specified by setownerid (true) or not (false, the default). signature public boolean issendnotificationemail() return value type: boolean setaccountid(accountid) sets the id of the account into which the lead is merged. this value is required only when updating an existing account, including person accounts. signature public void setaccountid(id accountid) parameters accountid type: id return value type: void setcontactid(contactid) sets the id of the contact into which the lead will be merged (this contact must be associated with the account specified with setaccountid, and setaccountid must be specified). this value is required only when updating an existing contact. signature public void setcontactid(id contactid) parameters contactid type: id 2060apex reference guide leadconvert class return value type: void usage if setcontactid is specified, then the application creates a new contact that is implicitly associated with the account. the contact name and other existing data are not overwritten (unless setoverwriteleadsource is set to true, in which case only the leadsource field is overwritten). important: if you are converting a lead into a person account," "do not specify setcontactid or an error will result. specify only setaccountid of the person account. setconvertedstatus(status) sets the lead status value for a converted lead. this field is required. signature public void setconvertedstatus(string status) parameters status type: string return value type: void setdonotcreateopportunity(createopportunity) specifies whether to create an opportunity during lead conversion. the default value is false: opportunities are created by default. set this flag to true only if you do not want to create an opportunity from the lead. signature public void setdonotcreateopportunity(boolean createopportunity) parameters createopportunity type: boolean return value type: void setleadid(leadid) sets the id of the lead to convert. this field is required. 2061apex reference guide leadconvert class signature public void setleadid(id leadid) parameters leadid type: id return value type: void setopportunityid(opportunityid) sets the id of the opportunity into which the lead is merged. this value is required only when updating an existing opportunity. signature public void setopportunityid(id opportunityid) parameters opportunityid type: id return value type: void setopportunityname(opportunityname) sets the name of the opportunity to create. if no name is specified, this value defaults to the company name of the lead. signature public void setopportunityname(string opportunityname) parameters opportunityname type: string return value type: void usage the maximum length of this field is 80 characters. 2062apex reference guide leadconvert class if setdonotcreateopportunity is true, no opportunity is created and this field must be left blank; otherwise, an error is returned. setoverwriteleadsource(overwriteleadsource) specifies whether to overwrite the leadsource field on the target contact object with the contents of the leadsource field in the source lead object. the default value is false, to not overwrite the field. if you specify this as true, you must also specify setcontactid for the target contact. signature public void setoverwriteleadsource(boolean overwriteleadsource) parameters overwriteleadsource type: boolean return value type: void setownerid(ownerid) specifies the id of the person to own any newly created account, contact, and opportunity. if the application does not specify this value, the owner of the new object will be the owner of the lead. signature public void setownerid(id ownerid) parameters ownerid type: id return value type: void usage this method is not applicable when merging with existing objects—if setownerid is specified, the ownerid field is not overwritten in an existing account or contact. setrelatedpersonaccountid(relatedpersonaccountid) sets the id of the existing person account into which to convert the lead. this value is required only when updating an existing person account. 2063apex reference guide leadconvertresult class signature public void setrelatedpersonaccountid(id relatedpersonaccountid) parameters relatedpersonaccountid type: id return value type: void setrelatedpersonaccountrecord(entity relatedpersonaccountrecord) sets the entity record of the new person account into which to convert the lead. signature public void setrelatedpersonaccountrecord(entity relatedpersonaccountrecord) parameters relatedpersonaccountrecord type: id return value type: void setsendnotificationemail(sendemail) specifies whether to send a notification email to the owner specified by setownerid. the default value is false, that is, to not send email. signature public void setsendnotificationemail(boolean sendemail) parameters sendemail type: boolean return value type: void leadconvertresult class the result of a lead conversion. 2064apex reference guide leadconvertresult class namespace database usage an array of leadconvertresult objects is returned with the convertlead database method. each element in the leadconvertresult array corresponds to the sobject array passed as the sobject[] parameter in the convertlead database method, that is, the first element in the leadconvertresult array matches the first element passed in the sobject array, the second element corresponds to the second element, and so on" ". if only one sobject is passed in, the leadconvertresult array contains a single element. leadconvertresult methods the following are methods for leadconvertresult. all are instance methods. in this section: getaccountid() the id of the new account (if a new account was specified) or the id of the account specified when convertlead was invoked. getcontactid() the id of the new contact (if a new contact was specified) or the id of the contact specified when convertlead was invoked. geterrors() if an error occurred, an array of one or more database error objects providing the error code and description. getleadid() the id of the converted lead. getopportunityid() the id of the new opportunity, if one was created when convertlead was invoked. getrelatedpersonaccountid() the id of the new or existing person account specified when convertlead was invoked. issuccess() a boolean value that is set to true if the dml operation was successful for this object, false otherwise getaccountid() the id of the new account (if a new account was specified) or the id of the account specified when convertlead was invoked. signature public id getaccountid() return value type: id getcontactid() the id of the new contact (if a new contact was specified) or the id of the contact specified when convertlead was invoked. 2065apex reference guide leadconvertresult class signature public id getcontactid() return value type: id geterrors() if an error occurred, an array of one or more database error objects providing the error code and description. signature public database.error[] geterrors() return value type: database.error[] getleadid() the id of the converted lead. signature public id getleadid() return value type: id getopportunityid() the id of the new opportunity, if one was created when convertlead was invoked. signature public id getopportunityid() return value type: id getrelatedpersonaccountid() the id of the new or existing person account specified when convertlead was invoked. signature public id getrelatedpersonaccountid() 2066apex reference guide mergeresult class return value type: id issuccess() a boolean value that is set to true if the dml operation was successful for this object, false otherwise signature public boolean issuccess() return value type: boolean mergeresult class contains the result of a merge database method operation. namespace database usage the database.merge method returns a database.mergeresult object for each merged record. mergeresult methods the following are methods for mergeresult. all are instance methods. in this section: geterrors() returns a list of database.error objects representing the errors encountered, if any, during a merge operation using the database.merge method. if no error occurred, returns null. getid() returns the id of the master record into which other records were merged. getmergedrecordids() returns the ids of the records merged into the master record. getupdatedrelatedids() returns the ids of all related records that were reparented as a result of the merge that are viewable by the user sending the merge call. issuccess() indicates whether the merge was successful (true) or not (false). 2067apex reference guide mergeresult class geterrors() returns a list of database.error objects representing the errors encountered, if any, during a merge operation using the database.merge method. if no error occurred, returns null. signature public list geterrors() return value type: list getid() returns the id of the master record into which other records were merged. signature public id getid() return value type: id getmergedrecordids() returns the ids of the records merged into the master record. signature public list getmergedrecordids() return value type: list getupdatedrelatedids() returns the ids of all related records that were reparented as a result of the merge that are viewable by the user sending the merge call. signature public list getupdatedrelatedids() return value type: list 2068apex reference guide querylocator class issuccess() indicates whether the merge was successful (true) or not (" "false). signature public boolean issuccess() return value type: boolean querylocator class represents the record set returned by database.getquerylocator and used with batch apex. namespace database querylocator methods the following are methods for querylocator. all are instance methods. in this section: getquery() returns the query used to instantiate the database.querylocator object. this is useful when testing the start method. iterator() returns a new instance of a query locator iterator. getquery() returns the query used to instantiate the database.querylocator object. this is useful when testing the start method. signature public string getquery() return value type: string usage you can’t use the for update keywords with a getquerylocator query to lock a set of records. the set of records in the batch is determined when the start method is run. 2069apex reference guide querylocatoriterator class example system.assertequals(qlreturnedfromstart. getquery(), database.getquerylocator([select id from account]).getquery() ); iterator() returns a new instance of a query locator iterator. signature public database.querylocatoriterator iterator() return value type: database.querylocatoriterator usage warning: to iterate over a query locator, save the iterator instance that this method returns in a variable and then use this variable to iterate over the collection. calling iterator every time you want to perform an iteration can result in incorrect behavior because each call returns a new iterator instance. for an example, see querylocatoriterator class. querylocatoriterator class represents an iterator over a query locator record set. namespace database example this sample shows how to obtain an iterator for a query locator, which contains five accounts. this sample calls hasnext and next to get each record in the collection. // get a query locator database.querylocator q = database.getquerylocator( [select name from account limit 5]); // get an iterator database.querylocatoriterator it = q.iterator(); // iterate over the records while (it.hasnext()) { account a = (account)it.next(); 2070apex reference guide querylocatoriterator class system.debug(a); } querylocatoriterator methods the following are methods for querylocatoriterator. all are instance methods. in this section: hasnext() returns true if there are one or more records remaining in the collection; otherwise, returns false. next() advances the iterator to the next sobject record and returns the sobject. hasnext() returns true if there are one or more records remaining in the collection; otherwise, returns false. signature public boolean hasnext() return value type: boolean next() advances the iterator to the next sobject record and returns the sobject. signature public sobject next() return value type: sobject usage because the return value is the generic sobject type, you must cast it if using a more specific type. for example: account a = (account)myiterator.next(); example account a = (account)myiterator.next(); 2071apex reference guide saveresult class saveresult class the result of an insert or update dml operation returned by a database method. namespace database usage an array of saveresult objects is returned with the insert and update database methods. each element in the saveresult array corresponds to the sobject array passed as the sobject[] parameter in the database method, that is, the first element in the saveresult array matches the first element passed in the sobject array, the second element corresponds with the second element, and so on. if only one sobject is passed in, the saveresult array contains a single element. a saveresult object is generated when a new or existing salesforce record is saved. example the following example shows how to obtain and iterate through the returned database.saveresult objects. it inserts two accounts using database.insert with a false second parameter to allow partial processing of records on failure. one of the accounts is missing the name required field, which causes a failure. next, it iterates through the results to determine whether the operation was successful or not for each record. it writes the id of every record that was processed successfully to the debug log, or error messages and fields of the failed records. this example generates one successful operation and one failure. // create two accounts, one" "of which is missing a required field account[] accts = new list{ new account(name='account1'), new account()}; database.saveresult[] srlist = database.insert(accts, false); // iterate through each returned result for (database.saveresult sr : srlist) { if (sr.issuccess()) { // operation was successful, so get the id of the record that was processed system.debug('successfully inserted account. account id: ' + sr.getid()); } else { // operation failed, so get all errors for(database.error err : sr.geterrors()) { system.debug('the following error has occurred.'); system.debug(err.getstatuscode() + ': ' + err.getmessage()); system.debug('account fields that affected this error: ' + err.getfields()); } } } see also: error class duplicateerror class 2072apex reference guide saveresult class saveresult methods the following are methods for saveresult. all are instance methods. in this section: geterrors() if an error occurred, returns an array of one or more database error objects providing the error code and description. if no error occurred, returns an empty set. getid() returns the id of the sobject you were trying to insert or update. issuccess() returns a boolean that is set to true if the dml operation was successful for this object, false otherwise. geterrors() if an error occurred, returns an array of one or more database error objects providing the error code and description. if no error occurred, returns an empty set. signature public database.error[] geterrors() return value type: database.error[] getid() returns the id of the sobject you were trying to insert or update. signature public id getid() return value type: id versioned behavior changes prior to api version 53.0, the method returned a null value if the record wasn’t updated successfully. in api version 53.0 and later, the method returns the sobject id, regardless of whether the update operation is successful or not. issuccess() returns a boolean that is set to true if the dml operation was successful for this object, false otherwise. 2073apex reference guide undeleteresult class signature public boolean issuccess() return value type: boolean example this example shows the code used to process duplicate records, which are detected when there is an unsuccessful save due to an error. this code is part of a custom application that implements duplicate management when users add a contact. see duplicateresult class on page 2079 to check out the entire sample applicaton. if (!saveresult.issuccess()) { ... } undeleteresult class the result of an undelete dml operation returned by the database.undelete method. namespace database usage an array of database.undeleteresult objects is returned with the undelete database method. each element in the undeleteresult array corresponds to the sobject array passed as the sobject[] parameter in the undelete database method; that is, the first element in the undeleteresult array matches the first element passed in the sobject array, the second element corresponds with the second element, and so on. if only one sobject is passed in, the undeleteresults array contains a single element. undeleteresult methods the following are methods for undeleteresult. all are instance methods. in this section: geterrors() if an error occurred, returns an array of one or more database error objects providing the error code and description. if no error occurred, returns null. getid() returns the id of the sobject you were trying to undelete. issuccess() returns a boolean value that is set to true if the dml operation was successful for this object, false otherwise. geterrors() if an error occurred, returns an array of one or more database error objects providing the error code and description. if no error occurred, returns null. 2074apex reference guide upsertresult class signature public database.error[] geterrors() return value type: database.error[] getid() returns the id of the sobject you were trying to undelete. signature public id getid() return value type: id usage if this field contains a value, the object was successfully undeleted. if this field is empty, the operation was not successful for that object" ". issuccess() returns a boolean value that is set to true if the dml operation was successful for this object, false otherwise. signature public boolean issuccess() return value type: boolean upsertresult class the result of an upsert dml operation returned by the database.upsert method. namespace database usage an array of database.upsertresult objects is returned with the upsert database method. each element in the upsertresult array corresponds to the sobject array passed as the sobject[] parameter in the upsert database method; that is, the first element in the upsertresult array matches the first element passed in the sobject array, the second element corresponds with the second element, and so on. if only one sobject is passed in, the upsertresults array contains a single element. 2075apex reference guide upsertresult class upsertresult methods the following are methods for upsertresult. all are instance methods. in this section: geterrors() if an error occurred, returns an array of one or more database error objects providing the error code and description. if no error occurred, returns an empty set. getid() returns the id of the sobject you were trying to update or insert. iscreated() a boolean value that is set to true if the record was created, false if the record was updated. issuccess() returns a boolean value that is set to true if the dml operation was successful for this object, false otherwise. geterrors() if an error occurred, returns an array of one or more database error objects providing the error code and description. if no error occurred, returns an empty set. signature public database.error[] geterrors() return value type: database.error [] getid() returns the id of the sobject you were trying to update or insert. signature public id getid() return value type: id versioned behavior changes prior to api version 53.0, the method returned a null value if the record wasn’t upserted successfully. in api version 53.0 and later, the method returns the sobject id regardless of whether the update operation is successful. iscreated() a boolean value that is set to true if the record was created, false if the record was updated. 2076apex reference guide datacloud namespace signature public boolean iscreated() return value type: boolean issuccess() returns a boolean value that is set to true if the dml operation was successful for this object, false otherwise. signature public boolean issuccess() return value type: boolean datacloud namespace the datacloud namespace provides classes and methods for retrieving information about duplicate rules. duplicate rules let you control whether and when users can save duplicate records within salesforce. the following are the classes in the datacloud namespace. in this section: additionalinformationmap class represents other information, if any, about matched records. duplicateresult class represents the details of a duplicate rule that detected duplicate records and information about those duplicate records. fielddiff class represents the name of a matching rule field and how the values of the field compare for the duplicate and its matching record. findduplicates class performs rule-based searches for duplicate records. the input is an array of sobjects. each sobject represents a record you want to find duplicates of. the output identifies the detected duplicates for each input sobject based on active duplicate rules for the given object. findduplicatesbyids class performs rule-based searches for duplicate records. the input is an array of ids. each id specifies records to search for duplicates among. the duplicates are detected based on the active duplicate rules applicable to the object type corresponding to the input ids. findduplicatesresult class output for rule-based searches for duplicate records. findduplicatesresult contains results of detecting duplicates using instances of findduplicates or findduplicatesbyids classes. matchrecord class represents a duplicate record detected by a matching rule. 2077apex reference guide additionalinformationmap class matchresult class represents the duplicate results for a matching rule. additionalinformationmap class represents other information, if any, about matched records. namespace datacloud in this section: additionalinformationmap methods additionalinformationmap methods the following are methods for additionalinformationmap. in this section: getname() returns the element name. getvalue() returns the value of the element. getname() returns" "the element name. signature public string getname() return value type: string getvalue() returns the value of the element. signature public string getvalue() return value type: string 2078apex reference guide duplicateresult class duplicateresult class represents the details of a duplicate rule that detected duplicate records and information about those duplicate records. namespace datacloud usage the duplicateresult class and its methods are available to organizations that use duplicate rules. duplicateresult is contained within duplicateerror, which is part of saveresult. saveresult is generated when a user attempts to save a record in salesforce. example this example shows a custom application that lets users add a contact. when a contact is saved, an alert displays if there are duplicate records. the sample application consists of a visualforce page and an apex controller. the visualforce page is listed first so that you can see how the page makes use of the apex controller. save the apex class first before saving the visualforce page. name {!item['name']} owner last modified date 2079apex reference guide duplicateresult class this sample is the apex controller for the page. this controller contains the action method for the save button. the save method inserts the new contact. if errors are returned, this method iterates through each error, checks if it’s a duplicate error, adds the error message to the page, and returns information about the duplicate records to be displayed on the page. public class contactdedupecontroller { // initialize a variable to hold the contact record you're processing private final contact contact; // initialize a list to hold any duplicate records private list duplicaterecords; // define variable that’s true if there are duplicate records public boolean hasduplicateresult{get;set;} // define the constructor public contactdedupecontroller() { // define the values for the contact you’re processing based on its id id id = apexpages.currentpage().getparameters().get('id'); this.contact = (id == null) ? new contact() : [select id, firstname, lastname, email, phone, accountid from contact where id = :id]; // initialize empty list of potential duplicate records this.duplicaterecords = new list(); this.hasduplicateresult = false; } // return contact and its values to the visualforce page for display public contact getcontact() { return this.contact; } // return duplicate records to the visualforce page for display public list getduplicaterecords" "() { return this.duplicaterecords; } // process the saved record and handle any duplicates public pagereference save() { // optionally, set dml options here, use “dml” instead of “false” // in the insert() // database.dmloptions dml = new database.dmloptions(); // dml.duplicateruleheader.allowsave = true; // dml.duplicateruleheader.runascurrentuser = true; database.saveresult saveresult = database.insert(contact, false); 2080apex reference guide duplicateresult class if (!saveresult.issuccess()) { for (database.error error : saveresult.geterrors()) { // if there are duplicates, an error occurs // process only duplicates and not other errors // (e.g., validation errors) if (error instanceof database.duplicateerror) { // handle the duplicate error by first casting it as a // duplicateerror class // this lets you use methods of that class // (e.g., getduplicateresult()) database.duplicateerror duplicateerror = (database.duplicateerror)error; datacloud.duplicateresult duplicateresult = duplicateerror.getduplicateresult(); // display duplicate error message as defined in the duplicate rule apexpages.message errormessage = new apexpages.message( apexpages.severity.error, 'duplicate error: ' + duplicateresult.geterrormessage()); apexpages.addmessage(errormessage); // get duplicate records this.duplicaterecords = new list(); // return only match results of matching rules that // find duplicate records datacloud.matchresult[] matchresults = duplicateresult.getmatchresults(); // just grab first match result (which contains the // duplicate record found and other match info) datacloud.matchresult matchresult = matchresults[0]; datacloud.matchrecord[] matchrecords = matchresult.getmatchrecords(); // add matched record to the duplicate records variable for (datacloud.matchrecord matchrecord : matchrecords) { system.debug('matchrecord: ' + matchrecord.getrecord()); this.duplicaterecords.add(matchrecord.getrecord()); } this.hasduplicateresult = !this.duplicaterecords.isempty(); } } //if there’s a duplicate record, stay on the page return null; } // after save, navigate to the view page: return (new apexpages.standardcontroller(contact)).view(); } } 2081apex reference guide duplicateresult class in this section: duplicateresult methods see also: saveresult class duplicateerror class duplicateresult methods the following are methods for duplicateresult. in this section: getduplicaterule() returns the developer name of the executed duplicate rule that returned duplicate records. geterrormessage() returns the error message configured by the administrator to warn users they may be creating duplicate records. this message is associated with a duplicate rule. getmatchresults() returns the duplicate records and match information. isallowsave() indicates whether the duplicate rule will allow a record that’s identified as a duplicate to be saved. set to true if duplicate rule should allow save; otherwise, false. getduplicaterule() returns the developer name of the executed duplicate rule that returned duplicate records. signature public string getduplicaterule() return value type: string geterrormessage() returns the error message configured by the administrator to warn users they may be creating duplicate records. this message is associated with a duplicate rule. signature public string geterrormessage() 2082" "apex reference guide duplicateresult class return value type: string example this example shows the code used to display the error message when duplicates are found while saving a new contact. this code is part of a custom application that lets users add a contact. when a contact is saved, an alert displays if there are duplicate records. review duplicateresult class on page 2079 to check out the entire sample applicaton. apexpages.message errormessage = new apexpages.message( apexpages.severity.error, 'duplicate error: ' + duplicateresult.geterrormessage()); apexpages.addmessage(errormessage); getmatchresults() returns the duplicate records and match information. signature public list getmatchresults() return value type: list example this example shows the code used to return duplicate record and match information and assign it to the matchresults variable. this code is part of a custom application that implements duplicate management when users add a contact. see duplicateresult class on page 2079 to check out the entire sample applicaton. datacloud.matchresult[] matchresults = duplicateresult.getmatchresults(); isallowsave() indicates whether the duplicate rule will allow a record that’s identified as a duplicate to be saved. set to true if duplicate rule should allow save; otherwise, false. signature public boolean isallowsave() return value type: boolean 2083apex reference guide fielddiff class fielddiff class represents the name of a matching rule field and how the values of the field compare for the duplicate and its matching record. namespace datacloud in this section: fielddiff methods fielddiff methods the following are methods for fielddiff. in this section: getdifference() returns how the field values compare for the duplicate and its matching record. getname() returns the name of a field on a matching rule that detected duplicates. getdifference() returns how the field values compare for the duplicate and its matching record. signature public string getdifference() return value type: string possible values include: • same: indicates the field values match exactly. • different: indicates that the field values do not match. • null: indicates that the field values are a match because both values are blank. getname() returns the name of a field on a matching rule that detected duplicates. signature public string getname() 2084apex reference guide findduplicates class return value type: string findduplicates class performs rule-based searches for duplicate records. the input is an array of sobjects. each sobject represents a record you want to find duplicates of. the output identifies the detected duplicates for each input sobject based on active duplicate rules for the given object. namespace datacloud in this section: findduplicates methods findduplicates methods the following are methods for findduplicates. in this section: findduplicates(sobjects) identifies duplicates for sobjects provided and returns a list of findduplicatesresult objects. findduplicates(sobjects) identifies duplicates for sobjects provided and returns a list of findduplicatesresult objects. usage use findduplicates to apply active duplicate rules associated with an object to records represented by input sobjects. findduplicates uses the duplicate rules for the object that has the same type as the input sobjects. input • all sobjects in the input array must be of the same object type, and that type must correspond to an object type that supports duplicate rules. • the input array is limited to 50 elements. if you exceed this limit, an exception is thrown with the following message: configuration error: the number of records to check is greater than the permitted batch size. output • the output of findduplicates is an array of objects with the same number of elements as the input array, and in the same order. the output objects encapsulate record ids for duplicate records. the output objects also contain values from the duplicate records. • each element contains an array of duplicateresult objects. if findduplicates doesn’t find any duplicates, the duplicaterule field in duplicateresult contains the name of the duplicate rule that findduplicates applied, but the matchresults array is empty. 2085apex reference guide findduplicatesbyids" "class example account acct = new account(); acct.name = 'acme'; acct.billingstreet = '123 fake st'; acct.billingcity = 'springfield'; acct.billingstate = 'vt'; acct.billingcountry = 'us'; list acctlist = new list(); acctlist.add(acct); if (datacloud.findduplicates.findduplicates(acctlist).size() == 0) { // if the new account doesn't have duplicates, insert it. insert(acct); } signature public static list findduplicates(list sobjects) parameters sobjects type: list an array of sobjects for which you want to find duplicates. return value type: list findduplicatesbyids class performs rule-based searches for duplicate records. the input is an array of ids. each id specifies records to search for duplicates among. the duplicates are detected based on the active duplicate rules applicable to the object type corresponding to the input ids. namespace datacloud in this section: findduplicatesbyids methods findduplicatesbyids methods the following are methods for findduplicatesbyids. 2086apex reference guide findduplicatesbyids class in this section: findduplicatesbyids(ids) identifies duplicates of sobjects provided and returns a list of findduplicatesresult objects. findduplicatesbyids(ids) identifies duplicates of sobjects provided and returns a list of findduplicatesresult objects. usage use findduplicatesbyids to apply active duplicate rules associated with an object to records represented by the record ids. findduplicatesbyids uses the duplicate rules for the object that has the same type as the input record ids. for example, if the record id represents an account, findduplicatesbyids uses the duplicate rules associated with the account object. input • all record ids in the input array must be of the same object type, and that type must correspond to an object type that supports duplicate rules. • the input array is limited to 50 elements. if you exceed this limit, an exception is thrown with the following message: configuration error: the number of records to check is greater than the permitted batch size. output • the output of findduplicatesbyids is an array of objects with the same number of elements as the input array, and in the same order. the output objects encapsulate record ids for duplicate records. the output objects also contain values from the duplicate records. • each element contains an array of duplicateresult objects. if findduplicatesbyids doesn’t find any duplicates, the duplicaterule field in duplicateresult contains the name of the duplicate rule that findduplicatesbyids applied, but the matchresults array is empty. example account acct = new account(name='salesforce'); insert acct; list idlist = new list(); idlist.add(acct.id); if (datacloud.findduplicatesbyids.findduplicatesbyids(idlist).size() > 0) { system.debug('found duplicates'); } signature public static list findduplicatesbyids(list ids) parameters ids type: listid> 2087apex reference guide findduplicatesresult class a list of ids for which you want to find duplicates. return value type: list findduplicatesresult class output for rule-based searches for duplicate records. findduplicatesresult contains results of detecting duplicates using instances of findduplicates or findduplicatesbyids classes. namespace datacloud in this section: findduplicatesresult properties findduplicatesresult methods findduplicatesresult properties the following are properties for findduplicatesresult. in this section: duplicateresults a list of duplicateresult objects representing the results of calling findduplicates.findduplicates(sobjects) or findduplicatesbyids.findduplicatesbyids(ids). elements in the list correspond to sobjects or ids in the input list. errors a" "list of database.error objects holding errors resulting from calling findduplicates.findduplicates(sobjects) or findduplicatesbyids.findduplicatesbyids(ids). success boolean signifying whether the call to findduplicates.findduplicates(sobjects) or findduplicatesbyids.findduplicatesbyids(ids) was successful. duplicateresults a list of duplicateresult objects representing the results of calling findduplicates.findduplicates(sobjects) or findduplicatesbyids.findduplicatesbyids(ids). elements in the list correspond to sobjects or ids in the input list. signature public list duplicateresults 2088apex reference guide findduplicatesresult class property value type: list errors a list of database.error objects holding errors resulting from calling findduplicates.findduplicates(sobjects) or findduplicatesbyids.findduplicatesbyids(ids). signature public list errors {get; set;} property value type: list success boolean signifying whether the call to findduplicates.findduplicates(sobjects) or findduplicatesbyids.findduplicatesbyids(ids) was successful. signature public boolean success {get; set;} property value type: boolean findduplicatesresult methods the following are methods for findduplicatesresult. in this section: getduplicateresults() returns a list of duplicateresult objects representing the results of calling findduplicates.findduplicates(sobjects) or findduplicatesbyids.findduplicatesbyids(ids). elements in the list correspond to sobjects or ids in the input list. geterrors() returns a list of databaseerror objects containing errors resulting from calling findduplicates.findduplicates(sobjects) or findduplicatesbyids.findduplicatesbyids(ids), if errors were encountered. issuccess() returns a boolean signifying whether the call to findduplicates.findduplicates(sobjects) or findduplicatesbyids.findduplicatesbyids(ids) was successful. 2089apex reference guide findduplicatesresult class getduplicateresults() returns a list of duplicateresult objects representing the results of calling findduplicates.findduplicates(sobjects) or findduplicatesbyids.findduplicatesbyids(ids). elements in the list correspond to sobjects or ids in the input list. example account acct = new account(name='salesforce'); list acctlist = new list(); acctlist.add(acct); datacloud.findduplicatesresult[] results = datacloud.findduplicates.findduplicates(acctlist); for (datacloud.findduplicatesresult findduperesult : results) { for (datacloud.duplicateresult duperesult : findduperesult.getduplicateresults()) { for (datacloud.matchresult matchresult : duperesult.getmatchresults()) { for (datacloud.matchrecord matchrecord : matchresult.getmatchrecords()) { system.debug('duplicate record: ' + matchrecord.getrecord()); } } } } signature public list getduplicateresults() return value type: list geterrors() returns a list of databaseerror objects containing errors resulting from calling findduplicates.findduplicates(sobjects) or findduplicatesbyids.findduplicatesbyids(ids), if errors were encountered. signature public list geterrors() return value type: list issuccess() returns a boolean signifying whether the call to findduplicates.findduplicates(sobjects) or findduplicatesbyids.findduplicatesbyids(ids) was successful. 2090apex reference guide matchrecord class signature public boolean issuccess() return value type: boolean matchrecord class represents a duplicate record detected by a matching rule. namespace" "datacloud in this section: matchrecord methods matchrecord methods the following are methods for matchrecord. in this section: getadditionalinformation() returns other information about a matched record. for example, a matchgrade represents the quality of the data for the d&b fields in the matched record. getfielddiffs() returns all matching rule fields and how each field value compares for the duplicate and its matching record. getmatchconfidence() returns the ranking of how similar a matched record’s data is to the data in your request. must be equal to or greater than the value of the minmatchconfidence specified in your request. returns -1 if unused. getrecord() returns the fields and field values for the duplicate. getadditionalinformation() returns other information about a matched record. for example, a matchgrade represents the quality of the data for the d&b fields in the matched record. signature public list getadditionalinformation() return value type: list 2091apex reference guide matchresult class getfielddiffs() returns all matching rule fields and how each field value compares for the duplicate and its matching record. signature public list getfielddiffs() return value type: list getmatchconfidence() returns the ranking of how similar a matched record’s data is to the data in your request. must be equal to or greater than the value of the minmatchconfidence specified in your request. returns -1 if unused. signature public double getmatchconfidence() return value type: double getrecord() returns the fields and field values for the duplicate. signature public sobject getrecord() return value type: sobject matchresult class represents the duplicate results for a matching rule. namespace datacloud in this section: matchresult methods 2092apex reference guide matchresult class matchresult methods the following are methods for matchresult. in this section: getentitytype() returns the entity type of the matching rule. geterrors() returns errors that occurred during matching for the matching rule. getmatchengine() returns the match engine for the matching rule. getmatchrecords() returns information about the duplicates for the matching rule. getrule() returns the developer name of the matching rule. getsize() returns the number of duplicates detected by the matching rule. issuccess() returns false if there’s an error with the matching rule, and true if the matching rule successfully ran. getentitytype() returns the entity type of the matching rule. signature public string getentitytype() return value type: string geterrors() returns errors that occurred during matching for the matching rule. signature public list geterrors() return value type: list getmatchengine() returns the match engine for the matching rule. 2093apex reference guide matchresult class signature public string getmatchengine() return value type: string getmatchrecords() returns information about the duplicates for the matching rule. signature public list getmatchrecords() return value type: list getrule() returns the developer name of the matching rule. signature public string getrule() return value type: string getsize() returns the number of duplicates detected by the matching rule. signature public integer getsize() return value type: integer issuccess() returns false if there’s an error with the matching rule, and true if the matching rule successfully ran. signature public boolean issuccess() 2094apex reference guide datasource namespace return value type: boolean datasource namespace the datasource namespace provides the classes for the apex connector framework. use the apex connector framework to develop a custom adapter for salesforce connect. then connect your salesforce organization to any data anywhere via the salesforce connect custom adapter. the following are the classes in the datasource namespace. in this section: asyncdeletecallback class a callback class that the database.deleteasync method references. salesforce calls this class after the remote deleteasync operation is completed. this class provides the compensating transaction in the completion context of the delete operation. extend this class to define the actions to execute after the remote delete operation finishes execution." "asyncsavecallback class a callback class that the database.insertasync or database.updateasync method references. salesforce calls this class after the remote operation is completed. this class provides the compensating transaction in the completion context of the insert or update operation. extend this class to define the actions to execute after the remote insert or update operation finishes execution. authenticationcapability enum specifies the types of authentication that can be used to access the external system. authenticationprotocol enum determines what type of credentials are used to authenticate to the external system. capability enum declares which functional operations the external system supports. also specifies required endpoint settings for the external data source definition. column class describes a column on a datasource.table. this class extends the datasourceutil class and inherits its methods. columnselection class identifies the list of columns to return during a query or search. connection class extend this class to enable your salesforce org to sync the external system’s schema and to handle queries, searches, and write operations (upsert and delete) of the external data. this class extends the datasourceutil class and inherits its methods. connectionparams class contains the credentials for authenticating to the external system. datasourceutil class parent class for the datasource.provider, datasource.connection, datasource.table, and datasource.column classes. datatype enum specifies the data types that are supported by the apex connector framework. 2095apex reference guide datasource namespace deletecontext class an instance of deletecontext is passed to the deleterows() method on your database.connection class. the class provides context information about the delete request to the implementor of deleterows(). deleteresult class represents the result of a delete operation on an sobject record. the result is returned by the datasource.deleterows method of the datasource.connection class. filter class represents a where clause in a sosl or soql query. filtertype enum referenced by the type property on a datasource.filter. identitytype enum determines which set of credentials is used to authenticate to the external system. order class contains details about how to sort the rows in the result set. equivalent to an order by statement in a soql query. orderdirection enum specifies the direction for sorting rows based on column values. provider class extend this base class to create a custom adapter for salesforce connect. the class informs salesforce of the functional and authentication capabilities that are supported by or required to connect to the external system. this class extends the datasourceutil class and inherits its methods. queryaggregation enum specifies how to aggregate a column in a query. querycontext class an instance of querycontext is provided to the query method on your datasource.connection class. the instance corresponds to a soql request. queryutils class contains helper methods to locally filter, sort, and apply limit and offset clauses to data rows. this helper class is provided for your convenience during early development and tests, but it isn’t supported for use in production environments. readcontext class abstract base class for the querycontext and searchcontext classes. searchcontext class an instance of searchcontext is provided to the search method on your datasource.connection class. the instance corresponds to a search or sosl request. searchutils class helper class for implementing search on a custom adapter for salesforce connect. table class describes a table on an external system that the salesforce connect custom adapter connects to. this class extends the datasourceutil class and inherits its methods. tableresult class contains the results of a search or query. 2096apex reference guide asyncdeletecallback class tableselection class contains a breakdown of the soql or sosl query. its properties represent the from, order by, select, and where clauses in the query. upsertcontext class an instance of upsertcontext is passed to the upsertrows() method on your datasource.connection class. this class provides context information about the upsert request to the implementor of upsertrows(). upsertresult class represents the result of an upsert operation on an external object record. the result is returned by the upsertrows method of the datasource.connection class. datasource exceptions the datasource namespace contains exception classes. asyncdeletecallback class a callback class that the database.deleteasync method references. sales" "force calls this class after the remote deleteasync operation is completed. this class provides the compensating transaction in the completion context of the delete operation. extend this class to define the actions to execute after the remote delete operation finishes execution. namespace datasource in this section: asyncdeletecallback methods asyncdeletecallback methods the following are methods for asyncdeletecallback. in this section: processdelete(deleteresult) override this method to define actions that salesforce executes after a remote database.deleteasync operation is completed. for example, based on the results of the remote operation, you can update custom object data or other data that's stored in the salesforce org.. processdelete(deleteresult) override this method to define actions that salesforce executes after a remote database.deleteasync operation is completed. for example, based on the results of the remote operation, you can update custom object data or other data that's stored in the salesforce org.. signature public void processdelete(database.deleteresult deleteresult) 2097apex reference guide asyncsavecallback class parameters deleteresult type: database.deleteresult the result of the asynchronous delete operation. return value type: void asyncsavecallback class a callback class that the database.insertasync or database.updateasync method references. salesforce calls this class after the remote operation is completed. this class provides the compensating transaction in the completion context of the insert or update operation. extend this class to define the actions to execute after the remote insert or update operation finishes execution. namespace datasource in this section: asyncsavecallback methods asyncsavecallback methods the following are methods for asyncsavecallback. in this section: processsave(saveresult) override this method to define actions that salesforce executes after the remote database.insertasync or database.updateasync operation is completed. for example, based on the results of the remote operation, you can update custom object data or other data that's stored in the salesforce org. processsave(saveresult) override this method to define actions that salesforce executes after the remote database.insertasync or database.updateasync operation is completed. for example, based on the results of the remote operation, you can update custom object data or other data that's stored in the salesforce org. signature public void processsave(database.saveresult saveresult) parameters saveresult type: database.saveresult 2098apex reference guide authenticationcapability enum the result of the asynchronous insert or update operation. return value type: void authenticationcapability enum specifies the types of authentication that can be used to access the external system. usage the datasource.provider class returns datasource.authenticationcapability enum values. the returned values determine which authentication settings are available on the external data source definition in salesforce. if you set up callouts in your datasource.connection class, you can specify the callout endpoints as named credentials instead of urls. if you do so for all callouts, return anonymous as the sole entry in the list of data source authentication capabilities. that way, the external data source definition doesn’t require authentication settings. salesforce manages all authentication for apex callouts that specify a named credential as the callout endpoint so that your code doesn’t have to. enum values the following are the values of the datasource.authenticationcapability enum. value description anonymous no credentials are required to authenticate to the external system. basic a username and password can be used to authenticate to the external system. certificate a security certificate can be supplied when establishing each connection to the external system. oauth oauth can be used to authenticate to the external system. authenticationprotocol enum determines what type of credentials are used to authenticate to the external system. enum values the following are the values of the datasource.authenticationprotocol enum. value description none no credentials are used to authenticate to the external system. oauth oauth 2.0 is used to authenticate to the external system. password a username and password are used to authenticate to the external system. 2099apex reference guide capability enum capability enum declares which functional operations the external system supports. also specifies required endpoint settings for the external data source definition. usage the datasource.provider class returns datasource.capability enum values, which: • specify the functional capabilities of the external system. • determine which endpoint settings are available on the external data source definition in salesforce." "enum values the following are the values of the datasource.capability enum. value description query_pagination_server_driven with server-driven paging, the external system determines the page sizes and batch boundaries. the external system’s paging settings can optimize the external system’s performance and improve the load times for external objects in your org. also, the external data set can change while your users or the lightning platform are paging through the result set. typically, server-driven paging adjusts batch boundaries to accommodate changing data sets more effectively than client-driven paging. if you enable server-driven paging on an external data source, salesforce ignores the requested page sizes, including the default querymore() batch size of 500 rows. the pages returned by the external system determine the batches, but each page can’t exceed 2,000 rows. also, the apex code must generate a query token and use it to determine and fetch the next batch of results. query_total_size the external system can provide the total number of rows that meet the query criteria, even when requested to return a smaller batch size. this capability enables you to simplify how you paginate results by using querymore(). require_endpoint requires the administrator to specify the endpoint in the url field in the external data source definition. require_https requires the endpoint url to use secure http. if require_endpoint isn’t declared, require_https is ignored. row_create allows creating of external data. row_delete allows deleting external data. row_query allows api and soql queries of the external data. also allows reports on the external objects. row_update allows updating external data. search allows sosl and salesforce searches of the external data. when the custom adapter declares the search capability, you can control which external objects are searchable by selecting or deselecting allow search on each 2100apex reference guide column class value description external object. however, syncing always overwrites the external object’s search status to match the search status of the external data source. only text, text area, and long text area fields on external objects can be searched. if an external object has no searchable fields, searches on that object return no records. see also: salesforce help: validate and sync an external data source column class describes a column on a datasource.table. this class extends the datasourceutil class and inherits its methods. namespace datasource usage a list of column metadata is provided by the datasource.connection class when the sync() method is invoked. each column can become a field on an external object. the metadata is stored in salesforce. updating the apex code to return new or updated values for the column metadata doesn’t automatically update the stored metadata in salesforce. in this section: column properties column methods column properties the following are properties for column. in this section: decimalplaces if the data type is numeric, the number of decimal places to the right of the decimal point. description description of what the column represents. filterable whether a result set can be filtered based on the values of the column. label user-friendly name for the column that appears in the salesforce user interface. 2101apex reference guide column class length if the column is a string data type, the number of characters in the column. if the column is a numeric data type, the total number of digits on both sides of the decimal point, but excluding the decimal point. name name of the column in the external system. referencetargetfield api name of the custom field on the parent object whose values are compared against this column’s values. matching values identify related records in an indirect lookup relationship. applies only when the column’s data type is indirect_lookup_type. for other data types, this value is ignored. referenceto api name of the parent object in the relationship that’s represented by this column. applies only when the column’s data type is lookup_type, external_lookup_type, or indirect_lookup_type. for other data types, this value is ignored. sortable whether a result set can be sorted based on the values of the column via an order by clause. type data type of the column. decimalplaces if the data type is" "numeric, the number of decimal places to the right of the decimal point. signature public integer decimalplaces {get; set;} property value type: integer description description of what the column represents. signature public string description {get; set;} property value type: string filterable whether a result set can be filtered based on the values of the column. signature public boolean filterable {get; set;} 2102apex reference guide column class property value type: boolean label user-friendly name for the column that appears in the salesforce user interface. signature public string label {get; set;} property value type: string length if the column is a string data type, the number of characters in the column. if the column is a numeric data type, the total number of digits on both sides of the decimal point, but excluding the decimal point. signature public integer length {get; set;} property value type: integer name name of the column in the external system. signature public string name {get; set;} property value type: string referencetargetfield api name of the custom field on the parent object whose values are compared against this column’s values. matching values identify related records in an indirect lookup relationship. applies only when the column’s data type is indirect_lookup_type. for other data types, this value is ignored. signature public string referencetargetfield {get; set;} 2103apex reference guide column class property value type: string referenceto api name of the parent object in the relationship that’s represented by this column. applies only when the column’s data type is lookup_type, external_lookup_type, or indirect_lookup_type. for other data types, this value is ignored. signature public string referenceto {get; set;} property value type: string sortable whether a result set can be sorted based on the values of the column via an order by clause. signature public boolean sortable {get; set;} property value type: boolean type data type of the column. signature public datasource.datatype type {get; set;} property value type: datasource.datatype column methods the following are methods for column. in this section: boolean(name) returns a new column of data type boolean_type. externallookup(name, domain) returns a new column of data type external_lookup_type. 2104apex reference guide column class get(name, label, description, issortable, isfilterable, type, length, decimalplaces, referenceto, referencetargetfield) returns a new column with the ten specified column property values. get(name, label, description, issortable, isfilterable, type, length, decimalplaces) returns a new column with the eight specified column property values. get(name, label, description, issortable, isfilterable, type, length) returns a new column with the seven specified column property values. indirectlookup(name, domain, targetfield) returns a new column of data type indirect_lookup_type. integer(name, length) returns a new numeric column with no decimal places using the specified name and length. lookup(name, domain) returns a new column of data type lookup_type. number(name, length, decimalplaces) returns a new column of data type number_type. text(name, label, length) returns a new column of data type string_short_type or string_long_type, with the specified name, label, and length. text(name, length) returns a new column of data type string_short_type or string_long_type, with the specified name and length. text(name) returns a new column of data type string_short_type with the specified name and the length of 255 characters. textarea(name) returns a new column of data type string_long_type with the specified name and the length of 32,000 characters. url(name, length) returns a new column of data type url_type with the specified name and length. url(name) returns a new column of data type url_type with the specified name and the length of 1,000 characters. boolean(name)" "returns a new column of data type boolean_type. signature public static datasource.column boolean(string name) parameters name type: string name of the column. 2105apex reference guide column class return value type: datasource.column externallookup(name, domain) returns a new column of data type external_lookup_type. signature public static datasource.column externallookup(string name, string domain) parameters name type: string name of the column. domain type: string api name of the parent object in the external lookup relationship. return value type: datasource.column the returned column has these property values. property value name name label name description name issortable true isfilterable true type datasource.datatype.external_lookup_type length 255 decimalplaces 0 referenceto domain referencetargetfield null get(name, label, description, issortable, isfilterable, type, length, decimalplaces, referenceto, referencetargetfield) returns a new column with the ten specified column property values. 2106apex reference guide column class signature public static datasource.column get(string name, string label, string description, boolean issortable, boolean isfilterable, datasource.datatype type, integer length, integer decimalplaces, string referenceto, string referencetargetfield) parameters see column properties on page 2101 for information about each parameter. name type: string label type: string description type: string issortable type: boolean isfilterable type: boolean type type: datasource.datatype length type: integer decimalplaces type: integer referenceto type: string referencetargetfield type: string return value type: datasource.column get(name, label, description, issortable, isfilterable, type, length, decimalplaces) returns a new column with the eight specified column property values. signature public static datasource.column get(string name, string label, string description, boolean issortable, boolean isfilterable, datasource.datatype type, integer length, integer decimalplaces) 2107apex reference guide column class parameters see column properties on page 2101 for information about each parameter. name type: string label type: string description type: string issortable type: boolean isfilterable type: boolean type type: datasource.datatype length type: integer decimalplaces type: integer return value type: datasource.column get(name, label, description, issortable, isfilterable, type, length) returns a new column with the seven specified column property values. signature public static datasource.column get(string name, string label, string description, boolean issortable, boolean isfilterable, datasource.datatype type, integer length) parameters see column properties on page 2101 for information about each parameter. name type: string label type: string description type: string issortable type: boolean isfilterable type: boolean 2108apex reference guide column class type type: datasource.datatype length type: integer return value type: datasource.column indirectlookup(name, domain, targetfield) returns a new column of data type indirect_lookup_type. signature public static datasource.column indirectlookup(string name, string domain, string targetfield) parameters name type: string name of the column. domain type: string api name of the parent object in the indirect lookup relationship. targetfield type: string api name of the custom field on the parent object whose values are compared against this column’s values. matching values identify related records in an indirect lookup relationship. return value type: datasource.column the returned column has these property values. property value name name label name description name issortable true isfilterable true type datasource.datatype.indirect_lookup_type 2109apex reference guide column class property value length 255 decimalplaces 0 referenceto domain referencetargetfield targetfield integer(name, length) returns a new numeric column with no decimal places using the specified name and length. sign" "ature public static datasource.column integer(string name, integer length) parameters name type: string the column name. length type: integer the column length. return value type: datasource.column lookup(name, domain) returns a new column of data type lookup_type. signature public static datasource.column lookup(string name, string domain) parameters name type: string name of the column. domain type: string api name of the parent object in the lookup relationship. 2110apex reference guide column class return value type: datasource.column the returned column has these property values. property value name name label name description name issortable true isfilterable true type datasource.datatype.lookup_type length 255 decimalplaces 0 referenceto domain referencetargetfield null number(name, length, decimalplaces) returns a new column of data type number_type. signature public static datasource.column number(string name, integer length, integer decimalplaces) parameters see column properties on page 2101 for information about each parameter. name type: string length type: integer decimalplaces type: integer return value type: datasource.column the returned column has these property values. 2111apex reference guide column class property value name name label name description name issortable true isfilterable true type datasource.datatype.number_type length length decimalplaces decimalplaces text(name, label, length) returns a new column of data type string_short_type or string_long_type, with the specified name, label, and length. signature public static datasource.column text(string name, string label, integer length) parameters name type: string name of the column. label type: string user-friendly name for the column that appears in the salesforce user interface. length type: integer number of characters allowed in the column. return value type: datasource.column the returned column has these property values. property value name name label label description label issortable true 2112apex reference guide column class property value isfilterable true type datasource.datatype.string_short_type if length is 255 or less datasource.datatype.string_long_type if length is greater than 255 length length decimalplaces 0 text(name, length) returns a new column of data type string_short_type or string_long_type, with the specified name and length. signature public static datasource.column text(string name, integer length) parameters name type: string name of the column. length type: integer number of characters allowed in the column. return value type: datasource.column the returned column has these property values. property value name name label name description name issortable true isfilterable true type datasource.datatype.string_short_type if length is 255 or less datasource.datatype.string_long_type if length is greater than 255 length length 2113apex reference guide column class property value decimalplaces 0 text(name) returns a new column of data type string_short_type with the specified name and the length of 255 characters. signature public static datasource.column text(string name) parameters name type: string name of the column. return value type: datasource.column the returned column has these property values. property value name name label name description name issortable true isfilterable true type datasource.datatype.string_short_type length 255 decimalplaces 0 textarea(name) returns a new column of data type string_long_type with the specified name and the length of 32,000 characters. signature public static datasource.column textarea(string name) 2114apex reference guide column class parameters name type: string name of the column. return value type: datasource.column the returned column has these property values. property value name name label name description name issortable true isfilterable true type datasource.datatype.string_long_type" "length 32000 decimalplaces 0 url(name, length) returns a new column of data type url_type with the specified name and length. signature public static datasource.column url(string name, integer length) parameters name type: string name of the column. length type: integer number of characters allowed in the column. return value type: datasource.column the returned column has these property values. 2115apex reference guide column class property value name name label name description name issortable true isfilterable true type datasource.datatype.url_type length length decimalplaces 0 url(name) returns a new column of data type url_type with the specified name and the length of 1,000 characters. signature public static datasource.column url(string name) parameters name type: string name of the column. return value type: datasource.column the returned column has these property values. property value name name label name description name issortable true isfilterable true type datasource.datatype.url_type length 1000 decimalplaces 0 2116apex reference guide columnselection class columnselection class identifies the list of columns to return during a query or search. namespace datasource namespace usage this class is associated with the select clause for a soql query, or the returning clause for a sosl query. in this section: columnselection properties columnselection properties the following are properties for columnselection. in this section: aggregation how to aggregate the column’s data. columnname name of the selected column. tablename name of the column’s table. aggregation how to aggregate the column’s data. signature public datasource.queryaggregation aggregation {get; set;} property value type: datasource.queryaggregation columnname name of the selected column. signature public string columnname {get; set;} 2117apex reference guide connection class property value type: string tablename name of the column’s table. signature public string tablename {get; set;} property value type: string connection class extend this class to enable your salesforce org to sync the external system’s schema and to handle queries, searches, and write operations (upsert and delete) of the external data. this class extends the datasourceutil class and inherits its methods. namespace datasource usage your datasource.connection and datasource.provider classes compose a custom adapter for salesforce connect. changing the sync method on the datasource.connection class doesn’t automatically resync any external objects. example global class sampledatasourceconnection extends datasource.connection { global sampledatasourceconnection(datasource.connectionparams connectionparams) { } override global list sync() { list tables = new list(); list columns; columns = new list(); columns.add(datasource.column.text('name', 255)); columns.add(datasource.column.text('externalid', 255)); columns.add(datasource.column.url('displayurl')); tables.add(datasource.table.get('sample', 'title', columns)); return tables; } override global datasource.tableresult query(datasource.querycontext c) { return datasource.tableresult.get(c, datasource.queryutils.process(c, getrows())); } 2118apex reference guide connection class override global list search(datasource.searchcontext c) { list results = new list(); for (datasource.tableselection tableselection : c.tableselections) { results.add(datasource.tableresult.get(tableselection, getrows())); } return results; } // helper method to get record values from the external system for the sample table. private list> getrows () { // get row field values for the sample table from the external system via a callout. httpresponse response = makegetcallout(); // parse the json response and populate" "the rows. map m = (map)json.deserializeuntyped( response.getbody()); map error = (map)m.get('error'); if (error != null) { throwexception(string.valueof(error.get('message'))); } list> rows = new list>(); list jsonrows = (list)m.get('value'); if (jsonrows == null) { rows.add(foundrow(m)); } else { for (object jsonrow : jsonrows) { map row = (map)jsonrow; rows.add(foundrow(row)); } } return rows; } global override list upsertrows(datasource.upsertcontext context) { if (context.tableselected == 'sample') { list results = new list(); list> rows = context.rows; for (map row : rows){ // make a callout to insert or update records in the external system. httpresponse response; // determine whether to insert or update a record. if (row.get('externalid') == null){ // send a post http request to insert new external record. // make an apex callout and get httpresponse. response = makepostcallout( '{""name"":""' + row.get('name') + '"",""externalid"":""' + row.get('externalid') + '""'); } else { // send a put http request to update an existing external record. 2119apex reference guide connection class // make an apex callout and get httpresponse. response = makeputcallout( '{""name"":""' + row.get('name') + '"",""externalid"":""' + row.get('externalid') + '""', string.valueof(row.get('externalid'))); } // check the returned response. // first, deserialize it. map m = (map)json.deserializeuntyped( response.getbody()); if (response.getstatuscode() == 200){ results.add(datasource.upsertresult.success( string.valueof(m.get('id')))); } else { results.add(datasource.upsertresult.failure( string.valueof(m.get('id')), 'the callout resulted in an error: ' + response.getstatuscode())); } } return results; } return null; } global override list deleterows(datasource.deletecontext context) { if (context.tableselected == 'sample'){ list results = new list(); for (string externalid : context.externalids){ httpresponse response = makedeletecallout(externalid); if (response.getstatuscode() == 200){ results.add(datasource.deleteresult.success(externalid)); } else { results.add(datasource.deleteresult.failure(externalid, 'callout delete error:' + response.getbody())); } } return results; } return null; } // helper methods // make a get callout private static httpresponse makegetcallout() { httpresponse response; // make callout // ... 2120apex reference guide connection class return response; } // populate a row based on values from the external system. private map foundrow(map foundrow) { map row = new map(); row.put('externalid', string.valueof(foundrow.get('id'))); row.put('displayurl', string.valueof(foundrow.get('displayurl'))); row.put('name', string.valueof(foundrow.get('name'))); return row; } // make a post callout private static httpresponse makepostcallout(" "string jsonbody) { httpresponse response; // make callout // ... return response; } // make a put callout private static httpresponse makeputcallout(string jsonbody, string externalid) { httpresponse response; // make callout // ... return response; } // make a delete callout private static httpresponse makedeletecallout(string externalid) { httpresponse response; // make callout // ... return response; } } in this section: connection methods connection methods the following are methods for connection. in this section: deleterows(deletecontext) invoked when external object records are deleted via the salesforce user interface, apis, or apex. query(querycontext) invoked by a soql query of an external object. a soql query is generated and executed when a user visits an external object’s list view or record detail page in salesforce. returns the results of the query. 2121apex reference guide connection class search(searchcontext) invoked by a sosl query of an external object or when a user performs a salesforce global search that also searches external objects. returns the results of the query. sync() invoked when an administrator clicks validate and sync on the external data source detail page. returns a list of tables that describe the external system’s schema. upsertrows(upsertcontext) invoked when external object records are created or updated via the salesforce user interface, apis, or apex. deleterows(deletecontext) invoked when external object records are deleted via the salesforce user interface, apis, or apex. signature public list deleterows(datasource.deletecontext deletecontext) parameters deletecontext type: datasource.deletecontext contains context information about the delete request. return value type: list the results of the delete operation. query(querycontext) invoked by a soql query of an external object. a soql query is generated and executed when a user visits an external object’s list view or record detail page in salesforce. returns the results of the query. signature public datasource.tableresult query(datasource.querycontext querycontext) parameters querycontext type: datasource.querycontext represents the query to run against a data table. return value type: datasource.tableresult 2122apex reference guide connection class search(searchcontext) invoked by a sosl query of an external object or when a user performs a salesforce global search that also searches external objects. returns the results of the query. signature public list search(datasource.searchcontext searchcontext) parameters searchcontext type: datasource.searchcontext represents the query to run against an external data table. return value type: list sync() invoked when an administrator clicks validate and sync on the external data source detail page. returns a list of tables that describe the external system’s schema. signature public list sync() return value type: list each returned table can be used to create an external object in salesforce. on the validate external data source page, the administrator views the list of returned tables and selects which tables to sync. when the administrator clicks sync, an external object is created for each selected table. each column within the selected tables also becomes a field in the external object. upsertrows(upsertcontext) invoked when external object records are created or updated via the salesforce user interface, apis, or apex. signature public list upsertrows(datasource.upsertcontext upsertcontext) parameters upsertcontext type: datasource.upsertcontext contains context information about the upsert request. 2123apex reference guide connectionparams class return value type: list the results of the upsert operation. connectionparams class contains the credentials for authenticating to the external system. namespace datasource usage if your extension of the datasource.provider class returns datasource.authenticationcapability values that indicate support for authentication, the datasource.connection class is instantiated with a datasource.connectionparams instance in the constructor. the authentication credentials in the datasource.connectionpar" "ams instance depend on the identity type field of the external data source definition in salesforce. • if identity type is set to named principal, the credentials come from the external data source definition. • if identity type is set to per user: – for queries and searches, the credentials are specific to the current user who invokes the query or search. the credentials come from the user’s authentication settings for the external system. – for administrative connections, such as syncing the external system’s schema, the credentials come from the external data source definition. the values in this class can appear in debug logs and can be accessed by users who have the “author apex” permission. if you require better security, we recommend that you specify named credentials instead of urls as your apex callout endpoints. salesforce manages all authentication for apex callouts that specify a named credential as the callout endpoint so that your code doesn’t have to. in this section: connectionparams properties connectionparams properties the following are properties for connectionparams. in this section: certificatename the name of the certificate for establishing each connection to the external system. endpoint the url of the external system. oauthtoken the oauth token that’s issued by the external system. 2124apex reference guide connectionparams class password the password for authenticating to the external system. principaltype an instance of datasource.identitytype, which determines which set of credentials to use to access the external system. protocol the type of protocol that’s used to authenticate to the external system. repository reserved for future use. username the username for authenticating to the external system. certificatename the name of the certificate for establishing each connection to the external system. signature public string certificatename {get; set;} property value type: string the value comes from the external data source definition in salesforce. endpoint the url of the external system. signature public string endpoint {get; set;} property value type: string the value comes from the external data source definition in salesforce. oauthtoken the oauth token that’s issued by the external system. signature public string oauthtoken {get; set;} property value type: string 2125apex reference guide connectionparams class password the password for authenticating to the external system. signature public string password {get; set;} property value type: string the value depends on the identity type field of the external data source definition in salesforce. • if identity type is set to named principal, the credentials come from the external data source definition. • if identity type is set to per user: – for queries and searches, the credentials are specific to the current user who invokes the query or search. the credentials come from the user’s authentication settings for the external system. – for administrative connections, such as syncing the external system’s schema, the credentials come from the external data source definition. principaltype an instance of datasource.identitytype, which determines which set of credentials to use to access the external system. signature public datasource.identitytype principaltype {get; set;} property value type: datasource.identitytype protocol the type of protocol that’s used to authenticate to the external system. signature public datasource.authenticationprotocol protocol {get; set;} property value type: datasource.authenticationprotocol repository reserved for future use. 2126apex reference guide datasourceutil class signature public string repository {get; set;} property value type: string reserved for future use. username the username for authenticating to the external system. signature public string username {get; set;} property value type: string the value depends on the identity type field of the external data source definition in salesforce. • if identity type is set to named principal, the credentials come from the external data source definition. • if identity type is set to per user: – for queries and searches, the credentials are specific to the current user who invokes the query or search. the credentials come from the user’s authentication settings for the external system. – for administrative connections, such as syncing the external system’s schema, the credentials come from the external data source definition. datasourceutil class parent class for the datasource.provider, datasource.connection, datasource.table, and data" "source.column classes. namespace datasource in this section: datasourceutil methods datasourceutil methods the following are methods for datasourceutil. 2127apex reference guide datatype enum in this section: logwarning(message) logs the error message in the debug log. throwexception(message) throws a datasourceexception and displays the provided message to the user. logwarning(message) logs the error message in the debug log. signature public void logwarning(string message) parameters message type: string the error message. return value type: void throwexception(message) throws a datasourceexception and displays the provided message to the user. signature public void throwexception(string message) parameters message type: string error message to display to the user. return value type: void datatype enum specifies the data types that are supported by the apex connector framework. 2128apex reference guide deletecontext class usage the datasource.datatype enum is referenced by the type property on the datasource.column class. enum values the following are the values of the datasource.datatype enum. value description boolean_type boolean datetime_type date/time external_lookup_type external lookup relationship indirect_lookup_type indirect lookup relationship lookup_type lookup relationship number_type number string_long_type long text area string_short_type text area url_type url deletecontext class an instance of deletecontext is passed to the deleterows() method on your database.connection class. the class provides context information about the delete request to the implementor of deleterows(). namespace datasource usage the apex connector framework creates context for operations. context is comprised of parameters about the operations, which other methods can use. an instance of the deletecontext class packages these parameters into an object that can be used when a deleterows() operation is initiated. in this section: deletecontext properties deletecontext properties the following are properties for deletecontext. 2129apex reference guide deleteresult class in this section: externalids the external ids of the rows representing external object records to delete. tableselected the name of the table to delete rows from. externalids the external ids of the rows representing external object records to delete. signature public list externalids {get; set;} property value type: list tableselected the name of the table to delete rows from. signature public string tableselected {get; set;} property value type: string deleteresult class represents the result of a delete operation on an sobject record. the result is returned by the datasource.deleterows method of the datasource.connection class. namespace datasource usage a delete operation on external object records generates an array of objects of type datasource.deleteresult. its methods create result records that indicate whether the delete operation succeeded or failed. in this section: deleteresult properties deleteresult methods 2130apex reference guide deleteresult class deleteresult properties the following are properties for deleteresult. in this section: errormessage the error message that’s generated by a failed delete operation. recorded with a result of type datasource.deleteresult. externalid the unique identifier of a row that represents an external object record to delete. success indicates whether a delete operation succeeded or failed. errormessage the error message that’s generated by a failed delete operation. recorded with a result of type datasource.deleteresult. signature public string errormessage {get; set;} property value type: string externalid the unique identifier of a row that represents an external object record to delete. signature public string externalid {get; set;} property value type: string success indicates whether a delete operation succeeded or failed. signature public boolean success {get; set;} property value type: boolean 2131apex reference guide deleteresult class deleteresult methods the following are methods for deleteresult. in this section: equals(obj) maintains the integrity of lists of type deleteresult by determining the equality of external objects in a list. this method is dynamic and is based on the equals method in java. failure(externalid, errormessage) creates a delete result" "indicating the failure of a delete request for a given external id. hashcode() maintains the integrity of lists of type deleteresult by determining the uniqueness of the external object records in a list. success(externalid) creates a delete result indicating the successful completion of a delete request for a given external id. equals(obj) maintains the integrity of lists of type deleteresult by determining the equality of external objects in a list. this method is dynamic and is based on the equals method in java. signature public boolean equals(object obj) parameters obj type: object external object whose key is to be validated. for information about the equals method, see using custom types in map keys and sets. return value type: boolean failure(externalid, errormessage) creates a delete result indicating the failure of a delete request for a given external id. signature public static datasource.deleteresult failure(string externalid, string errormessage) parameters externalid type: string 2132" "apex reference guide filter class the unique identifier of the sobject record to delete. errormessage type: string the reason the delete operation failed. return value type: datasource.deleteresult status result of the delete operation. hashcode() maintains the integrity of lists of type deleteresult by determining the uniqueness of the external object records in a list. signature public integer hashcode() return value type: integer success(externalid) creates a delete result indicating the successful completion of a delete request for a given external id. signature public static datasource.deleteresult success(string externalid) parameters externalid type: string the unique identifier of the sobject record to delete. return value type: datasource.deleteresult status result of the delete operation for the sobject with the given external id. filter class represents a where clause in a sosl or soql query. namespace datasource 2133apex reference guide filter class usage compound types require child filters. specifically, the subfilters property can’t be null if the type property is not_, and_, or or_. in this section: filter properties filter properties the following are properties for filter. in this section: columnname name of the column that’s being evaluated in a simple comparative type of filter. columnvalue value that the filter compares records against in a simple comparative type of filter. subfilters list of subfilters for compound filter types, such as not_, and_, and or_. tablename name of the table whose column is being evaluated in a simple comparative type of filter. type type of filter operation that limits the returned data. columnname name of the column that’s being evaluated in a simple comparative type of filter. signature public string columnname {get; set;} property value type: string columnvalue value that the filter compares records against in a simple comparative type of filter. signature public object columnvalue {get; set;} property value type: object 2134apex reference guide filtertype enum subfilters list of subfilters for compound filter types, such as not_, and_, and or_. signature public list subfilters {get; set;} property value type: list tablename name of the table whose column is being evaluated in a simple comparative type of filter. signature public string tablename {get; set;} property value type: string type type of filter operation that limits the returned data. signature public datasource.filtertype type {get; set;} property value type: datasource.filtertype filtertype enum referenced by the type property on a datasource.filter. usage determines how to limit the returned data. enum values the following are the values of the datasource.filtertype enum. 2135apex reference guide identitytype enum value description and_ this compound filter type returns all rows that match all the subfilters. contains simple comparative filter type. ends_with simple comparative filter type. equals simple comparative filter type. greater_than simple comparative filter type. greater_than_or_equal_to simple comparative filter type. less_than simple comparative filter type. less_than_or_equal_to simple comparative filter type. like_ simple comparative filter type. not_ this compound filter type returns the rows that don’t match the subfilter. not_equals simple comparative filter type. or_ this compound filter type returns all rows that match any of the subfilters. starts_with simple comparative filter type. identitytype enum determines which set of credentials is used to authenticate to the external system. usage the relevant credentials are passed to your datasource.connection class. enum values the following are the values of the datasource.identitytype enum. value description anonymous no credentials are used to authenticate to the external system. named_user the credentials in the external data source definition are used to authenticate to the external system, regardless of which user is accessing the external data from your organization. per_user for queries and searches, the credentials are specific to the current user who invokes the query or search. the credentials come from the user’s authentication settings for the external system. for administrative connections" ", such as syncing the external system’s schema, the credentials come from the external data source definition. 2136apex reference guide order class order class contains details about how to sort the rows in the result set. equivalent to an order by statement in a soql query. namespace datasource usage used in the order property on the datasource.tableselection class. in this section: order properties order methods order properties the following are properties for order. in this section: columnname name of the column whose values are used to sort the rows in the result set. direction direction for sorting rows based on column values. tablename name of the table whose column values are used to sort the rows in the result set. columnname name of the column whose values are used to sort the rows in the result set. signature public string columnname {get; set;} property value type: string direction direction for sorting rows based on column values. signature public datasource.orderdirection direction {get; set;} 2137apex reference guide order class property value type: datasource.orderdirection tablename name of the table whose column values are used to sort the rows in the result set. signature public string tablename {get; set;} property value type: string order methods the following are methods for order. in this section: get(tablename, columnname, direction) creates an instance of the datasource.order class. get(tablename, columnname, direction) creates an instance of the datasource.order class. signature public static datasource.order get(string tablename, string columnname, datasource.orderdirection direction) parameters tablename type: string name of the table whose column values are used to sort the rows in the result set. columnname type: string name of the column whose values are used to sort the rows in the result set. direction type: datasource.orderdirection direction for sorting rows based on column values. return value type: datasource.order 2138apex reference guide orderdirection enum orderdirection enum specifies the direction for sorting rows based on column values. usage used by the direction property on the datasource.order class. enum values the following are the values of the datasource.orderdirection enum. value description ascending sort rows in ascending order (a–z). descending sort rows in descending order (z–a). provider class extend this base class to create a custom adapter for salesforce connect. the class informs salesforce of the functional and authentication capabilities that are supported by or required to connect to the external system. this class extends the datasourceutil class and inherits its methods. namespace datasource usage create an apex class that extends datasource.provider to specify the following. • the types of authentication that can be used to access the external system • the features that are supported for the connection to the external system • the apex class that extends datasource.connection to sync the external system’s schema and to handle the queries and searches of the external data the values that are returned by the datasource.provider class determine which settings are available in the external data source definition in salesforce. to access the external data source definition from setup, enter external data sources in the quick find box, then select external data sources. in this section: provider methods provider methods the following are methods for provider. 2139apex reference guide provider class in this section: getauthenticationcapabilities() returns the types of authentication that can be used to access the external system. getcapabilities() returns the functional operations that the external system supports and the required endpoint settings for the external data source definition in salesforce. getconnection(connectionparams) returns a connection that points to an instance of the external data source. getauthenticationcapabilities() returns the types of authentication that can be used to access the external system. signature public list getauthenticationcapabilities() return value type: list getcapabilities() returns the functional operations that the external system supports and the required endpoint settings for the external data source definition in salesforce. signature public list getcapabilities() return value type: list getconnection" "(connectionparams) returns a connection that points to an instance of the external data source. signature public datasource.connection getconnection(datasource.connectionparams connectionparams) parameters connectionparams type: datasource.connectionparams credentials for authenticating to the external system. 2140apex reference guide queryaggregation enum return value type: datasource.connection queryaggregation enum specifies how to aggregate a column in a query. usage used by the aggregation property on the datasource.columnselection class. enum values the following are the values of the datasource.queryaggregation enum. value description avg reserved for future use. count returns the number of rows that meet the query criteria. max reserved for future use. min reserved for future use. none no aggregation. sum reserved for future use. querycontext class an instance of querycontext is provided to the query method on your datasource.connection class. the instance corresponds to a soql request. namespace datasource in this section: querycontext properties querycontext methods querycontext properties the following are properties for querycontext. 2141apex reference guide querycontext class in this section: querymoretoken query token that’s used for server-driven paging to determine and fetch the subsequent batch of results. tableselection query details that represent the from, order by, select, and where clauses in a soql or sosl query. querymoretoken query token that’s used for server-driven paging to determine and fetch the subsequent batch of results. signature public string querymoretoken {get; set;} property value type: string tableselection query details that represent the from, order by, select, and where clauses in a soql or sosl query. signature public datasource.tableselection tableselection {get; set;} property value type: datasource.tableselection querycontext methods the following are methods for querycontext. in this section: get(metadata, offset, maxresults, tableselection) creates an instance of the querycontext class. get(metadata, offset, maxresults, tableselection) creates an instance of the querycontext class. signature public static datasource.querycontext get(list metadata, integer offset, integer maxresults, datasource.tableselection tableselection) 2142apex reference guide queryutils class parameters metadata type: list list of table metadata that describes the external system’s tables to query. offset type: integer used for client-driven paging. specifies the starting row offset into the query’s result set. maxresults type: integer used for client-driven paging. specifies the maximum number of rows to return in each batch. tableselection type: datasource.tableselection query details that represent the from, order by, select, and where clauses in a soql or sosl query. return value type: datasource.querycontext queryutils class contains helper methods to locally filter, sort, and apply limit and offset clauses to data rows. this helper class is provided for your convenience during early development and tests, but it isn’t supported for use in production environments. namespace datasource usage the datasource.queryutils class and its helper methods can process query results locally within your salesforce org. this class is provided for your convenience to simplify the development of your salesforce connect custom adapter for initial tests. however, the datasource.queryutils class and its methods aren’t supported for use in production environments that use callouts to retrieve data from external systems. complete the filtering and sorting on the external system before sending the query results to salesforce. when possible, use server-driven paging or another technique to have the external system determine the appropriate data subsets according to the limit and offset clauses in the query. in this section: queryutils methods queryutils methods the following are methods for queryutils. 2143apex reference guide queryutils class in this section: applylimitandoffset(querycontext, rows) returns a subset of data rows after locally applying limit and offset clauses from the query. this helper method is provided for your convenience during early development and tests, but it isn’t supported for use in production environments. filter(querycontext, rows) returns a subset of data rows after" "locally ordering and applying filters from the query. this helper method is provided for your convenience during early development and tests, but it isn’t supported for use in production environments. process(querycontext, rows) returns data rows after locally filtering, sorting, ordering, and applying limit and offset clauses from the query. this helper method is provided for your convenience during early development and tests, but it isn’t supported for use in production environments. sort(querycontext, rows) returns data rows after locally sorting and applying the order from the query. this helper method is provided for your convenience during early development and tests, but it isn’t supported for use in production environments. applylimitandoffset(querycontext, rows) returns a subset of data rows after locally applying limit and offset clauses from the query. this helper method is provided for your convenience during early development and tests, but it isn’t supported for use in production environments. signature public static list> applylimitandoffset(datasource.querycontext querycontext, list> rows) parameters querycontext type: datasource.querycontext represents the query to run against a data table. rows type: list> rows of data. return value type: list> filter(querycontext, rows) returns a subset of data rows after locally ordering and applying filters from the query. this helper method is provided for your convenience during early development and tests, but it isn’t supported for use in production environments. signature public static list> filter(datasource.querycontext querycontext, list> rows) 2144apex reference guide queryutils class parameters querycontext type: datasource.querycontext querycontext rows type: list> rows of data. return value type: list> process(querycontext, rows) returns data rows after locally filtering, sorting, ordering, and applying limit and offset clauses from the query. this helper method is provided for your convenience during early development and tests, but it isn’t supported for use in production environments. signature public static list> process(datasource.querycontext querycontext, list> rows) parameters querycontext type: datasource.querycontext represents the query to run against a data table. rows type: list> rows of data. return value type: list> sort(querycontext, rows) returns data rows after locally sorting and applying the order from the query. this helper method is provided for your convenience during early development and tests, but it isn’t supported for use in production environments. signature public static list> sort(datasource.querycontext querycontext, list> rows) 2145apex reference guide readcontext class parameters querycontext type: datasource.querycontext represents the query to run against a data table. rows type: list> rows of data. return value type: list> readcontext class abstract base class for the querycontext and searchcontext classes. namespace datasource in this section: readcontext properties readcontext properties the following are properties for readcontext. in this section: maxresults maximum number of rows that the query can return. metadata describes the external system’s tables to query. offset the starting row offset into the query’s result set. used for client-driven paging. maxresults maximum number of rows that the query can return. signature public integer maxresults {get; set;} 2146apex reference guide searchcontext class property value type: integer metadata describes the external system’s tables to query. signature public list metadata {get; set;} property value type: list offset the starting row offset into the query’s result set. used for client-driven paging. signature public integer offset {get; set;} property value type: integer searchcontext class an instance of searchcontext is provided to the search method on your datasource.connection class. the instance correspond" "s to a search or sosl request. namespace datasource in this section: searchcontext constructors searchcontext properties searchcontext constructors the following are constructors for searchcontext. in this section: searchcontext(metadata, offset, maxresults, tableselections, searchphrase) creates an instance of the searchcontext class with the specified parameter values. 2147apex reference guide searchcontext class searchcontext() creates an instance of the searchcontext class. searchcontext(metadata, offset, maxresults, tableselections, searchphrase) creates an instance of the searchcontext class with the specified parameter values. signature public searchcontext(list metadata, integer offset, integer maxresults, list tableselections, string searchphrase) parameters metadata type: list list of table metadata that describes the external system’s tables to query. offset type: integer specifies the starting row offset into the query’s result set. maxresults type: integer specifies the maximum number of rows to return in each batch. tableselections type: list list of queries and their details. the details represent the from, order by, select, and where clauses in each soql or sosl query. searchphrase type: string the user-entered search string as a case-sensitive single phrase, with all non-alphanumeric characters removed. searchcontext() creates an instance of the searchcontext class. signature public searchcontext() searchcontext properties the following are properties for searchcontext. 2148apex reference guide searchutils class in this section: searchphrase the user-entered search string as a case-sensitive single phrase, with all non-alphanumeric characters removed. tableselections list of queries and their details. the details represent the from, order by, select, and where clauses in each soql or sosl query. searchphrase the user-entered search string as a case-sensitive single phrase, with all non-alphanumeric characters removed. signature public string searchphrase {get; set;} property value type: string tableselections list of queries and their details. the details represent the from, order by, select, and where clauses in each soql or sosl query. signature public list tableselections {get; set;} property value type: list searchutils class helper class for implementing search on a custom adapter for salesforce connect. namespace datasource usage we recommend that you develop your own search implementation that can search columns in addition to the designated name field. in this section: searchutils methods searchutils methods the following are methods for searchutils. 2149apex reference guide table class in this section: searchbyname(searchdetails, connection) queries all the tables and returns each row whose designated name field contains the search phrase. searchbyname(searchdetails, connection) queries all the tables and returns each row whose designated name field contains the search phrase. signature public static list searchbyname(datasource.searchcontext searchdetails, datasource.connection connection) parameters searchdetails type: datasource.searchcontext the searchcontext class that specifies which data to search and what to search for. connection type: datasource.connection the datasource.connection class that connects to the external system. return value type: list table class describes a table on an external system that the salesforce connect custom adapter connects to. this class extends the datasourceutil class and inherits its methods. namespace datasource usage a list of table metadata is provided by the datasource.connection class when the sync() method is invoked. each table can become an external object in salesforce. the metadata is stored in salesforce. updating the apex code to return new or updated values for the table metadata doesn’t automatically update the stored metadata in salesforce. in this section: table properties table methods 2150apex reference guide table class table properties the following are properties for table. in this section: columns list of table columns. description description of what the table represents. labelplural plural form of the user-friendly name for the table. the label" "plural becomes the object’s plural label in the salesforce user interface. labelsingular singular form of the user-friendly name for the table. the labelsingular becomes the object label in the salesforce user interface. we recommend that you make object labels unique across all standard, custom, and external objects in the org. name name of the table on the external system. namecolumn name of the table column that becomes the name field of the external object when the administrator syncs the table. columns list of table columns. signature public list columns {get; set;} property value type: list description description of what the table represents. signature public string description {get; set;} property value type: string labelplural plural form of the user-friendly name for the table. the labelplural becomes the object’s plural label in the salesforce user interface. 2151apex reference guide table class signature public string labelplural {get; set;} datasource.table, labelplural property value type: string labelsingular singular form of the user-friendly name for the table. the labelsingular becomes the object label in the salesforce user interface. we recommend that you make object labels unique across all standard, custom, and external objects in the org. signature public string labelsingular {get; set;} property value type: string name name of the table on the external system. signature public string name {get; set;} property value type: string namecolumn name of the table column that becomes the name field of the external object when the administrator syncs the table. signature public string namecolumn {get; set;} property value type: string table methods the following are methods for table. 2152apex reference guide table class in this section: get(name, labelsingular, labelplural, description, namecolumn, columns) returns the table metadata with the specified parameter values. get(name, namecolumn, columns) returns the table metadata with the specified parameter values, using the name for the labels and description. get(name, labelsingular, labelplural, description, namecolumn, columns) returns the table metadata with the specified parameter values. signature public static datasource.table get(string name, string labelsingular, string labelplural, string description, string namecolumn, list columns) parameters name type: string name of the external table. labelsingular type: string singular form of the user-friendly name for the table. the labelsingular becomes the object label in the salesforce user interface. labelplural type: string plural form of the user-friendly name for the table. the labelplural becomes the object’s plural label in the salesforce user interface. description type: string description of the external table. namecolumn type: string name of the table column that becomes the name field of the external object when the administrator syncs the table. columns type: list list of table columns. return value type: datasource.table get(name, namecolumn, columns) returns the table metadata with the specified parameter values, using the name for the labels and description. 2153apex reference guide tableresult class signature public static datasource.table get(string name, string namecolumn, list columns) datasource.table, get, [string, string, list], datasource.table parameters name type: string name of the external table. namecolumn type: string name of the table column that becomes the name field of the external object when the administrator syncs the table. columns type: list list of table columns. return value type: datasource.table the returned table metadata has these property values. property value name name labelsingular name labelplural name description name namecolumn namecolumn columns columns tableresult class contains the results of a search or query. namespace datasource in this section: tableresult properties tableresult methods 2154apex reference guide tableresult class tableresult properties the following are properties for tableresult. in this section: errormessage errormessage querymoretoken query token that’s used for server-" "driven paging to determine and fetch the subsequent batch of results. this token is passed back to the apex data source on subsequent queries in the querymoretoken property on the querycontext. rows rows of data. success whether the search or query was successful. tablename name of the table that was queried. totalsize the total number of rows that meet the query criteria, even when the external system is requested to return a smaller batch size. errormessage errormessage signature public string errormessage {get; set;} property value type: string querymoretoken query token that’s used for server-driven paging to determine and fetch the subsequent batch of results. this token is passed back to the apex data source on subsequent queries in the querymoretoken property on the querycontext. signature public string querymoretoken {get; set;} property value type: string rows rows of data. 2155apex reference guide tableresult class signature public list> rows {get; set;} property value type: list> success whether the search or query was successful. signature public boolean success {get; set;} property value type: boolean tablename name of the table that was queried. signature public string tablename {get; set;} property value type: string totalsize the total number of rows that meet the query criteria, even when the external system is requested to return a smaller batch size. signature public integer totalsize {get; set;} property value type: integer tableresult methods the following are methods for tableresult. 2156apex reference guide tableresult class in this section: error(errormessage) returns failed search or query results with the provided error message. get(success, errormessage, tablename, rows, totalsize) returns a subset of data rows in a tableresult with the provided property values and the number of rows in the table. get(success, errormessage, tablename, rows) returns a subset of data rows in a tableresult with the provided property values. get(querycontext, rows) returns the subset of data rows that meet the query criteria, and the number of rows in the table, in a tableresult. get(tableselection, rows) returns the subset of data rows that meet the query criteria, and the number of rows in the table, in a tableresult. error(errormessage) returns failed search or query results with the provided error message. signature public static datasource.tableresult error(string errormessage) parameters errormessage type: string errormessage return value type: datasource.tableresult the returned tableresult has these property values. property value success false errormessage errormessage tablename null rows null rows.size() 0 get(success, errormessage, tablename, rows, totalsize) returns a subset of data rows in a tableresult with the provided property values and the number of rows in the table. 2157apex reference guide tableresult class signature public static datasource.tableresult get(boolean success, string errormessage, string tablename, list> rows, integer totalsize) parameters success type: boolean whether the search or query was successful. errormessage type: string errormessage tablename type: string name of the table that was queried. rows type: list> rows of data. totalsize type: integer the total number of rows that meet the query criteria, even when the external system is requested to return a smaller batch size. return value type: datasource.tableresult get(success, errormessage, tablename, rows) returns a subset of data rows in a tableresult with the provided property values. signature public static datasource.tableresult get(boolean success, string errormessage, string tablename, list> rows) parameters success type: boolean whether the search or query was successful. errormessage type: string errormessage tablename type: string 2158apex reference guide tableresult class name of the table that was queried. rows type: list> rows of data. return value type: datasource.tableresult get(querycontext, rows) returns the subset of data rows that meet the query criteria, and the number of rows in the table, in a" "tableresult. signature public static datasource.tableresult get(datasource.querycontext querycontext, list> rows) parameters querycontext type: datasource.querycontext represents the query to run against a data table. rows type: list> rows of data. return value type: datasource.tableresult get(tableselection, rows) returns the subset of data rows that meet the query criteria, and the number of rows in the table, in a tableresult. signature public static datasource.tableresult get(datasource.tableselection tableselection, list> rows) parameters tableselection type: datasource.tableselection query details that represent the from, order by, select, and where clauses in a soql or sosl query. rows type: list> rows of data. 2159apex reference guide tableselection class return value type: datasource.tableresult tableselection class contains a breakdown of the soql or sosl query. its properties represent the from, order by, select, and where clauses in the query. namespace datasource in this section: tableselection properties tableselection properties the following are properties for tableselection. in this section: columnsselected list of columns to query. corresponds to the select clause in a soql or sosl query. filter identifies the query filter, which can be a compound filter that has a list of subfilters. the filter corresponds to the where clause in a soql or sosl query. order identifies the order for sorting the query results. corresponds to the order by clause in a soql or sosl query. tableselected name of the table to query. corresponds to the from clause in a soql or sosl query. columnsselected list of columns to query. corresponds to the select clause in a soql or sosl query. signature public list columnsselected {get; set;} property value type: list filter identifies the query filter, which can be a compound filter that has a list of subfilters. the filter corresponds to the where clause in a soql or sosl query. 2160apex reference guide upsertcontext class signature public datasource.filter filter {get; set;} property value type: datasource.filter order identifies the order for sorting the query results. corresponds to the order by clause in a soql or sosl query. signature public list order {get; set;} property value type: list tableselected name of the table to query. corresponds to the from clause in a soql or sosl query. signature public string tableselected {get; set;} property value type: string upsertcontext class an instance of upsertcontext is passed to the upsertrows() method on your datasource.connection class. this class provides context information about the upsert request to the implementor of upsertrows(). namespace datasource usage the apex connector framework creates the contet for operations. context is comprised of parameters about the operations, which other methods can use. an instance of the upsertcontext class packages these parameters into an object that can be used when an upsertrows() operation is initiated. in this section: upsertcontext properties 2161apex reference guide upsertresult class upsertcontext properties the following are properties for upsertcontext. in this section: rows list of rows corresponding to the external object records to upsert. tableselected the name of the table to upsert rows in. rows list of rows corresponding to the external object records to upsert. signature public list> rows {get; set;} property value type: list> tableselected the name of the table to upsert rows in. signature public string tableselected {get; set;} property value type: string upsertresult class represents the result of an upsert operation on an external object record. the result is returned by the upsertrows method of the datasource.connection class. namespace datasource usage an upsert operation" "on external object records generates an array of objects of type datasource.upsertresult. its methods create result records that indicate whether the upsert operation succeeded or failed. 2162apex reference guide upsertresult class in this section: upsertresult properties upsertresult methods upsertresult properties the following are properties for upsertresult. in this section: errormessage the error message that’s generated by a failed upsert operation. externalid the unique identifier of a row that represents an external object record to upsert. success indicates whether a delete operation succeeded or failed. errormessage the error message that’s generated by a failed upsert operation. signature public string errormessage {get; set;} property value type: string externalid the unique identifier of a row that represents an external object record to upsert. signature public string externalid {get; set;} property value type: string success indicates whether a delete operation succeeded or failed. signature public boolean success {get; set;} 2163apex reference guide upsertresult class property value type: boolean upsertresult methods the following are methods for upsertresult. in this section: equals(obj) maintains the integrity of lists of type upsertresult by determining the equality of external object records in a list. this method is dynamic and is based on the equals method in java. failure(externalid, errormessage) creates an upsert result that indicates the failure of a delete request for a given external id. hashcode() maintains the integrity of lists of type upsertresult by determining the uniqueness of the external object records in a list. success(externalid) creates a delete result that indicates the successful completion of an upsert request for a given external id. equals(obj) maintains the integrity of lists of type upsertresult by determining the equality of external object records in a list. this method is dynamic and is based on the equals method in java. signature public boolean equals(object obj) parameters obj type: object external object whose key is to be validated. return value type: boolean failure(externalid, errormessage) creates an upsert result that indicates the failure of a delete request for a given external id. signature public static datasource.upsertresult failure(string externalid, string errormessage) 2164apex reference guide datasource exceptions parameters externalid type: string the unique identifier of the external object record to upsert. errormessage type: string the reason the upsert operation failed. return value type: datasource.upsertresult status result for the upsert operation. hashcode() maintains the integrity of lists of type upsertresult by determining the uniqueness of the external object records in a list. signature public integer hashcode() return value type: integer success(externalid) creates a delete result that indicates the successful completion of an upsert request for a given external id. signature public static datasource.upsertresult success(string externalid) parameters externalid type: string the unique identifier of the external object record to upsert. return value type: datasource.upsertresult status result of the upsert operation for the external object record with the given external id. datasource exceptions the datasource namespace contains exception classes. 2165apex reference guide dataweave namespace (beta) all exception classes support built-in methods for returning the error message and exception type. see exception class and built-in exceptions. the datasource namespace contains these exceptions. exception description methods datasource.datasourceexception throw this exception to indicate that an to get the error message and write it error occurred while communicating with to debug log, use the string an external data source. getmessage(). datasource.oauthtokenexpiredexception throw this exception to indicate that an to get the error message and write it oauth token has expired. the system then to debug log, use the string attempts to refresh the token getmessage(). automatically and restart the query, search, or sync operation. dataweave namespace (beta) the dataweave namespace provides classes and methods to support the invocation of dataweave scripts from apex. note: this feature is a beta service. customer may opt to try such beta service in its sole discretion. any use of the beta service is subject to the applicable beta services terms" "provided at agreements and terms. you can provide feedback and suggestions for the dataweave in apex feature in the trailblazer community. the beta release of dataweave in apex supports packaging of dataweave scripts within a namespace. however, you can only access scripts within a package, not across different namespaces. dataweave class methods are supported only in scratch orgs that have the dataweaveinapex feature enabled. dataweave in apex doesn’t support packaging. dataweave is the mulesoft expression language for accessing, parsing, and transforming data that travels through a mule application. for detailed information, see dataweave language. these are the classes in the dataweave namespace. in this section: result class contains methods to retrieve data that was transformed using script class methods. script class contains the createscript() method to load dataweave scripts and the execute() method to obtain script output in a dataweave.result object. see also: dataweave in apex result class contains methods to retrieve data that was transformed using script class methods. 2166apex reference guide result class note: this feature is a beta service. customer may opt to try such beta service in its sole discretion. any use of the beta service is subject to the applicable beta services terms provided at agreements and terms. you can provide feedback and suggestions for the dataweave in apex feature in the trailblazer community. the beta release of dataweave in apex supports packaging of dataweave scripts within a namespace. however, you can only access scripts within a package, not across different namespaces. namespace dataweave example see script class for an example to run a dataweave script from apex and retrieve the resulting script output. in this section: result methods result methods the following are methods for result. in this section: getvalue() returns the result of a dataweave script execution as an object. getvalueasstring() returns the result of a dataweave script execution as a string value. getvalue() returns the result of a dataweave script execution as an object. note: this feature is a beta service. customer may opt to try such beta service in its sole discretion. any use of the beta service is subject to the applicable beta services terms provided at agreements and terms. you can provide feedback and suggestions for the dataweave in apex feature in the trailblazer community. the beta release of dataweave in apex supports packaging of dataweave scripts within a namespace. however, you can only access scripts within a package, not across different namespaces. signature public object getvalue() return value type: object getvalueasstring() returns the result of a dataweave script execution as a string value. 2167apex reference guide script class note: this feature is a beta service. customer may opt to try such beta service in its sole discretion. any use of the beta service is subject to the applicable beta services terms provided at agreements and terms. you can provide feedback and suggestions for the dataweave in apex feature in the trailblazer community. the beta release of dataweave in apex supports packaging of dataweave scripts within a namespace. however, you can only access scripts within a package, not across different namespaces. signature public string getvalueasstring() return value type: string script class contains the createscript() method to load dataweave scripts and the execute() method to obtain script output in a dataweave.result object. note: this feature is a beta service. customer may opt to try such beta service in its sole discretion. any use of the beta service is subject to the applicable beta services terms provided at agreements and terms. you can provide feedback and suggestions for the dataweave in apex feature in the trailblazer community. the beta release of dataweave in apex supports packaging of dataweave scripts within a namespace. however, you can only access scripts within a package, not across different namespaces. namespace dataweave this example runs a dataweave script from apex and retrieves the resulting script output. first deploy the script to the org as contactstojson.dwl. %dw 2.0 input records application/java output application/json --- { users: records map(record) -> { firstname: record.firstname, lastname: record.lastname } then, execute the script from apex. list data = [select firstname, lastname from contact where lastname limit 5]; map args = new map{ 'records' => data }; dataweave.script script = dataweave.script.createscript('contactstojson'); dataweave.result result = script.execute(args); string jsonoutput = result.getvalueasstring(); in this section: script methods 2168apex reference guide script class script methods the following are methods for script. in this section: createscript(scriptname) loads a dataweave 2.0 script from the .dwl metadata file that is deployed in an org. the script can then be run using the script.execute method. createscript(namespace, scriptname) loads a dataweave 2.0 script from a specified namespace. the script can then be run using the script.execute method. execute(parameters) executes the dataweave script that is loaded using the createscript() method and returns the script output. tostring() returns the name of the script. createscript(scriptname) loads a dataweave 2.0 script from the .dwl metadata file that is deployed in an org. the script can then be run using the script.execute method. note: this feature is a beta service. customer may opt to try such beta service in its sole discretion. any use of the beta service is subject to the applicable beta services terms provided at agreements and terms. you can provide feedback and suggestions for the dataweave in apex feature in the trailblazer community. the beta release of dataweave in apex supports packaging of dataweave scripts within a namespace. however, you can only access scripts within a package, not across different namespaces. signature public static createscript(string scriptname) parameters scriptname type: string the name of the deployed metadata .dwl script (not including the file extension). return value type: dataweave.script dataweave script that is used as a parameter in the script.execute() method. createscript(namespace, scriptname) loads a dataweave 2.0 script from a specified namespace. the script can then be run using the script.execute method. note: this feature is a beta service. customer may opt to try such beta service in its sole discretion. any use of the beta service is subject to the applicable beta services terms provided at agreements and terms. you can provide feedback and suggestions for the dataweave in apex feature in the trailblazer community. the beta release of dataweave in apex supports packaging of dataweave scripts within a namespace. however, you can only access scripts within a package, not across different namespaces. 2169apex reference guide script class signature public static dataweave.script createscript(string namespace, string scriptname) parameters namespace type: string the namespace name for the deployed script. if the namespace name is null, the caller namespace is used. if the namespace name is empty, the org namespace is used. scriptname type: string the name of the deployed metadata .dwl script (not including the file extension). return value type: dataweave.script dataweave script that is used as a parameter in the script.execute() method. execute(parameters) executes the dataweave script that is loaded using the createscript() method and returns the script output. note: this feature is a beta service. customer may opt to try such beta service in its sole discretion. any use of the beta service is subject to the applicable beta services terms provided at agreements and terms. you can provide feedback and suggestions for the dataweave in apex feature in the trailblazer community. the beta release of dataweave in apex supports packaging of dataweave scripts within a namespace. however, you can only access scripts within a package, not across different namespaces. signature public execute(map parameters) parameters parameters type: map input to the dataweave script. the keys correspond to the input directive names defined in the dataweave header. see input directive and dataweave header. return value type: dataweave.result the dataweave.result object contains the script output. tostring() returns the name of the script. 2170apex reference guide dom namespace note: this feature is a beta service. customer may opt to try such beta service in its sole discretion. any use of the beta service is subject to the applicable beta services terms provided at agreements and terms. you can provide feedback and suggestions for" "the dataweave in apex feature in the trailblazer community. the beta release of dataweave in apex supports packaging of dataweave scripts within a namespace. however, you can only access scripts within a package, not across different namespaces. signature public string tostring() return value type: string dom namespace the dom namespace provides classes and methods for parsing and creating xml content. the following are the classes in the dom namespace. in this section: document class use the document class to process xml content. you can parse nested xml content that’s up to 50 nodes deep. xmlnode class use the xmlnode class to work with a node in an xml document. document class use the document class to process xml content. you can parse nested xml content that’s up to 50 nodes deep. namespace dom usage one common application is to use it to create the body of a request for httprequest or to parse a response accessed by httpresponse. in this section: document constructors document methods see also: reading and writing xml using the dom 2171apex reference guide document class document constructors the following are constructors for document. in this section: document() creates a new instance of the dom.document class. document() creates a new instance of the dom.document class. signature public document() document methods the following are methods for document. all are instance methods. in this section: createrootelement(name, namespace, prefix) creates the top-level root element for a document. getrootelement() returns the top-level root element node in the document. if this method returns null, the root element has not been created yet. load(xml) parse the xml representation of the document specified in the xml argument and load it into a document. toxmlstring() returns the xml representation of the document as a string. createrootelement(name, namespace, prefix) creates the top-level root element for a document. signature public dom.xmlnode createrootelement(string name, string namespace, string prefix) parameters name type: string namespace type: string prefix type: string 2172apex reference guide document class return value type: dom.xmlnode usage for more information about namespaces, see reading and writing xml using the dom. calling this method more than once on a document generates an error as a document can have only one root element. getrootelement() returns the top-level root element node in the document. if this method returns null, the root element has not been created yet. signature public dom.xmlnode getrootelement() return value type: dom.xmlnode load(xml) parse the xml representation of the document specified in the xml argument and load it into a document. signature public void load(string xml) parameters xml type: string return value type: void example dom.document doc = new dom.document(); doc.load(xml); toxmlstring() returns the xml representation of the document as a string. signature public string toxmlstring() 2173apex reference guide xmlnode class return value type: string xmlnode class use the xmlnode class to work with a node in an xml document. namespace dom xmlnode methods the following are methods for xmlnode. all are instance methods. in this section: addchildelement(name, namespace, prefix) creates a child element node for this node. addcommentnode(text) creates a child comment node for this node. addtextnode(text) creates a child text node for this node. getattribute(key, keynamespace) returns namespaceprefix:attributevalue for the given key and key namespace. getattributecount() returns the number of attributes for this node. getattributekeyat(index) returns the attribute key for the given index. index values start at 0. getattributekeynsat(index) returns the attribute key namespace for the given index. getattributevalue(key, keynamespace) returns the attribute value for the given key and key namespace. getattributevaluens(key, keynamespace) returns the attribute value namespace for the given key and key namespace. getchildelement(name, namespace) returns the child element node for the node with the given name and namespace. getchildelements() returns the child element nodes for this node" ". this doesn't include child text or comment nodes. getchildren() returns the child nodes for this node. this includes all node types. getname() returns the element name. 2174apex reference guide xmlnode class getnamespace() returns the namespace of the element. getnamespacefor(prefix) returns the namespace of the element for the given prefix. getnodetype() returns the node type. getparent() returns the parent of this element. getprefixfor(namespace) returns the prefix of the given namespace. gettext() returns the text for this node. insertbefore(newchild, refchild) inserts a new child node before the specified node. removeattribute(key, keynamespace) removes the attribute with the given key and key namespace. returns true if successful, false otherwise. removechild(childnode) removes the given child node. setattribute(key, value) sets the key attribute value. setattributens(key, value, keynamespace, valuenamespace) sets the key attribute value. setnamespace(prefix, namespace) sets the namespace for the given prefix. addchildelement(name, namespace, prefix) creates a child element node for this node. signature public dom.xmlnode addchildelement(string name, string namespace, string prefix) parameters name type: string the name argument can't have a null value. namespace type: string prefix type: string 2175apex reference guide xmlnode class return value type: dom.xmlnode usage • if the namespace argument has a non-null value and the prefix argument is null, the namespace is set as the default namespace. • if the prefix argument is null, salesforce automatically assigns a prefix for the element. the format of the automatic prefix is nsi, where i is a number.if the prefix argument is '', the namespace is set as the default namespace. addcommentnode(text) creates a child comment node for this node. signature public dom.xmlnode addcommentnode(string text) parameters text type: string the text argument can't have a null value. return value type: dom.xmlnode addtextnode(text) creates a child text node for this node. signature public dom.xmlnode addtextnode(string text) parameters text type: string the text argument can't have a null value. return value type: dom.xmlnode getattribute(key, keynamespace) returns namespaceprefix:attributevalue for the given key and key namespace. 2176apex reference guide xmlnode class signature public string getattribute(string key, string keynamespace) parameters key type: string keynamespace type: string return value type: string example for example, for the element: • getattribute returns c:d • getattributevalue returns d getattributecount() returns the number of attributes for this node. signature public integer getattributecount() return value type: integer getattributekeyat(index) returns the attribute key for the given index. index values start at 0. signature public string getattributekeyat(integer index) parameters index type: integer return value type: string 2177apex reference guide xmlnode class getattributekeynsat(index) returns the attribute key namespace for the given index. signature public string getattributekeynsat(integer index) parameters index type: integer return value type: string getattributevalue(key, keynamespace) returns the attribute value for the given key and key namespace. signature public string getattributevalue(string key, string keynamespace) parameters key type: string keynamespace type: string return value type: string example for example, for the element: • getattribute returns c:d • getattributevalue returns d getattributevaluens(key, keynamespace) returns the attribute value namespace for the given key and key namespace. signature public string getattributevaluens(string key, string keynamespace) 2178apex reference guide xmlnode class parameters key type: string keynamespace type: string return value type: string getchildelement(" "name, namespace) returns the child element node for the node with the given name and namespace. signature public dom.xmlnode getchildelement(string name, string namespace) parameters name type: string namespace type: string return value type: dom.xmlnode getchildelements() returns the child element nodes for this node. this doesn't include child text or comment nodes. signature public dom.xmlnode[] getchildelements() return value type: dom.xmlnode[] getchildren() returns the child nodes for this node. this includes all node types. signature public dom.xmlnode[] getchildren() 2179apex reference guide xmlnode class return value type: dom.xmlnode[] getname() returns the element name. signature public string getname() return value type: string getnamespace() returns the namespace of the element. signature public string getnamespace() return value type: string getnamespacefor(prefix) returns the namespace of the element for the given prefix. signature public string getnamespacefor(string prefix) parameters prefix type: string return value type: string getnodetype() returns the node type. 2180apex reference guide xmlnode class signature public dom.xmlnodetype getnodetype() return value type: dom.xmlnodetype getparent() returns the parent of this element. signature public dom.xmlnode getparent() return value type: dom.xmlnode getprefixfor(namespace) returns the prefix of the given namespace. signature public string getprefixfor(string namespace) parameters namespace type: string the namespace argument can't have a null value. return value type: string gettext() returns the text for this node. signature public string gettext() return value type: string 2181apex reference guide xmlnode class insertbefore(newchild, refchild) inserts a new child node before the specified node. signature public dom.xmlnode insertbefore(dom.xmlnode newchild, dom.xmlnode refchild) parameters newchild type: dom.xmlnode the node to insert. refchild type: dom.xmlnode the node before the new node. return value type: dom.xmlnode usage • if refchild is null, newchild is inserted at the end of the list. • if refchild doesn't exist, an exception is thrown. removeattribute(key, keynamespace) removes the attribute with the given key and key namespace. returns true if successful, false otherwise. signature public boolean removeattribute(string key, string keynamespace) parameters key type: string keynamespace type: string return value type: boolean removechild(childnode) removes the given child node. 2182" "apex reference guide xmlnode class signature public boolean removechild(dom.xmlnode childnode) parameters childnode type: dom.xmlnode return value type: boolean setattribute(key, value) sets the key attribute value. signature public void setattribute(string key, string value) parameters key type: string value type: string return value type: void setattributens(key, value, keynamespace, valuenamespace) sets the key attribute value. signature public void setattributens(string key, string value, string keynamespace, string valuenamespace) parameters key type: string value type: string keynamespace type: string 2183apex reference guide eventbus namespace valuenamespace type: string return value type: void setnamespace(prefix, namespace) sets the namespace for the given prefix. signature public void setnamespace(string prefix, string namespace) parameters prefix type: string namespace type: string return value type: void eventbus namespace the eventbus namespace provides classes and methods for platform events and change data capture events. the following are the classes in the eventbus namespace. in this section: changeeventheader class contains header fields of change data capture events. eventpublishfailurecallback interface implement this interface to track platform event messages that failed to publish. the onfailure() method in this interface is called when the final result of the asynchronous publish operation becomes available. eventpublishsuccesscallback interface implement this interface to track platform event messages that were published successfully. the onsuccess() method in this interface is called when the final result of the asynchronous publish operation becomes available. failureresult interface contains the result of an apex publish callback when the event publishing failed. this interface is used as a parameter in the onfailure method of the eventpublishfailurecallback interface. 2184apex reference guide changeeventheader class successresult interface contains the result of an apex publish callback when the event publishing succeeded. this interface is used as a parameter in the onsuccess method of the eventpublishsuccesscallback interface. testbroker class contains methods that simulate the successful delivery or failed publishing of platform event or change event messages in an apex test. triggercontext class provides information about the platform event or change event trigger that’s currently executing, such as how many times the trigger was retried due to the eventbus.retryableexception. also, provides a method to resume trigger executions. see also: platform events developer guide changeeventheader class contains header fields of change data capture events. namespace eventbus in this section: changeeventheader properties see also: change data capture developer guide changeeventheader properties the following are properties for changeeventheader. in this section: changedfields a list of the fields that were changed in an update operation, including the lastmodifieddate system field. this field is empty for other operations, including record creation. this property is available in apex saved using api version 47.0 or later. changeorigin only populated for changes done by api apps or from lightning experience; empty otherwise. the salesforce api and the api client id that initiated the change, if set by the client. use this field to detect whether your app initiated the change to not process the change again and potentially avoid a deep cycle of changes. changetype the operation that caused the change. 2185apex reference guide changeeventheader class commitnumber the system change number (scn) of a committed transaction, which increases sequentially. this field is provided for diagnostic purposes. the field value is not guaranteed to be unique in salesforce—it is unique only in a single database instance. if your salesforce org migrates to another database instance, the commit number might not be unique or sequential. committimestamp the date and time when the change occurred, represented as the number of milliseconds since january 1, 1970 00:00:00 gmt. commituser the id of the user that ran the change operation. difffields contains the names of fields whose values are sent as a unified diff because they contain large text values. entityname the api name of the standard or custom object that the change pertains to. for example, account or myobject__c. nulledfields contains the names of fields whose values were changed to null in an update operation. use this field in apex change event messages to determine if a field was changed to null in an update" "and isn’t an unchanged field. recordids one or more record ids for the changed records. typically, this field contains one record id. if in one transaction the same change occurred in multiple records of the same object type during one second, salesforce merges the change notifications. in this case, salesforce sends one change event for all affected records and the recordids field contains the ids for all records that have the same change. sequencenumber the sequence of the change within a transaction. the sequence number starts from 1. transactionkey a string that uniquely identifies each salesforce transaction. you can use this key to identify and group all changes that were made in the same transaction. changedfields a list of the fields that were changed in an update operation, including the lastmodifieddate system field. this field is empty for other operations, including record creation. this property is available in apex saved using api version 47.0 or later. signature public list changedfields {get; set;} property value type: list changeorigin only populated for changes done by api apps or from lightning experience; empty otherwise. the salesforce api and the api client id that initiated the change, if set by the client. use this field to detect whether your app initiated the change to not process the change again and potentially avoid a deep cycle of changes. 2186apex reference guide changeeventheader class signature public string changeorigin {get; set;} property value type: string the format of the changeorigin field value is: com/salesforce/api//;client= is the name of the salesforce api used to make the data change. it can take one of these values: soap, rest, bulkapi, xmlrpc, oldsoap, toolingsoap, toolingrest, apex, apexdebuggerrest. • is the version of the api call that made the change and is in the format xx.x. • is a string that contains the client id of the app that initiated the change. if the client id is not set in the api call, client= is not appended to the changeorigin field. example: com/salesforce/api/soap/49.0;client=astro the client id is set in the call options header of an api call. for an example on how to set the call options header, see: • rest api: sforce-call-options header. (bulk api also uses the sforce-call-options header. ) • soap api: calloptions header. (apex api also uses the calloptions element.) changetype the operation that caused the change. signature public string changetype {get; set;} property value type: string can be one of the following values: • create • update • delete • undelete for gap events, the change type starts with the gap_ prefix. • gap_create • gap_update • gap_delete • gap_undelete for overflow events, the change type is gap_overflow. 2187apex reference guide changeeventheader class commitnumber the system change number (scn) of a committed transaction, which increases sequentially. this field is provided for diagnostic purposes. the field value is not guaranteed to be unique in salesforce—it is unique only in a single database instance. if your salesforce org migrates to another database instance, the commit number might not be unique or sequential. signature public long commitnumber {get; set;} property value type: long committimestamp the date and time when the change occurred, represented as the number of milliseconds since january 1, 1970 00:00:00 gmt. signature public long committimestamp {get; set;} property value type: long commituser the id of the user that ran the change operation. signature public string commituser {get; set;} property value type: string difffields contains the names of fields whose values are sent as a unified diff because they contain large text values. signature public list difffields {get; set;} 2188apex reference guide changeeventheader class property value type: list see also: change data capture developer guide: sending data differences for fields of updated records" "entityname the api name of the standard or custom object that the change pertains to. for example, account or myobject__c. signature public string entityname {get; set;} property value type: string nulledfields contains the names of fields whose values were changed to null in an update operation. use this field in apex change event messages to determine if a field was changed to null in an update and isn’t an unchanged field. signature public list nulledfields {get; set;} property value type: list recordids one or more record ids for the changed records. typically, this field contains one record id. if in one transaction the same change occurred in multiple records of the same object type during one second, salesforce merges the change notifications. in this case, salesforce sends one change event for all affected records and the recordids field contains the ids for all records that have the same change. signature public list recordids {get; set;} property value type: list examples of operations with same changes are: • update of fielda to valuea in account records. • deletion of account records. • renaming or replacing a picklist value that results in updating the field value in all affected records. 2189apex reference guide eventpublishfailurecallback interface the recordids field can contain a wildcard value when a change event message is generated for custom field type conversions that cause data loss. in this case, the recordids value is the three-character prefix of the object, followed by the wildcard character *. for example, for accounts, the value is 001*. sequencenumber the sequence of the change within a transaction. the sequence number starts from 1. signature public integer sequencenumber {get; set;} property value type: integer a lead conversion is an example of a transaction that can have multiple changes. a lead conversion results in the following sequence of changes, all within the same transaction. 1. create an account 2. create a contact 3. create an opportunity 4. update a lead transactionkey a string that uniquely identifies each salesforce transaction. you can use this key to identify and group all changes that were made in the same transaction. signature public string transactionkey {get; set;} property value type: string eventpublishfailurecallback interface implement this interface to track platform event messages that failed to publish. the onfailure() method in this interface is called when the final result of the asynchronous publish operation becomes available. namespace eventbus usage for more information, see get the result of asynchronous platform event publishing with apex publish callbacks in the platform events developer guide. 2190apex reference guide eventpublishsuccesscallback interface in this section: eventpublishfailurecallback methods eventpublishfailurecallback example implementation eventpublishfailurecallback methods the following are methods for eventpublishfailurecallback. in this section: onfailure(result) the system invokes this method when the final result of eventbus.publish is available and the publishing of the platform event message failed. onfailure(result) the system invokes this method when the final result of eventbus.publish is available and the publishing of the platform event message failed. signature public void onfailure(eventbus.failureresult result) parameters result type: eventbus.failureresult the final result of eventbus.publish. return value type: void eventpublishfailurecallback example implementation for an example implementation and a test class, see get the result of asynchronous platform event publishing with apex publish callbacks in the platform events developer guide. eventpublishsuccesscallback interface implement this interface to track platform event messages that were published successfully. the onsuccess() method in this interface is called when the final result of the asynchronous publish operation becomes available. namespace eventbus 2191apex reference guide failureresult interface usage for more information, see get the result of asynchronous platform event publishing with apex publish callbacks in the platform events developer guide. in this section: eventpublishsuccesscallback methods eventpublishsuccesscallback example implementation eventpublishsuccesscallback methods the following are methods for eventpublishsuccesscallback. in this section: onsuccess(result) the system invokes this method when the final result of eventbus.publish is available and the publishing of the platform event message succeeded. onsuccess(" "result) the system invokes this method when the final result of eventbus.publish is available and the publishing of the platform event message succeeded. signature public void onsuccess(eventbus.successresult result) parameters result type: eventbus.successresult the final result of eventbus.publish. return value type: void eventpublishsuccesscallback example implementation for an example implementation and a test class, see get the result of asynchronous platform event publishing with apex publish callbacks in the platform events developer guide. failureresult interface contains the result of an apex publish callback when the event publishing failed. this interface is used as a parameter in the onfailure method of the eventpublishfailurecallback interface. 2192apex reference guide successresult interface namespace eventbus in this section: failureresult methods failureresult methods the following are methods for failureresult. in this section: geteventuuids() returns a list of eventuuid field values of each platform event that is included in eventbus.eventpublishfailurecallback. geteventuuids() returns a list of eventuuid field values of each platform event that is included in eventbus.eventpublishfailurecallback. signature public list geteventuuids() return value type: list successresult interface contains the result of an apex publish callback when the event publishing succeeded. this interface is used as a parameter in the onsuccess method of the eventpublishsuccesscallback interface. namespace eventbus in this section: successresult methods successresult methods the following are methods for successresult. 2193apex reference guide testbroker class in this section: geteventuuids() returns a list of eventuuid field values of each platform event that is included in the eventbus.eventpublishsuccesscallback. geteventuuids() returns a list of eventuuid field values of each platform event that is included in the eventbus.eventpublishsuccesscallback. signature public list geteventuuids() return value type: list testbroker class contains methods that simulate the successful delivery or failed publishing of platform event or change event messages in an apex test. namespace eventbus in this section: testbroker methods testbroker methods the following are methods for testbroker. in this section: deliver() delivers platform event messages to the test event bus. use this method to deliver test event messages multiple times and verify that event subscribers have processed the test events each step of the way. fail() causes the publishing of platform event messages to fail in the test event bus. use this method to test apex publish callbacks. deliver() delivers platform event messages to the test event bus. use this method to deliver test event messages multiple times and verify that event subscribers have processed the test events each step of the way. 2194apex reference guide testbroker class signature public void deliver() return value type: void usage enclose test.geteventbus().deliver() within the test.starttest() and test.stoptest() statement block. test.starttest(); // create test events // ... // publish test events with eventbus.publish() // ... // deliver test events test.geteventbus().deliver(); // perform validation // ... test.stoptest(); see also: platform events developer guide fail() causes the publishing of platform event messages to fail in the test event bus. use this method to test apex publish callbacks. signature public void fail() return value type: void usage // create test events // ... // publish test events with eventbus.publish() // ... // fail publishing of test events test.geteventbus().fail(); // perform validation // ... for more information, see get the result of asynchronous platform event publishing with apex publish callbacks in the platform events developer guide. 2195apex reference guide triggercontext class triggercontext class provides information about the platform event or change event trigger that’s currently executing, such as how many times the trigger was retried due to the eventbus.retryableexception. also, provides a method to resume trigger executions. namespace eventbus in this section: triggercontext properties triggercontext methods triggercontext properties the following are properties for triggercontext. in this section:" "lasterror read-only. the error message that the last thrown eventbus.retryableexception contains. retries read-only. the number of times the trigger was retried due to throwing the eventbus.retryableexception. lasterror read-only. the error message that the last thrown eventbus.retryableexception contains. signature public string lasterror {get;} property value type: string usage the error message that this property returns is the message that was passed in when creating the eventbus.retryableexception exception, as follows. throw new eventbus.retryableexception( 'condition is not met, so retrying the trigger again.'); retries read-only. the number of times the trigger was retried due to throwing the eventbus.retryableexception. 2196apex reference guide triggercontext class signature public integer retries {get;} property value type: integer triggercontext methods the following are methods for triggercontext. in this section: currentcontext() returns an instance of the eventbus.triggercontext class containing information about the currently executing trigger. getresumecheckpoint() returns the replay id that was set by setresumecheckpoint(). the returned value is the replay id of the event message after which trigger processing resumes in a new trigger invocation. setresumecheckpoint(resumereplayid) sets a checkpoint in the event stream where the platform event trigger resumes execution in a new invocation. use this method to recover from limit and uncaught exceptions, or to control the number of events processed in one trigger execution. when calling this method, pass in the replay id of the last successfully processed event message. when the trigger stops execution before all events in trigger.new are processed, either because of an uncaught exception or intentionally, the trigger is invoked again. the new execution starts with the event message in the stream after the one with the checkpointed replay id. currentcontext() returns an instance of the eventbus.triggercontext class containing information about the currently executing trigger. signature public static eventbus.triggercontext currentcontext() return value type: eventbus.triggercontext information about the currently executing trigger. getresumecheckpoint() returns the replay id that was set by setresumecheckpoint(). the returned value is the replay id of the event message after which trigger processing resumes in a new trigger invocation. signature public string getresumecheckpoint() 2197apex reference guide externalservice namespace return value type: string setresumecheckpoint(resumereplayid) sets a checkpoint in the event stream where the platform event trigger resumes execution in a new invocation. use this method to recover from limit and uncaught exceptions, or to control the number of events processed in one trigger execution. when calling this method, pass in the replay id of the last successfully processed event message. when the trigger stops execution before all events in trigger.new are processed, either because of an uncaught exception or intentionally, the trigger is invoked again. the new execution starts with the event message in the stream after the one with the checkpointed replay id. signature public void setresumecheckpoint(string resumereplayid) parameters resumereplayid type: string the replay id of the last successfully processed platform event message, after which to resume processing in a new trigger execution context. return value type: void usage the method throws an eventbus.invalidreplayidexception if the supplied replay id is not valid—the replay id is not in the current trigger batch of events, in the trigger.new list. example this snippet shows how to call the method and pass in the replayid property of an event instance. eventbus.triggercontext.currentcontext().setresumecheckpoint(event.replayid); externalservice namespace the externalservice namespace provides dynamically generated apex service interfaces and apex classes for complex object data types. the externalservice namespace doesn't define a fixed set of classes. the namespace reflects openapi-compatible external service registrations with active operations for type-safe outbound calls. the object schema, in the api specification that is associated with the registered external service, maps to apex types. see also: salesforce help: invoke external service callouts using apex 2198apex reference guide flow namespace flow namespace the flow namespace provides a class for advanced visualforce controller access to flows. the following is the class in the flow namespace. in this section: interview class the flow.interview class provides advanced controller access to flows and the ability to start a flow." "interview class the flow.interview class provides advanced controller access to flows and the ability to start a flow. namespace flow usage soql and dml limits apply during flow execution. see per-transaction flow limits in the salesforce help. to create an interview object, you have two options. • create the object directly in your class by using: – no namespace: flow.interview.flowname – namespace: flow.interview.namespace.flowname • create the object dynamically by using createinterview() note: we recommend only using createinterview() if you need to reuse your method or class. using createinterview() has these drawbacks. • if you package a class that uses createinterview(), you have to add the associated flow manually. • if you delete a flow, salesforce doesn't check if it's referenced with createinterview(). examples: starting flow interviews the following examples are all sample controllers that start an interview for the flow from the build a discount calculator project on trailhead. each shows a different permutation, based on: • whether the interview is created statically, with flow.interview.myflow, or dynamically, with createinterview(). • whether the flow is managed or local. interview created statically for a local flow { map inputs = new map(); inputs.put('accountid', myaccount); inputs.put('opportunityid', myoppty); 2199apex reference guide interview class flow.interview.calculate_discounts myflow = new flow.interview.calculate_discounts(inputs); myflow.start(); } interview created dynamically for a local flow public void callflow(string flowname, map inputs) { flow.interview myflow = flow.interview.createinterview(flowname, inputs); myflow.start(); } interview created statically for a managed flow { map inputs = new map(); inputs.put('accountid', myaccount); inputs.put('opportunityid', myoppty); flow.interview.mynamespace.calculate_discounts myflow = new flow.interview.mynamespace.calculate_discounts(inputs); myflow.start(); } interview created dynamically for a managed flow public void callflow(string namespace, string flowname, map inputs) { flow.interview myflow = flow.interview.createinterview(namespace, flowname, inputs); myflow.start(); } example: getting variable values this sample uses the getvariablevalue method to obtain breadcrumb (navigation) information from a flow. if that flow contains subflow elements, and each of the referenced flows also contains a vabreadcrumb variable, you can provide users with breadcrumbs regardless of which flow the interview is running. public class samplecontroller { //instance of the flow public flow.interview.flow_template_gallery myflow {get; set;} public string getbreadcrumb() { string abreadcrumb; if (myflow==null) { return 'home';} else abreadcrumb = (string) myflow.getvariablevalue('vabreadcrumb'); return(abreadcrumb==null ? 'home': abreadcrumb); } } 2200apex reference guide interview class interview methods the following are instance methods for interview. createinterview(namespace, flowname, inputvariables) creates an interview for a namespaced flow. signature public static flow.interview createinterview(string namespace, string flowname, map inputvariables) parameters namespace type: string the flow’s namespace. flowname type: string the flow’s api name. inputvariables type: map initial values for the flow’s input variables. return value type: flow.interview usage use this method to dynamically create a flow.interview object for the start() method. how you get output variable values from an interview depends on the type of the apex variable where you're storing the interview. • if the variable is cast to a specific flow, you can use myflow.myvar to access a variable, where myvar is the name of the variable. system.debug('my output variable: ' + myflow.varname); • if the variable is of type flow.interview but not" "cast to a specific flow, you must use getvariablevalue() to access the flow's variables. system.debug('my output variable: ' + myflow.getvariablevalue('varname')); if the flow doesn't exist in the current org, a typeexception is thrown. createinterview(flowname, inputvariables) creates an interview for a flow. 2201apex reference guide interview class signature public static flow.interview createinterview(string flowname, map inputvariables) parameters flowname type: string the flow’s api name. inputvariables type: map initial values for the flow’s input variables. return value type: flow.interview usage use this method to dynamically create a flow.interview object for the start() method. how you get output variable values from an interview depends on the type of the apex variable where you're storing the interview. • if the variable is cast to a specific flow, you can use myflow.myvar to access a variable, where myvar is the name of the variable. system.debug('my output variable: ' + myflow.varname); • if the variable is of type flow.interview but not cast to a specific flow, you must use getvariablevalue() to access the flow's variables. system.debug('my output variable: ' + myflow.getvariablevalue('varname')); if the flow doesn't exist in the current org, a typeexception is thrown. getvariablevalue(variablename) returns the value of the specified flow variable. the flow variable can be in the flow embedded in the visualforce page, or in a separate flow that is called by a subflow element. signature public object getvariablevalue(string variablename) parameters variablename type: string specifies the unique name of the flow variable. return value type: object 2202apex reference guide functions namespace usage the returned variable value comes from whichever flow the interview is running. if the specified variable can’t be found in that flow, the method returns null. this method checks for the existence of the variable at run time only, not at compile time. start() starts an instance (interview) for an autolaunched or user provisioning flow. signature public void start() return value type: void usage this method can be used only with flows that have one of these types. • autolaunched flow • user provisioning flow for details, see “flow types” in salesforce help. when a flow user invokes an autolaunched flow, the active flow version runs. if there’s no active version, the latest version runs. when a flow admin invokes a flow, the latest version always runs. functions namespace the functions namespace provides classes and methods used to invoke and manage salesforce functions. salesforce functions is your code, run on demand, in the salesforce functions trusted elastic compute cloud. upload your complex business logic code, written using your preferred languages and frameworks, and salesforce functions takes care of everything else necessary to invoke your code in a secure, multi-tenant aware, and self-scaling environment. for more details on salesforce functions, see salesforce functions. the following are the classes in the functions namespace. in this section: function class use the function class to access deployed salesforce functions, and invoke them synchronously or asynchronously. functioncallback interface represents the callback salesforce calls when an asynchronous, queued function invocation has completed. functionerrortype enum represents the error type of functioninvocationerror. functioninvocation interface use functioninvocation to get the status and results of a synchronous or asynchronous function invocation. 2203apex reference guide function class functioninvocationerror interface use functioninvocationerror to get detailed error information about a failed function invocation. functioninvocationstatus enum represents the status of a function invocation. functioninvokemock interface use the functioninvokemock interface to mock salesforce functions responses during testing. mockfunctioninvocationfactory class use the mockfunctioninvocationfactory methods to generate appropriate mock responses for testing salesforce functions. function class use the function class to access deployed salesforce functions, and invoke them synchronously or asynchronously. namespace functions usage the function class represents an instance of a deployed function you can invoke from your org. you can invoke functions synchronously, or asynchronously using asynchronous apex. if your function takes longer than 2 minutes to return" ", the request will time out. to avoid timing out, consider using asynchronous invocation. invoking a function asynchronously doesn’t count against asynchronous apex limits, such as apex queueable limits. before synchronously invoking a function, commit any pending data operations in apex, otherwise you will get a calloutexception. for asynchronous invocations, the queued invocation won’t happen if the apex transaction is not committed. any data operations that happen in the function itself are not considered part of the apex transaction. functions cannot be invoked in an apex test. a “function invocations from apex tests are not supported” calloutexception is thrown if apex determines that a function is being invoked during a test. if you must run tests against code that invokes functions you’ll need to mock your function invocations during the tests. see functioninvocation example implementation for an example of a mocked functioninvocation that you can use in testing. example the following example synchronously invokes a deployed “accountfunction” function: functions.function accountfunction = functions.function.get('myproject.accountfunction'); functions.functioninvocation invocation = accountfunction.invoke('{ ""accountname"" : ""acct"", ""contactname"" : ""mycontact"", ""opportunityname"" : ""oppty"" }'); string jsonresponse = invocation.getresponse(); the following example asynchronously invokes a deployed “accountfunction” function, using the provided callback: functions.function accountfunction = functions.function.get('myproject.accountfunction'); accountfunction.invoke('{ ""accountname"" : ""acct"", ""contactname"" : ""mycontact"", ""opportunityname"" : ""oppty"" }', new mycallback()); public class mycallback 2204apex reference guide function class implements functions.functioncallback { public void handleresponse(functions.functioninvocation result) { // handle result of function invocation // ... } } in this section: function methods function methods the following are methods for function. in this section: get(functionname) returns the function instance for the named function and project. the function must be properly deployed and have appropriate permissions to work with the org running your apex code. get(namespace, functionname) returns the function instance for the named function, project, and namespace. the function must be properly deployed and have appropriate permissions to work with the org running your apex code. invoke(payload, callback) invokes the function asynchronously. invoke(payload) invokes the function synchronously. get(functionname) returns the function instance for the named function and project. the function must be properly deployed and have appropriate permissions to work with the org running your apex code. signature public static functions.function get(string functionname) parameters functionname type: string the name of the salesforce function and the functions project that the function is part of. the format of the parameter string is “project name.function name”. for example, to retrieve the generatepdf function in the onboarding function project, use onboarding.generatepdf. the function and project must be deployed to a compute environment connected to the org. 2205apex reference guide function class return value type: functions.function returns a function instance that you can invoke. usage the function.get() method can throw the following exceptions: • invalidparametervalueexception — the functionname parameter doesn’t have the correct project name.function name format. • nodatafoundexception — the project or function name provided in the functionname parameter couldn’t be found. make sure the project and function name are spelled correctly and that the project and function have been properly deployed. get(namespace, functionname) returns the function instance for the named function, project, and namespace. the function must be properly deployed and have appropriate permissions to work with the org running your apex code. signature public static functions.function get(string namespace, string functionname) parameters namespace type: string the name of the namespace that both the salesforce function and the functions project are part of. the org the function is in must be global to access across namespaces. default value is the same org where the method is being called. functionname type: string the name of the salesforce function and the functions project that the function is part of. the format of the parameter string is “project name.function name”. for example, to retrieve the generatepdf function in the" "onboarding function project, use onboarding.generatepdf. the function and project must be deployed to a compute environment connected to the org. return value type: functions.function returns a function instance that you can invoke. usage the function.get() method can throw the following exceptions: • invalidparametervalueexception — the functionname parameter doesn’t have the correct project name.function name format. • nodatafoundexception — the project or function name provided in the functionname parameter couldn’t be found. make sure the project and function name are spelled correctly and that the project and function have been properly deployed. 2206apex reference guide function class • runtimeexception — the function is public yet references a function across namespaces. make sure to retrieve references across namespaces only in a global org. invoke(payload, callback) invokes the function asynchronously. signature public functions.functioninvocation invoke(string payload, functions.functioncallback callback) parameters payload type: string the payload data that gets passed to the function. specify your payload data in a json-format string. callback type: functions.functioncallback a functioncallback implementation that gets called when your function is invoked asynchronously. return value type: functions.functioninvocation returns a functioninvocation that contains information about the results of the invocation, such as the function response, or error results. usage the function.invoke(payload, callback) method can throw the following exceptions: • calloutexception — one of the following conditions causes this exception to be thrown: – salesforce functions isn’t enabled on the current org. for more details on enabling functions, see configure orgs for functions in the functions developer guide. – the function is being invoked in an apex test. functions can’t be invoked in tests. – the “functions” permission set is missing or has incorrect permissions for functioninvocationrequest. for more details on the correct permissions for functioninvocationrequest see function permissions in the functions developer guide. – the provided payload isn’t valid json. – the function hasn’t completed deployment to a compute environment or invocation request returns a 404 http error. • invalidparametervalueexception — the callback parameter is null or references a class that doesn’t implement functions.functioncallback. • nodatafoundexception — a reference for the function couldn’t be found in the current org. make sure the project and function have been properly deployed. 2207apex reference guide functioncallback interface invoke(payload) invokes the function synchronously. signature public functions.functioninvocation invoke(string payload) parameters payload type: string the payload data that gets passed to the function. specify your payload data in a json-format string. return value type: functions.functioninvocation returns a functioninvocation that contains information about the results of the invocation, such as the function response, or error results. usage the function.invoke(payload) method can throw the following exceptions: • calloutexception — one of the following conditions causes this exception to be thrown: – salesforce functions isn’t enabled on the current org. for more details on enabling functions, see configure orgs for functions in the functions developer guide. – the function is being invoked in an apex test. functions can’t be invoked in tests. – the provided payload isn’t valid json. – there are pending dml operations. – the function is being synchronously invoked from an apex trigger. – the function hasn’t completed deployment to a compute environment or invocation request returns a 404 http error. – the function request returns a 5xx http error. – the function invocation has exceeded the time limit for synchronous invocations. for details on the time limit and work-arounds, see limits in the functions developer guide. • nodatafoundexception — a reference for the function couldn’t be found in the current org. make sure the project and function have been properly deployed. functioncallback interface represents the callback salesforce calls when an asynchronous, queued function invocation has completed. namespace functions 2208apex reference guide functioncallback interface usage when invoking functions asynchronously via function.invoke(payload, callback), you provide your own class that implements functioncallback. in this section: functioncallback methods functioncallback example implementation functioncallback methods the following are methods for functioncallback. in this section: handleresponse(var1) called when an asynchronous function invocation has completed." "handleresponse(var1) called when an asynchronous function invocation has completed. signature public void handleresponse(functions.functioninvocation var1) parameters var1 type: functions.functioninvocation the result parameter contains json response information and error information. return value type: void functioncallback example implementation this is an example implementation of the functions.functioncallback interface. public class mycallback implements functions.functioncallback { public void handleresponse(functions.functioninvocation result) { // handle result of function invocation string jsonresponse = result.getresponse(); system.debug('got response ' + jsonresponse); jsonparser parser = json.createparser(jsonresponse); // process json using your own data class... 2209apex reference guide functionerrortype enum } } the following example uses this implementation when invoking a function asynchronously: myfunction.invoke('{ ""accountname"" : ""acct"", ""contactname"" : ""mycontact"", ""opportunityname"" : ""oppty"" }', new mycallback()); functionerrortype enum represents the error type of functioninvocationerror. enum values these are the values of the functions.functionerrortype enum. value description function_exception a known exception resulting from the function logic itself. examples include an exception thrown from the function code, or an exception thrown from a library or framework the function uses. runtime_exception a known exception resulting from the salesforce functions runtime. for example, a malformed payload passed to the function when invoked results in this error type. unexpected_function_exception an unknown exception. for example, a network or system-level issue within the salesforce functions infrastructure results in this error type. functioninvocation interface use functioninvocation to get the status and results of a synchronous or asynchronous function invocation. namespace functions usage the results of a function invocation are passed back via functioninvocation. use this instance to determine if the invocation was successful, and any results from the function invocation. you can also implement your own functioninvocation interface if you run apex tests with your function invocation code. your test code can create and use your own functioninvocation instance in place of using the results from a call to function.invoke(). in this section: functioninvocation methods functioninvocation example implementation 2210apex reference guide functioninvocation interface functioninvocation methods the following are methods for functioninvocation. in this section: geterror() returns error information for a function invocation. getinvocationid() returns the invocation id of the function invocation. getresponse() returns the response string of the function invocation. getstatus() returns the status of the function invocation. geterror() returns error information for a function invocation. signature public functions.functioninvocationerror geterror() return value type: functions.functioninvocationerror contains a functioninvocationerror instance that you can use to get information about any invocation errors. if the function was invoked successfully, the returned instance is null. getinvocationid() returns the invocation id of the function invocation. signature public string getinvocationid() return value type: string this id is available after a call to either the synchronous or asynchronous function.invoke() methods. for asynchronous invocations, this id can be used to check the status of the queued invocation. getresponse() returns the response string of the function invocation. 2211apex reference guide functioninvocation interface signature public string getresponse() return value type: string the response string is the raw request json response, which can be parsed using the jsonparser class. getstatus() returns the status of the function invocation. signature public functions.functioninvocationstatus getstatus() return value type: functions.functioninvocationstatus the result of the invocation, such as functioninvocationstatus.success or functioninvocationstatus.error. functioninvocation example implementation this is an example implementation of the functions.functioninvocation interface. public class myfunctioninvocationerror implements functions.functioninvocationerror { public string getmessage() { return 'mock error message for testing'; } public functions.functionerrortype gettype() { return functions.functionerrortype.function_exception; } } public class myfunctioninvocation implements functions.functioninvocation { public functions.functioninvocationstatus getstatus() { return functions.function" "invocationstatus.error; } public string getresponse() { return 'mock response for testing'; } public string getinvocationid() { return 'mocktestid'; } public functions.functioninvocationerror geterror() { functions.functioninvocationerror testerror = new myfunctioninvocationerror(); return testerror; } } 2212apex reference guide functioninvocationerror interface the following example tests the implementation: functions.functioninvocation testinvocation = new myfunctioninvocation(); if (testinvocation.getstatus() == functions.functioninvocationstatus.error) { system.debug('error: ' + (testinvocation.geterror() != null ? testinvocation.geterror().getmessage() : 'unknown')); return; } functioninvocationerror interface use functioninvocationerror to get detailed error information about a failed function invocation. namespace functions usage functioninvocationerror contains various error information such as the error message at the time of the error. in this section: functioninvocationerror methods functioninvocationerror example implementation functioninvocationerror methods the following are methods for functioninvocationerror. in this section: getmessage() returns the error message from a function invocation error. gettype() returns the error type for functioninvocationerror. getmessage() returns the error message from a function invocation error. signature public string getmessage() return value type: string 2213apex reference guide functioninvocationstatus enum gettype() returns the error type for functioninvocationerror. signature public functions.functionerrortype gettype() return value type: functions.functionerrortype functioninvocationerror example implementation this is an example implementation of the functions.functioninvocationerror interface. public class myfunctioninvocationerror implements functions.functioninvocationerror { public string getmessage() { return 'mock error message for testing'; } public functions.functionerrortype gettype() { return functions.functionerrortype.function_exception; } } this example tests the implementation. functions.functioninvocationerror testerror = new myfunctioninvocationerror(); system.debug('error: ' + testerror.getmessage() + ' type: ' + testerror.gettype()); functioninvocationstatus enum represents the status of a function invocation. enum values the following are the values of the functions.functioninvocationstatus enum. value description error the invocation failed. check the functioninvocation and functioninvocationerror returned by the invoke call to debug the issue. pending the invocation is pending. if the function is being invoked asynchronously, the invocation is still in the asynch queue. success the invocation succeeded. use functioninvocation.getresponse() with the functioninvocation instance returned by the invoke call to get any response returned by the function. 2214apex reference guide functioninvokemock interface functioninvokemock interface use the functioninvokemock interface to mock salesforce functions responses during testing. namespace functions usage to mock salesforce functions testing, implement an appropriate mock response in the respond(functionname,payload) method of the functioninvokemock interface. during mock testing of a salesforce functions, apex runtime sends the response specified in the respond() method, rather than invoking the function itself. appropriate success and error messages can be configured with the createsuccessresponse(invocationid,message) and createerrorresponse(invocationid,functionserrortype,errormsg) methods in functions.mockfunctioninvocationfactory. in this section: functioninvokemock methods functioninvokemock example implementation functioninvokemock methods the following are methods for functioninvokemock. in this section: respond(functionname, payload) the mock response implemented in the functions.functioninvokemock interface. the response is sent by apex runtime when the test.setmock() method is called. respond(functionname, payload) the mock response implemented in the functions.functioninvokemock interface. the response is sent by apex runtime when the test.setmock() method is called. signature public functions.functioninvocation respond(string functionname, string payload) parameters functionname type: string the name of the salesforce function and the functions project that the function is part of. the format of the parameter string is “" "project name.function name”. 2215apex reference guide functioninvokemock interface payload type: string the json-format payload data that is passed to the function. return value type: functioninvocation interface the result of the mock call to salesforce functions. appropriate responses can be generated by using the createsuccessresponse() and createerrorresponse() methods in the functions.mockfunctioninvocationfactory class. functioninvokemock example implementation this is sample implementation of the functions.functioninvokemock interface. @istest public class functionsinvokemockimpl implements functions.functioninvokemock { public functions.functioninvocation respond(string functionname, string payload) { // return mock success response string invocationid = '000000000000000'; string response = 'mockresponse'; return functions.mockfunctioninvocationfactory.createsuccessresponse(invocationid, response); } } this example shows the minimal setup required for testing synchronous and asynchronous functions and is simplified to include both function invocations and the functioncallback class. @istest public class functiontest { @istest static void testsyncfunctioncall() { // set mock class to respond to function invocations test.setmock( functions.functioninvokemock.class, new functionsinvokemockinner()); functions.function mockedfunction = functions.function.get('example.function'); test.starttest(); // synchronous function call functions.functioninvocation invokeresult = mockedfunction.invoke('{}'); test.stoptest(); // verify that the received response contains expected mock values system.assertequals(functions.functioninvocationstatus.success, invokeresult.getstatus()); system.assertequals('mockresponse', invokeresult.getresponse()); system.assertequals('000000000000000', invokeresult.getinvocationid()); } 2216apex reference guide functioninvokemock interface @istest static void testasyncfunctioncall() { // set mock class to respond to function invocations test.setmock( functions.functioninvokemock.class, new functionsinvokemockinner()); functions.function mockedfunction = functions.function.get('example.function2'); test.starttest(); //asynchronous function invocation with callback mockedfunction.invoke('{}', new democallback()); test.stoptest(); // include assertions here about the expected callback processing } public class democallback implements functions.functioncallback { public void handleresponse(functions.functioninvocation invokeresult) { // handle result of function invocation // the callback is included in the example here for convenience // it would normally be defined in the classes being tested // verify that the received response contains expected mock values system.assertequals(invokeresult.getstatus(), functions.functioninvocationstatus.error); functions.functioninvocationerror resulterror = invokeresult.geterror(); system.assertequals('bang', invokeresult.geterror().getmessage()); system.assertequals('000000000000000', invokeresult.getinvocationid()); } } public class functionsinvokemockinner implements functions.functioninvokemock { public functions.functioninvocation respond(string functionname, string payload) { // return mock success response string invocationid = '000000000000000'; if(functionname == 'example.function2') { return functions.mockfunctioninvocationfactory.createerrorresponse( invocationid, functions.functionerrortype.function_exception, 'bang'); } string response = 'mockresponse'; return functions.mockfunctioninvocationfactory.createsuccessresponse(invocationid, response); } } 2217apex reference guide mockfunctioninvocationfactory class } mockfunctioninvocationfactory class use the mockfunctioninvocationfactory methods to generate appropriate mock responses for testing salesforce functions. namespace functions usage to mock salesforce functions testing, implement an appropriate mock response in the respond(functionname,payload) method of the functioninvokemock interface. during mock testing of a salesforce functions, the apex runtime sends the response specified in the respond() method, rather than invoking the function itself. appropriate success and error messages can be configured with the createsuccessresponse(invocationid,message) and createerrorresponse(invocationid,functionserrortype,errormsg) methods. see functioninvokemock example implementation. in this" "section: mockfunctioninvocationfactory methods mockfunctioninvocationfactory methods the following are methods for mockfunctioninvocationfactory. in this section: createerrorresponse(invocationid, functionserrortype, errmsg) generate a response for an error condition during mock testing of salesforce functions. createsuccessresponse(invocationid, response) generate a response for a successful mock test of salesforce functions. createerrorresponse(invocationid, functionserrortype, errmsg) generate a response for an error condition during mock testing of salesforce functions. signature public static functions.functioninvocation createerrorresponse(string invocationid, functions.functionerrortype functionserrortype, string errmsg) parameters invocationid type: string 2218apex reference guide invocable namespace the id associated with a call to either the synchronous or asynchronous function.invoke() method. functionserrortype type: functionerrortype enum the error type of functioninvocationerror. errmsg type: string the error message. return value type: functioninvocation interface createsuccessresponse(invocationid, response) generate a response for a successful mock test of salesforce functions. signature public static functions.functioninvocation createsuccessresponse(string invocationid, string response) parameters invocationid type: string the id associated with a call to either the synchronous or asynchronous function.invoke() method. response type: string the message indicating success. return value type: functioninvocation interface invocable namespace the invocable namespace provides classes for calling invocable actions from apex. these classes are in the invocable namespace. in this section: action class contains methods to create, update, and retrieve information about invocable actions. action.error class contains methods to retrieve errors returned by invocable actions. 2219apex reference guide action class action.result class contains methods to retrieve results from invocable actions called from apex code. action class contains methods to create, update, and retrieve information about invocable actions. namespace invocable in this section: action methods action methods these methods are for action. in this section: addinvocation() creates an empty invocation in preparation for calling an invocable action. after you create the invocation, you can add parameters to the invocation. clearinvocations() clears the existing invocations from the action. clone() creates a copy of the invocable.action. createcustomaction(type, namespace, name) creates a wrapper for a custom invocable action in a specified namespace. createcustomaction(type, name) creates a wrapper for a custom invocable action. createstandardaction(type) creates a wrapper for a standard invocable action. getname() gets the name of an invocable action. getnamespace() gets the namespace of a custom invocable action. gettype() gets the type of an invocable action. invoke() invokes an invocable action from apex code. isstandard() determines whether an invocable action is a standard invocable action. 2220apex reference guide action class setinvocationparameter(parametername, parametervalue) sets a value for an invocable action parameter. setinvocations(invocations) initializes the invocations for an action from a pre-existing list of invocations. addinvocation() creates an empty invocation in preparation for calling an invocable action. after you create the invocation, you can add parameters to the invocation. signature public invocable.action addinvocation() return value type: invocable.action on page 2220 clearinvocations() clears the existing invocations from the action. signature public invocable.action clearinvocations() return value type: invocable.action on page 2220 clone() creates a copy of the invocable.action. signature public object clone() return value type: object createcustomaction(type, namespace, name) creates a wrapper for a custom invocable action in a specified namespace. signature public static invocable.action createcustomaction(string type, string namespace, string name) 2221apex reference guide action class parameters type type: string type of invocable action. namespace" "type: string namespace where the invocable action is located. name type: string name for the custom invocable action. return value type: invocable.action createcustomaction(type, name) creates a wrapper for a custom invocable action. signature public static invocable.action createcustomaction(string type, string name) parameters type type: string type of invocable action. name type: string name for the custom invocable action. return value type: invocable.action createstandardaction(type) creates a wrapper for a standard invocable action. signature public static invocable.action createstandardaction(string type) 2222apex reference guide action class parameters type type: string type of invocable action. return value type: invocable.action getname() gets the name of an invocable action. signature public string getname() return value type: string name of the invocable action. getnamespace() gets the namespace of a custom invocable action. signature public string getnamespace() return value type: string namespace of the custom invocable action. gettype() gets the type of an invocable action. signature public string gettype() return value type: string type of invocable action. 2223apex reference guide action class invoke() invokes an invocable action from apex code. signature public list invoke() return value type: list isstandard() determines whether an invocable action is a standard invocable action. signature public boolean isstandard() return value type: boolean this method returns true if the invocable action is a standard invocable action. setinvocationparameter(parametername, parametervalue) sets a value for an invocable action parameter. signature public invocable.action setinvocationparameter(string parametername, object parametervalue) parameters parametername type: string name of the invocable action parameter to set. parametervalue type: object value to set the invocable action parameter to. return value type: invocable.action on page 2220 setinvocations(invocations) initializes the invocations for an action from a pre-existing list of invocations. 2224apex reference guide action.error class signature public invocable.action setinvocations(list> invocations) parameters invocations type: list on page 3123> list of invocations for the invocable action. return value type: invocable.action on page 2220 action.error class contains methods to retrieve errors returned by invocable actions. namespace invocable in this section: action.error methods action.error methods these methods are for action.error. in this section: clone() creates a copy of the invocable.action.error. getcode() gets the error code returned by an invocable action. getmessage() gets the error message returned by an invocable action. clone() creates a copy of the invocable.action.error. signature public object clone() 2225apex reference guide action.result class return value type: object getcode() gets the error code returned by an invocable action. signature public string getcode() return value type: string getmessage() gets the error message returned by an invocable action. signature public string getmessage() return value type: string action.result class contains methods to retrieve results from invocable actions called from apex code. namespace invocable in this section: action.result methods action.result methods the methods are for action.result. in this section: clone() creates a copy of the invocable.action.result. getaction() gets the invocable action that was invoked and caused a result to be returned. 2226apex reference guide action.result class geterrors() gets a list of errors that were returned by an invocable action." "getinvocationparameters() gets a list of the parameter values set for an invocable action. this method returns a list that contains the input parameter values for each invocation of an action. each map in the list contains a key for the name of each input parameter. getoutputparameters() gets a list of the parameter values returned by an invocable action. this method returns a list that contains the result for each invocation of an action. each map in the list contains a key for the name of each output parameter. issuccess() determines if an invocable action ran without errors. clone() creates a copy of the invocable.action.result. signature public object clone() return value type: object getaction() gets the invocable action that was invoked and caused a result to be returned. signature public invocable.action getaction() return value type: invocable.action on page 2220 geterrors() gets a list of errors that were returned by an invocable action. signature public list on page 3343 geterrors() return value type: list on page 3343 2227apex reference guide kbmanagement namespace getinvocationparameters() gets a list of the parameter values set for an invocable action. this method returns a list that contains the input parameter values for each invocation of an action. each map in the list contains a key for the name of each input parameter. signature public map getinvocationparameters() return value type: map on page 3144 getoutputparameters() gets a list of the parameter values returned by an invocable action. this method returns a list that contains the result for each invocation of an action. each map in the list contains a key for the name of each output parameter. signature public map getoutputparameters() return value type: map on page 3144 issuccess() determines if an invocable action ran without errors. signature public boolean issuccess() return value type: boolean this method returns true if the invocable action ran successfully. kbmanagement namespace the kbmanagement namespace provides a class for managing knowledge articles. the following is the class in the kbmanagement namespace. in this section: publishingservice class use the methods in the kbmanagement.publishingservice class to manage the lifecycle of an article and its translations. 2228apex reference guide publishingservice class publishingservice class use the methods in the kbmanagement.publishingservice class to manage the lifecycle of an article and its translations. namespace kbmanagement usage use the methods in the kbmanagement.publishingservice class to manage the following parts of the lifecycle of an article and its translations: • publishing • updating • retrieving • deleting • submitting for translation • setting a translation to complete or incomplete status • archiving • assigning review tasks for draft articles or translations note: date values are based on gmt. to use the methods in this class, you must enable salesforce knowledge. see salesforce knowledge implementation guide for more information on setting up salesforce knowledge. publishingservice methods the following are methods for publishingservice. all methods are static. in this section: archiveonlinearticle(articleid, scheduleddate) archives an online version of an article. if the specified scheduleddate is null, the article is archived immediately. otherwise, it archives the article on the scheduled date. assigndraftarticletask(articleid, assigneeid, instructions, duedate, sendemailnotification) assigns a review task related to a draft article. assigndrafttranslationtask(articleversionid, assigneeid, instructions, duedate, sendemailnotification) assigns a review task related to a draft translation. cancelscheduledarchivingofarticle(articleid) cancels the scheduled archiving of an online article. cancelscheduledpublicationofarticle(articleid) cancels the scheduled publication of a draft article. completetranslation(articleversionid) puts a translation in a completed state that is ready to publish. 2229apex reference guide publishingservice class deletearchivedarticle(articleid) deletes an archived article. deletearch" "ivedarticleversion(articleid, versionnumber) deletes a specific archived version of a published article. deletedraftarticle(articleid) deletes a draft article. deletedrafttranslation(articleversionid) deletes a draft translation. editarchivedarticle(articleid) creates a draft article from the archived primary version and returns the new draft primary version id of the article. editonlinearticle(articleid, unpublish) creates a draft article from the online version and returns the new draft primary version id of the article. also, unpublishes the online article, if unpublish is set to true. editpublishedtranslation(articleid, language, unpublish) creates a draft version of the online translation for a specific language and returns the new draft primary version id of the article. also, unpublishes the article, if set to true. publisharticle(articleid, flagasnew) publishes an article. if flagasnew is set to true, the article is published as a major version. restoreoldversion(articleid, versionnumber) creates a draft article from an existing online article based on the specified archived version of the article and returns the article version id. scheduleforpublication(articleid, scheduleddate) schedules the article for publication as a major version. if the specified date is null, the article is published immediately. settranslationtoincomplete(articleversionid) sets a draft translation that is ready for publication back to “in progress” status. submitfortranslation(articleid, language, assigneeid, duedate) submits an article for translation to the specified language. also assigns the specified user and due date to the submittal and returns new id of the draft translation. archiveonlinearticle(articleid, scheduleddate) archives an online version of an article. if the specified scheduleddate is null, the article is archived immediately. otherwise, it archives the article on the scheduled date. signature public static void archiveonlinearticle(string articleid, datetime scheduleddate) parameters articleid type: string scheduleddate type: datetime 2230apex reference guide publishingservice class return value type: void example string articleid = 'insert article id'; datetime scheduleddate = datetime.newinstancegmt(2012, 12,1,13,30,0); kbmanagement.publishingservice.archiveonlinearticle(articleid, scheduleddate); assigndraftarticletask(articleid, assigneeid, instructions, duedate, sendemailnotification) assigns a review task related to a draft article. signature public static void assigndraftarticletask(string articleid, string assigneeid, string instructions, datetime duedate, boolean sendemailnotification) parameters articleid type: string assigneeid type: string instructions type: string duedate type: datetime sendemailnotification type: boolean return value type: void example string articleid = 'insert article id'; string assigneeid = ''; string instructions = 'please review this draft.'; datetime duedate = datetime.newinstancegmt(2012, 12, 1); kbmanagement.publishingservice.assigndraftarticletask(articleid, assigneeid, instructions, duedate, true); 2231apex reference guide publishingservice class assigndrafttranslationtask(articleversionid, assigneeid, instructions, duedate, sendemailnotification) assigns a review task related to a draft translation. signature public static void assigndrafttranslationtask(string articleversionid, string assigneeid, string instructions, datetime duedate, boolean sendemailnotification) parameters articleversionid type: string assigneeid type: string instructions type: string duedate type: datetime sendemailnotification type: boolean return value type: void example string articleid = 'insert article id'; string assigneeid = 'insert assignee id'; string instructions = 'please review this draft.'; datetime duedate = datetime.newinstancegmt(2012, 12, 1); kbmanagement.publishingservice.assigndrafttranslationtask(articleid, assigneeid, instructions, duedate, true); cancelscheduledarchivingofarticle(articleid) cancels the scheduled archiving of an online article. signature public static void cancelscheduledarchivingofarticle" (string articleid) parameters articleid type: string 2232 "apex reference guide publishingservice class return value type: void example string articleid = 'insert article id'; kbmanagement.publishingservice.cancelscheduledarchivingofarticle (articleid); cancelscheduledpublicationofarticle(articleid) cancels the scheduled publication of a draft article. signature public static void cancelscheduledpublicationofarticle(string articleid) parameters articleid type: string return value type: void example string articleid = 'insert article id'; kbmanagement.publishingservice.cancelscheduledpublicationofarticle (articleid); completetranslation(articleversionid) puts a translation in a completed state that is ready to publish. signature public static void completetranslation(string articleversionid) parameters articleversionid type: string return value type: void 2233apex reference guide publishingservice class example string articleversionid = 'insert article id'; kbmanagement.publishingservice.completetranslation(articleversionid); deletearchivedarticle(articleid) deletes an archived article. signature public static void deletearchivedarticle(string articleid) parameters articleid type: string return value type: void example string articleid = 'insert article id'; kbmanagement.publishingservice.deletearchivedarticle(articleid); deletearchivedarticleversion(articleid, versionnumber) deletes a specific archived version of a published article. signature public static void deletearchivedarticleversion(string articleid, integer versionnumber) parameters articleid type: string versionnumber type: integer return value type: void 2234apex reference guide publishingservice class example string articleid = 'insert article id'; integer versionnumber = 1; kbmanagement.publishingservice.deletearchivedarticleversion(articleid, versionnumber); deletedraftarticle(articleid) deletes a draft article. signature public static void deletedraftarticle(string articleid) parameters articleid type: string return value type: void example string articleid = 'insert article id'; kbmanagement.publishingservice.deletedraftarticle(articleid); deletedrafttranslation(articleversionid) deletes a draft translation. signature public static void deletedrafttranslation(string articleversionid) parameters articleversionid type: string return value type: void example string articleversionid = 'insert article id'; kbmanagement.publishingservice.deletedrafttranslation (articleversionid); 2235apex reference guide publishingservice class editarchivedarticle(articleid) creates a draft article from the archived primary version and returns the new draft primary version id of the article. signature public static string editarchivedarticle(string articleid) parameters articleid type: string return value type: string example string articleid = 'insert article id'; string id = kbmanagement.publishingservice.editarchivedarticle(articleid); editonlinearticle(articleid, unpublish) creates a draft article from the online version and returns the new draft primary version id of the article. also, unpublishes the online article, if unpublish is set to true. signature public static string editonlinearticle(string articleid, boolean unpublish) parameters articleid type: string unpublish type: boolean return value type: string example string articleid = 'insert article id'; string id = kbmanagement.publishingservice.editonlinearticle (articleid, true); 2236apex reference guide publishingservice class editpublishedtranslation(articleid, language, unpublish) creates a draft version of the online translation for a specific language and returns the new draft primary version id of the article. also, unpublishes the article, if set to true. signature public static string editpublishedtranslation(string articleid, string language, boolean unpublish) parameters articleid type: string language type: string unpublish type: boolean return value type: string example string articleid = 'insert article id'; string language = 'fr'; string id = kbmanagement.publishingservice.editpublishedtranslation(articleid, language, true); publisharticle(articleid, flagasnew) publishes an article. if flagasnew is set to true, the article is published as a major version. signature" "public static void publisharticle(string articleid, boolean flagasnew) parameters articleid type: string flagasnew type: boolean return value type: void 2237apex reference guide publishingservice class example string articleid = 'insert article id'; kbmanagement.publishingservice.publisharticle(articleid, true); restoreoldversion(articleid, versionnumber) creates a draft article from an existing online article based on the specified archived version of the article and returns the article version id. signature public static string restoreoldversion(string articleid, integer versionnumber) parameters articleid type: string versionnumber type: integer return value type: string example string articleid = 'insert article id'; string id = kbmanagement.publishingservice.restoreoldversion (articleid, 1); scheduleforpublication(articleid, scheduleddate) schedules the article for publication as a major version. if the specified date is null, the article is published immediately. signature public static void scheduleforpublication(string articleid, datetime scheduleddate) parameters articleid type: string scheduleddate type: datetime return value type: void 2238apex reference guide publishingservice class example string articleid = 'insert article id'; datetime scheduleddate = datetime.newinstancegmt(2012, 12,1,13,30,0); kbmanagement.publishingservice.scheduleforpublication(articleid, scheduleddate); settranslationtoincomplete(articleversionid) sets a draft translation that is ready for publication back to “in progress” status. signature public static void settranslationtoincomplete(string articleversionid) parameters articleversionid type: string return value type: void example string articleversionid = 'insert article id'; kbmanagement.publishingservice.settranslationtoincomplete(articleversionid); submitfortranslation(articleid, language, assigneeid, duedate) submits an article for translation to the specified language. also assigns the specified user and due date to the submittal and returns new id of the draft translation. signature public static string submitfortranslation(string articleid, string language, string assigneeid, datetime duedate) parameters articleid type: string language type: string assigneeid type: string duedate type: datetime 2239apex reference guide lxscheduler namespace return value type: string example string articleid = 'insert article id'; string language = 'fr'; string assigneeid = 'insert assignee id'; datetime duedate = datetime.newinstancegmt(2012, 12,1); string id = kbmanagement.publishingservice.submitfortranslation(articleid, language, assigneeid, duedate); lxscheduler namespace the lxscheduler namespace provides an interface and classes for integrating salesforce scheduler with external calendars. the following are the classes and the interface in the lxscheduler namespace. in this section: getappointmentcandidatesinput class contains information about the available service resources (appointment candidates) based on work type group and service territories. getappointmentcandidatesinputbuilder class contains methods to build an instance of the lxscheduler.getappointmentcandidatesinput class. getappointmentslotsinput class contains information about the available appointment time slots for a resource based on given work type group and territories. getappointmentslotsinputbuilder class contains methods to build an instance of the lxscheduler.getappointmentslotsinput class. schedulerresources class contains methods that holds the business logic to get resources availability. skillrequirement class contains information about the set the skills that are required to complete a particular task for a work type. skillrequirementbuilder class contains methods to build an instance of the lxscheduler.skillrequirement class. worktype class contains information about the type of work to be performed. worktypebuilder class contains methods to build an instance of the lxscheduler.worktype class. serviceresourceschedulehandler interface allows an implementing class to check external calendar events to find already booked time slots for the requested service resources. this interface is part of salesforce scheduler. serviceappointmentrequestinfo class represents the list of parameters that are passed to the serviceresourcesche" "dulehandler interface. this class is implemented internally by apex. 2240apex reference guide getappointmentcandidatesinput class serviceresourceinfo class contains information about a service resource. serviceresourceschedule class use this class to pass results from your implemented apex class to the serviceresourceschedulehandler interface methods. unavailabletimeslot class use this class to pass the unavailable time slots to the lxscheduler.serviceresourceschedule class. see also: apex interface implementation limitations and error codes getappointmentcandidatesinput class contains information about the available service resources (appointment candidates) based on work type group and service territories. set up salesforce scheduler before making requests. this setup includes creating or configuring service resources, service territory members, work type groups, work types, work type group members, and service territory work types. see set up salesforce scheduler for more information. the appointment time slots are determined based on multiple factors, such as field values, scheduled appointments, absences, scheduler settings, and scheduling policies to determine available time slots. see how salesforce scheduler determines available time slots for more information. the following factors are considered for returning start time and end time of resources. resource availability determined using service territory member, service territory, work type, and account operating hours fields. resource unavailability determined by resource absences, existing appointments that the resource is assigned to. the resource must be marked as a required resource for the appointment with a status that isn’t in closed, canceled, or completed. appointment start time interval in the scheduling policy appointment start time interval field in the scheduling policy is used to determine when the appointment can start. this interval can be 5, 10, 15, 20, 30, or 60. by default, it’s set to 15. work type duration the end time is calculated as start time + duration of the work type. note: if asset scheduling is enabled, the response also includes asset-based candidates. namespace lxscheduler usage the constructor for this class can’t be called directly. create an instance of this class using the getappointmentcandidatesinputbuilder.build() method. this example shows how to get a list of available appointment candidates based on worktypegroupid: //build input for getappointmentcandidates api lxscheduler.getappointmentcandidatesinput input = new 2241apex reference guide getappointmentcandidatesinput class lxscheduler.getappointmentcandidatesinputbuilder() .setworktypegroupid('0vsrm0000000abc4am') .setterritoryids(new list{'0hhrm0000000fxd0am'}) .setstarttime(system.now().format('yyyy-mm-dd\'t\'hh:mm:ssz','america/new_york')) .setendtime(system.now().adddays(5).format('yyyy-mm-dd\'t\'hh:mm:ssz','america/new_york')) .setaccountid('001rm0000053iqgyai') .setschedulingpolicyid('0vrrm00000000bx') .setapiversion(double.valueof('50.0')) .build(); string response = lxscheduler.schedulerresources.getappointmentcandidates(input); this example shows how to get a list of available appointment candidates based on worktype: //build worktype lxscheduler.worktype worktype = new lxscheduler.worktypebuilder() .setid('08qrm0000000g9ryau') .build(); lxscheduler.getappointmentcandidatesinput input = new lxscheduler.getappointmentcandidatesinputbuilder() .setworktype(worktype) .setterritoryids(new list{'0hhrm0000000fxd0am'}) .setstarttime(system.now().format('yyyy-mm-dd\'t\'hh:mm:ssz','america/new_york')) .setendtime(system.now().adddays(5).format('yyyy-mm-dd\'t\'hh:mm:ssz','america/new_york')) .setaccountid('001rm0000053iqgyai') .setschedulingpolicyid('0vrrm00000000bx') .setapiversion(double.valueof('50.0')) ." "build(); string response = lxscheduler.schedulerresources.getappointmentcandidates(input); this example shows how to get a list of available candidate appointments based on durationinminutes and without the worktypegroupid or worktype fields: //build skillrequirement lxscheduler.skillrequirement skillreq = new lxscheduler.skillrequirementbuilder() .setskillid('0c5rm0000004ezs0a2') .setskilllevel(90) .build(); //build worktype lxscheduler.worktype worktype = new lxscheduler.worktypebuilder() .setdurationinminutes(15) .setblocktimebeforeappointmentinminutes(5) .setblocktimeafterappointmentinminutes(5) .settimeframestartinminutes(10080) .settimeframeendinminutes(40320) .setoperatinghoursid('0ohrm0000000fmg4au') .setskillrequirements(new list{skillreq}) .build(); 2242apex reference guide getappointmentcandidatesinputbuilder class lxscheduler.getappointmentcandidatesinput input = new lxscheduler.getappointmentcandidatesinputbuilder() .setworktype(worktype) .setterritoryids(new list{'0hhrm0000000fxd0am'}) .setschedulingpolicyid('0vrrm00000000bx') .setapiversion(double.valueof('50.0')) .build(); string response = lxscheduler.schedulerresources.getappointmentcandidates(input); this example shows a sample response of a list of available candidates: [ { ""starttime"": ""2021-02-16t16:15:00.000+0000"", ""endtime"": ""2021-02-16t16:16:00.000+0000"", ""resources"": [ ""0hnxx0000004c9bcau"" ], ""territoryid"": ""0hhxx0000004c92cae"" }, { ""starttime"": ""2021-02-16t16:30:00.000+0000"", ""endtime"": ""2021-02-16t16:31:00.000+0000"", ""resources"": [ ""0hnxx0000004c9bcau"" ], ""territoryid"": ""0hhxx0000004c92cae"" }, ] getappointmentcandidatesinputbuilder class contains methods to build an instance of the lxscheduler.getappointmentcandidatesinput class. a builder object is obtained by invoking one of the getappointmentcandidatesinputbuilder methods defined by the getappointmentcandidatesinput class. namespace lxscheduler in this section: getappointmentcandidatesinputbuilder methods getappointmentcandidatesinputbuilder methods the following are methods for getappointmentcandidatesinputbuilder. 2243apex reference guide getappointmentcandidatesinputbuilder class in this section: build() returns an instance of the lxscheduler.getappointmentcandidatesinput object. setaccountid(accountid) sets the id of the associated account for which you want to create the appointments. setallowconcurrent(allowconcurrent) allows the scheduling of concurrent appointments. setapiversion(apiversion) sets the api version of the business logic for the getappointmentcandidates method. setcorrelationid(correlationid) sets the correlation id. setendtime(endtime) sets the scheduling end time. setengagementchanneltypeids(engagementchanneltypeids) sets an engagement channel type. setfilterbyresources(filterbyresources) enables filtering resources using a comma-separated list of service resource ids. setresourcelimitapptdistribution(resourcelimitapptdistribution) sets the number of service resources to show during appointment scheduling. setschedulingpolicyid(schedulingpolicyid) sets the id of the appointmentschedulingpolicy object. setstarttime(starttime) sets the scheduling start time to the specified time. setterritoryids(territoryids) sets the service territory ids. setworktype(worktype) sets the type of work to be" "performed. setworktypegroupid(worktypegroupid) sets the id of the work type group. build() returns an instance of the lxscheduler.getappointmentcandidatesinput object. signature public lxscheduler.getappointmentcandidatesinput build() return value type: lxscheduler.getappointmentcandidatesinput 2244apex reference guide getappointmentcandidatesinputbuilder class setaccountid(accountid) sets the id of the associated account for which you want to create the appointments. signature public lxscheduler.getappointmentcandidatesinputbuilder setaccountid(string accountid) parameters accountid type: string return value type: lxscheduler.getappointmentcandidatesinputbuilder setallowconcurrent(allowconcurrent) allows the scheduling of concurrent appointments. signature public lxscheduler.getappointmentcandidatesinputbuilder setallowconcurrent(boolean allowconcurrent) parameters allowconcurrent type: boolean if true, allows scheduling of concurrent appointments in a time slot. the default is false. available in api version 47.0 and later. return value type: lxscheduler.getappointmentcandidatesinputbuilder setapiversion(apiversion) sets the api version of the business logic for the getappointmentcandidates method. signature public lxscheduler.getappointmentcandidatesinputbuilder setapiversion(double apiversion) parameters apiversion type: double 2245apex reference guide getappointmentcandidatesinputbuilder class usage the specified parameter must use the correct api version. for example, if api version is set to 45.0 and filterbyresources is set (which is available in api version 51.0 and later), then this field is ignored. if no api version or incorrect api version is passed in the request body, by default the latest version is used. note: the api is available since version 45.0. return value type: lxscheduler.getappointmentcandidatesinputbuilder setcorrelationid(correlationid) sets the correlation id. signature public lxscheduler.getappointmentcandidatesinputbuilder setcorrelationid(string correlationid) parameters correlationid type: string id to pass custom information to the serviceresourceschedulehandler apex interface. for example, you can use the correlation id to identify the app, website, or any other external system that calls this apex interface implementation. if you don’t pass a custom value, a randomly generated identifier is passed. available in api version 53.0 and later. return value type: lxscheduler.getappointmentcandidatesinputbuilder setendtime(endtime) sets the scheduling end time. signature public lxscheduler.getappointmentcandidatesinputbuilder setendtime(string endtime) parameters endtime type: string the latest time that a time slot can end (inclusive). note: if end time is not specified, it defaults to 31 days. 2246apex reference guide getappointmentcandidatesinputbuilder class usage the specified string should use the standard date format “['yyyy-mm-dd\’t\’hh:mm:ssz']” in the local time zone. defaults to the user’s time zone. return value type: lxscheduler.getappointmentcandidatesinputbuilder setengagementchanneltypeids(engagementchanneltypeids) sets an engagement channel type. signature public lxscheduler.getappointmentcandidatesinputbuilder setengagementchanneltypeids(list engagementchanneltypeids) parameters engagementchanneltypeids type: list the id of the engagement channel type record. the availability of service resources is filtered based on the engagement channel type selected. this field is available in api version 56.0 and later. note: this field supports only one engagement channel type id. return value type: lxscheduler.getappointmentcandidatesinputbuilder usage you can use engagement channel types only in these cases: • the schedule appointments using engagement channels setting is enabled in salesforce scheduler settings in your salesforce org. • shifts are defined in the scheduling policy. for more information on setting up shifts in scheduling policy, see define shift rules in scheduling policy. note:" "engagement channel types are not supported with operating-hours rules in the scheduling policy. setfilterbyresources(filterbyresources) enables filtering resources using a comma-separated list of service resource ids. signature public lxscheduler.getappointmentcandidatesinputbuilder setfilterbyresources(list filterbyresources) 2247apex reference guide getappointmentcandidatesinputbuilder class parameters filterbyresources type: list gets only eligible resources that are both in the list and in the selected service territory sorted by the order in which the resource ids are passed. this field is available in api version 51.0 and later. return value type: lxscheduler.getappointmentcandidatesinputbuilder setresourcelimitapptdistribution(resourcelimitapptdistribution) sets the number of service resources to show during appointment scheduling. signature public lxscheduler.getappointmentcandidatesinputbuilder setresourcelimitapptdistribution(integer resourcelimitapptdistribution) parameters resourcelimitapptdistribution type: integer specify the maximum number of service resources that you want to show during appointment scheduling when appointment distribution is enabled. available in api version 53.0 and later. return value type: lxscheduler.getappointmentcandidatesinputbuilder setschedulingpolicyid(schedulingpolicyid) sets the id of the appointmentschedulingpolicy object. signature public lxscheduler.getappointmentcandidatesinputbuilder setschedulingpolicyid(string schedulingpolicyid) parameters schedulingpolicyid type: string the id of the appointmentschedulingpolicy object. if no scheduling policy is passed in the request body, the default configurations are used. return value type: lxscheduler.getappointmentcandidatesinputbuilder 2248apex reference guide getappointmentcandidatesinputbuilder class setstarttime(starttime) sets the scheduling start time to the specified time. signature public lxscheduler.getappointmentcandidatesinputbuilder setstarttime(string starttime) parameters starttime type: string the earliest time that a time slot can begin (inclusive). you can also use a time from the past. usage the specified string should use the standard date format “['yyyy-mm-dd\’t\’hh:mm:ssz']” in the local time zone. defaults to the user’s time zone. return value type: lxscheduler.getappointmentcandidatesinputbuilder setterritoryids(territoryids) sets the service territory ids. signature public lxscheduler.getappointmentcandidatesinputbuilder setterritoryids(list territoryids) parameters territoryids type: list list of service territory ids, where the work that is being requested is performed. this is a required field. return value type: lxscheduler.getappointmentcandidatesinputbuilder setworktype(worktype) sets the type of work to be performed. signature public lxscheduler.getappointmentcandidatesinputbuilder setworktype(lxscheduler.worktype worktype) 2249apex reference guide getappointmentslotsinput class parameters worktype type: lxscheduler.worktype this method takes input as an instance of the lxscheduler.worktype class. build the instance of the input class using the lxscheduler.worktypebuilder class. required if worktypegroupid is not given. if id of the worktype is given, the rest of worktype fields are optional. usage return value type: lxscheduler.getappointmentcandidatesinputbuilder setworktypegroupid(worktypegroupid) sets the id of the work type group. signature public lxscheduler.getappointmentcandidatesinputbuilder setworktypegroupid(string worktypegroupid) parameters worktypegroupid type: string the id of the work type group containing the work types that are being performed. required if worktype is not given. if worktype is given, then you must provide either id or durationinminutes, but not both. return value type: lxscheduler.getappointmentcandidatesinputbuilder getappointmentslotsinput class contains" "information about the available appointment time slots for a resource based on given work type group and territories. the appointment time slots are determined based on your salesforce scheduler data model configurations. here are some prerequisites that you can consider while setting up data. • set up salesforce scheduler before making your requests. the setup includes creating or configuring service resources, service territory members, work type groups, work types, work type group members, and service territory work types. see manage business information in salesforce scheduler for more information. • configure a work type mapped for each territory in the request body via service territory work type. map the same work type to the work type group, via work type group member. the following factors affect how time slots are calculated and returned. • timezones that differ across operating hours are handled and results are always returned in utc. • the resource must be marked as a required resource on the assigned resource object. 2250apex reference guide getappointmentslotsinput class • the resource is considered unavailable if the status categories of the resource assigned to service appointments are other than canceled, cannot complete, and completed. • resource absences of all types are considered unavailable from start to end. • the following fields of work type records, if configured, are used to fine-tune time slot requirements. for more information, see create work types in salesforce scheduler. parameter description timeframe start time slots sooner than current time + timeframe start aren’t returned. timeframe end time slots later than current time + timeframe end aren’t returned. block time before appointment the time period before the appointment is considered as unavailable. block time after appointment the time period after the appointment is considered as unavailable. operating hours the overlap of all operating hours from the account, work type, service territory, and service territory member are considered while determining time slots. for more information, see set up operating hours in salesforce scheduler. • only the time slots within the period of 31 days from the start date are returned. • salesforce scheduler uses multiple factors, such as field values, scheduled appointments, absences, scheduler settings, and scheduling policies to determine available time slots, including the earliest and latest appointment slots. see how does salesforce scheduler determine available time slots. note: if asset scheduling is enabled, you can provide an asset-based service resource in requiredresourceids to retrieve available timeslots for the asset resource. namespace lxscheduler usage the constructor for this class can’t be called directly. create an instance of this class using the getappointmentslotsinputbuilder.build() method. this example shows how to get a list of available time slots based on worktypegroupid: //build input for getappointmentslots api lxscheduler.getappointmentslotsinput input = new lxscheduler.getappointmentslotsinputbuilder() .setworktypegroupid('0vsxx0000004c92gae') .setterritoryids(new list{'0hhxx0000004c92cae'}) .setstarttime(system.now().format('yyyy-mm-dd\'t\'hh:mm:ssz')) .setendtime(system.now().adddays(1).format('yyyy-mm-dd\'t\'hh:mm:ssz')) .setaccountid('001xx000003gyk0aao') .setrequiredresourceids(new list{'0hnxx0000004c92cae'}) .setschedulingpolicyid('0vrxx0000004cae') .setapiversion(double.valueof('48.0')) 2251apex reference guide getappointmentslotsinput class .build(); string response = lxscheduler.schedulerresources.getappointmentslots(input); this example shows how to get a list of available time slots based on worktype: //build worktype lxscheduler.worktype worktype = new lxscheduler.worktypebuilder() .setid('08qxx0000004c92aae') .build(); lxscheduler.getappointmentslotsinput input = new lxscheduler.getappointmentslotsinputbuilder() .setworktype(worktype) .setterritoryids(new list{'0hhxx0000004c92cae'}) .setstarttime" "(system.now().format('yyyy-mm-dd\'t\'hh:mm:ssz')) .setendtime(system.now().adddays(1).format('yyyy-mm-dd\'t\'hh:mm:ssz')) .setaccountid('001xx000003gyk0aao') .setrequiredresourceids(new list{'0hnxx0000004c92cae'}) .setschedulingpolicyid('0vrxx0000004cae') .setapiversion(double.valueof('48.0')) .build(); string response = lxscheduler.schedulerresources.getappointmentslots(input); this example shows how to get a list of available time slots based on durationinminutes and without worktypegroupid or worktype fields: //build worktype lxscheduler.worktype worktype = new lxscheduler.worktypebuilder() .setdurationinminutes(60) .build(); lxscheduler.getappointmentslotsinput input = new lxscheduler.getappointmentslotsinputbuilder() .setworktype(worktype) .setterritoryids(new list{'0hhxx0000004c92cae'}) .setrequiredresourceids(new list{'0hnxx0000004c92cae'}) .setapiversion(double.valueof('48.0')) .build(); string response = lxscheduler.schedulerresources.getappointmentslots(input); this example shows a sample response of a list of available time slots: [ { ""territoryid"": ""0hhxx0000004c92cae"", ""starttime"": ""2021-02-10t16:00:00.000+0000"", ""endtime"": ""2021-02-10t16:15:00.000+0000"", ""remainingappointments"": 1 }, { ""territoryid"": ""0hhxx0000004c92cae"", ""starttime"": ""2021-02-10t16:15:00.000+0000"", ""endtime"": ""2021-02-10t16:30:00.000+0000"", 2252apex reference guide getappointmentslotsinputbuilder class ""remainingappointments"": 1 }, ] getappointmentslotsinputbuilder class contains methods to build an instance of the lxscheduler.getappointmentslotsinput class. a builder object is obtained by invoking one of the getappointmentslotsinputbuilder methods defined by the getappointmentslotsinput class. namespace lxscheduler in this section: getappointmentslotsinputbuilder methods getappointmentslotsinputbuilder methods the following are methods for getappointmentslotsinputbuilder. in this section: build() returns an instance of the lxscheduler.getappointmentslotsinput object. setaccountid(accountid) sets the id of the associated account for which you want to create appointments. setallowconcurrentscheduling(allowconcurrentscheduling) allows the scheduling of concurrent appointments. setapiversion(apiversion) sets the api version of the business logic for the getappointmentslots method. setcorrelationid(correlationid) sets the correlation id. setendtime(endtime) sets the scheduling end time. setengagementchanneltypeids(engagementchanneltypeids) sets an engagement channel type. setprimaryresourceid(primaryresourceid) sets the id of the primary resource. setrequiredresourceids(requiredresourceids) sets the resource ids. setschedulingpolicyid(schedulingpolicyid) sets the id of the appointmentschedulingpolicy object. 2253apex reference guide getappointmentslotsinputbuilder class setstarttime(starttime) sets the scheduling start time. setterritoryids(territoryids) sets the ids of service territories. setworktype(worktype) sets the type of work to be performed. setworktypegroupid(worktypegroupid) sets the id of the work type group. build() returns an instance of the lxscheduler.getappointmentslotsinput object." "signature public lxscheduler.getappointmentslotsinput build() return value type: lxscheduler.getappointmentslotsinput setaccountid(accountid) sets the id of the associated account for which you want to create appointments. signature public lxscheduler.getappointmentslotsinputbuilder setaccountid(string accountid) parameters accountid type: string the id of the associated account. return value type: lxscheduler.getappointmentslotsinputbuilder setallowconcurrentscheduling(allowconcurrentscheduling) allows the scheduling of concurrent appointments. signature public lxscheduler.getappointmentslotsinputbuilder setallowconcurrentscheduling(boolean allowconcurrentscheduling) 2254apex reference guide getappointmentslotsinputbuilder class parameters allowconcurrentscheduling type: boolean if true, allows scheduling of concurrent appointments in a time slot. if false, concurrent appointments are not allowed. the default is false. available in api version 47.0 and later. return value type: lxscheduler.getappointmentslotsinputbuilder setapiversion(apiversion) sets the api version of the business logic for the getappointmentslots method. signature public lxscheduler.getappointmentslotsinputbuilder setapiversion(double apiversion) parameters apiversion type: double usage the specified parameter must use the correct api version. for example, if api version is set to 45.0 and primaryresourceid is set (which is available in api version 48.0 and later), then this field is ignored. if no api version or incorrect api version is passed in the request body, by default the latest version is used. note: the api is available since version 45.0. return value type: lxscheduler.getappointmentslotsinputbuilder setcorrelationid(correlationid) sets the correlation id. signature public lxscheduler.getappointmentslotsinputbuilder setcorrelationid(string correlationid) parameters correlationid type: string 2255apex reference guide getappointmentslotsinputbuilder class id to pass custom information to the serviceresourceschedulehandler apex interface. for example, you can use the correlation id to identify the app, website, or any other external system that calls this apex interface implementation. if you don’t pass a custom value, a randomly generated identifier is passed. available in api version 53.0 and later. return value type: lxscheduler.getappointmentslotsinputbuilder setendtime(endtime) sets the scheduling end time. signature public lxscheduler.getappointmentslotsinputbuilder setendtime(string endtime) parameters endtime type: string the latest time that a time slot can end (inclusive). if end time is not specified, it defaults to 31 days. usage the specified string should use the standard date format “['yyyy-mm-dd\’t\’hh:mm:ssz']” in the local time zone. defaults to the user’s time zone. return value type: lxscheduler.getappointmentslotsinputbuilder setengagementchanneltypeids(engagementchanneltypeids) sets an engagement channel type. signature public lxscheduler.getappointmentslotsinputbuilder setengagementchanneltypeids(list engagementchanneltypeids) parameters engagementchanneltypeids type: list the id of the engagement channel type record. the availability of time slots is filtered based on the engagement channel type selected. this field is available in api version 56.0 and later. note: this field supports only one engagement channel type id. 2256apex reference guide getappointmentslotsinputbuilder class return value type: lxscheduler.getappointmentslotsinputbuilder usage you can use engagement channel types only in these cases: • the schedule appointments using engagement channels setting is enabled in salesforce scheduler settings in your salesforce org. • shifts are defined in the scheduling policy. for more information on setting up shifts in scheduling policy, see define shift rules in scheduling policy. note: engagement channel types are not supported with operating-hours rules in the scheduling policy. setprimaryresourceid(" "primaryresourceid) sets the id of the primary resource. signature public lxscheduler.getappointmentslotsinputbuilder setprimaryresourceid(string primaryresourceid) parameters primaryresourceid type: string the id of the primary resource in multi-resource scheduling. required only when multi-resource scheduling is enabled. available in api version 48.0 and later. return value type: lxscheduler.getappointmentslotsinputbuilder setrequiredresourceids(requiredresourceids) sets the resource ids. signature public lxscheduler.getappointmentslotsinputbuilder setrequiredresourceids(list requiredresourceids) parameters requiredresourceids type: list list of resource ids that must be available during the time slot. this is a required field. 2257apex reference guide getappointmentslotsinputbuilder class return value type: lxscheduler.getappointmentslotsinputbuilder setschedulingpolicyid(schedulingpolicyid) sets the id of the appointmentschedulingpolicy object. signature public lxscheduler.getappointmentslotsinputbuilder setschedulingpolicyid(string schedulingpolicyid) parameters schedulingpolicyid type: string if no scheduling policy is passed in the request body, the default configurations are used. return value type: lxscheduler.getappointmentslotsinputbuilder setstarttime(starttime) sets the scheduling start time. signature public lxscheduler.getappointmentslotsinputbuilder setstarttime(string starttime) parameters starttime type: string the earliest time that a time slot can begin (inclusive). defaults to the current time of the request, if empty. usage the specified string should use the standard date format “['yyyy-mm-dd\’t\’hh:mm:ssz']” in the local time zone. defaults to the user’s time zone. return value type: lxscheduler.getappointmentslotsinputbuilder setterritoryids(territoryids) sets the ids of service territories. 2258apex reference guide getappointmentslotsinputbuilder class signature public lxscheduler.getappointmentslotsinputbuilder setterritoryids(list territoryids) parameters territoryids type: list list of ids of service territories, where the work that is being requested is performed. this is a required field. return value type: lxscheduler.getappointmentslotsinputbuilder setworktype(worktype) sets the type of work to be performed. signature public lxscheduler.getappointmentslotsinputbuilder setworktype(lxscheduler.worktype worktype) parameters worktype type: lxscheduler.worktype this method takes input as an instance of the lxscheduler.worktype class. build the instance of the input class using the lxscheduler.worktypebuilder class. required if worktypegroupid is not given. return value type: lxscheduler.getappointmentslotsinputbuilder setworktypegroupid(worktypegroupid) sets the id of the work type group. signature public lxscheduler.getappointmentslotsinputbuilder setworktypegroupid(string worktypegroupid) parameters worktypegroupid type: string the id of the work type group containing the work types that are being performed. 2259apex reference guide schedulerresources class return value type: lxscheduler.getappointmentslotsinputbuilder schedulerresources class contains methods that holds the business logic to get resources availability. namespace lxscheduler implementation considerations apex implementation of the methods in the schedulerresources class should adhere to apex governor limits. it includes synchronous heap size limit, synchronous cpu time limit, and synchronous concurrent transactions for long running transactions. to avoid governor limits, you must tune the input by reducing the time frame, limiting number of service resources, or limiting number or territories at a time. this will reduce the overall transaction time and response size of the implementation. for more information on standard apex governer limits, see salesforce developer limits and allocations quick reference" ". example to get list of available service resources (appointment candidates): string response = lxscheduler.schedulerresources.getappointmentcandidates(input); to get a list of available appointment time slots for a resource: string response = lxscheduler.schedulerresources.getappointmentslots(input); in this section: schedulerresources methods schedulerresources methods the following are methods for schedulerresources. in this section: getappointmentcandidates(getappointmentcandidatesinput) returns a list of service resources based on work type group or work type and service territories. getappointmentslots(getappointmentslotsinput) returns a list of available appointment time slots for a resource based on given work type group or work type and service territories. setappointmentcandidatesmock(expectedresponse) sets a mock object when running tests for the getappointmentcandidates method. 2260apex reference guide schedulerresources class setappointmentslotsmock(expectedresponse) sets a mock object when running tests for the getappointmentslots method. getappointmentcandidates(getappointmentcandidatesinput) returns a list of service resources based on work type group or work type and service territories. set up salesforce scheduler before making requests. this setup includes creating or configuring service resources, service territory members, work type groups, work types, work type group members, and service territory work types. see set up salesforce scheduler for more information. the appointment time slots are determined based on multiple factors, such as field values, scheduled appointments, absences, scheduler settings, and scheduling policies to determine available time slots. see how salesforce scheduler determines available time slots for more information. the following factors are considered for returning start time and end time of resources. resource availability determined using service territory member, service territory, work type, and account operating hours fields. resource unavailability determined by resource absences, existing appointments that the resource is assigned to. the resource must be marked as a required resource for the appointment with a status that isn’t in closed, canceled, or completed. appointment start time interval in the scheduling policy appointment start time interval field in the scheduling policy is used to determine when the appointment can start. this interval can be 5, 10, 15, 20, 30, or 60. by default, it’s set to 15. work type duration the end time is calculated as start time + duration of the work type. note: if asset scheduling is enabled, the response also includes asset-based candidates. signature public static string getappointmentcandidates(lxscheduler.getappointmentcandidatesinput getappointmentcandidatesinput) parameters getappointmentcandidatesinput type: lxscheduler.getappointmentcandidatesinput this method takes input as an instance of the lxscheduler.getappointmentcandidatesinput class. build the instance of the input class using the lxscheduler.getappointmentcandidatesinputbuilder class. return value type: string getappointmentslots(getappointmentslotsinput) returns a list of available appointment time slots for a resource based on given work type group or work type and service territories. the appointment time slots are determined based on your salesforce scheduler data model configurations. here are some prerequisites that you can consider while setting up data. 2261apex reference guide schedulerresources class • set up salesforce scheduler before making your requests. the setup includes creating or configuring service resources, service territory members, work type groups, work types, work type group members, and service territory work types. see manage business information in salesforce scheduler for more information. • configure a work type mapped for each territory in the request body via service territory work type. map the same work type to the work type group, via work type group member. the following factors affect how time slots are calculated and returned. • timezones that differ across operating hours are handled and results are always returned in utc. • the resource must be marked as a required resource on the assigned resource object. • the resource is considered unavailable if the status categories of the resource assigned to service appointments are other than canceled, cannot complete, and completed. • resource absences of all types are considered unavailable from start to end. • the following fields of work type records, if configured, are used to fine-tune time slot requirements. for more information, see create work types in salesforce scheduler. parameter" "description timeframe start time slots sooner than current time + timeframe start aren’t returned. timeframe end time slots later than current time + timeframe end aren’t returned. block time before appointment the time period before the appointment is considered as unavailable. block time after appointment the time period after the appointment is considered as unavailable. operating hours the overlap of all operating hours from the account, work type, service territory, and service territory member are considered while determining time slots. for more information, see set up operating hours in salesforce scheduler. • only the time slots within the period of 31 days from the start date are returned. • salesforce scheduler uses multiple factors, such as field values, scheduled appointments, absences, scheduler settings, and scheduling policies to determine available time slots, including the earliest and latest appointment slots. see how does salesforce scheduler determine available time slots. note: if asset scheduling is enabled, you can provide an asset-based service resource in requiredresourceids to retrieve available timeslots for the asset resource. signature public static string getappointmentslots(lxscheduler.getappointmentslotsinput getappointmentslotsinput) parameters getappointmentslotsinput type: lxscheduler.getappointmentslotsinput this method takes input as an instance of the lxscheduler.getappointmentslotsinput class. build the instance of the input class using the lxscheduler.getappointmentslotsinputbuilder class. 2262apex reference guide schedulerresources class return value type: string setappointmentcandidatesmock(expectedresponse) sets a mock object when running tests for the getappointmentcandidates method. this constructor is intended for test usage and throws an exception if used outside of the apex test context. signature public static void setappointmentcandidatesmock(string expectedresponse) parameters expectedresponse type: string return value type: void this example shows a sample implementation of the getappointmentcandidates class: public class appointmentcandidateservice { //instance members for parsing public string starttime; public string endtime; public list resources; public string territoryid; public static list getappointmentcandidates(){ //build input for getappointmentcandidates api lxscheduler.getappointmentcandidatesinput input = new lxscheduler.getappointmentcandidatesinputbuilder() .setworktypegroupid('0vsrm0000000agt4a2') .setterritoryids(new list{'0hhrm0000000g8w0au'}) .setstarttime(system.now().format('yyyy-mm-dd\'t\'hh:mm:ssz','america/los_angeles')) .setendtime(system.now().adddays(2).format('yyyy-mm-dd\'t\'hh:mm:ssz','america/los_angeles')) .setschedulingpolicyid('0vrrm00000000d0') .setapiversion(double.valueof('50.0')) .build(); list vlist = parse(lxscheduler.schedulerresources.getappointmentcandidates(input)); return vlist; } private static list parse(string json) { return (list) system.json.deserialize(json, list.class); } } 2263apex reference guide schedulerresources class this example shows how to set a sample mock using the setappointmentcandidatesmock method: @istest private class getappointmentcandidatestest { static testmethod void getappcandidatestest() { string expectedresponse = '[' + ' {' + ' \""starttime\"": \""2021-03-18t16:00:00.000+0000\"",' + ' \""endtime\"": \""2021-03-18t17:00:00.000+0000\"",' + ' \""resources\"": [' + ' \""0hnrm0000000fxv0ae\""' + ' ],' + ' \""territoryid\"": \""0hhrm0000000g8w0au\""' + ' },' + ' {' + ' \""starttime\"": \""2021-03-18t" "19:00:00.000+0000\"",' + ' \""endtime\"": \""2021-03-18t20:00:00.000+0000\"",' + ' \""resources\"": [' + ' \""0hnrm0000000fxv0ae\""' + ' ],' + ' \""territoryid\"": \""0hhrm0000000g8w0au\""' + ' }' + ']'; lxscheduler.schedulerresources.setappointmentcandidatesmock(expectedresponse); test.starttest(); list candidatelist = appointmentcandidateservice.getappointmentcandidates(); system.assertequals(2, candidatelist.size(), 'should return only 2 records!'); test.stoptest(); } } setappointmentslotsmock(expectedresponse) sets a mock object when running tests for the getappointmentslots method. this constructor is intended for test usage and throws an exception if used outside of the apex test context. signature public static void setappointmentslotsmock(string expectedresponse) parameters expectedresponse type: string 2264apex reference guide skillrequirement class return value type: void skillrequirement class contains information about the set the skills that are required to complete a particular task for a work type. namespace lxscheduler usage the constructor for this class can’t be called directly. create an instance of this class using the skillrequirementbuilder.build() method. skillrequirementbuilder class contains methods to build an instance of the lxscheduler.skillrequirement class. a builder object is obtained by invoking one of the skillrequirementbuilder methods defined by the skillrequirement class. namespace lxscheduler in this section: skillrequirementbuilder methods skillrequirementbuilder methods the following are methods for skillrequirementbuilder. in this section: build() returns an instance of the lxscheduler.skillrequirement object. setskillid(skillid) sets the skill that is required to complete a particular task for a work type. this is a required field. setskilllevel(skilllevel) sets the level of the skill that is required to complete a particular task for a work type build() returns an instance of the lxscheduler.skillrequirement object. 2265apex reference guide worktype class signature public lxscheduler.skillrequirement build() return value type: lxscheduler.skillrequirement setskillid(skillid) sets the skill that is required to complete a particular task for a work type. this is a required field. signature public lxscheduler.skillrequirementbuilder setskillid(string skillid) parameters skillid type: string return value type: lxscheduler.skillrequirementbuilder setskilllevel(skilllevel) sets the level of the skill that is required to complete a particular task for a work type signature public lxscheduler.skillrequirementbuilder setskilllevel(double skilllevel) parameters skilllevel type: double the skill levels can range from zero to 99.99. depending on your business needs, you might want the skill level to reflect years of experience, certification levels, or license classes. return value type: lxscheduler.skillrequirementbuilder worktype class contains information about the type of work to be performed. 2266apex reference guide worktypebuilder class namespace lxscheduler usage the constructor for this class can’t be called directly. create an instance of this class using the worktypebuilder.build() method. worktypebuilder class contains methods to build an instance of the lxscheduler.worktype class. a builder object is obtained by invoking one of the worktypebuilder methods defined by the worktype class. namespace lxscheduler in this section: worktypebuilder methods worktypebuilder methods the following are methods for worktypebuilder. in this section: build() returns an instance of the lxscheduler.worktype object. setblocktimeafterappointmentinminutes(blocktimeafterappointmentinminutes) sets the time period, in minutes. setblocktimebeforeappointmentinminutes(blocktimebeforeappointmentinminutes) sets the time period, in minutes. setdurationinminutes(durationin" "minutes) sets the event length. setid(id) sets the id of the work type to the specified id. setoperatinghoursid(operatinghoursid) sets the overlap of operating hours. setskillrequirements(skillrequirements) sets the skills that are required to complete a particular task for a work type. settimeframeendinminutes(timeframeendinminutes) sets the end of the timeframe. settimeframestartinminutes(timeframestartinminutes) sets the beginning of the timeframe. 2267apex reference guide worktypebuilder class build() returns an instance of the lxscheduler.worktype object. signature public lxscheduler.worktype build() return value type: lxscheduler.worktype setblocktimeafterappointmentinminutes(blocktimeafterappointmentinminutes) sets the time period, in minutes. signature public lxscheduler.worktypebuilder setblocktimeafterappointmentinminutes(integer blocktimeafterappointmentinminutes) parameters blocktimeafterappointmentinminutes type: integer the time period after the appointment is considered unavailable. return value type: lxscheduler.worktypebuilder setblocktimebeforeappointmentinminutes(blocktimebeforeappointmentinminutes) sets the time period, in minutes. signature public lxscheduler.worktypebuilder setblocktimebeforeappointmentinminutes(integer blocktimebeforeappointmentinminutes) parameters blocktimebeforeappointmentinminutes type: integer the time period before the appointment is considered as unavailable. return value type: lxscheduler.worktypebuilder 2268apex reference guide worktypebuilder class setdurationinminutes(durationinminutes) sets the event length. signature public lxscheduler.worktypebuilder setdurationinminutes(integer durationinminutes) parameters durationinminutes type: integer contains the event length, in minutes. required if id is not given. return value type: lxscheduler.worktypebuilder setid(id) sets the id of the work type to the specified id. signature public lxscheduler.worktypebuilder setid(string id) parameters id type: string the id of the work type. required if durationinminutes is not given. return value type: lxscheduler.worktypebuilder setoperatinghoursid(operatinghoursid) sets the overlap of operating hours. signature public lxscheduler.worktypebuilder setoperatinghoursid(string operatinghoursid) parameters operatinghoursid type: string the overlap of all operating hours from the account, work type, service territory, and service territory member are considered while determining time slots. 2269apex reference guide worktypebuilder class return value type: lxscheduler.worktypebuilder setskillrequirements(skillrequirements) sets the skills that are required to complete a particular task for a work type. signature public lxscheduler.worktypebuilder setskillrequirements(list skillrequirements) parameters skillrequirements type: list this method takes input as an instance of the lxscheduler.skillrequirement class. build the instance of the input class using the lxscheduler.skillrequirementbuilder class. return value type: lxscheduler.worktypebuilder settimeframeendinminutes(timeframeendinminutes) sets the end of the timeframe. signature public lxscheduler.worktypebuilder settimeframeendinminutes(integer timeframeendinminutes) parameters timeframeendinminutes type: integer return value type: lxscheduler.worktypebuilder settimeframestartinminutes(timeframestartinminutes) sets the beginning of the timeframe. signature public lxscheduler.worktypebuilder settimeframestartinminutes(integer timeframestartinminutes) 2270apex reference guide serviceresourceschedulehandler interface parameters timeframestartinminutes type: integer return value type: lxscheduler.worktypebuilder serviceresourceschedulehandler interface allows an implementing class" "to check external calendar events to find already booked time slots for the requested service resources. this interface is part of salesforce scheduler. namespace lxscheduler usage the lxscheduler.serviceresourceschedulehandler interface is called by salesforce scheduler apis. to implement this interface, you must first declare a class with the implements keyword as follows: public class serviceresourceschedulehandlerimpl implements lxscheduler.serviceresourceschedulehandler{} next, your class must provide an implementation for the following method: public static list getunavailabletimeslots(lxscheduler.serviceappointmentrequestinfo requestinfo){ //your code here } the implemented method must be declared as global or public. in this section: serviceresourceschedulehandler methods serviceresourceschedulehandler example implementation serviceresourceschedulehandler methods the following are methods for serviceresourceschedulehandler. in this section: getunavailabletimeslots(var1) passes the required information to get unavailable time slots from an external system. the implementation of this method returns the lxscheduler.serviceresourceschedule class. 2271apex reference guide serviceresourceschedulehandler interface getunavailabletimeslots(var1) passes the required information to get unavailable time slots from an external system. the implementation of this method returns the lxscheduler.serviceresourceschedule class. signature public list getunavailabletimeslots(lxscheduler.serviceappointmentrequestinfo var1) parameters var1 type: lxscheduler.serviceappointmentrequestinfo represents the list of parameters that are passed to the serviceresourceschedulehandler interface. return value type: list serviceresourceschedulehandler example implementation this is an example implementation of the lxscheduler.serviceresourceschedulehandler interface. /** * implement interface lxscheduler.serviceresourceschedulehandler * this class is called when fetching service resources and time slots through salesforce scheduler api.*/ public class serviceresourceschedulehandlerimpl implements lxscheduler.serviceresourceschedulehandler{ // the main interface method. public static list getunavailabletimeslots(lxscheduler.serviceappointmentrequestinfo requestinfo){ //request info values. list serviceresources=requestinfo.getserviceresources(); datetime startdate=requestinfo.getstartdate(); datetime enddate=requestinfo.getenddate(); list resourceunavailability = new list(); set unavailabilityintervals = new set(); //this is a dummy response. implement your own business logic to connect to your internal or external systems. for (integer i = 0; i < 5; i++) { //set the unavailability intervals of a service resource. unavailabilityintervals.add(new lxscheduler.unavailabletimeslot(startdate.addminutes(15*i),startdate.addminutes(15*(i+1)))); 2272apex reference guide serviceresourceschedulehandler interface } for (lxscheduler.serviceresourceinfo serviceresource:serviceresources) { //set the unavailability of service resource. resourceunavailability.add(new lxscheduler.serviceresourceschedule(serviceresource.getserviceresourceid(),unavailabilityintervals)); } return resourceunavailability; } } this example shows how to set a sample test mock using the lxscheduler.serviceresourceschedulehandler interface. @istest private class serviceresourceschedulehandlerimpltest { static testmethod void getunavailabletimeslotstest() { //initializing the test execution with mock values. change it according to the implementation. //in case of non-test execution, the lxscheduler.serviceappointmentrequestinfo instance will automatically initialize. //mock values for lxscheduler.serviceresourceinfo string userid = '005d2000000i1n6iak'; string username = 'someuser@example.com'; string email" "= 'someuser@example.com'; string serviceresourceid = '0hnd20000004c9bkae'; list territoryids = new list(); string resourcetype = 't'; lxscheduler.serviceresourceinfo serviceresinfo = new lxscheduler.serviceresourceinfo(userid, username, email, serviceresourceid, territoryids, resourcetype); //mock values for lxscheduler.serviceappointmentrequestinfo datetime startdate = system.now(); datetime enddate = system.now(); list serviceresources = new list(); serviceresources.add(serviceresinfo); string schedulingpolicyid = '0vrd20000004c9s'; string worktypegroupid = '0vsd20000004c93oae'; string accountid = '001d2000002pkxwiai'; string primaryresourceid = '0hnd20000004c9bkae'; string worktypeid = '08qd20000004c9xiau'; string correlationid = 'some_id'; lxscheduler.serviceappointmentrequestinfo mockrequestinfo = new lxscheduler.serviceappointmentrequestinfo(startdate, enddate, serviceresources, schedulingpolicyid, worktypegroupid, accountid, 2273apex reference guide serviceappointmentrequestinfo class primaryresourceid, worktypeid, correlationid); serviceresourceschedulehandlerimpl.getunavailabletimeslots(mockrequestinfo); } } serviceappointmentrequestinfo class represents the list of parameters that are passed to the serviceresourceschedulehandler interface. this class is implemented internally by apex. namespace lxscheduler in this section: serviceappointmentrequestinfo constructors serviceappointmentrequestinfo methods serviceappointmentrequestinfo constructors the following are constructors for serviceappointmentrequestinfo. in this section: serviceappointmentrequestinfo(startdate, enddate, serviceresources, schedulingpolicyid, worktypegroupid, accountid, primaryresourceid, worktypeid, correlationid) creates a new instance of the lxscheduler.serviceappointmentrequestinfo class using the specified start date, end date, service resources, scheduling policy, work type group, accound id, primary resource, work type, and correlation. serviceappointmentrequestinfo(startdate, enddate, serviceresources, schedulingpolicyid, worktypegroupid, accountid, primaryresourceid, worktypeid, correlationid) creates a new instance of the lxscheduler.serviceappointmentrequestinfo class using the specified start date, end date, service resources, scheduling policy, work type group, accound id, primary resource, work type, and correlation. signature public serviceappointmentrequestinfo(datetime startdate, datetime enddate, list serviceresources, string schedulingpolicyid, string worktypegroupid, string accountid, string primaryresourceid, string worktypeid, string correlationid) 2274apex reference guide serviceappointmentrequestinfo class parameters startdate type: datetime the start date and time for which unavailable time slots are requested. enddate type: datetime the end date and time for which unavailable time slots are requested. serviceresources type: list the list of requested service resources for the unavailable time slots. schedulingpolicyid type: string the id of the scheduling policy . worktypegroupid type: string the work type group id. accountid type: string the account id of an existing user. primaryresourceid type: string the id of the primary service resource. worktypeid type: string the work type id. correlationid type: string a unique identifier for a service appointment request. serviceappointmentrequestinfo methods the following are methods for serviceappointmentrequestinfo. in this section: getaccountid() returns the account id of the customer if the api request contains one. getcorrelationid() returns a unique identifier for a request. getenddate() returns the end date and time for which unavailable time slots are requested. 2275apex reference guide serviceappointmentrequestinfo class getprimaryresourceid()" "returns the id of the primary service resource. getschedulingpolicyid() returns the id of the scheduling policy that the api request contains. getserviceresources() returns the list of requested service resources for the unavailable time slots. getstartdate() returns the start date and time for which unavailable time slots are requested. getworktypegroupid() returns the work type group id if the api request contains one. getworktypeid() returns the work type id if the api request contains one. getaccountid() returns the account id of the customer if the api request contains one. signature public string getaccountid() return value type: string getcorrelationid() returns a unique identifier for a request. signature public string getcorrelationid() return value type: string getenddate() returns the end date and time for which unavailable time slots are requested. signature public datetime getenddate() return value type: datetime 2276apex reference guide serviceappointmentrequestinfo class getprimaryresourceid() returns the id of the primary service resource. signature public string getprimaryresourceid() return value type: string getschedulingpolicyid() returns the id of the scheduling policy that the api request contains. signature public string getschedulingpolicyid() return value type: string getserviceresources() returns the list of requested service resources for the unavailable time slots. signature public list getserviceresources() return value type: list getstartdate() returns the start date and time for which unavailable time slots are requested. signature public datetime getstartdate() return value type: datetime getworktypegroupid() returns the work type group id if the api request contains one. 2277apex reference guide serviceresourceinfo class signature public string getworktypegroupid() return value type: string getworktypeid() returns the work type id if the api request contains one. signature public string getworktypeid() return value type: string serviceresourceinfo class contains information about a service resource. namespace lxscheduler in this section: serviceresourceinfo constructors serviceresourceinfo methods serviceresourceinfo constructors the following are constructors for serviceresourceinfo. in this section: serviceresourceinfo(userid, username, email, serviceresourceid, territoryids, resourcetype) creates a new instance of the lxscheduler.serviceresourceinfo class using the specified service resource details. serviceresourceinfo(userid, username, email, serviceresourceid, territoryids, resourcetype) creates a new instance of the lxscheduler.serviceresourceinfo class using the specified service resource details. 2278apex reference guide serviceresourceinfo class signature public serviceresourceinfo(string userid, string username, string email, string serviceresourceid, list territoryids, string resourcetype) parameters userid type: string the user id of the service resource. username type: string the user name of the service resource. email type: string the email id of the service resource. serviceresourceid type: string the id of the service resource. territoryids type: list a list of requested service territories for the service resource. resourcetype type: string the type of the service resource such as technician or asset. serviceresourceinfo methods the following are methods for serviceresourceinfo. in this section: getemail() returns the email id of the service resource. getresourcetype() returns the type of the service resource such as technician or asset. getserviceresourceid() returns the id of the service resource. getterritoryids() returns a list of requested service territories for the service resource. getuserid() returns the user id of the service resource. getusername() returns the user name of the service resource. 2279apex reference guide serviceresourceinfo class getemail() returns the email id of the service resource. signature public string getemail() return value type: string getresourcetype() returns the type of the service resource such as technician or asset. signature public string getresourcetype() return value type: string getserviceresourceid() returns the id of the service resource." "signature public string getserviceresourceid() return value type: string getterritoryids() returns a list of requested service territories for the service resource. signature public list getterritoryids() return value type: list getuserid() returns the user id of the service resource. 2280apex reference guide serviceresourceschedule class signature public string getuserid() return value type: string getusername() returns the user name of the service resource. signature public string getusername() return value type: string serviceresourceschedule class use this class to pass results from your implemented apex class to the serviceresourceschedulehandler interface methods. namespace lxscheduler in this section: serviceresourceschedule constructors serviceresourceschedule properties serviceresourceschedule constructors the following are constructors for serviceresourceschedule. in this section: serviceresourceschedule(serviceresourceid, unavailabletimeslots) creates a new instance of lxscheduler.serviceresourceschedule class. serviceresourceschedule(serviceresourceid, unavailabletimeslots) creates a new instance of lxscheduler.serviceresourceschedule class. signature public serviceresourceschedule(string serviceresourceid, set unavailabletimeslots) 2281apex reference guide unavailabletimeslot class parameters serviceresourceid type: string record id of the service resource. unavailabletimeslots type: set an instance of lxscheduler.unavailabletimeslot class. serviceresourceschedule properties the following are properties for serviceresourceschedule. in this section: serviceresourceid record id of the service resource. unavailabletimeslots an instance of lxscheduler.unavailabletimeslot class. serviceresourceid record id of the service resource. signature public string serviceresourceid {get; set;} property value type: string unavailabletimeslots an instance of lxscheduler.unavailabletimeslot class. signature public set unavailabletimeslots {get; set;} property value type: set unavailabletimeslot class use this class to pass the unavailable time slots to the lxscheduler.serviceresourceschedule class. 2282" "apex reference guide unavailabletimeslot class namespace lxscheduler in this section: unavailabletimeslot constructors unavailabletimeslot properties unavailabletimeslot constructors the following are constructors for unavailabletimeslot. in this section: unavailabletimeslot(timemin, timemax) creates an instance of lxscheduler.unavailabletimeslot class. unavailabletimeslot(timemin, timemax) creates an instance of lxscheduler.unavailabletimeslot class. signature public unavailabletimeslot(datetime timemin, datetime timemax) parameters timemin type: datetime start time of an unavailable time slot. timemax type: datetime end time of an unavailable time slot. unavailabletimeslot properties the following are properties for unavailabletimeslot. in this section: timemax end time of an unavailable time slot. timemin start time of an unavailable time slot. 2283apex reference guide messaging namespace timemax end time of an unavailable time slot. signature public datetime timemax {get; set;} property value type: datetime timemin start time of an unavailable time slot. signature public datetime timemin {get; set;} property value type: datetime messaging namespace the messaging namespace provides classes and methods for salesforce outbound and inbound email functionality. the following are the classes in the messaging namespace. in this section: attachmentretrievaloption enum provides options for including attachment metadata only, attachment metadata and content, or excluding attachments. email class (base email methods) contains base email methods common to both single and mass email. emailfileattachment class emailfileattachment is used in singleemailmessage to specify attachments passed in as part of the request, as opposed to existing documents in salesforce. inboundemail class represents an inbound email object. inboundemail.authenticationresult class contains the authentication type and response for inbound emails. inboundemail.authenticationresultfield class contains field data from the authentication result response for inbound emails. inboundemail.binaryattachment class an inboundemail object stores binary attachments in an inboundemail.binaryattachment object. 2284apex reference guide attachmentretrievaloption enum inboundemail.textattachment class an inboundemail object stores text attachments in an inboundemail.textattachment object. inboundemailresult class the inboundemailresult object is used to return the result of the email service. if this object is null, the result is assumed to be successful. inboundenvelope class the inboundenvelope object stores the envelope information associated with the inbound email, and has the following fields. massemailmessage class contains methods for sending mass email. inboundemail.header class an inboundemail object stores rfc 2822 email header information in an inboundemail.header object with the following properties. pushnotification class pushnotification is used to configure push notifications and send them from an apex trigger. pushnotificationpayload class contains methods to create the notification message payload for an apple device. customnotification class customnotification is used to create, configure, and send custom notifications from apex code. renderemailtemplatebodyresult class contains the results for rendering email templates. renderemailtemplateerror class represents an error that the renderemailtemplatebodyresult object can contain. sendemailerror class represents an error that the sendemailresult object may contain. sendemailresult class contains the result of sending an email message. singleemailmessage methods contains methods for sending single email messages. attachmentretrievaloption enum provides options for including attachment metadata only, attachment metadata and content, or excluding attachments. namespace messaging usage use these enum values with the renderstoredemailtemplate(templateid, whoid, whatid, attachmentretrievaloption) method. enum values the following are the values of the messaging.attachmentretrievaloption enum. 2285apex reference guide email class (base email methods) value description metadata_only includes only the file name, content type, and the object id in the fileattachments property of messaging.singleemailmessage. note: when the template is rendered from a visualforce template (and not from a static file attached to the template), the object id is not available. metadata_" "with_body includes the attachment content, in addition to the file name, content type, and the object id in the fileattachments property of messaging.singleemailmessage. none doesn’t include any attachments in messaging.singleemailmessage. email class (base email methods) contains base email methods common to both single and mass email. namespace messaging usage note: if templates are not being used, all email content must be in plain text, html, or both.visualforce email templates cannot be used for mass email. email methods the following are methods for email. all are instance methods. in this section: setbccsender(bcc) indicates whether the email sender receives a copy of the email that is sent. for a mass mail, the sender is only copied on the first email sent. setreplyto(replyaddress) optional. the email address that receives the message when a recipient replies. settemplateid(templateid) the id of the template to be merged to create this email. specify a value for settemplateid, sethtmlbody, or setplaintextbody. or, you can define both sethtmlbody and setplaintextbody. setsaveasactivity(saveasactivity) optional. the default value is true, meaning the email is saved as an activity. this argument only applies if the recipient list is based on targetobjectid or targetobjectids. if html email tracking is enabled for the organization, you will be able to track open rates. 2286apex reference guide email class (base email methods) setsenderdisplayname(displayname) optional. the name that appears on the from line of the email. this cannot be set if the object associated with a setorgwideemailaddressid for a singleemailmessage has defined its displayname field. setusesignature(usesignature) indicates whether the email includes an email signature if the user has one configured. the default is true, meaning if the user has a signature it is included in the email unless you specify false. setbccsender(bcc) indicates whether the email sender receives a copy of the email that is sent. for a mass mail, the sender is only copied on the first email sent. signature public void setbccsender(boolean bcc) parameters bcc type: boolean return value type: void usage note: if the bcc compliance option is set at the organization level, the user cannot add bcc addresses on standard messages. the following error code is returned: bcc_not_allowed_if_bcc_ compliance_enabled. contact your salesforce representative for information on bcc compliance. setreplyto(replyaddress) optional. the email address that receives the message when a recipient replies. signature public void setreplyto(string replyaddress) parameters replyaddress type: string return value type: void 2287apex reference guide email class (base email methods) settemplateid(templateid) the id of the template to be merged to create this email. specify a value for settemplateid, sethtmlbody, or setplaintextbody. or, you can define both sethtmlbody and setplaintextbody. signature public void settemplateid(id templateid) parameters templateid type: id return value type: void usage note: sethtmlbody and setplaintextbody apply only to single email methods, not to mass email methods. setsaveasactivity(saveasactivity) optional. the default value is true, meaning the email is saved as an activity. this argument only applies if the recipient list is based on targetobjectid or targetobjectids. if html email tracking is enabled for the organization, you will be able to track open rates. signature public void setsaveasactivity(boolean saveasactivity) parameters saveasactivity type: boolean return value type: void setsenderdisplayname(displayname) optional. the name that appears on the from line of the email. this cannot be set if the object associated with a setorgwideemailaddressid for a singleemailmessage has defined its displayname field. signature public void setsenderdisplayname(string displayname) 2288apex reference guide emailfileattachment class parameters displayname type: string return value type: void setusesignature(usesignature) indicates whether the email includes an email signature if the user has one configured." "the default is true, meaning if the user has a signature it is included in the email unless you specify false. signature public void setusesignature(boolean usesignature) parameters usesignature type: boolean return value type: void emailfileattachment class emailfileattachment is used in singleemailmessage to specify attachments passed in as part of the request, as opposed to existing documents in salesforce. namespace messaging in this section: emailfileattachment constructors emailfileattachment properties emailfileattachment constructors the following are constructors for emailfileattachment. in this section: emailfileattachment() creates a new instance of the messaging.emailfileattachment class. 2289apex reference guide emailfileattachment class emailfileattachment() creates a new instance of the messaging.emailfileattachment class. signature public emailfileattachment() emailfileattachment properties the following are properties for emailfileattachment. in this section: body gets or sets the attachment itself. contenttype gets or sets the attachment's content-type. filename gets or sets the name of the file to attach. id read-only. gets the attachment id. inline specifies a content-disposition of inline (true) or attachment (false). body gets or sets the attachment itself. signature public blob body {get; set;} property value type: blob contenttype gets or sets the attachment's content-type. signature public string contenttype {get; set;} property value type: string 2290apex reference guide inboundemail class filename gets or sets the name of the file to attach. signature public string filename {get; set;} property value type: string id read-only. gets the attachment id. signature public id id {get;} property value type: id inline specifies a content-disposition of inline (true) or attachment (false). signature public boolean inline {get; set;} property value type: boolean inboundemail class represents an inbound email object. namespace messaging in this section: inboundemail constructors inboundemail properties 2291apex reference guide inboundemail class inboundemail constructors the following are constructors for inboundemail. in this section: inboundemail() creates a new instance of the messaging.inboundemail class. inboundemail() creates a new instance of the messaging.inboundemail class. signature public inboundemail() inboundemail properties the following are properties for inboundemail. in this section: authenticationresults a list of authentication results received with the email, if any. binaryattachments a list of binary attachments received with the email, if any. ccaddresses a list of carbon copy (cc) addresses, if any. fromaddress the email address that appears in the from field. fromname the name that appears in the from field, if any. headers a list of the rfc 2822 headers in the email. htmlbody the html version of the email, if specified by the sender. htmlbodyistruncated indicates whether the html body text is truncated (true) or not (false.) inreplyto the in-reply-to field of the incoming email. identifies the email or emails to which this one is a reply (parent emails). contains the parent email or emails' message-ids. messageid the message-id—the incoming email's unique identifier. 2292apex reference guide inboundemail class plaintextbody the plain text version of the email, if specified by the sender. plaintextbodyistruncated indicates whether the plain body text is truncated (true) or not (false.) references the references field of the incoming email. identifies an email thread. contains a list of the parent emails' references and message ids, and possibly the in-reply-to fields. replyto the email address that appears in the reply-to header. subject the subject line of the email, if any. textattachments a list of text attachments received with the email, if any. toaddresses the email address that appears in the to field. authenticationresults a list of authentication results received with the email, if any. signature public inboundemail.authenticationresult" "[] authenticationresults {get; set;} property value type: inboundemail.authenticationresult[] usage examples of authentication results include dkim, dmarc, and spf. binaryattachments a list of binary attachments received with the email, if any. signature public inboundemail.binaryattachment[] binaryattachments {get; set;} property value type: inboundemail.binaryattachment[] usage examples of binary attachments include image, audio, application, and video files. 2293apex reference guide inboundemail class ccaddresses a list of carbon copy (cc) addresses, if any. signature public string[] ccaddresses {get; set;} property value type: string[] fromaddress the email address that appears in the from field. signature public string fromaddress {get; set;} property value type: string fromname the name that appears in the from field, if any. signature public string fromname {get; set;} property value type: string headers a list of the rfc 2822 headers in the email. signature public inboundemail.header[] headers {get; set;} property value type: inboundemail.header[] usage the list of the rfc 2822 headers includes: 2294apex reference guide inboundemail class • recieved from • custom headers • message-id • date htmlbody the html version of the email, if specified by the sender. signature public string htmlbody {get; set;} property value type: string htmlbodyistruncated indicates whether the html body text is truncated (true) or not (false.) signature public boolean htmlbodyistruncated {get; set;} property value type: boolean inreplyto the in-reply-to field of the incoming email. identifies the email or emails to which this one is a reply (parent emails). contains the parent email or emails' message-ids. signature public string inreplyto {get; set;} property value type: string messageid the message-id—the incoming email's unique identifier. signature public string messageid {get; set;} 2295apex reference guide inboundemail class property value type: string plaintextbody the plain text version of the email, if specified by the sender. signature public string plaintextbody {get; set;} property value type: string plaintextbodyistruncated indicates whether the plain body text is truncated (true) or not (false.) signature public boolean plaintextbodyistruncated {get; set;} property value type: boolean references the references field of the incoming email. identifies an email thread. contains a list of the parent emails' references and message ids, and possibly the in-reply-to fields. signature public string[] references {get; set;} property value type: string[] replyto the email address that appears in the reply-to header. signature public string replyto {get; set;} 2296apex reference guide inboundemail class property value type: string usage if there is no reply-to header, this field is identical to the fromaddress field. subject the subject line of the email, if any. signature public string subject {get; set;} property value type: string textattachments a list of text attachments received with the email, if any. signature public inboundemail.textattachment[] textattachments {get; set;} property value type: inboundemail.textattachment[] usage the text attachments can be any of the following: • attachments with a multipurpose internet mail extension (mime) type of text • attachments with a mime type of application/octet-stream and a file name that ends with either a .vcf or .vcs extension. these are saved as text/x-vcard and text/calendar mime types, respectively. toaddresses the email address that appears in the to field. signature public string[] toaddresses {get; set;} property value type: string[] 2297apex reference guide inboundemail.authenticationresult class inboundemail.authenticationresult class contains the authentication type and response for inbound emails. namespace messaging in this section: inboundemail.authenticationresult constructors inboundemail" ".authenticationresult properties inboundemail.authenticationresult constructors the following are constructors for inboundemail.authenticationresult. in this section: inboundemail.authenticationresult() creates a new instance of the messaging.inboundemail.authenticationresult class. inboundemail.authenticationresult() creates a new instance of the messaging.inboundemail.authenticationresult class. signature public inboundemail.authenticationresult() inboundemail.authenticationresult properties the following are properties for inboundemail.authenticationresult. in this section: authenticationresultfields additional information in authentication result headers. examples include: name: smtp.mailfrom and value: example.com. method the authentication method used for the security check. possible values include dkim, dmarc, or spf. result the result of the authentication check. when the email service is configured to verify the legitimacy of the sending server before processing a message, possible values include pass or fail. otherwise, the value returned is none. authenticationresultfields additional information in authentication result headers. examples include: name: smtp.mailfrom and value: example.com. 2298apex reference guide inboundemail.authenticationresultfield class signature public inboundemail.authenticationresultfield[] authenticationresultfields {get; set;} property value type: inboundemail.authenticationresultfield[] method the authentication method used for the security check. possible values include dkim, dmarc, or spf. signature public string method {get; set;} property value type: string result the result of the authentication check. when the email service is configured to verify the legitimacy of the sending server before processing a message, possible values include pass or fail. otherwise, the value returned is none. signature public string result {get; set;} property value type: string inboundemail.authenticationresultfield class contains field data from the authentication result response for inbound emails. namespace messaging in this section: inboundemail.authenticationresultfield constructors inboundemail.authenticationresultfield properties inboundemail.authenticationresultfield constructors the following are constructors for inboundemail.authenticationresultfield. 2299apex reference guide inboundemail.authenticationresultfield class in this section: inboundemail.authenticationresultfield() creates a new instance of the messaging.inboundemail.authenticationresultfield class. inboundemail.authenticationresultfield() creates a new instance of the messaging.inboundemail.authenticationresultfield class. signature public inboundemail.authenticationresultfield() inboundemail.authenticationresultfield properties the following are properties for inboundemail.authenticationresultfield. in this section: name the authentication result field name. for example: smtp.mailfrom. value the authentication result field value. for example: example.com. name the authentication result field name. for example: smtp.mailfrom. signature public string name {get; set;} property value type: string value the authentication result field value. for example: example.com. signature public string value {get; set;} property value type: string 2300apex reference guide inboundemail.binaryattachment class inboundemail.binaryattachment class an inboundemail object stores binary attachments in an inboundemail.binaryattachment object. namespace messaging usage examples of binary attachments include image, audio, application, and video files. in this section: inboundemail.binaryattachment constructors inboundemail.binaryattachment properties inboundemail.binaryattachment constructors the following are constructors for inboundemail.binaryattachment. in this section: inboundemail.binaryattachment() creates a new instance of the messaging.inboundemail.binaryattachment class. inboundemail.binaryattachment() creates a new instance of the messaging.inboundemail.binaryattachment class. signature public inboundemail.binaryattachment() inboundemail.binaryattachment properties the following are properties for inboundemail.binaryattachment. in this section: body the body of the attachment. filename the name of the attached file. headers any header values associated with the attachment. examples of header names include content-type" ", content-transfer-encoding, and content-id. 2301apex reference guide inboundemail.binaryattachment class mimetypesubtype the primary and sub mime-type. body the body of the attachment. signature public blob body {get; set;} property value type: blob filename the name of the attached file. signature public string filename {get; set;} property value type: string headers any header values associated with the attachment. examples of header names include content-type, content-transfer-encoding, and content-id. signature public list headers {get; set;} property value type: list mimetypesubtype the primary and sub mime-type. signature public string mimetypesubtype {get; set;} property value type: string 2302apex reference guide inboundemail.textattachment class inboundemail.textattachment class an inboundemail object stores text attachments in an inboundemail.textattachment object. namespace messaging usage the text attachments can be any of the following: • attachments with a multipurpose internet mail extension (mime) type of text • attachments with a mime type of application/octet-stream and a file name that ends with either a .vcf or .vcs extension. these are saved as text/x-vcard and text/calendar mime types, respectively. in this section: inboundemail.textattachment constructors inboundemail.textattachment properties inboundemail.textattachment constructors the following are constructors for inboundemail.textattachment. in this section: inboundemail.textattachment() creates a new instance of the messaging.inboundemail.textattachment class. inboundemail.textattachment() creates a new instance of the messaging.inboundemail.textattachment class. signature public inboundemail.textattachment() inboundemail.textattachment properties the following are properties for inboundemail.textattachment. in this section: body the body of the attachment. bodyistruncated indicates whether the attachment body text is truncated (true) or not (false.) 2303apex reference guide inboundemail.textattachment class charset the original character set of the body field. the body is re-encoded as utf-8 as input to the apex method. filename the name of the attached file. headers any header values associated with the attachment. examples of header names include content-type, content-transfer-encoding, and content-id. mimetypesubtype the primary and sub mime-type. body the body of the attachment. signature public string body {get; set;} property value type: string bodyistruncated indicates whether the attachment body text is truncated (true) or not (false.) signature public boolean bodyistruncated {get; set;} property value type: boolean charset the original character set of the body field. the body is re-encoded as utf-8 as input to the apex method. signature public string charset {get; set;} property value type: string filename the name of the attached file. 2304apex reference guide inboundemailresult class signature public string filename {get; set;} property value type: string headers any header values associated with the attachment. examples of header names include content-type, content-transfer-encoding, and content-id. signature public list headers {get; set;} property value type: list mimetypesubtype the primary and sub mime-type. signature public string mimetypesubtype {get; set;} property value type: string inboundemailresult class the inboundemailresult object is used to return the result of the email service. if this object is null, the result is assumed to be successful. namespace messaging inboundemailresult properties the following are properties for inboundemailresult. in this section: message a message that salesforce returns in the body of a reply email. this field can be populated" "with text irrespective of the value returned by the success field. 2305apex reference guide inboundenvelope class success a value that indicates whether the email was successfully processed. message a message that salesforce returns in the body of a reply email. this field can be populated with text irrespective of the value returned by the success field. signature public string message {get; set;} property value type: string success a value that indicates whether the email was successfully processed. signature public boolean success {get; set;} property value type: boolean usage if false, salesforce rejects the inbound email and sends a reply email to the original sender containing the message specified in the message field. inboundenvelope class the inboundenvelope object stores the envelope information associated with the inbound email, and has the following fields. namespace messaging inboundenvelope properties the following are properties for inboundenvelope. in this section: fromaddress the name that appears in the from field of the envelope, if any. 2306apex reference guide massemailmessage class toaddress the name that appears in the to field of the envelope, if any. fromaddress the name that appears in the from field of the envelope, if any. signature public string fromaddress {get; set;} property value type: string toaddress the name that appears in the to field of the envelope, if any. signature public string toaddress {get; set;} property value type: string massemailmessage class contains methods for sending mass email. namespace messaging usage massemailmessage extends email and inherits all of its methods. all base email (email class) methods are also available to the massemailmessage objects. in this section: massemailmessage constructors massemailmessage methods see also: email class (base email methods) 2307apex reference guide massemailmessage class massemailmessage constructors the following are constructors for massemailmessage. in this section: massemailmessage() creates a new instance of the messaging.massemailmessage class. massemailmessage() creates a new instance of the messaging.massemailmessage class. signature public massemailmessage() massemailmessage methods the following are methods for massemailmessage. all are instance methods. all base email (email class) methods are also available to the massemailmessage objects. these methods are described in email class (base email methods). in this section: setdescription(description) the description of the email. settargetobjectids(targetobjectids) a list of ids of the contacts, leads, or users to which the email will be sent. the ids you specify set the context and ensure that merge fields in the template contain the correct data. the objects must be of the same type (all contacts, all leads, or all users). setwhatids(whatids) optional. if you specify a list of contacts for the targetobjectids field, you can specify a list of whatids as well. this helps to further ensure that merge fields in the template contain the correct data. setdescription(description) the description of the email. signature public void setdescription(string description) parameters description type: string return value type: void 2308apex reference guide massemailmessage class settargetobjectids(targetobjectids) a list of ids of the contacts, leads, or users to which the email will be sent. the ids you specify set the context and ensure that merge fields in the template contain the correct data. the objects must be of the same type (all contacts, all leads, or all users). signature public void settargetobjectids(id[] targetobjectids) parameters targetobjectids type: id[] return value type: void usage you can list multiple ids per email. if you specify a value for the targetobjectids field, optionally specify a whatid as well to set the email context to a user, contact, or lead. this ensures that merge fields in the template contain the correct data. each id counts against the sending organization's daily mass email limit. do not specify the ids of records that have the email opt out option selected. all emails must have a recipient value in at least one of the following fields: • toaddresses • ccaddresses • bccaddresses • targetobjectid setwhatids(whatids) optional. if you specify a list of contacts" "for the targetobjectids field, you can specify a list of whatids as well. this helps to further ensure that merge fields in the template contain the correct data. signature public void setwhatids(id[] whatids) parameters whatids type: id[] return value type: void 2309apex reference guide inboundemail.header class usage the values must be one of the following types: • contract • case • opportunity • product note: if you specify whatids, specify one for each targetobjectid; otherwise, you will receive an invalid_id_field error. inboundemail.header class an inboundemail object stores rfc 2822 email header information in an inboundemail.header object with the following properties. namespace messaging inboundemail.header properties the following are properties for inboundemail.header. in this section: name the name of the header parameter, such as date or message-id. value the value of the header. name the name of the header parameter, such as date or message-id. signature public string name {get; set;} property value type: string value the value of the header. signature public string value {get; set;} 2310apex reference guide pushnotification class property value type: string pushnotification class pushnotification is used to configure push notifications and send them from an apex trigger. namespace messaging example this sample apex trigger sends push notifications to the connected app named test_app, which corresponds to a mobile app on ios mobile clients. the trigger fires after cases have been updated and sends the push notification to two users: the case owner and the user who last modified the case. trigger casealert on case (after update) { for(case cs : trigger.new) { // instantiating a notification messaging.pushnotification msg = new messaging.pushnotification(); // assembling the necessary payload parameters for apple. // apple params are: // (,,, // ) // this example doesn't use badge count or free-form data. // the number of notifications that haven't been acted // upon by the intended recipient is best calculated // at the time of the push. this timing helps // ensure accuracy across multiple target devices. map payload = messaging.pushnotificationpayload.apple( 'case ' + cs.casenumber + ' status changed to: ' + cs.status, '', null, null); // adding the assembled payload to the notification msg.setpayload(payload); // getting recipient users string userid1 = cs.ownerid; string userid2 = cs.lastmodifiedbyid; // adding recipient users to list set users = new set(); users.add(userid1); users.add(userid2); // sending the notification to the specified app and users. 2311apex reference guide pushnotification class // here we specify the api name of the connected app. msg.send('test_app', users); } } in this section: pushnotification constructors pushnotification methods pushnotification constructors the following are the constructors for pushnotification. in this section: pushnotification() creates a new instance of the messaging.pushnotification class. pushnotification(payload) creates a new instance of the messaging.pushnotification class using the specified payload parameters as key-value pairs. when you use this constructor, you don’t need to call setpayload to set the payload. pushnotification() creates a new instance of the messaging.pushnotification class. signature public pushnotification() pushnotification(payload) creates a new instance of the messaging.pushnotification class using the specified payload parameters as key-value pairs. when you use this constructor, you don’t need to call setpayload to set the payload. signature public pushnotification(map payload) parameters payload type:map the payload, expressed as a map of key-value pairs. pushnotification methods the following are the methods for pushnotification. all are global methods. 2312apex reference guide pushnotification class in this section: send(" "application, users) sends a push notification message to the specified users. setpayload(payload) sets the payload of the push notification message. setttl(ttl) reserved for future use. send(application, users) sends a push notification message to the specified users. signature public void send(string application, set users) parameters application type: string the connected app api name. this corresponds to the mobile client app the notification should be sent to. users type: set a set of user ids that correspond to the users the notification should be sent to. example see the push notification example. setpayload(payload) sets the payload of the push notification message. signature public void setpayload(map payload) parameters payload type: map the payload, expressed as a map of key-value pairs. payload parameters can be different for each mobile os vendor. for more information on apple’s payload parameters, search for “apple push notification service” at https://developer.apple.com/library/mac/documentation/. to create the payload for an apple device, see the pushnotificationpayload class. 2313apex reference guide pushnotificationpayload class example see the push notification example. setttl(ttl) reserved for future use. signature public void setttl(integer ttl) parameters ttl type: integer reserved for future use. pushnotificationpayload class contains methods to create the notification message payload for an apple device. namespace messaging usage apple has specific requirements for the notification payload. and this class has helper methods to create the payload. for more information on apple’s payload parameters, search for “apple push notification service” at https://developer.apple.com/library/mac/documentation/. example see the push notification example. in this section: pushnotificationpayload methods pushnotificationpayload methods the following are the methods for pushnotificationpayload. all are global static methods. in this section: apple(alert, sound, badgecount, userdata) helper method that creates a valid apple payload from the specified arguments. apple(alertbody, actionlockey, lockey, locargs, launchimage, sound, badgecount, userdata) helper method that creates a valid apple payload from the specified arguments. 2314apex reference guide pushnotificationpayload class apple(alert, sound, badgecount, userdata) helper method that creates a valid apple payload from the specified arguments. signature public static map apple(string alert, string sound, integer badgecount, map userdata) parameters alert type: string notification message to be sent to the mobile client. sound type: string name of a sound file to be played as an alert. this sound file should be in the mobile application bundle. badgecount type: integer number to display as the badge of the application icon. userdata type: map map of key-value pairs that contains any additional data used to provide context for the notification. for example, it can contain ids of the records that caused the notification to be sent. the mobile client app can use these ids to display these records. return value type:map returns a formatted payload that includes all of the specified arguments. usage to generate a valid payload, you must provide a value for at least one of the following parameters: alert, sound, badgecount. example see the push notification example. apple(alertbody, actionlockey, lockey, locargs, launchimage, sound, badgecount, userdata) helper method that creates a valid apple payload from the specified arguments. signature public static map apple(string alertbody, string actionlockey, string lockey, string[] locargs, string launchimage, string sound, integer badgecount, map userdata) 2315apex reference guide customnotification class parameters alertbody type: string text of the alert message. actionlockey type: string if a value is specified for the actionlockey argument, an alert with two buttons is displayed. the value is a key to get a localized string in a localizable.strings file to use for the right button’s title. lockey type: string key" "to an alert-message string in a localizable.strings file for the current localization. locargs type: list variable string values to appear in place of the format specifiers in lockey. launchimage type: string file name of an image file in the application bundle. sound type: string name of a sound file to be played as an alert. this sound file should be in the mobile application bundle. badgecount type: integer number to display as the badge of the application icon. userdata type: map map of key-value pairs that contains any additional data used to provide context for the notification. for example, it can contain ids of the records that caused the notification to be sent. the mobile client app can use these ids to display these records. return value type: map returns a formatted payload that includes all of the specified arguments. usage to generate a valid payload, you must provide a value for at least one of the following parameters: alert, sound, badgecount. customnotification class customnotification is used to create, configure, and send custom notifications from apex code. 2316apex reference guide customnotification class namespace messaging usage customnotification allows two approaches to creating and configuring a custom notification. • create an instance with the default constructor, and then set notification attributes using the various setter methods. • create an instance and configure notification parameters at the same time using the parameterized constructor. once the custom notification is configured, call send() to send the notification. notification target the notification target is used by the receiving client application to navigate to an appropriate record or page when a user responds to a notification. for example, when a user is notified that a record was updated, responding to the notification can open the relevant record. you must specify a target for a notification. the target can be specified using either the targetid or the targetpageref attribute. neither attribute is required, but if both are omitted, send() throws an exception. if there’s no natural target for a notification, set the targetid to a dummy value, such as 000000000000000aaa. a dummy value prevents the exception, and also prevents automatic navigation when responding to the notification in the client app. you can set both targetid and targetpageref in the same notification. the client app that receives the notification determines which target, if any, to use when responding to the notification. important: before winter ’21 you could set only a target record (targetid) for a notification. most client applications expect to find a targetid in the notification payload. if you can’t update a client app to handle notifications that include only a targetpageref, set the targetid to a dummy value. execution context and notification permissions by default apex code executes in system mode, and doesn’t require user permissions to send notifications with customnotification. however, if your apex code runs in a user context—for example, by executing anonymous apex in the developer console—the send custom notifications user permission is checked, and send() fails if you don’t have the required permission. example this example apex class provides a static method for sending a custom notification to a recipient list. call this method from a trigger, flow, or wherever you want to send a custom notification from apex. public without sharing class customnotificationfromapex { public static void notifyusers(set recipientsids, string targetid) { // get the id for our custom notification type customnotificationtype notificationtype = [select id, developername from customnotificationtype where developername='custom_notification']; // create a new custom notification messaging.customnotification notification = new messaging.customnotification(); // set the contents for the notification 2317apex reference guide customnotification class notification.settitle('apex custom notification'); notification.setbody('the notifications are coming from inside the apex!'); // set the notification type and target notification.setnotificationtypeid(notificationtype.id); notification.settargetid(targetid); // actually send the notification try { notification.send(recipientsids); } catch (exception e) { system.debug('problem sending notification: ' + e.getmessage()); } } } note: this example uses a hard-coded string, custom_notification, as the developername (also known as the api name) of a custom notification type. use your custom notification types in your own code. customnot" "ification.send() can throw an exception, which is handled minimally in this example. add more substantial error handling to code you plan to use in production. in this section: customnotification constructors customnotification methods see also: salesforce help: send custom notifications actions developer guide: custom notification actions metadata api developer guide: customnotificationtype customnotification constructors the following are constructors for customnotification. in this section: customnotification() creates a new instance of the messaging.customnotification class. customnotification(typeid, sender, title, body, targetid, targetpageref) creates an instance of the messaging.customnotification class using the specified parameters. when you use this constructor, you don’t need to call the various setter methods to define the custom notification attributes. customnotification() creates a new instance of the messaging.customnotification class. 2318apex reference guide customnotification class signature public customnotification() customnotification(typeid, sender, title, body, targetid, targetpageref) creates an instance of the messaging.customnotification class using the specified parameters. when you use this constructor, you don’t need to call the various setter methods to define the custom notification attributes. signature public customnotification(string typeid, string sender, string title, string body, string targetid, string targetpageref) parameters typeid type: string the id of the custom notification type being used for the notification. sender type: string the user id of the sender of the notification. title type: string the title of the notification. maximum characters: 250. body type: string the body of the notification. maximum characters: 750. targetid type: string the record id for the target record of the notification. you must specify either a targetid or a targetpageref. see custom notification usage. targetpageref type: string the pagereference for the navigation target of the notification. to see how to specify the target using json, see pagereference types. you must specify either a targetid or a targetpagere. see custom notification usage. usage a client may see a truncated notification title or body depending on the delivery channel or app, and how the connect api notification parameters are configured. for more information on the trimmessages query parameter, see notification . customnotification methods the following are methods for customnotification. 2319apex reference guide customnotification class in this section: send(users) sends a custom notification to the specified users. setnotificationtypeid(id) sets the type of the custom notification. settitle(title) sets the title of the custom notification. setbody(body) sets the body of the custom notification. setsenderid(id) sets the sender of the custom notification. settargetid(targetid) sets the target record of the custom notification. settargetpageref(pageref) sets the target page of the custom notification. send(users) sends a custom notification to the specified users. signature public void send(set users) parameters users type: set required. a set of recipient ids. each recipient id corresponds to a recipient or recipient type that the notification should be sent to. valid recipient or recipient type values are: • userid — the notification is sent to this user, if this user is active. • accountid — the notification is sent to all active users who are members of this account’s account team. note: this recipient type is valid if account teams are enabled for your org. • opportunityid — the notification is sent to all active users who are members of this opportunity’s opportunity team. note: this recipient type is valid if team selling is enabled for your org. • groupid — the notification is sent to all active users who are members of this group. • queueid — the notification is sent to all active users who are members of this queue. values can be combined in a set, up to the maximum of 500 values. return value type: void 2320apex reference guide customnotification class example see the custom notification example. setnotificationtypeid(id) sets the type of the custom notification. signature public void setnotificationtypeid(string id) parameters id type: string the id of the custom notification type being" "used for the notification. a notification type is required to send a custom notification. see custom notification usage. return value type: void example see the custom notification example. settitle(title) sets the title of the custom notification. signature public void settitle(string title) parameters title type: string the title of the notification, as it will be seen by recipients. maximum characters: 250. a title is required to send a custom notification. see custom notification usage. return value type: void example see the custom notification example. 2321apex reference guide customnotification class setbody(body) sets the body of the custom notification. signature public void setbody(string body) parameters body type: string the body of the notification, as it will be seen by recipients. maximum characters: 750. a body is required to send a custom notification. see custom notification usage. return value type: void example see the custom notification example. setsenderid(id) sets the sender of the custom notification. signature public void setsenderid(string id) parameters id type: string the user id of the sender of the notification. setting a sender is optional. see custom notification usage. return value type: void example see the custom notification example. settargetid(targetid) sets the target record of the custom notification. 2322apex reference guide renderemailtemplatebodyresult class signature public void settargetid(string targetid) parameters targetid type: string the record id for the target record of the notification. either a targetid or a targetpageref is required to send a custom notification. see custom notification usage. return value type: void example see the custom notification example. settargetpageref(pageref) sets the target page of the custom notification. signature public void settargetpageref(string pageref) parameters pageref type: string the pagereference for the navigation target of the notification. either a targetid or a targetpageref is required to send a custom notification. see custom notification usage. return value type: void example see the custom notification example. renderemailtemplatebodyresult class contains the results for rendering email templates. namespace messaging 2323apex reference guide renderemailtemplatebodyresult class in this section: renderemailtemplatebodyresult methods renderemailtemplatebodyresult methods the following are methods for renderemailtemplatebodyresult. in this section: geterrors() if an error occurred during the renderemailtemplate method, a renderemailtemplateerror object is returned. getmergedbody() returns the rendered body text with merge field references replaced with the corresponding record data. getsuccess() indicates whether the operation was successful. geterrors() if an error occurred during the renderemailtemplate method, a renderemailtemplateerror object is returned. signature public list geterrors() return value type: list getmergedbody() returns the rendered body text with merge field references replaced with the corresponding record data. signature public string getmergedbody() return value type: string getsuccess() indicates whether the operation was successful. signature public boolean getsuccess() 2324apex reference guide renderemailtemplateerror class return value type: boolean renderemailtemplateerror class represents an error that the renderemailtemplatebodyresult object can contain. namespace messaging in this section: renderemailtemplateerror methods renderemailtemplateerror methods the following are methods for renderemailtemplateerror. in this section: getfieldname() returns the name of the merge field in the error. getmessage() returns a message describing the error. getoffset() returns the offset within the supplied body text where the error was discovered. if the offset cannot be determined, -1 is returned. getstatuscode() returns a salesforce api status code. getfieldname() returns the name of the merge field in the error. signature public string getfieldname() return value type: string getmessage() returns a message describing the error. 2325apex reference guide sendemailerror class signature public string getmessage() return value type: string getoffset() returns the offset within the supplied body text where the error was discovered. if the offset cannot be determined, -1 is returned. signature" "public integer getoffset() return value type: integer getstatuscode() returns a salesforce api status code. signature public system.statuscode getstatuscode() return value type: system.statuscode sendemailerror class represents an error that the sendemailresult object may contain. namespace messaging sendemailerror methods the following are methods for sendemailerror. all are instance methods. in this section: getfields() a list of one or more field names. identifies which fields in the object, if any, affected the error condition. getmessage() the text of the error message. 2326apex reference guide sendemailerror class getstatuscode() returns a code that characterizes the error. gettargetobjectid() the id of the target record for which the error occurred. getfields() a list of one or more field names. identifies which fields in the object, if any, affected the error condition. signature public string[] getfields() return value type: string[] getmessage() the text of the error message. signature public string getmessage() return value type: string getstatuscode() returns a code that characterizes the error. signature public system.statuscode getstatuscode() return value type: system.statuscode usage the full list of status codes is available in the wsdl file for your organization. for more information about accessing the wsdl file for your organization, see downloading salesforce wsdls and client authentication certificates in the salesforce online help. gettargetobjectid() the id of the target record for which the error occurred. 2327apex reference guide sendemailresult class signature public string gettargetobjectid() return value type: string sendemailresult class contains the result of sending an email message. namespace messaging sendemailresult methods the following are methods for sendemailresult. all are instance methods. in this section: geterrors() if an error occurred during the sendemail method, a sendemailerror object is returned. issuccess() indicates whether the email was successfully submitted for delivery (true) or not (false). even if issuccess is true, it does not mean the intended recipients received the email, as there could have been a problem with the email address or it could have bounced or been blocked by a spam blocker. geterrors() if an error occurred during the sendemail method, a sendemailerror object is returned. signature public sendemailerror[] geterrors() return value type: messaging.sendemailerror[] issuccess() indicates whether the email was successfully submitted for delivery (true) or not (false). even if issuccess is true, it does not mean the intended recipients received the email, as there could have been a problem with the email address or it could have bounced or been blocked by a spam blocker. signature public boolean issuccess() 2328apex reference guide singleemailmessage methods return value type: boolean singleemailmessage methods contains methods for sending single email messages. namespace messaging usage singleemailmessage extends email and inherits all of its methods. all base email (email class) methods are also available to the singleemailmessage objects. emails sent via singleemailmessage count against the sending organization's daily single email limit. email properties are readable and writable. each property has corresponding setter and getter methods. for example, the toaddresses() property is equivalent to the settoaddresses() and gettoaddresses() methods. only the setter methods are documented. however, the gettemplatename() method doesn’t have an equivalent setter method; use settemplateid() to specify a template name. in this section: singleemailmessage constructors singleemailmessage methods see also: email class (base email methods) singleemailmessage constructors the following are constructors for singleemailmessage. in this section: singleemailmessage() creates a new instance of the messaging.singleemailmessage class. singleemailmessage() creates a new instance of the messaging.singleemailmessage class. signature public singleemailmessage() 2329apex reference guide singleemailmessage methods singleemailmessage methods the following are methods for singleemailmessage. all are instance methods. all base email (email class) methods are also available to the singleemailmessage objects. these methods are described in email class (base email methods). in this section:" "gettemplatename() the name of the template used to create the email. setbccaddresses(bccaddresses) optional. a list of blind carbon copy (bcc) addresses or object ids of the contacts, leads, and users you’re sending the email to. the maximum size for this field is 4,000 bytes. the maximum total of toaddresses, ccaddresses, and bccaddresses per email is 150. all recipients in these three fields count against the limit for email sent using apex or the api. setccaddresses(ccaddresses) optional. a list of carbon copy (cc) addresses or object ids of the contacts, leads, and users you’re sending the email to. the maximum size for this field is 4,000 bytes. the maximum total of toaddresses, ccaddresses, and bccaddresses per email is 150. all recipients in these three fields count against the limit for email sent using apex or the api. setcharset(characterset) optional. the character set for the email. if this value is null, the user's default value is used. setdocumentattachments(documentids) (deprecated. use setentityattachments() instead.) optional. a list containing the id of each document object you want to attach to the email. setentityattachments(ids) optional. array of ids of document, contentversion, or attachment items to attach to the email. setfileattachments(filenames) optional. a list containing the file names of the binary and text files you want to attach to the email. sethtmlbody(htmlbody) optional. the html version of the email, specified by the sender. the value is encoded according to the specification associated with the organization. specify a value for settemplateid, sethtmlbody, or setplaintextbody. or, you can define both sethtmlbody and setplaintextbody. setinreplyto(parentmessageids) sets the optional in-reply-to field of the outgoing email. this field identifies the email or emails to which this email is a reply (parent emails). setoptoutpolicy(emailoptoutpolicy) optional. if you added recipients by id instead of email address and the email opt out option is set, this method determines the behavior of the sendemail() call. if you add recipients by their email addresses, the opt-out settings for those recipients aren’t checked and those recipients always receive the email. setplaintextbody(plaintextbody) optional. the text version of the email, specified by the sender. specify a value for settemplateid, sethtmlbody, or setplaintextbody. or, you can define both sethtmlbody and setplaintextbody. setorgwideemailaddressid(emailaddressid) optional. the id of the organization-wide email address associated with the outgoing email. if you’re using apex to send emails from the guest user, set the sender to the verified org-wide email address or the emails are blocked. the object's displayname field cannot be set if the setsenderdisplayname field is already set. 2330apex reference guide singleemailmessage methods setreferences(references) optional. the references field of the outgoing email. identifies an email thread. contains the parent emails' references and message ids, and possibly the in-reply-to fields. setsubject(subject) optional. the email subject line. if you are using an email template, the subject line of the template overrides this value. settargetobjectid(targetobjectid) required if using a template, optional otherwise. the id of the contact, lead, or user to which the email will be sent. the id you specify sets the context and ensures that merge fields in the template contain the correct data. settemplateid(templateid) required if using a template, optional otherwise. the id of the template used to create the email. settoaddresses(toaddresses) optional. a list of email addresses or object ids of the contacts, leads, and users you’re sending the email to. the maximum size for this field is 4,000 bytes. the maximum total of toaddresses, ccaddresses, and bccaddresses per email is 150. all recipients in these three fields count against the limit for email sent using apex or the api. settreatbodiesastemplate(treatastemplate) optional. if set to true, the subject, plain text, and html text bodies of the email are treated as template data. the merge fields are resolved" "using the renderemailtemplate method. default is false. settreattargetobjectasrecipient(treatasrecipient) optional. if set to true, the targetobjectid (a contact, lead, or user) is the recipient of the email. if set to false, the targetobjectid is supplied as the whoid field for template rendering but isn’t a recipient of the email. the default is true. setwhatid(whatid) if you specify a contact for the targetobjectid field, you can specify an optional whatid as well. this helps to further ensure that merge fields in the template contain the correct data. gettemplatename() the name of the template used to create the email. signature public string gettemplatename() return value type: string usage there is no equivalent setter method for gettemplatename(). if the email didn’t use a template, gettemplatename() returns nothing. if you use settemplateid(), and then call gettemplatename(), the template name associated to the template id is returned. 2331apex reference guide singleemailmessage methods setbccaddresses(bccaddresses) optional. a list of blind carbon copy (bcc) addresses or object ids of the contacts, leads, and users you’re sending the email to. the maximum size for this field is 4,000 bytes. the maximum total of toaddresses, ccaddresses, and bccaddresses per email is 150. all recipients in these three fields count against the limit for email sent using apex or the api. signature public void setbccaddresses(string[] bccaddresses) parameters bccaddresses type: string[] return value type: void usage all emails must have a recipient value in at least one of the following fields: • toaddresses • ccaddresses • bccaddresses • targetobjectid if the bcc compliance option is set at the organization level, the user cannot add bcc addresses on standard messages. the following error code is returned: bcc_not_allowed_if_bcc_ compliance_enabled. contact your salesforce representative for information on bcc compliance. setccaddresses(ccaddresses) optional. a list of carbon copy (cc) addresses or object ids of the contacts, leads, and users you’re sending the email to. the maximum size for this field is 4,000 bytes. the maximum total of toaddresses, ccaddresses, and bccaddresses per email is 150. all recipients in these three fields count against the limit for email sent using apex or the api. signature public void setccaddresses(string[] ccaddresses) parameters ccaddresses type: string[] return value type: void 2332" "apex reference guide singleemailmessage methods usage all emails must have a recipient value in at least one of the following fields: • toaddresses • ccaddresses • bccaddresses • targetobjectid setcharset(characterset) optional. the character set for the email. if this value is null, the user's default value is used. signature public void setcharset(string characterset) parameters characterset type: string return value type: void setdocumentattachments(documentids) (deprecated. use setentityattachments() instead.) optional. a list containing the id of each document object you want to attach to the email. signature public void setdocumentattachments(id[] documentids) parameters documentids type: id[] return value type: void usage you can attach multiple documents as long as the total size of all attachments does not exceed 10 mb. setentityattachments(ids) optional. array of ids of document, contentversion, or attachment items to attach to the email. 2333apex reference guide singleemailmessage methods signature public void setentityattachments(list ids) parameters ids type: list return value type: void setfileattachments(filenames) optional. a list containing the file names of the binary and text files you want to attach to the email. signature public void setfileattachments(emailfileattachment[] filenames) parameters filenames type: messaging.emailfileattachment[] return value type: void usage you can attach multiple files as long as the total size of all attachments does not exceed 10 mb. sethtmlbody(htmlbody) optional. the html version of the email, specified by the sender. the value is encoded according to the specification associated with the organization. specify a value for settemplateid, sethtmlbody, or setplaintextbody. or, you can define both sethtmlbody and setplaintextbody. signature public void sethtmlbody(string htmlbody) parameters htmlbody type: string 2334apex reference guide singleemailmessage methods return value type: void setinreplyto(parentmessageids) sets the optional in-reply-to field of the outgoing email. this field identifies the email or emails to which this email is a reply (parent emails). signature public void setinreplyto(string parentmessageids) parameters parentmessageids type: string contains one or more parent email message ids. return value type: void setoptoutpolicy(emailoptoutpolicy) optional. if you added recipients by id instead of email address and the email opt out option is set, this method determines the behavior of the sendemail() call. if you add recipients by their email addresses, the opt-out settings for those recipients aren’t checked and those recipients always receive the email. signature public void setoptoutpolicy(string emailoptoutpolicy) parameters emailoptoutpolicy type: string possible values of the emailoptoutpolicy parameter are: • send (default)—the email is sent to all recipients. the recipients’ email opt out setting is ignored. the setting enforce email privacy settings is ignored. • filter—no email is sent to recipients that have the email opt out option set. emails are sent to the other recipients. the setting enforce email privacy settings is ignored. • reject—if any of the recipients have the email opt out option set, sendemail() throws an error and no email is sent. the setting enforce email privacy settings is respected, as are the selections in the data privacy record based on the individual object. if any of the recipients have don’t market, don’t process, or forget this individual selected, sendemail() throws an error and no email is sent. 2335apex reference guide singleemailmessage methods return value type: void example this example shows how to send an email with the opt-out setting enforced. recipients are specified by their ids. the filter option causes the email to be sent only to recipients that haven’t opted out from email. this example uses dot notation of the email properties, which is equivalent to using the set methods. messaging.singleemailmessage message = new messaging.singleemailmessage(); // set recipients to two contact ids. // replace ids with valid record ids in your org. message.toaddresses = new" "string[] { '003d000000qdexs', '003d000000qdfw5' }; message.optoutpolicy = 'filter'; message.subject = 'opt out test message'; message.plaintextbody = 'this is the message body.'; messaging.singleemailmessage[] messages = new list {message}; messaging.sendemailresult[] results = messaging.sendemail(messages); if (results[0].success) { system.debug('the email was sent successfully.'); } else { system.debug('the email failed to send: ' + results[0].errors[0].message); } setplaintextbody(plaintextbody) optional. the text version of the email, specified by the sender. specify a value for settemplateid, sethtmlbody, or setplaintextbody. or, you can define both sethtmlbody and setplaintextbody. signature public void setplaintextbody(string plaintextbody) parameters plaintextbody type: string return value type: void setorgwideemailaddressid(emailaddressid) optional. the id of the organization-wide email address associated with the outgoing email. if you’re using apex to send emails from the guest user, set the sender to the verified org-wide email address or the emails are blocked. the object's displayname field cannot be set if the setsenderdisplayname field is already set. 2336apex reference guide singleemailmessage methods signature public void setorgwideemailaddressid(id emailaddressid) parameters emailaddressid type: id usage after you create an org-wide email address, you’re sent a confirmation email to verify it. copy the id from the url and use the setorgwideemailaddressid(id) method on your instance of messaging.singleemailmessage. to avoid hard-coding an id, after creating your org-wide email address, you can query them. orgwideemailaddress[] owea = [select id from orgwideemailaddress where address = 'donotreply@.com']; messaging.singleemailmessage mail = new messaging.singleemailmessage(); if ( owea.size() > 0 ) { mail.setorgwideemailaddressid(owea.get(0).id); } return value type: void setreferences(references) optional. the references field of the outgoing email. identifies an email thread. contains the parent emails' references and message ids, and possibly the in-reply-to fields. signature public void setreferences(string references) parameters references type: string return value type: void setsubject(subject) optional. the email subject line. if you are using an email template, the subject line of the template overrides this value. signature public void setsubject(string subject) 2337apex reference guide singleemailmessage methods parameters subject type: string return value type: void settargetobjectid(targetobjectid) required if using a template, optional otherwise. the id of the contact, lead, or user to which the email will be sent. the id you specify sets the context and ensures that merge fields in the template contain the correct data. signature public void settargetobjectid(id targetobjectid) parameters targetobjectid type: id return value type: void usage do not specify the ids of records that have the email opt out option selected. all emails must have a recipient value in at least one of the following fields: • toaddresses • ccaddresses • bccaddresses • targetobjectid settemplateid(templateid) required if using a template, optional otherwise. the id of the template used to create the email. signature public void settemplateid(id templateid) parameters templateid type: id 2338apex reference guide singleemailmessage methods return value type: void settoaddresses(toaddresses) optional. a list of email addresses or object ids of the contacts, leads, and users you’re sending the email to. the maximum size for this field is 4,000 bytes. the maximum total of toaddresses, ccaddresses, and bccaddresses per email is 150. all recipients in these three fields count against the limit for email sent using apex or the api. signature public void settoaddresses(string[] toaddresses)" "parameters toaddresses type: string[] return value type: void usage all emails must have a recipient value in at least one of the following fields: • toaddresses • ccaddresses • bccaddresses • targetobjectid settreatbodiesastemplate(treatastemplate) optional. if set to true, the subject, plain text, and html text bodies of the email are treated as template data. the merge fields are resolved using the renderemailtemplate method. default is false. signature public void settreatbodiesastemplate(boolean treatastemplate) parameters treatastemplate type: boolean return value type: void 2339apex reference guide singleemailmessage methods settreattargetobjectasrecipient(treatasrecipient) optional. if set to true, the targetobjectid (a contact, lead, or user) is the recipient of the email. if set to false, the targetobjectid is supplied as the whoid field for template rendering but isn’t a recipient of the email. the default is true. signature public void settreattargetobjectasrecipient(boolean treatasrecipient) parameters treatasrecipient type: boolean return value type: void usage note: you can set to, cc, and bcc addresses using the email messaging methods regardless of whether a template is used for the email or the target object is a recipient. setwhatid(whatid) if you specify a contact for the targetobjectid field, you can specify an optional whatid as well. this helps to further ensure that merge fields in the template contain the correct data. signature public void setwhatid(id whatid) parameters whatid type: id return value type: void usage the value must be one of the following types: • account • asset • campaign • case • contract 2340apex reference guide metadata namespace • opportunity • order • product • solution • custom metadata namespace the metadata namespace provides classes and methods for working with custom metadata in salesforce salesforce uses metadata types and components to represent org configuration and customization. metadata is used for org settings that admins control or configuration information applied by installed apps and packages. use the classes in the metadata namespace to access metadata from within apex code. metadata access in apex is available for apex classes using api version 40.0 and later. for more information, see metadata. the following are the classes in the metadata namespace. in this section: analyticscloudcomponentlayoutitem class represents the settings for a wave analytics dashboard on a standard or custom page. consolecomponent class represents a custom console component on a section of a page layout. container class represents a location and style in which to display more than one custom console component in the sidebars of the console. customconsolecomponents class represents custom console components (visualforce pages, lookup fields, or related lists) on a page layout. custommetadata class represents records of custom metadata types. custommetadatavalue class represents custom metadata values for a custom metadata component. deploycallback interface an interface for metadata deployment callback classes. deploycallbackcontext class represents context information for a deployment job. deploycontainer class represents a container for custom metadata components to be deployed. deploydetails class contains detailed information on deployed components. deploymessage class represents result information for the deployment of a metadata component. 2341apex reference guide metadata namespace deployproblemtype enum describes the problem type for an unsuccessful component deploy. deployresult class represents the results of a metadata deployment. deploystatus enum the result status of a deployment. feeditemtypeenum enum the type of feed item in a feed-based page layout. feedlayout class represents the values that define the feed view of a feed-based page layout. feed-based layouts are available on account, case, contact, lead, opportunity, custom, and external objects. they include a feed view and a detail view. feedlayoutcomponent class represents a component in the feed view of a feed-based page layout. feedlayoutcomponenttype enum indicates the type of feed layout component. feedlayoutfilter class represents a feed filter option in the feed view of a feed-based page layout. a filter can have only standardfilter or feeditemtype set. feedlayoutfilterposition enum describes where the feed filters list is included in the layout. feedlayoutfiltertype" "enum the type of feed layout filter. layout class represents the metadata associated with a page layout. layoutcolumn class represents the items in a column within a layout section. layoutheader enum represents tagging types used for metadata.layout.headers layoutitem class represents the valid values that define a layout item. layoutsection class represents a section of a page layout, such as the custom links section. layoutsectionstyle enum describes the possible styles for a layout section. metadata class an abstract base class that represents a custom metadata component. metadatatype enum represents the custom metadata components available in apex. metadatavalue class an abstract base class that represents a custom metadata component field. 2342apex reference guide metadata namespace minilayout class represents a mini view of a record in the console tab, hover details, and event overlays. operations class represents a class to execute metadata operations, such as retrieving or deploying custom metadata. platformactionlist class represents the list of actions, and their order, that display in the salesforce mobile action bar for the layout. platformactionlistcontextenum enum describes the different contexts of action lists. platformactionlistitem class represents an action in the platform action list for a layout. platformactiontypeenum enum the type of action for a platformactionlistitem. primarytabcomponents class represents custom console components on primary tabs in the salesforce console. quickactionlist class represents the list of actions associated with the page layout. quickactionlistitem class represents an action in the quickactionlist. relatedcontent class represents the mobile cards section of the page layout. relatedcontentitem class represents an individual item in the relatedcontent list. relatedlist class represents related list custom components on the sidebars of the salesforce console. relatedlistitem class represents an item in the related list in a page layout. reportchartcomponentlayoutitem class represents the settings for a report chart on a standard or custom page. reportchartcomponentsize enum describes the size of the displayed report chart component. sidebarcomponent class represents a specific custom console component to display in a container that hosts multiple components in one of the sidebars of the salesforce console. sortorder enum describes the sort order of a related list. statuscode enum describes the status code for an unsuccessful component deploy. subtabcomponents class represents custom console components on subtabs in the salesforce console. summarylayoutstyleenum enum describes the highlights panel style for a summarylayout. 2343apex reference guide analyticscloudcomponentlayoutitem class summarylayout class controls the appearance of the highlights panel, which summarizes key fields in a grid at the top of a page layout, when case feed is enabled. summarylayoutitem class controls the appearance of an individual field and its column and row position within the highlights panel grid, when case feed is enabled. you can have two fields per each grid in a highlights panel. uibehavior enum describes the behavior for a layout item on a layout page. analyticscloudcomponentlayoutitem class represents the settings for a wave analytics dashboard on a standard or custom page. namespace metadata usage use this class when accessing metadata.layout metadata components. for more information, see “analyticscloudcomponentlayoutitem” in the metadata api developer guide. in this section: analyticscloudcomponentlayoutitem properties analyticscloudcomponentlayoutitem methods analyticscloudcomponentlayoutitem properties the following are properties for analyticscloudcomponentlayoutitem. in this section: assettype specifies the type of wave analytics asset. devname unique development name of the dashboard to add. error an error string that is populated only when an error occurred in the underlying dashboard. filter dashboard filters for mapping data fields in the dashboard to the object’s fields. height specifies the height of the dashboard, in pixels. hideonerror controls whether users see a dashboard that has an error. 2344apex reference guide analyticscloudcomponentlayoutitem class showheader if true, includes the dashboard’s header bar. if false, the dashboard appears without a header bar. showsharing if set to true, and the dashboard is shareable the dashboard shows the share icon. if set to false, the dashboard doesn’t show the share icon. showtitle if true, includes the dashboard’s title above the dashboard. if false," "the dashboard appears without a title. width specifies the width of the dashboard, in pixels or percentage. assettype specifies the type of wave analytics asset. signature public string assettype {get; set;} property value type: string devname unique development name of the dashboard to add. signature public string devname {get; set;} property value type: string error an error string that is populated only when an error occurred in the underlying dashboard. signature public string error {get; set;} property value type: string filter dashboard filters for mapping data fields in the dashboard to the object’s fields. 2345apex reference guide analyticscloudcomponentlayoutitem class signature public string filter {get; set;} property value type: string height specifies the height of the dashboard, in pixels. signature public integer height {get; set;} property value type: integer hideonerror controls whether users see a dashboard that has an error. signature public boolean hideonerror {get; set;} property value type: boolean showheader if true, includes the dashboard’s header bar. if false, the dashboard appears without a header bar. signature public boolean showheader {get; set;} property value type: boolean showsharing if set to true, and the dashboard is shareable the dashboard shows the share icon. if set to false, the dashboard doesn’t show the share icon. 2346apex reference guide analyticscloudcomponentlayoutitem class signature public boolean showsharing {get; set;} property value type: boolean showtitle if true, includes the dashboard’s title above the dashboard. if false, the dashboard appears without a title. signature public boolean showtitle {get; set;} property value type: boolean width specifies the width of the dashboard, in pixels or percentage. signature public string width {get; set;} property value type: string analyticscloudcomponentlayoutitem methods the following are methods for analyticscloudcomponentlayoutitem. in this section: clone() makes a duplicate copy of the metadata.analyticscloudcomponentlayoutitem. clone() makes a duplicate copy of the metadata.analyticscloudcomponentlayoutitem. signature public object clone() 2347apex reference guide consolecomponent class return value type: object consolecomponent class represents a custom console component on a section of a page layout. namespace metadata usage use this class when accessing metadata.layout metadata components. for more information, see “consolecomponent” in the metadata api developer guide. in this section: consolecomponent properties consolecomponent methods consolecomponent properties the following are properties for consolecomponent. in this section: height the height of the custom console component in pixels. location the location of the custom console component on the page layout. valid values are right, left, top, and bottom. visualforcepage the unique name of the custom console component. width the width of the custom console component in pixels. height the height of the custom console component in pixels. signature public integer height {get; set;} property value type: integer 2348apex reference guide consolecomponent class location the location of the custom console component on the page layout. valid values are right, left, top, and bottom. signature public string location {get; set;} property value type: string visualforcepage the unique name of the custom console component. signature public string visualforcepage {get; set;} property value type: string width the width of the custom console component in pixels. signature public integer width {get; set;} property value type: integer consolecomponent methods the following are methods for consolecomponent. in this section: clone() makes a duplicate copy of the metadata.consolecomponent. clone() makes a duplicate copy of the metadata.consolecomponent. 2349apex reference guide container class signature public object clone() return value type: object container class represents a location and style in which to display more than one custom console component in the sidebars of the console. namespace metadata usage use this class when accessing metadata.layout metadata components. for more information, see “container” in the metadata api developer guide. in this section: container properties container methods container properties the following are properties" "for container. in this section: height the height of the component’s container. the unit property determines the unit of measurement, in pixels or percent. iscontainerautosizeenabled if set to true, stacked console components in the sidebars autosize vertically. region the location of the component’s container (right, left, bottom, top). sidebarcomponents represents a specific custom console component to display in the components’ container. style the style of the container in which to display multiple components (stack, tab, accordion). unit the unit of measurement, in pixels or percent, for the height or width of the components’ container. width the width of the component’s container. the unit property determines the unit of measurement, in pixels or percent. 2350apex reference guide container class height the height of the component’s container. the unit property determines the unit of measurement, in pixels or percent. signature public integer height {get; set;} property value type: integer iscontainerautosizeenabled if set to true, stacked console components in the sidebars autosize vertically. signature public boolean iscontainerautosizeenabled {get; set;} property value type: boolean region the location of the component’s container (right, left, bottom, top). signature public string region {get; set;} property value type: string sidebarcomponents represents a specific custom console component to display in the components’ container. signature public list sidebarcomponents {get; set;} property value type: list style the style of the container in which to display multiple components (stack, tab, accordion). 2351apex reference guide container class signature public string style {get; set;} property value type: string unit the unit of measurement, in pixels or percent, for the height or width of the components’ container. signature public string unit {get; set;} property value type: string width the width of the component’s container. the unit property determines the unit of measurement, in pixels or percent. signature public integer width {get; set;} property value type: integer container methods the following are methods for container. in this section: clone() makes a duplicate copy of the metadata.container. clone() makes a duplicate copy of the metadata.container. signature public object clone() 2352apex reference guide customconsolecomponents class return value type: object customconsolecomponents class represents custom console components (visualforce pages, lookup fields, or related lists) on a page layout. namespace metadata usage use this class when accessing metadata.layout metadata components. for more information, see “customconsolecomponents” in the metadata api developer guide. in this section: customconsolecomponents properties customconsolecomponents methods customconsolecomponents properties the following are properties for customconsolecomponents. in this section: primarytabcomponents represents custom console components on primary tabs in the salesforce console. subtabcomponents represents custom console components on subtabs in the salesforce console. primarytabcomponents represents custom console components on primary tabs in the salesforce console. signature public metadata.primarytabcomponents primarytabcomponents {get; set;} property value type: metadata.primarytabcomponents subtabcomponents represents custom console components on subtabs in the salesforce console. 2353apex reference guide custommetadata class signature public metadata.subtabcomponents subtabcomponents {get; set;} property value type: metadata.subtabcomponents customconsolecomponents methods the following are methods for customconsolecomponents. in this section: clone() makes a duplicate copy of the metadata.customconsolecomponents. clone() makes a duplicate copy of the metadata.customconsolecomponents. signature public object clone() return value type: object custommetadata class represents records of custom metadata types. warning: protected custom metadata types behave like public custom metadata types when they are outside of a managed package. public custom metadata types are readable for all profiles, including the guest user. do not store secrets, personally identifying information, or any private data in these records. use protected custom metadata types only in managed packages. outside of a" "managed package, use named credentials or encrypted custom fields to store secrets like oauth tokens, passwords, and other confidential material. namespace metadata usage use metadata.custommetadata to represent records of custom metadata types in apex. for more information, see custom metadata types in the metadata api developer guide. 2354apex reference guide custommetadata class example // set up custom metadata to be created in the subscriber org. metadata.custommetadata custommetadata = new metadata.custommetadata(); custommetadata.fullname = 'isvnamespace__metadatatypename.metadatarecordname'; metadata.custommetadatavalue customfield = new metadata.custommetadatavalue(); customfield.field = 'customfield__c'; customfield.value = 'new value'; custommetadata.values.add(customfield); note: when you assign namespaces to records, provide full, qualified record names to the app. if both the type and the record are in namespace, use something like: custommetadata.fullname = 'namespace__metadatatypename.namespace__metadatarecordname' in this section: custommetadata properties custommetadata methods custommetadata properties the following are properties for custommetadata. in this section: description the description of the custom metadata. label the label of the custom metadata record. protected_x property that describes whether the custom metadata record is a protected component. values a list of custom metadata values, such as custom fields, for the custom metadata record. description the description of the custom metadata. signature public string description {get; set;} property value type: string 2355apex reference guide custommetadata class label the label of the custom metadata record. signature public string label {get; set;} property value type: string protected_x property that describes whether the custom metadata record is a protected component. signature public boolean protected_x {get; set;} property value type: boolean values a list of custom metadata values, such as custom fields, for the custom metadata record. signature public list values {get; set;} property value type: list custommetadata methods the following are methods for custommetadata. in this section: clone() makes a duplicate copy of the metadata.custommetadata. clone() makes a duplicate copy of the metadata.custommetadata. 2356apex reference guide custommetadatavalue class signature public object clone() return value type: object custommetadatavalue class represents custom metadata values for a custom metadata component. namespace metadata usage use metadata.custommetadatavalue to access values for custom fields of custom metadata records. supported apex primitive types are: • boolean • date • datetime • decimal • double • integer • long • string example // set a custom field value for a custom metadata record metadata.custommetadatavalue customfield = new metadata.custommetadatavalue(); customfield.field = 'customfield1__c'; customfield.value = 'new value'; custommetadata.values.add(customfield); in this section: custommetadatavalue properties custommetadatavalue methods custommetadatavalue properties the following are properties for custommetadatavalue. 2357apex reference guide custommetadatavalue class in this section: field the field name for the custom metadata value. value the field value for the custom metadata value. field the field name for the custom metadata value. signature public string field {get; set;} property value type: string value the field value for the custom metadata value. signature public object value {get; set;} property value type: object supported apex primitive types are: • boolean • date • datetime • decimal • double • integer • long • string when setting the value for relationship fields, use the qualified api name of the related metadata, not the id. for more information, see primitive data types. custommetadatavalue methods the following are methods for custommetadatavalue. 2358apex reference guide deploycallback interface in this section: clone() makes a duplicate copy of the metadata.custommetadatavalue. clone() makes a duplicate copy of the metadata.custommetadatavalue" ". signature public object clone() return value type: object deploycallback interface an interface for metadata deployment callback classes. namespace metadata usage you must provide a callback class for the asynchronous deployment of custom metadata through apex. this class must implement the metadata.deploycallback interface. salesforce calls your deploycallback.handleresult() method asynchronously once the queued deployment completes. because the callback is called as asynchronous apex after deployment, there may be a brief period where the deploy has completed, but your callback has not been called yet. in this section: deploycallback methods deploycallback example implementation deploycallback methods the following are methods for deploycallback. in this section: handleresult(var1, var2) method that is called when the asynchronous deployment of custom metadata completes. 2359apex reference guide deploycallbackcontext class handleresult(var1, var2) method that is called when the asynchronous deployment of custom metadata completes. signature public void handleresult(metadata.deployresult var1, metadata.deploycallbackcontext var2) parameters var1 type: metadata.deployresult the results of the asynchronous deployment. var2 type: metadata.deploycallbackcontext the context for the queued asynchronous deployment job. return value type: void deploycallback example implementation this is an example implementation of the metadata.deploycallback interface. public class mycallback implements metadata.deploycallback { public void handleresult(metadata.deployresult result, metadata.deploycallbackcontext context) { if (result.status == metadata.deploystatus.succeeded) { // deployment was successful } else { // deployment was not successful } } } the following example uses this implementation for a deployment. // setup callback and deploy mycallback callback = new mycallback(); metadata.operations.enqueuedeployment(mdcontainer, callback); deploycallbackcontext class represents context information for a deployment job. namespace metadata 2360apex reference guide deploycallbackcontext class usage after an asynchronous metadata deployment finishes, salesforce provides an instance ofmetadata.deploycallbackcontext in an asynchronous call to your implementation of handleresult() in your metadata.deploycallback class. example public void handleresult(metadata.deployresult result, metadata.deploycallbackcontext context) { // check the callback job id for the deployment id jobid = context.getcallbackjobid(); // ...process the results... } in this section: deploycallbackcontext methods deploycallbackcontext methods the following are methods for deploycallbackcontext. in this section: clone() makes a duplicate copy of the metadata.deploycallbackcontext. getcallbackjobid() gets the asynchronous apex job id for the callback job. clone() makes a duplicate copy of the metadata.deploycallbackcontext. signature public object clone() return value type: object getcallbackjobid() gets the asynchronous apex job id for the callback job. signature public id getcallbackjobid() 2361apex reference guide deploycontainer class return value type: id deploycontainer class represents a container for custom metadata components to be deployed. namespace metadata usage use metadata.deploycontainer to manage custom metadata components for deployment. a container must have one or more components before being deployed. example // use deploycontainer for deployment metadata.deploycontainer mdcontainer = new metadata.deploycontainer(); mdcontainer.addmetadata(custommetadata); ... // enqueue deploy metadata.operations.enqueuedeployment(mdcontainer, callback); in this section: deploycontainer methods deploycontainer methods the following are methods for deploycontainer. in this section: addmetadata(md) add a custom metadata component to the container. clone() makes a duplicate copy of the metadata.deploycontainer. getmetadata() retrieves a list of custom metadata components from the container. removemetadata(md) removes a metadata component from the container. removemetadatabyfullname(fullname) removes a metadata component from the container using the component’s full name. 2362apex reference guide deploycontainer class addmetadata(md) add a custom metadata component to the container. signature public void addmetadata(metadata.metadata md) parameters md type: metadata.metadata a custom metadata component class that derives from metadata.metadata. avoid adding components" "to a metadata.deploycontainerthat have the same metadata.metadata.fullname because it causes deployment errors. return value type: void clone() makes a duplicate copy of the metadata.deploycontainer. signature public object clone() return value type: object getmetadata() retrieves a list of custom metadata components from the container. signature public list getmetadata() return value type: list removemetadata(md) removes a metadata component from the container. signature public boolean removemetadata(metadata.metadata md) 2363apex reference guide deploydetails class parameters md type: metadata.metadata metadata component to remove. return value type: boolean returns true if the container changed as a result of the call. removemetadatabyfullname(fullname) removes a metadata component from the container using the component’s full name. signature public boolean removemetadatabyfullname(string fullname) parameters fullname type: string full name of the component to remove. return value type: boolean returns true if the container changed as a result of the call. deploydetails class contains detailed information on deployed components. namespace metadata usage use this class to obtain a list of the successfully and unsuccessfully deployed components after a completed deployment by salesforce in your metadata.deploycallback results. in this section: deploydetails properties deploydetails methods 2364apex reference guide deploydetails class deploydetails properties the following are properties for deploydetails. in this section: componentfailures contains a list of information about components that failed to deploy. componentsuccesses contains a list of information about components that deployed successfully. componentfailures contains a list of information about components that failed to deploy. signature public list componentfailures {get; set;} property value type: list componentsuccesses contains a list of information about components that deployed successfully. signature public list componentsuccesses {get; set;} property value type: list deploydetails methods the following are methods for deploydetails. in this section: clone() makes a duplicate copy of the metadata.deploydetails. clone() makes a duplicate copy of the metadata.deploydetails. 2365apex reference guide deploymessage class signature public object clone() return value type: object deploymessage class represents result information for the deployment of a metadata component. namespace metadata usage use deploymessage to access detailed information about component deployments. salesforce provides a list of deploymessages for a completed deployment via the deploydetails and deployresults instances sent in the deploycallback.handleresult() callback. in this section: deploymessage properties deploymessage methods deploymessage properties the following are properties for deploymessage. in this section: changed determines whether the component was changed after deployment. if true, the component was changed as a result of the deployment. if false, the deployed component was the same as the corresponding component already in the org. columnnumber each component is represented by a text file. if an error occurs during deployment, this property represents the column of the text file where the error occurred. componenttype the metadata type of the component in the deployment. created if true, the component was created as a result of the deployment. if false, the component was modified as a result of the deployment. createddate the date and time when the component was created as a result of the deployment. 2366apex reference guide deploymessage class deleted if true, the component was deleted as a result of the deployment. if false, the component was either new or modified as result of the deployment. filename the name of the file in the metadata archive used to deploy the component. fullname full name for the custom metadata component. id id of the component that was deployed. linenumber each component is represented by a text file. if an error occurs during deployment, this field represents the line number of the text file where the error occurred. problem if an error or warning occurred, this field contains a description of the problem that caused the deployment to fail. problemtype indicates the problem type, for example, an error or warning. success indicates whether the component was successfully deployed (" "true) or not (false). changed determines whether the component was changed after deployment. if true, the component was changed as a result of the deployment. if false, the deployed component was the same as the corresponding component already in the org. signature public boolean changed {get; set;} property value type: boolean columnnumber each component is represented by a text file. if an error occurs during deployment, this property represents the column of the text file where the error occurred. signature public integer columnnumber {get; set;} property value type: integer 2367apex reference guide deploymessage class componenttype the metadata type of the component in the deployment. signature public string componenttype {get; set;} property value type: string created if true, the component was created as a result of the deployment. if false, the component was modified as a result of the deployment. signature public boolean created {get; set;} property value type: boolean createddate the date and time when the component was created as a result of the deployment. signature public datetime createddate {get; set;} property value type: datetime deleted if true, the component was deleted as a result of the deployment. if false, the component was either new or modified as result of the deployment. signature public boolean deleted {get; set;} property value type: boolean 2368apex reference guide deploymessage class filename the name of the file in the metadata archive used to deploy the component. signature public string filename {get; set;} property value type: string fullname full name for the custom metadata component. signature public string fullname {get; set;} property value type: string id id of the component that was deployed. signature public id id {get; set;} property value type: id linenumber each component is represented by a text file. if an error occurs during deployment, this field represents the line number of the text file where the error occurred. signature public integer linenumber {get; set;} property value type: integer 2369apex reference guide deploymessage class problem if an error or warning occurred, this field contains a description of the problem that caused the deployment to fail. signature public string problem {get; set;} property value type: string problemtype indicates the problem type, for example, an error or warning. signature public metadata.deployproblemtype problemtype {get; set;} property value type: metadata.deployproblemtype success indicates whether the component was successfully deployed (true) or not (false). signature public boolean success {get; set;} property value type: boolean deploymessage methods the following are methods for deploymessage. in this section: clone() makes a duplicate copy of the metadata.deploymessage. clone() makes a duplicate copy of the metadata.deploymessage. 2370apex reference guide deployproblemtype enum signature public object clone() return value type: object deployproblemtype enum describes the problem type for an unsuccessful component deploy. enum values the following are the values of the metadata.deployproblemtype enum. value description error the deploy problem is an error. info the deploy problem is of type “info”. warning the deploy problem is a warning. see also: statuscode enum deployresult class represents the results of a metadata deployment. namespace metadata usage after an asynchronous metadata deployment finishes, salesforce provides an instance of metadata.deployresult in a call to your implementation of handleresult() in your metadata.deploycallback class. example public void handleresult(metadata.deployresult result, metadata.deploycallbackcontext context) { if (result.status == metadata.deploystatus.succeeded) { // deployment was successful } else { // deployment was not successful 2371apex reference guide deployresult class } } in this section: deployresult properties deployresult methods deployresult properties the following are properties for deployresult. in this section: canceledby id of the user who canceled the queued deployment. canceledbyname full name of the user who canceled the queued deployment. checkonly indicates whether the deployment checked only the validity of the deployed files without making changes in the org. a check-only deployment does" "not deploy components or change the org in any way. completeddate date and time for when the deployment process ended. createdby id of the user who created the deployment job. createdbyname full name of the user who created the deployment job. createddate date and time the deployment job was first queued. details provides the details for components in a completed deployment. done indicates whether salesforce finished processing the deployment. errormessage message corresponding to the values in the errorstatuscode property, if any. errorstatuscode if an error occurs during deployment, a status code is returned. the message corresponding to the status code is returned in the errormessagefield property. id id of the deployment job. ignorewarnings specifies whether a deployment continues, even if the deployment generates warnings. 2372apex reference guide deployresult class lastmodifieddate date and time of the last update for the deployment process. messages a list of all the detail messages for a deployment. numbercomponenterrors the number of components that generated errors during the deployment. numbercomponentsdeployed the number of components deployed in the deployment process. use this value with the numbercomponentstotal property to get an estimate of the deployment’s progress. numbercomponentstotal the total number of components in the deployment. use this value with the numbercomponentsdeployed property to get an estimate of the deployment’s progress. rollbackonerror indicates whether any failure causes a complete rollback (true) or not (false) of the deployment. startdate date and time the deployment process began. statedetail indicates which component is being deployed. status indicates the current state of the deployment. success indicates whether the deployment was successful (true) or not (false). canceledby id of the user who canceled the queued deployment. signature public string canceledby {get; set;} property value type: string canceledbyname full name of the user who canceled the queued deployment. signature public string canceledbyname {get; set;} property value type: string 2373apex reference guide deployresult class checkonly indicates whether the deployment checked only the validity of the deployed files without making changes in the org. a check-only deployment does not deploy components or change the org in any way. signature public boolean checkonly {get; set;} property value type: boolean completeddate date and time for when the deployment process ended. signature public datetime completeddate {get; set;} property value type: datetime createdby id of the user who created the deployment job. signature public string createdby {get; set;} property value type: string createdbyname full name of the user who created the deployment job. signature public string createdbyname {get; set;} property value type: string 2374apex reference guide deployresult class createddate date and time the deployment job was first queued. signature public datetime createddate {get; set;} property value type: datetime details provides the details for components in a completed deployment. signature public metadata.deploydetails details {get; set;} property value type: metadata.deploydetails done indicates whether salesforce finished processing the deployment. signature public boolean done {get; set;} property value type: boolean errormessage message corresponding to the values in the errorstatuscode property, if any. signature public string errormessage {get; set;} property value type: string 2375apex reference guide deployresult class errorstatuscode if an error occurs during deployment, a status code is returned. the message corresponding to the status code is returned in the errormessagefield property. signature public string errorstatuscode {get; set;} property value type: string for a description of each status code value, see core data types used in api calls in the soap api developer guide. id id of the deployment job. signature public id id {get; set;} property value type: id ignorewarnings specifies whether a deployment continues, even if the deployment generates warnings. signature public boolean ignorewarnings {get; set;} property value type: boolean lastmodifieddate date and time of the last update for the deployment process. signature public datetime lastmodifieddate {get; set;} property value type: dat" "etime 2376apex reference guide deployresult class messages a list of all the detail messages for a deployment. signature public list messages {get; set;} property value type: list numbercomponenterrors the number of components that generated errors during the deployment. signature public integer numbercomponenterrors {get; set;} property value type: integer numbercomponentsdeployed the number of components deployed in the deployment process. use this value with the numbercomponentstotal property to get an estimate of the deployment’s progress. signature public integer numbercomponentsdeployed {get; set;} property value type: integer numbercomponentstotal the total number of components in the deployment. use this value with the numbercomponentsdeployed property to get an estimate of the deployment’s progress. signature public integer numbercomponentstotal {get; set;} property value type: integer 2377apex reference guide deployresult class rollbackonerror indicates whether any failure causes a complete rollback (true) or not (false) of the deployment. signature public boolean rollbackonerror {get; set;} property value type: boolean startdate date and time the deployment process began. signature public datetime startdate {get; set;} property value type: datetime statedetail indicates which component is being deployed. signature public string statedetail {get; set;} property value type: string status indicates the current state of the deployment. signature public metadata.deploystatus status {get; set;} property value type: metadata.deploystatus success indicates whether the deployment was successful (true) or not (false). 2378apex reference guide deploystatus enum signature public boolean success {get; set;} property value type: boolean deployresult methods the following are methods for deployresult. in this section: clone() makes a duplicate copy of the metadata.deployresult. clone() makes a duplicate copy of the metadata.deployresult. signature public object clone() return value type: object deploystatus enum the result status of a deployment. usage metadata.deployresult.status uses this enum to describe the results of the deployment. enum values the following are the values of the metadata.deploystatus enum. value description canceled the queued deployment was canceled. canceling the queued deployment is being canceled. failed the deployment failed. inprogress the deployment has been started and is in progress. pending the deployment has been queued but not started. 2379apex reference guide feeditemtypeenum enum value description succeeded the deployment succeeded. succeededpartial the deployment succeeded, but some components might not have been successfully deployed. check metadata.deployresult for more details. feeditemtypeenum enum the type of feed item in a feed-based page layout. enum values the following are the values of the metadata.feeditemtypeenum enum. value description activityevent activity on tasks and events associated with a case. available only on case layouts. advancedtextpost group announcements posted on a feed. announcementpost not used. approvalpost approvals submitted on a feed. attacharticleevent activity related to attaching articles to cases. basictemplatefeeditem activity from the log a call action. available only on layouts for objects that support activities (tasks and events). calllogpost activity from the log a call action. available only on layouts for objects that support activities (tasks and events). canvaspost posts a canvas app makes on a feed. casecommentpost activity from the case note action. available only on case layouts. changestatuspost activity from the change status action. available only on case layouts. chattranscriptpost activity related to attaching chat transcripts to cases. available only on case layouts. collaborationgroupcreated creating a public group. collaborationgroupunarchived not used. contentpost attaching a file to a post. createrecordevent creating a record from the publisher. dashboardcomponentalert not used. dashboardcomponentsnapshot posting a dashboard snapshot on a feed. emailmessageevent activity from the email action. available only on case layouts. facebookpost not used. 2380apex reference guide feedlayout class value description linkpost attaching a url to a post" ". milestoneevent changing the milestone status on a case. available only on case layouts. pollpost posting a poll on a feed. profileskillpost adding skills to a user’s chatter profile. questionpost posting a question on a feed. replypost activity from the portal action. available only on case layouts. rypplepost creating a thanks badge in wdc. socialpost activity on twitter from the social post action. testitem creating a text post from the publisher. textpost making a change or group of changes to a tracked field. trackedchange not used. undefined undefined feed item. userstatus not used. feedlayout class represents the values that define the feed view of a feed-based page layout. feed-based layouts are available on account, case, contact, lead, opportunity, custom, and external objects. they include a feed view and a detail view. namespace metadata usage use this class when accessing metadata.layout metadata components. for more information, see “feedlayout” in the metadata api developer guide. in this section: feedlayout properties feedlayout methods feedlayout properties the following are properties for feedlayout. 2381apex reference guide feedlayout class in this section: autocollapsepublisher specifies whether the publisher is collapsed when the page loads (true) or not (false). compactfeed specifies whether the feed-based page layout uses a compact feed (true) or not (false). if set to true, feed items on the page are collapsed by default, and the feed view has an updated design. feedfilterposition indicates where the feed filters list is included in the layout. feedfilters the individual filters displayed in the feed filters list. fullwidthfeed specifies whether the feed expands horizontally to take up all available space on the page (true) or not (false). hidesidebar specifies whether the sidebar is hidden (true) or not (false). highlightexternalfeeditems controls whether to highlight external feed items (true) or not (false). leftcomponents the individual components displayed in the left column of the feed view. rightcomponents lists the individual components displayed in the right column of the feed view. useinlinefiltersinconsole indicates whether to use inline filters in the salesforce console. autocollapsepublisher specifies whether the publisher is collapsed when the page loads (true) or not (false). signature public boolean autocollapsepublisher {get; set;} property value type: boolean compactfeed specifies whether the feed-based page layout uses a compact feed (true) or not (false). if set to true, feed items on the page are collapsed by default, and the feed view has an updated design. signature public boolean compactfeed {get; set;} 2382" "apex reference guide feedlayout class property value type: boolean feedfilterposition indicates where the feed filters list is included in the layout. signature public metadata.feedlayoutfilterposition feedfilterposition {get; set;} property value type: feedlayoutfilterposition enum feedfilters the individual filters displayed in the feed filters list. signature public list feedfilters {get; set;} property value type: list. fullwidthfeed specifies whether the feed expands horizontally to take up all available space on the page (true) or not (false). signature public boolean fullwidthfeed {get; set;} property value type: boolean hidesidebar specifies whether the sidebar is hidden (true) or not (false). signature public boolean hidesidebar {get; set;} property value type: boolean 2383apex reference guide feedlayout class highlightexternalfeeditems controls whether to highlight external feed items (true) or not (false). signature public boolean highlightexternalfeeditems {get; set;} property value type: boolean leftcomponents the individual components displayed in the left column of the feed view. signature public list leftcomponents {get; set;} property value type: list rightcomponents lists the individual components displayed in the right column of the feed view. signature public list rightcomponents {get; set;} property value type: list useinlinefiltersinconsole indicates whether to use inline filters in the salesforce console. signature public boolean useinlinefiltersinconsole {get; set;} property value type: boolean feedlayout methods the following are methods for feedlayout. 2384apex reference guide feedlayoutcomponent class in this section: clone() makes a duplicate copy of the metadata.feedlayout. clone() makes a duplicate copy of the metadata.feedlayout. signature public object clone() return value type: object feedlayoutcomponent class represents a component in the feed view of a feed-based page layout. namespace metadata usage use this class when accessing metadata.layout metadata components. for more information, see “feedlayoutcomponent” in the metadata api developer guide. in this section: feedlayoutcomponent properties feedlayoutcomponent methods feedlayoutcomponent properties the following are properties for feedlayoutcomponent. see feedlayoutcomponent in the metadata api developer guide in this section: componenttype represents a component in the feed view of a feed-based page layout. the type of component is required. height the height, in pixels, of the component. doesn’t apply to standardcomponents page_x the name of the visualforce page used as a custom component. 2385apex reference guide feedlayoutcomponent class componenttype represents a component in the feed view of a feed-based page layout. the type of component is required. signature public metadata.feedlayoutcomponenttype componenttype {get; set;} property value type: metadata.feedlayoutcomponenttype on page 2387 height the height, in pixels, of the component. doesn’t apply to standardcomponents signature public integer height {get; set;} property value type: integer page_x the name of the visualforce page used as a custom component. signature public string page_x {get; set;} property value type: string feedlayoutcomponent methods the following are methods for feedlayoutcomponent. in this section: clone() makes a duplicate copy of the metadata.feedlayoutcomponent. clone() makes a duplicate copy of the metadata.feedlayoutcomponent. 2386apex reference guide feedlayoutcomponenttype enum signature public object clone() return value type: object feedlayoutcomponenttype enum indicates the type of feed layout component. enum values the following are the values of the metadata.feedlayoutcomponenttype enum. value description caseexperts list of case experts. caseunifiedfiles list of all files attached to the case. custombuttons custom button. customlinks custom link. followers list of followers. following icon that toggles between a follow button (if the user viewing a record doesn’t already follow it) and a following indicator (" "if the user viewing a record does follow it). helpandtoollinks icons that link to the help topic for the page, the page layout, and, the printable view of the page. available only on case layouts. milestones milestone tracker, which lets users see the status of a milestone on a case. available only on case layouts. similarcases list of similar cases. topics list of topics related to the record. visualforce custom visualforce component. feedlayoutfilter class represents a feed filter option in the feed view of a feed-based page layout. a filter can have only standardfilter or feeditemtype set. namespace metadata 2387apex reference guide feedlayoutfilter class usage use this class when accessing metadata.layout metadata components. for more information, see “feedlayoutfilter” in the metadata api developer guide. in this section: feedlayoutfilter properties feedlayoutfilter methods feedlayoutfilter properties the following are properties for feedlayoutfilter. in this section: feedfiltername the name of a customfeedfilter component. names are prefixed with the name of the parent object. for example, case.mycustomfeedfilter. feedfiltertype the type of filter. feeditemtype the type of feed item to display. feedfiltername the name of a customfeedfilter component. names are prefixed with the name of the parent object. for example, case.mycustomfeedfilter. signature public string feedfiltername {get; set;} property value type: string feedfiltertype the type of filter. signature public metadata.feedlayoutfiltertype feedfiltertype {get; set;} property value type: feedlayoutfiltertype enum 2388apex reference guide feedlayoutfilterposition enum feeditemtype the type of feed item to display. signature public metadata.feeditemtypeenum feeditemtype {get; set;} property value type: feeditemtypeenum enum feedlayoutfilter methods the following are methods for feedlayoutfilter. in this section: clone() makes a duplicate copy of the metadata.feedlayoutfilter. clone() makes a duplicate copy of the metadata.feedlayoutfilter. signature public object clone() return value type: object feedlayoutfilterposition enum describes where the feed filters list is included in the layout. enum values the following are the values of the metadata.feedlayoutfilterposition enum. value description centerdropdown as a drop-down list in the center column. leftfixed as a fixed list in the left column. leftfloat as a floating list in the left column. 2389apex reference guide feedlayoutfiltertype enum feedlayoutfiltertype enum the type of feed layout filter. enum values the following are the values of the metadata.feedlayoutfiltertype enum. value description allupdates shows all feed items on a record. custom shows custom feed items. feeditemtype shows feed items only for a particular type of activity on the record. layout class represents the metadata associated with a page layout. namespace metadata usage use this class to access layout metadata components. for more information, see layout in the metadata api developer guide. in this section: layout properties layout methods layout properties the following are properties for layout. in this section: custombuttons the custom buttons for this layout. customconsolecomponents represents custom console components (visualforce pages, lookup fields, or related lists) on a page layout. emaildefault default value for the email checkbox. only relevant if the showemailcheckbox property is set. excludebuttons list of standard buttons to exclude from this layout. 2390apex reference guide layout class feedlayout represents the values that define the feed view of a feed-based page layout. headers represents the layout headers used for tagging. layoutsections the main sections of the layout containing fields, s-controls, and custom links. the order here determines the layout order. minilayout represents a minilayout, which is used in the mini view of a record in the console tab, hover details, and event overlays. multilinelayoutfields fields for special multiline layout fields which appear in opportunityproduct layouts. platformactionlist the list of actions, and their order, that display in the salesforce mobile action bar for the layout. quickactionlist the list of quick actions that display in the full salesforce site" "for the page layout. relatedcontent the related content section of the page layout. relatedlists the related lists for the layout, listed in the order they appear in the user interface. relatedobjects the list of related objects that appears in the mini view of the console. runassignmentrulesdefault default value for the “run assignment rules” checkbox. only relevant if the showrunassignmentrulescheckbox property is set. showemailcheckbox controls whether to show the email checkbox. only allowed on case, caseclose, and task layouts. the default state of checkbox is controlled by the emaildefault property. showhighlightspanel if set, the highlights panel displays on pages in the salesforce console. showinteractionlogpanel if set, the interaction log displays on pages in the salesforce console. showknowledgecomponent only allowed on case layouts. if set, the knowledge sidebar displays on cases in the salesforce console. showrunassignmentrulescheckbox controls whether to show the run assignment rules checkbox. only allowed on lead and case layouts. the default state of checkbox is controlled by the runassignmentrulesdefault property. showsolutionsection only allowed on caseclose layout. if set, the built-in solution information section shows up on the page. showsubmitandattachbutton for cast layouts only. if set, the submit & add attachment button displays on case edit pages to portal users in the customer portal. summarylayout the summary layout for this layout. 2391apex reference guide layout class custombuttons the custom buttons for this layout. signature public list custombuttons {get; set;} property value type: list customconsolecomponents represents custom console components (visualforce pages, lookup fields, or related lists) on a page layout. signature public metadata.customconsolecomponents customconsolecomponents {get; set;} property value type: customconsolecomponents class emaildefault default value for the email checkbox. only relevant if the showemailcheckbox property is set. signature public boolean emaildefault {get; set;} property value type: boolean excludebuttons list of standard buttons to exclude from this layout. signature public list excludebuttons {get; set;} property value type: list feedlayout represents the values that define the feed view of a feed-based page layout. 2392apex reference guide layout class signature public metadata.feedlayout feedlayout {get; set;} property value type: metadata.feedlayout headers represents the layout headers used for tagging. signature public list headers {get; set;} property value type: list layoutsections the main sections of the layout containing fields, s-controls, and custom links. the order here determines the layout order. signature public list layoutsections {get; set;} property value type: list minilayout represents a minilayout, which is used in the mini view of a record in the console tab, hover details, and event overlays. signature public metadata.minilayout minilayout {get; set;} property value type: metadata.minilayout multilinelayoutfields fields for special multiline layout fields which appear in opportunityproduct layouts. signature public list multilinelayoutfields {get; set;} 2393apex reference guide layout class property value type: list platformactionlist the list of actions, and their order, that display in the salesforce mobile action bar for the layout. signature public metadata.platformactionlist platformactionlist {get; set;} property value type: metadata.platformactionlist quickactionlist the list of quick actions that display in the full salesforce site for the page layout. signature public metadata.quickactionlist quickactionlist {get; set;} property value type: meatadata.quickactionl. relatedcontent the related content section of the page layout. signature public metadata.relatedcontent relatedcontent {get; set;} property value type: metadata.relatedcontent relatedlists the related lists for the layout, listed in the order they appear in the user interface. signature public list relatedlists {get; set;}" "property value type: list 2394apex reference guide layout class relatedobjects the list of related objects that appears in the mini view of the console. signature public list relatedobjects {get; set;} property value type: list runassignmentrulesdefault default value for the “run assignment rules” checkbox. only relevant if the showrunassignmentrulescheckbox property is set. signature public boolean runassignmentrulesdefault {get; set;} property value type: boolean showemailcheckbox controls whether to show the email checkbox. only allowed on case, caseclose, and task layouts. the default state of checkbox is controlled by the emaildefault property. signature public boolean showemailcheckbox {get; set;} property value type: boolean showhighlightspanel if set, the highlights panel displays on pages in the salesforce console. signature public boolean showhighlightspanel {get; set;} property value type: boolean 2395apex reference guide layout class showinteractionlogpanel if set, the interaction log displays on pages in the salesforce console. signature public boolean showinteractionlogpanel {get; set;} property value type: boolean showknowledgecomponent only allowed on case layouts. if set, the knowledge sidebar displays on cases in the salesforce console. signature public boolean showknowledgecomponent {get; set;} property value type: boolean showrunassignmentrulescheckbox controls whether to show the run assignment rules checkbox. only allowed on lead and case layouts. the default state of checkbox is controlled by the runassignmentrulesdefault property. signature public boolean showrunassignmentrulescheckbox {get; set;} property value type: boolean showsolutionsection only allowed on caseclose layout. if set, the built-in solution information section shows up on the page. signature public boolean showsolutionsection {get; set;} property value type: boolean 2396apex reference guide layoutcolumn class showsubmitandattachbutton for cast layouts only. if set, the submit & add attachment button displays on case edit pages to portal users in the customer portal. signature public boolean showsubmitandattachbutton {get; set;} property value type: boolean summarylayout the summary layout for this layout. signature public metadata.summarylayout summarylayout {get; set;} property value type: metadata.summarylayout layout methods the following are methods for layout. in this section: clone() makes a duplicate copy of the metadata.layout. clone() makes a duplicate copy of the metadata.layout. signature public object clone() return value type: object layoutcolumn class represents the items in a column within a layout section. 2397apex reference guide layoutcolumn class namespace metadata usage use this class when accessing metadata.layout metadata components. for more information, see “layoutcolumn” in the metadata api developer guide. in this section: layoutcolumn properties layoutcolumn methods layoutcolumn properties the following are properties for layoutcolumn. in this section: layoutitems the individual items within a column (ordered from top to bottom). reserved this field is reserved for salesforce. layoutitems the individual items within a column (ordered from top to bottom). signature public list layoutitems {get; set;} property value type: list reserved this field is reserved for salesforce. signature public string reserved {get; set;} property value type: string 2398apex reference guide layoutheader enum layoutcolumn methods the following are methods for layoutcolumn. in this section: clone() makes a duplicate copy of the metadata.layoutcolumn. clone() makes a duplicate copy of the metadata.layoutcolumn. signature public object clone() return value type: object layoutheader enum represents tagging types used for metadata.layout.headers enum values the following are the values of the metadata.layoutheader enum. value description personaltagging tag is set to private user. publictagging tag is viewable to any user who can access the record. layoutitem class represents the valid values that define a layout item. namespace metadata usage use this class when accessing metadata.layout metadata components" ". for more information, see “layoutitem” in the metadata api developer guide. 2399apex reference guide layoutitem class in this section: layoutitem properties layoutitem methods layoutitem properties the following are properties for layoutitem. in this section: analyticscloudcomponent a wave analytics dashboard component on a page. behavior determines the field behavior. canvas references a canvas app. component references a component. customlink the custom link reference. emptyspace controls if this layout item is a blank space. field the field name reference, relative to the layout, for example “description” or “myfield__c”. height for s-controls and pages only, the height in pixels. page_x reference to a visualforce page. reportchartcomponent refers to a report chart that you can add to a standard or custom object page. scontrol reference to an s-control. showlabel for s-control and pages only, whether to show the label. showscrollbars for s-control and pages only, whether to show scrollbars. width for s-control and pages only, the width in pixels or percent. pixel values are simply the number of pixels, for example, 500. percentage values must include the percent sign, for example, 20%. analyticscloudcomponent a wave analytics dashboard component on a page. 2400apex reference guide layoutitem class signature public metadata.analyticscloudcomponentlayoutitem analyticscloudcomponent {get; set;} property value type: metadata.analyticscloudcomponentlayoutitem behavior determines the field behavior. signature public metadata.uibehavior behavior {get; set;} property value type: metadata.uibehavior canvas references a canvas app. signature public string canvas {get; set;} property value type: string component references a component. signature public string component {get; set;} property value type: string customlink the custom link reference. signature public string customlink {get; set;} 2401apex reference guide layoutitem class property value type: string emptyspace controls if this layout item is a blank space. signature public boolean emptyspace {get; set;} property value type: boolean field the field name reference, relative to the layout, for example “description” or “myfield__c”. signature public string field {get; set;} property value type: string height for s-controls and pages only, the height in pixels. signature public integer height {get; set;} property value type: integer page_x reference to a visualforce page. signature public string page_x {get; set;} property value type: string 2402apex reference guide layoutitem class reportchartcomponent refers to a report chart that you can add to a standard or custom object page. signature public metadata.reportchartcomponentlayoutitem reportchartcomponent {get; set;} property value type: metadata.reportchartcomponentlayoutitem scontrol reference to an s-control. signature public string scontrol {get; set;} property value type: string showlabel for s-control and pages only, whether to show the label. signature public boolean showlabel {get; set;} property value type: boolean showscrollbars for s-control and pages only, whether to show scrollbars. signature public boolean showscrollbars {get; set;} property value type: boolean 2403apex reference guide layoutsection class width for s-control and pages only, the width in pixels or percent. pixel values are simply the number of pixels, for example, 500. percentage values must include the percent sign, for example, 20%. signature public string width {get; set;} property value type: string layoutitem methods the following are methods for layoutitem. in this section: clone() makes a duplicate copy of the metadata.layoutitem. clone() makes a duplicate copy of the metadata.layoutitem. signature public object clone() return value type: object layoutsection class represents a section of a page layout, such as the custom links section. namespace metadata usage use this class when accessing metadata.layout metadata components. for more information, see “layout" "section” in the metadata api developer guide. in this section: layoutsection properties 2404apex reference guide layoutsection class layoutsection methods layoutsection properties the following are properties for layoutsection. in this section: customlabel indicates if this section's label is custom or standard (built-in). detailheading controls if this section appears in the detail page. editheading controls if this section appears in the edit page. label the label; either standard or custom, based on the customlabel property. layoutcolumns lists the layout columns. you can have one, two, or three columns, ordered left to right, are possible. style the style of the layout for this section. customlabel indicates if this section's label is custom or standard (built-in). signature public boolean customlabel {get; set;} property value type: boolean detailheading controls if this section appears in the detail page. signature public boolean detailheading {get; set;} property value type: boolean editheading controls if this section appears in the edit page. 2405apex reference guide layoutsection class signature public boolean editheading {get; set;} property value type: boolean label the label; either standard or custom, based on the customlabel property. signature public string label {get; set;} property value type: string layoutcolumns lists the layout columns. you can have one, two, or three columns, ordered left to right, are possible. signature public list layoutcolumns {get; set;} property value type: list style the style of the layout for this section. signature public metadata.layoutsectionstyle style {get; set;} property value type: metadata.layoutsectionstyle layoutsection methods the following are methods for layoutsection. 2406apex reference guide layoutsectionstyle enum in this section: clone() makes a duplicate copy of the metadata.layoutsection. clone() makes a duplicate copy of the metadata.layoutsection. signature public object clone() return value type: object layoutsectionstyle enum describes the possible styles for a layout section. enum values the following are the values of the metadata.layoutsectionstyle enum. value description customlinks contains custom links only onecolumn one column twocolumnslefttoright two columns, tab goes left to right twocolumnstoptobottom two columns, tab goes top to bottom metadata class an abstract base class that represents a custom metadata component. namespace metadata usage you can’t create instances of this abstract class. instead, create an instance of a specific custom metadata component class that derives from metadata.metadata, such as metadata.custommetadata. for more information, see metadata in the metadata api developer guide. 2407apex reference guide metadata class in this section: metadata properties metadata methods metadata properties the following are properties for metadata. in this section: fullname the full name of the custom metadata, which can include the namespace, type, and component name. fullname the full name of the custom metadata, which can include the namespace, type, and component name. signature public string fullname {get; set;} property value type: string the format of the full name can include the namespace, metadata type, and metadata component name. if you’re updating components in a namespace, you also need to qualify the namespace for the component in the full name. for example, the full name for a custom metadata ""mdtype1__mdt"" component named ""component1"" that is contained in the ""mypackage"" namespace is ""mypackage__mdtype1__mdt.mypackage__component1"". for more information on full name formats for different metadata types, see reference documentation on the metadata types in the metadata api developer guide. metadata methods the following are methods for metadata. in this section: clone() makes a duplicate copy of the metadata.metadata. clone() makes a duplicate copy of the metadata.metadata. signature public object clone() 2408apex reference guide metadatatype enum return value type: object metadatatype enum represents the custom metadata components available in apex. enum values the following are the values of the met" "adata.metadatatype enum. value description custommetadata records of custom metadata types layout layouts metadatavalue class an abstract base class that represents a custom metadata component field. namespace metadata usage you can’t create instances of this abstract class. instead, create an instance of a specific custom metadata component value class that derives from metadata.metadatavalue, such as metadata.custommetadatavalue. in this section: metadatavalue methods metadatavalue methods the following are methods for metadatavalue. in this section: clone() makes a duplicate copy of the metadata.metadatavalue. clone() makes a duplicate copy of the metadata.metadatavalue. 2409apex reference guide minilayout class signature public object clone() return value type: object minilayout class represents a mini view of a record in the console tab, hover details, and event overlays. namespace metadata usage use this class when accessing metadata.layout metadata components. for more information, see “minilayout” in the metadata api developer guide. in this section: minilayout properties minilayout methods minilayout properties the following are properties for minilayout. in this section: fields the fields for the mini-layout, listed in the order they appear in the ui. fields that appear in the mini-layout must appear in the main layout. relatedlists the mini related lists, listed in the order they appear in the ui. you cannot set sorting on mini related lists. fields that appear in the mini related lists must appear in the main layout. fields the fields for the mini-layout, listed in the order they appear in the ui. fields that appear in the mini-layout must appear in the main layout. signature public list fields {get; set;} 2410apex reference guide operations class property value type: list relatedlists the mini related lists, listed in the order they appear in the ui. you cannot set sorting on mini related lists. fields that appear in the mini related lists must appear in the main layout. signature public list relatedlists {get; set;} property value type: list minilayout methods the following are methods for minilayout. in this section: clone() makes a duplicate copy of the metadata.minilayout. clone() makes a duplicate copy of the metadata.minilayout. signature public object clone() return value type: object operations class represents a class to execute metadata operations, such as retrieving or deploying custom metadata. namespace metadata usage use the metadata.operations class to execute metadata operations. for more information on use cases and restrictions of metadata operations in apex, see metadata. 2411apex reference guide operations class example: retrieve metadata the following example retrieves the “mytestcustommdtype” custom metadata record from the subscriber org, and inspects the custom fields. public class readmetadata { public void retrievemetadata () { // list fullnames of components we want to retrieve list componentnamelist = new list{'isvnamespace__testcustommdtype.mytestcustommdtype'}; // retrieve components that are records of custom metadata types // based on name list components = metadata.operations.retrieve( metadata.metadatatype.custommetadata, componentnamelist); metadata.custommetadata custommetadatarecord = (metadata.custommetadata) components.get(0); // check fields of retrieved component list values = custommetadatarecord.values; for (integer i = 0; i < values.size(); i++) { if (values.get(i).field == 'testfield__c' && values.get(i).value == 'desired value') { // ...process accordingly... } } } } example: deploy metadata the following example uses the metadata api in apex to update the customfield custom field value of the metadatarecordname custom metadata record and deploy this change into the subscriber org. because the deployment is asynchronous, you must provide a callback class that implements the metadata.deploycallback interface, which is then used when the queued deployment completes. public class createmetadata{ public void updateanddeploymetadata" "() { // setup custom metadata to be created in the subscriber org. metadata.custommetadata custommetadata = new metadata.custommetadata(); custommetadata.fullname = 'isvnamespace__metadatatypename.metadatarecordname'; metadata.custommetadatavalue customfield = new metadata.custommetadatavalue(); customfield.field = 'customfield__c'; customfield.value = 'new value'; custommetadata.values.add(customfield); metadata.deploycontainer mdcontainer = new metadata.deploycontainer(); mdcontainer.addmetadata(custommetadata); // setup deploy callback, mydeploycallback implements // the metadata.deploycallback interface (code for // this class not shown in this example) mydeploycallback callback = new mydeploycallback(); 2412apex reference guide operations class // enqueue custom metadata deployment id jobid = metadata.operations.enqueuedeployment(mdcontainer, callback); } } example: create two metadata records synchronously create a metadata record along with another one that references it in the same transaction. if the parent record was installed with a namespace, prefix the developer name with recordns__. note: no custom metadata relationship can relate records of the same type to each other. public class createmetadata { public id docreate( string parentrecdevname, string parentreclabel, string childrecdevname, string childreclabel) { metadata.deploycontainer mdcontainer = new metadata.deploycontainer(); metadata.custommetadata parentrecord = new metadata.custommetadata(); parentrecord.fullname = 'parenttype.' + parentrecdevname; parentrecord.label = parentreclabel; mdcontainer.addmetadata(parentrecord); metadata.custommetadata childrecord = new metadata.custommetadata(); childrecord.fullname = 'childtype.' + childrecdevname; childrecord.label = childreclabel; metadata.custommetadatavalue relvalue = new metadata.custommetadatavalue(); relvalue.field = 'parent__c'; relvalue.value = parentrecdevname; childrecord.values.add(relvalue); mdcontainer.addmetadata(childrecord); id jobid = metadata.operations.enqueuedeployment(mdcontainer, null); return jobid; } } in this section: operations methods operations methods the following are methods for operations. 2413apex reference guide operations class in this section: clone() makes a duplicate copy of the metadata.operations. enqueuedeployment(container, callback) deploys custom metadata components asynchronously. retrieve(type, fullnames) retrieves a list of custom metadata components. clone() makes a duplicate copy of the metadata.operations. signature public object clone() return value type: object enqueuedeployment(container, callback) deploys custom metadata components asynchronously. signature public static id enqueuedeployment(metadata.deploycontainer container, metadata.deploycallback callback) parameters container type: metadata.deploycontainer container that contains the set of metadata components to deploy. callback type: metadata.deploycallback a class that implements the metadata.deploycallback interface. used by salesforce to return information about the deployment results. return value type: id id of deployment request. retrieve(type, fullnames) retrieves a list of custom metadata components. 2414apex reference guide platformactionlist class signature public static list retrieve(metadata.metadatatype type, list fullnames) parameters type type: metadata.metadatatype the metadata component type. fullnames type: list a list of component names to retrieve. for information on component name formats, see metadata.fullname(). return value type: list platformactionlist class represents the list of actions, and their order, that display in the salesforce mobile action bar for the layout. namespace metadata usage use this class when accessing metadata.layout metadata components. for more information, see “platformactionlist” in the metadata api developer guide. in this section: platformactionlist properties platformactionlist methods platformactionlist properties the following are properties for platformactionlist. in this section" ": actionlistcontext the context of the action list. platformactionlistitems the actions in the platform action list. 2415apex reference guide platformactionlist class relatedsourceentity when the actionlistcontext property is “relatedlist” or” “relatedlistrecord”, this field represents the api name of the related list to which the action belongs. actionlistcontext the context of the action list. signature public metadata.platformactionlistcontextenum actionlistcontext {get; set;} property value type: metadata.platformactionlistcontextenum platformactionlistitems the actions in the platform action list. signature public list platformactionlistitems {get; set;} property value type: list relatedsourceentity when the actionlistcontext property is “relatedlist” or” “relatedlistrecord”, this field represents the api name of the related list to which the action belongs. signature public string relatedsourceentity {get; set;} property value type: string platformactionlist methods the following are methods for platformactionlist. in this section: clone() makes a duplicate copy of the metadata.platformactionlist. 2416apex reference guide platformactionlistcontextenum enum clone() makes a duplicate copy of the metadata.platformactionlist. signature public object clone() return value type: object platformactionlistcontextenum enum describes the different contexts of action lists. enum values the following are the values of the metadata.platformactionlistcontextenum enum. value description actiondefinition action definition context. assistant assistant context. bannerphoto banner photo context. chatter chatter context. dockable dockable context. feedelement feed element context. flexipage flexipage context. global_x global context. listview listview context. listviewdefinition listview definition context. listviewrecord listview record context. lookup lookup context. mrulist mru list context. mrurow mru row context. objecthomechart object home chart context. photo photo context record record context. recordedit record edit context 2417apex reference guide platformactionlistitem class value description relatedlist related list context. relatedlistrecord related list record context. platformactionlistitem class represents an action in the platform action list for a layout. namespace metadata usage use this class when accessing metadata.layout metadata components. for more information, see “platformactionlistitem” in the metadata api developer guide. in this section: platformactionlistitem properties platformactionlistitem methods platformactionlistitem properties the following are properties for platformactionlistitem. in this section: actionname the api name for the action in the list. actiontype the type of action. sortorder the placement of the action in the list. subtype the subtype of the action. actionname the api name for the action in the list. signature public string actionname {get; set;} 2418apex reference guide platformactionlistitem class property value type: string actiontype the type of action. signature public metadata.platformactiontypeenum actiontype {get; set;} property value type: metadata.platformactiontypeenum sortorder the placement of the action in the list. signature public integer sortorder {get; set;} property value type: integer subtype the subtype of the action. signature public string subtype {get; set;} property value type: string platformactionlistitem methods the following are methods for platformactionlistitem. in this section: clone() makes a duplicate copy of the metadata.platformactionlistitem. 2419apex reference guide platformactiontypeenum enum clone() makes a duplicate copy of the metadata.platformactionlistitem. signature public object clone() return value type: object platformactiontypeenum enum the type of action for a platformactionlistitem. enum values the following are the values of the metadata.platformactiontypeenum enum. value description actionlink an indicator on a feed element that targets an api, a web page, or a file, represented by a button in the salesforce chatter feed ui. custombutton" "when clicked, opens a url or a visualforce page in a window or executes javascript. invocableaction an invocable action such as posting to chatter. productivityaction productivity actions are predefined by salesforce and are attached to a limited set of objects. you can’t edit or delete productivity actions. quickaction a global or object-specific action. standardbutton a predefined salesforce button such as new, edit, and delete. primarytabcomponents class represents custom console components on primary tabs in the salesforce console. namespace metadata usage use this class when accessing metadata.layout metadata components. for more information, see “primarytabcomponents” in the metadata api developer guide. 2420apex reference guide primarytabcomponents class in this section: primarytabcomponents properties primarytabcomponents methods primarytabcomponents properties the following are properties for primarytabcomponents. in this section: component represents a custom console component (visualforce page, lookup field, or related lists) on a section of a page layout. containers represents a location and style in which to display more than one custom console component on the sidebars of the salesforce console. component represents a custom console component (visualforce page, lookup field, or related lists) on a section of a page layout. signature public list component {get; set;} property value type: list containers represents a location and style in which to display more than one custom console component on the sidebars of the salesforce console. signature public list containers {get; set;} property value type: list primarytabcomponents methods the following are methods for primarytabcomponents. in this section: clone() makes a duplicate copy of the metadata.primarytabcomponents. 2421apex reference guide quickactionlist class clone() makes a duplicate copy of the metadata.primarytabcomponents. signature public object clone() return value type: object quickactionlist class represents the list of actions associated with the page layout. namespace metadata usage use this class when accessing metadata.layout metadata components. for more information, see “quickactionlist” in the metadata api developer guide. in this section: quickactionlist properties quickactionlist methods quickactionlist properties the following are properties for quickactionlist. in this section: quickactionlistitems list of quickactionlist objects. quickactionlistitems list of quickactionlist objects. signature public list quickactionlistitems {get; set;} property value type: list 2422apex reference guide quickactionlistitem class quickactionlist methods the following are methods for quickactionlist. in this section: clone() makes a duplicate copy of the metadata.quickactionlist. clone() makes a duplicate copy of the metadata.quickactionlist. signature public object clone() return value type: object quickactionlistitem class represents an action in the quickactionlist. namespace metadata usage use this class when accessing metadata.layout metadata components. for more information, see “quickactionlistitem” in the metadata api developer guide. in this section: quickactionlistitem properties quickactionlistitem methods quickactionlistitem properties the following are properties for quickactionlistitem. in this section: quickactionname the api name of the action. 2423apex reference guide relatedcontent class quickactionname the api name of the action. signature public string quickactionname {get; set;} property value type: string quickactionlistitem methods the following are methods for quickactionlistitem. in this section: clone() makes a duplicate copy of the metadata.quickactionlistitem. clone() makes a duplicate copy of the metadata.quickactionlistitem. signature public object clone() return value type: object relatedcontent class represents the mobile cards section of the page layout. namespace metadata usage use this class when accessing metadata.layout metadata components. for more information, see “relatedcontent” in the metadata api developer guide. in this section: relatedcontent properties related" "content methods 2424apex reference guide relatedcontentitem class relatedcontent properties the following are properties for relatedcontent. in this section: relatedcontentitems a list of layout items in the mobile cards section of the page layout. relatedcontentitems a list of layout items in the mobile cards section of the page layout. signature public list relatedcontentitems {get; set;} property value type: list relatedcontent methods the following are methods for relatedcontent. in this section: clone() makes a duplicate copy of the metadata.relatedcontent. clone() makes a duplicate copy of the metadata.relatedcontent. signature public object clone() return value type: object relatedcontentitem class represents an individual item in the relatedcontent list. namespace metadata 2425apex reference guide relatedcontentitem class usage use this class when accessing metadata.layout metadata components. for more information, see “relatedcontentitem” in the metadata api developer guide. in this section: relatedcontentitem properties relatedcontentitem methods relatedcontentitem properties the following are properties for relatedcontentitem. in this section: layoutitem an individual layout item in the mobile cards section. layoutitem an individual layout item in the mobile cards section. signature public metadata.layoutitem layoutitem {get; set;} property value type: metadata.layoutitem relatedcontentitem methods the following are methods for relatedcontentitem. in this section: clone() makes a duplicate copy of the metadata.relatedcontentitem. clone() makes a duplicate copy of the metadata.relatedcontentitem. signature public object clone() 2426apex reference guide relatedlist class return value type: object relatedlist class represents related list custom components on the sidebars of the salesforce console. namespace metadata usage use this class when accessing metadata.layout metadata components. for more information, see “relatedlist” in the metadata api developer guide. in this section: relatedlist properties relatedlist methods relatedlist properties the following are properties for relatedlist. in this section: hideondetail when set to true, the related list is hidden from detail pages where it appears as a component to prevent duplicate information from showing. name the name of the component as it appears to console users. hideondetail when set to true, the related list is hidden from detail pages where it appears as a component to prevent duplicate information from showing. signature public boolean hideondetail {get; set;} property value type: boolean 2427apex reference guide relatedlistitem class name the name of the component as it appears to console users. signature public string name {get; set;} property value type: string relatedlist methods the following are methods for relatedlist. in this section: clone() makes a duplicate copy of the metadata.relatedlist. clone() makes a duplicate copy of the metadata.relatedlist. signature public object clone() return value type: object relatedlistitem class represents an item in the related list in a page layout. namespace metadata usage use this class when accessing metadata.layout metadata components. for more information, see “relatedlistitem” in the metadata api developer guide. in this section: relatedlistitem properties relatedlistitem methods 2428apex reference guide relatedlistitem class relatedlistitem properties the following are properties for relatedlistitem. in this section: custombuttons a list of custom buttons used in the related list. excludebuttons a list of excluded related-list buttons. fields a list of fields displayed in the related list. uses aliases instead of field or api names. relatedlist the name of the related list. sortfield the name of the field used for sorting. sortorder when sortfield is set, the sortorder property determines the sort order. custombuttons a list of custom buttons used in the related list. signature public list custombuttons {get; set;} property value type: list for more information, see “define custom buttons and links” in the salesforce online help. excludebuttons a list of excluded related-list buttons. signature public list excludebuttons" "{get; set;} property value type: list fields a list of fields displayed in the related list. uses aliases instead of field or api names. 2429apex reference guide relatedlistitem class signature public list fields {get; set;} property value type: list relatedlist the name of the related list. signature public string relatedlist {get; set;} property value type: string sortfield the name of the field used for sorting. signature public string sortfield {get; set;} property value type: string sortorder when sortfield is set, the sortorder property determines the sort order. signature public metadata.sortorder sortorder {get; set;} property value type: metadata.sortorder relatedlistitem methods the following are methods for relatedlistitem. 2430apex reference guide reportchartcomponentlayoutitem class in this section: clone() makes a duplicate copy of the metadata.relatedlistitem. clone() makes a duplicate copy of the metadata.relatedlistitem. signature public object clone() return value type: object reportchartcomponentlayoutitem class represents the settings for a report chart on a standard or custom page. namespace metadata usage use this class when accessing metadata.layout metadata components. for more information, see “reportchartcomponentlayoutitem” in the metadata api developer guide. in this section: reportchartcomponentlayoutitem properties reportchartcomponentlayoutitem methods reportchartcomponentlayoutitem properties the following are properties for reportchartcomponentlayoutitem. in this section: cachedata indicates whether to use cached data when displaying the chart. when the attribute is set to true, data is cached for 24 hours. when the attribute is set to false, the report is run every time the page is refreshed. contextfilterablefield unique development name of the field by which a report chart is filtered to return data relevant to the page. if set, the id field for the parent object of the page or report type is the chart data filter. the parent object for the report type and the page must match for a chart to return relevant data. 2431apex reference guide reportchartcomponentlayoutitem class error error string that is populated only when an error occurs in the underlying report. hideonerror controls whether users see a chart that has an error. when an error occurs and this attribute is not set, the chart doesn’t show any data except the error. set the attribute to true to hide the chart from a page on error. includecontext if true, filters the report chart to return data that’s relevant to the page. reportname unique development name of a report that includes a chart. showtitle if true, applies the title from the report to the chart. size size of the displayed chart. the default is medium. cachedata indicates whether to use cached data when displaying the chart. when the attribute is set to true, data is cached for 24 hours. when the attribute is set to false, the report is run every time the page is refreshed. signature public boolean cachedata {get; set;} property value type: boolean contextfilterablefield unique development name of the field by which a report chart is filtered to return data relevant to the page. if set, the id field for the parent object of the page or report type is the chart data filter. the parent object for the report type and the page must match for a chart to return relevant data. signature public string contextfilterablefield {get; set;} property value type: string error error string that is populated only when an error occurs in the underlying report. signature public string error {get; set;} 2432" "apex reference guide reportchartcomponentlayoutitem class property value type: string hideonerror controls whether users see a chart that has an error. when an error occurs and this attribute is not set, the chart doesn’t show any data except the error. set the attribute to true to hide the chart from a page on error. signature public boolean hideonerror {get; set;} property value type: boolean includecontext if true, filters the report chart to return data that’s relevant to the page. signature public boolean includecontext {get; set;} property value type: boolean reportname unique development name of a report that includes a chart. signature public string reportname {get; set;} property value type: string showtitle if true, applies the title from the report to the chart. signature public boolean showtitle {get; set;} 2433apex reference guide reportchartcomponentsize enum property value type: boolean size size of the displayed chart. the default is medium. signature public metadata.reportchartcomponentsize size {get; set;} property value type: metadata.reportchartcomponentsize reportchartcomponentlayoutitem methods the following are methods for reportchartcomponentlayoutitem. in this section: clone() makes a duplicate copy of the metadata.reportchartcomponentlayoutitem. clone() makes a duplicate copy of the metadata.reportchartcomponentlayoutitem. signature public object clone() return value type: object reportchartcomponentsize enum describes the size of the displayed report chart component. enum values the following are the values of the metadata.reportchartcomponentsize enum. value description large large chart size. medium medium chart size. 2434apex reference guide sidebarcomponent class value description small small chart size. sidebarcomponent class represents a specific custom console component to display in a container that hosts multiple components in one of the sidebars of the salesforce console. namespace metadata usage use this class when accessing metadata.layout metadata components. for more information, see “sidebarcomponent” in the metadata api developer guide. in this section: sidebarcomponent properties sidebarcomponent methods sidebarcomponent properties the following are properties for sidebarcomponent. in this section: componenttype specifies the component type. valid values are “knowledgeone”, “lookup”, “milestones”, “relatedlist”, “topics”, “files”, and “caseexperts”. createaction if the component is a lookup field, the name of the quick action used to create a record. enablelinking if the component is a lookup field, lets users associate a record with this field. height the height of the component in the container. the unit property determines the unit of measurement, in pixels or percent. knowledgeoneenable indicates if the component is enabled for knowledge one. label the name of the component as it displays to console users. available for components in a container with the style of tabs or accordion. lookup if the component is a lookup field, the name of the field. 2435apex reference guide sidebarcomponent class page_x if the component is a visualforce page, the name of the visualforce page. relatedlists if the component is a related list component, the list of related list names. unit the unit of measurement (pixels or percent) for the height and width of the component in the container. updateaction if the component is a lookup field, the name of the quick action used to update a record. width the width of the component in the container. the unit property determines the unit of measurement, in pixels or percent. componenttype specifies the component type. valid values are “knowledgeone”, “lookup”, “milestones”, “relatedlist”, “topics”, “files”, and “caseexperts”. signature public string componenttype {get; set;} property value type: string createaction if the component is a lookup field, the name of the quick action used to create a record. signature public string createaction {get; set;} property value type: string enablelinking if the component is a lookup field, lets users associate a record with this field. signature public boolean enablelinking {" "get; set;} property value type: boolean 2436apex reference guide sidebarcomponent class height the height of the component in the container. the unit property determines the unit of measurement, in pixels or percent. signature public integer height {get; set;} property value type: integer knowledgeoneenable indicates if the component is enabled for knowledge one. signature public boolean knowledgeoneenable {get; set;} property value type: boolean label the name of the component as it displays to console users. available for components in a container with the style of tabs or accordion. signature public string label {get; set;} property value type: string lookup if the component is a lookup field, the name of the field. signature public string lookup {get; set;} property value type: string page_x if the component is a visualforce page, the name of the visualforce page. 2437apex reference guide sidebarcomponent class signature public string page_x {get; set;} property value type: string relatedlists if the component is a related list component, the list of related list names. signature public list relatedlists {get; set;} property value type: list unit the unit of measurement (pixels or percent) for the height and width of the component in the container. signature public string unit {get; set;} property value type: string updateaction if the component is a lookup field, the name of the quick action used to update a record. signature public string updateaction {get; set;} property value type: string width the width of the component in the container. the unit property determines the unit of measurement, in pixels or percent. signature public integer width {get; set;} 2438apex reference guide sortorder enum property value type: integer sidebarcomponent methods the following are methods for sidebarcomponent. in this section: clone() makes a duplicate copy of the metadata.sidebarcomponent. clone() makes a duplicate copy of the metadata.sidebarcomponent. signature public object clone() return value type: object sortorder enum describes the sort order of a related list. enum values the following are the values of the metadata.sortorder enum. value description asc_x sort in ascending order. desc_x sort in descending order. statuscode enum describes the status code for an unsuccessful component deploy. enum values the following are the values of the metadata.statuscode enum. value description invalid_scs_inbound_user log in as the runas user configured in your scs setup. 2439apex reference guide subtabcomponents class value description require_connected_app_scs scs connected app is not installed. require_connected_app_session_scs to use the scs connected app, the user must be authenticated. require_runas_user a runas user must be configured in your org. see also: deployproblemtype enum subtabcomponents class represents custom console components on subtabs in the salesforce console. namespace metadata usage use this class when accessing metadata.layout metadata components. for more information, see “subtabcomponents” in the metadata api developer guide. in this section: subtabcomponents properties subtabcomponents methods subtabcomponents properties the following are properties for subtabcomponents. in this section: component represents a custom console component (visualforce page, lookup field, or related lists) on a section of a page layout. containers represents a location and style in which to display more than one custom console component on the sidebars of the salesforce console. component represents a custom console component (visualforce page, lookup field, or related lists) on a section of a page layout. signature public list component {get; set;} 2440apex reference guide summarylayoutstyleenum enum property value type: list containers represents a location and style in which to display more than one custom console component on the sidebars of the salesforce console. signature public list containers {get; set;} property value" "type: list subtabcomponents methods the following are methods for subtabcomponents. in this section: clone() makes a duplicate copy of the metadata.subtabcomponents. clone() makes a duplicate copy of the metadata.subtabcomponents. signature public object clone() return value type: object summarylayoutstyleenum enum describes the highlights panel style for a summarylayout. enum values the following are the values of the metadata.summarylayoutstyleenum enum. value description caseinteraction case interaction style. childservicereporttemplatestyle child service report template style. 2441apex reference guide summarylayout class value description defaultquotetemplate default quote template style. defaultservicereporttemplate default service report style default_x default style. pathassistant path assisstant style. quickactionlayoutleftright quick action left-right layout style. quickactionlayouttopdown quick action top-down layout style. quotetemplate quote template style. servicereporttemplate service report style. summarylayout class controls the appearance of the highlights panel, which summarizes key fields in a grid at the top of a page layout, when case feed is enabled. namespace metadata usage use this class when accessing metadata.layout metadata components. for more information, see “summarylayout” in the metadata api developer guide. in this section: summarylayout properties summarylayout methods summarylayout properties the following are properties for summarylayout. in this section: masterlabel the name of the layout label. sizex number of columns in the highlights pane, between 1 and 4 (inclusive). sizey number of rows in each column, either 1 or 2. 2442apex reference guide summarylayout class sizez if provided, the setting is not visible to users. summarylayoutitems controls the appearance of an individual field and its column and row position within the highlights panel grid, when case feed is enabled. at least one is required. summarylayoutstyle specifies the panel style. masterlabel the name of the layout label. important: where possible, we changed noninclusive terms to align with our company value of equality. we maintained certain terms to avoid any effect on customer implementations. signature public string masterlabel {get; set;} property value type: string sizex number of columns in the highlights pane, between 1 and 4 (inclusive). signature public integer sizex {get; set;} property value type: integer sizey number of rows in each column, either 1 or 2. signature public integer sizey {get; set;} property value type: integer sizez if provided, the setting is not visible to users. 2443apex reference guide summarylayout class signature public integer sizez {get; set;} property value type: integer summarylayoutitems controls the appearance of an individual field and its column and row position within the highlights panel grid, when case feed is enabled. at least one is required. signature public list summarylayoutitems {get; set;} property value type: list summarylayoutstyle specifies the panel style. signature public metadata.summarylayoutstyleenum summarylayoutstyle {get; set;} property value type: metadata.summarylayoutstyleenum summarylayout methods the following are methods for summarylayout. in this section: clone() makes a duplicate copy of the metadata.summarylayout. clone() makes a duplicate copy of the metadata.summarylayout. signature public object clone() 2444apex reference guide summarylayoutitem class return value type: object summarylayoutitem class controls the appearance of an individual field and its column and row position within the highlights panel grid, when case feed is enabled. you can have two fields per each grid in a highlights panel. namespace metadata usage use this class when accessing metadata.layout metadata components. for more information, see “summarylayoutitem” in the metadata api developer guide. in this section: summarylayoutitem properties summarylayoutitem methods summarylayoutitem properties the following are properties for summarylayoutitem. in this section: customlink the custom link reference. field the field name reference, relative to the page layout. must be a standard or custom field that also exists on the detail page. posx the item's column" "position in the highlights panel grid. must be within the range of sizex. posy the item's row position in the highlights panel grid. must be within the range of sizey. posz reserved for future use. if provided, the setting is not visible to users. customlink the custom link reference. signature public string customlink {get; set;} 2445apex reference guide summarylayoutitem class property value type: string field the field name reference, relative to the page layout. must be a standard or custom field that also exists on the detail page. signature public string field {get; set;} property value type: string posx the item's column position in the highlights panel grid. must be within the range of sizex. signature public integer posx {get; set;} property value type: integer posy the item's row position in the highlights panel grid. must be within the range of sizey. signature public integer posy {get; set;} property value type: integer posz reserved for future use. if provided, the setting is not visible to users. signature public integer posz {get; set;} property value type: integer 2446apex reference guide uibehavior enum summarylayoutitem methods the following are methods for summarylayoutitem. in this section: clone() makes a duplicate copy of the metadata.summarylayoutitem. clone() makes a duplicate copy of the metadata.summarylayoutitem. signature public object clone() return value type: object uibehavior enum describes the behavior for a layout item on a layout page. enum values the following are the values of the metadata.uibehavior enum. value description edit the layout field can be edited but is not required. readonly the layout field is read-only. required the layout field can be edited and is required. pref_center namespace the pref_center namespace provides an interface, classes, and methods to create and retrieve data in forms in preference manager. preference manager, previously called preference center, is a feature within the privacy center app. the following are the classes in the pref_center namespace. in this section: loadformdata class retrieve records related to the tokenized record id, and populate the values of a preference form. 2447apex reference guide loadformdata class loadparameters class contains methods to retrieve record id information for parameters passed into the load-form handler. preferencecenterapexhandler interface pass data between your organization and a form in preference manager. submitformdata class contains methods to retrieve information on buttons and options selected in a preference form. submitparameters class retrieve record id information to use with your submit-form handler. tokentype enum defines the types of values supported by the tokenutility methods. tokenutility class generate authentication tokens to access preference forms. validationresult class this class is reserved for future use with preference manager. loadformdata class retrieve records related to the tokenized record id, and populate the values of a preference form. namespace pref_center example use methods in the loadformdata class to set available and selected values in different form components: list picklistoptions = new list(); picklistoptions.add(new system.selectoption('optin', 'opt in')); picklistoptions.add(new system.selectoption('optout', 'opt out')); // set the available options for the picklist loadformdata.setoptions('mypicklist', picklistoptions); // add an option to the existing options for the picklist loadformdata.addoption('mypicklist', 'optoutall', 'opt out all'); // select the 'optin' option in the picklist loadformdata.setselectedoption('mypicklist', 'optin'); list checkboxoptions = new list(); checkboxoptions.add(new system.selectoption('yes', 'yes')); checkboxoptions.add(new system.selectoption('no', 'no')); // set available options for the checkbox group loadformdata.setoptions('mycheckbox', checkboxoptions); // select the 'yes' option in the checkbox group loadformdata.addselectedoption('mycheckbox', 'yes'); 2448apex reference guide loadformdata" "class // also select the 'no' option in the checkbox group loadformdata.addselectedoption('mycheckbox', 'no'); // another way to select both the 'yes' and 'no' options in the checkbox group loadformdata.setselectedoptions('mycheckbox', new list{'yes', 'no'}); // fill the value in the text input loadformdata.settextvalue('mytextinput', 'admin@salesforce.com'); // set the hint text for the text input loadformdata.settexthint('mytextinput', 'email address'); // set the label for the button loadformdata.setbuttonlabel('mybutton', 'save preferences'); in this section: loadformdata constructors loadformdata methods loadformdata constructors the following are constructors for loadformdata. in this section: loadformdata(data) creates an instance of the loadformdata class for running tests on any custom apex classes you create for preference manager. loadformdata(data) creates an instance of the loadformdata class for running tests on any custom apex classes you create for preference manager. signature public loadformdata(map data) parameters data type: mapmap maps preference form data from the field id to the field properties. usage this constructor is available in api version 56.0 and later. loadformdata methods the following are methods for loadformdata. 2449apex reference guide loadformdata class in this section: addoption(fieldid, value, label) add an option for a checkbox, picklist, or radio button field in a preference form using the label and value. addoption(fieldid, option) add a defined, selectable option for a checkbox, picklist, or radio button field in a preference form. addselectedoption(fieldid, option) add a selected option for a checkbox field in a preference form. this requires the field on the form to have a defined option with a set value. setbuttonlabel(fieldid, label) set the label of a button added to the preference form. setoptions(fieldid, options) add a list of selectable options for a field on a preference form. setselectedoption(fieldid, optionvalue) for a picklist or radio button field on a preference form that has defined values, set the value entered in the optionvalue field as the selected option. setselectedoptions(fieldid, options) for an existing checkbox field on a preference form that has defined values, set the values entered in the options field as the selected options. this requires the field on the form to have defined options with a set value. settexthint(fieldid, hinttext) set the hint text inside a text input field. the hint text tells the user what type of information to enter, like an email address. settextvalue(fieldid, value) set the value of a text field in a preference form. addoption(fieldid, value, label) add an option for a checkbox, picklist, or radio button field in a preference form using the label and value. signature public void addoption(string fieldid, string value, string label) parameters fieldid type: string identifies a field in the preference form. value type: string represents the selection or text entered in a preference form field. label type: string the label for the value of a field in a preference form. 2450apex reference guide loadformdata class return value type: void addoption(fieldid, option) add a defined, selectable option for a checkbox, picklist, or radio button field in a preference form. signature public void addoption(string fieldid, system.selectoption option) parameters fieldid type: string identifies a field in the preference form. option type: system.selectoption the option selected on a field in the preference form. return value type: void addselectedoption(fieldid, option) add a selected option for a checkbox field in a preference form. this requires the field on the form to have a defined option with a set value. signature public void addselectedoption(string fieldid, string option) parameters fieldid type: string identifies a field in the preference form. option type: string the" "selectable option being added. return value type: void 2451apex reference guide loadformdata class setbuttonlabel(fieldid, label) set the label of a button added to the preference form. signature public void setbuttonlabel(string fieldid, string label) parameters fieldid type: string identifies a field in the preference form. label type: string the label for a button added to the preference form. return value type: void setoptions(fieldid, options) add a list of selectable options for a field on a preference form. signature public void setoptions(string fieldid, list options) parameters fieldid type: string identifies a field in the preference form. options type: list the selectable options for a field in the preference form. return value type: void setselectedoption(fieldid, optionvalue) for a picklist or radio button field on a preference form that has defined values, set the value entered in the optionvalue field as the selected option. 2452apex reference guide loadformdata class signature public void setselectedoption(string fieldid, string optionvalue) parameters fieldid type: string identifies a field in the preference form. optionvalue type: string the value for the selected option. return value type: void setselectedoptions(fieldid, options) for an existing checkbox field on a preference form that has defined values, set the values entered in the options field as the selected options. this requires the field on the form to have defined options with a set value. signature public void setselectedoptions(string fieldid, list options) parameters fieldid type: string identifies the checkbox field in the preference form. options type: list the selected options for a field in the preference form. return value type: void settexthint(fieldid, hinttext) set the hint text inside a text input field. the hint text tells the user what type of information to enter, like an email address. signature public void settexthint(string fieldid, string hinttext) 2453apex reference guide loadparameters class parameters fieldid type: string the id of the text input field in the preference form. hinttext type: string the hint text in the text input field. return value type: void settextvalue(fieldid, value) set the value of a text field in a preference form. signature public void settextvalue(string fieldid, string value) parameters fieldid type: string identifies a field in the preference form. value type: string represents the value entered for the text field in a preference form. return value type: void loadparameters class contains methods to retrieve record id information for parameters passed into the load-form handler. namespace pref_center example string userid = loadparams.getrecordid(); user user = [select id, aboutme from user where id=:userid]; 2454apex reference guide preferencecenterapexhandler interface in this section: loadparameters methods loadparameters methods the following are methods for loadparameters. in this section: getrecordid() returns the untokenized version of the record id. getrecordid() returns the untokenized version of the record id. signature public string getrecordid() return value type: string preferencecenterapexhandler interface pass data between your organization and a form in preference manager. namespace pref_center in this section: preferencecenterapexhandler methods preferencecenterapexhandler methods the following are methods for preferencecenterapexhandler. in this section: load(loadparams, formdata, validationresult) retrieve the record ids and initial values from a preference form before it is edited and submitted. submit(loadparams, formdata, validationresult) updates the changed values of fields when the preference form is submitted. 2455apex reference guide preferencecenterapexhandler interface load(loadparams, formdata, validationresult) retrieve the record ids and initial values from a preference form before it is edited and submitted. signature public pref_center.loadformdata load(pref_center.loadparameters loadparams, pref_center.loadformdata formdata, pref_" "center.validationresult validationresult) parameters loadparams type: pref_center.loadparameters retrieve the tokenized record id. formdata type: pref_center.loadformdata set the initial values of fields in a form before they are edited. validationresult type: pref_center.validationresult reserved for future use. return value type: pref_center.loadformdata submit(loadparams, formdata, validationresult) updates the changed values of fields when the preference form is submitted. signature public void submit(pref_center.submitparameters submitparams, pref_center.submitformdata formdata, pref_center.validationresult validationresult) parameters submitparams type: pref_center.submitparameters retrieve the tokenized record id. formdata type: pref_center.submitformdata retrieve the values of fields in a submitted form. validationresult type: pref_center.validationresult reserved for future use. 2456apex reference guide submitformdata class return value type: void submitformdata class contains methods to retrieve information on buttons and options selected in a preference form. namespace pref_center example use methods in the submitformdata class to retrieve the selected values in different form components: string buttonclickedid = formdata.getbuttonclicked(); if (buttonclickedid == 'submitbutton') { // handle form submit } else if (buttonclickedid == 'cancelbutton') { // handle form cancel } string picklistvalueold = formdata.getoldselectedvalue('mypicklist'); string picklistvaluenew = formdata.getselectedvalue('mypicklist'); if (picklistvalueold != picklistvaluenew) { // do something } list checkboxvaluesold = formdata.getoldselectedvalues('mycheckbox'); list checkboxvaluesnew = formdata.getselectedvalues('mycheckbox'); if (checkboxvaluesold != null && checkboxvaluesnew != null && (checkboxvaluesold.size() != checkboxvaluesnew.size())) { // do something } string textinputvalueold = formdata.getoldstringvalue('mytextinput'); string textinputvaluenew = formdata.getstringvalue('mytextinput'); if (textinputvalueold != textinputvaluenew) { // do something } in this section: submitformdata methods submitformdata methods the following are methods for submitformdata. 2457apex reference guide submitformdata class in this section: getbuttonclicked() returns the field id of the button that was clicked in the preference form. for example, use this method to determine if the clicked button was submit or cancel. getoldselectedvalue(fieldid) returns the value that was set for the specified field when the preference form was previously edited by the user. this method is used for field types such as picklist or radio buttons. getoldselectedvalues(fieldid) returns a list of the string values that were set on a checkbox field when the preference form was previously edited by the user. getoldstringvalue(fieldid) returns the string value that was set on a field when the preference form was loaded. this method is used for field types such as text, and throws a typeexception if used with a field that can return more than one value, like a checkbox field. getselectedvalue(fieldid) returns the string value that is currently selected for a picklist or radio button field in the preference form. getselectedvalues(fieldid) returns a list of string values that are currently selected on a checkbox field in the preference form. getstringvalue(fieldid) returns the string value that was set on a field when the preference form was loaded. this method is used for field types such as text. getbuttonclicked() returns the field id of the button that was clicked in the preference form. for example, use this method to determine if the clicked button was submit or cancel. signature public string getbuttonclicked() return value type: string getoldselectedvalue(fieldid) returns the value that was set for the specified field when the preference form was previously edited by the user. this method is used for field types such as picklist or radio buttons. signature public string getoldselectedvalue(string fieldid) parameters fieldid type: string 2458apex" "reference guide submitformdata class identifies a field in the preference form. return value type: string getoldselectedvalues(fieldid) returns a list of the string values that were set on a checkbox field when the preference form was previously edited by the user. signature public list getoldselectedvalues(string fieldid) parameters fieldid type: string identifies a field in the preference form. return value type: list getoldstringvalue(fieldid) returns the string value that was set on a field when the preference form was loaded. this method is used for field types such as text, and throws a typeexception if used with a field that can return more than one value, like a checkbox field. signature public string getoldstringvalue(string fieldid) parameters fieldid type: string identifies a field in the preference form. return value type: string getselectedvalue(fieldid) returns the string value that is currently selected for a picklist or radio button field in the preference form. signature public string getselectedvalue(string fieldid) 2459apex reference guide submitparameters class parameters fieldid type: string identifies a field in the preference form. return value type: string getselectedvalues(fieldid) returns a list of string values that are currently selected on a checkbox field in the preference form. signature public list getselectedvalues(string fieldid) parameters fieldid type: string identifies a field in the preference form. return value type: list getstringvalue(fieldid) returns the string value that was set on a field when the preference form was loaded. this method is used for field types such as text. signature public string getstringvalue(string fieldid) parameters fieldid type: string identifies a field in the preference form. return value type: string submitparameters class retrieve record id information to use with your submit-form handler. 2460apex reference guide tokentype enum namespace pref_center example string userid = submitparams.getrecordid(); user user = [select id, aboutme from user where id=:userid]; in this section: submitparameters methods submitparameters methods the following are methods for submitparameters. in this section: getrecordid() returns the untokenized version of the record id. getrecordid() returns the untokenized version of the record id. signature public string getrecordid() return value type: string tokentype enum defines the types of values supported by the tokenutility methods. enum values the following are the values of the pref_center.tokentype enum. value description email identifies the token as an email address. standard identifies the token as a salesforce record id. this is the default token type. 2461apex reference guide tokenutility class tokenutility class generate authentication tokens to access preference forms. namespace pref_center example call the generatetoken() method to generate a single token for a specified salesforce record id: individual individual = [select id from individual limit 1]; string token = pref_center.tokenutility.generatetoken(individual.id); // do something with the token system.debug(token) call the generatetokens() method to generate tokens in bulk when given a list of salesforce record ids: list individualids = new list(); // get ids of individuals who have not opted out of tracking for (individual individual : [select id from individual where hasoptedouttracking = false]) { individualids.add(individual.id); } // generate tokens for the list of individual record ids map tokens = pref_center.tokenutility.generatetokens(individualids); string firstindividualid = individualids[0]; // the returned map has the input record id as key and the corresponding token as value string tokenforfirstindividual = tokens.get(firstindividualid); // do something with the token system.debug(tokenforfirstindividual); in this section: tokenutility methods tokenutility methods the following are methods for tokenutility. in this section: generatetoken(tokenvalue, tokentype) returns the authentication token for the specified token value using the given token type. generatetoken" "(tokenvalue) returns the authentication token for the specified token value using the default standard token type. generatetokens(tokenvalues, tokentype) returns the authentication tokens in the form of a map, where the map key is the input value to be tokenized and the map value is the corresponding token. the given token type is used to generate the tokens. 2462apex reference guide tokenutility class generatetokens(tokenvalues) returns the generated tokens in the form of a map. this method uses the default standard token type to generate the tokens. generatetoken(tokenvalue, tokentype) returns the authentication token for the specified token value using the given token type. signature public static string generatetoken(string tokenvalue, pref_center.tokentype tokentype) parameters tokenvalue type: string the value passed to loadparameters.getrecordid() and submitparameters.getrecordid(). identifies the entity that the preference form is acting on. tokentype type: pref_center.tokentype specifies the type of the value to be encrypted with authentication tokens. return value type: string generatetoken(tokenvalue) returns the authentication token for the specified token value using the default standard token type. signature public static string generatetoken(string tokenvalue) parameters tokenvalue type: string identifies the entity that the preference form is acting on. the value passed to loadparameters.getrecordid() and submitparameters.getrecordid(). return value type: string generatetokens(tokenvalues, tokentype) returns the authentication tokens in the form of a map, where the map key is the input value to be tokenized and the map value is the corresponding token. the given token type is used to generate the tokens. 2463apex reference guide validationresult class signature public static map generatetokens(list tokenvalues, pref_center.tokentype tokentype) parameters tokenvalues type: list the values passed to loadparameters.getrecordid() and submitparameters.getrecordid(). identifies the entity that the preference form is acting on. contains multiple values to be encrypted with authentication tokens. tokentype type: pref_center.tokentype specifies the type of the value to be encrypted with authentication tokens. return value type: map generatetokens(tokenvalues) returns the generated tokens in the form of a map. this method uses the default standard token type to generate the tokens. signature public static map generatetokens(list tokenvalues) parameters tokenvalues type: list the list of string values passed to loadparameters.getrecordid() and submitparameters.getrecordid(). contains multiple values to be encrypted with authentication tokens. return value type: map, where the map key is the input value to be tokenized and the map value is the corresponding token. validationresult class this class is reserved for future use with preference manager. namespace pref_center 2464apex reference guide process namespace process namespace the process namespace provides an interface and classes for passing data between your organization and a flow. the following are the interfaces and classes in the process namespace. in this section: plugin interface allows you to pass data between your organization and a specified flow. plugindescriberesult class describes the input and output parameters for process.pluginresult. plugindescriberesult.inputparameter class describes the input parameter for process.pluginresult. plugindescriberesult.outputparameter class describes the output parameter for process.pluginresult. pluginrequest class passes input parameters from the class that implements the process.plugin interface to the flow. pluginresult class returns output parameters from the class that implements the process.plugin interface to the flow. plugin interface allows you to pass data between your organization and a specified flow. namespace process tip: we recommend using the @invocablemethod annotation instead of the process.plugin interface. • the interface doesn’t support blob, collection, sobject, and time data types, and it doesn’t support bulk operations. once you implement the interface on a class, the class can be referenced only from flows. • the annotation supports all data types and bulk operations. once you implement the annotation on a class, the class can be referenced from flows, processes, and the custom invocable actions rest api endpoint. in this section: plugin methods plugin example implementation plugin methods the" "following are instance methods for plugin. 2465apex reference guide plugin interface in this section: describe() returns a process.plugindescriberesult object that describes this method call. invoke(request) primary method that the system invokes when the class that implements the interface is instantiated. describe() returns a process.plugindescriberesult object that describes this method call. signature public process.plugindescriberesult describe() return value type: process.plugindescriberesult invoke(request) primary method that the system invokes when the class that implements the interface is instantiated. signature public process.pluginresult invoke(process.pluginrequest request) parameters request type: process.pluginrequest return value type: process.pluginresult plugin example implementation global class flowchat implements process.plugin { // the main method to be implemented. the flow calls this at run time. global process.pluginresult invoke(process.pluginrequest request) { // get the subject of the chatter post from the flow string subject = (string) request.inputparameters.get('subject'); // use the chatter apis to post it to the current user's feed feeditem fitem = new feeditem(); fitem.parentid = userinfo.getuserid(); fitem.body = 'flow update: ' + subject; insert fitem; 2466apex reference guide plugindescriberesult class // return to flow map result = new map(); return new process.pluginresult(result); } // returns the describe information for the interface global process.plugindescriberesult describe() { process.plugindescriberesult result = new process.plugindescriberesult(); result.name = 'flowchatplugin'; result.tag = 'chat'; result.inputparameters = new list{ new process.plugindescriberesult.inputparameter('subject', process.plugindescriberesult.parametertype.string, true) }; result.outputparameters = new list{ }; return result; } } test class the following is a test class for the above class. @istest private class flowchattest { static testmethod void flowchattests() { flowchat plugin = new flowchat(); map inputparams = new map(); string feedsubject = 'flow is alive'; inputparams.put('subject', feedsubject); process.pluginrequest request = new process.pluginrequest(inputparams); plugin.invoke(request); } } plugindescriberesult class describes the input and output parameters for process.pluginresult. namespace process 2467apex reference guide plugindescriberesult class tip: we recommend using the @invocablemethod annotation instead of the process.plugin interface. • the interface doesn’t support blob, collection, sobject, and time data types, and it doesn’t support bulk operations. once you implement the interface on a class, the class can be referenced only from flows. • the annotation supports all data types and bulk operations. once you implement the annotation on a class, the class can be referenced from flows, processes, and the custom invocable actions rest api endpoint. in this section: plugindescriberesult constructors plugindescriberesult properties plugindescriberesult constructors the following are constructors for plugindescriberesult. in this section: plugindescriberesult() creates a new instance of the process.plugindescriberesult class. plugindescriberesult() creates a new instance of the process.plugindescriberesult class. signature public plugindescriberesult() plugindescriberesult properties the following are properties for plugindescriberesult. in this section: description this optional field describes the purpose of the plug-in. inputparameters the input parameters passed by the process.pluginrequest class from a flow to the class that implements the process.plugin interface. name unique name of the plug-in. outputparameters the output parameters passed by the process.pluginresult class from the class that implements the process.plugin interface to the flow. 2468apex reference guide plugindescriberesult class description this optional field describes the purpose of the plug-in. signature public string description {get; set;} property value type: string usage size limit: 255 characters. inputparameters" "the input parameters passed by the process.pluginrequest class from a flow to the class that implements the process.plugin interface. signature public list inputparameters {get; set;} property value type: list name unique name of the plug-in. signature public string name {get; set;} property value type: string usage size limit: 40 characters. outputparameters the output parameters passed by the process.pluginresult class from the class that implements the process.plugin interface to the flow. 2469apex reference guide plugindescriberesult.inputparameter class signature public list outputparameters {get; set;} property value type: list plugindescriberesult.inputparameter class describes the input parameter for process.pluginresult. namespace process tip: we recommend using the @invocablemethod annotation instead of the process.plugin interface. • the interface doesn’t support blob, collection, sobject, and time data types, and it doesn’t support bulk operations. once you implement the interface on a class, the class can be referenced only from flows. • the annotation supports all data types and bulk operations. once you implement the annotation on a class, the class can be referenced from flows, processes, and the custom invocable actions rest api endpoint. in this section: plugindescriberesult.inputparameter constructors plugindescriberesult.inputparameter properties plugindescriberesult.inputparameter constructors the following are constructors for plugindescriberesult.inputparameter. in this section: plugindescriberesult.inputparameter(name, description, parametertype, required) creates a new instance of the process.plugindescriberesult.inputparameter class using the specified name, description, parameter type, and required option. plugindescriberesult.inputparameter(name, parametertype, required) creates a new instance of the process.plugindescriberesult.inputparameter class using the specified name, parameter type, and required option. plugindescriberesult.inputparameter(name, description, parametertype, required) creates a new instance of the process.plugindescriberesult.inputparameter class using the specified name, description, parameter type, and required option. 2470apex reference guide plugindescriberesult.inputparameter class signature public plugindescriberesult.inputparameter(string name, string description, process.plugindescriberesult.parametertype parametertype, boolean required) parameters name type: string unique name of the plug-in. description type: string describes the purpose of the plug-in. parametertype type: process.plugindescriberesult.parametertype the data type of the input parameter. required type: boolean set to true for required and false otherwise. plugindescriberesult.inputparameter(name, parametertype, required) creates a new instance of the process.plugindescriberesult.inputparameter class using the specified name, parameter type, and required option. signature public plugindescriberesult.inputparameter(string name, process.plugindescriberesult.parametertype parametertype, boolean required) parameters name type: string unique name of the plug-in. parametertype type: process.plugindescriberesult.parametertype the data type of the input parameter. required type: boolean set to true for required and false otherwise. plugindescriberesult.inputparameter properties the following are properties for plugindescriberesult.inputparameter. 2471apex reference guide plugindescriberesult.inputparameter class in this section: description this optional field describes the purpose of the plug-in. name unique name of the plug-in. parametertype the data type of the input parameter. required set to true for required and false otherwise. description this optional field describes the purpose of the plug-in. signature public string description {get; set;} property value type: string usage size limit: 255 characters. name unique name of the plug-in. signature public string name {get; set;} property value type: string usage size limit: 40 characters. parametertype the data type of the input parameter. signature public process.plugindescriberesult.parametertype parametertype {get; set;} 2472apex reference guide plugin" "describeresult.outputparameter class property value type: process.plugindescriberesult.parametertype required set to true for required and false otherwise. signature public boolean required {get; set;} property value type: boolean plugindescriberesult.outputparameter class describes the output parameter for process.pluginresult. namespace process tip: we recommend using the @invocablemethod annotation instead of the process.plugin interface. • the interface doesn’t support blob, collection, sobject, and time data types, and it doesn’t support bulk operations. once you implement the interface on a class, the class can be referenced only from flows. • the annotation supports all data types and bulk operations. once you implement the annotation on a class, the class can be referenced from flows, processes, and the custom invocable actions rest api endpoint. in this section: plugindescriberesult.outputparameter constructors plugindescriberesult.outputparameter properties plugindescriberesult.outputparameter constructors the following are constructors for plugindescriberesult.outputparameter. in this section: plugindescriberesult.outputparameter(name, description, parametertype) creates a new instance of the process.plugindescriberesult.outputparameter class using the specified name, description, and parameter type. plugindescriberesult.outputparameter(name, parametertype) creates a new instance of the process.plugindescriberesult.outputparameter class using the specified name, description, and parameter type. 2473apex reference guide plugindescriberesult.outputparameter class plugindescriberesult.outputparameter(name, description, parametertype) creates a new instance of the process.plugindescriberesult.outputparameter class using the specified name, description, and parameter type. signature public plugindescriberesult.outputparameter(string name, string description, process.plugindescriberesult.parametertype parametertype) parameters name type: string unique name of the plug-in. description type: string describes the purpose of the plug-in. parametertype type: process.plugindescriberesult.parametertype the data type of the input parameter. plugindescriberesult.outputparameter(name, parametertype) creates a new instance of the process.plugindescriberesult.outputparameter class using the specified name, description, and parameter type. signature public plugindescriberesult.outputparameter(string name, process.plugindescriberesult.parametertype parametertype) parameters name type: string unique name of the plug-in. parametertype type: process.plugindescriberesult.parametertype the data type of the input parameter. plugindescriberesult.outputparameter properties the following are properties for plugindescriberesult.outputparameter. 2474apex reference guide plugindescriberesult.outputparameter class in this section: description this optional field describes the purpose of the plug-in. name unique name of the plug-in. parametertype the data type of the input parameter. description this optional field describes the purpose of the plug-in. signature public string description {get; set;} property value type: string usage size limit: 255 characters. name unique name of the plug-in. signature public string name {get; set;} property value type: string usage size limit: 40 characters. parametertype the data type of the input parameter. signature public process.plugindescriberesult.parametertype parametertype {get; set;} 2475apex reference guide pluginrequest class property value type: process.plugindescriberesult.parametertype pluginrequest class passes input parameters from the class that implements the process.plugin interface to the flow. namespace process tip: we recommend using the @invocablemethod annotation instead of the process.plugin interface. • the interface doesn’t support blob, collection, sobject, and time data types, and it doesn’t support bulk operations. once you implement the interface on a class, the class can be referenced only from flows. • the annotation supports all data types and bulk operations. once you implement the annotation on a class, the class can be referenced from flows, processes, and the custom invocable actions rest api endpoint. pluginrequest properties the following are properties for pluginrequest. in this section: inputparameters input parameters that are passed from the class that implements the process.plugin interface to the flow. inputparameters input" "parameters that are passed from the class that implements the process.plugin interface to the flow. signature public map inputparameters {get; set;} property value type: map pluginresult class returns output parameters from the class that implements the process.plugin interface to the flow. tip: we recommend using the @invocablemethod annotation instead of the process.plugin interface. • the interface doesn’t support blob, collection, sobject, and time data types, and it doesn’t support bulk operations. once you implement the interface on a class, the class can be referenced only from flows. • the annotation supports all data types and bulk operations. once you implement the annotation on a class, the class can be referenced from flows, processes, and the custom invocable actions rest api endpoint. 2476apex reference guide quickaction namespace namespace process pluginresult properties the following are properties for pluginresult. in this section: outputparameters output parameters returned from the class that implements the interface to the flow. outputparameters output parameters returned from the class that implements the interface to the flow. signature public map outputparameters {get; set;} property value type: map quickaction namespace the quickaction namespace provides classes and methods for quick actions. the following are the classes in the quickaction namespace. in this section: describeavailablequickactionresult class contains describe metadata information for a quick action that is available for a specified parent. describelayoutcomponent class represents the smallest unit in a layout—a field or a separator. describelayoutitem class represents an individual item in a quickaction.describelayoutrow. describelayoutrow class represents a row in a quickaction.describelayoutsection. describelayoutsection class represents a section of a layout and consists of one or more columns and one or more rows (an array of quickaction.describelayoutrow). describequickactiondefaultvalue class returns a default value for a quick action. 2477apex reference guide describeavailablequickactionresult class describequickactionresult class contains describe metadata information for a quick action. quickactiondefaults class represents an abstract apex class that provides the context for running the standard email action on case feed and the container of the email message fields for the action payload. you can override the target fields before the standard email action is rendered. quickactiondefaultshandler interface the quickaction.quickactiondefaultshandler interface lets you specify the default values for the standard email and send email actions in the case feed. you can use this interface to specify the from address, cc address, bcc address, subject, and email body for the email action in the case feed. you can use the interface to pre-populate these fields based on the context where the action is displayed, such as the case origin (for example, country) and subject. quickactionrequest class use the quickaction.quickactionrequest class for providing action information for quick actions to be performed by quickaction class methods. action information includes the action name, context record id, and record. quickactionresult class after you initiate a quick action with the quickaction class, use the quickactionresult class for processing action results. sendemailquickactiondefaults class represents an apex class that provides: the from address list; the original email’s email message id, provided that the reply action was invoked on the email message feed item; and methods to specify related settings on templates. you can override these fields before the standard email action is rendered. describeavailablequickactionresult class contains describe metadata information for a quick action that is available for a specified parent. namespace quickaction usage the quickaction describeavailablequickactions method returns an array of available quick action describe result objects (quickaction.describeavailablequickactionresult). describeavailablequickactionresult methods the following are methods for describeavailablequickactionresult. all are instance methods. in this section: getactionenumorid() returns the unique id for the action. if the action doesn’t have an id, its api name is used. getlabel() the quick action label. 2478apex reference guide describeavailablequickactionresult class getname() the quick action name. gettype() the quick action type. getactionenumorid() returns the unique id for the action. if the action doesn’t have an id, its api name is used. signature" "public string getactionenumorid() return value type: string getlabel() the quick action label. signature public string getlabel() return value type: string getname() the quick action name. signature public string getname() return value type: string gettype() the quick action type. signature public string gettype() 2479apex reference guide describelayoutcomponent class return value type: string describelayoutcomponent class represents the smallest unit in a layout—a field or a separator. namespace quickaction describelayoutcomponent methods the following are methods for describelayoutcomponent. all are instance methods. in this section: getdisplaylines() returns the vertical lines displayed for a field. applies to textarea and multi-select picklist fields. gettaborder() returns the tab order for the item in the row. gettype() returns the name of the quickaction.describelayoutcomponent type for this component. getvalue() returns the name of the field if the type for quickaction.describelayoutcomponent is textarea. getdisplaylines() returns the vertical lines displayed for a field. applies to textarea and multi-select picklist fields. signature public integer getdisplaylines() return value type: integer gettaborder() returns the tab order for the item in the row. signature public integer gettaborder() 2480apex reference guide describelayoutitem class return value type: integer gettype() returns the name of the quickaction.describelayoutcomponent type for this component. signature public string gettype() return value type: string getvalue() returns the name of the field if the type for quickaction.describelayoutcomponent is textarea. signature public string getvalue() return value type: string describelayoutitem class represents an individual item in a quickaction.describelayoutrow. namespace quickaction usage for most fields on a layout, there is only one component per layout item. however, in a display-only view, the quickaction.describelayoutitem might be a composite of the individual fields (for example, an address can consist of street, city, state, country, and postal code data). on the corresponding edit view, each component of the address field would be split up into separate quickaction.describelayoutitems. describelayoutitem methods the following are methods for describelayoutitem. all are instance methods. 2481apex reference guide describelayoutitem class in this section: getlabel() returns the label text for this item. getlayoutcomponents() returns a list of quickaction.describelayoutcomponents for this item. iseditablefornew() indicates whether this item can be edited for new (true) or not (false). iseditableforupdate() indicates whether this item can be edited for update(true) or not (false). isplaceholder() indicates whether this item is a placeholder (true) or not (false). if true, then this item is blank. isrequired() indicates whether this item is required (true) or not (false). getlabel() returns the label text for this item. signature public string getlabel() return value type: string getlayoutcomponents() returns a list of quickaction.describelayoutcomponents for this item. signature public list getlayoutcomponents() return value type: list iseditablefornew() indicates whether this item can be edited for new (true) or not (false). signature public boolean iseditablefornew() 2482" "apex reference guide describelayoutrow class return value type: boolean iseditableforupdate() indicates whether this item can be edited for update(true) or not (false). signature public boolean iseditableforupdate() return value type: boolean isplaceholder() indicates whether this item is a placeholder (true) or not (false). if true, then this item is blank. signature public boolean isplaceholder() return value type: boolean isrequired() indicates whether this item is required (true) or not (false). signature public boolean isrequired() return value type: boolean usage this is useful if, for example, you want to render required fields in a contrasting color. describelayoutrow class represents a row in a quickaction.describelayoutsection. namespace quickaction 2483apex reference guide describelayoutsection class usage a quickaction.describelayoutrow consists of one or more quickaction.describelayoutitem objects. for each quickaction.describelayoutrow, a quickaction.describelayoutitem refers either to a specific field or to an “empty” quickaction.describelayoutitem (one that contains no quickaction.describelayoutcomponent objects). an empty quickaction.describelayoutitem can be returned when a given quickaction.describelayoutrow is sparse (for example, containing more fields on the right column than on the left column). describelayoutrow methods the following are methods for describelayoutrow. all are instance methods. in this section: getlayoutitems() returns either a specific field or an empty quickaction.describelayoutitem (one that contains no quickaction.describelayoutcomponent objects). getnumitems() returns the number of quickaction.describelayoutitem. getlayoutitems() returns either a specific field or an empty quickaction.describelayoutitem (one that contains no quickaction.describelayoutcomponent objects). signature public list getlayoutitems() return value type: list getnumitems() returns the number of quickaction.describelayoutitem. signature public integer getnumitems() return value type: integer describelayoutsection class represents a section of a layout and consists of one or more columns and one or more rows (an array of quickaction.describelayoutrow). 2484apex reference guide describelayoutsection class namespace quickaction describelayoutsection properties the following are properties for describelayoutsection. collapsed the current view of the record details section: collapsed (true) or expanded (false). signature public boolean collapsed {get; set;} property value type: boolean layoutsectionid the unique id of the record details section in the layout. signature public id layoutsectionid {get; set;} property value type: id describelayoutsection methods the following are methods for describelayoutsection. in this section: getcolumns() returns the number of columns in the quickaction.describelayoutsection. getheading() the heading text (label) for the quickaction.describelayoutsection. getlayoutrows() returns an array of one or more quickaction.describelayoutrow objects. getlayoutsectionid() returns the id of the record details section in the layout. getparentlayoutid() returns the id of the layout upon which this describelayoutsection resides. 2485apex reference guide describelayoutsection class getrows() returns the number of rows in the quickaction.describelayoutsection. iscollapsed() indicates whether the record details section is collapsed (true) or expanded (false). if you build your own app, you can use this method to see whether the current user collapsed a section, and respect that preference in your own ui. isusecollapsiblesection() indicates whether the quickaction.describelayoutsection is a collapsible section (true) or not (false). isuseheading() indicates whether to use the heading (true) or not (false). getcolumns() returns the number of columns in the quickaction.describelayoutsection. signature public integer getcolumns() return value type: integer getheading() the heading text (label) for the quickaction.describelayoutsection. signature public string getheading() return value type: string getlayoutrows()" "returns an array of one or more quickaction.describelayoutrow objects. signature public list getlayoutrows() return value type: list getlayoutsectionid() returns the id of the record details section in the layout. 2486apex reference guide describelayoutsection class signature public id getlayoutsectionid() return value type: id getparentlayoutid() returns the id of the layout upon which this describelayoutsection resides. signature public id getparentlayoutid() return value type: id getrows() returns the number of rows in the quickaction.describelayoutsection. signature public integer getrows() return value type: integer iscollapsed() indicates whether the record details section is collapsed (true) or expanded (false). if you build your own app, you can use this method to see whether the current user collapsed a section, and respect that preference in your own ui. signature public boolean iscollapsed() return value type: boolean isusecollapsiblesection() indicates whether the quickaction.describelayoutsection is a collapsible section (true) or not (false). 2487apex reference guide describequickactiondefaultvalue class signature public boolean isusecollapsiblesection() return value type: boolean isuseheading() indicates whether to use the heading (true) or not (false). signature public boolean isuseheading() return value type: boolean describequickactiondefaultvalue class returns a default value for a quick action. namespace quickaction usage represents the default values of fields to use in default layouts. describequickactiondefaultvalue methods the following are methods for describequickactiondefaultvalue. all are instance methods. in this section: getdefaultvalue() returns the default value of the quick action. getfield() returns the field name of the action. getdefaultvalue() returns the default value of the quick action. 2488apex reference guide describequickactionresult class signature public string getdefaultvalue() return value type: string getfield() returns the field name of the action. signature public string getfield() return value type: string describequickactionresult class contains describe metadata information for a quick action. namespace quickaction usage the quickaction describequickactions method returns an array of quick action describe result objects (quickaction.describequickactionresult). in this section: describequickactionresult properties describequickactionresult methods describequickactionresult properties the following are properties for describequickactionresult. in this section: canvasapplicationname the name of the canvas application invoked by the custom action. colors array of color information. each color is associated with a theme. 2489apex reference guide describequickactionresult class contextsobjecttype the object used for the action. was getsourcesobjecttype() in api version 29.0 and earlier. defaultvalues the action’s default values. flowdevname if the custom action invokes a flow, the fully qualified name of the flow. flowrecordidvar if the custom action invokes a flow, the input variable that the custom action passes the record’s id to. height the height in pixels of the action pane. iconname the name of the icon used for the action. if a custom icon is not used, this value isn’t set. icons array of icons. each icon is associated with a theme. iconurl the url of the icon used for the action. this icon url corresponds to the 32x32 icon used for the current salesforce theme, introduced in spring ’10, or the custom icon, if there is one. layout the section of the layout where the action resides. lightningcomponentbundleid if the custom action invokes a lightning component, the id of the lightning component bundle to which the component belongs. lightningcomponentbundlename if the custom action invokes a lightning component, the name of the lightning component bundle to which the component belongs. lightningcomponentqualifiedname the fully qualified name of the lightning component invoked by the custom action. miniiconurl the icon’s url. this icon url corresponds to the 16x16 icon used for the current salesforce theme, introduced in spring ’10, or the custom icon, if" "there is one. showquickactionlcheader indicates whether the lightning component quick action header and footer are shown. if false, then both the header containing the quick action title and the footer containing the save and cancel buttons aren’t displayed. showquickactionvfheader indicates whether the visualforce quick action header and footer should be shown. if false, then both the header containing the quick action title and the footer containing the save and cancel buttons aren’t displayed. targetparentfield the parent object type of the action. links the target object to the parent object. for example, the value is account if the target object is contact and the parent object is account. targetrecordtypeid the record type of the target record. 2490apex reference guide describequickactionresult class targetsobjecttype the action’s target object type. visualforcepagename the name of the visualforce page associated with the custom action. visualforcepageurl the url of the visualforce page associated with the action. width the width in pixels of the action pane, for custom actions that call visualforce pages, canvas apps, or lightning components. canvasapplicationname the name of the canvas application invoked by the custom action. signature public string canvasapplicationname {get; set;} property value type: string colors array of color information. each color is associated with a theme. signature public list colors {get; set;} property value type: list on page 2660 contextsobjecttype the object used for the action. was getsourcesobjecttype() in api version 29.0 and earlier. signature public string contextsobjecttype {get; set;} property value type: string defaultvalues the action’s default values. 2491apex reference guide describequickactionresult class signature public list defaultvalues {get; set;} property value type: list flowdevname if the custom action invokes a flow, the fully qualified name of the flow. signature public string flowdevname {get; set;} property value type: string flowrecordidvar if the custom action invokes a flow, the input variable that the custom action passes the record’s id to. signature public string flowrecordidvar {get; set;} property value type: string valid values are null or recordid. height the height in pixels of the action pane. signature public integer height {get; set;} property value type: integer iconname the name of the icon used for the action. if a custom icon is not used, this value isn’t set. 2492apex reference guide describequickactionresult class signature public string iconname {get; set;} property value type: string icons array of icons. each icon is associated with a theme. signature public list icons {get; set;} property value type: list if no custom icon was associated with the quick action and the quick action creates a specific object, the icons will correspond to the icons used for the created object. for example, if the quick action creates an account, the icon array will contain the icons used for account. if a custom icon was associated with the quick action, the array will contain that custom icon. iconurl the url of the icon used for the action. this icon url corresponds to the 32x32 icon used for the current salesforce theme, introduced in spring ’10, or the custom icon, if there is one. signature public string iconurl {get; set;} property value type: string layout the section of the layout where the action resides. signature public quickaction.describelayoutsection layout {get; set;} property value type: quickaction.describelayoutsection on page 2484 2493apex reference guide describequickactionresult class lightningcomponentbundleid if the custom action invokes a lightning component, the id of the lightning component bundle to which the component belongs. signature public string lightningcomponentbundleid {get; set;} property value type: string lightningcomponentbundlename if the custom action invokes a lightning component, the name of the lightning component bundle to which" "the component belongs. signature public string lightningcomponentbundlename {get; set;} property value type: string lightningcomponentqualifiedname the fully qualified name of the lightning component invoked by the custom action. signature public string lightningcomponentqualifiedname {get; set;} property value type: string miniiconurl the icon’s url. this icon url corresponds to the 16x16 icon used for the current salesforce theme, introduced in spring ’10, or the custom icon, if there is one. signature public string miniiconurl {get; set;} property value type: string 2494apex reference guide describequickactionresult class showquickactionlcheader indicates whether the lightning component quick action header and footer are shown. if false, then both the header containing the quick action title and the footer containing the save and cancel buttons aren’t displayed. signature public boolean showquickactionlcheader {get; set;} property value type: boolean showquickactionvfheader indicates whether the visualforce quick action header and footer should be shown. if false, then both the header containing the quick action title and the footer containing the save and cancel buttons aren’t displayed. signature public boolean showquickactionvfheader {get; set;} property value type: boolean targetparentfield the parent object type of the action. links the target object to the parent object. for example, the value is account if the target object is contact and the parent object is account. signature public string targetparentfield {get; set;} property value type: string targetrecordtypeid the record type of the target record. signature public string targetrecordtypeid {get; set;} property value type: string 2495apex reference guide describequickactionresult class targetsobjecttype the action’s target object type. signature public string targetsobjecttype {get; set;} property value type: string visualforcepagename the name of the visualforce page associated with the custom action. signature public string visualforcepagename {get; set;} property value type: string visualforcepageurl the url of the visualforce page associated with the action. signature public string visualforcepageurl {get; set;} property value type: string width the width in pixels of the action pane, for custom actions that call visualforce pages, canvas apps, or lightning components. signature public integer width {get; set;} property value type: integer describequickactionresult methods the following are methods for describequickactionresult. all are instance methods. 2496apex reference guide describequickactionresult class in this section: getactionenumorid() returns the unique id for the action. if the action doesn’t have an id, its api name is used. getcanvasapplicationname() returns the name of the canvas application, if used. getcolors() returns an array of color information. each color is associated with a theme. getcontextsobjecttype() returns the object used for the action. replaces getsourcesobjecttype() in api version 30.0 and later. getdefaultvalues() returns the default values for a action. getflowdevname() if the custom action invokes a flow, returns the fully qualified name of the flow invoked by the custom action. getflowrecordidvar() if the custom action invokes a flow, returns the input variable that the custom action passes the record’s id to. getheight() returns the height in pixels of the action pane. geticonname() returns the actions’ icon name. geticonurl() returns the url of the 32x32 icon used for the action. geticons() returns a list of schema.describeiconresult objects that describe colors used in a tab. getlabel() returns the action label. getlayout() returns the layout sections that comprise an action. getlightningcomponentbundleid() if the custom action invokes a lightning component, returns the id of the lightning component bundle to which the component belongs. getlightningcomponentbundlename() if the custom action invokes a lightning component, returns the name of the lightning component bundle to which the component belongs. getlightningcomponentqualifiedname() if the custom action invokes a lightning component, returns the fully qualified name of the lightning component invoked by the custom action. get" "miniiconurl() returns the 16x16 icon url. getname() returns the action name. 2497apex reference guide describequickactionresult class getshowquickactionlcheader() returns an indication of whether the lightning component quick action header and footer are shown. getshowquickactionvfheader() returns an indication of whether the visualforce quick action header and footer should be shown. getsourcesobjecttype() returns the object type used for the action. gettargetparentfield() returns the parent object’s type for the action. gettargetrecordtypeid() returns the record type of the targeted record. gettargetsobjecttype() returns the action’s target object type. gettype() returns a create or custom visualforce action. getvisualforcepagename() if visualforce is used, returns the name of the associated page for the action. getvisualforcepageurl() returns the url of the visualforce page associated with the action. getwidth() if a custom action is created, returns the width in pixels of the action pane. getactionenumorid() returns the unique id for the action. if the action doesn’t have an id, its api name is used. signature public string getactionenumorid() return value type: string getcanvasapplicationname() returns the name of the canvas application, if used. syntax public string getcanvasapplicationname() return value type: string 2498apex reference guide describequickactionresult class getcolors() returns an array of color information. each color is associated with a theme. signature public list getcolors() return value type: list getcontextsobjecttype() returns the object used for the action. replaces getsourcesobjecttype() in api version 30.0 and later. signature public string getcontextsobjecttype() return value type: string getdefaultvalues() returns the default values for a action. signature public list getdefaultvalues() return value type: list getflowdevname() if the custom action invokes a flow, returns the fully qualified name of the flow invoked by the custom action. signature public string getflowdevname() return value type: string getflowrecordidvar() if the custom action invokes a flow, returns the input variable that the custom action passes the record’s id to. 2499apex reference guide describequickactionresult class signature public string getflowrecordidvar() return value type: string getheight() returns the height in pixels of the action pane. signature public integer getheight() return value type: integer geticonname() returns the actions’ icon name. signature public string geticonname() return value type: string geticonurl() returns the url of the 32x32 icon used for the action. signature public string geticonurl() return value type: string geticons() returns a list of schema.describeiconresult objects that describe colors used in a tab. signature public list geticons() 2500apex reference guide describequickactionresult class return value type: list getlabel() returns the action label. signature public string getlabel() return value type: string getlayout() returns the layout sections that comprise an action. signature public quickaction.describelayoutsection getlayout() return value type: quickaction.describelayoutsection getlightningcomponentbundleid() if the custom action invokes a lightning component, returns the id of the lightning component bundle to which the component belongs. signature public string getlightningcomponentbundleid() return value type: string getlightningcomponentbundlename() if the custom action invokes a lightning component, returns the name of the lightning component bundle to which the component belongs. signature public string getlightningcomponentbundlename() 2501apex reference guide describequickactionresult class return value type: string getlightningcomponentqualifiedname() if the custom action invokes a lightning component, returns the fully qualified name of the lightning component invoked by the" "custom action. signature public string getlightningcomponentqualifiedname() return value type: string getminiiconurl() returns the 16x16 icon url. signature public string getminiiconurl() return value type: string getname() returns the action name. signature public string getname() return value type: string getshowquickactionlcheader() returns an indication of whether the lightning component quick action header and footer are shown. signature public boolean getshowquickactionlcheader() 2502apex reference guide describequickactionresult class return value type: boolean if false, then both the header containing the quick action title and the footer containing the save and cancel buttons aren’t displayed. getshowquickactionvfheader() returns an indication of whether the visualforce quick action header and footer should be shown. signature public boolean getshowquickactionvfheader() return value type: boolean if false, then both the header containing the quick action title and the footer containing the save and cancel buttons aren’t displayed. getsourcesobjecttype() returns the object type used for the action. signature public string getsourcesobjecttype() return value type: string gettargetparentfield() returns the parent object’s type for the action. signature public string gettargetparentfield() return value type: string gettargetrecordtypeid() returns the record type of the targeted record. signature public string gettargetrecordtypeid() 2503apex reference guide describequickactionresult class return value type: string gettargetsobjecttype() returns the action’s target object type. signature public string gettargetsobjecttype() return value type: string gettype() returns a create or custom visualforce action. signature public string gettype() return value type: string getvisualforcepagename() if visualforce is used, returns the name of the associated page for the action. signature public string getvisualforcepagename() return value type: string getvisualforcepageurl() returns the url of the visualforce page associated with the action. signature public string getvisualforcepageurl() return value type: string 2504apex reference guide quickactiondefaults class getwidth() if a custom action is created, returns the width in pixels of the action pane. signature public integer getwidth() return value type: integer quickactiondefaults class represents an abstract apex class that provides the context for running the standard email action on case feed and the container of the email message fields for the action payload. you can override the target fields before the standard email action is rendered. namespace quickaction usage note: you cannot extend this abstract class. you can use the getter methods when using it in the context of quickaction.quickactiondefaultshandler. salesforce provides a class that extends this class (see quickaction.sendemailquickactiondefaults.) in this section: quickactiondefaults methods quickactiondefaults methods the following are methods for quickactiondefaults. in this section: getactionname() returns the name of the standard email action on case feed (case.email). getactiontype() returns the type of the standard email action on case feed (email). getcontextid() the id of the context related to the standard email action on case feed (case id). gettargetsobject() the target object of the standard email action on case feed (emailmessage). 2505apex reference guide quickactiondefaults class getactionname() returns the name of the standard email action on case feed (case.email). signature public string getactionname() return value type: string getactiontype() returns the type of the standard email action on case feed (email). signature public string getactiontype() return value type: string getcontextid() the id of the context related to the standard email action on case feed (case id). signature public id getcontextid() return value type: id gettargetsobject() the target object of the standard email action on case feed (emailmessage). signature public sobject gettargetsobject() return value type: sobject 2506apex reference guide quickactiondefaultshandler interface quickactiondefaultshandler interface the quickaction.quickactiondefaultshandler interface lets you specify the default values for" "the standard email and send email actions in the case feed. you can use this interface to specify the from address, cc address, bcc address, subject, and email body for the email action in the case feed. you can use the interface to pre-populate these fields based on the context where the action is displayed, such as the case origin (for example, country) and subject. namespace quickaction usage to specify default values for the standard email action in the case feed, create a class that implements quickaction.quickactiondefaultshandler. the quickaction.quickactiondefaultshandler interface works in salesforce classic and lightning experience. when working in lightning experience, keep the following things in mind: • the interface overrides email values set up with predefined ids. • the interface works with the out-of-the-box email action provided on cases. you can also use the interface with custom email actions for the case object. • the interface in lightning experience doesn’t support: – email attachments – custom email fields – visualforce email templates, which are a type of email template available in salesforce classic • the from field determines the from address picklist. while you can’t customize this picklist in send email action types via the quickactiondefaultshandler interface, you can customize the from address field. to customize this field, remove the from field from the sendemail quick action layout and add the from address field instead. then provide a valid and verified from address in the quickactiondefaultshandler code. this address must be the current user’s address, an organization-wide email address that the current user has access to, or an email-to-case routing address. • if your apex interface adds content to the email body, merge fields display as unresolved. during preview and send, the merge fields resolve. when you implement this interface, provide an empty parameterless constructor. in this section: quickactiondefaultshandler methods quickactiondefaultshandler example implementations quickactiondefaultshandler methods the following are methods for quickactiondefaultshandler. 2507apex reference guide quickactiondefaultshandler interface in this section: oninitdefaults(actiondefaults) implement this method to provide default values for the standard email action in the case feed. oninitdefaults(actiondefaults) implement this method to provide default values for the standard email action in the case feed. signature public void oninitdefaults(quickaction.quickactiondefaults[] actiondefaults) parameters actiondefaults type: quickaction.quickactiondefaults[] this array contains only one item of type quickaction.sendemailquickactiondefaults. return value type: void quickactiondefaultshandler example implementations these examples are implementations of the quickaction.quickactiondefaultshandler interface. in this example, the oninitdefaults method checks whether the element passed in the array is for the standard email action in the case feed. then, it performs a query to retrieve the case that corresponds to the context id. next, it sets the value of the bcc address of the corresponding email message to a default value. the default value is based on the case reason. finally, it sets the default values of the email template properties. the oninitdefaults method determines the default values based on two criteria: first, whether a reply action on an email message initiated the call to the method, and second, whether any previous emails attached to the case are associated with the call. global class emailpublisherloader implements quickaction.quickactiondefaultshandler { // empty constructor global emailpublisherloader() { } // the main interface method global void oninitdefaults(quickaction.quickactiondefaults[] defaults) { quickaction.sendemailquickactiondefaults sendemaildefaults = null; // check if the quick action is the standard case feed send email action for (integer j = 0; j < defaults.size(); j++) { if (defaults.get(j) instanceof quickaction.sendemailquickactiondefaults && defaults.get(j).gettargetsobject().getsobjecttype() == emailmessage.sobjecttype && defaults.get(j).getactionname().equals('case.email') && defaults.get(j).getactiontype().equals('email')) { sendemaildefaults = 2508apex reference guide quickactiondefaultshandler interface (quickaction.sendemailquickactiondefaults)defaults.get(j); break; } } if (sendemaildefaults != null) { case c = [select status, reason" "from case where id=:sendemaildefaults.getcontextid()]; emailmessage emailmessage = (emailmessage)sendemaildefaults.gettargetsobject(); // set bcc address to make sure each email goes for audit emailmessage.bccaddress = getbccaddress(c.reason); /* set template related fields when the in reply to id field is null we know the interface is called on page load. here we check if there are any previous emails attached to the case and load the 'new_case_created' or 'automatic_response' template. when the in reply to id field is not null we know that the interface is called on click of reply/reply all of an email and we load the 'default_reply_template' template */ if (sendemaildefaults.getinreplytoid() == null) { integer emailcount = [select count() from emailmessage where parentid=:sendemaildefaults.getcontextid()]; if (emailcount!= null && emailcount > 0) { sendemaildefaults.settemplateid( gettemplateidhelper('automatic_response')); } else { sendemaildefaults.settemplateid( gettemplateidhelper('new_case_created')); } sendemaildefaults.setinserttemplatebody(false); sendemaildefaults.setignoretemplatesubject(false); } else { sendemaildefaults.settemplateid( gettemplateidhelper('default_reply_template')); sendemaildefaults.setinserttemplatebody(false); sendemaildefaults.setignoretemplatesubject(true); } } } private id gettemplateidhelper(string templateapiname) { id templateid = null; try { templateid = [select id, name from emailtemplate where developername = : templateapiname].id; } catch (exception e) { system.debug('unble to locate emailtemplate using name: ' + templateapiname + ' refer to setup | communications templates ' + templateapiname); 2509apex reference guide quickactiondefaultshandler interface } return templateid; } private string getbccaddress(string reason) { if (reason != null && reason.equals('technical')) { return 'support_technical@mycompany.com'; } else if (reason != null && reason.equals('billing')) { return 'support_billing@mycompany.com'; } else { return 'support@mycompany.com'; } } } in this example, the oninitdefaults method checks whether the element passed in the array is for the standard email action in the case feed. then it performs a query to determine if the case priority is set to high. if the priority is set to high, the email address managers@acme.com is appended to the bcc field. global class emailpublisherforhighprioritycases implements quickaction.quickactiondefaultshandler { // empty constructor global emailpublisherforhighprioritycases() { } // the main interface method global void oninitdefaults(quickaction.quickactiondefaults[] defaults) { quickaction.sendemailquickactiondefaults sendemaildefaults = (quickaction.sendemailquickactiondefaults)defaults.get(0); emailmessage emailmessage = (emailmessage)sendemaildefaults.gettargetsobject(); case c = [select casenumber, priority from case where id=:sendemaildefaults.getcontextid()]; // if case severity is “high,” append “managers@acme.com” to the existing (and possibly blank) bcc field if (c.priority != null && c.priority.equals('high')) { // priority is 'high' emailmessage.bccaddress = 'managers@acme.com'; } } } in this example, the oninitdefaults method checks whether the element passed in the array is for the standard email action in the case feed. then it performs a query to determine if the case type is set to problem. if the type is set to problem, the first response email template is inserted into the body of the email. global class emailpublisherforcasetype implements quickaction.quickactiondefaultshandler { // empty constructor global emailpublisherforcasetype() { } // the main interface method global void oninitdefaults(quickaction.quickactiondefaults[] defaults) { quickaction.sendemailquickactiondef" "aults sendemaildefaults = (quickaction.sendemailquickactiondefaults)defaults.get(0); 2510apex reference guide quickactiondefaultshandler interface emailmessage emailmessage = (emailmessage)sendemaildefaults.gettargetsobject(); case c = [select casenumber, type from case where id=:sendemaildefaults.getcontextid()]; // if case type is “problem,” insert the “first response” email template if (c.casenumber != null && c.type.equals('problem')) { sendemaildefaults.settemplateid('insert email template id here'); // set the template id corresponding to first response sendemaildefaults.setinserttemplatebody(true); sendemaildefaults.setignoretemplatesubject(false); } } in this example, the oninitdefaults method checks whether the element passed in the array is for the standard email action in the case feed. then it performs a query to determine if the email is a reply or reply all email. if email is a reply or reply all email, the corresponding email templates for these emails are inserted into the body of the email. global class emailpublisherforreplyandreplyall implements quickaction.quickactiondefaultshandler { // empty constructor global emailpublisherforreplyandreplyall() { } // the main interface method global void oninitdefaults(quickaction.quickactiondefaults[] defaults) { quickaction.sendemailquickactiondefaults sendemaildefaults = (quickaction.sendemailquickactiondefaults)defaults.get(0); emailmessage emailmessage = (emailmessage)sendemaildefaults.gettargetsobject(); // if the email is a “reply” email, insert the “reply email template” to the email body if (sendemaildefaults.getactionname().equals('emailmessage._reply')) { sendemaildefaults.settemplateid('insert reply email template id here'); sendemaildefaults.setinserttemplatebody(true); sendemaildefaults.setignoretemplatesubject(false); // if the email is a “reply all” email, insert the “reply all email template” to the email body } else if (sendemaildefaults.getactionname().equals('emailmessage._replyall')) { sendemaildefaults.settemplateid('insert reply all email template id here'); sendemaildefaults.setinserttemplatebody(true); sendemaildefaults.setignoretemplatesubject(false); } 2511apex reference guide quickactionrequest class quickactionrequest class use the quickaction.quickactionrequest class for providing action information for quick actions to be performed by quickaction class methods. action information includes the action name, context record id, and record. namespace quickaction usage for apex saved using salesforce api version 28.0, a parent id is associated with the quickactionrequest instead of the context id. the constructor of this class takes no arguments: quickaction.quickactionrequest qar = new quickaction.quickactionrequest(); example in this sample, a new quick action is created to create a contact and assign a record to it. quickaction.quickactionrequest req = new quickaction.quickactionrequest(); // some quick action name req.quickactionname = schema.account.quickaction.accountcreatecontact; // define a record for the quick action to create contact c = new contact(); c.lastname = 'last name'; req.record = c; // provide the context id (or parent id). in this case, it is an account record. req.contextid = '001xx000003dgco'; quickaction.quickactionresult res = quickaction.performquickaction(req); in this section: quickactionrequest constructors quickactionrequest methods see also: quickaction class quickactionrequest constructors the following are constructors for quickactionrequest. 2512apex reference guide quickactionrequest class in this section: quickactionrequest() creates a new instance of the quickaction.quickactionrequest class. quickactionrequest() creates a new instance of the quickaction.quickactionrequest class. signature public quickactionrequest() quickactionrequest methods the following are methods for quickactionrequest. all are instance methods. in this section: getcontextid() returns this quickaction’s context record id. getquickactionname() returns this quickaction’s name. getrecord" "() returns the quickaction’s associated record. setcontextid(contextid) sets this quickaction’s context id. returned by getcontextid. setquickactionname(name) sets this quickaction’s name. returned by getquickactionname. setrecord(record) sets a record for this quickaction. returned by getrecord. getcontextid() returns this quickaction’s context record id. signature public id getcontextid() return value type: id getquickactionname() returns this quickaction’s name. 2513apex reference guide quickactionrequest class signature public string getquickactionname() return value type: string getrecord() returns the quickaction’s associated record. signature public sobject getrecord() return value type: sobject setcontextid(contextid) sets this quickaction’s context id. returned by getcontextid. signature public void setcontextid(id contextid) parameters contextid type: id return value type: void usage for apex saved using salesforce api version 28.0, sets this quickaction’s parent id and is returned by getparentid. setquickactionname(name) sets this quickaction’s name. returned by getquickactionname. signature public void setquickactionname(string name) 2514apex reference guide quickactionresult class parameters name type: string return value type: void setrecord(record) sets a record for this quickaction. returned by getrecord. signature public void setrecord(sobject record) parameters record type: sobject return value type: void quickactionresult class after you initiate a quick action with the quickaction class, use the quickactionresult class for processing action results. namespace quickaction see also: quickaction class quickactionresult methods the following are methods for quickactionresult. all are instance methods. in this section: geterrors() if an error occurs, an array of one or more database error objects, along with error codes and descriptions, is returned. getids() the ids of the quickactions being processed. getsuccessmessage() returns the success message associated with the quick action. 2515apex reference guide quickactionresult class iscreated() returns true if the action is created; otherwise, false. issuccess() returns true if the action completes successfully; otherwise, false. geterrors() if an error occurs, an array of one or more database error objects, along with error codes and descriptions, is returned. signature public list geterrors() return value type: list getids() the ids of the quickactions being processed. signature public list getids() return value type: list getsuccessmessage() returns the success message associated with the quick action. signature public string getsuccessmessage() return value type: string iscreated() returns true if the action is created; otherwise, false. signature public boolean iscreated() 2516apex reference guide sendemailquickactiondefaults class return value type: boolean issuccess() returns true if the action completes successfully; otherwise, false. signature public boolean issuccess() return value type: boolean sendemailquickactiondefaults class represents an apex class that provides: the from address list; the original email’s email message id, provided that the reply action was invoked on the email message feed item; and methods to specify related settings on templates. you can override these fields before the standard email action is rendered. namespace quickaction usage note: you cannot instantiate this class. one can use the getters/setters when using it in the context of quickaction.quickactiondefaultshandler. in this section: sendemailquickactiondefaults methods sendemailquickactiondefaults methods the following are methods for sendemailquickactiondefaults. in this section: getfromaddresslist() returns a list of email addresses that are available in the from: address drop-down menu for the standard email action. getinreplytoid() returns the email message id of the email to which the reply/reply all action has been invoked. setignoretemplatesubject(useoriginalsubject) specifies whether the template" "subject should be ignored (true), thus using the original subject, or whether the template subject should replace the original subject (false). 2517apex reference guide sendemailquickactiondefaults class setinserttemplatebody(keeporiginalbodycontent) specifies whether the template body should be inserted above the original body content (true) or whether it should replace the entire content with the template body (false). settemplateid(templateid) sets the email template id to load into the email body. getfromaddresslist() returns a list of email addresses that are available in the from: address drop-down menu for the standard email action. signature public list getfromaddresslist() return value type: list getinreplytoid() returns the email message id of the email to which the reply/reply all action has been invoked. signature public id getinreplytoid() return value type: id setignoretemplatesubject(useoriginalsubject) specifies whether the template subject should be ignored (true), thus using the original subject, or whether the template subject should replace the original subject (false). signature public void setignoretemplatesubject(boolean useoriginalsubject) parameters useoriginalsubject type: boolean return value type: void 2518apex reference guide reports namespace setinserttemplatebody(keeporiginalbodycontent) specifies whether the template body should be inserted above the original body content (true) or whether it should replace the entire content with the template body (false). signature public void setinserttemplatebody(boolean keeporiginalbodycontent) parameters keeporiginalbodycontent type: boolean return value type: void settemplateid(templateid) sets the email template id to load into the email body. signature public void settemplateid(id templateid) parameters templateid type: id the template id. return value type: void reports namespace the reports namespace provides classes for accessing the same data as is available in the salesforce reports and dashboards rest api. the following are the classes in the reports namespace. in this section: aggregatecolumn class contains methods for describing summary fields such as record count, sum, average, max, min, and custom summary formulas. includes name, label, data type, and grouping context. 2519apex reference guide reports namespace bucketfield class contains methods and constructors to work with information about a bucket field, including bucket type, name, and bucketed values. bucketfieldvalue class contains information about the report values included in a bucket field. buckettype enum the types of values included in a bucket. columndatatype enum the reports.columndatatype enum describes the type of data in a column. it is returned by the getdatatype method. columnsortorder enum the reports.columnsortorder enum describes the order that the grouping column uses to sort data. crossfilter class contains methods and constructors used to work with information about a cross filter. csfgrouptype enum the group level at which the custom summary format aggregate is displayed in a report. dategranularity enum the reports.dategranularity enum describes the date interval that is used for grouping. detailcolumn class contains methods for describing fields that contain detailed data. detailed data fields are also listed in the report metadata. dimension class contains information for each row or column grouping. evaluatedcondition class contains the individual components of an evaluated condition for a report notification, such as the aggregate name and label, the operator, and the value that the aggregate is compared to. evaluatedconditionoperator enum the reports.evaluatedconditionoperator enum describes the type of operator used to compare an aggregate to a value. it is returned by the getoperator method. filteroperator class contains information about a filter operator, such as display name and api name. filtervalue class contains information about a filter value, such as the display name and api name. formulatype enum the format of the numbers in a custom summary formula. groupingcolumn class contains methods for describing fields that are used for column grouping. groupinginfo class contains methods for describing fields that are used for grouping. groupingvalue class contains grouping values for a row or column, including the key, label, and value. notificationaction interface implement this interface to trigger a custom apex class when the conditions for a report notification are met. 2520apex" "reference guide reports namespace notificationactioncontext class contains information about the report instance and condition threshold for a report notification. reportcsf class contains methods and constructors for working with information about a custom summary formula (csf). reportcurrency class contains information about a currency value, including the amount and currency code. reportdatacell class contains the data for a cell in the report, including the display label and value. reportdescriberesult class contains report, report type, and extended metadata for a tabular, summary, or matrix report. reportdetailrow class contains data cells for a detail row of a report. reportdivisioninfo class contains information about the divisions that can be used to filter a report. reportextendedmetadata class contains report extended metadata for a tabular, summary, or matrix report. reportfact class contains the fact map for the report, which represents the report’s data values. reportfactwithdetails class contains the detailed fact map for the report, which represents the report’s data values. reportfactwithsummaries class contains the fact map for the report, which represents the report’s data values, and includes summarized fields. reportfilter class contains information about a report filter, including column, operator, and value. reportformat enum contains the possible report format types. reportfiltertype enum the types of values included in a report filter type. reportinstance class returns an instance of a report that was run asynchronously. retrieves the results for that instance. reportmanager class runs a report synchronously or asynchronously and with or without details. reportmetadata class contains report metadata for a tabular, summary, or matrix report. reportresults class contains the results of running a report. reportscopeinfo class contains information about possible scope values that you can choose. scope values depend on the report type. for example, you can set the scope for opportunity reports to all opportunities, my team’s opportunities, or my opportunities. 2521apex reference guide reports namespace reportscopevalue class contains information about a possible scope value. scope values depend on the report type. for example, you can set the scope for opportunity reports to all opportunities, my team’s opportunities, or my opportunities. reporttype class contains the unique api name and display name for the report type. reporttypecolumn class contains detailed report type metadata about a field, including data type, display name, and filter values. reporttypecolumncategory class information about categories of fields in a report type. reporttypemetadata class contains report type metadata, which gives you information about the fields that are available in each section of the report type, plus filter information for those fields. sortcolumn class contains information about the sort column used in the report. standarddatefilter class contains information about standard date filter available in the report—for example, the api name, start date, and end date of the standard date filter duration as well as the api name of the date field on which the filter is placed. standarddatefilterduration class contains information about each standard date filter—also referred to as a relative date filter. it contains the api name and display label of the standard date filter duration as well as the start and end dates. standarddatefilterdurationgroup class contains information about the standard date filter groupings, such as the grouping display label and all standard date filters that fall under the grouping. groupings include calendar year, calendar quarter, calendar month, calendar week, fiscal year, fiscal quarter, day, and custom values based on user-defined date ranges. standardfilter class contains information about the standard filter defined in the report, such as the filter field api name and filter value. standardfilterinfo class is an abstract base class for an object that provides standard filter information. standardfilterinfopicklist class contains information about the standard filter picklist, such as the display name and type of the filter field, the default picklist value, and a list of all possible picklist values. standardfiltertype enum the standardfiltertype enum describes the type of standard filters in a report. the gettype() method returns a reports.standardfiltertype enum value. summaryvalue class contains summary data for a cell of the report. thresholdinformation class contains a list of evaluated conditions for a report notification. toprows class contains methods and constructors for working with information about a row limit filter. reports exceptions the reports namespace contains exception classes." "2522apex reference guide aggregatecolumn class aggregatecolumn class contains methods for describing summary fields such as record count, sum, average, max, min, and custom summary formulas. includes name, label, data type, and grouping context. namespace reports aggregatecolumn methods the following are methods for aggregatecolumn. all are instance methods. in this section: getname() returns the unique api name of the summary field. getlabel() returns the localized display name for the summarized or custom summary formula field. getdatatype() returns the data type of the summarized or custom summary formula field. getacrossgroupingcontext() returns the column grouping in the report where the summary field is displayed. getdowngroupingcontext() returns the row grouping in the report where the summary field is displayed. getname() returns the unique api name of the summary field. syntax public string getname() return value type: string getlabel() returns the localized display name for the summarized or custom summary formula field. syntax public string getlabel() 2523apex reference guide bucketfield class return value type: string getdatatype() returns the data type of the summarized or custom summary formula field. syntax public reports.columndatatype getdatatype() return value type: reports.columndatatype getacrossgroupingcontext() returns the column grouping in the report where the summary field is displayed. syntax public string getacrossgroupingcontext() return value type: string getdowngroupingcontext() returns the row grouping in the report where the summary field is displayed. syntax public string getdowngroupingcontext() return value type: string bucketfield class contains methods and constructors to work with information about a bucket field, including bucket type, name, and bucketed values. namespace reports in this section: bucketfield constructors 2524apex reference guide bucketfield class bucketfield methods bucketfield constructors the following are constructors for bucketfield. in this section: bucketfield(buckettype, devlopername, label, nulltreatedaszero, otherbucketlabel, sourcecolumnname, values) creates an instance of the reports.bucketfield class using the specified parameters. bucketfield() creates an instance of the reports.bucketfield class. you can then set values by using the class’s set methods. bucketfield(buckettype, devlopername, label, nulltreatedaszero, otherbucketlabel, sourcecolumnname, values) creates an instance of the reports.bucketfield class using the specified parameters. signature public bucketfield(reports.buckettype buckettype, string devlopername, string label, boolean nulltreatedaszero, string otherbucketlabel, string sourcecolumnname, list values) parameters buckettype type: reports.buckettype the type of bucket. devlopername type: string api name of the bucket. label type: string user-facing name of the bucket. nulltreatedaszero type: boolean specifies whether null values are converted to zero (true) or not (false). otherbucketlabel type: string name of the fields grouped as other (in buckets of buckettype picklist). sourcecolumnname type: string name of the bucketed field. 2525apex reference guide bucketfield class values type: list types of the values included in the bucket. bucketfield() creates an instance of the reports.bucketfield class. you can then set values by using the class’s set methods. signature public bucketfield() bucketfield methods the following are methods for bucketfield. in this section: getbuckettype() returns the bucket type. getdevlopername() returns the bucket’s api name. getlabel() returns the user-facing name of the bucket. getnulltreatedaszero() returns true if null values are converted to the number zero, otherwise returns false. getotherbucketlabel() returns the name of fields grouped as other in buckets of type picklist. getsourcecolumnname() returns the api name of the bucketed field. getvalues() returns the report values grouped by the bucket field. setbuckettype(value) sets the buckettype of the bucket. setb" "uckettype(buckettype) sets the buckettype of the bucket. setdevlopername(devlopername) sets the api name of the bucket. setlabel(label) sets the user-facing name of the bucket. setnulltreatedaszero(nulltreatedaszero) specifies whether null values in the bucket are converted to zero (true) or not (false). 2526apex reference guide bucketfield class setotherbucketlabel(otherbucketlabel) sets the name of the fields grouped as other (in buckets of buckettype picklist). setsourcecolumnname(sourcecolumnname) specifies the name of the bucketed field. setvalues(values) specifies which type of values are included in the bucket. tostring() returns a string. getbuckettype() returns the bucket type. signature public reports.buckettype getbuckettype() return value type: reports.buckettype getdevlopername() returns the bucket’s api name. signature public string getdevlopername() return value type: string getlabel() returns the user-facing name of the bucket. signature public string getlabel() return value type: string getnulltreatedaszero() returns true if null values are converted to the number zero, otherwise returns false. 2527apex reference guide bucketfield class signature public boolean getnulltreatedaszero() return value type: boolean getotherbucketlabel() returns the name of fields grouped as other in buckets of type picklist. signature public string getotherbucketlabel() return value type: string getsourcecolumnname() returns the api name of the bucketed field. signature public string getsourcecolumnname() return value type: string getvalues() returns the report values grouped by the bucket field. signature public list getvalues() return value type: list on page 3123 setbuckettype(value) sets the buckettype of the bucket. signature public void setbuckettype(string value) 2528apex reference guide bucketfield class parameters value type: string see the reports.buckettype enum for valid values. return value type: void setbuckettype(buckettype) sets the buckettype of the bucket. signature public void setbuckettype(reports.buckettype buckettype) parameters buckettype type: reports.buckettype return value type: void setdevlopername(devlopername) sets the api name of the bucket. signature public void setdevlopername(string devlopername) parameters devlopername type: string the api name to assign to the bucket. return value type: void setlabel(label) sets the user-facing name of the bucket. 2529apex reference guide bucketfield class signature public void setlabel(string label) parameters label type: string return value type: void setnulltreatedaszero(nulltreatedaszero) specifies whether null values in the bucket are converted to zero (true) or not (false). signature public void setnulltreatedaszero(boolean nulltreatedaszero) parameters nulltreatedaszero type: boolean return value type: void setotherbucketlabel(otherbucketlabel) sets the name of the fields grouped as other (in buckets of buckettype picklist). signature public void setotherbucketlabel(string otherbucketlabel) parameters otherbucketlabel type: string return value type: void setsourcecolumnname(sourcecolumnname) specifies the name of the bucketed field. 2530apex reference guide bucketfieldvalue class signature public void setsourcecolumnname(string sourcecolumnname) parameters sourcecolumnname type: string return value type: void setvalues(values) specifies which type of values are included in the bucket. signature public void setvalues(list values) parameters values type: list on page 3123 return value type: void tostring() returns a string. signature public string tostring() return value type" ": string bucketfieldvalue class contains information about the report values included in a bucket field. namespace reports 2531apex reference guide bucketfieldvalue class in this section: bucketfieldvalue constructors bucketfieldvalue methods bucketfieldvalue constructors the following are constructors for bucketfieldvalue. in this section: bucketfieldvalue(label, sourcedimensionvalues, rangeupperbound) creates an instance of the reports.bucketfieldvalue class using the specified parameters. bucketfieldvalue() creates an instance of the reports.bucketfieldvalue class. you can then set values by using the class’s set methods. bucketfieldvalue(label, sourcedimensionvalues, rangeupperbound) creates an instance of the reports.bucketfieldvalue class using the specified parameters. signature public bucketfieldvalue(string label, list sourcedimensionvalues, double rangeupperbound) parameters label type: string the user-facing name of the bucket. sourcedimensionvalues type: list on page 3123 a list of the values from the source field included in this bucket category (in buckets of type picklist and buckets of type text). rangeupperbound type: double the greatest range limit under which values are included in this bucket category (in buckets of type number). bucketfieldvalue() creates an instance of the reports.bucketfieldvalue class. you can then set values by using the class’s set methods. signature public bucketfieldvalue() bucketfieldvalue methods the following are methods for bucketfieldvalue. 2532" "apex reference guide bucketfieldvalue class in this section: getlabel() returns the user-facing name of the bucket category. getrangeupperbound() returns the greatest range limit under which values are included in this bucket category (in buckets of type number). getsourcedimensionvalues() returns a list of the values from the source field included in this bucket category (in buckets of type picklist and buckets of type text). setlabel(label) set the user-facing name of the bucket category. setrangeupperbound(rangeupperbound) sets the greatest limit of a range under which values are included in this bucket category (in buckets of type number). setsourcedimensionvalues(sourcedimensionvalues) specifies the values from the source field included in this bucket category (in buckets of type picklist and buckets of type text). tostring() returns a string. getlabel() returns the user-facing name of the bucket category. signature public string getlabel() return value type: string getrangeupperbound() returns the greatest range limit under which values are included in this bucket category (in buckets of type number). signature public double getrangeupperbound() return value type: double getsourcedimensionvalues() returns a list of the values from the source field included in this bucket category (in buckets of type picklist and buckets of type text). 2533apex reference guide bucketfieldvalue class signature public list getsourcedimensionvalues() return value type: list setlabel(label) set the user-facing name of the bucket category. signature public void setlabel(string label) parameters label type: string return value type: void setrangeupperbound(rangeupperbound) sets the greatest limit of a range under which values are included in this bucket category (in buckets of type number). signature public void setrangeupperbound(double rangeupperbound) parameters rangeupperbound type: double return value type: void setsourcedimensionvalues(sourcedimensionvalues) specifies the values from the source field included in this bucket category (in buckets of type picklist and buckets of type text). signature public void setsourcedimensionvalues(list sourcedimensionvalues) 2534apex reference guide buckettype enum parameters sourcedimensionvalues type: list return value type: void tostring() returns a string. signature public string tostring() return value type: string buckettype enum the types of values included in a bucket. enum values the following are the values of the reports.buckettype enum. value description number numeric values picklist picklist values text string values columndatatype enum the reports.columndatatype enum describes the type of data in a column. it is returned by the getdatatype method. namespace reports enum values the following are the values of the reports.columndatatype enum. 2535apex reference guide columnsortorder enum value description boolean_data boolean (true or false) values combobox_data comboboxes, which provide a set of enumerated values and enable the user to specify a value that is not in the list currency_data currency values datetime_data datetime values date_data date values double_data double values email_data email addresses id_data an object’s salesforce id int_data integer values multipicklist_data multi-select picklists, which provide a set of enumerated values from which multiple values can be selected percent_data percent values phone_data phone numbers. values can include alphabetic characters. client applications are responsible for phone number formatting. picklist_data single-select picklists, which provide a set of enumerated values from which only one value can be selected reference_data cross-references to another object, analogous to a foreign key field string_data string values textarea_data string values that are displayed as multiline text fields time_data time values url_data url values that are displayed as hyperlinks columnsortorder enum the reports.columnsortorder enum describes the order that the grouping column uses to sort data. namespace reports usage the groupinginfo.getcolumn" "sortorder() method returns a reports.columnsortorder enum value. the groupinginfo.setcolumnsortorder() method takes the enum value as an argument. 2536apex reference guide crossfilter class enum values the following are the values of the reports.columnsortorder enum. value description ascending sort data in ascending order (a–z) descending sort data in descending order (z–a) crossfilter class contains methods and constructors used to work with information about a cross filter. namespace reports in this section: crossfilter constructors crossfilter methods crossfilter constructors the following are constructors for crossfilter. in this section: crossfilter(criteria, includesobject, primaryentityfield, relatedentity, relatedentityjoinfield) creates an instance of the reports.crossfilter class using the specified parameters. crossfilter() creates an instance of the reports.crossfilter class. you can then set values by using the class’s set methods. crossfilter(criteria, includesobject, primaryentityfield, relatedentity, relatedentityjoinfield) creates an instance of the reports.crossfilter class using the specified parameters. signature public crossfilter(list criteria, boolean includesobject, string primaryentityfield, string relatedentity, string relatedentityjoinfield) parameters criteria type: list 2537apex reference guide crossfilter class information about how to filter the relatedentity. relates the primary entity with a subset of the relatedentity. includesobject type: boolean specifies whether objects returned have a relationship with the relatedentity (true) or not (false). primaryentityfield type: string the name of the object on which the cross filter is evaluated. relatedentity type: string the name of the object that the primaryentityfield is evaluated against—the right-hand side of the cross filter. relatedentityjoinfield type: string the name of the field used to join the primaryentityfield and relatedentity. crossfilter() creates an instance of the reports.crossfilter class. you can then set values by using the class’s set methods. signature public crossfilter() crossfilter methods the following are methods for crossfilter. in this section: getcriteria() returns information about how to filter the relatedentity. describes the subset of the relatedentity which the primary entity is evaluated against. getincludesobject() returns true if primary object has a relationship with the relatedentity, otherwise returns false. getprimaryentityfield() returns the name of the object on which the cross filter is evaluated. getrelatedentity() returns name of the object that the primaryentityfield is evaluated against—the right-hand side of the cross filter. getrelatedentityjoinfield() returns the name of the field used to join the primaryentityfield and relatedentity. setcriteria(criteria) specifis how to filter the relatedentity. relates the primary entity with a subset of the relatedentity. setincludesobject(includesobject) specifies whether objects returned have a relationship with the relatedentity (true) or not (false). 2538apex reference guide crossfilter class setprimaryentityfield(primaryentityfield) specifies the name of the object on which the cross filter is evaluated. setrelatedentity(relatedentity) specifies the name of the object that the primaryentityfield is evaluated against—the right-hand side of the cross filter. setrelatedentityjoinfield(relatedentityjoinfield) specifies the name of the field used to join the primaryentityfield and relatedentity. tostring() returns a string. getcriteria() returns information about how to filter the relatedentity. describes the subset of the relatedentity which the primary entity is evaluated against. signature public list getcriteria() return value type: list getincludesobject() returns true if primary object has a relationship with the relatedentity, otherwise returns false. signature public boolean getincludesobject() return value type: boolean getprimaryentityfield() returns the name of the object on which the cross filter is evaluated. signature public string getprimaryentityfield() return value type: string getrelatedentity() returns name of the object that the primaryentityfield is evaluated against—the right-hand side of the cross filter. 2539apex reference guide crossfilter class signature public string getrelatedentity() return value type: string getrelatedentityjoin" "field() returns the name of the field used to join the primaryentityfield and relatedentity. signature public string getrelatedentityjoinfield() return value type: string setcriteria(criteria) specifis how to filter the relatedentity. relates the primary entity with a subset of the relatedentity. signature public void setcriteria(list criteria) parameters criteria type: list return value type: void setincludesobject(includesobject) specifies whether objects returned have a relationship with the relatedentity (true) or not (false). signature public void setincludesobject(boolean includesobject) parameters includesobject type: boolean 2540apex reference guide crossfilter class return value type: void setprimaryentityfield(primaryentityfield) specifies the name of the object on which the cross filter is evaluated. signature public void setprimaryentityfield(string primaryentityfield) parameters primaryentityfield type: string return value type: void setrelatedentity(relatedentity) specifies the name of the object that the primaryentityfield is evaluated against—the right-hand side of the cross filter. signature public void setrelatedentity(string relatedentity) parameters relatedentity type: string return value type: void setrelatedentityjoinfield(relatedentityjoinfield) specifies the name of the field used to join the primaryentityfield and relatedentity. signature public void setrelatedentityjoinfield(string relatedentityjoinfield) parameters relatedentityjoinfield type: string 2541apex reference guide csfgrouptype enum return value type: void tostring() returns a string. signature public string tostring() return value type: string csfgrouptype enum the group level at which the custom summary format aggregate is displayed in a report. enum values the following are the values of the reports.csfgrouptype enum. value description all the aggregate is displayed at the end of every summary row. custom the aggregate is displayed at specified grouping levels. grand_total the aggregate is displayed only at the grand total level. dategranularity enum the reports.dategranularity enum describes the date interval that is used for grouping. namespace reports usage the groupinginfo.getdategranularity method returns a reports.dategranularity enum value. the groupinginfo.setdategranularity method takes the enum value as an argument. enum values the following are the values of the reports.dategranularity enum. 2542apex reference guide detailcolumn class value description day the day of the week (monday–sunday) day_in_month the day of the month (1–31) fiscal_period the fiscal period fiscal_quarter the fiscal quarter fiscal_week the fiscal week fiscal_year the fiscal year month the month (january–december) month_in_year the month number (1–12) none no date grouping quarter the quarter number (1–4) week the week number (1–52) year the year number (####) detailcolumn class contains methods for describing fields that contain detailed data. detailed data fields are also listed in the report metadata. namespace reports detailcolumn instance methods the following are instance methods for detailcolumn. all are instance methods. in this section: getname() returns the unique api name of the detail column field. getlabel() returns the localized display name of a standard field, the id of a custom field, or the api name of a bucket field that has detailed data. getdatatype() returns the data type of a detail column field. getname() returns the unique api name of the detail column field. 2543apex reference guide dimension class syntax public string getname() return value type: string getlabel() returns the localized display name of a standard field, the id of a custom field, or the api name of a bucket field that has detailed data. syntax public string getlabel() return value type: string getdatatype() returns the data type of a detail column field. syntax public reports.columndatatype getdatatype() return value type: reports.columndatatype dimension class contains information for each row or column grouping." "namespace reports dimension methods the following are methods for dimension. all are instance methods. in this section: getgroupings() returns information for each row or column grouping as a list. 2544apex reference guide evaluatedcondition class getgroupings() returns information for each row or column grouping as a list. syntax public list getgroupings() return value type: list evaluatedcondition class contains the individual components of an evaluated condition for a report notification, such as the aggregate name and label, the operator, and the value that the aggregate is compared to. namespace reports in this section: evaluatedcondition constructors evaluatedcondition methods evaluatedcondition constructors the following are constructors for evaluatedcondition. in this section: evaluatedcondition(aggregatename, aggregatelabel, comparetovalue, aggregatevalue, displaycompareto, displayvalue, operator) creates a new instance of the reports.evaluatedconditions class using the specified parameters. evaluatedcondition(aggregatename, aggregatelabel, comparetovalue, aggregatevalue, displaycompareto, displayvalue, operator) creates a new instance of the reports.evaluatedconditions class using the specified parameters. signature public evaluatedcondition(string aggregatename, string aggregatelabel, double comparetovalue, double aggregatevalue, string displaycompareto, string displayvalue, reports.evaluatedconditionoperator operator) 2545apex reference guide evaluatedcondition class parameters aggregatename type: string the unique api name of the aggregate. aggregatelabel type: string the localized display name of the aggregate. comparetovalue type: double the value that the aggregate is compared to in the condition. aggregatevalue type: double the actual value of the aggregate when the report is run. displaycompareto type: string the value that the aggregate is compared to in the condition, formatted for display. for example, a display value for a currency is $20.00 or usd20.00 instead of 20.00. displayvalue type: string the value of the aggregate when the report is run, formatted for display. for example, a display value for a currency is $20.00 or usd20.00 instead of 20.00. operator type: reports.evaluatedconditionoperator the operator used in the condition. evaluatedcondition methods the following are methods for evaluatedcondition. in this section: getaggregatelabel() returns the localized display name of the aggregate. getaggregatename() returns the unique api name of the aggregate. getcompareto() returns the value that the aggregate is compared to in the condition. getdisplaycompareto() returns the value that the aggregate is compared to in the condition, formatted for display. for example, a display value for a currency is $20.00 or usd20.00 instead of 20.00. getdisplayvalue() returns the value of the aggregate when the report is run, formatted for display. for example, a display value for a currency is $20.00 or usd20.00 instead of 20.00. 2546apex reference guide evaluatedcondition class getoperator() returns the operator used in the condition. getvalue() returns the actual value of the aggregate when the report is run. getaggregatelabel() returns the localized display name of the aggregate. signature public string getaggregatelabel() return value type: string getaggregatename() returns the unique api name of the aggregate. signature public string getaggregatename() return value type: string getcompareto() returns the value that the aggregate is compared to in the condition. signature public double getcompareto() return value type: double getdisplaycompareto() returns the value that the aggregate is compared to in the condition, formatted for display. for example, a display value for a currency is $20.00 or usd20.00 instead of 20.00. signature public string getdisplaycompareto() 2547apex reference guide evaluatedconditionoperator enum return value type: string getdisplayvalue() returns the value of the aggregate when the report is run, formatted for display. for example, a display value for a currency is $20.00 or usd20.00 instead of 20.00. signature public string getdisplayvalue() return value type: string getoperator()" "returns the operator used in the condition. signature public reports.evaluatedconditionoperator getoperator() return value type: reports.evaluatedconditionoperator getvalue() returns the actual value of the aggregate when the report is run. signature public double getvalue() return value type: double evaluatedconditionoperator enum the reports.evaluatedconditionoperator enum describes the type of operator used to compare an aggregate to a value. it is returned by the getoperator method. namespace reports 2548apex reference guide filteroperator class enum values the following are the values of the reports.evaluatedconditionoperator enum. value description equal equality operator. greater_than greater than operator. greater_than_equal greater than or equal to operator. less_than less than operator. less_than_equal less than or equal to operator. not_equal inequality operator. filteroperator class contains information about a filter operator, such as display name and api name. namespace reports filteroperator methods the following are methods for filteroperator. all are instance methods. in this section: getlabel() returns the localized display name of the filter operator. possible values for this name are restricted based on the data type of the column being filtered. getname() returns the unique api name of the filter operator. possible values for this name are restricted based on the data type of the column being filtered. for example multipicklist fields can use the following filter operators: “equals,” “not equal to,” “includes,” and “excludes.” bucket fields are considered to be of the string type. getlabel() returns the localized display name of the filter operator. possible values for this name are restricted based on the data type of the column being filtered. syntax public string getlabel() 2549apex reference guide filtervalue class return value type: string getname() returns the unique api name of the filter operator. possible values for this name are restricted based on the data type of the column being filtered. for example multipicklist fields can use the following filter operators: “equals,” “not equal to,” “includes,” and “excludes.” bucket fields are considered to be of the string type. syntax public string getname() return value type: string filtervalue class contains information about a filter value, such as the display name and api name. namespace reports filtervalue methods the following are methods for filtervalue. all are instance methods. in this section: getlabel() returns the localized display name of the filter value. possible values for this name are restricted based on the data type of the column being filtered. getname() returns the unique api name of the filter value. possible values for this name are restricted based on the data type of the column being filtered. getlabel() returns the localized display name of the filter value. possible values for this name are restricted based on the data type of the column being filtered. syntax public string getlabel() 2550apex reference guide formulatype enum return value type: string getname() returns the unique api name of the filter value. possible values for this name are restricted based on the data type of the column being filtered. syntax public string getname() return value type: string formulatype enum the format of the numbers in a custom summary formula. enum values the following are the values of the reports.formulatype enum. value description currency formatted as currency. for example, $100.00. number formatted as numbers. for example, 100. percent formatted as percentages. for example, 100%. groupingcolumn class contains methods for describing fields that are used for column grouping. namespace reports the groupingcolumn class provides basic information about column grouping fields. the groupinginfo class includes additional methods for describing and updating grouping fields. groupingcolumn methods the following are methods for groupingcolumn. all are instance methods. 2551apex reference guide groupingcolumn class in this section: getname() returns the unique api name of the field or bucket field that is used for column grouping. getlabel() returns the localized display name of the field that is used for column grouping. getdata" "type() returns the data type of the field that is used for column grouping. getgroupinglevel() returns the level of grouping for the column. getname() returns the unique api name of the field or bucket field that is used for column grouping. syntax public string getname() return value type: string getlabel() returns the localized display name of the field that is used for column grouping. syntax public string getlabel() return value type: string getdatatype() returns the data type of the field that is used for column grouping. syntax public reports.columndatatype getdatatype() return value type: reports.columndatatype getgroupinglevel() returns the level of grouping for the column. 2552apex reference guide groupinginfo class syntax public integer getgroupinglevel() return value type: integer usage • in a summary report, 0, 1, or 2 indicates grouping at the first, second, or third row level. • in a matrix report, 0 or 1 indicates grouping at the first or second row or column level. groupinginfo class contains methods for describing fields that are used for grouping. namespace reports groupinginfo methods the following are methods for groupinginfo. all are instance methods. in this section: getname() returns the unique api name of the field or bucket field that is used for row or column grouping. getsortorder() returns the order that is used to sort data in a row or column grouping (ascending or descending). getdategranularity() returns the date interval that is used for row or column grouping. getsortaggregate() returns the summary field that is used to sort data within a grouping in a summary report. the value is null when data within a grouping is not sorted by a summary field. getname() returns the unique api name of the field or bucket field that is used for row or column grouping. syntax public string getname() return value type: string 2553apex reference guide groupingvalue class getsortorder() returns the order that is used to sort data in a row or column grouping (ascending or descending). syntax public reports.columnsortorder getsortorder() return value type: reports.columnsortorder getdategranularity() returns the date interval that is used for row or column grouping. syntax public reports.dategranularity getdategranularity() return value type: reports.dategranularity getsortaggregate() returns the summary field that is used to sort data within a grouping in a summary report. the value is null when data within a grouping is not sorted by a summary field. syntax public string getsortaggregate() return value type: string groupingvalue class contains grouping values for a row or column, including the key, label, and value. namespace reports groupingvalue methods the following are methods for groupingvalue. all are instance methods. 2554apex reference guide groupingvalue class in this section: getgroupings() returns a list of second- or third-level row or column groupings. if there are none, the value is an empty array. getkey() returns the unique identifier for a row or column grouping. the identifier is used by the fact map to specify data values within each grouping. getlabel() returns the localized display name of a row or column grouping. for date and time fields, the label is the localized date or time. getvalue() returns the value of the field that is used as a row or column grouping. getgroupings() returns a list of second- or third-level row or column groupings. if there are none, the value is an empty array. syntax public list getgroupings() return value type: list getkey() returns the unique identifier for a row or column grouping. the identifier is used by the fact map to specify data values within each grouping. syntax public string getkey() return value type: string getlabel() returns the localized display name of a row or column grouping. for date and time fields, the label is the localized date or time. syntax public string getlabel() return value type: string 2555apex reference guide notificationaction interface getvalue() returns the value of the field that is used as a row or column grouping. syntax public object get" "value() return value type: object usage the value depends on the field’s data type. • currency fields: – amount: of type currency. a data cell’s value. – currency: of type picklist. the iso 4217 currency code, if available; for example, usd for us dollars or cny for chinese yuan. (if the grouping is on the converted currency, this value is the currency code for the report and not for the record.) • picklist fields: api name. for example, a custom picklist field—type of business with values 1, 2, and 3 for consulting, services, and add-on business respectively—has 1, 2, or 3 as the grouping value. • id fields: api name. • record type fields: api name. • date and time fields: date or time in iso-8601 format. • lookup fields: unique api name. for example, for the opportunity owner lookup field, the id of each opportunity owner’s chatter profile page can be a grouping value. notificationaction interface implement this interface to trigger a custom apex class when the conditions for a report notification are met. namespace reports usage report notifications for reports that users have subscribed to can trigger a custom apex class, which must implement the reports.notificationaction interface. the execute method in this interface receives a notificationactioncontext object as a parameter, which contains information about the report instance and the conditions that must be met for a notification to be triggered. in this section: notificationaction methods notificationaction example implementation 2556apex reference guide notificationaction interface notificationaction methods the following are methods for notificationaction. in this section: execute(context) executes the custom apex action specified in the context parameter of the context object, notificationactioncontext. the object contains information about the report instance and the conditions that must be met for a notification to be triggered. the method executes whenever the specified conditions are met. execute(context) executes the custom apex action specified in the context parameter of the context object, notificationactioncontext. the object contains information about the report instance and the conditions that must be met for a notification to be triggered. the method executes whenever the specified conditions are met. signature public void execute(reports.notificationactioncontext context) parameters context type: reports.notificationactioncontext return value type: void notificationaction example implementation this is an example implementation of the reports.notificationaction interface. public class alertowners implements reports.notificationaction { public void execute(reports.notificationactioncontext context) { reports.reportresults results = context.getreportinstance().getreportresults(); for(reports.groupingvalue g: results.getgroupingsdown().getgroupings()) { feeditem t = new feeditem(); t.parentid = (id)g.getvalue(); t.body = 'this record needs attention. please view the report.'; t.title = 'needs attention: '+ results.getreportmetadata().getname(); t.linkurl = '/' + results.getreportmetadata().getid(); insert t; } } } 2557apex reference guide notificationactioncontext class notificationactioncontext class contains information about the report instance and condition threshold for a report notification. namespace reports in this section: notificationactioncontext constructors notificationactioncontext methods notificationactioncontext constructors the following are constructors for notificationactioncontext. in this section: notificationactioncontext(reportinstance, thresholdinformation) creates a new instance of the reports.notificationactioncontext class using the specified parameters. notificationactioncontext(reportinstance, thresholdinformation) creates a new instance of the reports.notificationactioncontext class using the specified parameters. signature public notificationactioncontext(reports.reportinstance reportinstance, reports.thresholdinformation thresholdinformation) parameters reportinstance type: reports.reportinstance an instance of a report. thresholdinformation type: reports.thresholdinformation the evaluated conditions for the notification. notificationactioncontext methods the following are methods for notificationactioncontext. in this section: getreportinstance() returns the report instance associated with the notification. 2558apex reference guide reportcsf class getthresholdinformation() returns the threshold information associated with the notification. getreportinstance() returns the report instance associated with the notification. signature public reports.reportinstance getreportinstance() return value type: reports.reportinstance getth" "resholdinformation() returns the threshold information associated with the notification. signature public reports.thresholdinformation getthresholdinformation() return value type: reports.thresholdinformation reportcsf class contains methods and constructors for working with information about a custom summary formula (csf). namespace reports in this section: reportcsf constructors reportcsf methods reportcsf constructors the following are constructors for reportcsf. in this section: reportcsf(label, description, formulatype, decimalplaces, downgroup, downgrouptype, acrossgroup, acrossgrouptype, formula) creates an instance of the reports.reportcsf class using the specified parameters. 2559apex reference guide reportcsf class reportcsf() creates an instance of the reports.reportcsf class. you can then set values by using the class’s set methods. reportcsf(label, description, formulatype, decimalplaces, downgroup, downgrouptype, acrossgroup, acrossgrouptype, formula) creates an instance of the reports.reportcsf class using the specified parameters. signature public reportcsf(string label, string description, reports.formulatype formulatype, integer decimalplaces, string downgroup, reports.csfgrouptype downgrouptype, string acrossgroup, reports.csfgrouptype acrossgrouptype, string formula) parameters label type: string the user-facing name of the custom summary formula. description type: string the user-facing description of the custom summary formula. formulatype type: reports.formulatype the format of the numbers in the custom summary formula. decimalplaces type: integer the number of decimal places to include in numbers. downgroup type: string the name of a row grouping when the downgrouptype is custom; null otherwise. downgrouptype type: reports.csfgrouptype where to display the aggregate of the custom summary formula. acrossgroup type: string the name of a column grouping when the accrossgrouptype is custom; null otherwise. acrossgrouptype type: reports.csfgrouptype where to display the aggregate of the custom summary formula. formula type: string the operations performed on values in the custom summary formula. 2560apex reference guide reportcsf class reportcsf() creates an instance of the reports.reportcsf class. you can then set values by using the class’s set methods. signature public reportcsf() reportcsf methods the following are methods for reportcsf. in this section: getacrossgroup() returns the name of a column grouping when the acrossgrouptype is custom. otherwise, returns null. getacrossgrouptype() returns where to display the aggregate. getdecimalplaces() returns the number of decimal places that numbers in the custom summary formula have. getdescription() returns the user-facing description of a custom summary formula. getdowngroup() returns the name of a row grouping when the downgrouptype is custom. otherwise, returns null. getdowngrouptype() returns where to display the aggregate of the custom summary formula. getformula() returns the operations performed on values in the custom summary formula. getformulatype() returns the formula type. getlabel() returns the user-facing name of the custom summary formula. setacrossgroup(acrossgroup) specifies the column for the across grouping. setacrossgrouptype(value) sets where to display the aggregate. setacrossgrouptype(acrossgrouptype) sets where to display the aggregate. setdecimalplaces(decimalplaces) sets the number of decimal places in numbers. setdescription(description) sets the user-facing description of the custom summary formula. setdowngroup(downgroup) sets the name of a row grouping when the downgrouptype is custom. 2561apex reference guide reportcsf class setdowngrouptype(value) sets where to display the aggregate. setdowngrouptype(downgrouptype) sets where to display the aggregate. setformula(formula) sets the operations to perform on values in the custom summary formula. setformulatype(value) sets the format of the numbers in the custom summary formula. setformulatype(formulatype) sets the format of numbers used in the custom summary formula. setlabel(label) sets" "the user-facing name of the custom summary formula. tostring() returns a string. getacrossgroup() returns the name of a column grouping when the acrossgrouptype is custom. otherwise, returns null. signature public string getacrossgroup() return value type: string getacrossgrouptype() returns where to display the aggregate. signature public reports.csfgrouptype getacrossgrouptype() return value type: reports.csfgrouptype getdecimalplaces() returns the number of decimal places that numbers in the custom summary formula have. signature public integer getdecimalplaces() 2562apex reference guide reportcsf class return value type: integer getdescription() returns the user-facing description of a custom summary formula. signature public string getdescription() return value type: string getdowngroup() returns the name of a row grouping when the downgrouptype is custom. otherwise, returns null. signature public string getdowngroup() return value type: string getdowngrouptype() returns where to display the aggregate of the custom summary formula. signature public reports.csfgrouptype getdowngrouptype() return value type: reports.csfgrouptype getformula() returns the operations performed on values in the custom summary formula. signature public string getformula() return value type: string 2563apex reference guide reportcsf class getformulatype() returns the formula type. signature public reports.formulatype getformulatype() return value type: reports.formulatype getlabel() returns the user-facing name of the custom summary formula. signature public string getlabel() return value type: string setacrossgroup(acrossgroup) specifies the column for the across grouping. signature public void setacrossgroup(string acrossgroup) parameters acrossgroup type: string return value type: void setacrossgrouptype(value) sets where to display the aggregate. signature public void setacrossgrouptype(string value) 2564apex reference guide reportcsf class parameters value type: string for possible values, see reports.csfgrouptype. return value type: void setacrossgrouptype(acrossgrouptype) sets where to display the aggregate. signature public void setacrossgrouptype(reports.csfgrouptype acrossgrouptype) parameters acrossgrouptype type: reports.csfgrouptype return value type: void setdecimalplaces(decimalplaces) sets the number of decimal places in numbers. signature public void setdecimalplaces(integer decimalplaces) parameters decimalplaces type: integer return value type: void setdescription(description) sets the user-facing description of the custom summary formula. signature public void setdescription(string description) 2565apex reference guide reportcsf class parameters description type: string return value type: void setdowngroup(downgroup) sets the name of a row grouping when the downgrouptype is custom. signature public void setdowngroup(string downgroup) parameters downgroup type: string return value type: void setdowngrouptype(value) sets where to display the aggregate. signature public void setdowngrouptype(string value) parameters value type: string for valid values, see reports.csfgrouptype. return value type: void setdowngrouptype(downgrouptype) sets where to display the aggregate. signature public void setdowngrouptype(reports.csfgrouptype downgrouptype) 2566apex reference guide reportcsf class parameters downgrouptype type: reports.csfgrouptype return value type: void setformula(formula) sets the operations to perform on values in the custom summary formula. signature public void setformula(string formula) parameters formula type: string return value type: void setformulatype(value) sets the format of the numbers in the custom summary formula. signature public void setformulatype(string value) parameters value type: string for valid values, see reports.formulatype. return value type: void setformulatype(formulatype) sets the format of numbers used" "in the custom summary formula. signature public void setformulatype(reports.formulatype formulatype) 2567apex reference guide reportcurrency class parameters formulatype type: reports.formulatype return value type: void setlabel(label) sets the user-facing name of the custom summary formula. signature public void setlabel(string label) parameters label type: string return value type: void tostring() returns a string. signature public string tostring() return value type: string reportcurrency class contains information about a currency value, including the amount and currency code. namespace reports reportcurrency methods the following are methods for reportcurrency. all are instance methods. 2568apex reference guide reportdatacell class in this section: getamount() returns the amount of the currency value. getcurrencycode() returns the report currency code, such as usd, eur, or gbp, for an organization that has multicurrency enabled. the value is null if the organization does not have multicurrency enabled. getamount() returns the amount of the currency value. syntax public decimal getamount() return value type: decimal getcurrencycode() returns the report currency code, such as usd, eur, or gbp, for an organization that has multicurrency enabled. the value is null if the organization does not have multicurrency enabled. syntax public string getcurrencycode() return value type: string reportdatacell class contains the data for a cell in the report, including the display label and value. namespace reports reportdatacell methods the following are methods for reportdatacell. all are instance methods. in this section: getlabel() returns the localized display name of the value of a specified cell in the report. 2569apex reference guide reportdescriberesult class getvalue() returns the value of a specified cell of a detail row of a report. getlabel() returns the localized display name of the value of a specified cell in the report. syntax public string getlabel() return value type: string getvalue() returns the value of a specified cell of a detail row of a report. syntax public object getvalue() return value type: object reportdescriberesult class contains report, report type, and extended metadata for a tabular, summary, or matrix report. namespace reports reportdescriberesult methods the following are methods for reportdescriberesult. all are instance methods. in this section: getreportextendedmetadata() returns additional information about grouping and summaries. getreportmetadata() returns unique identifiers for groupings and summaries. getreporttypemetadata() returns the fields in each section of a report type, plus filtering information for those fields. 2570apex reference guide reportdetailrow class getreportextendedmetadata() returns additional information about grouping and summaries. syntax public reports.reportextendedmetadata getreportextendedmetadata() return value type: reports.reportextendedmetadata getreportmetadata() returns unique identifiers for groupings and summaries. syntax public reports.reportmetadata getreportmetadata() return value type: reports.reportmetadata getreporttypemetadata() returns the fields in each section of a report type, plus filtering information for those fields. syntax public reports.reporttypemetadata getreporttypemetadata() return value type: reports.reporttypemetadata reportdetailrow class contains data cells for a detail row of a report. namespace reports reportdetailrow methods the following are methods for reportdetailrow. all are instance methods. 2571apex reference guide reportdivisioninfo class in this section: getdatacells() returns a list of data cells for a detail row. getdatacells() returns a list of data cells for a detail row. syntax public list getdatacells() return value type: list reportdivisioninfo class contains information about the divisions that can be used to filter a report. available only if your organization uses divisions to segment data and you have the “affected by divisions” permission. if you do not have the “affected by divisions” permission, your reports include records in all divisions. namespace reports usage use" "to filter records in the report based on a division, like west coast and east coast. reportdivisioninfo methods the following are methods for reportdivisioninfo. getdefaultvalue() returns the default division for the report. signature public string getdefaultvalue() return value type: string getvalues() returns a list of all possible divisions for the report. 2572apex reference guide reportextendedmetadata class signature public list getvalues() return value type: list reportextendedmetadata class contains report extended metadata for a tabular, summary, or matrix report. namespace reports report extended metadata provides additional, detailed metadata about summary and grouping fields, including data type and label information. reportextendedmetadata methods the following are methods for reportextendedmetadata. all are instance methods. in this section: getaggregatecolumninfo() returns all report summaries such as record count, sum, average, max, min, and custom summary formulas. contains values for each summary that is listed in the report metadata. getdetailcolumninfo() returns a map of two properties for each field that has detailed data identified by its unique api name. the detailed data fields are also listed in the report metadata. getgroupingcolumninfo() returns a map of each row or column grouping to its metadata. contains values for each grouping that is identified in the groupingsdown and groupingsacross lists. getaggregatecolumninfo() returns all report summaries such as record count, sum, average, max, min, and custom summary formulas. contains values for each summary that is listed in the report metadata. syntax public map getaggregatecolumninfo() return value type: map 2573apex reference guide reportfact class getdetailcolumninfo() returns a map of two properties for each field that has detailed data identified by its unique api name. the detailed data fields are also listed in the report metadata. syntax public map getdetailcolumninfo() return value type: map getgroupingcolumninfo() returns a map of each row or column grouping to its metadata. contains values for each grouping that is identified in the groupingsdown and groupingsacross lists. syntax public map getgroupingcolumninfo() return value type: map reportfact class contains the fact map for the report, which represents the report’s data values. namespace reports usage reportfact is the parent class of reportfactwithdetails and reportfactwithsummaries. if includedetails is true when the report is run, the fact map is a reportfactwithdetails object. if includedetails is false when the report is run, the fact map is a reportfactwithsummaries object. reportfact methods the following are methods for reportfact. all are instance methods. in this section: getaggregates() returns summary-level data for a report, including the record count. 2574apex reference guide reportfactwithdetails class getkey() returns the unique identifier for a row or column grouping. this identifier can be used to index specific data values within each grouping. getaggregates() returns summary-level data for a report, including the record count. syntax public list getaggregates() return value type: list getkey() returns the unique identifier for a row or column grouping. this identifier can be used to index specific data values within each grouping. syntax public string getkey() return value type: string reportfactwithdetails class contains the detailed fact map for the report, which represents the report’s data values. namespace reports usage the reportfactwithdetails class extends the reportfact class. a reportfactwithdetails object is returned if includedetails is set to true when the report is run. to access the detail values, you’ll need to cast the return value of the reportresults.getfactmap method to a reportfactwithdetails object. reportfactwithdetails methods the following are methods for reportfactwithdetails. all are instance methods. 2575apex reference guide reportfactwithsummaries class in this section: getaggregates() returns summary-level data for a report, including" "the record count. getkey() returns the unique identifier for a row or column grouping. this identifier can be used to index specific data values within each grouping. getrows() returns a list of detailed report data in the order of the detail columns that are provided by the report metadata. getaggregates() returns summary-level data for a report, including the record count. syntax public list getaggregates() return value type: list getkey() returns the unique identifier for a row or column grouping. this identifier can be used to index specific data values within each grouping. syntax public string getkey() return value type: string getrows() returns a list of detailed report data in the order of the detail columns that are provided by the report metadata. syntax public list getrows() return value type: list reportfactwithsummaries class contains the fact map for the report, which represents the report’s data values, and includes summarized fields. 2576apex reference guide reportfactwithsummaries class namespace reports usage the reportfactwithsummaries class extends the reportfact class. a reportfactwithsummaries object is returned if includedetails is set to false when the report is run. reportfactwithsummaries methods the following are methods for reportfactwithsummaries. all are instance methods. in this section: getaggregates() returns summary-level data for a report, including the record count. getkey() returns the unique identifier for a row or column grouping. this identifier can be used to index specific data values within each grouping. tostring() returns a string. getaggregates() returns summary-level data for a report, including the record count. syntax public list getaggregates() return value type: list getkey() returns the unique identifier for a row or column grouping. this identifier can be used to index specific data values within each grouping. syntax public string getkey() return value type: string 2577apex reference guide reportfilter class tostring() returns a string. signature public string tostring() return value type: string reportfilter class contains information about a report filter, including column, operator, and value. namespace reports in this section: reportfilter constructors reportfilter methods reportfilter constructors the following are constructors for reportfilter. in this section: reportfilter() creates a new instance of the reports.reportfilter class. you can then set values by using the “set” methods. reportfilter(column, operator, value) creates a new instance of the reports.reportfilter class by using the specified parameters. reportfilter(column, operator, value, filtertype) creates a new instance of the reports.reportfilter class by using the specified parameters. reportfilter() creates a new instance of the reports.reportfilter class. you can then set values by using the “set” methods. signature public reportfilter() reportfilter(column, operator, value) creates a new instance of the reports.reportfilter class by using the specified parameters. 2578apex reference guide reportfilter class signature public reportfilter(string column, string operator, string value) parameters column type: string operator type: string value type: string reportfilter(column, operator, value, filtertype) creates a new instance of the reports.reportfilter class by using the specified parameters. syntax public reportfiltertype(string column, string operator, string value, reports.reportfiltertype filtertype) parameters column type: string operator type: string value type: string filtertype type: reportfiltertype enum on page 2583 reportfilter methods the following are methods for reportfilter. all are instance methods. in this section: getcolumn() returns the unique api name for the field that’s being filtered. getfiltertype() returns the type of report filter. getoperator() returns the unique api name for the condition that is used to filter a field, such as “greater than” or “not equal to.” filter conditions depend on the data type of the field. 2579apex reference guide reportfilter class" "getvalue() returns the value that the field is being filtered by. for example, the field age can be filtered by a numeric value. setcolumn(column) sets the unique api name for the field that’s being filtered. setfiltertype() sets the type of report filter. setoperator(operator) sets the unique api name for the condition that is used to filter a field, such as “greater than” or “not equal to.” filter conditions depend on the data type of the field. setvalue(value) sets the value by which a field can be filtered. for example, the field age can be filtered by a numeric value. tostring(column) returns a string representation of the filter. getcolumn() returns the unique api name for the field that’s being filtered. syntax public string getcolumn() return value type: string getfiltertype() returns the type of report filter. syntax public string getfiltertype() return value type: reportfiltertype enum on page 2583 getoperator() returns the unique api name for the condition that is used to filter a field, such as “greater than” or “not equal to.” filter conditions depend on the data type of the field. syntax public string getoperator() 2580apex reference guide reportfilter class return value type: string getvalue() returns the value that the field is being filtered by. for example, the field age can be filtered by a numeric value. syntax public string getvalue() return value type: string setcolumn(column) sets the unique api name for the field that’s being filtered. syntax public void setcolumn(string column) parameters column type: string return value type: void setfiltertype() sets the type of report filter. syntax public void setfiltertype(string column) parameters column type: string return value type: void 2581apex reference guide reportformat enum setoperator(operator) sets the unique api name for the condition that is used to filter a field, such as “greater than” or “not equal to.” filter conditions depend on the data type of the field. syntax public void setoperator(string operator) parameters operator type: string return value type: void setvalue(value) sets the value by which a field can be filtered. for example, the field age can be filtered by a numeric value. syntax public void setvalue(string value) parameters value type: string return value type: void tostring(column) returns a string representation of the filter. signature public string tostring() return value type: string reportformat enum contains the possible report format types. 2582" "apex reference guide reportfiltertype enum namespace reports enum values the following are the values of the reports.reportformat enum. value description matrix matrix report format summary summary report format tabular tabular report format reportfiltertype enum the types of values included in a report filter type. enum values the following are the values of the reports.reportfiltertype enum. value description fieldtofield field-to-field filter fieldvalue field-to-value filter reportinstance class returns an instance of a report that was run asynchronously. retrieves the results for that instance. namespace reports reportinstance methods the following are methods for reportinstance. all are instance methods. in this section: getcompletiondate() returns the date and time when the instance of the report finished running. the completion date is available only if the report instance ran successfully or couldn’t be run because of an error. date and time information is in iso-8601 format. getid() returns the unique id for an instance of a report that was run asynchronously. 2583apex reference guide reportinstance class getownerid() returns the id of the user who created the report instance. getreportid() returns the unique id of the report this instance is based on. getreportresults() retrieves results for an instance of an asynchronous report. when you request your report, you can specify whether to summarize data or include details. getrequestdate() returns the date and time when an instance of the report was run. date and time information is in iso-8601 format. getstatus() returns the status of a report. getcompletiondate() returns the date and time when the instance of the report finished running. the completion date is available only if the report instance ran successfully or couldn’t be run because of an error. date and time information is in iso-8601 format. syntax public datetime getcompletiondate() return value type: datetime getid() returns the unique id for an instance of a report that was run asynchronously. syntax public id getid() return value type: id getownerid() returns the id of the user who created the report instance. syntax public id getownerid() return value type: id 2584apex reference guide reportinstance class getreportid() returns the unique id of the report this instance is based on. syntax public id getreportid() return value type: id getreportresults() retrieves results for an instance of an asynchronous report. when you request your report, you can specify whether to summarize data or include details. syntax public reports.reportresults getreportresults() return value type: reports.reportresults getrequestdate() returns the date and time when an instance of the report was run. date and time information is in iso-8601 format. syntax public datetime getrequestdate() return value type: datetime getstatus() returns the status of a report. syntax public string getstatus() return value type: string 2585apex reference guide reportmanager class usage • new if the report run was recently triggered through a request. • success if the report ran. • running if the report is being run. • error if the report run failed. the instance of a report run can return an error if, for example, your permission to access the report was removed after you requested the run. reportmanager class runs a report synchronously or asynchronously and with or without details. namespace reports usage gets instances of reports and describes the metadata of reports. reportmanager methods the following are methods for reportmanager. all methods are static. in this section: describereport(reportid) retrieves report, report type, and extended metadata for a tabular, summary, or matrix report. getdatatypefilteroperatormap() lists the field data types that you can use to filter the report. getreportinstance(instanceid) retrieves results for an instance of a report that has been run asynchronously. the settings you use when you run your asynchronous report determine whether you can retrieve summary data or detailed data. getreportinstances(reportid) returns a list of instances for a report that was run asynchronously. each item in the list represents a separate instance of the report, with metadata for the time at which the report was run. runasyncreport(report" "id, reportmetadata, includedetails) runs a report asynchronously with the report id. includes details if includedetails is set to true. filters the report based on the report metadata in reportmetadata. runasyncreport(reportid, includedetails) runs a report asynchronously with the report id. includes details if includedetails is set to true. runasyncreport(reportid, reportmetadata) runs a report asynchronously with the report id. filters the results based on the report metadata in reportmetadata. runasyncreport(reportid) runs a report asynchronously with the report id. 2586apex reference guide reportmanager class runreport(reportid, reportmetadata, includedetails) runs a report immediately with the report id. includes details if includedetails is set to true. filters the results based on the report metadata in reportmetadata. runreport(reportid, includedetails) runs a report immediately with the report id. includes details if includedetails is set to true. runreport(reportid, reportmetadata) runs a report immediately with the report id. filters the results based on the report metadata in rmdata. runreport(reportid) runs a report immediately with the report id. describereport(reportid) retrieves report, report type, and extended metadata for a tabular, summary, or matrix report. syntax public static reports.reportdescriberesult describereport(id reportid) parameters reportid type: id return value type: reports.reportdescriberesult getdatatypefilteroperatormap() lists the field data types that you can use to filter the report. syntax public static map> getdatatypefilteroperatormap() return value type: map> getreportinstance(instanceid) retrieves results for an instance of a report that has been run asynchronously. the settings you use when you run your asynchronous report determine whether you can retrieve summary data or detailed data. syntax public static reports.reportinstance getreportinstance(id instanceid) 2587apex reference guide reportmanager class parameters instanceid type: id return value type: reports.reportinstance getreportinstances(reportid) returns a list of instances for a report that was run asynchronously. each item in the list represents a separate instance of the report, with metadata for the time at which the report was run. syntax public static list getreportinstances(id reportid) parameters reportid type: id return value type: list runasyncreport(reportid, reportmetadata, includedetails) runs a report asynchronously with the report id. includes details if includedetails is set to true. filters the report based on the report metadata in reportmetadata. syntax public static reports.reportinstance runasyncreport(id reportid, reports.reportmetadata reportmetadata, boolean includedetails) parameters reportid type: id reportmetadata type: reports.reportmetadata includedetails type: boolean return value type: reports.reportinstance 2588apex reference guide reportmanager class runasyncreport(reportid, includedetails) runs a report asynchronously with the report id. includes details if includedetails is set to true. syntax public static reports.reportinstance runasyncreport(id reportid, boolean includedetails) parameters reportid type: id includedetails type: boolean return value type: reports.reportinstance runasyncreport(reportid, reportmetadata) runs a report asynchronously with the report id. filters the results based on the report metadata in reportmetadata. syntax public static reports.reportinstance runasyncreport(id reportid, reports.reportmetadata reportmetadata) parameters reportid type: id reportmetadata type: reports.reportmetadata return value type: reports.reportinstance runasyncreport(reportid) runs a report asynchronously with the report id. syntax public static reports.reportinstance runasyncreport(id reportid) 2589apex reference guide reportmanager class parameters reportid type: id return value type: reports.reportinstance runreport(reportid, reportmetadata, includedetails) runs a report immediately with the report id." "includes details if includedetails is set to true. filters the results based on the report metadata in reportmetadata. syntax public static reports.reportresults runreport(id reportid, reports.reportmetadata reportmetadata, boolean includedetails) parameters reportid type: id reportmetadata type: reports.reportmetadata includedetails type: boolean return value type: reports.reportresults runreport(reportid, includedetails) runs a report immediately with the report id. includes details if includedetails is set to true. syntax public static reports.reportresults runreport(id reportid, boolean includedetails) parameters reportid type: id includedetails type: boolean return value type: reports.reportresults 2590apex reference guide reportmetadata class runreport(reportid, reportmetadata) runs a report immediately with the report id. filters the results based on the report metadata in rmdata. syntax public static reports.reportresults runreport(id reportid, reports.reportmetadata reportmetadata) parameters reportid type: id reportmetadata type: reports.reportmetadatareports.reportmetadata return value type: reports.reportresults runreport(reportid) runs a report immediately with the report id. syntax public static reports.reportresults runreport(id reportid) parameters reportid type: id return value type: reports.reportresults reportmetadata class contains report metadata for a tabular, summary, or matrix report. namespace reports usage report metadata gives information about the report as a whole, such as the report type, format, summary fields, row or column groupings, and filters that are saved to the report. you can use the reportmetadata class to retrieve report metadata and to set metadata that can be used to filter a report. 2591apex reference guide reportmetadata class reportmetadata methods the following are methods for reportmetadata. all are instance methods. in this section: getaggregates() returns unique identifiers for summary or custom summary formula fields in the report. getbuckets() returns a list of bucket fields in the report. getcrossfilters() returns information about cross filters applied to a report. getcurrencycode() returns report currency, such as usd, eur, or gbp, for an organization that has multicurrency enabled. the value is null if the organization does not have multicurrency enabled. getcustomsummaryformula() returns information about custom summary formulas in a report. getdescription() returns the description of the report. getdetailcolumns() returns unique api names (column names) for the fields that contain detailed data. for example, the method might return the following values: “opportunity_name, type, lead_source, amount.” getdevelopername() returns the report api name. for example, the method might return the following value: “closed_sales_this_quarter.” getdivision() returns the division specified in the report. getgroupingsacross() returns column groupings in a report. getgroupingsdown() returns row groupings for a report. gethasdetailrows() indicates whether the report has detail rows. gethasrecordcount() indicates whether the report shows the total number of records. gethistoricalsnapshotdates() returns a list of historical snapshot dates. getid() returns the unique report id. getname() returns the report name. getreportbooleanfilter() returns logic to parse custom field filters. the value is null when filter logic is not specified. 2592apex reference guide reportmetadata class getreportfilters() returns a list of each custom filter in the report along with the field name, filter operator, and filter value. getreportformat() returns the format of the report. getreporttype() returns the unique api name and display name for the report type. getscope() returns the api name for the scope defined for the report. scope values depend on the report type. getshowgrandtotal() indicates whether the report shows the grand total. getshowsubtotals() indicates whether the report shows subtotals, such as column or row totals. getsortby() returns the list of columns on which the report is sorted. currently, you can sort on only one column. getstandarddatefilter() returns information about the standard date filter for the report," "such as the start date, end date, date range, and date field api name. getstandardfilters() returns a list of standard filters for the report. gettoprows() returns information about a row limit filter, including the number of rows returned and the sort order. setaggregates(aggregates) sets unique identifiers for standard or custom summary formula fields in the report. setbuckets(buckets) creates bucket fields in a report. setcrossfilters(crossfilters) applies cross filters to a report. setcurrencycode(currencycode) sets the currency, such as usd, eur, or gbp, for report summary fields in an organization that has multicurrency enabled. setcustomsummaryformula(customsummaryformula) adds a custom summary formula to a report. setdescription(description) sets the description of the report. setdetailcolumns(detailcolumns) sets the unique api names for the fields that contain detailed data—for example, opportunity_name, type, lead_source, or amount. setdevelopername(developername) sets the report api name—for example, closed_sales_this_quarter. setdivision(division) sets the division of the report. 2593apex reference guide reportmetadata class setgroupingsacross(groupinginfo) sets column groupings in a report. setgroupingsdown(groupinginfo) sets row groupings for a report. sethasdetailrows(hasdetailrows) specifies whether the report has detail rows. sethasrecordcount(hasrecordcount) specifies whether the report is configured to show the total number of records. sethistoricalsnapshotdates(historicalsnapshot) sets a list of historical snapshot dates. setid(id) sets the unique report id. setname(name) sets the report name. setreportbooleanfilter(reportbooleanfilter) sets logic to parse custom field filters. setreportfilters(reportfilters) sets a list of each custom filter in the report along with the field name, filter operator, and filter value. setreportformat(format) sets the format of the report. setreporttype(reporttype) sets the unique api name and display name for the report type. setscope(scopename) sets the api name for the scope defined for the report. scope values depend on the report type. setshowgrandtotal(showgrandtotal) specifies whether the report shows the grand total. setshowsubtotals(showsubtotals) specifies whether the report shows subtotals, such as column or row totals. setsortby(column) sets the list of columns on which the report is sorted. currently, you can only sort on one column. setstandarddatefilter(datefilter) sets the standard date filter—which includes the start date, end date, date range, and date field api name—for the report. setstandardfilters(filters) sets one or more standard filters on the report. settoprows(toprows) applies a row limit filter to a report. getaggregates() returns unique identifiers for summary or custom summary formula fields in the report. 2594apex reference guide reportmetadata class syntax public list getaggregates() return value type: list usage for example: • a!amount represents the average for the amount column. • s!amount represents the sum of the amount column. • m!amount represents the minimum value of the amount column. • x!amount represents the maximum value of the amount column. • s! represents the sum of a custom field column. for custom fields and custom report types, the identifier is a combination of the summary type and the field id. getbuckets() returns a list of bucket fields in the report. signature public list getbuckets() return value type: list getcrossfilters() returns information about cross filters applied to a report. signature public reports.crossfilter getcrossfilters() return value type: list getcurrencycode() returns report currency, such as usd, eur, or gbp, for an organization that has multicurrency enabled. the value is null if the organ" "ization does not have multicurrency enabled. syntax public string getcurrencycode() 2595apex reference guide reportmetadata class return value type: string getcustomsummaryformula() returns information about custom summary formulas in a report. signature public map getcustomsummaryformula() return value type: map getdescription() returns the description of the report. signature public string getdescription() return value type: string getdetailcolumns() returns unique api names (column names) for the fields that contain detailed data. for example, the method might return the following values: “opportunity_name, type, lead_source, amount.” syntax public list getdetailcolumns() return value type: list getdevelopername() returns the report api name. for example, the method might return the following value: “closed_sales_this_quarter.” syntax public string getdevelopername() 2596apex reference guide reportmetadata class return value type: string getdivision() returns the division specified in the report. note: reports that use standard filters (such as my cases or my team’s accounts) show records in all divisions. these reports can’t be further limited to a specific division. signature public string getdivision() return value type: string getgroupingsacross() returns column groupings in a report. syntax public list getgroupingsacross() return value type: list usage the identifier is: • an empty array for reports in summary format, because summary reports don't include column groupings • bucketfield_(id) for bucket fields • the id of a custom field when the custom field is used for a column grouping getgroupingsdown() returns row groupings for a report. syntax public list getgroupingsdown() return value type: list 2597apex reference guide reportmetadata class usage the identifier is: • bucketfield_(id) for bucket fields • the id of a custom field when the custom field is used for grouping gethasdetailrows() indicates whether the report has detail rows. signature public boolean gethasdetailrows() return value type: boolean gethasrecordcount() indicates whether the report shows the total number of records. signature public boolean gethasrecordcount() return value type: boolean gethistoricalsnapshotdates() returns a list of historical snapshot dates. syntax public list gethistoricalsnapshotdates() return value type: list getid() returns the unique report id. syntax public id getid() 2598apex reference guide reportmetadata class return value type: id getname() returns the report name. syntax public string getname() return value type: string getreportbooleanfilter() returns logic to parse custom field filters. the value is null when filter logic is not specified. syntax public string getreportbooleanfilter() return value type: string getreportfilters() returns a list of each custom filter in the report along with the field name, filter operator, and filter value. syntax public list getreportfilters() return value type: list getreportformat() returns the format of the report. syntax public reports.reportformat getreportformat() return value type: reports.reportformat 2599apex reference guide reportmetadata class usage this value can be: • tabular • summary • matrix getreporttype() returns the unique api name and display name for the report type. syntax public reports.reporttype getreporttype() return value type: reports.reporttype getscope() returns the api name for the scope defined for the report. scope values depend on the report type. signature public string getscope() return value type: string getshowgrandtotal() indicates whether the report shows the grand total. signature public boolean getshowgrandtotal() return value type: boolean getshowsubtotals() indicates whether" "the report shows subtotals, such as column or row totals. signature public boolean getshowsubtotals() 2600apex reference guide reportmetadata class return value type: boolean getsortby() returns the list of columns on which the report is sorted. currently, you can sort on only one column. signature public list getsortby() return value type: list getstandarddatefilter() returns information about the standard date filter for the report, such as the start date, end date, date range, and date field api name. signature public reports.standarddatefilter getstandarddatefilter() return value type: reports.standarddatefilter getstandardfilters() returns a list of standard filters for the report. signature public list getstandardfilters() return value type: list gettoprows() returns information about a row limit filter, including the number of rows returned and the sort order. signature public reports.toprows gettoprows() return value type: reports.toprows 2601apex reference guide reportmetadata class setaggregates(aggregates) sets unique identifiers for standard or custom summary formula fields in the report. signature public void setaggregates(list aggregates) parameters aggregates type: list return value type: void setbuckets(buckets) creates bucket fields in a report. signature public void setbuckets(list buckets) parameters buckets type: list return value type: void setcrossfilters(crossfilters) applies cross filters to a report. signature public void setcrossfilters(list crossfilters) parameters crossfilter type: list return value type: void 2602apex reference guide reportmetadata class setcurrencycode(currencycode) sets the currency, such as usd, eur, or gbp, for report summary fields in an organization that has multicurrency enabled. signature public void setcurrencycode(string currencycode) parameters currencycode type: string return value type: void setcustomsummaryformula(customsummaryformula) adds a custom summary formula to a report. signature public void setcustomsummaryformula(map customsummaryformula) parameters customsummaryformula type: map return value type: void setdescription(description) sets the description of the report. signature public void setdescription(string description) parameters description type: string return value type: void 2603apex reference guide reportmetadata class setdetailcolumns(detailcolumns) sets the unique api names for the fields that contain detailed data—for example, opportunity_name, type, lead_source, or amount. signature public void setdetailcolumns(list detailcolumns) parameters detailcolumns type: list return value type: void setdevelopername(developername) sets the report api name—for example, closed_sales_this_quarter. signature public void setdevelopername(string developername) parameters developername type: string return value type: void setdivision(division) sets the division of the report. note: reports that use standard filters (such as my cases or my team’s accounts) show records in all divisions. these reports can’t be further limited to a specific division. signature public void setdivision(string division) parameters division type: string 2604apex reference guide reportmetadata class return value type: void setgroupingsacross(groupinginfo) sets column groupings in a report. signature public void setgroupingsacross(list groupinginfo) parameters groupinginfo type: list return value type: void setgroupingsdown(groupinginfo) sets row groupings for a report. signature public void setgroupingsdown(list" "groupinginfo) parameters groupinginfo type: list return value type: void sethasdetailrows(hasdetailrows) specifies whether the report has detail rows. signature public void sethasdetailrows(boolean hasdetailrows) parameters hasdetailrows type: boolean 2605apex reference guide reportmetadata class return value type: void sethasrecordcount(hasrecordcount) specifies whether the report is configured to show the total number of records. signature public void sethasrecordcount(boolean hasrecordcount) parameters hasrecordcount type: boolean return value type: void sethistoricalsnapshotdates(historicalsnapshot) sets a list of historical snapshot dates. syntax public void sethistoricalsnapshotdates(list historicalsnapshot) parameters historicalsnapshot type: list return value type: void setid(id) sets the unique report id. signature public void setid(id id) parameters id type: id 2606apex reference guide reportmetadata class return value type: void setname(name) sets the report name. signature public void setname(string name) parameters name type: string return value type: void setreportbooleanfilter(reportbooleanfilter) sets logic to parse custom field filters. syntax public void setreportbooleanfilter(string reportbooleanfilter) parameters reportbooleanfilter type: string return value type: void setreportfilters(reportfilters) sets a list of each custom filter in the report along with the field name, filter operator, and filter value. syntax public void setreportfilters(list reportfilters) parameters reportfilters type: list 2607apex reference guide reportmetadata class return value type: void setreportformat(format) sets the format of the report. signature public void setreportformat(reports.reportformat format) parameters format type: reports.reportformat return value type: void setreporttype(reporttype) sets the unique api name and display name for the report type. signature public void setreporttype(reports.reporttype reporttype) parameters reporttype type: reports.reporttype return value type: void setscope(scopename) sets the api name for the scope defined for the report. scope values depend on the report type. signature public void setscope(string scopename) parameters scopename type: string 2608apex reference guide reportmetadata class return value type: void setshowgrandtotal(showgrandtotal) specifies whether the report shows the grand total. signature public void setshowgrandtotal(boolean showgrandtotal) parameters showgrandtotal type: boolean return value type: void setshowsubtotals(showsubtotals) specifies whether the report shows subtotals, such as column or row totals. signature public void setshowsubtotals(boolean showsubtotals) parameters showsubtotals type: boolean return value type: void setsortby(column) sets the list of columns on which the report is sorted. currently, you can only sort on one column. signature public void setsortby(list column) parameters column type: list 2609apex reference guide reportmetadata class return value type: void setstandarddatefilter(datefilter) sets the standard date filter—which includes the start date, end date, date range, and date field api name—for the report. signature public void setstandarddatefilter(reports.standarddatefilter datefilter) parameters datefilter type: reports.standarddatefilter return value type: void setstandardfilters(filters) sets one or more standard filters on the report. signature public void setstandardfilters(list filters) parameters filters type: list return value type: void settoprows(toprows) applies a row limit filter to a report. signature public" "reports.toprows settoprows(reports.toprows toprows) parameters toprows type: reports.toprows 2610apex reference guide reportresults class return value type: void reportresults class contains the results of running a report. namespace reports reportresults methods the following are methods for reportresults. all are instance methods. in this section: getalldata() returns all report data. getfactmap() returns summary-level data or summary and detailed data for each row or column grouping. detailed data is available if the includedetails parameter is set to true when the report is run. getgroupingsacross() returns a collection of column groupings, keys, and values. getgroupingsdown() returns a collection of row groupings, keys, and values. gethasdetailrows() returns information about whether the fact map has detail rows. getreportextendedmetadata() returns additional, detailed metadata about the report, including data type and label information for groupings and summaries. getreportmetadata() returns metadata about the report, including grouping and summary information. getalldata() returns all report data. syntax public boolean getalldata() return value type: boolean 2611apex reference guide reportresults class usage when true, indicates that all report results are returned. when false, indicates that results are returned for the same number of rows as in a report run in salesforce. note: for reports that contain too many records, use filters to refine results. getfactmap() returns summary-level data or summary and detailed data for each row or column grouping. detailed data is available if the includedetails parameter is set to true when the report is run. syntax public map getfactmap() return value type: map getgroupingsacross() returns a collection of column groupings, keys, and values. syntax public reports.dimension getgroupingsacross() return value type: reports.dimension getgroupingsdown() returns a collection of row groupings, keys, and values. syntax public reports.dimension getgroupingsdown() return value type: reports.dimension gethasdetailrows() returns information about whether the fact map has detail rows. syntax public boolean gethasdetailrows() 2612apex reference guide reportscopeinfo class return value type: boolean usage • when true, indicates that the fact map returns values for summary-level and record-level data. • when false, indicates that the fact map returns summary values. getreportextendedmetadata() returns additional, detailed metadata about the report, including data type and label information for groupings and summaries. syntax public reports.reportextendedmetadata getreportextendedmetadata() return value type: reports.reportextendedmetadata getreportmetadata() returns metadata about the report, including grouping and summary information. syntax public reports.reportmetadata getreportmetadata() return value type: reports.reportmetadata reportscopeinfo class contains information about possible scope values that you can choose. scope values depend on the report type. for example, you can set the scope for opportunity reports to all opportunities, my team’s opportunities, or my opportunities. namespace reports in this section: reportscopeinfo methods reportscopeinfo methods the following are methods for reportscopeinfo. 2613apex reference guide reportscopevalue class in this section: getdefaultvalue() returns the default scope of the data to display in the report. getvalues() returns a list of scope values specified for the report. getdefaultvalue() returns the default scope of the data to display in the report. signature public string getdefaultvalue() return value type: string getvalues() returns a list of scope values specified for the report. signature public list getvalues() return value type: list reportscopevalue class contains information about a possible scope value. scope values depend on the report type. for example, you can set the scope for opportunity reports to all opportunities, my team’s opportunities, or my opportunities. namespace reports in this section: reportscopevalue methods reportscopevalue methods the following are methods for reportscopevalue. 2614apex reference guide reporttype class in this" "section: getallowsdivision() returns a boolean value that indicates whether you can segment the report by this scope. getlabel() returns the display name of the scope of the report. getvalue() returns the scope value for the report. getallowsdivision() returns a boolean value that indicates whether you can segment the report by this scope. signature public boolean getallowsdivision() return value type: boolean getlabel() returns the display name of the scope of the report. signature public string getlabel() return value type: string getvalue() returns the scope value for the report. signature public string getvalue() return value type: string reporttype class contains the unique api name and display name for the report type. 2615apex reference guide reporttypecolumn class namespace reports reporttype methods the following are methods for reporttype. all are instance methods. in this section: getlabel() returns the localized display name of the report type. gettype() returns the unique identifier of the report type. getlabel() returns the localized display name of the report type. syntax public string getlabel() return value type: string gettype() returns the unique identifier of the report type. syntax public string gettype() return value type: string reporttypecolumn class contains detailed report type metadata about a field, including data type, display name, and filter values. namespace reports 2616apex reference guide reporttypecolumn class reporttypecolumn methods the following are methods for reporttypecolumn. all are instance methods. in this section: getdatatype() returns the data type of the field. getfiltervalues() if the field data type is picklist, multi-select picklist, boolean, or checkbox, returns all filter values for a field. for example, checkbox fields always have a value of true or false. for fields of other data types, the filter value is an empty array, because their values can’t be determined. getfilterable() if the field is of a type that can’t be filtered, returns false. for example, fields of the type encrypted text can’t be filtered. getlabel() returns the localized display name of the field. getname() returns the unique api name of the field. getdatatype() returns the data type of the field. syntax public reports.columndatatype getdatatype() return value type: reports.columndatatype getfiltervalues() if the field data type is picklist, multi-select picklist, boolean, or checkbox, returns all filter values for a field. for example, checkbox fields always have a value of true or false. for fields of other data types, the filter value is an empty array, because their values can’t be determined. syntax public list getfiltervalues() return value type: list getfilterable() if the field is of a type that can’t be filtered, returns false. for example, fields of the type encrypted text can’t be filtered. 2617apex reference guide reporttypecolumncategory class syntax public boolean getfilterable() return value type: boolean getlabel() returns the localized display name of the field. syntax public string getlabel() return value type: string getname() returns the unique api name of the field. syntax public string getname() return value type: string reporttypecolumncategory class information about categories of fields in a report type. namespace reports usage a report type column category is a set of fields that the report type grants access to. for example, an opportunity report has categories like opportunity information and primary contact. the opportunity information category has fields like amount, probability, and close date. get category information about a report by first getting the report metadata: // get the report id list reportlist = [select id,developername from report where developername = 'q1_opportunities2']; 2618apex reference guide reporttypecolumncategory class string reportid = (string)reportlist.get(0).get('id'); // describe the report reports.reportdescriberesult describeresults = reports.reportmanager.describereport(reportid); // get report type metadata reports.reporttypemetadata reporttypemetadata = describeresults.getreporttypemetadata(); //" "get report type column categories list reporttypecolumncategories = reporttypemetadata.getcategories(); system.debug('reporttypecolumncategories: ' + reporttypecolumncategories); reporttypecolumncategory methods the following are methods for reporttypecolumncategory. all are instance methods. in this section: getcolumns() returns information for all fields in the report type. the information is organized by each section’s unique api name. getlabel() returns the localized display name of a section in the report type under which fields are organized. for example, in an accounts with contacts custom report type, account general is the display name of the section that contains fields on general account information. getcolumns() returns information for all fields in the report type. the information is organized by each section’s unique api name. syntax public map getcolumns() return value type: map getlabel() returns the localized display name of a section in the report type under which fields are organized. for example, in an accounts with contacts custom report type, account general is the display name of the section that contains fields on general account information. syntax public string getlabel() 2619apex reference guide reporttypemetadata class return value type: string reporttypemetadata class contains report type metadata, which gives you information about the fields that are available in each section of the report type, plus filter information for those fields. namespace reports in this section: reporttypemetadata methods reporttypemetadata methods the following are methods for reporttypemetadata. all are instance methods. in this section: getcategories() returns all fields in the report type. the fields are organized by section. getdivisioninfo() returns the default division and a list of all possible divisions that can be applied to this type of report. getscopeinfo() returns information about the scopes that can be applied to this type of report. getstandarddatefilterdurationgroups() returns information about the standard date filter groupings that can be applied to this type of report. standard date filter groupings include calendar year, calendar quarter, calendar month, calendar week, fiscal year, fiscal quarter, day and a custom value based on a user-defined date range. getstandardfilterinfos() returns information about standard date filters that can be applied to this type of report. getcategories() returns all fields in the report type. the fields are organized by section. syntax public list getcategories() return value type: list 2620apex reference guide reporttypemetadata class getdivisioninfo() returns the default division and a list of all possible divisions that can be applied to this type of report. signature public reports.reportdivisioninfo getdivisioninfo() return value type: reports.reportdivisioninfo getscopeinfo() returns information about the scopes that can be applied to this type of report. signature public reports.reportscopeinfo getscopeinfo() return value type: reports.reportscopeinfo getstandarddatefilterdurationgroups() returns information about the standard date filter groupings that can be applied to this type of report. standard date filter groupings include calendar year, calendar quarter, calendar month, calendar week, fiscal year, fiscal quarter, day and a custom value based on a user-defined date range. signature public list getstandarddatefilterdurationgroups() return value type: list getstandardfilterinfos() returns information about standard date filters that can be applied to this type of report. signature public map getstandardfilterinfos() return value type: map 2621apex reference guide sortcolumn class sortcolumn class contains information about the sort column used in the report. namespace reports in this section: sortcolumn methods sortcolumn methods the following are methods for sortcolumn. in this section: getsortcolumn() returns the column used to sort the records in the report. getsortorder() returns the the sort order— ascending or descending—for the sort column. setsortcolumn(sortcolumn) sets the column used to sort the records in the report. setsortorder(sortorder) s" "ets the sort order— ascending or descending—for the sort column. getsortcolumn() returns the column used to sort the records in the report. signature public string getsortcolumn() return value type: string getsortorder() returns the the sort order— ascending or descending—for the sort column. signature public reports.columnsortorder getsortorder() 2622apex reference guide standarddatefilter class return value type: reports.columnsortorder setsortcolumn(sortcolumn) sets the column used to sort the records in the report. signature public void setsortcolumn(string sortcolumn) parameters sortcolumn type: string return value type: void setsortorder(sortorder) sets the sort order— ascending or descending—for the sort column. signature public void setsortorder(reports.columnsortorder sortorder) parameters sortorder type: reports.columnsortorder return value type: void standarddatefilter class contains information about standard date filter available in the report—for example, the api name, start date, and end date of the standard date filter duration as well as the api name of the date field on which the filter is placed. namespace reports in this section: standarddatefilter methods 2623apex reference guide standarddatefilter class standarddatefilter methods the following are methods for standarddatefilter. in this section: getcolumn() returns the api name of the standard date filter column. getdurationvalue() returns duration information about a standard date filter, such as start date, end date, and display name and api name of the date filter. getenddate() returns the end date of the standard date filter. getstartdate() returns the start date for the standard date filter. setcolumn(standarddatefiltercolumnname) sets the api name of the standard date filter column. setdurationvalue(durationname) sets the api name of the standard date filter. setenddate(enddate) sets the end date for the standard date filter. setstartdate(startdate) sets the start date for the standard date filter. getcolumn() returns the api name of the standard date filter column. signature public string getcolumn() return value type: string getdurationvalue() returns duration information about a standard date filter, such as start date, end date, and display name and api name of the date filter. signature public string getdurationvalue() return value type: string 2624apex reference guide standarddatefilter class getenddate() returns the end date of the standard date filter. signature public string getenddate() return value type: string getstartdate() returns the start date for the standard date filter. signature public string getstartdate() return value type: string setcolumn(standarddatefiltercolumnname) sets the api name of the standard date filter column. signature public void setcolumn(string standarddatefiltercolumnname) parameters standarddatefiltercolumnname type: string return value type: void setdurationvalue(durationname) sets the api name of the standard date filter. signature public void setdurationvalue(string durationname) 2625apex reference guide standarddatefilterduration class parameters durationname type: string return value type: void setenddate(enddate) sets the end date for the standard date filter. signature public void setenddate(string enddate) parameters enddate type: string return value type: void setstartdate(startdate) sets the start date for the standard date filter. signature public void setstartdate(string startdate) parameters startdate type: string return value type: void standarddatefilterduration class contains information about each standard date filter—also referred to as a relative date filter. it contains the api name and display label of the standard date filter duration as well as the start and end dates. namespace reports 2626apex reference guide standarddatefilterduration class in this section: standarddatefilterduration methods standarddatefilterduration methods the following are methods for standarddatefilterduration. in this section: getenddate() returns the end date of the date filter. getlabel() returns the display name of the date filter. possible values are relative date filters—like current fy and current fq—and custom date filters. getstartdate() returns the" "start date of the date filter. getvalue() returns the api name of the date filter. possible values are relative date filters—like this_fiscal_year and next_fiscal_quarter—and custom date filters. getenddate() returns the end date of the date filter. signature public string getenddate() return value type: string getlabel() returns the display name of the date filter. possible values are relative date filters—like current fy and current fq—and custom date filters. signature public string getlabel() return value type: string getstartdate() returns the start date of the date filter. 2627apex reference guide standarddatefilterdurationgroup class signature public string getstartdate() return value type: string getvalue() returns the api name of the date filter. possible values are relative date filters—like this_fiscal_year and next_fiscal_quarter—and custom date filters. signature public string getvalue() return value type: string standarddatefilterdurationgroup class contains information about the standard date filter groupings, such as the grouping display label and all standard date filters that fall under the grouping. groupings include calendar year, calendar quarter, calendar month, calendar week, fiscal year, fiscal quarter, day, and custom values based on user-defined date ranges. namespace reports in this section: standarddatefilterdurationgroup methods standarddatefilterdurationgroup methods the following are methods for standarddatefilterdurationgroup. in this section: getlabel() returns the display label for the standard date filter grouping. getstandarddatefilterdurations() returns the standard date filter groupings. getlabel() returns the display label for the standard date filter grouping. 2628apex reference guide standardfilter class signature public string getlabel() return value type: string getstandarddatefilterdurations() returns the standard date filter groupings. signature public list getstandarddatefilterdurations() return value type: list for example, a standard filter date grouping might look like this: reports.standarddatefilterduration[enddate=2015-12-31, label=current fy, startdate=2015-01-01, value=this_fiscal_year], reports.standarddatefilterduration[enddate=2014-12-31, label=previous fy, startdate=2014-01-01, value=last_fiscal_year], reports.standarddatefilterduration[enddate=2014-12-31, label=previous 2 fy, startdate=2013-01-01, value=last_n_fiscal_years:2] standardfilter class contains information about the standard filter defined in the report, such as the filter field api name and filter value. namespace reports usage use to get or set standard filters on a report. standard filters vary by report type. for example, standard filters for reports on the opportunity object are show, opportunity status, and probability. in this section: standardfilter methods standardfilter methods the following are methods for standardfilter. 2629apex reference guide standardfilter class in this section: getname() return the api name of the standard filter. getvalue() returns the standard filter value. setname(name) sets the api name of the standard filter. setvalue(value) sets the standard filter value. getname() return the api name of the standard filter. signature public string getname() return value type: string getvalue() returns the standard filter value. signature public string getvalue() return value type: string setname(name) sets the api name of the standard filter. signature public void setname(string name) parameters name type: string 2630apex reference guide standardfilterinfo class return value type: void setvalue(value) sets the standard filter value. signature public void setvalue(string value) parameters value type: string return value type: void standardfilterinfo class is an abstract base class for an object that provides standard filter information. namespace reports in this section: standardfilterinfo methods standardfilterinfo methods the following are methods for standardfilterinfo. in this section: getlabel() returns the" "display label of the standard filter. gettype() returns the type of standard filter. getlabel() returns the display label of the standard filter. 2631apex reference guide standardfilterinfopicklist class signature public string getlabel() return value type: string gettype() returns the type of standard filter. signature public reports.standardfiltertype gettype() return value type: reports.standardfiltertype standardfilterinfopicklist class contains information about the standard filter picklist, such as the display name and type of the filter field, the default picklist value, and a list of all possible picklist values. namespace reports in this section: standardfilterinfopicklist methods standardfilterinfopicklist methods the following are methods for standardfilterinfopicklist. in this section: getdefaultvalue() returns the default value for the standard filter picklist. getfiltervalues() returns a list of standard filter picklist values. getlabel() returns the display name of the standard filter picklist. gettype() returns the type of the standard filter picklist. 2632" "apex reference guide standardfilterinfopicklist class getdefaultvalue() returns the default value for the standard filter picklist. signature public string getdefaultvalue() return value type: string getfiltervalues() returns a list of standard filter picklist values. signature public list getfiltervalues() return value type: list getlabel() returns the display name of the standard filter picklist. signature public string getlabel() return value type: string gettype() returns the type of the standard filter picklist. signature public reports.standardfiltertype gettype() return value type: reports.standardfiltertype 2633apex reference guide standardfiltertype enum standardfiltertype enum the standardfiltertype enum describes the type of standard filters in a report. the gettype() method returns a reports.standardfiltertype enum value. namespace reports enum values the following are the values of the reports.standardfiltertype enum. value description picklist values for the standard filter type. string string values. summaryvalue class contains summary data for a cell of the report. namespace reports summaryvalue methods the following are methods for summaryvalue. all are instance methods. in this section: getlabel() returns the formatted summary data for a specified cell. getvalue() returns the numeric value of the summary data for a specified cell. getlabel() returns the formatted summary data for a specified cell. syntax public string getlabel() return value type: string 2634apex reference guide thresholdinformation class getvalue() returns the numeric value of the summary data for a specified cell. syntax public object getvalue() return value type: object thresholdinformation class contains a list of evaluated conditions for a report notification. namespace reports in this section: thresholdinformation constructors thresholdinformation methods thresholdinformation constructors the following are constructors for thresholdinformation. in this section: thresholdinformation(evaluatedconditions) creates a new instance of the reports.evaluatedcondition class. thresholdinformation(evaluatedconditions) creates a new instance of the reports.evaluatedcondition class. signature public thresholdinformation(list evaluatedconditions) parameters evaluatedconditions type: list a list of reports.evaluatedcondition objects. 2635apex reference guide toprows class thresholdinformation methods the following are methods for thresholdinformation. in this section: getevaluatedconditions() returns a list of evaluated conditions for a report notification. getevaluatedconditions() returns a list of evaluated conditions for a report notification. signature public list getevaluatedconditions() return value type: list toprows class contains methods and constructors for working with information about a row limit filter. namespace reports in this section: toprows constructors toprows methods toprows constructors the following are constructors for toprows. in this section: toprows(rowlimit, direction) creates an instance of the reports.toprows class using the specified parameters. toprows() creates an instance of the reports.toprows class. you can then set values by using the class’s set methods. toprows(rowlimit, direction) creates an instance of the reports.toprows class using the specified parameters. 2636apex reference guide toprows class signature public toprows(integer rowlimit, reports.columnsortorder direction) parameters rowlimit type: integer the number of rows returned in the report. direction type: reports.columnsortorder the sort order of the report rows. toprows() creates an instance of the reports.toprows class. you can then set values by using the class’s set methods. signature public toprows() toprows methods the following are methods for toprows. in this section: getdirection() returns the sort order of the report rows. getrowlimit() returns the maximum number of rows shown in the report. setdirection(value) sets the sort order of the report’s rows. setdirection" "(direction) sets the sort order of the report’s rows. setrowlimit(rowlimit) sets the maximum number of rows included in the report. tostring() returns a string. getdirection() returns the sort order of the report rows. signature public reports.columnsortorder getdirection() 2637apex reference guide toprows class return value type: reports.columnsortorder getrowlimit() returns the maximum number of rows shown in the report. signature public integer getrowlimit() return value type: integer setdirection(value) sets the sort order of the report’s rows. signature public void setdirection(string value) parameters value type: string for possible values, see reports.columnsortorder. return value type: void setdirection(direction) sets the sort order of the report’s rows. signature public void setdirection(reports.columnsortorder direction) parameters direction type: reports.columnsortorder return value type: void 2638apex reference guide reports exceptions setrowlimit(rowlimit) sets the maximum number of rows included in the report. signature public void setrowlimit(integer rowlimit) parameters rowlimit type: integer return value type: void tostring() returns a string. signature public string tostring() return value type: string reports exceptions the reports namespace contains exception classes. all exception classes support built-in methods for returning the error message and exception type. see exception class and built-in exceptions on page 3021. the reports namespace contains these exceptions: exception description methods reports.featurenotsupportedexception invalid report format reports.instanceaccessexception unable to access report instance reports.invalidfilterexception filter validation error list getfiltererrors() returns a list of filter errors reports.invalidreportmetadataexception missing metadata for list getreportmetadataerrors() filters returns a list of metadata errors reports.invalidsnapshotdateexception invalid historical report list getsnapshotdateerrors() returns format a list of snapshot date errors 2639apex reference guide richmessaging namespace exception description methods reports.metadataexception no selected report columns reports.reportrunexception error running report reports.unsupportedoperationexception missing permissions for running reports richmessaging namespace provides objects and methods for handling rich messaging content. the following are the classes in the richmessaging namespace. in this section: authrequesthandler interface use this interface to handle authorization request responses. authrequestresponse class this class contains authorization request response data. authrequestresult class this class contains the result from handling the authorization request response. authrequestresultstatus enum this enum describes the authentication result status. messagedefinitioninputparameter class represents a messaging component parameter value. this class is used to provide parameter payloads that can be translated to structured content payloads in rich content messages. timeslotoption class represents a complex time slot option type. this class is used to provide time option payloads that can be translated to structured content payloads in rich content messages. authrequesthandler interface use this interface to handle authorization request responses. namespace richmessaging on page 2640 usage when using this interface, the following limits are overridden. see execution governors and limits in the apex developer guide. 2640apex reference guide authrequesthandler interface table 1: overridden limits limit name overridden value total number of soql queries issued 2 total number of records retrieved by a single sosl query 2 total number of dml statements issued 1 total number of records processed as a result of dml statements 1 total number of callouts (http requests or web services calls) in a 2 transaction in this section: authrequesthandler methods authrequesthandler example implementation authrequesthandler methods the following are methods for authrequesthandler. in this section: handleauthrequest(var1) handles authorization request response. handleauthrequest(var1) handles authorization request response. signature public richmessaging.authrequestresult handleauthrequest(richmessaging.authrequestresponse var1) parameters var1 type: richmessaging.authrequestresponse on page 2643 the authorization response. return value type: richmessaging.authrequestresult on page 2645 2641apex reference guide authrequesthandler interface authrequesthandler example implementation" "this is an example implementation of the richmessaging.authrequesthandler interface. global class sampleauthrequesthandler implements richmessaging.authrequesthandler { global richmessaging.authrequestresult handleauthrequest(richmessaging.authrequestresponse authreqresponse) { // get contact email from messaging session string sessionid = authreqresponse.getcontextrecordid(); string contactemail = [select messagingsession.endusercontact.email from messagingsession where id = :sessionid].endusercontact.email; richmessaging.authrequestresultstatus authrequeststatus = richmessaging.authrequestresultstatus.declined; datetime dt = datetime.now(); // get user info if there's a valid contact email if (!string.isblank(contactemail)) { string userinfourl = 'https://api.my_auth_domain.com/v1/'; httprequest req = new httprequest(); req.setendpoint(userinfourl); req.setheader('content-type','application/json'); req.setmethod('get'); req.setheader('authorization', 'bearer '+authreqresponse.getaccesstoken()); http http = new http(); httpresponse res = http.send(req); string responsebody = res.getbody(); userwrapper userinfo = (userwrapper)system.json.deserialize(responsebody, userwrapper.class); if (userinfo.email == contactemail) { authrequeststatus = richmessaging.authrequestresultstatus.authenticated; dt = dt.addhours(6); } } return new richmessaging.authrequestresult( null, authrequeststatus, dt); } public class userwrapper{ public string href; public string display_name; public string type; public string country; public string product; public string email; 2642apex reference guide authrequestresponse class } } authrequestresponse class this class contains authorization request response data. namespace richmessaging in this section: authrequestresponse constructors authrequestresponse methods authrequestresponse constructors the following are constructors for authrequestresponse. in this section: authrequestresponse(accesstoken, contextrecordid, authprovidername) creates a new instance of the richmessaging.authrequestresponse class. authrequestresponse(accesstoken, contextrecordid, authprovidername) creates a new instance of the richmessaging.authrequestresponse class. signature public authrequestresponse(string accesstoken, string contextrecordid, string authprovidername) parameters accesstoken type: string the authorization access token. contextrecordid type: string the context record id. authprovidername type: string the provider name. 2643apex reference guide authrequestresponse class authrequestresponse methods the following are methods for authrequestresponse. in this section: getaccesstoken() gets the authorization access token. getauthprovidername() get the authorization provider name. getcontextrecordid() gets the context record id. getaccesstoken() gets the authorization access token. signature public string getaccesstoken() return value type: string the access token. getauthprovidername() get the authorization provider name. signature public string getauthprovidername() return value type: string the authorization provider name. getcontextrecordid() gets the context record id. signature public string getcontextrecordid() 2644apex reference guide authrequestresult class return value type: string the context record id. authrequestresult class this class contains the result from handling the authorization request response. namespace richmessaging in this section: authrequestresult constructors authrequestresult properties authrequestresult constructors the following are constructors for authrequestresult. in this section: authrequestresult(redirectpagereference, resultstatus, expirationdatetime) creates a new instance of the richmessaging.authrequestresult class. authrequestresult(redirectpagereference, resultstatus, expirationdatetime) creates a new instance of the richmessaging.authrequestresult class. signature public authrequestresult(system.pagereference redirectpagereference, richmessaging.authrequestresultstatus resultstatus, datetime expirationdatetime) parameters redirectpagereference type: system.pagereference on page 3214" the reference to the redirect page. resultstatus type: richmessaging.authrequestresultstatus on page 2647 the result status value. expirationdatetime type: datetime the expiration time. 2645apex reference guide authrequestresult class authrequestresult properties the following are properties for authrequestresult. in this section: expirationdatetime the expiration date and time. redirectpagereference the reference to the redirect page. resultstatus the result status value. expirationdatetime the expiration date and time. signature public datetime expirationdatetime {get; set;} property value type: datetime redirectpagereference the reference to the redirect page. signature public system.pagereference redirectpagereference {get; set;} property value type: system.pagereference on page 3214 resultstatus the result status value. signature public richmessaging.authrequestresultstatus resultstatus {get; set;} property value type: richmessaging.authrequestresultstatus on page 2647 2646apex reference guide authrequestresultstatus enum authrequestresultstatus enum this enum describes the authentication result status. enum values the following are the values of the richmessaging.authrequestresultstatus enum. value description authenticated authenticated result. declined declined result. messagedefinitioninputparameter class represents a messaging component parameter value. this class is used to provide parameter payloads that can be translated to structured content payloads in rich content messages. namespace richmessaging in this section: messagedefinitioninputparameter properties messagedefinitioninputparameter properties the following are properties for messagedefinitioninputparameter. in this section: booleanvalue a boolean input parameter. booleanvalues a list of boolean parameters. datetimevalue a datetime input parameter. datetimevalues a list of datetime input parameters. datevalue a date input parameter. datevalues a list of date input parameters. 2647apex reference guide messagedefinitioninputparameter class name a name input parameter. numbervalue a number input parameter. numbervalues a list of number input parameters. recordidvalue a record id input parameter. recordidvalues a list of record id input parameters. textvalue a text input parameter. textvalues a list of text input parameters. booleanvalue a boolean input parameter. signature public boolean booleanvalue {get; set;} property value type: boolean booleanvalues a list of boolean parameters. signature public list booleanvalues {get; set;} property value type: list on page 3123 datetimevalue a datetime input parameter. signature public datetime datetimevalue {get; set;} 2648apex reference guide messagedefinitioninputparameter class property value type: datetime datetimevalues a list of datetime input parameters. signature public list datetimevalues {get; set;} property value type: list on page 3123 datevalue a date input parameter. signature public date datevalue {get; set;} property value type: date datevalues a list of date input parameters. signature public list datevalues {get; set;} property value type: list on page 3123 name a name input parameter. signature public string name {get; set;} property value type: string 2649apex reference guide messagedefinitioninputparameter class numbervalue a number input parameter. signature public double numbervalue {get; set;} property value type: double numbervalues a list of number input parameters. signature public list numbervalues {get; set;} property value type: list on page 3123 recordidvalue a record id input parameter. signature public string recordidvalue {get; set;} property value type: string recordidvalues a list of record id input parameters. signature public list recordidvalues {get; set;} property value type: list on page 3123 textvalue a text input parameter. 2650apex reference guide timeslotoption class signature public string textvalue {get; set;} property value type: string textvalues a list of text input parameters. signature public list textvalues {get; set ";} property value type: list on page 3123 timeslotoption class represents a complex time slot option type. this class is used to provide time option payloads that can be translated to structured content payloads in rich content messages. namespace richmessaging in this section: timeslotoption constructors timeslotoption properties timeslotoption constructors the following are constructors for timeslotoption. in this section: timeslotoption(starttime, endtime) creates a timeslotoption object with a start and end time. timeslotoption(starttime, duration) creates a timeslotoption object with a start time and a duration. timeslotoption() creates a timeslotoption object. 2651apex reference guide timeslotoption class timeslotoption(starttime, endtime) creates a timeslotoption object with a start and end time. signature public timeslotoption(datetime starttime, datetime endtime) parameters starttime type: datetime start time. endtime type: datetime end time. timeslotoption(starttime, duration) creates a timeslotoption object with a start time and a duration. signature public timeslotoption(datetime starttime, integer duration) parameters starttime type: datetime start time. duration type: integer duration in seconds. timeslotoption() creates a timeslotoption object. signature public timeslotoption() timeslotoption properties the following are properties for timeslotoption. 2652apex reference guide schema namespace in this section: duration the duration in seconds. starttime the start time. duration the duration in seconds. signature public integer duration {get; set;} property value type: integer starttime the start time. signature public datetime starttime {get; set;} property value type: datetime schema namespace the schema namespace provides classes and methods for schema metadata information. the following are the classes in the schema namespace. in this section: childrelationship class contains methods for accessing the child relationship as well as the child sobject for a parent sobject. datacategory class represents the categories within a category group. datacategorygroupsobjecttypepair class specifies a category group and an associated object. describecolorresult class contains color metadata information for a tab. 2653apex reference guide childrelationship class describedatacategorygroupresult class contains the list of the category groups associated with knowledgearticleversion and question. describedatacategorygroupstructureresult class contains the category groups and categories associated with knowledgearticleversion and question. describefieldresult class contains methods for describing sobject fields. describeiconresult class contains icon metadata information for a tab. describesobjectresult class contains methods for describing sobjects. none of the methods take an argument. describetabresult class contains tab metadata information for a tab in a standard or custom app available in the salesforce user interface. describetabsetresult class contains metadata information about a salesforce classic standard or custom app available in the salesforce user interface. displaytype enum a schema.displaytype enum value is returned by the field describe result's gettype method. fielddescribeoptions enum a schema.fielddescribeoptions enum value is a parameter in the sobjecttype.getdescribe method. fieldset class contains methods for discovering and retrieving the details of field sets created on sobjects. fieldsetmember class contains methods for accessing the metadata for field set member fields. picklistentry class represents a picklist entry. recordtypeinfo class contains methods for accessing record type information for an sobject with associated record types. soaptype enum a schema.soaptype enum value is returned by the field describe result getsoaptype method. sobjectdescribeoptions enum a schema.sobjectdescribeoptions enum value is a parameter in the sobjecttype.getdescribe method. sobjectfield class a schema.sobjectfield object is returned from the field describe result using the getcontroller and getsobjectfield methods. sobjecttype class a schema.sobjecttype object is returned from the field describe result using the getreferenceto method, or from the sobject describe result using the getsobjecttype method. childrelationship class contains methods for accessing the child relationship" "as well as the child sobject for a parent sobject. 2654apex reference guide childrelationship class namespace schema example a childrelationship object is returned from the sobject describe result using the getchildrelationship method. for example: schema.describesobjectresult r = account.sobjecttype.getdescribe(); list c = r.getchildrelationships(); childrelationship methods the following are methods for childrelationship. all are instance methods. in this section: getchildsobject() returns the token of the child sobject on which there is a foreign key back to the parent sobject. getfield() returns the token of the field that has a foreign key back to the parent sobject. getrelationshipname() returns the name of the relationship. iscascadedelete() returns true if the child object is deleted when the parent object is deleted, false otherwise. isdeprecatedandhidden() reserved for future use. isrestricteddelete() returns true if the parent object can't be deleted because it is referenced by a child object, false otherwise. getchildsobject() returns the token of the child sobject on which there is a foreign key back to the parent sobject. signature public schema.sobjecttype getchildsobject() return value type: schema.sobjecttype getfield() returns the token of the field that has a foreign key back to the parent sobject. 2655apex reference guide childrelationship class signature public schema.sobjectfield getfield() return value type: schema.sobjectfield getrelationshipname() returns the name of the relationship. signature public string getrelationshipname() return value type: string iscascadedelete() returns true if the child object is deleted when the parent object is deleted, false otherwise. signature public boolean iscascadedelete() return value type: boolean isdeprecatedandhidden() reserved for future use. signature public boolean isdeprecatedandhidden() return value type: boolean isrestricteddelete() returns true if the parent object can't be deleted because it is referenced by a child object, false otherwise. signature public boolean isrestricteddelete() 2656apex reference guide datacategory class return value type: boolean datacategory class represents the categories within a category group. namespace schema usage the schema.datacategory object is returned by the gettopcategories method. datacategory methods the following are methods for datacategory. all are instance methods. in this section: getchildcategories() returns a recursive object that contains the visible sub categories in the data category. getlabel() returns the label for the data category used in the salesforce user interface. getname() returns the unique name used by the api to access to the data category. getchildcategories() returns a recursive object that contains the visible sub categories in the data category. signature public schema.datacategory getchildcategories() return value type: list getlabel() returns the label for the data category used in the salesforce user interface. signature public string getlabel() 2657apex reference guide datacategorygroupsobjecttypepair class return value type: string getname() returns the unique name used by the api to access to the data category. signature public string getname() return value type: string datacategorygroupsobjecttypepair class specifies a category group and an associated object. namespace schema usage schema.datacategorygroupsobjecttypepair is used by the describedatacategory groupstructures method to return the categories available to this object. in this section: datacategorygroupsobjecttypepair constructors datacategorygroupsobjecttypepair methods datacategorygroupsobjecttypepair constructors the following are constructors for datacategorygroupsobjecttypepair. in this section: datacategorygroupsobjecttypepair() creates a new instance of the schema.datacategorygroupsobjecttypepair class. datacategorygroupsobjecttypepair() creates a new instance of the schema.datacategorygroupsobjecttypepair class. signature public datacategorygroupsobjecttypepair() 2658apex reference guide datacategorygroupsobjecttypepair class datacategorygroupsobjecttypepair methods" "the following are methods for datacategorygroupsobjecttypepair. all are instance methods. in this section: getdatacategorygroupname() returns the unique name used by the api to access the data category group. getsobject() returns the object name associated with the data category group. setdatacategorygroupname(name) specifies the unique name used by the api to access the data category group. setsobject(sobjectname) sets the sobject associated with the data category group. getdatacategorygroupname() returns the unique name used by the api to access the data category group. signature public string getdatacategorygroupname() return value type: string getsobject() returns the object name associated with the data category group. signature public string getsobject() return value type: string setdatacategorygroupname(name) specifies the unique name used by the api to access the data category group. signature public string setdatacategorygroupname(string name) 2659apex reference guide describecolorresult class parameters name type: string return value type: void setsobject(sobjectname) sets the sobject associated with the data category group. signature public void setsobject(string sobjectname) parameters sobjectname type: string the sobjectname is the object name associated with the data category group. valid values are: • knowledgearticleversion—for article types. • question—for questions from answers. return value type: void describecolorresult class contains color metadata information for a tab. namespace schema usage the getcolors method of the schema.describetabresult class returns a list of schema.describecolorresult objects that describe colors used in a tab. the methods in the schema.describecolorresult class can be called using their property counterparts. for each method starting with get, you can omit the get prefix and the ending parentheses () to call the property counterpart. for example, colorresultobj.color is equivalent to colorresultobj.getcolor(). 2660apex reference guide describecolorresult class example this sample shows how to get the color information in the sales app for the first tab’s first color. // get tab set describes for each app list tabsetdesc = schema.describetabs(); // iterate through each tab set describe for each app and display the info for(schema.describetabsetresult tsr : tabsetdesc) { // display tab info for the sales app if (tsr.getlabel() == 'sales') { // get color information for the first tab list colordesc = tsr.gettabs()[0].getcolors(); // display the icon color, theme, and context of the first color returned system.debug('color: ' + colordesc[0].getcolor()); system.debug('theme: ' + colordesc[0].gettheme()); system.debug('context: ' + colordesc[0].getcontext()); } } // example debug statement output // debug|color: 1797c0 // debug|theme: theme4 // debug|context: primary describecolorresult methods the following are methods for describecolorresult. all are instance methods. in this section: getcolor() returns the web rgb color code, such as 00ff00. getcontext() returns the color context. the context determines whether the color is the main color for the tab or not. gettheme() returns the color theme. getcolor() returns the web rgb color code, such as 00ff00. signature public string getcolor() return value type: string 2661apex reference guide describedatacategorygroupresult class getcontext() returns the color context. the context determines whether the color is the main color for the tab or not. signature public string getcontext() return value type: string gettheme() returns the color theme. signature public string gettheme() return value type: string possible theme values include theme3, theme4, and custom. • theme3 is the salesforce theme introduced during spring ‘10. • theme4 is the salesforce theme introduced in winter ‘14 for the mobile touchscreen version of salesforce. • custom is the theme name associated with a custom icon. describedatacategorygroupresult class contains the list of the" "category groups associated with knowledgearticleversion and question. namespace schema usage the describedatacategorygroups method returns a schema.describedatacategorygroupresult object containing the list of the category groups associated with the specified object. for additional information and code examples using describedatacategorygroups, see accessing all data categories associated with an sobject. example the following is an example of how to instantiate a data category group describe result object: list objtype = new list(); objtype.add('knowledgearticleversion'); 2662apex reference guide describedatacategorygroupresult class objtype.add('question'); list describecategoryresult = schema.describedatacategorygroups(objtype); describedatacategorygroupresult methods the following are methods for describedatacategorygroupresult. all are instance methods. in this section: getcategorycount() returns the number of visible data categories in the data category group. getdescription() returns the description of the data category group. getlabel() returns the label for the data category group used in the salesforce user interface. getname() returns the unique name used by the api to access to the data category group. getsobject() returns the object name associated with the data category group. getcategorycount() returns the number of visible data categories in the data category group. signature public integer getcategorycount() return value type: integer getdescription() returns the description of the data category group. signature public string getdescription() return value type: string 2663apex reference guide describedatacategorygroupstructureresult class getlabel() returns the label for the data category group used in the salesforce user interface. signature public string getlabel() return value type: string getname() returns the unique name used by the api to access to the data category group. signature public string getname() return value type: string getsobject() returns the object name associated with the data category group. signature public string getsobject() return value type: string describedatacategorygroupstructureresult class contains the category groups and categories associated with knowledgearticleversion and question. namespace schema usage the describedatacategorygroupstructures method returns a list of schema.describe datacategorygroupstructureresult objects containing the category groups and categories associated with the specified object. for additional information and code examples, see accessing all data categories associated with an sobject. 2664apex reference guide describedatacategorygroupstructureresult class example the following is an example of how to instantiate a data category group structure describe result object: list pairs = new list(); datacategorygroupsobjecttypepair pair1 = new datacategorygroupsobjecttypepair(); pair1.setsobject('knowledgearticleversion'); pair1.setdatacategorygroupname('regions'); datacategorygroupsobjecttypepair pair2 = new datacategorygroupsobjecttypepair(); pair2.setsobject('questions'); pair2.setdatacategorygroupname('regions'); pairs.add(pair1); pairs.add(pair2); listresults = schema.describedatacategorygroupstructures(pairs, true); describedatacategorygroupstructureresult methods the following are methods for describedatacategorygroupstructureresult. all are instance methods. in this section: getdescription() returns the description of the data category group. getlabel() returns the label for the data category group used in the salesforce user interface. getname() returns the unique name used by the api to access to the data category group. getsobject() returns the name of object associated with the data category group. gettopcategories() returns a schema.datacategory object, that contains the top categories visible depending on the user's data category group visibility settings. getdescription() returns the description of the data category group. signature public string getdescription() 2665apex reference guide describedatacategorygroupstructureresult class return value type: string getlabel() returns the label for the data category group used in the salesforce user interface. signature public string getlabel() return value type: string" "getname() returns the unique name used by the api to access to the data category group. signature public string getname() return value type: string getsobject() returns the name of object associated with the data category group. signature public string getsobject() return value type: string gettopcategories() returns a schema.datacategory object, that contains the top categories visible depending on the user's data category group visibility settings. signature public list gettopcategories() 2666apex reference guide describefieldresult class return value type: list usage for more information on data category group visibility, see “data category visibility” in the salesforce online help. describefieldresult class contains methods for describing sobject fields. namespace schema usage instances of field describe results on the same describefieldresult aren’t guaranteed to be equal because the state and behavior of a describe object is determined by various factors including the api version used. to compare describe results, call the getsobjectfield() method on the field describe results and use the equality operator (==) to compare the sobjectfield values. example the following is an example of how to instantiate a field describe result object: schema.describefieldresult dfr = account.description.getdescribe(); describefieldresult methods the following are methods for describefieldresult. all are instance methods. in this section: getbytelength() for variable-length fields (including binary fields), returns the maximum size of the field, in bytes. getcalculatedformula() returns the formula specified for this field. getcontroller() returns the token of the controlling field. getdefaultvalue() returns the default value for this field. getdefaultvalueformula() returns the default value specified for this field if a formula is not used. getdigits() returns the maximum number of digits specified for the field. this method is only valid with integer fields. 2667apex reference guide describefieldresult class getinlinehelptext() returns the content of the field-level help. getlabel() returns the text label that is displayed next to the field in the salesforce user interface. this label can be localized. getlength() returns the maximum size of the field for the describefieldresult object in unicode characters (not bytes). getlocalname() returns the name of the field, similar to the getname method. however, if the field is part of the current namespace, the namespace portion of the name is omitted. getname() returns the field name used in apex. getpicklistvalues() returns a list of picklistentry objects. a runtime error is returned if the field is not a picklist. getprecision() for fields of type double, returns the maximum number of digits that can be stored, including all numbers to the left and to the right of the decimal point (but excluding the decimal point character). getreferencetargetfield() returns the name of the custom field on the parent standard or custom object whose values are matched against the values of the child external object's indirect lookup relationship field. the match is done to determine which records are related to each other. getreferenceto() returns a list of schema.sobjecttype objects for the parent objects of this field. if the isnamepointing method returns true, there is more than one entry in the list, otherwise there is only one. getrelationshipname() returns the name of the relationship. getrelationshiporder() returns 1 if the field is a child, 0 otherwise. getscale() for fields of type double, returns the number of digits to the right of the decimal point. any extra digits to the right of the decimal point are truncated. getsoaptype() returns one of the soaptype enum values, depending on the type of field. getsobjectfield() returns the token for this field. getsobjecttype() returns the salesforce object type from which this field originates. gettype() returns one of the displaytype enum values, depending on the type of field. isaccessible() returns true if the current user can see this field, false otherwise. isaipredictionfield() (beta) returns true if the current field is enabled to display einstein prediction data, false otherwise. 2668apex reference guide describefieldresult class isautonumber() returns true if the field is an auto number field, false otherwise. iscalculated" "() returns true if the field is a custom formula field, false otherwise. note that custom formula fields are always read-only. iscascadedelete() returns true if the child object is deleted when the parent object is deleted, false otherwise. iscasesensitive() returns true if the field is case sensitive, false otherwise. iscreateable() returns true if the field can be created by the current user, false otherwise. iscustom() returns true if the field is a custom field, false if it is a standard field, such as name. isdefaultedoncreate() returns true if the field receives a default value when created, false otherwise. isdependentpicklist() returns true if the picklist is a dependent picklist, false otherwise. isdeprecatedandhidden() reserved for future use. isencrypted() returns true if the field is encrypted with shield platform encryption, false otherwise. isexternalid() returns true if the field is used as an external id, false otherwise. isfilterable() returns true if the field can be used as part of the filter criteria of a where statement, false otherwise. isformulatreatnullnumberaszero() returns true if null is treated as zero in a formula field, false otherwise. isgroupable() returns true if the field can be included in the group by clause of a soql query, false otherwise. this method is only available for apex classes and triggers saved using api version 18.0 and higher. ishtmlformatted() returns true if the field has been formatted for html and should be encoded for display in html, false otherwise. one example of a field that returns true for this method is a hyperlink custom formula field. another example is a custom formula field that has an image text function. isidlookup() returns true if the field can be used to specify a record in an upsert method, false otherwise. isnamefield() returns true if the field is a name field, false otherwise. isnamepointing() returns true if the field can have multiple types of objects as parents. for example, a task can have both the contact/lead id (whoid) field and the opportunity/account id (whatid) field return true for this method. because either of those objects can be the parent of a particular task record. this method returns false otherwise. 2669apex reference guide describefieldresult class isnillable() returns true if the field is nillable, false otherwise. a nillable field can have empty content. a non-nillable field must have a value for the object to be created or saved. ispermissionable() returns true if field permissions can be specified for the field, false otherwise. isrestricteddelete() returns true if the parent object can't be deleted because it is referenced by a child object, false otherwise. isrestrictedpicklist() returns true if the field is a restricted picklist, false otherwise issearchprefilterable() returns true if a foreign key can be included in prefiltering when used in a sosl where clause, false otherwise. issortable() returns true if a query can sort on the field, false otherwise isunique() returns true if the value for the field must be unique, false otherwise isupdateable() returns true if the field can be edited by the current user, or child records in a master-detail relationship field on a custom object can be reparented to different parent records; false otherwise. iswriterequiresmasterread() returns true if writing to the detail object requires read sharing instead of read/write sharing of the parent. getbytelength() for variable-length fields (including binary fields), returns the maximum size of the field, in bytes. signature public integer getbytelength() return value type: integer getcalculatedformula() returns the formula specified for this field. signature public string getcalculatedformula() return value type: string 2670apex reference guide describefieldresult class getcontroller() returns the token of the controlling field. signature public schema.sobjectfield getcontroller() return value type: schema.sobjectfield getdefaultvalue() returns the default value for this field. signature public object getdefaultvalue() return value type: object getdefaultvalueformula() returns the default value specified for this field if a formula is not used. signature public string getdefaultvalueformula() return value type: string getdigits() returns the maximum number of digits specified for the field. this" "method is only valid with integer fields. signature public integer getdigits() return value type: integer getinlinehelptext() returns the content of the field-level help. 2671apex reference guide describefieldresult class signature public string getinlinehelptext() return value type: string usage for more information, see “define field-level help” in the salesforce online help. getlabel() returns the text label that is displayed next to the field in the salesforce user interface. this label can be localized. signature public string getlabel() return value type: string usage note: for the type field on standard objects, getlabel returns a label different from the default label. it returns a label of the form object type, where object is the standard object label. for example, for the type field on account, getlabel returns account type instead of the default label type. if the type label is renamed, getlabel returns the new label. you can check or change the labels of all standard object fields from setup by entering rename tabs and labels in the quick find box, then selecting rename tabs and labels. getlength() returns the maximum size of the field for the describefieldresult object in unicode characters (not bytes). signature public integer getlength() return value type: integer getlocalname() returns the name of the field, similar to the getname method. however, if the field is part of the current namespace, the namespace portion of the name is omitted. 2672apex reference guide describefieldresult class signature public string getlocalname() return value type: string getname() returns the field name used in apex. signature public string getname() return value type: string getpicklistvalues() returns a list of picklistentry objects. a runtime error is returned if the field is not a picklist. signature public list getpicklistvalues() return value type: list getprecision() for fields of type double, returns the maximum number of digits that can be stored, including all numbers to the left and to the right of the decimal point (but excluding the decimal point character). signature public integer getprecision() return value type: integer getreferencetargetfield() returns the name of the custom field on the parent standard or custom object whose values are matched against the values of the child external object's indirect lookup relationship field. the match is done to determine which records are related to each other. 2673apex reference guide describefieldresult class signature public string getreferencetargetfield() return value type: string usage for information about indirect lookup relationships, see “indirect lookup relationship fields on external objects” in the salesforce help. getreferenceto() returns a list of schema.sobjecttype objects for the parent objects of this field. if the isnamepointing method returns true, there is more than one entry in the list, otherwise there is only one. signature public list getreferenceto() return value type: list versioned behavior changes in api version 51.0 and later, the getreferenceto() method returns referenced objects that aren’t accessible to the context user. if the context user has access to an object’s field that references another object, irrespective of the context user’s access to the cross-referenced object, the method returns references. in api version 50.0 and earlier, if the context user doesn’t have access to the cross-referenced object, the method returns an empty list. getrelationshipname() returns the name of the relationship. signature public string getrelationshipname() return value type: string usage for more information about relationships and relationship names, see understanding relationship names in the soql and sosl reference. getrelationshiporder() returns 1 if the field is a child, 0 otherwise. 2674apex reference guide describefieldresult class signature public integer getrelationshiporder() return value type: integer usage for more information about relationships and relationship names, see understanding relationship names in the soql and sosl reference. getscale() for fields of type double, returns the number of digits to the right of the decimal point. any extra digits to the right of the decimal point are truncated. signature public integer" "getscale() return value type: integer usage this method returns a fault response if the number has too many digits to the left of the decimal point. getsoaptype() returns one of the soaptype enum values, depending on the type of field. signature public schema.soaptype getsoaptype() return value type: schema.soaptype getsobjectfield() returns the token for this field. signature public schema.sobjectfield getsobjectfield() return value type: schema.sobjectfield 2675apex reference guide describefieldresult class getsobjecttype() returns the salesforce object type from which this field originates. signature public schema.sobjecttype getsobjecttype() return value type: schema.sobjecttype example schema.describefieldresult f = account.industry.getdescribe(); schema.sobjecttype sourcetype = f.getsobjecttype(); assert.areequal(account.sobjecttype, sourcetype); gettype() returns one of the displaytype enum values, depending on the type of field. signature public schema.displaytype gettype() return value type: schema.displaytype isaccessible() returns true if the current user can see this field, false otherwise. signature public boolean isaccessible() return value type: boolean isaipredictionfield() (beta) returns true if the current field is enabled to display einstein prediction data, false otherwise. signature public boolean isaipredictionfield() 2676apex reference guide describefieldresult class return value type: boolean usage custom number fields can be set to display einstein prediction values. if you are participating in the einstein prediction builder beta program, use einstein prediction builder to set up the value to display. use this method to find out if a field is enabled to display an einstein prediction value. isautonumber() returns true if the field is an auto number field, false otherwise. signature public boolean isautonumber() return value type: boolean usage analogous to a sql identity type, auto number fields are read-only, non-createable text fields with a maximum length of 30 characters. auto number fields are used to provide a unique id that is independent of the internal object id (such as a purchase order number or invoice number). auto number fields are configured entirely in the salesforce user interface. iscalculated() returns true if the field is a custom formula field, false otherwise. note that custom formula fields are always read-only. signature public boolean iscalculated() return value type: boolean iscascadedelete() returns true if the child object is deleted when the parent object is deleted, false otherwise. signature public boolean iscascadedelete() return value type: boolean 2677apex reference guide describefieldresult class iscasesensitive() returns true if the field is case sensitive, false otherwise. signature public boolean iscasesensitive() return value type: boolean iscreateable() returns true if the field can be created by the current user, false otherwise. signature public boolean iscreateable() return value type: boolean iscustom() returns true if the field is a custom field, false if it is a standard field, such as name. signature public boolean iscustom() return value type: boolean isdefaultedoncreate() returns true if the field receives a default value when created, false otherwise. signature public boolean isdefaultedoncreate() return value type: boolean 2678apex reference guide describefieldresult class usage if this method returns true, salesforce implicitly assigns a value for this field when the object is created, even if a value for this field is not passed in on the create call. for example, in the opportunity object, the probability field has this attribute because its value is derived from the stage field. similarly, the owner has this attribute on most objects because its value is derived from the current user (if the owner field is not specified). isdependentpicklist() returns true if the picklist is a dependent picklist, false otherwise. signature public boolean isdependentpicklist() return value type: boolean isdeprecatedandhidden() reserved for future use. signature public boolean isdeprecatedandhidden() return value type: boolean isencrypted() returns true if the field is encrypted" "with shield platform encryption, false otherwise. signature public boolean isencrypted() return value type: boolean isexternalid() returns true if the field is used as an external id, false otherwise. signature public boolean isexternalid() 2679apex reference guide describefieldresult class return value type: boolean isfilterable() returns true if the field can be used as part of the filter criteria of a where statement, false otherwise. signature public boolean isfilterable() return value type: boolean isformulatreatnullnumberaszero() returns true if null is treated as zero in a formula field, false otherwise. signature public boolean isformulatreatnullnumberaszero() return value type: boolean isgroupable() returns true if the field can be included in the group by clause of a soql query, false otherwise. this method is only available for apex classes and triggers saved using api version 18.0 and higher. signature public boolean isgroupable() return value type: boolean ishtmlformatted() returns true if the field has been formatted for html and should be encoded for display in html, false otherwise. one example of a field that returns true for this method is a hyperlink custom formula field. another example is a custom formula field that has an image text function. signature public boolean ishtmlformatted() 2680apex reference guide describefieldresult class return value type: boolean isidlookup() returns true if the field can be used to specify a record in an upsert method, false otherwise. signature public boolean isidlookup() return value type: boolean isnamefield() returns true if the field is a name field, false otherwise. signature public boolean isnamefield() return value type: boolean usage this method is used to identify the name field for standard objects (such as accountname for an account object) and custom objects. objects can only have one name field, except where the firstname and lastname fields are used instead (such as on the contact object). if a compound name is present, for example, the name field on a person account, isnamefield is set to true for that record. isnamepointing() returns true if the field can have multiple types of objects as parents. for example, a task can have both the contact/lead id (whoid) field and the opportunity/account id (whatid) field return true for this method. because either of those objects can be the parent of a particular task record. this method returns false otherwise. signature public boolean isnamepointing() return value type: boolean 2681apex reference guide describefieldresult class isnillable() returns true if the field is nillable, false otherwise. a nillable field can have empty content. a non-nillable field must have a value for the object to be created or saved. signature public boolean isnillable() return value type: boolean ispermissionable() returns true if field permissions can be specified for the field, false otherwise. signature public boolean ispermissionable() return value type: boolean isrestricteddelete() returns true if the parent object can't be deleted because it is referenced by a child object, false otherwise. signature public boolean isrestricteddelete() return value type: boolean isrestrictedpicklist() returns true if the field is a restricted picklist, false otherwise signature public boolean isrestrictedpicklist() return value type: boolean 2682" "apex reference guide describefieldresult class issearchprefilterable() returns true if a foreign key can be included in prefiltering when used in a sosl where clause, false otherwise. signature public boolean issearchprefilterable() return value type: boolean usage prefiltering means to filter by a specific field value before executing the full search query. prefiltering is supported only in where clauses with the equals (=) operator. issortable() returns true if a query can sort on the field, false otherwise signature public boolean issortable() return value type: boolean isunique() returns true if the value for the field must be unique, false otherwise signature public boolean isunique() return value type: boolean isupdateable() returns true if the field can be edited by the current user, or child records in a master-detail relationship field on a custom object can be reparented to different parent records; false otherwise. important: where possible, we changed noninclusive terms to align with our company value of equality. we maintained certain terms to avoid any effect on customer implementations. signature public boolean isupdateable() 2683apex reference guide describeiconresult class return value type: boolean iswriterequiresmasterread() returns true if writing to the detail object requires read sharing instead of read/write sharing of the parent. signature public boolean iswriterequiresmasterread() return value type: boolean describeiconresult class contains icon metadata information for a tab. namespace schema usage the geticons method of the schema.describetabresult class returns a list of schema.describeiconresult objects that describe colors used in a tab. the methods in the schema.describeiconresult class can be called using their property counterparts. for each method starting with get, you can omit the get prefix and the ending parentheses () to call the property counterpart. for example, iconresultobj.url is equivalent to iconresultobj.geturl(). example this sample shows how to get the icon information in the sales app for the first tab’s first icon. // get tab set describes for each app list tabsetdesc = schema.describetabs(); // iterate through each tab set for(schema.describetabsetresult tsr : tabsetdesc) { // get tab info for the sales app if (tsr.getlabel() == 'sales') { // get icon information for the first tab list icondesc = tsr.gettabs()[0].geticons(); // display the icon height and width of the first icon system.debug('height: ' + icondesc[0].getheight()); system.debug('width: ' + icondesc[0].getwidth()); } } 2684apex reference guide describeiconresult class // example debug statement output // debug|height: 32 // debug|width: 32 describeiconresult methods the following are methods for describeiconresult. all are instance methods. in this section: getcontenttype() returns the tab icon’s content type, such as image/png. getheight() returns the tab icon’s height in pixels. gettheme() returns the tab’s icon theme. geturl() returns the tab’s icon fully qualified url. getwidth() returns the tab’s icon width in pixels. getcontenttype() returns the tab icon’s content type, such as image/png. signature public string getcontenttype() return value type: string getheight() returns the tab icon’s height in pixels. signature public integer getheight() return value type: integer usage note: if the icon content type is svg, the icon won’t have a size and its height is zero. 2685apex reference guide describesobjectresult class gettheme() returns the tab’s icon theme. signature public string gettheme() return value type: string possible theme values include theme3, theme4, and custom. • theme3 is the salesforce theme introduced during spring ‘10. • theme4 is the salesforce theme introduced in winter ‘14 for the mobile touchscreen version of salesforce. • custom is the theme name associated with a custom icon. geturl() returns the tab’s icon fully qualified url." "signature public string geturl() return value type: string getwidth() returns the tab’s icon width in pixels. signature public integer getwidth() return value type: integer usage note: if the icon content type is svg, the icon won’t have a size and its width is zero. describesobjectresult class contains methods for describing sobjects. none of the methods take an argument. 2686apex reference guide describesobjectresult class namespace schema usage instances of describe results on the same describesobjectresult aren’t guaranteed to be equal because the state and behavior of a describe object is determined by various factors including the api version used. to compare describe results, call the getsobjecttype() method on the sobject describe results and use the equality operator (==) to compare the sobjecttype values. describesobjectresult properties the following are properties for describesobjectresult. associateentitytype the type of associated object. for example, history or share. signature public string associateentitytype {get; set;} property value type: string associateparententity the parent object of an associated object. signature public string associateparententity {get; set;} property value type: string describesobjectresult methods the following are methods for describesobjectresult. all are instance methods. in this section: fields follow fields with a field member variable name or with the getmap method. fieldsets follow fieldsets with a field set name or with the getmap method. 2687apex reference guide describesobjectresult class getassociateentitytype() returns additional metadata for an associated object of a specified parent but only if it's a specific associated object type. used in combination with the getassociateparententity() method to get the parent object. for example, invoking the method on accounthistory returns the parent object as account and the type of associated object as history. getassociateparententity() returns additional metadata for an associated object but only if it's associated to a specific parent object. used in combination with the getassociateentitytype() method to get the type of associated object. for example, invoking the method on accounthistory returns the parent object as account and the type of associated object as history. getchildrelationships() returns a list of child relationships, which are the names of the sobjects that have a foreign key to the sobject being described. getdefaultimplementation() reserved for future use. gethassubtypes() reserved for future use. getimplementedby() reserved for future use. getimplementsinterfaces() reserved for future use. getisinterface() reserved for future use. getkeyprefix() returns the three-character prefix code for the object. record ids are prefixed with three-character codes that specify the type of the object (for example, accounts have a prefix of 001 and opportunities have a prefix of 006). getlabel() returns the object's label, which may or may not match the object name. getlabelplural() returns the object's plural label, which may or may not match the object name. getlocalname() returns the name of the object, similar to the getname method. however, if the object is part of the current namespace, the namespace portion of the name is omitted. getname() returns the name of the object. getrecordtypeinfos() returns a list of the record types supported by this object. the current user is not required to have access to a record type to see it in this list. getrecordtypeinfosbydevelopername() returns a map that matches developer names to their associated record type. the current user is not required to have access to a record type to see it in this map. getrecordtypeinfosbyid() returns a map that matches record ids to their associated record types. the current user is not required to have access to a record type to see it in this map. 2688apex reference guide describesobjectresult class getrecordtypeinfosbyname() returns a map that matches record labels to their associated record type. the current user is not required to have access to a record type to see it in this map. getsobjectdescribeoption() returns the effective describe option used by the system for the sobject. getsobjecttype() returns the schema.sobjecttype object for the sobject. you can use this to create a similar sobject." "isaccessible() returns true if the current user can see this object, false otherwise. iscreateable() returns true if the object can be created by the current user, false otherwise. iscustom() returns true if the object is a custom object, false if it is a standard object. iscustomsetting() returns true if the object is a custom setting, false otherwise. isdeletable() returns true if the object can be deleted by the current user, false otherwise. isdeprecatedandhidden() reserved for future use. isfeedenabled() returns true if chatter feeds are enabled for the object, false otherwise. this method is only available for apex classes and triggers saved using salesforceapi version 19.0 and later. ismergeable() returns true if the object can be merged with other objects of its type by the current user, false otherwise. true is returned for leads, contacts, and accounts. ismruenabled() returns true if most recently used (mru) list functionality is enabled for the object, false otherwise. isqueryable() returns true if the object can be queried by the current user, false otherwise issearchable() returns true if the object can be searched by the current user, false otherwise. isundeletable() returns true if the object can be undeleted by the current user, false otherwise. isupdateable() returns true if the object can be updated by the current user, false otherwise. fields follow fields with a field member variable name or with the getmap method. 2689apex reference guide describesobjectresult class signature public schema.sobjecttypefields fields() return value type: the return value is a special data type. see the example to learn how to use fields. usage note: when you describe sobjects and their fields from within an apex class, custom fields of new field types are returned regardless of the api version that the class is saved in. if a field type, such as the geolocation field type, is available only in a recent api version, components of a geolocation field are returned even if the class is saved in an earlier api version. example schema.describefieldresult dfr = schema.sobjecttype.account.fields.name; to get a custom field name, specify the custom field name. see also: apex developer guide: using field tokens apex developer guide: describing sobjects using schema method apex developer guide: understanding apex describe information fieldsets follow fieldsets with a field set name or with the getmap method. signature public schema.sobjecttypefields fieldsets() return value type: the return value is a special data type. see the example to learn how to use fieldsets. example schema.describesobjectresult d = account.sobjecttype.getdescribe(); map fsmap = d.fieldsets.getmap(); see also: apex developer guide: using field tokens apex developer guide: describing sobjects using schema method apex developer guide: understanding apex describe information 2690apex reference guide describesobjectresult class getassociateentitytype() returns additional metadata for an associated object of a specified parent but only if it's a specific associated object type. used in combination with the getassociateparententity() method to get the parent object. for example, invoking the method on accounthistory returns the parent object as account and the type of associated object as history. signature public string associateentitytype {get; set;} return value type: string see also: describesobjectresult properties getassociateparententity() returns additional metadata for an associated object but only if it's associated to a specific parent object. used in combination with the getassociateentitytype() method to get the type of associated object. for example, invoking the method on accounthistory returns the parent object as account and the type of associated object as history. signature public string getassociateparententity() return value type: string see also: describesobjectresult properties getchildrelationships() returns a list of child relationships, which are the names of the sobjects that have a foreign key to the sobject being described. signature public schema.childrelationship getchildrelationships() return value type: list example for example, the account object includes contacts and opportunities" "as child relationships. 2691apex reference guide describesobjectresult class getdefaultimplementation() reserved for future use. signature public string getdefaultimplementation() return value type: string gethassubtypes() reserved for future use. to check if person accounts are enabled for the current org, use this code snippet: schema.sobjecttype.account.fields.getmap().containskey( 'ispersonaccount' ); signature public boolean gethassubtypes() return value type: boolean getimplementedby() reserved for future use. signature public string getimplementedby() return value type: string getimplementsinterfaces() reserved for future use. signature public string getimplementsinterfaces() return value type: string 2692apex reference guide describesobjectresult class getisinterface() reserved for future use. signature public boolean getisinterface() return value type: boolean getkeyprefix() returns the three-character prefix code for the object. record ids are prefixed with three-character codes that specify the type of the object (for example, accounts have a prefix of 001 and opportunities have a prefix of 006). signature public string getkeyprefix() return value type: string usage the describesobjectresult object returns a value for objects that have a stable prefix. for object types that do not have a stable or predictable prefix, this field is blank. client applications that rely on these codes can use this way of determining object type to ensure forward compatibility. getlabel() returns the object's label, which may or may not match the object name. signature public string getlabel() return value type: string usage the object's label might not always match the object name. for example, an organization in the medical industry might change the label for account to patient. this label is then used in the salesforce user interface. see the salesforce online help for more information. getlabelplural() returns the object's plural label, which may or may not match the object name. 2693apex reference guide describesobjectresult class signature public string getlabelplural() return value type: string usage the object's plural label might not always match the object name. for example, an organization in the medical industry might change the plural label for account to patients. this label is then used in the salesforce user interface. see the salesforce online help for more information. getlocalname() returns the name of the object, similar to the getname method. however, if the object is part of the current namespace, the namespace portion of the name is omitted. signature public string getlocalname() return value type: string getname() returns the name of the object. signature public string getname() return value type: string getrecordtypeinfos() returns a list of the record types supported by this object. the current user is not required to have access to a record type to see it in this list. signature public list getrecordtypeinfos() return value type: list 2694apex reference guide describesobjectresult class getrecordtypeinfosbydevelopername() returns a map that matches developer names to their associated record type. the current user is not required to have access to a record type to see it in this map. signature public map getrecordtypeinfosbydevelopername() return value type: map getrecordtypeinfosbyid() returns a map that matches record ids to their associated record types. the current user is not required to have access to a record type to see it in this map. signature public schema.recordtypeinfo getrecordtypeinfosbyid() return value type: map getrecordtypeinfosbyname() returns a map that matches record labels to their associated record type. the current user is not required to have access to a record type to see it in this map. signature public schema.recordtypeinfo getrecordtypeinfosbyname() return value type: map getsobjectdescribeoption() returns the effective describe option used by the system for the sobject. signature" "public schema.sobjectdescribeoptions getsobjectdescribeoption() return value type: schema.sobjectdescribeoptions valid values are: 2695apex reference guide describesobjectresult class • sobjectdescribeoptions.full: indicates eager-load all elements of the describe, including child relationships, up-front at the time of method invocation. • sobjectdescribeoptions.deferred: indicates lazy-load child relationships. this means that all child relationships will not be loaded at the time of first invocation of the method. getsobjecttype() returns the schema.sobjecttype object for the sobject. you can use this to create a similar sobject. signature public schema.sobjecttype getsobjecttype() return value type: schema.sobjecttype isaccessible() returns true if the current user can see this object, false otherwise. signature public boolean isaccessible() return value type: boolean versioned behavior changes in api version 54.0 and later, for custom settings and custom metadata type objects, describesobjectresult.isaccessible() returns false if the user doesn’t have permissions to access the queried objects. in api version 53.0 and earlier, the method returns true even if the user doesn't have the required permissions. iscreateable() returns true if the object can be created by the current user, false otherwise. signature public boolean iscreateable() return value type: boolean iscustom() returns true if the object is a custom object, false if it is a standard object. 2696apex reference guide describesobjectresult class signature public boolean iscustom() return value type: boolean iscustomsetting() returns true if the object is a custom setting, false otherwise. signature public boolean iscustomsetting() return value type: boolean isdeletable() returns true if the object can be deleted by the current user, false otherwise. signature public boolean isdeletable() return value type: boolean isdeprecatedandhidden() reserved for future use. signature public boolean isdeprecatedandhidden() return value type: boolean isfeedenabled() returns true if chatter feeds are enabled for the object, false otherwise. this method is only available for apex classes and triggers saved using salesforceapi version 19.0 and later. 2697apex reference guide describesobjectresult class signature public boolean isfeedenabled() return value type: boolean ismergeable() returns true if the object can be merged with other objects of its type by the current user, false otherwise. true is returned for leads, contacts, and accounts. signature public boolean ismergeable() return value type: boolean ismruenabled() returns true if most recently used (mru) list functionality is enabled for the object, false otherwise. signature public boolean ismruenabled() return value type: boolean isqueryable() returns true if the object can be queried by the current user, false otherwise signature public boolean isqueryable() return value type: boolean issearchable() returns true if the object can be searched by the current user, false otherwise. 2698apex reference guide describetabresult class signature public boolean issearchable() return value type: boolean isundeletable() returns true if the object can be undeleted by the current user, false otherwise. signature public boolean isundeletable() return value type: boolean isupdateable() returns true if the object can be updated by the current user, false otherwise. signature public boolean isupdateable() return value type: boolean describetabresult class contains tab metadata information for a tab in a standard or custom app available in the salesforce user interface. namespace schema usage the gettabs method of the schema.describetabsetresult returns a list of schema.describetabresult objects that describe the tabs of one app. the methods in the schema.describetabresult class can be called using their property counterparts. for each method starting with get, you can omit the get prefix and the ending parentheses () to call the property counterpart. for example, tabresultobj.label is equivalent to tabresultobj.getlabel(). similarly, for each method starting with is, omit the is prefix and the ending parentheses (). for example, tabresultobj.iscustom" "is equivalent to tabresultobj.custom. 2699apex reference guide describetabresult class describetabresult methods the following are methods for describetabresult. all are instance methods. in this section: getcolors() returns a list of color metadata information for all colors associated with this tab. each color is associated with a theme and context. geticonurl() returns the url for the main 32 x 32-pixel icon for a tab. this icon corresponds to the current theme (theme3) and appears next to the heading at the top of most pages. geticons() returns a list of icon metadata information for all icons associated with this tab. each icon is associated with a theme and context. getlabel() returns the display label of this tab. getminiiconurl() returns the url for the 16 x 16-pixel icon that represents a tab. this icon corresponds to the current theme (theme3) and appears in related lists and other locations. getsobjectname() returns the name of the sobject that is primarily displayed on this tab (for tabs that display a particular sobject). geturl() returns a fully qualified url for viewing this tab. iscustom() returns true if this is a custom tab, or false if this is a standard tab. getcolors() returns a list of color metadata information for all colors associated with this tab. each color is associated with a theme and context. signature public list getcolors() return value type: list geticonurl() returns the url for the main 32 x 32-pixel icon for a tab. this icon corresponds to the current theme (theme3) and appears next to the heading at the top of most pages. signature public string geticonurl() 2700apex reference guide describetabresult class return value type: string geticons() returns a list of icon metadata information for all icons associated with this tab. each icon is associated with a theme and context. signature public list geticons() return value type: list getlabel() returns the display label of this tab. signature public string getlabel() return value type: string getminiiconurl() returns the url for the 16 x 16-pixel icon that represents a tab. this icon corresponds to the current theme (theme3) and appears in related lists and other locations. signature public string getminiiconurl() return value type: string getsobjectname() returns the name of the sobject that is primarily displayed on this tab (for tabs that display a particular sobject). signature public string getsobjectname() 2701apex reference guide describetabsetresult class return value type: string geturl() returns a fully qualified url for viewing this tab. signature public string geturl() return value type: string iscustom() returns true if this is a custom tab, or false if this is a standard tab. signature public boolean iscustom() return value type: boolean describetabsetresult class contains metadata information about a salesforce classic standard or custom app available in the salesforce user interface. namespace schema usage the schema.describetabs method returns a list of schema.describetabsetresult objects that describe salesforce classic standard and custom apps. the methods in the schema.describetabsetresult class can be called using their property counterparts. for each method starting with get, you can omit the get prefix and the ending parentheses () to call the property counterpart. for example, tabsetresultobj.label is equivalent to tabsetresultobj.getlabel(). similarly, for each method starting with is, omit the is prefix and the ending parentheses (). for example, tabsetresultobj.isselected is equivalent to tabsetresultobj.selected. 2702apex reference guide describetabsetresult class example this example shows how to call the schema.describetabs method to get describe information for all available salesforce classic apps. this example iterates through each describe result and gets more metadata information for the sales app. // app we're interested to get more info about string appname = 'sales'; // get tab set describes for each app list tabsetdesc = schema.describetabs(); // iterate through each tab set describe for each app and display the" "info for(schema.describetabsetresult tsr : tabsetdesc) { // get more information for the sales app if (tsr.getlabel() == appname) { // find out if the app is selected if (tsr.isselected()) { system.debug('the ' + appname + ' app is selected. '); } // get the app's logo url and namespace string logo = tsr.getlogourl(); system.debug('logo url: ' + logo); string ns = tsr.getnamespace(); if (ns == '') { system.debug('the ' + appname + ' app has no namespace defined.'); } else { system.debug('namespace: ' + ns); } // get the number of tabs system.debug('the ' + appname + ' app has ' + tsr.gettabs().size() + ' tabs.'); } } // example debug statement output // debug|the sales app is selected. // debug|logo url: https://mydomainname.my.salesforce.com/img/seasonlogos/2014_winter_aloha.png // debug|the sales app has no namespace defined. // debug|the sales app has 14 tabs. describetabsetresult methods the following are methods for describetabsetresult. all are instance methods. in this section: getdescription() returns the display description for the standard or custom app. getlabel() returns the display label for the standard or custom app. 2703apex reference guide describetabsetresult class getlogourl() returns a fully qualified url to the logo image associated with the standard or custom app. getnamespace() returns the developer namespace prefix of a salesforce appexchange managed package. gettabs() returns metadata information about the standard or custom app’s displayed tabs. isselected() returns true if this standard or custom app is the user’s currently selected app. otherwise, returns false. getdescription() returns the display description for the standard or custom app. signature public string getdescription() return value type: string getlabel() returns the display label for the standard or custom app. signature public string getlabel() return value type: string usage the display label changes when tabs are renamed in the salesforce user interface. see the salesforce online help for more information. getlogourl() returns a fully qualified url to the logo image associated with the standard or custom app. signature public string getlogourl() return value type: string 2704apex reference guide displaytype enum getnamespace() returns the developer namespace prefix of a salesforce appexchange managed package. signature public string getnamespace() return value type: string usage this namespace prefix corresponds to the namespace prefix of the developer edition organization that was enabled to allow publishing a managed package. this method applies to a custom app containing a set of tabs and installed as part of a managed package. gettabs() returns metadata information about the standard or custom app’s displayed tabs. signature public list gettabs() return value type: list isselected() returns true if this standard or custom app is the user’s currently selected app. otherwise, returns false. signature public boolean isselected() return value type: boolean displaytype enum a schema.displaytype enum value is returned by the field describe result's gettype method. namespace schema 2705apex reference guide displaytype enum type field value what the field object contains address address values anytype any value of the following types: string, picklist, boolean, integer, double, percent, id, date, datetime, url, or email. base64 base64-encoded arbitrary binary data (of type base64binary) boolean boolean (true or false) values combobox comboboxes, which provide a set of enumerated values and allow the user to specify a value not in the list currency currency values datacategorygroupreference reference to a data category group or a category unique name date date values datetime datetime values double double values email email addresses encryptedstring encrypted string id primary key field for an object integer integer values location location values, including latitude and longitude. long long values multipicklist multi-" "select picklists, which provide a set of enumerated values from which multiple values can be selected percent percent values phone phone numbers. values can include alphabetic characters. client applications are responsible for phone number formatting. picklist single-select picklists, which provide a set of enumerated values from which only one value can be selected reference cross-references to a different object, analogous to a foreign key field string string values textarea string values that are displayed as multiline text fields time time values url url values that are displayed as hyperlinks 2706apex reference guide fielddescribeoptions enum usage for more information, see field types in the object reference for salesforce. for more information about the methods shared by all enums, see enum methods. fielddescribeoptions enum a schema.fielddescribeoptions enum value is a parameter in the sobjecttype.getdescribe method. usage for more information about the method using this enum, see getdescribe(options). enum values the following are the values of the schema.fielddescribeoptions enum. value description default compute context-specific, describe field results. full_describe compute all aspects of describe field results. fieldset class contains methods for discovering and retrieving the details of field sets created on sobjects. namespace schema usage use the methods in the schema.fieldset class to discover the fields contained within a field set, and get details about the field set itself, such as the name, namespace, label, and so on. the following example shows how to get a collection of field set describe result objects for an sobject. the key of the returned map is the field set name, and the value is the corresponding field set describe result. map fsmap = schema.sobjecttype.account.fieldsets.getmap(); field sets are also available from sobject describe results. the following lines of code are equivalent to the prior sample: schema.describesobjectresult d = account.sobjecttype.getdescribe(); map fsmap = d.fieldsets.getmap(); 2707apex reference guide fieldset class to work with an individual field set, you can access it via the map of field sets on an sobject or, when you know the name of the field set in advance, using an explicit reference to the field set. the following two lines of code retrieve the same field set: schema.fieldset fs1 = schema.sobjecttype.account.fieldsets.getmap().get('field_set_name'); schema.fieldset fs2 = schema.sobjecttype.account.fieldsets.field_set_name; example: displaying a field set on a visualforce page this sample uses schema.fieldset and schema.fieldsetmember methods to dynamically get all the fields in the dimensions field set for the merchandise custom object. the list of fields is then used to construct a soql query that ensures those fields are available for display. the visualforce page uses the merchandisedetails class as its controller. public class merchandisedetails { public merchandise__c merch { get; set; } public merchandisedetails() { this.merch = getmerchandise(); } public list getfields() { return sobjecttype.merchandise__c.fieldsets.dimensions.getfields(); } private merchandise__c getmerchandise() { string query = 'select '; for(schema.fieldsetmember f : this.getfields()) { query += f.getfieldpath() + ', '; } query += 'id, name from merchandise__c limit 1'; return database.query(query); } } the visualforce page using the above controller is simple: 2708apex reference guide fieldset class one thing to note about the above markup is the expression used to determine if a field on the form should be indicated as being a required field. a field in a field set can be required by either the field set definition, or the field’s own definition. the expression handles both cases. fieldset methods the following are methods for fieldset. all are instance methods. in this section: getdescription() returns the field set’s description. getfields() returns a list of schema.fieldsetmember objects for the fields making up the field set. getlabel() returns the translation of the text label that is displayed next to the field in the salesforce user interface. getname() returns the field set’s name. getnamespace() returns the field set’s namespace. getsobjecttype() returns the schema.sobjecttype of the sobject containing the field set definition. getdescription() returns the field set’s description. signature public string getdescription() return value type: string usage description is a required field for a field set, intended to describe the context and content of the field set. it’s often intended for administrators who might be configuring a field set defined in a managed package, rather than for end users. getfields() returns a list of schema.fieldsetmember objects for the fields making up the field set. 2709apex reference guide fieldset class signature public list getfields() return value type: list getlabel() returns the translation of the text label that is displayed next to the field in the salesforce user interface. signature public string getlabel() return value type: string getname() returns the field set’s name. signature public string getname() return value type: string getnamespace() returns the field set’s namespace. signature public string getnamespace() return value type: string usage the returned namespace is an empty string if your organization hasn’t set a namespace, and the field set is defined in your organization. otherwise, it’s the namespace of your organization, or the namespace of the managed package containing the field set. 2710apex reference guide fieldsetmember class getsobjecttype() returns the schema.sobjecttype of the sobject containing the field set definition. signature public schema.sobjecttype getsobjecttype() return value type: schema.sobjecttype fieldsetmember class contains methods for accessing the metadata for field set member fields. namespace schema usage use the methods in the schema.fieldsetmember class to get details about fields contained within a field set, such as the field label, type, a dynamic soql-ready field path, and so on. the following example shows how to get a collection of field set member describe result objects for a specific field set on an sobject: list fields = schema.sobjecttype.account.fieldsets.getmap().get('field_set_name').getfields(); if you know the name of the field set in advance, you can access its fields more directly using an explicit reference to the field set: list fields = schema.sobjecttype.account.fieldsets.field_set_name.getfields(); see also: fieldset class fieldsetmember methods the following are methods for fieldsetmember. all are instance methods. in this section: getdbrequired() returns true if the field is required by the field’s definition in its sobject, otherwise, false. getfieldpath() returns a field path string in a format ready to be used in a dynamic soql query. getlabel() returns the text label that’s displayed next to the field in the salesforce user interface. 2711apex reference guide fieldsetmember class getrequired() returns true if the field is required by the field set, otherwise, false. gettype() returns the field’s apex data type. getsobjectfield() returns the token for this field. getdbrequired() returns true if" "the field is required by the field’s definition in its sobject, otherwise, false. signature public boolean getdbrequired() return value type: boolean getfieldpath() returns a field path string in a format ready to be used in a dynamic soql query. signature public string getfieldpath() return value type: string example see displaying a field set on a visualforce page for an example of how to use this method. getlabel() returns the text label that’s displayed next to the field in the salesforce user interface. signature public string getlabel() return value type: string getrequired() returns true if the field is required by the field set, otherwise, false. 2712apex reference guide picklistentry class signature public boolean getrequired() return value type: boolean gettype() returns the field’s apex data type. signature public schema.displaytype gettype() return value type: schema.displaytype getsobjectfield() returns the token for this field. signature public schema.sobjectfield getsobjectfield() return value type: schema.sobjectfield picklistentry class represents a picklist entry. namespace schema usage picklist fields contain a list of one or more items from which a user chooses a single item. they display as drop-down lists in the salesforce user interface. one of the items can be configured as the default item. a schema.picklistentry object is returned from the field describe result using the getpicklistvalues method. for example: schema.describefieldresult f = account.industry.getdescribe(); list p = f.getpicklistvalues(); 2713apex reference guide picklistentry class picklistentry methods the following are methods for picklistentry. all are instance methods. in this section: getlabel() returns the display name of this item in the picklist. getvalue() returns the value of this item in the picklist. isactive() returns true if this item must be displayed in the drop-down list for the picklist field in the user interface, false otherwise. isdefaultvalue() returns true if this item is the default value for the picklist, false otherwise. only one item in a picklist can be designated as the default. getlabel() returns the display name of this item in the picklist. signature public string getlabel() return value type: string getvalue() returns the value of this item in the picklist. signature public string getvalue() return value type: string isactive() returns true if this item must be displayed in the drop-down list for the picklist field in the user interface, false otherwise. signature public boolean isactive() 2714apex reference guide recordtypeinfo class return value type: boolean isdefaultvalue() returns true if this item is the default value for the picklist, false otherwise. only one item in a picklist can be designated as the default. signature public boolean isdefaultvalue() return value type: boolean recordtypeinfo class contains methods for accessing record type information for an sobject with associated record types. namespace schema usage a recordtypeinfo object is returned from the sobject describe result using the getrecordtypeinfos method. for example: schema.describesobjectresult r = account.sobjecttype.getdescribe(); list rt = r.getrecordtypeinfos(); in addition to the getrecordtypeinfos method, you can use the getrecordtypeinfosbyid and the getrecordtypeinfosbyname methods. these methods return maps that associate recordtypeinfo with record ids and record labels, respectively. example the following example assumes at least one record type has been created for the account object: recordtype rt = [select id,name from recordtype where sobjecttype='account' limit 1]; schema.describesobjectresult d = schema.sobjecttype.account; map rtmapbyid = d.getrecordtypeinfosbyid(); schema.recordtypeinfo rtbyid = rtmapbyid.get(rt.id); map rtmapbyname = d.getrecordtypeinfosbyname(); schema.record" "typeinfo rtbyname = rtmapbyname.get(rt.name); system.assertequals(rtbyid,rtbyname); recordtypeinfo methods the following are methods for recordtypeinfo. all are instance methods. 2715apex reference guide recordtypeinfo class in this section: getdevelopername() returns the developer name for this record type. getname() returns the ui label of this record type. the label can be translated into any language that salesforce supports. getrecordtypeid() returns the id of this record type. isactive() returns true if this record type is active, false otherwise. isavailable() returns true if this record type is available to the current user, false otherwise. use this method to display a list of available record types to the user when he or she is creating a new record. isdefaultrecordtypemapping() returns true if this is the default record type for the user, false otherwise. ismaster() returns true if this is the master record type and false otherwise. the master record type is the default record type that’s used when a record has no custom record type associated with it. getdevelopername() returns the developer name for this record type. signature public string getdevelopername() return value type: string getname() returns the ui label of this record type. the label can be translated into any language that salesforce supports. signature public string getname() return value type: string getrecordtypeid() returns the id of this record type. 2716apex reference guide recordtypeinfo class signature public id getrecordtypeid() return value type: id isactive() returns true if this record type is active, false otherwise. signature public boolean isactive() return value type: boolean isavailable() returns true if this record type is available to the current user, false otherwise. use this method to display a list of available record types to the user when he or she is creating a new record. signature public boolean isavailable() return value type: boolean isdefaultrecordtypemapping() returns true if this is the default record type for the user, false otherwise. signature public boolean isdefaultrecordtypemapping() return value type: boolean ismaster() returns true if this is the master record type and false otherwise. the master record type is the default record type that’s used when a record has no custom record type associated with it. 2717apex reference guide soaptype enum signature public boolean ismaster() return value type: boolean soaptype enum a schema.soaptype enum value is returned by the field describe result getsoaptype method. namespace schema type field value what the field object contains anytype any value of the following types: string, boolean, integer, double, id, date or datetime. base64binary base64-encoded arbitrary binary data (of type base64binary) boolean boolean (true or false) values date date values datetime datetime values double double values id primary key field for an object integer integer values string string values time time values usage for more information, see soaptypes in the soap api developer guide. for more information about the methods shared by all enums, see enum methods. sobjectdescribeoptions enum a schema.sobjectdescribeoptions enum value is a parameter in the sobjecttype.getdescribe method. usage for more information about the method using this enum, see getdescribe(options). 2718apex reference guide sobjectfield class enum values the following are the values of the schema.sobjectdescribeoptions enum. value description default either eager-load or lazy-load depending on the api version. deferred lazy-load child relationships; do not load all child relationships at the time of first invocation of the method. full eager-load all elements of the describe, including child relationships, up-front at the time of method invocation. see getdescribe(options). sobjectfield class a schema.sobjectfield object is returned from the field describe result using the getcontroller and getsobjectfield methods. namespace schema example schema.describefieldresult f = account.industry.getdescribe(); schema.sobjectfield t = f.getsobjectfield(); sobjectfield methods the following are instance methods for s" "objectfield. in this section: getdescribe() returns the describe field result for this field. getdescribe(options) returns the describe field result for this field. this method also provides an option to get all the describe field results for an object. getdescribe() returns the describe field result for this field. signature public schema.describefieldresult getdescribe() 2719apex reference guide sobjecttype class return value type: schema.describefieldresult getdescribe(options) returns the describe field result for this field. this method also provides an option to get all the describe field results for an object. signature public schema.describefieldresult getdescribe(object options) parameters options type: object use this parameter to pass fielddescribeoptions.full_describe when a subset of system objects could have different results for picklist values based on the context they're invoked in. this parameter computes all aspects of describe field results. for example, aiconversationcontext.persontype field is a picklist that contains a list of accessible object types. return value type: schema.describefieldresult sobjecttype class a schema.sobjecttype object is returned from the field describe result using the getreferenceto method, or from the sobject describe result using the getsobjecttype method. namespace schema usage schema.describefieldresult f = account.industry.getdescribe(); list p = f.getreferenceto(); sobjecttype methods the following are methods for sobjecttype. all are instance methods. in this section: getdescribe() returns the describe sobject result for this field. 2720apex reference guide sobjecttype class getdescribe(options) returns the describe sobject result for this field; the parameter value determines whether all child relationships are loaded up-front, or not. newsobject() constructs a new sobject of this type. newsobject(id) constructs a new sobject of this type, with the specified id. newsobject(recordtypeid, loaddefaults) constructs a new sobject of this type, and optionally, of the specified record type id and with default custom field values. getdescribe() returns the describe sobject result for this field. signature public schema.describesobjectresult getdescribe() return value type: schema.describesobjectresult getdescribe(options) returns the describe sobject result for this field; the parameter value determines whether all child relationships are loaded up-front, or not. signature public schema.describesobjectresult getdescribe(object options) parameters options type: object the parameter values determine how the elements of the describe operation are loaded. • use sobjectdescribeoptions.full to eager-load all elements of the describe, including child relationships, up-front at the time of method invocation. this describe guarantees fully coherent results, even if the describe object is passed to another namespace, api version, or other apex context that may have different results when generating describe attributes. • use sobjectdescribeoptions.deferred to enable lazy initialization of describe attributes on first use. this means that all child relationships will not be loaded at the time of first invocation of the method. • use sobjectdescribeoptions.default to default to either eager-load or lazy-load depending on the api version. the type of describe operation, as determined by the parameter value is depicted in this table. 2721apex reference guide sobjecttype class table 2: type of load for sobjecttype.getdescribe() parameter value api version 43.0 and earlier api version 44.0 and later full eager eager deferred lazy lazy default lazy lazy return value type: schema.describesobjectresult newsobject() constructs a new sobject of this type. signature public sobject newsobject() return value type: sobject example for an example, see dynamic dml. newsobject(id) constructs a new sobject of this type, with the specified id. signature public sobject newsobject(id id) parameters id type: id return value type: sobject usage for the argument, pass the id of an existing record in the database. 2722apex reference guide sobjecttype class after you create a" "new sobject, the sobject returned has all fields set to null. you can set any updateable field to desired values and then update the record in the database. only the fields you set new values for are updated and all other fields which are not system fields are preserved. newsobject(recordtypeid, loaddefaults) constructs a new sobject of this type, and optionally, of the specified record type id and with default custom field values. important: where possible, we changed noninclusive terms to align with our company value of equality. we maintained certain terms to avoid any effect on customer implementations. signature public sobject newsobject(id recordtypeid, boolean loaddefaults) parameters recordtypeid type: id specifies the record type id of the sobject to create. if no record type exists for this sobject, use null. if the sobject has record types and you specify null, the default record type is used. loaddefaults type: boolean specifies whether to populate custom fields with their predefined default values (true) or not (false). return value type: sobject usage • for required fields that have no default values, make sure to provide a value before inserting the new sobject. otherwise, the insertion results in an error. an example is the account name field or a master-detail relationship field. • since picklists and multi-select picklists can have default values specified per record type, this method populates the default value corresponding to the record type specified. • if fields have no predefined default values and the loaddefaults argument is true, this method creates the sobject with field values of null. • if the loaddefaults argument is false, this method creates the sobject with field values of null. • this method populates read-only custom fields of the new sobject with default values. you can then insert the new sobject with the read-only fields, even though these fields cannot be edited after they’re inserted. • if a custom field is marked as unique and also provides a default value, inserting more than one new sobject will cause a run-time exception because of duplicate field values. to learn more about default field values, see “default field values” in the salesforce online help. 2723apex reference guide search namespace example: creating new sobject with default values this sample creates an account with any default values populated for its custom fields, if any, using the newsobject method. it also creates a second account for a specific record type. for both accounts, the sample sets the name field, which is a required field that doesn’t have a default value, before inserting the new accounts. // create an account with predefined default values account acct = (account)account.sobjecttype.newsobject(null, true); // provide a value for name acct.name = 'acme'; // insert new account insert acct; // this is for record type rt1 of account id rtid = [select id from recordtype where sobjecttype='account' and name='rt1'].id; account acct2 = (account)account.sobjecttype.newsobject(rtid, true); // provide a value for name acct2.name = 'acme2'; // insert new account insert acct2; search namespace the search namespace provides classes for getting search results and suggestion results. the following are the classes in the search namespace. in this section: knowledgesuggestionfilter class filter settings that narrow the results from a call to system.search.suggest(searchquery, sobjecttype, options) when the sosl search query contains a knowledgearticleversion object. questionsuggestionfilter class the search.questionsuggestionfilter class filters results from a call to system.search.suggest(searchquery, sobjecttype, options) when the sosl searchquery contains a feeditem object. searchresult class a wrapper object that contains an sobject and search metadata. searchresults class wraps the results returned by the search.find(string) method. suggestionoption class options that narrow record and article suggestion results returned from a call to system.search.suggest(string, string, search.suggestionoption). suggestionresult class a wrapper object that contains an sobject. 2724apex reference guide knowledgesuggestionfilter class suggestionresults class wraps the results returned by the search.suggest(string, string, search.suggestionoption) method. see also: find(searchquery) suggest(" "searchquery, sobjecttype, suggestions) knowledgesuggestionfilter class filter settings that narrow the results from a call to system.search.suggest(searchquery, sobjecttype, options) when the sosl search query contains a knowledgearticleversion object. namespace search knowledgesuggestionfilter methods the following are methods for knowledgesuggestionfilter. in this section: addarticletype(articletype) adds a filter that narrows suggestion results to display the specified article type. this filter is optional. adddatacategory(datacategorygroupname, datacategoryname) adds a filter that narrows suggestion results to display articles in the specified data category. this filter is optional. addtopic(topic) specifies the article topic to return. this filter is optional. setchannel(channelname) sets a channel to narrow the suggestion results to articles in the specified channel. this filter is optional. setdatacategories(datacategoryfilters) adds filters that narrow suggestion results to display articles in the specified data categories. use this method to set multiple data category group and name pairs in one call. this filter is optional. setlanguage(localecode) sets a language to narrow the suggestion results to display articles in that language. this filter value is required in calls to system.search.suggest(string, string, search.suggestionoption). setpublishstatus(publishstatus) sets a publish status to narrow the suggestion results to display articles with that status. this filter value is required in calls to system.search.suggest(string, string, search.suggestionoption). setvalidationstatus(validationstatus) sets a validation status to narrow the suggestion results to display articles with that status. this filter is optional. addarticletype(articletype) adds a filter that narrows suggestion results to display the specified article type. this filter is optional. 2725apex reference guide knowledgesuggestionfilter class signature public void addarticletype(string articletype) parameters articletype type: string a three-character id prefix indicating the desired article type. return value type: void usage to add more than 1 article type, call the method multiple times. adddatacategory(datacategorygroupname, datacategoryname) adds a filter that narrows suggestion results to display articles in the specified data category. this filter is optional. signature public void adddatacategory(string datacategorygroupname, string datacategoryname) parameters datacategorygroupname type: string the name of the data category group datacategoryname type: string the name of the data category. return value type: void usage to set multiple data categories, call the method multiple times. the name of the data category group and name of the data category for desired articles, expressed as a mapping, for example, search.knowledgesuggestionfilter.adddatacategory('regions', 'asia'). addtopic(topic) specifies the article topic to return. this filter is optional. 2726apex reference guide knowledgesuggestionfilter class signature public void addtopic(string topic) parameters addtopic type: string the name of the article topic. return value type: void usage to add more than 1 article topic, call the method multiple times. setchannel(channelname) sets a channel to narrow the suggestion results to articles in the specified channel. this filter is optional. signature public void setchannel(string channelname) parameters channelname type: string the name of a channel. valid values are: • allchannels–visible in all channels the user has access to • app–visible in the internal salesforce knowledge application • pkb–visible in the public knowledge base • csp–visible in the customer portal • prm–visible in the partner portal if channel isn’t specified, the default value is determined by the type of user. • pkb for a guest user • csp for a customer portal user • prm for a partner portal user • app for any other type of user if channel is specified, the specified value may not be the actual value requested, because of certain requirements. • for guest, customer portal, and partner portal users, the specified value must match the default value for each user type. if the values don’t match or allchannels is specified, then app replaces the specified value. • for all users other than guest, customer portal, and partner portal users: – if pkb, csp, prm, or app are specified, then the specified value is used. 27" "27apex reference guide knowledgesuggestionfilter class – if allchannels is specified, then app replaces the specified value. return value type: void setdatacategories(datacategoryfilters) adds filters that narrow suggestion results to display articles in the specified data categories. use this method to set multiple data category group and name pairs in one call. this filter is optional. signature public void setdatacategories(map datacategoryfilters) parameters datacategoryfilters type: map a map of data category group and data category name pairs. return value type: void setlanguage(localecode) sets a language to narrow the suggestion results to display articles in that language. this filter value is required in calls to system.search.suggest(string, string, search.suggestionoption). signature public void setlanguage(string localecode) parameters localecode type: string a locale code. for example, 'en_us' (english–united states), or 'es' (spanish). return value type: void see also: supported locales 2728apex reference guide questionsuggestionfilter class setpublishstatus(publishstatus) sets a publish status to narrow the suggestion results to display articles with that status. this filter value is required in calls to system.search.suggest(string, string, search.suggestionoption). signature public void setpublishstatus(string publishstatus) parameters publishstatus type: string a publish status. valid values are: • draft–articles aren’t published in salesforce knowledge. • online–articles are published in salesforce knowledge. • archived–articles aren’t published and are available in archived articles view. setvalidationstatus(validationstatus) sets a validation status to narrow the suggestion results to display articles with that status. this filter is optional. signature public void setvalidationstatus(string validationstatus) parameters validationstatus type: string an article validation status. these values are available in the validationstatus field on the knowledgearticleversion object. return value type: void questionsuggestionfilter class the search.questionsuggestionfilter class filters results from a call to system.search.suggest(searchquery, sobjecttype, options) when the sosl searchquery contains a feeditem object. namespace search in this section: questionsuggestionfilter methods 2729apex reference guide questionsuggestionfilter class questionsuggestionfilter methods the following are methods for questionsuggestionfilter. in this section: addgroupid(groupid) adds a filter to display questions associated with the single specified group whose id is passed in as an argument. this filter is optional. addnetworkid(networkid) adds a filter to display questions associated with the single specified network whose id is passed in as an argument. this filter is optional. adduserid(userid) adds a filter to display questions belonging to the single specified user whose id is passed in as an argument. this filter is optional. setgroupids(groupids) sets a new list of groups to replace the current list of groups where the group ids are passed in as an argument. this filter is optional. setnetworkids(networkids) sets a new list of networks to replace the current list of networks where the network ids are passed in as an argument. this filter is optional. settopicid(topicid) sets a filter to display questions associated with the single specified topic whose id is passed in as an argument. this filter is optional. setuserids(userids) sets a new list of users to replace the current list of users where the users ids are passed in as an argument. this filter is optional. addgroupid(groupid) adds a filter to display questions associated with the single specified group whose id is passed in as an argument. this filter is optional. signature public void addgroupid(string groupid) parameters groupid type: string the id for a group. return value type: void usage to add more than one group, call the method multiple times. 2730apex reference guide questionsuggestionfilter class addnetworkid(networkid) adds a filter to display questions associated with the single specified network whose id is passed in as an argument. this filter is optional. signature public void addnetworkid(string networkid) parameters networkid type: string the id of the experience cloud site about which you’re retrieving this information." "return value type: void usage to add more than one network, call the method multiple times. adduserid(userid) adds a filter to display questions belonging to the single specified user whose id is passed in as an argument. this filter is optional. signature public void adduserid(string userid) parameters userid type: string the id for the user. return value type: void usage to add more than one user, call the method multiple times. setgroupids(groupids) sets a new list of groups to replace the current list of groups where the group ids are passed in as an argument. this filter is optional. signature public void setgroupids(list groupids) 2731apex reference guide questionsuggestionfilter class parameters groupids type: list a list of group ids. return value type: void setnetworkids(networkids) sets a new list of networks to replace the current list of networks where the network ids are passed in as an argument. this filter is optional. signature public void setnetworkids(list networkids) parameters networkids type: list a list of network ids. return value type: void settopicid(topicid) sets a filter to display questions associated with the single specified topic whose id is passed in as an argument. this filter is optional. signature public void settopicid(string topicid) parameters topicid type: string the id for a topic. return value type: void setuserids(userids) sets a new list of users to replace the current list of users where the users ids are passed in as an argument. this filter is optional. 2732" "apex reference guide searchresult class signature public void setuserids(list userids) parameters userids type: list a list of user ids. return value type: void searchresult class a wrapper object that contains an sobject and search metadata. namespace search searchresult methods the following are methods for searchresult. in this section: getsobject() returns an sobject from a searchresult object. getsnippet(fieldname) returns a snippet from a case, feed, or knowledge article searchresult object based on the specified field name. getsnippet() returns a snippet from a searchresult object based on the default field. getsobject() returns an sobject from a searchresult object. signature public sobject getsobject() 2733apex reference guide searchresult class return value type: sobject see also: find(searchquery) apex developer guide: dynamic sosl getsnippet(fieldname) returns a snippet from a case, feed, or knowledge article searchresult object based on the specified field name. signature public string getsnippet(string fieldname) parameters fieldname type: string the field name to use for creating the snippet. valid values: case.casenumber, feedpost.title, knowledgearticleversion.title return value type: string see also: find(searchquery) apex developer guide: dynamic sosl getsnippet() returns a snippet from a searchresult object based on the default field. signature public string getsnippet() return value type: string see also: find(searchquery) apex developer guide: dynamic sosl 2734apex reference guide searchresults class searchresults class wraps the results returned by the search.find(string) method. namespace search searchresults methods the following are methods for searchresults. in this section: get(sobjecttype) returns a list of search.searchresult objects that contain an sobject of the specified type. get(sobjecttype) returns a list of search.searchresult objects that contain an sobject of the specified type. signature public list get(string sobjecttype) parameters sobjecttype type: string the name of an sobject in the dynamic sosl query passed to the search.find(string) method. return value type: list usage sosl queries passed to the search.find(string) method can return results for multiple objects. for example, the query search.find('find \'map\' in all fields returning account, contact, opportunity') includes results for 3 objects. you can call get(string) to retrieve search results for 1 object at a time. for example, to get results for the account object, call search.searchresults.get('account'). see also: find(searchquery) searchresult methods apex developer guide: dynamic sosl 2735apex reference guide suggestionoption class suggestionoption class options that narrow record and article suggestion results returned from a call to system.search.suggest(string, string, search.suggestionoption). namespace search suggestionoption methods the following are methods for suggestionoption. in this section: setfilter(knowledgesuggestionfilter) set filters that narrow salesforce knowledge article results in a call to system.search.suggest(string, string, search.suggestionoption). setlimit(limit) the maximum number of record or article suggestions to retrieve. setfilter(knowledgesuggestionfilter) set filters that narrow salesforce knowledge article results in a call to system.search.suggest(string, string, search.suggestionoption). signature public void setfilter(search.knowledegesuggestionfilter knowledgesuggestionfilter) parameters knowledgesuggestionfilter type: knowledgesuggestionfilter an object containing filters that narrow the search results. return value type: void usage search.knowledgesuggestionfilter filters = new search.knowledgesuggestionfilter(); filters.setlanguage('en_us'); filters.setpublishstatus('online'); filters.setchannel('app'); search.suggestionoption options = new search.suggestionoption(); options.setfilter(filters); 2736apex reference guide suggestionresult class search.suggestionresults suggestionresults = search.suggest('all', 'knowledgearticle" "version', options); for (search.suggestionresult searchresult : suggestionresults.getsuggestionresults()) { knowledgearticleversion article = (knowledgearticleversion)result.getsobject(); system.debug(article.title); } setlimit(limit) the maximum number of record or article suggestions to retrieve. signature public void setlimit(integer limit) parameters limit type: integer the maximum number of record or article suggestions to retrieve. return value type: void usage by default, the system.search.suggest(string, string, search.suggestionoption) method returns the 5 most relevant results. however, if your query is broad, it could match more than 5 results. if search.suggestionresults.hasmoreresults() returns true, there are more than 5 results. to retrieve them, call setlimit(integer) to increase the number of suggestions results. search.suggestionoption option = new search.suggestionoption(); option.setlimit(10); search.suggest('my query', 'mysobjecttype', option); suggestionresult class a wrapper object that contains an sobject. namespace search suggestionresult methods the following are methods for suggestionresult. 2737apex reference guide suggestionresults class in this section: getsobject() returns the sobject from a suggestionresult object. getsobject() returns the sobject from a suggestionresult object. signature public sobject getsobject() return value type: sobject suggestionresults class wraps the results returned by the search.suggest(string, string, search.suggestionoption) method. namespace search suggestionresults methods the following are methods for suggestionresults. in this section: getsuggestionresults() returns a list of suggestionresult objects from the response to a call to search.suggest(string, string, search.suggestionoption). hasmoreresults() indicates whether a call to system.search.suggest(string, string, search.suggestionoption) has more results available than were returned. getsuggestionresults() returns a list of suggestionresult objects from the response to a call to search.suggest(string, string, search.suggestionoption). signature public list getsuggestionresults() 2738apex reference guide sfc namespace return value type: list hasmoreresults() indicates whether a call to system.search.suggest(string, string, search.suggestionoption) has more results available than were returned. signature public boolean hasmoreresults() return value type: boolean usage if a limit isn’t specified, 5 records are returned in calls to system.search.suggest(string, string, search.suggestionoption). if there are more suggested records than the limit specified, a call to hasmoreresults() returns true. sfc namespace the sfc namespace contains classes used in salesforce files. the following are the classes in the sfc namespace. in this section: contentdownloadcontext enum this enum specifies the download context. contentdownloadhandler class use contentdownloadhandler to define a custom download handler that controls how content is downloaded. contentdownloadhandlerfactory interface use this interface to provide a class factory that salesforce can call to create instances of your custom contentdownloadhandler. contentdownloadcontext enum this enum specifies the download context. usage if the operationcontext is content, chatter, delivery, s1, or mobile, it can be used in a shepherd servlet as a query parameter. it’s possible for a user to change the query parameters. if a user enters a value other than content, chatter, delivery, s1, or mobile, the value is treated as the default value content. users can’t set query parameters to rest_api, soql, or retrieve, so these values can be assumed to be accurate. 2739apex reference guide contentdownloadhandler class enum values the sfc.contentdownloadcontext enum value identifies the content download context. the enum value is provided as a query parameter in the file download servlet. the following are the values of the sfc.contentdownloadcontext enum. value description chatter download from chatter. content default value. downloads from the salesforce crm content product. delivery download of a content delivery. rest_api download from the connect api (/connect/files/$" "{fileid}/content endpoint). used in both android and ios apps. retrieve retrieve versiondata from sobject api. s1 download from lightning experience. soql select versiondata from soql. contentdownloadhandler class use contentdownloadhandler to define a custom download handler that controls how content is downloaded. namespace sfc on page 2739 in this section: contentdownloadhandler properties contentdownloadhandler properties the following are properties for contentdownloadhandler. in this section: downloaderrormessage a customized error message explaining why the download isn’t allowed. isdownloadallowed indicates whether or not download is allowed. redirecturl the url the user should be redirected to, for applying information rights management (irm) control, virus scanning, or other behavior. downloaderrormessage a customized error message explaining why the download isn’t allowed. 2740apex reference guide contentdownloadhandlerfactory interface signature public string downloaderrormessage {get; set;} property value type: string this message is used if a redirecturl is not provided. if the download is not allowed, salesforce will throw a contentcustomizeddownloadexception exception that contains the downloaderrormessage. isdownloadallowed indicates whether or not download is allowed. signature public boolean isdownloadallowed {get; set;} property value type: boolean redirecturl the url the user should be redirected to, for applying information rights management (irm) control, virus scanning, or other behavior. signature public string redirecturl {get; set;} property value type: string the url must be a valid relative url. for example, the redirect can be a custom visualforce page such as “/apex/irmcontrol”. urls with no path, such as “www.domain.com”, will result in an invalidparametervalueexception. contentdownloadhandlerfactory interface use this interface to provide a class factory that salesforce can call to create instances of your custom contentdownloadhandler. namespace sfc on page 2739 usage contentdownloadhandler getcontentdownloadhandler(list ids, contentdownloadcontext context); 2741apex reference guide contentdownloadhandlerfactory interface in this section: contentdownloadhandlerfactory methods contentdownloadhandlerfactory example implementation contentdownloadhandlerfactory methods the following are methods for contentdownloadhandlerfactory. in this section: getcontentdownloadhandler(var1, var2) returns a contentdownloadhandler for a given list of content ids and a download context. getcontentdownloadhandler(var1, var2) returns a contentdownloadhandler for a given list of content ids and a download context. signature public sfc.contentdownloadhandler getcontentdownloadhandler(list var1, sfc.contentdownloadcontext var2) parameters var1 type: list var2 type: sfc.contentdownloadcontext on page 2739 return value type: sfc.contentdownloadhandler on page 2740 contentdownloadhandlerfactory example implementation this example creates a class that implements the sfc.contentdownloadhandlerfactory interface and returns a download handler that blocks downloading content to mobile devices. // allow customization of the content download experience public class contentdownloadhandlerfactoryimpl implements sfc.contentdownloadhandlerfactory { public sfc.contentdownloadhandler getcontentdownloadhandler(list ids, sfc.contentdownloadcontext context) { sfc.contentdownloadhandler contentdownloadhandler = new sfc.contentdownloadhandler(); if(context == sfc.contentdownloadcontext.mobile) { contentdownloadhandler.isdownloadallowed = false; contentdownloadhandler.downloaderrormessage = 'downloading a file from a mobile 2742apex reference guide sfdc_checkout namespace device is not allowed.'; return contentdownloadhandler; } contentdownloadhandler.isdownloadallowed = true; return contentdownloadhandler; } } sfdc_checkout namespace the sfdc_checkout namespace provides an interface and classes for b2b commerce apps in salesforce. the following are the classes in the sfdc_checkout namespace. in this section: asynccartprocessor interface use this interface to implement asynchronous integrations in b2b commerce. b2bcheckoutcontroller class communicate with simple checkout apex methods to work with data related to b2b commerce checkout. integrationinfo class provides the values that b2b commerce checkout uses to map requests to responses, necessary metadata, and context. integration" "status class supports synchronous execution of apex integrations for b2b commerce. the implementation must return the status of the execution. integrationstatus.status enum the integrationstatus.status enum describes the status of the current integration. asynccartprocessor interface use this interface to implement asynchronous integrations in b2b commerce. namespace sfdc_checkout in this section: asynccartprocessor methods asynccartprocessor example implementation asynccartprocessor methods the following are methods for asynccartprocessor. 2743apex reference guide b2bcheckoutcontroller class in this section: startcartprocessasync(integrationinfo, cartid) the startcartprocessasync method is called asynchronously by the integration framework. calling this method begins cart processing for commerce checkout. startcartprocessasync(integrationinfo, cartid) the startcartprocessasync method is called asynchronously by the integration framework. calling this method begins cart processing for commerce checkout. signature public sfdc_checkout.integrationstatus startcartprocessasync(sfdc_checkout.integrationinfo integrationinfo, id cartid) parameters integrationinfo type: integrationinfo provides values that b2b commerce checkout apis use to map requests to responses, necessary metadata, and context. cartid type: id id of the webcart object. return value type: integrationstatus status of the current integration. possible values are success and failed. asynccartprocessor example implementation this is an example implementation of the sfdc_checkout.asynccartprocessor interface. global interface checkout_asynccartprocessor { //integration for async processing integrationstatus startcartprocessasync( integrationinfo integrationinfo, id cartid); } asynccartprocessor is a base interface. there are four interfaces that extend it, including cartinventoryvalidation, cartpricecalculations, cartshippingcharges, and carttaxcalculations. for more information about these interfaces, including code examples and test classes, see checkout integrations. b2bcheckoutcontroller class communicate with simple checkout apex methods to work with data related to b2b commerce checkout. 2744apex reference guide integrationinfo class namespace sfdc_checkout usage you must specify the sfdc_checkout namespace when creating an instance of this class. in this section: b2bcheckoutcontroller methods b2bcheckoutcontroller methods the following are methods for b2bcheckoutcontroller. in this section: licensecompliance(cartid, orderid) if you implement your own cart-to-order process without invoking the cart to order flow core action, you must invoke this method to correctly track your orders for gmv (gross merchandise value) recognition. licensecompliance(cartid, orderid) if you implement your own cart-to-order process without invoking the cart to order flow core action, you must invoke this method to correctly track your orders for gmv (gross merchandise value) recognition. signature public static void licensecompliance(string cartid, string orderid) parameters cartid type: string the cartid of a web cart from which an order is created. orderid type: string the orderid of the order you created from the cart. return value type: void integrationinfo class provides the values that b2b commerce checkout uses to map requests to responses, necessary metadata, and context. 2745apex reference guide integrationinfo class namespace sfdc_checkout on page 2743 usage this class provides information about a b2b commerce integration. an instance of this class is passed as a parameter into the integration interface. in this section: integrationinfo properties integrationinfo properties the following are properties for integrationinfo. in this section: integrationid the unique id of a b2b commerce integration. jobid the id of the job, specific to the salesforce background operation framework. sitelanguage site language to be used by third party services. integrationid the unique id of a b2b commerce integration. signature public string integrationid {get; set;} property value type: string jobid the id of the job, specific to the salesforce background operation framework. signature public string jobid {get; set;} property value type: string 2746apex reference guide integrationstatus class sitelanguage site language to be used by third party services." "signature public string sitelanguage {get; set;} property value type: string integrationstatus class supports synchronous execution of apex integrations for b2b commerce. the implementation must return the status of the execution. namespace sfdc_checkout usage you must specify the sfdc_checkout namespace when creating an instance of this class. in this section: integrationstatus properties integrationstatus properties the following are properties for integrationstatus. in this section: status indicates the status of the integration process and whether or not it completed successfully. status indicates the status of the integration process and whether or not it completed successfully. signature public sfdc_checkout.integrationstatus.status status {get; set;} property value type: sfdc_checkout.integrationstatus.status on page 2748 2747apex reference guide integrationstatus.status enum integrationstatus.status enum the integrationstatus.status enum describes the status of the current integration. enum values the following are the values of the sfdc_checkout.integrationstatus.status enum. value description failed indicates transient, unknown error, managed by the implementor. the buyer can retry this action. success indicates the integration executed successfully. sfdc_surveys namespace the sfdc_surveys namespace provides an interface for shortening survey invitations. the following are the classes in the sfdc_surveys namespace. in this section: surveyinvitationlinkshortener interface use this interface to provide a class factory that salesforce can call to create instances of your custom surveyinvitationlinkshortener. example implementation to associate surveysubjects with surveyinvitation and surveyresponses if no survey responses are populated, create a custom code to associate surveysubjects with surveyinvitation and surveyresponses. surveyinvitationlinkshortener interface use this interface to provide a class factory that salesforce can call to create instances of your custom surveyinvitationlinkshortener. namespace sfdc_surveys usage implement an instance of the surveyinvitationlinkshortener interface to shorten the survey invitation that can be distributed as short urls over customer engaged channels, such as sms, whatsapp, or facebook messenger. special access rules to implement this interface, you must have the salesforce feedback management license enabled in your salesforce organization. 2748apex reference guide surveyinvitationlinkshortener interface in this section: surveyinvitationlinkshortener methods surveyinvitationlinkshortener example implementation surveyinvitationlinkshortener methods the following are methods for surveyinvitationlinkshortener. in this section: getshortenedurl(var1) returns a shortened url for a given survey invitation. getshortenedurl(var1) returns a shortened url for a given survey invitation. signature public string getshortenedurl(string var1) parameters var1 type: string return value type: string surveyinvitationlinkshortener example implementation this is an example implementation of the sfdc_surveys.surveyinvitationlinkshortener interface. this sample code uses named credentials for authentication. for more information on named credentials, see named credentials as callout endpoints. public class surveyinvitationlinkshortenerimpl implements sfdc_surveys.surveyinvitationlinkshortener { public string getshortenedurl(string invitationurl) { return shortenurlusingbitlyservice(invitationurl); } public string shortenurlusingbitlyservice(string invitationurl) { httprequest request = new httprequest(); request.setendpoint('callout:bitly/v4/shorten'); request.setmethod('post'); request.setheader('authorization', 'bearer {!$credential.password}'); request.setheader('accept', 'application/json'); request.setheader('content-type', 'application/json'); request.setbody(json.serialize(new map{ 2749apex reference guide example implementation to associate surveysubjects with surveyinvitation and surveyresponses 'group_guid' => '{!$credential.username}', 'long_url' => invitationurl })); http http = new http(); httpresponse res = http.send(request); object result = json.deserializeuntyped(res.getbody" "()); if (result instanceof map) { map resultmap = (map) result; object shortenedlinkval = resultmap.get('link'); if(shortenedlinkval != null && shortenedlinkval instanceof string) { return (string) shortenedlinkval; } } return invitationurl; } } example implementation to associate surveysubjects with surveyinvitation and surveyresponses if no survey responses are populated, create a custom code to associate surveysubjects with surveyinvitation and surveyresponses. this example shows how to associate surveysubjects with surveyinvitation and surveyresponses. public class createentriesinsurveyinvitationresprl { // utility to create surveyinvitation and surveysubject record public static void addentry(string associatedrecordid, string surveyid, string participantid) { string invitationid = createsurveyinvitation(surveyid, participantid); createsurveysubject(invitationid, associatedrecordid); } // create an unauthenticated invitation by setting the surveyid and participantid private static string createsurveyinvitation(string surveyid, string participantid) { surveyinvitation surveyinv = new surveyinvitation(); surveyinv.name = 'surveyinvitationforcase'; // add your survey invitation name here surveyinv.participantid = participantid; surveyinv.communityid = '0dbrm0000004n4y'; //add your community id here surveyinv.optionsallowguestuserresponse = true; surveyinv.surveyid = surveyid; // insert the surveyinvitation record insert surveyinv; return surveyinv.id; } // associate the above invitation to the required record (eg: case, opportunity...) 2750apex reference guide site namespace private static void createsurveysubject(string invitationid, string associatedrecordid) { surveysubject subj = new surveysubject(); subj.name = 'sur_subject_for_invitation'; subj.parentid = invitationid; // similary you can use survey response id to associate survey subject to a response record. subj.subjectid = associatedrecordid; // insert the surveysubject record insert subj; } } //use this trigger to create a survey subject record associated to //the survey response record trigger surveyresponseforcasetrigger on surveyresponse (after insert) { system.debug('inside survey response trigger '); for(surveyresponse sr: trigger.new) { surveysubject subj = new surveysubject(); subj.name = 'sur_subject_for_response'; subj.parentid = sr.id; //associating survey response id //get the associatedrecordid recordid (like case, opportunity etc) using the surveyinvitation id and //assigning it to subjectid, assuming we inserted surveysubject record for the associated invitation //using the previous code list sursubj=[select subjectid from surveysubject where parentid = :sr.invitationid]; for(surveysubject sub:sursubj){ string ids=string.valueof(sub.subjectid).substring(0,3); if('500'.equals(ids)){ subj.subjectid =sub.subjectid; // insert the surveysubject record insert subj; break; } } site namespace the site namespace provides an interface for rewriting sites urls. the following is the interface in the site namespace. 2751apex reference guide urlrewriter interface in this section: urlrewriter interface enables rewriting sites urls. site exceptions the site namespace contains an exception class. urlrewriter interface enables rewriting sites urls. namespace site usage sites provides built-in logic that helps you display user-friendly urls and links to site visitors. create rules to rewrite url requests typed into the address bar, launched from bookmarks, or linked from external websites. you can also create rules to rewrite the urls for links within site pages. url rewriting not only makes urls more descriptive and intuitive for users, it allows search engines to better index your site pages. for example, let's say that you have a blog site. without url rewriting, a blog entry's url might look like this: https://myblog.my.salesforce-sites.com/posts?id=003d000000q0pcn to rewrite urls for a site, create an apex class that maps" "the original urls to user-friendly urls, and then add the apex class to your site. urlrewriter methods the following are methods for urlrewriter. all are instance methods. in this section: generateurlfor(salesforceurls) maps a list of salesforce urls to a list of user-friendly urls. maprequesturl(userfriendlyurl) maps a user-friendly url to a salesforce url. generateurlfor(salesforceurls) maps a list of salesforce urls to a list of user-friendly urls. signature public system.pagereference[] generateurlfor(system.pagereference[] salesforceurls) 2752apex reference guide site exceptions parameters salesforceurls type: system.pagereference[] return value type: system.pagereference[] usage you can use list instead of pagereference[], if you prefer. important: the size and order of the input list of salesforce urls must exactly correspond to the size and order of the generated list of user-friendly urls. the generateurlfor method maps input urls to output urls based on the order in the lists. maprequesturl(userfriendlyurl) maps a user-friendly url to a salesforce url. signature public system.pagereference maprequesturl(system.pagereference userfriendlyurl) parameters userfriendlyurl type: system.pagereference return value type: system.pagereference site exceptions the site namespace contains an exception class. all exception classes support built-in methods for returning the error message and exception type. see exception class and built-in exceptions. the site namespace contains this exception: exception description methods site.externalusercreateexception unable to create use the string getmessage() to get the error message external user and write it to debug log. use list getdisplaymessages() to get a list of errors displayed to the end user. this exception can’t be subclassed or thrown in code. 2753apex reference guide support namespace support namespace the support namespace provides an interface used for case feed. the following is the interface in the support namespace. in this section: emailtemplateselector interface the support.emailtemplateselector interface enables providing default email templates in case feed. with default email templates, specified email templates are preloaded for cases based on criteria such as case origin or subject. milestonetriggertimecalculator interface the support.milestonetriggertimecalculator interface calculates the time trigger for a milestone. emailtemplateselector interface the support.emailtemplateselector interface enables providing default email templates in case feed. with default email templates, specified email templates are preloaded for cases based on criteria such as case origin or subject. namespace support to specify default templates, you must create a class that implements support.emailtemplateselector. when you implement this interface, provide an empty parameterless constructor. in this section: emailtemplateselector methods emailtemplateselector example implementation emailtemplateselector methods the following are methods for emailtemplateselector. in this section: getdefaulttemplateid(caseid) returns the id of the email template to preload for the case currently being viewed in the case feed using the specified case id. getdefaulttemplateid(caseid) returns the id of the email template to preload for the case currently being viewed in the case feed using the specified case id. signature public id getdefaulttemplateid(id caseid) 2754apex reference guide emailtemplateselector interface parameters caseid type: id return value type: id emailtemplateselector example implementation this is an example implementation of the support.emailtemplateselector interface. the getdefaultemailtemplateid method implementation retrieves the subject and description of the case corresponding to the specified case id. next, it selects an email template based on the case subject and returns the email template id. global class mycasetemplatechooser implements support.emailtemplateselector { // empty constructor global mycasetemplatechooser() { } // the main interface method global id getdefaultemailtemplateid(id caseid) { // select the case we're interested in, choosing any fields that are relevant to our decision case c = [select subject, description from case where id=:caseid]; emailtemplate et; if (c.subject.contains('lx-1150')) { et = [select id from emailtemplate where developername = 'lx1150_template']; } else if(" "c.subject.contains('lx-1220')) { et = [select id from emailtemplate where developername = 'lx1220_template']; } // return the id of the template selected return et.id; } } the following example tests the above code: @istest private class mycasetemplatechoosertest { static testmethod void testchoosetemplate() { mycasetemplatechooser chooser = new mycasetemplatechooser(); // create a simulated case to test with case c = new case(); c.subject = 'i\'m having trouble with my lx-1150'; database.insert(c); // make sure the proper template is chosen for this subject id actualtemplateid = chooser.getdefaultemailtemplateid(c.id); 2755apex reference guide milestonetriggertimecalculator interface emailtemplate expectedtemplate = [select id from emailtemplate where developername = 'lx1150_template']; id expectedtemplateid = expectedtemplate.id; system.assertequals(actualtemplateid, expectedtemplateid); // change the case properties to match a different template c.subject = 'my lx1220 is overheating'; database.update(c); // make sure the correct template is chosen in this case actualtemplateid = chooser.getdefaultemailtemplateid(c.id); expectedtemplate = [select id from emailtemplate where developername = 'lx1220_template']; expectedtemplateid = expectedtemplate.id; system.assertequals(actualtemplateid, expectedtemplateid); } } milestonetriggertimecalculator interface the support.milestonetriggertimecalculator interface calculates the time trigger for a milestone. namespace support implement the support.milestonetriggertimecalculator interface to calculate a dynamic time trigger for a milestone based on the milestone type, the properties of the case, and case-related objects. to implement the support.milestonetriggertimecalculator interface, you must first declare a class with the implements keyword as follows: global class employee implements support.milestonetriggertimecalculator { next, your class must provide an implementation for the following method: global integer calculatemilestonetriggertime(string caseid, string milestonetypeid) the implemented method must be declared as global or public. in this section: milestonetriggertimecalculator methods milestonetriggertimecalculator example implementation milestonetriggertimecalculator methods the following are instance methods for milestonetriggertimecalculator. 2756apex reference guide milestonetriggertimecalculator interface in this section: calculatemilestonetriggertime(caseid, milestonetypeid) calculates the milestone trigger time based on the specified case and milestone type and returns the time in minutes. calculatemilestonetriggertime(caseid, milestonetypeid) calculates the milestone trigger time based on the specified case and milestone type and returns the time in minutes. syntax public integer calculatemilestonetriggertime(string caseid, string milestonetypeid) parameters caseid type: string id of the case the milestone is applied to. milestonetypeid type: string id of the milestone type. return value type: integer the calculated trigger time in minutes. milestonetriggertimecalculator example implementation this sample class demonstrates the implementation of thesupport.milestonetriggertimecalculator interface. in this sample, the case’s priority and the milestone m1 determine that the time trigger is 18 minutes. global class mymilestonetimecalculator implements support.milestonetriggertimecalculator { global integer calculatemilestonetriggertime(string caseid, string milestonetypeid){ case c = [select priority from case where id=:caseid]; milestonetype mt = [select name from milestonetype where id=:milestonetypeid]; if (c.priority != null && c.priority.equals('high')){ if (mt.name != null && mt.name.equals('m1')) { return 7;} else { return 5; } } else { return 18; } } } 2757apex reference guide system namespace this test class can be used to test the implementation of support.milestonetriggertimecalculator. @istest private class milestonetimecalculatortest { static testmethod void testmilestonetimecalculator() { // select an existing milestone type to test with milestonetype[] mtlst =" "[select id, name from milestonetype limit 1]; if(mtlst.size() == 0) { return; } milestonetype mt = mtlst[0]; // create case data. // typically, the milestone type is related to the case, // but for simplicity, the case is created separately for this test. case c = new case(priority = 'high'); insert c; mymilestonetimecalculator calculator = new mymilestonetimecalculator(); integer actualtriggertime = calculator.calculatemilestonetriggertime(c.id, mt.id); if(mt.name != null && mt.name.equals('m1')) { system.assertequals(actualtriggertime, 7); } else { system.assertequals(actualtriggertime, 5); } c.priority = 'low'; update c; actualtriggertime = calculator.calculatemilestonetriggertime(c.id, mt.id); system.assertequals(actualtriggertime, 18); } } system namespace the system namespace provides classes and methods for core apex functionality. the following are the classes in the system namespace. in this section: accesslevel class defines the different modes, such as system or user mode, that apex database operations execute in. accesstype enum specifies the access check type for the fields of an sobject. address class contains methods for accessing the component fields of address compound fields. answers class represents zone answers. 2758apex reference guide system namespace apexpages class use apexpages to add and check for messages associated with the current page, as well as to reference the current page. approval class contains methods for processing approval requests and setting approval-process locks and unlocks on records. assert class contains methods to assert various conditions with test methods, such as whether two values are the same, a condition is true, or a variable is null. asyncinfo class provides methods to get the current stack depth, maximum stack depth, and the minimum queueable delay for queueable transactions, and to determine if maximum stack depth is set. asyncoptions class contains maximum stack depths for queueable transactions and the minimum queueable delay in minutes. passed as parameter to the system.enqueuejob() method to define the maximum stack depth for queueable transactions and the minimum queueable delay in minutes. blob class contains methods for the blob primitive data type. boolean class contains methods for the boolean primitive data type. businesshours class use the businesshours methods to set the business hours at which your customer support team operates. callable interface enables developers to use a common interface to build loosely coupled integrations between apex classes or triggers, even for code in separate packages. agreeing upon a common interface enables developers from different companies or different departments to build upon one another’s solutions. implement this interface to enable the broader community, which might have different solutions than the ones you had in mind, to extend your code’s functionality. cases class use the cases class to interact with case records. comparable interface adds sorting support for lists that contain non-primitive types, that is, lists of user-defined types. continuation class use the continuation class to make callouts asynchronously to a soap or rest web service. cookie class the cookie class lets you access cookies for your salesforce site using apex. crypto class provides methods for creating digests, message authentication codes, and signatures, as well as encrypting and decrypting information. custom metadata type methods custom metadata types are customizable, deployable, packageable, and upgradeable application metadata. all custom metadata is exposed in the application cache, which allows access without repeated queries to the database. the metadata is then available for formula fields, validation rules, flows, apex, and soap api. all methods are static. 2759apex reference guide system namespace custom settings methods custom settings are similar to custom objects and enable application developers to create custom sets of data, as well as create and associate custom data for an organization, profile, or specific user. all custom settings data is exposed in the application cache, which enables efficient access without the cost of repeated queries to the database. this data is then available for formula fields, validation rules, flows, apex, and the soap api. database class contains methods for creating and manipulating data. date class contains methods for the date primitive data type. datetime class contains methods for the dat" "etime primitive data type. decimal class contains methods for the decimal primitive data type. domain class represents an existing domain hosted by salesforce that serves the org or its content. contains methods to obtain information about these domains, such as the domain type, my domain name, and sandbox name. domaincreator class use the domaincreator class to return a hostname specific to the org. for example, get the org’s visualforce hostname. values are returned as a hostname, such as mydomainname.lightning.force.com. domainparser class use the domainparser class to parse a domain that salesforce hosts for the org and extract information about the domain. domaintype enum specifies the domain type for a system.domain. double class contains methods for the double primitive data type. emailmessages class use the methods in the emailmessages class to interact with emails and email threading. encodingutil class use the methods in the encodingutil class to encode and decode url strings, and convert strings to hexadecimal format. enum methods an enum is an abstract data type with values that each take on exactly one of a finite set of identifiers that you specify. apex provides built-in enums, such as logginglevel, and you can define your own enum. eventbus class contains methods for publishing platform events. exception class and built-in exceptions an exception denotes an error that disrupts the normal flow of code execution. you can use apex built-in exceptions or create custom exceptions. all exceptions have common methods. flexqueue class contains methods that reorder batch jobs in the apex flex queue. featuremanagement class use the methods in the system.featuremanagement class to check and modify the values of feature parameters, and to show or hide custom objects and custom permissions in your subscribers’ orgs. 2760apex reference guide system namespace formula class contains the recalculateformulas method that updates (recalculates) all formula fields on the input sobjects. formularecalcfielderror class the return type of the formularecalcresult.geterrors method. formularecalcresult class the return type of the formula.recalculateformulas method. http class use the http class to initiate an http request and response. httpcalloutmock interface enables sending fake responses when testing http callouts. httprequest class use the httprequest class to programmatically create http requests like get, post, patch, put, and delete. httpresponse class use the httpresponse class to handle the http response returned by the http class. id class contains methods for the id primitive data type. ideas class represents zone ideas. installhandler interface enables custom code to run after a managed package installation or upgrade. integer class contains methods for the integer primitive data type. json class contains methods for serializing apex objects into json format and deserializing json content that was serialized using the serialize method in this class. jsongenerator class contains methods used to serialize objects into json content using the standard json encoding. jsonparser class represents a parser for json-encoded content. jsontoken enum contains all token values used for parsing json content. label class provides methods to retrieve a custom label or to check if translation exists for a label in a specific language and namespace. label names are dynamically resolved at run time, overriding the user’s current language if a translation exists for the requested language. you can’t access labels that are protected in a different namespace. limits class contains methods that return limit information for specific resources. list class contains methods for the list collection type. location class contains methods for accessing the component fields of geolocation compound fields. 2761apex reference guide system namespace logginglevel enum specifies the logging level for the system.debug method. long class contains methods for the long primitive data type. map class contains methods for the map collection type. matcher class matchers use patterns to perform match operations on a character string. math class contains methods for mathematical operations. messaging class contains messaging methods used when sending a single or mass email. multistaticresourcecalloutmock class utility class used to specify a fake response using multiple resources for testing http callouts. network class manage experience cloud sites. orglimit class contains methods that provide the name, maximum value" ", and current value of an org limit. orglimits class contains methods that provide a list or map of all orglimit instances for salesforce your org, such as soap api requests, bulk api requests, and streaming api limits. pagereference class a pagereference is a reference to an instantiation of a page. among other attributes, pagereferences consist of a url and a set of query parameter names and values. packaging class contains a method for obtaining information about managed and unlocked packages. pattern class represents a compiled representation of a regular expression. queueable interface enables the asynchronous execution of apex jobs that can be monitored. queueablecontext interface represents the parameter type of the execute() method in a class that implements the queueable interface and contains the job id. this interface is implemented internally by apex. quickaction class use apex to request and process actions on objects that allow custom fields, on objects that appear in a chatter feed, or on objects that are available globally. quiddity enum specifies a quiddity value used by the methods in the system.request class remoteobjectcontroller use remoteobjectcontroller to access the standard visualforce remote objects operations in your remote objects override methods. 2762apex reference guide system namespace request class contains methods to obtain the request id and quiddity value of the current salesforce request. resetpasswordresult class represents the result of a password reset. restcontext class contains the restrequest and restresponse objects. restrequest class use the system.restrequest class to access and pass request data in a restful apex method. restresponse class represents an object used to pass data from an apex restful web service method to an http response. sandboxpostcopy interface to make your sandbox environment business ready, automate data manipulation or business logic tasks. extend this interface and add methods to perform post-copy tasks, then specify the class during sandbox creation. schedulable interface the class that implements this interface can be scheduled to run at different intervals. schedulablecontext interface represents the parameter type of a method in a class that implements the schedulable interface and contains the scheduled job id. this interface is implemented internally by apex. schema class contains methods for obtaining schema describe information. search class use the methods of the search class to perform dynamic sosl queries. security class contains methods to securely implement apex applications. selectoption class a selectoption object specifies one of the possible values for a visualforce selectcheckboxes, selectlist, or selectradio component. set class represents a collection of unique elements with no duplicate values. site class use the site class to manage your sites. change, reset, validate, and check the expiration of passwords. create site users, person accounts, and portal users. get the admin email and id. get various urls, the path prefix, the id, the template, and the type of the site. log in to the site. sobject class contains methods for the sobject data type. sobjectaccessdecision class contains the results of a call to the security.stripinaccessible method and methods to retrieve those results. staticresourcecalloutmock class utility class used to specify a fake response for testing http callouts. string class contains methods for the string primitive data type. 2763apex reference guide system namespace stubprovider interface stubprovider is a callback interface that you can use as part of the apex stub api to implement a mocking framework. use this interface with the test.createstub() method to create stubbed apex objects for testing. system class contains methods for system operations, such as writing debug messages and scheduling jobs. test class contains methods related to apex tests. time class contains methods for the time primitive data type. timezone class represents a time zone. contains methods for creating a new time zone and obtaining time zone properties, such as the time zone id, offset, and display name. trigger class use the trigger class to access run-time context information in a trigger, such as the type of trigger or the list of sobject records that the trigger operates on. triggeroperation enum system.triggeroperation enum values are associated with trigger events. type class contains methods for getting the apex type that corresponds to an apex class and for instantiating new types. uninstallhandler interface enables custom code to run after a managed package is uninstalled. url class represents a uniform resource locator (url) and provides access to parts of the url. enables access" "to the base url used to access your salesforce org. userinfo class contains methods for obtaining information about the context user. usermanagement class contains methods to manage end users, for example, to register their verification methods, verify their identity, or remove their personal information. version class use the version methods to get the version of a first-generation managed package, and to compare package versions. webservicecallout class enables making callouts to soap operations on an external web service. this class is used in the apex stub class that is auto-generated from a wsdl. webservicemock interface enables sending fake responses when testing web service callouts of a class auto-generated from a wsdl. xmlstreamreader class the xmlstreamreader class provides methods for forward, read-only access to xml data. you can pull data from xml or skip unwanted events. you can parse nested xml content that’s up to 50 nodes deep. xmlstreamwriter class the xmlstreamwriter class provides methods for writing xml data. 2764apex reference guide accesslevel class accesslevel class defines the different modes, such as system or user mode, that apex database operations execute in. namespace system usage by default, apex code runs in system mode, which means that it runs with substantially elevated permissions over the user running the code. in system mode, the object and field-level permissions of the current user are ignored, and the record sharing rules are controlled by the class sharing keywords. in user mode, the current user's object permissions, field-level security, and sharing rules are enforced. many of the dml methods of the system.database and system.search classes include an accesslevel parameter to specify the execution mode. example if the user running this apex code doesn't have write access to the account object, the database.insert() method returns an error. list toinsert = new list{new account(name = 'exciting new account')}; list sr = database.insert(toinsert, accesslevel.user_mode); in contrast, this example shows the method running in system mode. the success of the insert doesn't depend on whether the user running the apex code has create access to the account object. list toinsert = new list{new account(name = 'exciting new account')}; list sr = database.insert(toinsert, accesslevel.system_mode); in this section: accesslevel properties accesslevel properties the following are properties for accesslevel. in this section: system_mode execution mode in which the the object and field-level permissions of the current user are ignored, and the record sharing rules are controlled by the class sharing keywords. user_mode execution mode in which the object permissions, field-level security, and sharing rules of the current user are enforced. 2765apex reference guide accesstype enum system_mode execution mode in which the the object and field-level permissions of the current user are ignored, and the record sharing rules are controlled by the class sharing keywords. signature public system.accesslevel system_mode {get;} property value type: system.accesslevel user_mode execution mode in which the object permissions, field-level security, and sharing rules of the current user are enforced. signature public system.accesslevel user_mode {get;} property value type: system.accesslevel accesstype enum specifies the access check type for the fields of an sobject. usage use these enum values for the accesschecktype parameter of the stripinaccessible method. enum values the following are the values of the system.accesstype enum. value description creatable check the fields of an sobject for create access. readable check the fields of an sobject for read access. updatable check the fields of an sobject for update access. upsertable check the fields of an sobject for both insert and update access. address class contains methods for accessing the component fields of address compound fields. 2766apex reference guide address class namespace system usage each of these methods is also equivalent to a read-only property. for each getter method, you can access the property using dot notation. for example, myaddress.getcity() is equivalent to myaddress.city. you can’t use dot notation to access compound fields’ subfields directly on the parent field. instead, assign the parent field" "to a variable of type address, and then access its components. for example, to access the city field in myaccount.billingaddress, do the following: address addr = myaccount.billingaddress; string acctcity = addr.city; important: “address” in salesforce can also refer to the address standard object. when referencing the address object in your apex code, always use schema.address instead of address to prevent confusion with the standard address compound field. if referencing both the address object and the address standard field in the same snippet, you can differentiate between the two by using system.address for the field and schema.address for the object. example // select and access address fields. // call the getdistance() method in different ways. account[] records = [select id, billingaddress from account limit 10]; for(account acct : records) { address addr = acct.billingaddress; double lat = addr.latitude; double lon = addr.longitude; location loc1 = location.newinstance(30.1944,-97.6682); double apexdist1 = addr.getdistance(loc1, 'mi'); double apexdist2 = loc1.getdistance(addr, 'mi'); system.assertequals(apexdist1, apexdist2); double apexdist3 = location.getdistance(addr, loc1, 'mi'); system.assertequals(apexdist2, apexdist3); } in this section: address methods address methods the following are methods for address. in this section: getcity() returns the city field of this address. 2767apex reference guide address class getcountry() returns the text-only country/territory name component of this address. getcountrycode() returns the country/territory code of this address if state and country/territory picklists are enabled in your organization. otherwise, returns null. getdistance(tolocation, unit) returns the distance from this location to the specified location using the specified unit. getgeocodeaccuracy() when using geolocation data for a given address, this method gives you relative location information based on latitude and longitude values. for example, you can find out if the latitude and longitude values point to the middle of the street, instead of the exact address. getlatitude() returns the latitude field of this address. getlongitude() returns the longitude field of this address. getpostalcode() returns the postal code of this address. getstate() returns the text-only state name component of this address. getstatecode() returns the state code of this address if state and country/territory picklists are enabled in your organization. otherwise, returns null. getstreet() returns the street field of this address. getcity() returns the city field of this address. signature public string getcity() return value type: string getcountry() returns the text-only country/territory name component of this address. signature public string getcountry() 2768apex reference guide address class return value type: string getcountrycode() returns the country/territory code of this address if state and country/territory picklists are enabled in your organization. otherwise, returns null. signature public string getcountrycode() return value type: string getdistance(tolocation, unit) returns the distance from this location to the specified location using the specified unit. signature public double getdistance(location tolocation, string unit) parameters tolocation type: location the location to which you want to calculate the distance from the current location. unit type: string the distance unit you want to use: mi or km. return value type: double getgeocodeaccuracy() when using geolocation data for a given address, this method gives you relative location information based on latitude and longitude values. for example, you can find out if the latitude and longitude values point to the middle of the street, instead of the exact address. signature public string getgeocodeaccuracy() return value type: string 2769apex reference guide address class the getgeocodeaccuracy() return value tells you more about the location at a latitude and longitude for a given address. for example, zip means the latitude and longitude point to the center of the zip code area, in case a match for an exact street address can’t be found" ". accuracy value description address in the same building nearaddress near the address block midway point of the block street midway point of the street extendedzip center of the extended zip code area zip center of the zip code area neighborhood center of the neighborhood city center of the city county center of the county state center of the state unknown no match for the address was found geocodes are added only for some standard addresses. • billing address on accounts • shipping address on accounts • mailing address on contacts • address on leads person accounts are not supported. note: for getgeocodeaccuracy() to work, set up and activate the geocode data integration rules for the related address fields. getlatitude() returns the latitude field of this address. signature public double getlatitude() return value type: double 2770apex reference guide address class getlongitude() returns the longitude field of this address. signature public double getlongitude() return value type: double getpostalcode() returns the postal code of this address. signature public string getpostalcode() return value type: string getstate() returns the text-only state name component of this address. signature public string getstate() return value type: string getstatecode() returns the state code of this address if state and country/territory picklists are enabled in your organization. otherwise, returns null. signature public string getstatecode() return value type: string getstreet() returns the street field of this address. 2771apex reference guide answers class signature public string getstreet() return value type: string answers class represents zone answers. namespace system usage answers is a feature that enables users to ask questions and have zone members post replies. members can then vote on the helpfulness of each reply, and the person who asked the question can mark one reply as the best answer. for more information on answers, see “answers overview” in the salesforce online help. example the following example finds questions in an internal zone that have similar titles as a new question: public class findsimilarquestioncontroller { public static void test() { // instantiate a new question question question = new question (); // specify a title for the new question question.title = 'how much vacation time do full-time employees get?'; // specify the communityid (internal_community) in which to find similar questions. community community = [ select id from community where name = 'internal_community' ]; question.communityid = community.id; id[] results = answers.findsimilar(question); } } the following example marks a reply as the best reply: id questionid = [select id from question where title = 'testing setbestreplyid' limit 1].id; id replyid = [select id from reply where questionid = :questionid limit 1].id; answers.setbestreply(questionid,replyid); 2772apex reference guide answers class answers methods the following are methods for answers. all methods are static. in this section: findsimilar(yourquestion) returns a list of similar questions based on the title of the specified question. setbestreply(questionid, replyid) sets the specified reply for the specified question as the best reply. because a question can have multiple replies, setting the best reply helps users quickly identify the reply that contains the most helpful information. findsimilar(yourquestion) returns a list of similar questions based on the title of the specified question. signature public static id[] findsimilar(question yourquestion) parameters yourquestion type: question return value type: id[] usage each findsimilar call counts against the sosl statements governor limit allowed for the process. setbestreply(questionid, replyid) sets the specified reply for the specified question as the best reply. because a question can have multiple replies, setting the best reply helps users quickly identify the reply that contains the most helpful information. signature public static void setbestreply(string questionid, string replyid) parameters questionid type: string replyid type: string 2773apex reference guide apexpages class return value type: void apexpages class use apexpages to add and check for messages associated with the current page, as well as to reference the current page. names" "pace system usage in addition, apexpages is used as a namespace for the pagereference class and the message class. apexpages methods the following are methods for apexpages. all are instance methods. in this section: addmessage(message) add a message to the current page context. addmessages(exceptionthrown) adds a list of messages to the current page context based on a thrown exception. currentpage() returns the current page's pagereference. getmessages() returns a list of the messages associated with the current context. hasmessages() returns true if there are messages associated with the current context, false otherwise. hasmessages(severity) returns true if messages of the specified severity exist, false otherwise. addmessage(message) add a message to the current page context. signature public void addmessage(apexpages.message message) parameters message type: apexpages.message 2774apex reference guide apexpages class return value type: void addmessages(exceptionthrown) adds a list of messages to the current page context based on a thrown exception. signature public void addmessages(exception exceptionthrown) parameters exceptionthrown type: exception return value type: void currentpage() returns the current page's pagereference. signature public system.pagereference currentpage() return value type: system.pagereference example this code segment returns the id parameter of the current page. public mycontroller() { account = [ select id, name, site from account where id = :apexpages.currentpage(). getparameters(). get('id') ]; } getmessages() returns a list of the messages associated with the current context. 2775apex reference guide approval class signature public apexpages.message[] getmessages() return value type: apexpages.message[] hasmessages() returns true if there are messages associated with the current context, false otherwise. signature public boolean hasmessages() return value type: boolean hasmessages(severity) returns true if messages of the specified severity exist, false otherwise. signature public boolean hasmessages(apexpages.severity severity) parameters sev type: apexpages.severity return value type: boolean approval class contains methods for processing approval requests and setting approval-process locks and unlocks on records. namespace system usage salesforce admins can edit locked records. depending on your approval process configuration settings, an assigned approver can also edit locked records. locks and unlocks that are set programmatically use the same record editability settings as other approval-process locks and unlocks. 2776apex reference guide approval class record locks and unlocks are treated as dml. they’re blocked before a callout, they count toward your dml limits, and if a failure occurs, they’re rolled back along with the rest of your transaction. to change this rollback behavior, use an allornone parameter. approval is also used as a namespace for the processrequest and processresult classes. see also: approval process considerations approval methods the following are methods for approval. all methods are static. in this section: islocked(id) returns true if the record with the id id is locked, or false if it’s not. islocked(ids) returns a map of record ids and their lock statuses. if the record is locked the status is true. if the record is not locked the status is false. islocked(sobject) returns true if the sobject record is locked, or false if it’s not. islocked(sobjects) returns a map of record ids to lock statuses. if the record is locked the status is true. if the record is not locked the status is false. lock(recordid) locks an object, and returns the lock results. lock(recordids) locks a set of objects, and returns the lock results, including failures. lock(recordtolock) locks an object, and returns the lock results. lock(recordstolock) locks a set of objects, and returns the lock results, including failures. lock(recordid, allornothing) locks an object, with the option for partial success, and returns the lock result. lock(recordids, allornothing) locks a set" "of objects, with the option for partial success. it returns the lock results, including failures. lock(recordtolock, allornothing) locks an object, with the option for partial success, and returns the lock result. lock(recordstolock, allornothing) locks a set of objects, with the option for partial success. it returns the lock results, including failures. process(approvalrequest) submits a new approval request and approves or rejects existing approval requests. process(approvalrequest, allornone) submits a new approval request and approves or rejects existing approval requests. 2777apex reference guide approval class process(approvalrequests) submits a list of new approval requests, and approves or rejects existing approval requests. process(approvalrequests, allornone) submits a list of new approval requests, and approves or rejects existing approval requests. unlock(recordid) unlocks an object, and returns the unlock results. unlock(recordids) unlocks a set of objects, and returns the unlock results, including failures. unlock(recordtounlock) unlocks an object, and returns the unlock results. unlock(recordstounlock) unlocks a set of objects, and returns the unlock results, including failures. unlock(recordid, allornothing) unlocks an object, with the option for partial success, and returns the unlock result. unlock(recordids, allornothing) unlocks a set of objects, with the option for partial success. it returns the unlock results, including failures. unlock(recordtounlock, allornothing) unlocks an object, with the option for partial success, and returns the unlock result. unlock(recordstounlock, allornothing) unlocks a set of objects, with the option for partial success. it returns the unlock results, including failures. islocked(id) returns true if the record with the id id is locked, or false if it’s not. signature public static boolean islocked(id id) parameters id type: id the id of the record whose lock or unlock status is in question. return value type: boolean islocked(ids) returns a map of record ids and their lock statuses. if the record is locked the status is true. if the record is not locked the status is false. 2778apex reference guide approval class signature public static map islocked(list ids) parameters ids type: list the ids of the records whose lock or unlock statuses are in question. return value type: map islocked(sobject) returns true if the sobject record is locked, or false if it’s not. signature public static boolean islocked(sobject sobject) parameters sobject type: sobject the record whose lock or unlock status is in question. return value type: boolean islocked(sobjects) returns a map of record ids to lock statuses. if the record is locked the status is true. if the record is not locked the status is false. signature public static map islocked(list sobjects) parameters sobjects type: list the records whose lock or unlock statuses are in question. return value type: map 2779apex reference guide approval class lock(recordid) locks an object, and returns the lock results. signature public static approval.lockresult lock(id recordid) parameters recordid type: id id of the object to lock. return value type: approval.lockresult lock(recordids) locks a set of objects, and returns the lock results, including failures. signature public static list lock(list ids) parameters ids type: list ids of the objects to lock. return value type: list lock(recordtolock) locks an object, and returns the lock results. signature public static approval.lockresult lock(sobject recordtolock) parameters recordtolock type: sobject 2780apex reference guide approval class return value type: approval." "lockresult lock(recordstolock) locks a set of objects, and returns the lock results, including failures. signature public static list lock(list recordstolock) parameters recordstolock type: list return value type: list lock(recordid, allornothing) locks an object, with the option for partial success, and returns the lock result. signature public static approval.lockresult lock(id recordid, boolean allornothing) parameters recordid type: id id of the object to lock. allornothing type: boolean specifies whether this operation allows partial success. if you specify false and a record fails, the remainder of the dml operation can still succeed. this method returns a result object that you can use to verify which records succeeded, which failed, and why. return value type: approval.lockresult lock(recordids, allornothing) locks a set of objects, with the option for partial success. it returns the lock results, including failures. signature public static list lock(list recordids, boolean allornothing) 2781apex reference guide approval class parameters recordids type: list ids of the objects to lock. allornothing type: boolean specifies whether this operation allows partial success. if you specify false and a record fails, the remainder of the dml operation can still succeed. this method returns a result object that you can use to verify which records succeeded, which failed, and why. return value type: list lock(recordtolock, allornothing) locks an object, with the option for partial success, and returns the lock result. signature public static approval.lockresult lock(sobject recordtolock, boolean allornothing) parameters recordtolock type: sobject allornothing type: boolean specifies whether this operation allows partial success. if you specify false and a record fails, the remainder of the dml operation can still succeed. this method returns a result object that you can use to verify which records succeeded, which failed, and why. return value type: approval.lockresult lock(recordstolock, allornothing) locks a set of objects, with the option for partial success. it returns the lock results, including failures. signature public static list lock(list recordstolock, boolean allornothing) parameters recordstolock type: list 2782" "apex reference guide approval class allornothing type: boolean specifies whether this operation allows partial success. if you specify false and a record fails, the remainder of the dml operation can still succeed. this method returns a result object that you can use to verify which records succeeded, which failed, and why. return value type: list process(approvalrequest) submits a new approval request and approves or rejects existing approval requests. signature public static approval.processresult process(approval.processrequest approvalrequest) parameters approvalrequest type: approval.processrequest return value type: approval.processresult example // insert an account account a = new account(name='test', annualrevenue=100.0); insert a; // create an approval request for the account approval.processsubmitrequest req1 = new approval.processsubmitrequest(); req1.setobjectid(a.id); // submit the approval request for the account approval.processresult result = approval.process(req1); process(approvalrequest, allornone) submits a new approval request and approves or rejects existing approval requests. 2783apex reference guide approval class signature public static approval.processresult process(approval.processrequest approvalrequest, boolean allornone) parameters approvalrequest approval.processrequest allornone type: boolean the optional allornone parameter specifies whether the operation allows for partial success. if you specify false for this parameter and an approval fails, the remainder of the approval processes can still succeed. return value approval.processresult process(approvalrequests) submits a list of new approval requests, and approves or rejects existing approval requests. signature public static approval.processresult [] process(approval.processrequest[] approvalrequests) parameters approvalrequests approval.processrequest [] return value approval.processresult [] process(approvalrequests, allornone) submits a list of new approval requests, and approves or rejects existing approval requests. signature public static approval.processresult [] process(approval.processrequest[] approvalrequests, boolean allornone) parameters approvalrequests approval.processrequest [] 2784apex reference guide approval class allornone type: boolean the optional allornone parameter specifies whether the operation allows for partial success. if you specify false for this parameter and an approval fails, the remainder of the approval processes can still succeed. return value approval.processresult [] unlock(recordid) unlocks an object, and returns the unlock results. signature public static approval.unlockresult unlock(id recordid) parameters recordid type: id id of the object to unlock. return value type: approval.unlockresult unlock(recordids) unlocks a set of objects, and returns the unlock results, including failures. signature public static list unlock(list recordids) parameters recordids type: list ids of the objects to unlock. return value type: list unlock(recordtounlock) unlocks an object, and returns the unlock results. 2785apex reference guide approval class signature public static approval.unlockresult unlock(sobject recordtounlock) parameters recordtounlock type: sobject return value type: approval.unlockresult unlock(recordstounlock) unlocks a set of objects, and returns the unlock results, including failures. signature public static list unlock(list recordstounlock) parameters recordstounlock type: list return value type: list unlock(recordid, allornothing) unlocks an object, with the option for partial success, and returns the unlock result. signature public static approval.unlockresult unlock(id recordid, boolean allornothing) parameters recordid type: id id of the object to lock. allornothing type: boolean specifies whether this operation allows partial success. if you specify false and" "a record fails, the remainder of the dml operation can still succeed. this method returns a result object that you can use to verify which records succeeded, which failed, and why. 2786apex reference guide approval class return value type: approval.unlockresult unlock(recordids, allornothing) unlocks a set of objects, with the option for partial success. it returns the unlock results, including failures. signature public static list unlock(list recordids, boolean allornothing) parameters recordids type: list ids of the objects to unlock. allornothing type: boolean specifies whether this operation allows partial success. if you specify false and a record fails, the remainder of the dml operation can still succeed. this method returns a result object that you can use to verify which records succeeded, which failed, and why. return value type: list unlock(recordtounlock, allornothing) unlocks an object, with the option for partial success, and returns the unlock result. signature public static approval.unlockresult unlock(sobject recordtounlock, boolean allornothing) parameters recordtounlock type: sobject allornothing type: boolean specifies whether this operation allows partial success. if you specify false and a record fails, the remainder of the dml operation can still succeed. this method returns a result object that you can use to verify which records succeeded, which failed, and why. return value type: approval.unlockresult 2787apex reference guide assert class unlock(recordstounlock, allornothing) unlocks a set of objects, with the option for partial success. it returns the unlock results, including failures. signature public static list unlock(list recordstounlock, boolean allornothing) parameters recordstounlock type: list allornothing type: boolean specifies whether this operation allows partial success. if you specify false and a record fails, the remainder of the dml operation can still succeed. this method returns a result object that you can use to verify which records succeeded, which failed, and why. return value type: list assert class contains methods to assert various conditions with test methods, such as whether two values are the same, a condition is true, or a variable is null. namespace system assert methods the following are methods for assert. in this section: areequal(expected, actual, msg) asserts that the first two arguments are the same. areequal(expected, actual) asserts that the two arguments are the same. arenotequal(notexpected, actual, msg) asserts that the first two arguments aren’t the same. arenotequal(notexpected, actual) asserts that the two arguments aren’t the same. fail(msg) immediately return a fatal error that causes code execution to halt. 2788apex reference guide assert class fail() immediately return a fatal error that causes code execution to halt. isfalse(condition, msg) asserts that the specified condition is false. isfalse(condition) asserts that the specified condition is false. isinstanceoftype(instance, expectedtype, msg) asserts that the instance is of the specified type. isinstanceoftype(instance, expectedtype) asserts that the instance is of the specified type. isnotinstanceoftype(instance, notexpectedtype, msg) asserts that the instance isn’t of the specified type. isnotinstanceoftype(instance, notexpectedtype) asserts that the instance isn’t of the specified type. isnotnull(value, msg) asserts that the value isn’t null. isnotnull(value) asserts that the value isn’t null. isnull(value, msg) asserts that the value is null. isnull(value) asserts that the value is null. istrue(condition, msg) asserts that the specified condition is true. istrue(condition) asserts that the specified condition is true. areequal(expected, actual, msg)" "asserts that the first two arguments are the same. signature public static void areequal(object expected, object actual, string msg) parameters expected type: object expected value. actual type: object actual value. 2789apex reference guide assert class msg type: string (optional) custom message returned as part of the error message. return value type: void usage if the first two arguments aren't the same, a fatal error is returned that causes code execution to halt. you can’t catch an assertion failure using a try/catch block even though it’s logged as an exception. example string sub = 'abcde'.substring(2); assert.areequal('cde', sub, 'expected characters after first two'); // succeeds areequal(expected, actual) asserts that the two arguments are the same. signature public static void areequal(object expected, object actual) parameters expected type: object expected value. actual type: object actual value. return value type: void usage if the two arguments aren't the same, a fatal error is returned that causes code execution to halt. you can’t catch an assertion failure using a try/catch block even though it’s logged as an exception. example string sub = 'abcde'.substring(2); assert.areequal('cde', sub); // succeeds 2790apex reference guide assert class arenotequal(notexpected, actual, msg) asserts that the first two arguments aren’t the same. signature public static void arenotequal(object notexpected, object actual, string msg) parameters notexpected type: object value that’s not expected. actual type: object actual value. msg type: string (optional) custom message returned as part of the error message. return value type: void usage if the first two arguments are the same, a fatal error is returned that causes code execution to halt. you can’t catch an assertion failure using a try/catch block even though it’s logged as an exception. example string sub = 'abcde'.substring(2); assert.arenotequal('xyz', sub, 'characters not expected after first two'); // succeeds arenotequal(notexpected, actual) asserts that the two arguments aren’t the same. signature public static void arenotequal(object notexpected, object actual) parameters notexpected type: object value that’s not expected. 2791apex reference guide assert class actual type: object actual value. return value type: void usage if the two arguments are the same, a fatal error is returned that causes code execution to halt. you can’t catch an assertion failure using a try/catch block even though it’s logged as an exception. example string sub = 'abcde'.substring(2); assert.arenotequal('xyz', sub); // succeeds fail(msg) immediately return a fatal error that causes code execution to halt. signature public static void fail(string msg) parameters msg type: string (optional) custom message returned as part of the error message. return value type: void usage commonly used in a try/catch block test case where an exception is expected to be thrown. you can’t, however, catch the assertion failure in the try/catch block even though it’s logged as an exception. example // test case where exception is expected try { someclass.methodundertest(); assert.fail('dmlexception expected'); } catch (dmlexception ex) { 2792apex reference guide assert class // add assertions here about the expected exception } fail() immediately return a fatal error that causes code execution to halt. signature public static void fail() return value type: void usage commonly used in a try/catch block test case where an exception is expected to be thrown. you can’t, however, catch the assertion failure in the try/catch block even though it’s logged as an exception. example // test case where exception is expected try { someclass.methodundertest(); assert.fail(); } catch (dml" "exception ex) { // add assertions here about the expected exception } isfalse(condition, msg) asserts that the specified condition is false. signature public static void isfalse(boolean condition, string msg) parameters condition type: boolean condition you’re checking to determine if it’s false. msg type: string (optional) custom message returned as part of the error message. 2793apex reference guide assert class return value type: void usage if the condition is true, a fatal error is returned that causes code execution to halt. you can’t catch an assertion failure using a try/catch block even though it’s logged as an exception. example boolean containscode = 'salesforce'.contains('code'); assert.isfalse(containscode, 'no code'); // assertion succeeds isfalse(condition) asserts that the specified condition is false. signature public static void isfalse(boolean condition) parameters condition type: boolean condition you’re checking to determine if it’s false. return value type: void usage if the condition is true, a fatal error is returned that causes code execution to halt. you can’t catch an assertion failure using a try/catch block even though it’s logged as an exception. example boolean containscode = 'salesforce'.contains('code'); assert.isfalse(containscode); // assertion succeeds isinstanceoftype(instance, expectedtype, msg) asserts that the instance is of the specified type. signature public static void isinstanceoftype(object instance, system.type expectedtype, string msg) 2794apex reference guide assert class parameters instance type: object instance whose type you're checking. expectedtype type: system.type on page 3473 expected type. msg type: string (optional) custom message returned as part of the error message. return value type: void usage if the instance isn't of the specified type, a fatal error is returned that causes code execution to halt. you can’t catch an assertion failure using a try/catch block even though it’s logged as an exception. example account o = new account(); assert.isinstanceoftype(o, account.class); // succeeds isinstanceoftype(instance, expectedtype) asserts that the instance is of the specified type. signature public static void isinstanceoftype(object instance, system.type expectedtype) parameters instance type: object instance whose type you're checking. expectedtype type: system.type on page 3473 expected type. return value type: void 2795apex reference guide assert class usage if the instance isn't of the specified type, a fatal error is returned that causes code execution to halt. you can’t catch an assertion failure using a try/catch block even though it’s logged as an exception. example account o = new account(); assert.isinstanceoftype(o, account.class); // succeeds account o = new account(); assert.isinstanceoftype(o, account.class, 'expected type.'); // succeeds isnotinstanceoftype(instance, notexpectedtype, msg) asserts that the instance isn’t of the specified type. signature public static void isnotinstanceoftype(object instance, system.type notexpectedtype, string msg) parameters instance type: object instance whose type you're checking. notexpectedtype type: system.type on page 3473 type that's not expected. msg type: string (optional) custom message returned as part of the error message. return value type: void usage if the instance is of the specified type, a fatal error is returned that causes code execution to halt. you can’t catch an assertion failure using a try/catch block even though it’s logged as an exception. example contact con = new contact(); assert.isnotinstanceoftype(con, account.class, 'not expected type'); // succeeds 2796apex reference guide assert class isnotinstanceoftype(instance, notexpectedtype) asserts that the instance isn’t of the specified type. signature public static void isnotinstanceoftype(object instance, system.type notexpectedtype)" "parameters instance type: object instance whose type you're checking. notexpectedtype type: system.type on page 3473 type that's not expected. return value type: void usage if the instance is of the specified type, a fatal error is returned that causes code execution to halt. you can’t catch an assertion failure using a try/catch block even though it’s logged as an exception. example contact con = new contact(); assert.isnotinstanceoftype(con, account.class); // succeeds isnotnull(value, msg) asserts that the value isn’t null. signature public static void isnotnull(object value, string msg) parameters value type: object value you’re checking to determine if it’s not null. msg type: string (optional) custom message returned as part of the error message. 2797apex reference guide assert class return value type: void usage if the value is null, a fatal error is returned that causes code execution to halt. you can’t catch an assertion failure using a try/catch block even though it’s logged as an exception. example string mystring = 'value'; assert.isnotnull(mystring, 'mystring should not be null'); // succeeds isnotnull(value) asserts that the value isn’t null. signature public static void isnotnull(object value) parameters value type: object value you’re checking to determine if it’s not null. return value type: void usage if the value is null, a fatal error is returned that causes code execution to halt. you can’t catch an assertion failure using a try/catch block even though it’s logged as an exception. example string mystring = 'value'; assert.isnotnull(mystring); // succeeds isnull(value, msg) asserts that the value is null. signature public static void isnull(object value, string msg) 2798apex reference guide assert class parameters value type: object value you’re checking to determine if it’s null. msg type: string (optional) custom message returned as part of the error message. return value type: void usage if the value isn't null, a fatal error is returned that causes code execution to halt. you can’t catch an assertion failure using a try/catch block even though it’s logged as an exception. example string mystring = null; assert.isnull(mystring, 'string should be null'); // succeeds isnull(value) asserts that the value is null. signature public static void isnull(object value) parameters value type: object value you’re checking to determine if it’s null. return value type: void usage if the value isn't null, a fatal error is returned that causes code execution to halt. you can’t catch an assertion failure using a try/catch block even though it’s logged as an exception. 2799apex reference guide assert class example string mystring = null; assert.isnull(mystring); // succeeds istrue(condition, msg) asserts that the specified condition is true. signature public static void istrue(boolean condition, string msg) parameters condition type: boolean condition you’re checking to determine if it’s true. msg type: string (optional) custom message returned as part of the error message. return value type: void usage if the specified condition is false, a fatal error is returned that causes code execution to halt. you can’t catch an assertion failure using a try/catch block even though it’s logged as an exception. example boolean containsforce = 'salesforce'.contains('force'); assert.istrue(containsforce, 'contains force'); // assertion succeeds istrue(condition) asserts that the specified condition is true. signature public static void istrue(boolean condition) parameters condition type: boolean condition you’re checking to determine if it’s true. 2800apex reference guide asyncinfo class return value type: void usage if the specified condition is false, a fatal error is returned that" "causes code execution to halt. you can’t catch an assertion failure using a try/catch block even though it’s logged as an exception. example boolean containsforce = 'salesforce'.contains('force'); assert.istrue(containsforce); // assertion succeeds asyncinfo class provides methods to get the current stack depth, maximum stack depth, and the minimum queueable delay for queueable transactions, and to determine if maximum stack depth is set. namespace system in this section: asyncinfo methods asyncinfo methods the following are methods for asyncinfo. in this section: getcurrentqueueablestackdepth() get the current queueable stack depth for queueable transactions. getmaximumqueueablestackdepth() get the maximum queueable stack depth for queueable transactions. getminimumqueueabledelayinminutes() get the minimum queueable delay for queueable transactions (in minutes). hasmaxstackdepth() determine if maximum stack depth is set for your queueable requests. getcurrentqueueablestackdepth() get the current queueable stack depth for queueable transactions. 2801apex reference guide asyncoptions class signature public static integer getcurrentqueueablestackdepth() return value type: integer getmaximumqueueablestackdepth() get the maximum queueable stack depth for queueable transactions. signature public static integer getmaximumqueueablestackdepth() return value type: integer getminimumqueueabledelayinminutes() get the minimum queueable delay for queueable transactions (in minutes). signature public static integer getminimumqueueabledelayinminutes() return value type: integer returns null if no delay is defined. hasmaxstackdepth() determine if maximum stack depth is set for your queueable requests. signature public static boolean hasmaxstackdepth() return value type: boolean asyncoptions class contains maximum stack depths for queueable transactions and the minimum queueable delay in minutes. passed as parameter to the system.enqueuejob() method to define the maximum stack depth for queueable transactions and the minimum queueable delay in minutes. 2802apex reference guide blob class namespace system in this section: asyncoptions properties asyncoptions properties the following are properties for asyncoptions. in this section: maximumqueueablestackdepth maximum stack depth for queueable transactions. minimumqueueabledelayinminutes minimum queueable delay for queueable transactions. maximumqueueablestackdepth maximum stack depth for queueable transactions. signature public integer maximumqueueablestackdepth {get; set;} property value type: integer minimumqueueabledelayinminutes minimum queueable delay for queueable transactions. signature public integer minimumqueueabledelayinminutes {get; set;} property value type: integer blob class contains methods for the blob primitive data type. namespace system 2803apex reference guide blob class usage for more information on blobs, see primitive data types. blob methods the following are methods for blob. in this section: size() returns the number of characters in the blob. topdf(stringtoconvert) creates a binary object out of the given string, encoding it as a pdf file. tostring() casts the blob into a string. valueof(stringtoblob) casts the specified string to a blob. size() returns the number of characters in the blob. signature public integer size() return value type: integer example string mystring = 'stringtoblob'; blob myblob = blob.valueof(mystring); integer size = myblob.size(); topdf(stringtoconvert) creates a binary object out of the given string, encoding it as a pdf file. signature public static blob topdf(string stringtoconvert) parameters stringtoconvert type: string 2804apex reference guide blob class note: referencing a static resource throws an invalidparametervalue exception. return value type: blob example string pdfcontent = 'this is a test string'; account a = new account(name = 'test'); insert a; attachment attachmentpdf = new attachment(); attachmentpdf.parentid = a.id; attachmentpdf.name = a.name + '.pdf'; attachmentpdf.body = blob.to" "pdf(pdfcontent); insert attachmentpdf; tostring() casts the blob into a string. signature public string tostring() return value type: string example string mystring = 'stringtoblob'; blob myblob = blob.valueof(mystring); system.assertequals('stringtoblob', myblob.tostring()); valueof(stringtoblob) casts the specified string to a blob. signature public static blob valueof(string stringtoblob) parameters stringtoblob type: string 2805apex reference guide boolean class return value type: blob example string mystring = 'stringtoblob'; blob myblob = blob.valueof(mystring); boolean class contains methods for the boolean primitive data type. namespace system boolean methods the following are methods for boolean. all methods are static. in this section: valueof(stringtoboolean) converts the specified string to a boolean value and returns true if the specified string value is true. otherwise, returns false. valueof(fieldvalue) converts the specified object to a boolean value. use this method to convert a history tracking field value or an object that represents a boolean value. valueof(stringtoboolean) converts the specified string to a boolean value and returns true if the specified string value is true. otherwise, returns false. signature public static boolean valueof(string stringtoboolean) parameters stringtoboolean type: string return value type: boolean usage if the specified argument is null, this method throws an exception. 2806apex reference guide businesshours class example boolean b = boolean.valueof('true'); system.assertequals(true, b); valueof(fieldvalue) converts the specified object to a boolean value. use this method to convert a history tracking field value or an object that represents a boolean value. signature public static boolean valueof(object fieldvalue) parameters fieldvalue type: object return value type: boolean usage use this method with the oldvalue or newvalue fields of history sobjects, such as accounthistory, when the field type corresponds to a boolean type, like a checkbox field. example list ahlist = [select field,oldvalue,newvalue from accounthistory]; for(accounthistory ah : ahlist) { system.debug('field: ' + ah.field); if (ah.field == 'isplatinum__c') { boolean oldvalue = boolean.valueof(ah.oldvalue); boolean newvalue = boolean.valueof(ah.newvalue); } businesshours class use the businesshours methods to set the business hours at which your customer support team operates. namespace system 2807apex reference guide businesshours class businesshours methods the following are methods for businesshours. all methods are static. in this section: add(businesshoursid, startdate, intervalmilliseconds) adds an interval of time from a start datetime traversing business hours only. returns the result datetime in the local time zone. addgmt(businesshoursid, startdate, intervalmilliseconds) adds an interval of milliseconds from a start datetime traversing business hours only. returns the result datetime in gmt. diff(businesshoursid, startdate, enddate) returns the difference in milliseconds between a start and end datetime based on a specific set of business hours. iswithin(businesshoursid, targetdate) returns true if the specified target date occurs within business hours. holidays are included in the calculation. nextstartdate(businesshoursid, targetdate) starting from the specified target date, returns the next date when business hours are open. if the specified target date falls within business hours, this target date is returned. add(businesshoursid, startdate, intervalmilliseconds) adds an interval of time from a start datetime traversing business hours only. returns the result datetime in the local time zone. signature public static datetime add(string businesshoursid, datetime startdate, long intervalmilliseconds) parameters businesshoursid type: string startdate type: datetime intervalmilliseconds type: long interval value should be provided in milliseconds, however time precision smaller than one minute is ignored. return value type: datetime addgmt" "(businesshoursid, startdate, intervalmilliseconds) adds an interval of milliseconds from a start datetime traversing business hours only. returns the result datetime in gmt. 2808apex reference guide businesshours class signature public static datetime addgmt(string businesshoursid, datetime startdate, long intervalmilliseconds) parameters businesshoursid type: string startdate type: datetime intervalmilliseconds type: long return value type: datetime diff(businesshoursid, startdate, enddate) returns the difference in milliseconds between a start and end datetime based on a specific set of business hours. signature public static long diff(string businesshoursid, datetime startdate, datetime enddate) parameters businesshoursid type: string startdate type: datetime enddate type: datetime return value type: long iswithin(businesshoursid, targetdate) returns true if the specified target date occurs within business hours. holidays are included in the calculation. signature public static boolean iswithin(string businesshoursid, datetime targetdate) 2809apex reference guide businesshours class parameters businesshoursid type: string the business hours id. targetdate type: datetime the date to verify. return value type: boolean example the following example finds whether a given time is within the default business hours. // get the default business hours businesshours bh = [select id from businesshours where isdefault=true]; // create datetime on may 28, 2013 at 1:06:08 am in the local timezone. datetime targettime = datetime.newinstance(2013, 5, 28, 1, 6, 8); // find whether the time is within the default business hours boolean iswithin= businesshours.iswithin(bh.id, targettime); nextstartdate(businesshoursid, targetdate) starting from the specified target date, returns the next date when business hours are open. if the specified target date falls within business hours, this target date is returned. signature public static datetime nextstartdate(string businesshoursid, datetime targetdate) parameters businesshoursid type: string the business hours id. targetdate type: datetime the date used as a start date to obtain the next date. return value type: datetime 2810apex reference guide callable interface example the following example finds the next date starting from the target date when business hours reopens. if the target date is within the given business hours, the target date is returned. the returned time is in the local time zone. // get the default business hours businesshours bh = [select id from businesshours where isdefault=true]; // create datetime on may 28, 2013 at 1:06:08 am in the local timezone. datetime targettime = datetime.newinstance(2013, 5, 28, 1, 6, 8); // starting from the targettime, find the next date when business hours reopens. return the target time. // if it is within the business hours. the returned time will be in the local time zone datetime nextstart = businesshours.nextstartdate(bh.id, targettime); callable interface enables developers to use a common interface to build loosely coupled integrations between apex classes or triggers, even for code in separate packages. agreeing upon a common interface enables developers from different companies or different departments to build upon one another’s solutions. implement this interface to enable the broader community, which might have different solutions than the ones you had in mind, to extend your code’s functionality. note: this interface is not an analog of the java callable interface, which is used for asynchronous invocation. don’t confuse the two. namespace system usage to implement the callable interface, you need to write only one method: call(string action, map args). in code that utilizes or tests an implementation of callable, cast an instance of your type to callable. this interface is not intended to replace defining more specific interfaces. rather, the callable interface allows integrations in which code from different classes or packages can use common base types. in this section: callable methods callable example implementation callable methods the following are methods for callable. 2811apex reference guide callable interface in this section: call(action, args) provides functionality that other classes or packages can utilize and build upon. call" "(action, args) provides functionality that other classes or packages can utilize and build upon. signature public object call(string action, map args) parameters action type: string the behavior for the method to exhibit. args type: map on page 3144 arguments to be used by the specified action. return value type: object the result of the method invocation. callable example implementation this class is an example implementation of the system.callable interface. public class extension implements callable { // actual method string concatstrings(string stringvalue) { return stringvalue + stringvalue; } // actual method decimal multiplynumbers(decimal decimalvalue) { return decimalvalue * decimalvalue; } // dispatch actual methods public object call(string action, map args) { switch on action { when 'concatstrings' { return this.concatstrings((string)args.get('stringvalue')); } when 'multiplynumbers' { return this.multiplynumbers((decimal)args.get('decimalvalue')); 2812apex reference guide cases class } when else { throw new extensionmalformedcallexception('method not implemented'); } } } public class extensionmalformedcallexception extends exception {} } the following test code illustrates how calling code utilizes the interface to call a method. @istest private with sharing class extensioncaller { @istest private static void givenconfiguredextensionwhencalledthenvalidresult() { // given string extensionclass = 'extension'; // typically set via configuration decimal decimaltestvalue = 10; // when callable extension = (callable) type.forname(extensionclass).newinstance(); decimal result = (decimal) extension.call('multiplynumbers', new map { 'decimalvalue' => decimaltestvalue }); // then system.assertequals(100, result); } } see also: apex developer guide: classes and casting cases class use the cases class to interact with case records. namespace system cases methods the following are static methods for cases. 2813apex reference guide cases class in this section: generatethreadingmessageid(caseid) returns an rfc 2822-compliant message identifier that contains information used to match the email and its replies to a case. getcaseidfromemailheaders(headers) returns the case id corresponding to the specified email header information, or returns null if none is found. getcaseidfromemailthreadid(emailthreadid) returns the case id corresponding to the specified email thread id. (deprecated. use getcaseidfromemailheaders and emailmessages.getrecordidfromemail instead.) generatethreadingmessageid(caseid) returns an rfc 2822-compliant message identifier that contains information used to match the email and its replies to a case. signature public static string generatethreadingmessageid(id caseid) parameters caseid type: id the case sobject id to which replies to this email should be attached. return value type: string usage use the returned message identifier when sending case-related emails in apex. the returned message identifier can be used in message-id or references headers. however, because salesforce doesn’t let users specify the message-id, we set this identifier in the references header. when users reply to the sent email, replies should be attached to the specified case. example in this sample, we create an email with a message identifier so that the email and any responses can be associated with the related case. //get your case id. here we use a dummy id id caseid = id.valueof('500xx000000bpktaaq'); //create a singleemailmessage object messaging.singleemailmessage email = new messaging.singleemailmessage(); //set recipients and other fields email.settoaddresses(new string[] {'test@salesforce.com'}); email.setplaintextbody('test email notification'); //........... more fields ........... //get the threading message identifier string messageid = cases.generatethreadingmessageid(caseid); //insert the message identifier into the references header email.setreferences(messageid); 2814apex reference guide cases class //send out the email messaging.sendemail(new messaging.singleemailmessage" "[]{email}); getcaseidfromemailheaders(headers) returns the case id corresponding to the specified email header information, or returns null if none is found. signature public static id getcaseidfromemailheaders(list headers) parameters headers type: list return value type: id usage to optimize finding a match between email threads and cases in your custom code, we recommend that you use this method and emailmessages.getrecordidfromemail to implement a combination of token- and header-based threading. if you are transitioning from ref id threading, we recommend that you replace cases.getcaseidfromemailthreadid with a combination of cases.getcaseidfromemailheaders and emailmessages.getrecordidfromemail. if you choose to implement header-based threading only, replace cases.getcaseidfromemailthreadid with cases.getcaseidfromemailheaders. the headers argument is used to find the matching case id using values for the in-reply-to and references headers based on rfc 2822. if email-to-case can’t find any emails with a matching in-reply-to or references header, it also checks the incoming email for an outlook-specific header called thread-index. the first 22 bytes of this header uniquely identify the thread. if email-to-case detects a thread-index header on the incoming mail, it looks for matching information in the clientthreadidentifier field in emailmessage records. if a match is found, the customer’s reply email is linked to the related case. typically this method is used in email services so that you can provide your own handling of inbound emails using apex code. example if you implement header-based threading in your email services currently, we recommend that you use lightning threading, which combines token-based threading and header-based threading. for header-based threading to continue to work, store emails as emailmessage records with the messagedidentifier field set properly. with lightning threading, you can use threading tokens as the primary threading method and rely on header-based threading as a fallback, or vice versa. in this example, we rely on threading tokens and use header-based threading as a fallback. global class attachemailmessagetocaseexample implements messaging.inboundemailhandler { global messaging.inboundemailresult handleinboundemail(messaging.inboundemail email, messaging.inboundenvelope env) { // create an inboundemailresult object for returning the result of the 2815apex reference guide cases class // apex email service. messaging.inboundemailresult result = new messaging.inboundemailresult(); // try to find the case id using threading tokens in email attributes. id caseid = emailmessages.getrecordidfromemail(email.subject, email.plaintextbody, email.htmlbody); // if we haven't found the case id, try finding it using headers. if (caseid == null) { caseid = cases.getcaseidfromemailheaders(email.headers); } // if a case isn’t found, create a new case record. if (caseid == null) { case c = new case(subject = email.subject); insert c; system.debug('new case object: ' + c); caseid = c.id; } // process recipients string toaddresses; if (email.toaddresses != null) { toaddresses = string.join(email.toaddresses, '; '); } // to store an emailmessage for threading, you need at minimum // the status, the messageidentifier, and the parentid fields. emailmessage em = new emailmessage( status = '0', messageidentifier = email.messageid, parentid = caseid, // other important fields. fromaddress = email.fromaddress, fromname = email.fromname, toaddress = toaddresses, textbody = email.plaintextbody, htmlbody = email.htmlbody, subject = email.subject, // parse thread-index header to remain consistent with email-to-case. clientthreadidentifier = getclientthreadidentifier(email.headers) // other fields you wish to add. ); // insert the new emailmessage. insert em; system.debug('new emailmessage object: ' + em ); // set the result to" "true. no need to send an email back to the user // with an error message. result.success = true; // return the result for the apex email service. return result; 2816apex reference guide comparable interface } private string getclientthreadidentifier(list headers) { if (headers == null || headers.size() == 0) return null; try { for (messaging.inboundemail.header header : headers) { if (header.name.equalsignorecase('thread-index')) { blob threadindex = encodingutil.base64decode(header.value.trim()); return encodingutil.converttohex(threadindex).substring(0, 44).touppercase(); } } } catch (exception e){ return null; } return null; } } getcaseidfromemailthreadid(emailthreadid) returns the case id corresponding to the specified email thread id. (deprecated. use getcaseidfromemailheaders and emailmessages.getrecordidfromemail instead.) signature public static id getcaseidfromemailthreadid(string emailthreadid) parameters emailthreadid type: string return value type: id usage the emailthreadid argument should have the following format: _00dxx1gew._500xxyktg. other formats, such as ref:_00dxx1gew._500xxyktl:ref and [ref:_00dxx1gew._500xxyktl:ref], are invalid. comparable interface adds sorting support for lists that contain non-primitive types, that is, lists of user-defined types. namespace system 2817apex reference guide comparable interface usage to add list sorting support for your apex class, you must implement the comparable interface with its compareto method in your class. to implement the comparable interface, you must first declare a class with the implements keyword as follows: global class employee implements comparable { next, your class must provide an implementation for the following method: global integer compareto(object compareto) { // your code here } the implemented method must be declared as global or public. in this section: comparable methods comparable example implementation see also: list class comparable methods the following are methods for comparable. in this section: compareto(objecttocompareto) returns an integer value that is the result of the comparison. compareto(objecttocompareto) returns an integer value that is the result of the comparison. signature public integer compareto(object objecttocompareto) parameters objecttocompareto type: object return value type: integer 2818apex reference guide comparable interface usage the implementation of this method returns the following values: • 0 if this instance and objecttocompareto are equal • > 0 if this instance is greater than objecttocompareto • < 0 if this instance is less than objecttocompareto if this object instance and objecttocompareto are incompatible, a system.typeexception is thrown. comparable example implementation this is an example implementation of the comparable interface. the compareto method in this example compares the employee of this class instance with the employee passed in the argument. the method returns an integer value based on the comparison of the employee ids. global class employee implements comparable { public long id; public string name; public string phone; // constructor public employee(long i, string n, string p) { id = i; name = n; phone = p; } // implement the compareto() method global integer compareto(object compareto) { employee comparetoemp = (employee)compareto; if (id == comparetoemp.id) return 0; if (id > comparetoemp.id) return 1; return -1; } } this example tests the sort order of a list of employee objects. @istest private class employeesortingtest { static testmethod void test1() { list emplist = new list(); emplist.add(new employee(101,'joe smith', '4155551212')); emplist.add(new employee(101,'j. smith', '4155551212')); emplist.add(new employee(25,'caragh smith', '4155551000'));" "emplist.add(new employee(105,'mario ruiz', '4155551099')); // sort using the custom compareto() method emplist.sort(); // write list contents to the debug log system.debug(emplist); 2819apex reference guide continuation class // verify list sort order. system.assertequals('caragh smith', emplist[0].name); system.assertequals('joe smith', emplist[1].name); system.assertequals('j. smith', emplist[2].name); system.assertequals('mario ruiz', emplist[3].name); } } continuation class use the continuation class to make callouts asynchronously to a soap or rest web service. namespace system example for a code example, see make long-running callouts from a visualforce page. in this section: continuation constructors continuation properties continuation methods continuation constructors the following are constructors for continuation. in this section: continuation(timeout) creates an instance of the continuation class by using the specified timeout in seconds. the timeout maximum is 120 seconds. continuation(timeout) creates an instance of the continuation class by using the specified timeout in seconds. the timeout maximum is 120 seconds. signature public continuation(integer timeout) parameters timeout type: integer the timeout for this continuation in seconds. 2820apex reference guide continuation class continuation properties the following are properties for continuation. in this section: continuationmethod the name of the callback method that is called after the callout response returns. timeout the timeout of the continuation in seconds. maximum: 120 seconds. state data that is stored in this continuation and that can be retrieved after the callout is finished and the callback method is invoked. continuationmethod the name of the callback method that is called after the callout response returns. signature public string continuationmethod {get; set;} property value type: string usage note: if the continuationmethod property is not set for a continuation, the same action method that made the asynchronous callout is called again when the callout response returns. timeout the timeout of the continuation in seconds. maximum: 120 seconds. signature public integer timeout {get; set;} property value type: integer state data that is stored in this continuation and that can be retrieved after the callout is finished and the callback method is invoked. signature public object state {get; set;} 2821apex reference guide continuation class property value type: object example this example shows how to save state information for a continuation in a controller. // declare inner class to hold state info private class stateinfo { string msg { get; set; } list urls { get; set; } stateinfo(string msg, list urls) { this.msg = msg; this.urls = urls; } } // then in the action method, set state for the continuation continuationinstance.state = new stateinfo('some state data', urls); continuation methods the following are methods for continuation. in this section: addhttprequest(request) adds the http request for the callout that is associated with this continuation. getrequests() returns all labels and requests that are associated with this continuation as key-value pairs. getresponse(requestlabel) returns the response for the request that corresponds to the specified label. addhttprequest(request) adds the http request for the callout that is associated with this continuation. signature public string addhttprequest(system.httprequest request) parameters request type: httprequest the http request to be sent to the external service by this continuation. return value type: string 2822apex reference guide continuation class a unique label that identifies the http request that is associated with this continuation. this label is used in the map that getrequests() returns to identify individual requests in a continuation. usage you can add up tothree requests to a continuation. note: the timeout that is set in each passed-in request is ignored. only the global timeout maximum of 120 seconds applies for a continuation. getrequests() returns all labels and requests that are associated with this continuation as key-value pairs. signature public map getrequests() return value type: map" "a map of all requests that are associated with this continuation. the map key is the request label, and the map value is the corresponding http request. getresponse(requestlabel) returns the response for the request that corresponds to the specified label. signature public static httpresponse getresponse(string requestlabel) parameters requestlabel type: string the request label to get the response for. return value type: httpresponse usage the status code is returned in the httpresponse object and can be obtained by calling getstatuscode() on the response. a status code of 200 indicates that the request was successful. other status code values indicate the type of problem that was encountered. sample of error status codes when a problem occurs with the response, some possible status code values are: • 2000: the timeout was reached, and the server didn’t get a chance to respond. 2823apex reference guide cookie class • 2001: there was a connection failure. • 2002: exceptions occurred. • 2003: the response hasn’t arrived (which also means that the apex asynchronous callout framework hasn’t resumed). • 2004: the response size is too large (greater than 1 mb). cookie class the cookie class lets you access cookies for your salesforce site using apex. namespace system usage use the setcookies method of the pagereference class to attach cookies to a page. important: • cookie names and values set in apex are url encoded, that is, characters such as @ are replaced with a percent sign and their hexadecimal representation. • the setcookies method adds the prefix “apex__” to the cookie names. • setting a cookie's value to null sends a cookie with an empty string value instead of setting an expired attribute. • after you create a cookie, the properties of the cookie can't be changed. • be careful when storing sensitive information in cookies. pages are cached regardless of a cookie value. if you use a cookie value to generate dynamic content, you should disable page caching. for more information, see configure site caching in salesforce help. consider the following limitations when using the cookie class: • the cookie class can only be accessed using apex that is saved using the salesforce api version 19 and above. • the maximum number of cookies that can be set per salesforce sites domain depends on your browser. newer browsers have higher limits than older ones. • cookies must be less than 4k, including name and attributes. • the maximum header size of a visualforce page, including cookies, is 8,192 bytes. for more information on sites, see “salesforce sites” in the salesforce online help. example the following example creates a class, cookiecontroller, which is used with a visualforce page (see markup below) to update a counter each time a user displays a page. the number of times a user goes to the page is stored in a cookie. // a visualforce controller class that creates a cookie // used to keep track of how often a user displays a page public class cookiecontroller { public cookiecontroller() { cookie counter = apexpages.currentpage().getcookies().get('counter'); 2824apex reference guide cookie class // if this is the first time the user is accessing the page, // create a new cookie with name 'counter', an initial value of '1', // path 'null', maxage '-1', and issecure 'true'. if (counter == null) { counter = new cookie('counter','1',null,-1,true); } else { // if this isn't the first time the user is accessing the page // create a new cookie, incrementing the value of the original count by 1 integer count = integer.valueof(counter.getvalue()); counter = new cookie('counter', string.valueof(count+1),null,-1,true); } // set the new cookie for the page apexpages.currentpage().setcookies(new cookie[]{counter}); } // this method is used by the visualforce action {!count} to display the current // value of the number of times a user had displayed a page. // this value is stored in the cookie. public string getcount() { cookie counter = apexpages.currentpage().getcookies().get('counter'); if(counter == null) { return '0'; } return counter.getvalue(); } } // test class for the visualforce controller @istest private class cookiecontrollertest { // test method for verifying the positive test case static testmethod void" "testcounter() { //first page view cookiecontroller controller = new cookiecontroller(); system.assert(controller.getcount() == '1'); //second page view controller = new cookiecontroller(); system.assert(controller.getcount() == '2'); } } the following is the visualforce page that uses the cookiecontroller apex controller above. the action {!count} calls the getcount method in the controller above. you have seen this page {!count} times in this section: cookie constructors cookie methods 2825apex reference guide cookie class cookie constructors the following are constructors for cookie. in this section: cookie(name, value, path, maxage, issecure) creates a new instance of the cookie class using the specified name, value, path, age, and the secure setting. cookie(name, value, path, maxage, issecure, samesite) creates a new instance of the cookie class using the specified name, value, path, and age, and settings for security and cross-domain behavior. cookie(name, value, path, maxage, issecure) creates a new instance of the cookie class using the specified name, value, path, age, and the secure setting. signature public cookie(string name, string value, string path, integer maxage, boolean issecure) parameters name type: string the cookie name. it can’t be null. value type: string the cookie data, such as session id. path type: string the path from where you can retrieve the cookie. maxage type: integer a number representing how long a cookie is valid for in seconds. if set to less than zero, a session cookie is issued. if set to zero, the cookie is deleted. issecure type: boolean a value indicating whether the cookie can only be accessed through https (true) or not (false). cookie(name, value, path, maxage, issecure, samesite) creates a new instance of the cookie class using the specified name, value, path, and age, and settings for security and cross-domain behavior. note: google chrome 80 introduces a new default cookie attribute setting of samesite, which is set to lax. previously, the samesite cookie attribute defaulted to the value of none. when samesite is set to none, cookies must be tagged with the issecure attribute indicating that they require an encrypted https connection. 2826apex reference guide cookie class signature public cookie(string name, string value, string path, integer maxage, boolean issecure, string samesite) parameters name type: string the cookie name. it can’t be null. value type: string the cookie data, such as session id. path type: string the path from where you can retrieve the cookie. maxage type: integer a number representing how long a cookie is valid for in seconds. if set to less than zero, a session cookie is issued. if set to zero, the cookie is deleted. issecure type: boolean a value indicating whether the cookie can only be accessed through https (true) or not (false). samesite type: string the samesite attribute on a cookie controls its cross-domain behavior. the valid values are none, lax, and strict. after the chrome 80 release, a cookie with a samesite value of none must also be marked secure by setting a value of none; secure. see also: salesforce spring ’20 release notes: prepare for google chrome’s changes in samesite cookie behavior that can break salesforce integrations chrome platform status: reject insecure samesite=none cookies cookie methods the following are methods for cookie. all are instance methods. in this section: getdomain() returns the name of the server making the request. getmaxage() returns a number representing how long the cookie is valid for, in seconds. if set to < 0, a session cookie is issued. if set to 0, the cookie is deleted. 2827apex reference guide cookie class getname() returns the name of the cookie. can't be null. getpath() returns the path from which you can retrieve the cookie. if null or blank, the location is set to root, or “/”. getsamesite() returns the value for the samesite attribute of the cookie. getvalue() returns the data" "captured in the cookie, such as session id. issecure() returns true if the cookie can only be accessed through https, otherwise returns false. getdomain() returns the name of the server making the request. signature public string getdomain() return value type: string getmaxage() returns a number representing how long the cookie is valid for, in seconds. if set to < 0, a session cookie is issued. if set to 0, the cookie is deleted. signature public integer getmaxage() return value type: integer getname() returns the name of the cookie. can't be null. signature public string getname() return value type: string 2828apex reference guide cookie class getpath() returns the path from which you can retrieve the cookie. if null or blank, the location is set to root, or “/”. signature public string getpath() return value type: string getsamesite() returns the value for the samesite attribute of the cookie. signature public string getsamesite() return value type: string see also: web.dev: samesite cookies explained getvalue() returns the data captured in the cookie, such as session id. signature public string getvalue() return value type: string issecure() returns true if the cookie can only be accessed through https, otherwise returns false. signature public boolean issecure() return value type: boolean 2829apex reference guide crypto class crypto class provides methods for creating digests, message authentication codes, and signatures, as well as encrypting and decrypting information. namespace system usage the methods in the crypto class can be used for securing content in lightning platform, or for integrating with external services such as google or amazon webservices (aws). encrypt and decrypt exceptions the following exceptions can be thrown for these methods: • decrypt • encrypt • decryptwithmanagediv • encryptwithmanagediv exception message description invalidparametervalue unable to parse initialization vector from thrown if you're using managed encrypted data. initialization vectors, and the cipher text is less than 16 bytes. invalidparametervalue invalid algorithm algoname. must be thrown if the algorithm name isn't one of aes128, aes192, aes256, aes384, or the valid values. aes512. invalidparametervalue invalid private key. must be size bytes. thrown if size of the private key doesn't match the specified algorithm. invalidparametervalue invalid initialization vector. must be 16 bytes. thrown if the initialization vector isn't 16 bytes. invalidparametervalue invalid data. input data is size bytes, thrown if the data is greater than 1 mb. for which exceeds the limit of 1048576 bytes. decryption, 1048608 bytes are allowed for the initialization vector header, plus any additional padding the encryption added to align to block size. nullpointerexception argument cannot be null. thrown if one of the required method arguments is null. securityexception given final block not properly padded. thrown if the data isn't properly block-aligned or similar issues occur during encryption or decryption. 2830apex reference guide crypto class exception message description securityexception message varies thrown if something goes wrong during either encryption or decryption. crypto methods the following are methods for crypto. all methods are static. in this section: decrypt(algorithmname, privatekey, initializationvector, ciphertext) decrypts the blob ciphertext using the specified algorithm, private key, and initialization vector. use this method to decrypt blobs encrypted using a third party application or the encrypt method. decryptwithmanagediv(algorithmname, privatekey, ivandciphertext) decrypts the blob ivandciphertext using the specified algorithm and private key. use this method to decrypt blobs encrypted using a third party application or the encryptwithmanagediv method. encrypt(algorithmname, privatekey, initializationvector, cleartext) encrypts the blob cleartext using the specified algorithm, private key and initialization vector. use this method when you want to specify your own initialization vector. encryptwithmanagediv(algorithmname, privatekey, cleartext) encrypts the blob cleartext using the specified algorithm and private key. use this method when you want salesforce to generate the initialization vector for you. generateaeskey(size) generates an advanced encryption standard (aes) key." "generatedigest(algorithmname, input) computes a secure, one-way hash digest based on the supplied input string and algorithm name. generatemac(algorithmname, input, privatekey) computes a message authentication code (mac) for the input string, using the private key and the specified algorithm. getrandominteger() returns a random integer. getrandomlong() returns a random long. sign(algorithmname, input, privatekey) computes a unique digital signature for the input string, using the specified algorithm and the supplied private key. signwithcertificate(algorithmname, input, certdevname) computes a unique digital signature for the input string, using the specified algorithm and the supplied certificate and key pair. signxml(algorithmname, node, idattributename, certdevname) envelops the signature into an xml document. signxml(algorithmname, node, idattributename, certdevname, refchild) inserts the signature envelope before the specified child node. 2831apex reference guide crypto class verify(string algorithmname, blob data, blob signature, blob publickey) verifies the digital signature for the blob data using the specified algorithm and the supplied public key. use this method to verify a blob signed by a digital signature created using a third-party application or the sign method. verify(string algorithmname, blob data, blob signature, string certdevname) verifies the digital signature for the blob data using the specified algorithm and the public key associated with the certdevname. use this method to verify a blob signed by a digital signature created using a third-party application or the sign method. verifyhmac(string algorithmname, blob input, blob privatekey, blob mactoverify) verifies the hmac signature for blob data using the specified algorithm, input data, privatekey, and the mac. use this method to verify a blob signed by a digital signature created using a third-party application or the sign method. decrypt(algorithmname, privatekey, initializationvector, ciphertext) decrypts the blob ciphertext using the specified algorithm, private key, and initialization vector. use this method to decrypt blobs encrypted using a third party application or the encrypt method. signature public static blob decrypt(string algorithmname, blob privatekey, blob initializationvector, blob ciphertext) parameters algorithmname type: string privatekey type: blob initializationvector type: blob ciphertext type: blob return value type: blob usage valid values for algorithmname are: • aes128 • aes192 • aes256 these algorithms are all industry standard advanced encryption standard (aes) algorithms with different size keys. they use cipher block chaining (cbc) and pkcs7 padding. the length of privatekey must match the specified algorithm: 128 bits, 192 bits, or 256 bits, which is 16 bytes, 24 bytes, or 32 bytes, respectively. you can use a third-party application or the generateaeskey method to generate this key for you. the initialization vector must be 128 bits (16 bytes.) 2832" "apex reference guide crypto class example blob exampleiv = blob.valueof('example of iv123'); blob key = crypto.generateaeskey(128); blob data = blob.valueof('data to be encrypted'); blob encrypted = crypto.encrypt('aes128', key, exampleiv, data); blob decrypted = crypto.decrypt('aes128', key, exampleiv, encrypted); string decryptedstring = decrypted.tostring(); system.assertequals('data to be encrypted', decryptedstring); decryptwithmanagediv(algorithmname, privatekey, ivandciphertext) decrypts the blob ivandciphertext using the specified algorithm and private key. use this method to decrypt blobs encrypted using a third party application or the encryptwithmanagediv method. signature public static blob decryptwithmanagediv(string algorithmname, blob privatekey, blob ivandciphertext) parameters algorithmname type: string privatekey type: blob ivandciphertext type: blob the first 128 bits (16 bytes) of ivandciphertext must contain the initialization vector. return value type: blob usage valid values for algorithmname are: • aes128 • aes192 • aes256 these algorithms are all industry standard advanced encryption standard (aes) algorithms with different size keys. they use cipher block chaining (cbc) and pkcs7 padding. the length of privatekey must match the specified algorithm: 128 bits, 192 bits, or 256 bits, which is 16 bytes, 24 bytes, or 32 bytes, respectively. you can use a third-party application or the generateaeskey method to generate this key for you. 2833apex reference guide crypto class example blob key = crypto.generateaeskey(128); blob data = blob.valueof('data to be encrypted'); blob encrypted = crypto.encryptwithmanagediv('aes128', key, data); blob decrypted = crypto.decryptwithmanagediv('aes128', key, encrypted); string decryptedstring = decrypted.tostring(); system.assertequals('data to be encrypted', decryptedstring); encrypt(algorithmname, privatekey, initializationvector, cleartext) encrypts the blob cleartext using the specified algorithm, private key and initialization vector. use this method when you want to specify your own initialization vector. signature public static blob encrypt(string algorithmname, blob privatekey, blob initializationvector, blob cleartext) parameters algorithmname type: string privatekey type: blob initializationvector type: blob cleartext type: blob return value type: blob usage the initialization vector must be 128 bits (16 bytes.) use either a third-party application or the decrypt method to decrypt blobs encrypted using this method. use the encryptwithmanagediv method if you want salesforce to generate the initialization vector for you. it is stored as the first 128 bits (16 bytes) of the encrypted blob. valid values for algorithmname are: • aes128 • aes192 • aes256 these algorithms are all industry standard advanced encryption standard (aes) algorithms with different size keys. they use cipher block chaining (cbc) and pkcs7 padding. the length of privatekey must match the specified algorithm: 128 bits, 192 bits, or 256 bits, which is 16 bytes, 24 bytes, or 32 bytes, respectively. you can use a third-party application or the generateaeskey method to generate this key for you. 2834apex reference guide crypto class example blob exampleiv = blob.valueof('example of iv123'); blob key = crypto.generateaeskey(128); blob data = blob.valueof('data to be encrypted'); blob encrypted = crypto.encrypt('aes128', key, exampleiv, data); blob decrypted = crypto.decrypt('aes128', key, exampleiv, encrypted); string decryptedstring = decrypted.tostring(); system.assertequals('data to be encrypted', decryptedstring); encryptwithmanagediv(algorithmname, privatekey, cleartext) encrypts the blob cleartext using the specified algorithm and private key. use this method when you want salesforce to generate the initialization vector for you. signature public static blob encrypt" "withmanagediv(string algorithmname, blob privatekey, blob cleartext) parameters algorithmname type: string privatekey type: blob cleartext type: blob return value type: blob usage the initialization vector is stored as the first 128 bits (16 bytes) of the encrypted blob. use either third-party applications or the decryptwithmanagediv method to decrypt blobs encrypted with this method. use the encrypt method if you want to generate your own initialization vector. valid values for algorithmname are: • aes128 • aes192 • aes256 these algorithms are all industry standard advanced encryption standard (aes) algorithms with different size keys. they use cipher block chaining (cbc) and pkcs7 padding. the length of privatekey must match the specified algorithm: 128 bits, 192 bits, or 256 bits, which is 16 bytes, 24 bytes, or 32 bytes, respectively. you can use a third-party application or the generateaeskey method to generate this key for you. 2835apex reference guide crypto class example blob key = crypto.generateaeskey(128); blob data = blob.valueof('data to be encrypted'); blob encrypted = crypto.encryptwithmanagediv('aes128', key, data); blob decrypted = crypto.decryptwithmanagediv('aes128', key, encrypted); string decryptedstring = decrypted.tostring(); system.assertequals('data to be encrypted', decryptedstring); generateaeskey(size) generates an advanced encryption standard (aes) key. signature public static blob generateaeskey(integer size) parameters size type: integer the key's size in bits. valid values are: • 128 • 192 • 256 return value type: blob example blob key = crypto.generateaeskey(128); generatedigest(algorithmname, input) computes a secure, one-way hash digest based on the supplied input string and algorithm name. signature public static blob generatedigest(string algorithmname, blob input) parameters algorithmname type: string valid values for algorithmname are: • md5 2836apex reference guide crypto class • sha1 • sha3-256 • sha3-384 • sha3-512 • sha-256 • sha-512 input type: blob return value type: blob example blob targetblob = blob.valueof('examplemd5string'); blob hash = crypto.generatedigest('md5', targetblob); generatemac(algorithmname, input, privatekey) computes a message authentication code (mac) for the input string, using the private key and the specified algorithm. signature public static blob generatemac(string algorithmname, blob input, blob privatekey) parameters algorithmname type: string the valid values for algorithmname are: • hmacmd5 • hmacsha1 • hmacsha256 • hmacsha512 input type: blob privatekey type: blob the value of privatekey does not need to be in decoded form. the value cannot exceed 4 kb. return value type: blob 2837apex reference guide crypto class example string salt = string.valueof(crypto.getrandominteger()); string key = 'key'; blob data = crypto.generatemac('hmacsha256', blob.valueof(salt), blob.valueof(key)); getrandominteger() returns a random integer. signature public static integer getrandominteger() return value type: integer example integer randomint = crypto.getrandominteger(); getrandomlong() returns a random long. signature public static long getrandomlong() return value type: long example long randomlong = crypto.getrandomlong(); sign(algorithmname, input, privatekey) computes a unique digital signature for the input string, using the specified algorithm and the supplied private key. signature public static blob sign(string algorithmname, blob input, blob privatekey) 2838apex reference guide crypto class parameters algorithmname type: string the algorithm name. the valid values for algorithmname are rsa, rsa-sha1, rsa-sha256, rsa-sha384, r" "sa-sha512, ecdsa-sha256, ecdsa-sha384, and ecdsa-sha512. rsa-sha1 is an rsa signature (with an asymmetric key pair) of an sha1 hash. rsa-sha256 is an rsa signature of an sha256 hash. rsa-sha384 is an rsa signature of an sha384 hash. rsa-sha512 is an rsa signature of an sha512 hash. rsa is the same as rsa-sha1. ecdsa-sha256 is an ecdsa signature of an sha256 hash. ecdsa-sha384 is an ecdsa signature of an sha384 hash. ecdsa-sha512 is an ecdsa signature of an sha512 hash. input type: blob the data to sign. privatekey type: blob the value of privatekey must be decoded using the encodingutilbase64decode method, and should be in rsa's pkcs #8 (1.2) private-key information syntax standard form. the value cannot exceed 4 kb. return value type: blob example the following snippet shows how to call the sign method. string algorithmname = 'rsa'; string key = ''; blob privatekey = encodingutil.base64decode(key); blob input = blob.valueof('12345qwerty'); crypto.sign(algorithmname, input, privatekey); signwithcertificate(algorithmname, input, certdevname) computes a unique digital signature for the input string, using the specified algorithm and the supplied certificate and key pair. signature public static blob signwithcertificate(string algorithmname, blob input, string certdevname) 2839apex reference guide crypto class parameters algorithmname type: string the algorithm name. the valid values for algorithmname are rsa, rsa-sha1, rsa-sha256, rsa-sha384, rsa-sha512,ecdsa-sha256, ecdsa-sha384, and ecdsa-sha512. rsa-sha1 is an rsa signature (with an asymmetric key pair) of an sha1 hash. rsa-sha256 is an rsa signature of an sha256 hash. rsa-sha384 is an rsa signature of an sha384 hash. rsa-sha512 is an rsa signature of an sha512 hash. rsa is the same as rsa-sha1. ecdsa-sha256 is an ecdsa signature of an sha256 hash. ecdsa-sha384 is an ecdsa signature of an sha384 hash. ecdsa-sha512 is an ecdsa signature of an sha512 hash. input type: blob the data to sign. certdevname type: string the unique name for a certificate stored in the salesforce org’s certificate and key management page to use for signing. to access the certificate and key management page from setup, enter certificate and key management in the quick find box, then select certificate and key management. return value type: blob example the following snippet is an example of the method for signing the content referenced by data. blob data = blob.valueof('12345qwerty'); system.crypto.signwithcertificate('rsa-sha512', data, 'signingcert'); signxml(algorithmname, node, idattributename, certdevname) envelops the signature into an xml document. signature public void signxml(string algorithmname, dom.xmlnode node, string idattributename, string certdevname) 2840apex reference guide crypto class parameters algorithmname type: string the rsa encryption algorithm name. valid names are rsa, rsa-sha1, rsa-sha256, rsa-sha384, rsa-sha512,ecdsa-sha256, ecdsa-sha384, and ecdsa-sha512. rsa-sha1 is an rsa signature (with an asymmetric key pair) of an sha1 hash. rsa-sha256 is an rsa signature of an sha256 hash. rsa-sha384 is an rsa signature of an sha384 hash. rsa-sha512 is an rsa signature of an sha512 hash. rsa is the same as rsa-sha1. ecdsa-sha256 is an ecdsa signature of an sha256 hash. ecdsa-sha384 is an ecdsa signature of an sha384 hash. ecdsa-sha512 is an ecdsa signature of" "an sha512 hash. node type: dom.xmlnode the xml node to sign and insert the signature into. idattributename type: string the full name (including the namespace) of the attribute on the node (xmlnode) to use as the reference id. if null, this method uses the id attribute on the node. if there is no id attribute, salesforce generates a new id and adds it to the node. certdevname type: string the unique name for a certificate stored in the salesforce org’s certificate and key management page to use for signing. to access the certificate and key management page from setup, enter certificate and key management in the quick find box, then select certificate and key management. return value type: void example the following is an example declaration and initialization. dom.document doc = new dom.document(); doc.load(...); system.crypto.signxml('rsa-sha512', doc.getrootelement(), null, 'signingcert'); return doc.toxmlstring(); signxml(algorithmname, node, idattributename, certdevname, refchild) inserts the signature envelope before the specified child node. 2841apex reference guide crypto class signature public static void signxml(string algorithmname, dom.xmlnode node, string idattributename, string certdevname, dom.xmlnode refchild) parameters algorithmname type: string the rsa encryption algorithm name. valid names are rsa, rsa-sha1, rsa-sha256, rsa-sha384, rsa-sha512,ecdsa-sha256, ecdsa-sha384, and ecdsa-sha512. rsa-sha1 is an rsa signature (with an asymmetric key pair) of an sha1 hash. rsa-sha256 is an rsa signature of an sha256 hash. rsa-sha384 is an rsa signature of an sha384 hash. rsa-sha512 is an rsa signature of an sha512 hash. rsa is the same as rsa-sha1. ecdsa-sha256 is an ecdsa signature of an sha256 hash. ecdsa-sha384 is an ecdsa signature of an sha384 hash. ecdsa-sha512 is an ecdsa signature of an sha512 hash. node type: dom.xmlnode the xml node to sign and insert the signature into. idattributename type: string the full name (including the namespace) of the attribute on the node (xmlnode) to use as the reference id. if null, this method uses the id attribute on the node. if there is no id attribute, salesforce generates a new id and adds it to the node. certdevname type: string the unique name for a certificate stored in the salesforce org’s certificate and key management page to use for signing. to access the certificate and key management page from setup, enter certificate and key management in the quick find box, then select certificate and key management. refchild dom.xmlnode the xml node before which to insert the signature. if refchild is null, the signature is added at the end. return value type: void verify(string algorithmname, blob data, blob signature, blob publickey) verifies the digital signature for the blob data using the specified algorithm and the supplied public key. use this method to verify a blob signed by a digital signature created using a third-party application or the sign method. 2842apex reference guide crypto class signature public static blob verify(string algorithmname, blob data, blob signature, blob publickey) parameters algorithmname type: string the algorithm name. the valid values for algorithmname are rsa, rsa-sha1, rsa-sha256, rsa-sha384, rsa-sha512,ecdsa-sha256, ecdsa-sha384, and ecdsa-sha512. rsa-sha1 is an rsa signature (with an asymmetric key pair) of an sha1 hash. rsa-sha256 is an rsa signature of an sha256 hash. rsa-sha384 is an rsa signature of an sha384 hash. rsa-sha512 is an rsa signature of an sha512 hash. rsa is the same as rsa-sha1. ecdsa-sha256 is an ecdsa signature of an sha256 hash. ecdsa-sha384 is an ecdsa signature of an sha384 hash. ecdsa-sha512 is an ecdsa signature" "of an sha512 hash. data type: blob the data to sign. signature type: blob the rsa signature. publickey type: blob the value of publickey must be decoded using the encodingutilbase64decode method, and be in x.509 standard. return value type: blob example string algorithmname = 'rsa'; string privatekey = ''; string publickey = ''; blob privatekey = encodingutil.base64decode(privatekey); blob publickey = encodingutil.base64decode(publickey); blob input = blob.valueof('12345qwerty'); blob signature = crypto.sign(algorithmname, input, privatekey); boolean verified = crypto.verify(algorithmname, input, signature, publickey); 2843apex reference guide crypto class verify(string algorithmname, blob data, blob signature, string certdevname) verifies the digital signature for the blob data using the specified algorithm and the public key associated with the certdevname. use this method to verify a blob signed by a digital signature created using a third-party application or the sign method. signature public static blob verify(string algorithmname, blob data, blob signature, string certdevname) parameters algorithmname type: string the algorithm name. the valid values for algorithmname are rsa, rsa-sha1, rsa-sha256, rsa-sha384, rsa-sha512,ecdsa-sha256, ecdsa-sha384, and ecdsa-sha512. rsa-sha1 is an rsa signature (with an asymmetric key pair) of an sha1 hash. rsa-sha256 is an rsa signature of an sha256 hash. rsa-sha384 is an rsa signature of an sha384 hash. rsa-sha512 is an rsa signature of an sha512 hash. rsa is the same as rsa-sha1. ecdsa-sha256 is an ecdsa signature of an sha256 hash. ecdsa-sha384 is an ecdsa signature of an sha384 hash. ecdsa-sha512 is an ecdsa signature of an sha512 hash. data type: blob the data to sign. signature type: blob the rsa signature. certdevname type: string the unique name for a certificate stored in the salesforce organization’s certificate and key management page to use for signing. to access the certificate and key management page from setup, enter certificate and key management in the quick find box, then select certificate and key management. return value type: blob 2844apex reference guide crypto class example blob data = blob.valueof('12345qwerty'); blob signature = crypto.signwithcertificate('rsa-sha256', data, 'signingcert'); boolean verified = crypto.verify('rsa-sha512', data, signature, 'signingcert'); verifyhmac(string algorithmname, blob input, blob privatekey, blob mactoverify) verifies the hmac signature for blob data using the specified algorithm, input data, privatekey, and the mac. use this method to verify a blob signed by a digital signature created using a third-party application or the sign method. signature public static blob verifyhmac(string algorithmname, blob input, blob privatekey, blob mactoverify) parameters algorithmname type: string the valid values for algorithmname are: • hmacmd5 • hmacsha1 • hmacsha256 • hmacsha512 data type: blob the data to sign. privatekey type: blob the value of privatekey does not need to be in decoded form. the value cannot exceed 4 kb. hmactoverify type: blob the value of the mac must be verified against the provided privatekey, data, and algorithm. return value type: boolean example string salt = string.valueof(crypto.getrandominteger()); string key = 'key'; blob mac = crypto.generatemac('hmacsha256', blob.valueof(salt), blob.valueof(key)); boolean verified = crypto.verifyhmac('hmacsha256', blob.valueof(salt), blob.valueof(key), mac); 28" "45apex reference guide custom metadata type methods custom metadata type methods custom metadata types are customizable, deployable, packageable, and upgradeable application metadata. all custom metadata is exposed in the application cache, which allows access without repeated queries to the database. the metadata is then available for formula fields, validation rules, flows, apex, and soap api. all methods are static. usage custom metadata types methods are instance type methods and are called by and operate on a specific instance of a custom metadata type. custom metadata types example the following example uses the getall() method. the custom metadata type named games has a field called gametype__c. this example determines if the field value of the first record is equal to the string pc. list mcs = games__mdt.getall().values(); boolean textfield = null; if (mcs[0].gametype__c == 'pc') { textfield = true; } system.assertequals(textfield, true); in this section: getall() returns a map containing custom metadata records for the specific custom metadata type. the map keys are the record developernames and the map values are the record sobjects. getinstance(recordid) returns a single custom metadata type record sobject for a specified record id. getinstance(developername) returns a single custom metadata type record sobject for a specified developername field of the custom metadata type object. getinstance(qualifiedapiname) returns a single custom metadata type record sobject for a qualified api name. getall() returns a map containing custom metadata records for the specific custom metadata type. the map keys are the record developernames and the map values are the record sobjects. signature public map getall() return value type: map 2846apex reference guide custom metadata type methods usage if no records are defined for the type, this method returns an empty map. to iterate over the list of custom metadata type record sobjects, use getall().values(). only the first 255 characters are returned for any field in a custom metadata type record, so longer text fields get truncated. if you want all the field data from a custom metadata type record, use a soql query. example this sample returns a map of all the records for a custom metadata type named games__mdt. map mcs = games__mdt.getall(); getinstance(recordid) returns a single custom metadata type record sobject for a specified record id. signature public custommetadatatype__mdt getinstance(recordid) parameters recordid type: string return value type: custommetadatatype__mdt usage use this method to explicitly retrieve custom metadata type information at the user level. only the first 255 characters of any field in a custom metadata type record are returned. therefore, fields such as long text fields can be truncated. if you want all the field data from a custom metadata type record, use a soql query. example this sample returns a single record sobject for the custom metadata type named games_mdt with recordid specified as m00000000000001. games__mdt mc = games__mdt.getinstance('m00000000000001'); getinstance(developername) returns a single custom metadata type record sobject for a specified developername field of the custom metadata type object. signature public custommetadatatype__mdt getinstance(string developername) 2847apex reference guide custom metadata type methods parameters developername type: string return value type: custommetadatatype__mdt usage use this method to return a single custom metadata type record for the specified developername. the developername is the unique name of the custom metadata type object in the api. only the first 255 characters of any field in a custom metadata type record are returned. therefore, fields such as long text fields can be truncated. if you want all the field data from a custom metadata type record, use a soql query. example returns a single record sobject for the custom metadata type named games_mdt with developername specified as firstrecord. games__mdt mc = games__mdt.getinstance('firstrecord'); getinstance(qualifiedapiname) returns a single custom metadata type record sobject for a qualified api name. signature public custommetadatatype__mdt getinstance(string qualifiedapiname" ") parameters qualifiedapiname type: string return value type: custommetadatatype__mdt usage use this method to return a single custom metadata type record for the specified qualifiedapiname. the qualifiedapiname is a concatenation of the namespace prefix and developername, and has this format: namespaceprefix__developername. the developername is the unique name of the custom metadata type object in the api. only the first 255 characters of any field in a custom metadata type record are returned. therefore, fields such as long text fields can be truncated. if you want all the field data from a custom metadata type record, use a soql query. 2848apex reference guide custom settings methods example this sample returns a single record sobject for the custom metadata type named games_mdt with qualified api name specified as mynamespace__firstrecord. games__mdt mc = games__mdt.getinstance('mynamespace__firstrecord'); custom settings methods custom settings are similar to custom objects and enable application developers to create custom sets of data, as well as create and associate custom data for an organization, profile, or specific user. all custom settings data is exposed in the application cache, which enables efficient access without the cost of repeated queries to the database. this data is then available for formula fields, validation rules, flows, apex, and the soap api. usage custom settings methods are all instance methods, that is, they are called by and operate on a specific instance of a custom setting. there are two types of custom settings: hierarchy and list. there are two types of methods: methods that work with list custom settings, and methods that work with hierarchy custom settings. note: all custom settings data is exposed in the application cache, which enables efficient access without the cost of repeated queries to the database. however, querying custom settings data using standard object query language (soql) doesn't use the application cache and is similar to querying a custom object. to benefit from caching, use other methods for accessing custom settings data such as the apex custom settings methods. for more information on creating custom settings in the salesforce user interface, see “create custom settings” in the salesforce online help. custom setting examples the following example uses a list custom setting called games. the games setting has a field called gametype. this example determines if the value of the first data set is equal to the string pc. list mcs = games__c.getall().values(); boolean textfield = null; if (mcs[0].gametype__c == 'pc') { textfield = true; } system.assertequals(textfield, true); the following example uses a custom setting called foundation_countries. this example demonstrates that the getvalues and getinstance methods return identical values. foundation_countries__c mycs1 = foundation_countries__c.getvalues('united states'); string myccval = mycs1.country_code__c; foundation_countries__c mycs2 = foundation_countries__c.getinstance('united states'); string myccinst = mycs2.country_code__c; system.assertequals(myccinst, myccval); 2849apex reference guide custom settings methods hierarchy custom setting examples in the following example, the hierarchy custom setting gamessupport has a field called corporate_number. the code returns the value for the profile specified with pid. gamessupport__c mhc = gamessupport__c.getinstance(pid); string mphone = mhc.corporate_number__c; the example is identical if you choose to use the getvalues method. the following example shows how to use hierarchy custom settings methods. for getinstance, the example shows how field values that aren't set for a specific user or profile are returned from fields defined at the next lowest level in the hierarchy. the example also shows how to use getorgdefaults. finally, the example demonstrates how getvalues returns fields in the custom setting record only for the specific user or profile, and doesn't merge values from other levels of the hierarchy. instead, getvalues returns null for any fields that aren't set. this example uses a hierarchy custom setting called hierarchy. hierarchy has two fields: overrideme and dontoverrideme. in addition, a user named robert has a system administrator profile. the organization, profile, and user settings for this example are as follows: organization settings overrideme: hello dontoverrideme: world profile settings overrideme" ": goodbye dontoverrideme is not set. user settings overrideme: fluffy dontoverrideme is not set. the following example demonstrates the result of the getinstance method when robert calls it in his organization: hierarchy__c cs = hierarchy__c.getinstance(); system.assert(cs.overrideme__c == 'fluffy'); system.assert(cs.dontoverrideme__c == 'world'); if robert passes his user id specified by robertid to getinstance, the results are the same. the identical results are because the lowest level of data in the custom setting is specified at the user level. hierarchy__c cs = hierarchy__c.getinstance(robertid); system.assert(cs.overrideme__c == 'fluffy'); system.assert(cs.dontoverrideme__c == 'world'); if robert passes the system administrator profile id specified by sysadminid to getinstance, the result is different. the data specified for the profile is returned: hierarchy__c cs = hierarchy__c.getinstance(sysadminid); system.assert(cs.overrideme__c == 'goodbye'); system.assert(cs.dontoverrideme__c == 'world'); when robert tries to return the data set for the organization using getorgdefaults, the result is: hierarchy__c cs = hierarchy__c.getorgdefaults(); system.assert(cs.overrideme__c == 'hello'); system.assert(cs.dontoverrideme__c == 'world'); 2850apex reference guide custom settings methods by using the getvalues method, robert can get the hierarchy custom setting values specific to his user and profile settings. for example, if robert passes his user id robertid to getvalues, the result is: hierarchy__c cs = hierarchy__c.getvalues(robertid); system.assert(cs.overrideme__c == 'fluffy'); // note how this value is null, because you are returning // data specific for the user system.assert(cs.dontoverrideme__c == null); if robert passes his system administrator profile id sysadminid to getvalues, the result is: hierarchy__c cs = hierarchy__c.getvalues(sysadminid); system.assert(cs.overrideme__c == 'goodbye'); // note how this value is null, because you are returning // data specific for the profile system.assert(cs.dontoverrideme__c == null); country and state code custom settings example this example illustrates using two custom setting objects for storing related information, and a visualforce page to display the data in a set of related picklists. in the following example, country and state codes are stored in two different custom settings: foundation_countries and foundation_states. the foundation_countries custom setting is a list type custom setting and has a single field, country_code. the foundation_states custom setting is also a list type of custom setting and has the following fields: • country code • state code • state name 2851apex reference guide custom settings methods the visualforce page shows two picklists: one for country and one for state. 2852apex reference guide custom settings methods
country
state/province
the apex controller countrystatepicker finds the values" "entered into the custom settings, then returns them to the visualforce page. public with sharing class countrystatepicker { // variables to store country and state selected by user public string state { get; set; } public string country {get; set;} // generates country dropdown from country settings public list getcountriesselectlist() { list options = new list(); options.add(new selectoption('', '-- select one --')); // find all the countries in the custom setting map countries = foundation_countries__c.getall(); // sort them by name list countrynames = new list(); countrynames.addall(countries.keyset()); countrynames.sort(); // create the select options. for (string countryname : countrynames) { foundation_countries__c country = countries.get(countryname); options.add(new selectoption(country.country_code__c, country.name)); } return options; } // to generate the states picklist based on the country selected by user. public list getstatesselectlist() { list options = new list(); // find all the states we have in custom settings. map allstates = foundation_states__c.getall(); // filter states that belong to the selected country map states = new map(); for(foundation_states__c state : allstates.values()) { if (state.country_code__c == this.country) { states.put(state.name, state); 2853apex reference guide custom settings methods } } // sort the states based on their names list statenames = new list(); statenames.addall(states.keyset()); statenames.sort(); // generate the select options based on the final sorted list for (string statename : statenames) { foundation_states__c state = states.get(statename); options.add(new selectoption(state.state_code__c, state.state_name__c)); } // if no states are found, just say not required in the dropdown. if (options.size() > 0) { options.add(0, new selectoption('', '-- select one --')); } else { options.add(new selectoption('', 'not required')); } return options; } } in this section: list custom setting methods hierarchy custom setting methods see also: apex developer guide: custom settings list custom setting methods the following are instance methods for list custom settings. in this section: getall() returns a map of the data sets defined for the custom setting. getinstance(datasetname) returns the custom setting data set record for the specified data set name. this method returns the exact same object as getvalues(datasetname). getvalues(datasetname) returns the custom setting data set record for the specified data set name. this method returns the exact same object as getinstance(datasetname). 2854apex reference guide custom settings methods getall() returns a map of the data sets defined for the custom setting. signature public map getall() return value type: map usage if no data set is defined, this method returns an empty map. note: for apex saved using salesforce api version 20.0 or earlier, the data set names, which are the keys in the returned map, are converted to lower case. for apex saved using salesforce api version 21.0 and later, the case of the data set names in the returned map keys is not changed and the original case is preserved. getinstance(datasetname) returns the custom setting data set record for the specified data set name. this method returns the exact same object as getvalues(datasetname). signature public customsetting__c getinstance(string datasetname) parameters datasetname type: string return value type: customsetting__c usage if no data is defined for the specified data set, this method returns null. getvalues(datasetname) returns the custom setting data set record for the specified data set name." "this method returns the exact same object as getinstance(datasetname). signature public customsetting__c getvalues(string datasetname) 2855apex reference guide custom settings methods parameters datasetname type: string return value type: customsetting__c usage if no data is defined for the specified data set, this method returns null. hierarchy custom setting methods the following are instance methods for hierarchy custom settings. note: • in api version 41.0 and below, each method in an apex test class, including testsetup methods, are able to insert hierarchy custom setting values. this behavior is true even when the methods have the same setupownerid value as a hierarchy custom setting record inserted in a different test method. • in api version 42.0 and later, if a hierarchy custom setting is inserted in a testsetup method, inserting a hierarchy custom setting record with the same setupownerid in a test method throws a duplicate_value exception. in this section: getinstance() returns a custom setting data set record for the current user. the fields returned in the custom setting record are merged based on the lowest level fields that are defined in the hierarchy. getinstance(userid) returns the custom setting data set record for the specified user id. the lowest level custom setting record and fields are returned. use this when you want to explicitly retrieve data for the custom setting at the user level. getinstance(profileid) returns the custom setting data set record for the specified profile id. the lowest level custom setting record and fields are returned. use this when you want to explicitly retrieve data for the custom setting at the profile level. getorgdefaults() returns the custom setting data set record for the organization. getvalues(userid) returns the custom setting data set record for the specified user id. getvalues(profileid) returns the custom setting data set for the specified profile id. getinstance() returns a custom setting data set record for the current user. the fields returned in the custom setting record are merged based on the lowest level fields that are defined in the hierarchy. 2856apex reference guide custom settings methods signature public customsetting__c getinstance() return value type: customsetting__c usage if no custom setting data is defined for the user, this method returns a new custom setting object. the new custom setting object contains an id set to null and merged fields from higher in the hierarchy. you can add this new custom setting record for the user by using insert or upsert. if no custom setting data is defined in the hierarchy, the returned custom setting has empty fields, except for the setupownerid field which contains the user id. note: for apex saved using salesforce api version 21.0 or earlier, this method returns the custom setting data set record with fields merged from field values defined at the lowest hierarchy level, starting with the user. also, if no custom setting data is defined in the hierarchy, this method returns null. this method is equivalent to a method call to getinstance(user_id) for the current user. example • custom setting data set defined for the user: if you have a custom setting data set defined for the user “uriel jones,” for the profile “system administrator,” and for the organization as a whole, and the user running the code is uriel jones, this method returns the custom setting record defined for uriel jones. • merged fields: if you have a custom setting data set with fields a and b for the user “uriel jones” and for the profile “system administrator,” and field a is defined for uriel jones, field b is null but is defined for the system adminitrator profile, this method returns the custom setting record for uriel jones with field a for uriel jones and field b from the system administrator profile. • no custom setting data set record defined for the user: if the current user is “barbara mahonie,” who also shares the “system administrator” profile, but no data is defined for barbara as a user, this method returns a new custom setting record with the id set to null and with fields merged based on the fields defined in the lowest level in the hierarchy. getinstance(userid) returns the custom setting data set record for the specified user id. the lowest level custom setting record and fields are returned. use this when you want to explicitly retrieve data for the custom setting at the user level. signature public customsetting__c getinstance(id userid) parameters userid type: id return value type: customsetting__c 2857a" "pex reference guide custom settings methods usage if no custom setting data is defined for the user, this method returns a new custom setting object. the new custom setting object contains an id set to null and merged fields from higher in the hierarchy. you can add this new custom setting record for the user by using insert or upsert. if no custom setting data is defined in the hierarchy, the returned custom setting has empty fields, except for the setupownerid field which contains the user id. note: for apex saved using salesforce api version 21.0 or earlier, this method returns the custom setting data set record with fields merged from field values defined at the lowest hierarchy level, starting with the user. also, if no custom setting data is defined in the hierarchy, this method returns null. getinstance(profileid) returns the custom setting data set record for the specified profile id. the lowest level custom setting record and fields are returned. use this when you want to explicitly retrieve data for the custom setting at the profile level. signature public customsetting__c getinstance(id profileid) parameters profileid type: id return value type: customsetting__c usage if no custom setting data is defined for the profile, this method returns a new custom setting record. the new custom setting object contains an id set to null and with merged fields from your organization's default values. you can add this new custom setting for the profile by using insert or upsert. if no custom setting data is defined in the hierarchy, the returned custom setting has empty fields, except for the setupownerid field which contains the profile id. note: for apex saved using salesforceapi version 21.0 or earlier, this method returns the custom setting data set record with fields merged from field values defined at the lowest hierarchy level, starting with the profile. also, if no custom setting data is defined in the hierarchy, this method returns null. getorgdefaults() returns the custom setting data set record for the organization. signature public customsetting__c getorgdefaults() return value type: customsetting__c 2858apex reference guide custom settings methods usage if no custom setting data is defined for the organization, this method returns an empty custom setting object. note: for apex saved using salesforce api version 21.0 or earlier, this method returns null if no custom setting data is defined for the organization. getvalues(userid) returns the custom setting data set record for the specified user id. signature public customsetting__c getvalues(id userid) parameters userid type: id return value type: customsetting__c usage use this if you only want the subset of custom setting data that has been defined at the user level. for example, suppose you have a custom setting field that has been assigned a value of ""alpha"" at the organizational level, but has no value assigned at the user or profile level. using getvalues(userid) returns null for this custom setting field. getvalues(profileid) returns the custom setting data set for the specified profile id. signature public customsetting__c getvalues(id profileid) parameters profileid type: id return value type: customsetting__c usage use this if you only want the subset of custom setting data that has been defined at the profile level. for example, suppose you have a custom setting field that has been assigned a value of ""alpha"" at the organizational level, but has no value assigned at the user or profile level. using getvalues(profileid) returns null for this custom setting field. 2859apex reference guide database class database class contains methods for creating and manipulating data. namespace system usage some database methods also exist as dml statements. see also: apex dml operations database methods the following are methods for database. all methods are static. in this section: convertlead(leadtoconvert, allornone) converts a lead into an account and contact, as well as (optionally) an opportunity. convertlead(leadstoconvert, allornone) converts a list of leadconvert objects into accounts and contacts, as well as (optionally) opportunities. convertlead(leadtoconvert, dmloptions) converts a lead into an account and contact, as well as (optionally) an opportunity. convertlead(leadstoconvert, dmloptions) converts a list of leadconvert objects into accounts and contacts, as well as (optionally) opportunities. convertlead(leadtoconvert, allor" "none, accesslevel) converts a lead into an account and contact, as well as (optionally) an opportunity. convertlead(leadstoconvert, allornone, accesslevel) converts a list of leadconvert objects into accounts and contacts, as well as (optionally) opportunities. convertlead(leadtoconvert, dmloptions, accesslevel) converts a lead into an account and contact, as well as (optionally) an opportunity. convertlead(leadstoconvert, dmloptions, accesslevel) converts a list of leadconvert objects into accounts and contacts, as well as (optionally) opportunities. countquery(query) returns the number of records that a dynamic soql query would return when executed. countquery(query, accesslevel) returns the number of records that a dynamic soql query would return when executed. countquerywithbinds(query, bindmap, accesslevel) returns the number of records that a dynamic soql query would return when executed. bind variables in the query are resolved from the bindmap map parameter directly with the key, rather than from apex code variables. 2860apex reference guide database class delete(recordtodelete, allornone) deletes an existing sobject record, such as an individual account or contact, from your organization's data. delete(recordstodelete, allornone) deletes a list of existing sobject records, such as individual accounts or contacts, from your organization’s data. delete(recordid, allornone) deletes existing sobject records, such as individual accounts or contacts, from your organization’s data. delete(recordids, allornone) deletes a list of existing sobject records, such as individual accounts or contacts, from your organization’s data. delete(recordtodelete, allornone, accesslevel) deletes an existing sobject record, such as an individual account or contact, from your organization's data. delete(recordstodelete, allornone, accesslevel) deletes a list of existing sobject records, such as individual accounts or contacts, from your organization’s data. delete(recordid, allornone, accesslevel) deletes existing sobject records, such as individual accounts or contacts, from your organization’s data. delete(recordids, allornone, accesslevel) deletes a list of existing sobject records, such as individual accounts or contacts, from your organization’s data. deleteasync(sobjects, callback) initiates requests to delete the external data that corresponds to the specified external object records. the request is executed asynchronously, as a background operation, and is sent to the external system that's defined by the external object's associated external data source. allows referencing a callback class whose processdelete method is called for each record after deletion. deleteasync(sobject, callback) initiates a request to delete the external data that corresponds to the specified external object record. the request is executed asynchronously, as a background operation, and is sent to the external system that's defined by the external object's associated external data source. allows referencing a callback class whose processdelete method is called after deletion. deleteasync(sobjects) initiates requests to delete the external data that corresponds to the specified external object records. the requests are executed asynchronously, as background operations, and are sent to the external systems that are defined by the external objects' associated external data sources. deleteasync(sobject) initiates a request to delete the external data that corresponds to the specified external object record. the request is executed asynchronously, as a background operation, and is sent to the external system that's defined by the external object's associated external data source. deleteasync(sobjects, callback, accesslevel) initiates requests to delete the external data that corresponds to the specified external object records. the request is executed asynchronously, as a background operation, and is sent to the external system that's defined by the external object's associated external data source. allows referencing a callback class whose processdelete method is called for each record after deletion. deleteasync(sobject, callback, accesslevel) initiates a request to delete the external data that corresponds to the specified external object record. the request is executed asynchronously, as a background operation, and is sent to the external system that's defined by the external object's associated external data source. allows referencing a callback class whose processdelete method is called after deletion. 2861apex reference guide database class deleteasync(" "sobjects, accesslevel) initiates requests to delete the external data that corresponds to the specified external object records. the requests are executed asynchronously, as background operations, and are sent to the external systems that are defined by the external objects' associated external data sources. deleteasync(sobject, accesslevel) initiates a request to delete the external data that corresponds to the specified external object record. the request is executed asynchronously, as a background operation, and is sent to the external system that's defined by the external object's associated external data source. deleteimmediate(sobjects) initiates requests to delete the external data that corresponds to the specified external object records. the requests are executed synchronously and are sent to the external systems that are defined by the external objects' associated external data sources. if the apex transaction contains pending changes, the synchronous operations can't be completed and throw exceptions. deleteimmediate(sobject) initiates a request to delete the external data that corresponds to the specified external object record. the request is executed synchronously and is sent to the external system that's defined by the external object's associated external data source. if the apex transaction contains pending changes, the synchronous operation can't be completed and throws an exception. deleteimmediate(sobjects, accesslevel) initiates requests to delete the external data that corresponds to the specified external object records. the requests are executed synchronously and are sent to the external systems that are defined by the external objects' associated external data sources. if the apex transaction contains pending changes, the synchronous operations can't be completed and throw exceptions. deleteimmediate(sobject, accesslevel) initiates a request to delete the external data that corresponds to the specified external object record. the request is executed synchronously and is sent to the external system that's defined by the external object's associated external data source. if the apex transaction contains pending changes, the synchronous operation can't be completed and throws an exception. emptyrecyclebin(recordids) permanently deletes the specified records from the recycle bin. emptyrecyclebin(obj) permanently deletes the specified sobject from the recycle bin. emptyrecyclebin(listofsobjects) permanently deletes the specified sobjects from the recycle bin. executebatch(batchclassobject) submits a batch apex job for execution corresponding to the specified class. executebatch(batchclassobject, scope) submits a batch apex job for execution using the specified class and scope. getasyncdeleteresult(deleteresult) retrieves the status of an asynchronous delete operation that’s identified by a database.deleteresult object. getasyncdeleteresult(asynclocator) retrieves the result of an asynchronous delete operation based on the result’s unique identifier. getasynclocator(result) returns the asynclocator associated with the result of a specified asynchronous insert, update, or delete operation. getasyncsaveresult(saveresult) returns the status of an asynchronous insert or update operation that’s identified by a database.saveresult object. 2862apex reference guide database class getasyncsaveresult(asynclocator) returns the status of an asynchronous insert or update operation based on the unique identifier associated with each modification. getdeleted(sobjecttype, startdate, enddate) returns the list of individual records that have been deleted for an sobject type within the specified start and end dates and times and that are still in the recycle bin. getquerylocator(listofqueries) creates a querylocator object used in batch apex or visualforce. getquerylocator(query) creates a querylocator object used in batch apex or visualforce. getquerylocator(listofqueries, accesslevel) creates a querylocator object used in batch apex or visualforce. getquerylocator(query, accesslevel) creates a querylocator object used in batch apex or visualforce. getquerylocatorwithbinds(query, bindmap, accesslevel) creates a querylocator object used in batch apex or visualforce. bind variables in the query are resolved from the bindmap map parameter directly with the key, rather than from apex code variables. getupdated(sobjecttype, startdate, enddate) returns the list of individual records that have been updated for an sobject type within the specified start and end dates and times. insert(recordtoinsert, allornone)" "adds an sobject, such as an individual account or contact, to your organization's data. insert(recordstoinsert, allornone) adds one or more sobjects, such as individual accounts or contacts, to your organization’s data. insert(recordtoinsert, dmloptions) adds an sobject, such as an individual account or contact, to your organization's data. insert(recordstoinsert, dmloptions) adds one or more sobjects, such as individual accounts or contacts, to your organization's data. insert(recordtoinsert, allornone, accesslevel) adds an sobject, such as an individual account or contact, to your organization's data. insert(recordstoinsert, allornone, accesslevel) adds one or more sobjects, such as individual accounts or contacts, to your organization’s data. insert(recordtoinsert, dmloptions, accesslevel) adds an sobject, such as an individual account or contact, to your organization's data. insert(recordstoinsert, dmloptions, accesslevel) adds one or more sobjects, such as individual accounts or contacts, to your organization's data. insertasync(sobjects, callback) initiates requests to add external object data to the relevant external systems. the requests are executed asynchronously, as background operations, and are sent to the external systems that are defined by the external objects' associated external data sources. allows referencing a callback class whose processsave method is called for each record after the remote operations are completed. 2863apex reference guide database class insertasync(sobject, callback) initiates a request to add external object data to the relevant external system. the request is executed asynchronously, as a background operation, and is sent to the external system that's defined by the external object's associated external data source. allows referencing a callback class whose processsave method is called after the remote operation is completed. insertasync(sobjects) initiates requests to add external object data to the relevant external systems. the requests are executed asynchronously, as background operations, and are sent to the external systems that are defined by the external objects' associated external data sources. insertasync(sobject) initiates a request to add external object data to the relevant external system. the request is executed asynchronously, as a background operation, and is sent to the external system that's defined by the external object's associated external data source. insertasync(sobjects, callback, accesslevel) initiates requests to add external object data to the relevant external systems. the requests are executed asynchronously, as background operations, and are sent to the external systems that are defined by the external objects' associated external data sources. allows referencing a callback class whose processsave method is called for each record after the remote operations are completed. insertasync(sobject, callback, accesslevel) initiates a request to add external object data to the relevant external system. the request is executed asynchronously, as a background operation, and is sent to the external system that's defined by the external object's associated external data source. allows referencing a callback class whose processsave method is called after the remote operation is completed. insertasync(sobjects, accesslevel) initiates requests to add external object data to the relevant external systems. the requests are executed asynchronously, as background operations, and are sent to the external systems that are defined by the external objects' associated external data sources. insertasync(sobject, accesslevel) initiates a request to add external object data to the relevant external system. the request is executed asynchronously, as a background operation, and is sent to the external system that's defined by the external object's associated external data source. insertimmediate(sobjects) initiates requests to add external object data to the relevant external systems. the requests are executed synchronously and are sent to the external systems that are defined by the external objects' associated external data sources. if the apex transaction contains pending changes, the synchronous operations can't be completed and throw exceptions. insertimmediate(sobject) initiates a request to add external object data to the relevant external system. the request is executed synchronously and is sent to the external system that's defined by the external object's associated external data source. if the apex transaction contains pending changes, the synchronous operation can't be completed and throws an exception. insertimmediate(sobjects, accesslevel) initiates requests to add external object data" "to the relevant external systems. the requests are executed synchronously and are sent to the external systems that are defined by the external objects' associated external data sources. if the apex transaction contains pending changes, the synchronous operations can't be completed and throw exceptions. insertimmediate(sobject, accesslevel) initiates a request to add external object data to the relevant external system. the request is executed synchronously and is sent to the external system that's defined by the external object's associated external data source. if the apex transaction contains pending changes, the synchronous operation can't be completed and throws an exception. merge(masterrecord, duplicateid) merges the specified duplicate record into the master sobject record of the same type, deleting the duplicate, and reparenting any related records. merges only accounts, contacts, or leads. 2864apex reference guide database class merge(masterrecord, duplicaterecord) merges the specified duplicate sobject record into the master sobject of the same type, deleting the duplicate, and reparenting any related records. merge(masterrecord, duplicateids) merges up to two records of the same sobject type into the master sobject record, deleting the others, and reparenting any related records. merge(masterrecord, duplicaterecords) merges up to two records of the same object type into the master sobject record, deleting the others, and reparenting any related records. merge(masterrecord, duplicateid, allornone) merges the specified duplicate record into the master sobject record of the same type, optionally returning errors, if any, deleting the duplicate, and reparenting any related records. merges only accounts, contacts, or leads. merge(masterrecord, duplicaterecord, allornone) merges the specified duplicate sobject record into the master sobject of the same type, optionally returning errors, if any, deleting the duplicate, and reparenting any related records. merge(masterrecord, duplicateids, allornone) merges up to two records of the same sobject type into the master sobject record, optionally returning errors, if any, deleting the duplicates, and reparenting any related records. merge(masterrecord, duplicaterecords, allornone) merges up to two records of the same object type into the master sobject record, optionally returning errors, if any, deleting the duplicates, and reparenting any related records. merge(masterrecord, duplicateid, accesslevel) merges the specified duplicate record into the master sobject record of the same type, deleting the duplicate, and reparenting any related records. merges only accounts, contacts, or leads. merge(masterrecord, duplicaterecord, accesslevel) merges the specified duplicate sobject record into the master sobject of the same type, deleting the duplicate, and reparenting any related records. merge(masterrecord, duplicateids, accesslevel) merges up to two records of the same sobject type into the master sobject record, deleting the others, and reparenting any related records. merge(masterrecord, duplicaterecords, accesslevel) merges up to two records of the same object type into the master sobject record, deleting the others, and reparenting any related records. merge(masterrecord, duplicateid, allornone, accesslevel) merges the specified duplicate record into the master sobject record of the same type, optionally returning errors, if any, deleting the duplicate, and reparenting any related records. merges only accounts, contacts, or leads. merge(masterrecord, duplicaterecord, allornone, accesslevel) merges the specified duplicate sobject record into the master sobject of the same type, optionally returning errors, if any, deleting the duplicate, and reparenting any related records. merge(masterrecord, duplicateids, allornone, accesslevel) merges up to two records of the same sobject type into the master sobject record, optionally returning errors, if any, deleting the duplicates, and reparenting any related records. 2865apex reference guide database class merge(masterrecord, duplicaterecords, allornone, accesslevel) merges up to two records of the same object type into the master sobject record, optionally returning errors, if any, deleting the duplicates, and reparenting any related records. query(querystring) creates a dynamic soql query at runtime. query(querystring, accesslevel) creates" "a dynamic soql query at runtime. querywithbinds(querystring, bindmap, accesslevel) creates a dynamic soql query at runtime. bind variables in the query are resolved from the bindmap map parameter directly with the key, rather than from apex code variables. rollback(databasesavepoint) restores the database to the state specified by the savepoint variable. any emails submitted since the last savepoint are also rolled back and not sent. setsavepoint() returns a savepoint variable that can be stored as a local variable, then used with the rollback method to restore the database to that point. undelete(recordtoundelete, allornone) restores an existing sobject record, such as an individual account or contact, from your organization's recycle bin. undelete(recordstoundelete, allornone) restores one or more existing sobject records, such as individual accounts or contacts, from your organization’s recycle bin. undelete(recordid, allornone) restores an existing sobject record, such as an individual account or contact, from your organization's recycle bin. undelete(recordids, allornone) restores one or more existing sobject records, such as individual accounts or contacts, from your organization’s recycle bin. undelete(recordtoundelete, allornone, accesslevel) restores an existing sobject record, such as an individual account or contact, from your organization's recycle bin. undelete(recordstoundelete, allornone, accesslevel) restores one or more existing sobject records, such as individual accounts or contacts, from your organization’s recycle bin. undelete(recordid, allornone, accesslevel) restores an existing sobject record, such as an individual account or contact, from your organization's recycle bin. undelete(recordids, allornone, accesslevel) restores one or more existing sobject records, such as individual accounts or contacts, from your organization’s recycle bin. update(recordtoupdate, allornone) modifies an existing sobject record, such as an individual account or contact, in your organization's data. update(recordstoupdate, allornone) modifies one or more existing sobject records, such as individual accounts or contacts, in your organization’s data. update(recordtoupdate, dmloptions) modifies an existing sobject record, such as an individual account or contact, in your organization's data. update(recordstoupdate, dmloptions) modifies one or more existing sobject records, such as individual accounts or contacts, in your organization’s data. 2866apex reference guide database class update(recordtoupdate, allornone, accesslevel) modifies an existing sobject record, such as an individual account or contact, in your organization's data. update(recordstoupdate, allornone, accesslevel) modifies one or more existing sobject records, such as individual accounts or contacts, in your organization’s data. update(recordtoupdate, dmloptions, accesslevel) modifies an existing sobject record, such as an individual account or contact, in your organization's data. update(recordstoupdate, dmloptions, accesslevel) modifies one or more existing sobject records, such as individual accounts or contacts, in your organization’s data. upsert(recordtoupsert, externalidfield, allornone) creates a new sobject record or updates an existing sobject record within a single statement, using a specified field to determine the presence of existing objects, or the id field if no field is specified. upsert(recordstoupsert, externalidfield, allornone) creates new sobject records or updates existing sobject records within a single statement, using a specified field to determine the presence of existing objects, or the id field if no field is specified. upsert(recordtoupsert, externalidfield, allornone, accesslevel) creates a new sobject record or updates an existing sobject record within a single statement, using a specified field to determine the presence of existing objects, or the id field if no field is specified. upsert(recordstoupsert, externalidfield, allornone, accesslevel) creates new sobject records or updates existing sobject records within a single statement, using a specified field to determine the presence of existing objects, or the id field if" "no field is specified. updateasync(sobjects, callback) initiates requests to update external object data on the relevant external systems. the requests are executed asynchronously, as background operations, and are sent to the external systems that are defined by the external objects' associated external data sources. allows referencing a callback class whose processsave method is called for each record after the remote operations are completed. updateasync(sobject, callback) initiates a request to update external object data on the relevant external system. the request is executed asynchronously, as a background operation, and is sent to the external system that's defined by the external object's associated external data source. allows referencing a callback class whose processsave method is called after the remote operation is completed. updateasync(sobjects) initiates requests to update external object data on the relevant external systems. the requests are executed asynchronously, as background operations, and are sent to the external systems that are defined by the external objects' associated external data sources. updateasync(sobject) initiates a request to update external object data on the relevant external system. the request is executed asynchronously, as a background operation, and is sent to the external system that's defined by the external object's associated external data source. updateasync(sobjects, callback, accesslevel) initiates requests to update external object data on the relevant external systems. the requests are executed asynchronously, as background operations, and are sent to the external systems that are defined by the external objects' associated external data sources. allows referencing a callback class whose processsave method is called for each record after the remote operations are completed. 2867apex reference guide database class updateasync(sobject, callback, accesslevel) initiates a request to update external object data on the relevant external system. the request is executed asynchronously, as a background operation, and is sent to the external system that's defined by the external object's associated external data source. allows referencing a callback class whose processsave method is called after the remote operation is completed. updateasync(sobjects, accesslevel) initiates requests to update external object data on the relevant external systems. the requests are executed asynchronously, as background operations, and are sent to the external systems that are defined by the external objects' associated external data sources. updateasync(sobject, accesslevel) initiates a request to update external object data on the relevant external system. the request is executed asynchronously, as a background operation, and is sent to the external system that's defined by the external object's associated external data source. updateimmediate(sobjects) initiates requests to update external object data on the relevant external systems. the requests are executed synchronously and are sent to the external systems that are defined by the external objects' associated external data sources. if the apex transaction contains pending changes, the synchronous operations can't be completed and throw exceptions. updateimmediate(sobject) initiates a request to update external object data on the relevant external system. the request is executed synchronously and is sent to the external system that's defined by the external object's associated external data source. if the apex transaction contains pending changes, the synchronous operation can't be completed and throws an exception. updateimmediate(sobjects, accesslevel) initiates requests to update external object data on the relevant external systems. the requests are executed synchronously and are sent to the external systems that are defined by the external objects' associated external data sources. if the apex transaction contains pending changes, the synchronous operations can't be completed and throw exceptions. updateimmediate(sobject, accesslevel) initiates a request to update external object data on the relevant external system. the request is executed synchronously and is sent to the external system that's defined by the external object's associated external data source. if the apex transaction contains pending changes, the synchronous operation can't be completed and throws an exception. convertlead(leadtoconvert, allornone) converts a lead into an account and contact, as well as (optionally) an opportunity. signature public static database.leadconvertresult convertlead(database.leadconvert leadtoconvert, boolean allornone) parameters leadtoconvert type: database.leadconvert allornone type: boolean the optional allornone parameter specifies whether the operation allows partial success. if you specify false for this parameter and a record fails, the remainder of the dml operation can still succeed. this" "method returns a result object that can be used to verify which records succeeded, which failed, and why. if the parameter is not set or is set true, an exception is thrown if the method is not successful. 2868apex reference guide database class return value type: database.leadconvertresult usage the convertlead method accepts up to 100 leadconvert objects. each executed convertlead method counts against the governor limit for dml statements. convertlead(leadstoconvert, allornone) converts a list of leadconvert objects into accounts and contacts, as well as (optionally) opportunities. signature public static database.leadconvertresult[] convertlead(database.leadconvert[] leadstoconvert, boolean allornone) parameters leadstoconvert type: database.leadconvert[] allornone type: boolean the optional allornone parameter specifies whether the operation allows partial success. if you specify false for this parameter and a record fails, the remainder of the dml operation can still succeed. this method returns a result object that can be used to verify which records succeeded, which failed, and why. if the parameter is not set or is set true, an exception is thrown if the method is not successful. return value type: database.leadconvertresult[] usage the convertlead method accepts up to 100 leadconvert objects. each executed convertlead method counts against the governor limit for dml statements. convertlead(leadtoconvert, dmloptions) converts a lead into an account and contact, as well as (optionally) an opportunity. signature public static database.leadconvertresult convertlead(database.leadconvert leadtoconvert, database.dmloptions dmloptions) 2869apex reference guide database class parameters leadtoconvert type: database.leadconvert dmloptions type: database.dmloptions the optional dmloptions parameter specifies additional data for the transaction, such as assignment rule information or rollback behavior when errors occur during record insertions. return value type: database.leadconvertresult usage the convertlead method accepts up to 100 leadconvert objects. each executed convertlead method counts against the governor limit for dml statements. convertlead(leadstoconvert, dmloptions) converts a list of leadconvert objects into accounts and contacts, as well as (optionally) opportunities. signature public static list convertlead(list leadstoconvert, database.dmloptions dmloptions) parameters leadstoconvert type: list dmloptions type: database.dmloptions the optional dmloptions parameter specifies additional data for the transaction, such as assignment rule information or rollback behavior when errors occur during record insertions. return value type: list usage the convertlead method accepts up to 100 leadconvert objects. each executed convertlead method counts against the governor limit for dml statements. convertlead(leadtoconvert, allornone, accesslevel) converts a lead into an account and contact, as well as (optionally) an opportunity. 2870apex reference guide database class signature public static database.leadconvertresult convertlead(database.leadconvert leadtoconvert, boolean allornone, system.accesslevel accesslevel) parameters leadtoconvert type: database.leadconvert allornone type: boolean the optional allornone parameter specifies whether the operation allows partial success. if you specify false for this parameter and a record fails, the remainder of the dml operation can still succeed. this method returns a result object that can be used to verify which records succeeded, which failed, and why. if the parameter is not set or is set true, an exception is thrown if the method is not successful. accesslevel type: system.accesslevel (optional) the accesslevel parameter specifies whether the method runs in system mode (accesslevel.system_mode) or user mode (accesslevel.user_mode). in system mode, the object and field-level permissions of the current user are ignored, and the record sharing rules are controlled by the class sharing keywords. in user mode, the object permissions, field-level security, and sharing rules of the current user are enforced. system mode is the default. return value type: database.leadconvertresult usage the convertlead" "method accepts up to 100 leadconvert objects. each executed convertlead method counts against the governor limit for dml statements. convertlead(leadstoconvert, allornone, accesslevel) converts a list of leadconvert objects into accounts and contacts, as well as (optionally) opportunities. signature public static list convertlead(list leadstoconvert, boolean allornone, system.accesslevel accesslevel) parameters leadstoconvert type: list allornone type: boolean the optional allornone parameter specifies whether the operation allows partial success. if you specify false for this parameter and a record fails, the remainder of the dml operation can still succeed. this method returns a result object that can be used to 2871apex reference guide database class verify which records succeeded, which failed, and why. if the parameter is not set or is set true, an exception is thrown if the method is not successful. accesslevel type: system.accesslevel (optional) the accesslevel parameter specifies whether the method runs in system mode (accesslevel.system_mode) or user mode (accesslevel.user_mode). in system mode, the object and field-level permissions of the current user are ignored, and the record sharing rules are controlled by the class sharing keywords. in user mode, the object permissions, field-level security, and sharing rules of the current user are enforced. system mode is the default. return value type: list usage the convertlead method accepts up to 100 leadconvert objects. each executed convertlead method counts against the governor limit for dml statements. convertlead(leadtoconvert, dmloptions, accesslevel) converts a lead into an account and contact, as well as (optionally) an opportunity. signature public static database.leadconvertresult convertlead(database.leadconvert leadtoconvert, database.dmloptions dmloptions, system.accesslevel accesslevel) parameters leadtoconvert type: database.leadconvert dmloptions type: database.dmloptions the optional dmloptions parameter specifies additional data for the transaction, such as assignment rule information or rollback behavior when errors occur during record insertions. accesslevel type: system.accesslevel (optional) the accesslevel parameter specifies whether the method runs in system mode (accesslevel.system_mode) or user mode (accesslevel.user_mode). in system mode, the object and field-level permissions of the current user are ignored, and the record sharing rules are controlled by the class sharing keywords. in user mode, the object permissions, field-level security, and sharing rules of the current user are enforced. system mode is the default. return value type: database.leadconvertresult 2872apex reference guide database class usage the convertlead method accepts up to 100 leadconvert objects. each executed convertlead method counts against the governor limit for dml statements. convertlead(leadstoconvert, dmloptions, accesslevel) converts a list of leadconvert objects into accounts and contacts, as well as (optionally) opportunities. signature public static list convertlead(list leadstoconvert, database.dmloptions dmloptions, system.accesslevel accesslevel) parameters leadstoconvert type: list dmloptions type: database.dmloptions the optional dmloptions parameter specifies additional data for the transaction, such as assignment rule information or rollback behavior when errors occur during record insertions. accesslevel type: system.accesslevel (optional) the accesslevel parameter specifies whether the method runs in system mode (accesslevel.system_mode) or user mode (accesslevel.user_mode). in system mode, the object and field-level permissions of the current user are ignored, and the record sharing rules are controlled by the class sharing keywords. in user mode, the object permissions, field-level security, and sharing rules of the current user are enforced. system mode is the default. return value type: list usage the convertlead method accepts up to 100 leadconvert objects. each executed convertlead method counts against the governor limit for dml statements. countquery(query) returns the number of records that a dynamic soql query would" "return when executed. signature public static integer countquery(string query) 2873apex reference guide database class parameters query type: string return value type: integer usage for more information, see dynamic soql. each executed countquery method counts against the governor limit for soql queries. example string querystring = 'select count() from account'; integer i = database.countquery(querystring); countquery(query, accesslevel) returns the number of records that a dynamic soql query would return when executed. signature public static integer countquery(string query, system.accesslevel accesslevel) parameters query type: string accesslevel type: system.accesslevel (optional) the accesslevel parameter specifies whether the method runs in system mode (accesslevel.system_mode) or user mode (accesslevel.user_mode). in system mode, the object and field-level permissions of the current user are ignored, and the record sharing rules are controlled by the class sharing keywords. in user mode, the object permissions, field-level security, and sharing rules of the current user are enforced. system mode is the default. return value type: integer usage for more information, see dynamic soql. each executed countquery method counts against the governor limit for soql queries. 2874apex reference guide database class countquerywithbinds(query, bindmap, accesslevel) returns the number of records that a dynamic soql query would return when executed. bind variables in the query are resolved from the bindmap map parameter directly with the key, rather than from apex code variables. signature public static integer countquerywithbinds(string query, map bindmap, system.accesslevel accesslevel) parameters query type: string soql query that includes apex bind variables preceded by a colon. all bind variables must have a key in the bindmap map. bindmap type: map a map that contains keys for each bind variable specified in the soql querystring and its value. the keys can’t be null or duplicates, and the values can’t be null or empty strings. accesslevel type: system.accesslevel the accesslevel parameter specifies whether the method runs in system mode (accesslevel.system_mode) or user mode (accesslevel.user_mode). in system mode, the object and field-level permissions of the current user are ignored, and the record sharing rules are controlled by the class sharing keywords. in user mode, the object permissions, field-level security, and sharing rules of the current user are enforced. return value type: integer usage for more information, see dynamic soql. each executed countquerywithbinds method counts against the governor limit for soql queries. example in this example, the soql query uses a bind variable for an account name. its value (acme inc.) is passed in to the method using the namebind map. the accountname variable isn't (and doesn’t have to be) in scope when the query is executed within the method. public static integer simplebindingsoqlquery(map bindparams) { string querystring = 'select count() ' + 'from account ' + 'where name = :name'; return database.countquerywithbinds( querystring, bindparams, 2875apex reference guide database class accesslevel.user_mode ); } string accountname = 'acme inc.'; map namebind = new map{'name' => accountname}; integer acctcount = simplebindingsoqlquery(namebind); system.debug(acctcount); delete(recordtodelete, allornone) deletes an existing sobject record, such as an individual account or contact, from your organization's data. signature public static database.deleteresult delete(sobject recordtodelete, boolean allornone) parameters recordtodelete type: sobject allornone type: boolean the optional allornone parameter specifies whether the operation allows partial success. if you specify false for this parameter and a record fails, the remainder of the dml operation can still succeed. this method returns a result object that can be used to verify which records succeeded, which failed, and why. if the parameter is not set or is set true, an exception is thrown if the method is not successful. return value type: database.deleteresult usage delete is analogous" "to the delete() statement in the soap api. each executed delete method counts against the governor limit for dml statements. delete(recordstodelete, allornone) deletes a list of existing sobject records, such as individual accounts or contacts, from your organization’s data. signature public static database.deleteresult[] delete(sobject[] recordstodelete, boolean allornone) parameters recordstodelete type: sobject[] 2876apex reference guide database class allornone type: boolean the optional allornone parameter specifies whether the operation allows partial success. if you specify false for this parameter and a record fails, the remainder of the dml operation can still succeed. this method returns a result object that can be used to verify which records succeeded, which failed, and why. if the parameter is not set or is set true, an exception is thrown if the method is not successful. return value type: database.deleteresult[] usage delete is analogous to the delete() statement in the soap api. each executed delete method counts against the governor limit for dml statements. example the following example deletes an account named 'dotcom': account[] doomedaccts = [select id, name from account where name = 'dotcom']; database.deleteresult[] dr_dels = database.delete(doomedaccts); delete(recordid, allornone) deletes existing sobject records, such as individual accounts or contacts, from your organization’s data. signature public static database.deleteresult delete(id recordid, boolean allornone) parameters recordid type: id allornone type: boolean the optional allornone parameter specifies whether the operation allows partial success. if you specify false for this parameter and a record fails, the remainder of the dml operation can still succeed. this method returns a result object that can be used to verify which records succeeded, which failed, and why. if the parameter is not set or is set true, an exception is thrown if the method is not successful. return value type: database.deleteresult usage delete is analogous to the delete() statement in the soap api. 2877apex reference guide database class each executed delete method counts against the governor limit for dml statements. delete(recordids, allornone) deletes a list of existing sobject records, such as individual accounts or contacts, from your organization’s data. signature public static database.deleteresult[] delete(id[] recordids, boolean allornone) parameters recordids type: id[] allornone type: boolean the optional allornone parameter specifies whether the operation allows partial success. if you specify false for this parameter and a record fails, the remainder of the dml operation can still succeed. this method returns a result object that can be used to verify which records succeeded, which failed, and why. if the parameter is not set or is set true, an exception is thrown if the method is not successful. return value type: database.deleteresult[] usage delete is analogous to the delete() statement in the soap api. each executed delete method counts against the governor limit for dml statements. delete(recordtodelete, allornone, accesslevel) deletes an existing sobject record, such as an individual account or contact, from your organization's data. signature public static database.deleteresult delete(sobject recordtodelete, boolean allornone, system.accesslevel accesslevel) parameters recordtodelete type: sobject allornone type: boolean the optional allornone parameter specifies whether the operation allows partial success. if you specify false for this parameter and a record fails, the remainder of the dml operation can still succeed. this method returns a result object that can be used to verify which records succeeded, which failed, and why. if the parameter is not set or is set true, an exception is thrown if the method is not successful. 2878apex reference guide database class accesslevel type: system.accesslevel (optional) the accesslevel parameter specifies whether the method runs in system mode (accesslevel.system_mode) or user mode (accesslevel.user_mode). in system mode, the object and field-level permissions of the current user are ignored, and the record sharing rules are controlled by the class sharing keywords. in user mode, the object permissions, field-level security, and sharing rules of the current user are enforced. system mode is the default. return value type: database" ".deleteresult usage delete is analogous to the delete() statement in the soap api. each executed delete method counts against the governor limit for dml statements. delete(recordstodelete, allornone, accesslevel) deletes a list of existing sobject records, such as individual accounts or contacts, from your organization’s data. signature public static list delete(list recordstodelete, boolean allornone, system.accesslevel accesslevel) parameters recordstodelete type: list allornone type: boolean the optional allornone parameter specifies whether the operation allows partial success. if you specify false for this parameter and a record fails, the remainder of the dml operation can still succeed. this method returns a result object that can be used to verify which records succeeded, which failed, and why. if the parameter is not set or is set true, an exception is thrown if the method is not successful. accesslevel type: system.accesslevel (optional) the accesslevel parameter specifies whether the method runs in system mode (accesslevel.system_mode) or user mode (accesslevel.user_mode). in system mode, the object and field-level permissions of the current user are ignored, and the record sharing rules are controlled by the class sharing keywords. in user mode, the object permissions, field-level security, and sharing rules of the current user are enforced. system mode is the default. return value type: list 2879apex reference guide database class usage delete is analogous to the delete() statement in the soap api. each executed delete method counts against the governor limit for dml statements. delete(recordid, allornone, accesslevel) deletes existing sobject records, such as individual accounts or contacts, from your organization’s data. signature public static database.deleteresult delete(id recordid, boolean allornone, system.accesslevel accesslevel) parameters recordid type: id allornone type: boolean the optional allornone parameter specifies whether the operation allows partial success. if you specify false for this parameter and a record fails, the remainder of the dml operation can still succeed. this method returns a result object that can be used to verify which records succeeded, which failed, and why. if the parameter is not set or is set true, an exception is thrown if the method is not successful. accesslevel type: system.accesslevel (optional) the accesslevel parameter specifies whether the method runs in system mode (accesslevel.system_mode) or user mode (accesslevel.user_mode). in system mode, the object and field-level permissions of the current user are ignored, and the record sharing rules are controlled by the class sharing keywords. in user mode, the object permissions, field-level security, and sharing rules of the current user are enforced. system mode is the default. return value type: database.deleteresult usage delete is analogous to the delete() statement in the soap api. each executed delete method counts against the governor limit for dml statements. delete(recordids, allornone, accesslevel) deletes a list of existing sobject records, such as individual accounts or contacts, from your organization’s data. signature public static list delete(list recordids, boolean allornone, system.accesslevel accesslevel) 2880apex reference guide database class parameters recordids type: list allornone type: boolean the optional allornone parameter specifies whether the operation allows partial success. if you specify false for this parameter and a record fails, the remainder of the dml operation can still succeed. this method returns a result object that can be used to verify which records succeeded, which failed, and why. if the parameter is not set or is set true, an exception is thrown if the method is not successful. accesslevel type: system.accesslevel (optional) the accesslevel parameter specifies whether the method runs in system mode (accesslevel.system_mode) or user mode (accesslevel.user_mode). in system mode, the object and field-level permissions of the current user are ignored, and the record sharing rules are controlled by the class sharing keywords. in user mode, the object permissions, field-level security, and sharing rules of the current user are enforced. system mode is the default. return value type: list usage delete is analogous" "to the delete() statement in the soap api. each executed delete method counts against the governor limit for dml statements. deleteasync(sobjects, callback) initiates requests to delete the external data that corresponds to the specified external object records. the request is executed asynchronously, as a background operation, and is sent to the external system that's defined by the external object's associated external data source. allows referencing a callback class whose processdelete method is called for each record after deletion. signature public static list deleteasync(list sobjects, datasource.asyncdeletecallback callback) parameters sobjects type: list list of external object records to delete. callback type: datasource.asyncdeletecallback the callback that contains the state in the originating context and an action (the processdelete method) that is executed after the insert operation is completed. use the action callback to update org data according to the operation’s results. the callback object must extend datasource.asyncdeletecallback. 2881apex reference guide database class return value type: list status results for the delete operation. each result corresponds to a record processed by this asynchronous operation and is associated with a unique identifier (asynclocator). the asynclocator value is included in the errors array of the result. you can retrieve this identifier with database.getasynclocator(). retrieve the final result with database.getasyncdeleteresult(). deleteasync(sobject, callback) initiates a request to delete the external data that corresponds to the specified external object record. the request is executed asynchronously, as a background operation, and is sent to the external system that's defined by the external object's associated external data source. allows referencing a callback class whose processdelete method is called after deletion. signature public static database.deleteresult deleteasync(sobject sobject, datasource.asyncdeletecallback callback) parameters sobject type: sobject the external object record to delete. callback type: datasource.asyncdeletecallback the callback that contains the state in the originating context and an action (the processdelete method) that is executed after the insert operation is completed. use the action callback to update org data according to the operation’s results. the callback object must extend datasource.asyncdeletecallback. return value type: database.deleteresult status result for the delete operation. the result corresponds to the record processed by this asynchronous operation and is associated with a unique identifier (asynclocator). the asynclocator value is included in the errors array of the result. you can retrieve this identifier with database.getasynclocator(). retrieve the final result with database.getasyncdeleteresult(). deleteasync(sobjects) initiates requests to delete the external data that corresponds to the specified external object records. the requests are executed asynchronously, as background operations, and are sent to the external systems that are defined by the external objects' associated external data sources. signature public static list deleteasync(list sobjects) 2882" "apex reference guide database class parameters sobjects type: list list of external object records to delete. return value type: list status results for the delete operation. each result corresponds to a record processed by this asynchronous operation and is associated with a unique identifier (asynclocator). the asynclocator value is included in the errors array of the result. you can retrieve this identifier with database.getasynclocator(). retrieve the final result with database.getasyncdeleteresult(). deleteasync(sobject) initiates a request to delete the external data that corresponds to the specified external object record. the request is executed asynchronously, as a background operation, and is sent to the external system that's defined by the external object's associated external data source. signature public static database.deleteresult deleteasync(sobject sobject) parameters sobject type: sobject the external object record to delete. return value type: database.deleteresult status result for the delete operation. the result corresponds to the record processed by this asynchronous operation and is associated with a unique identifier (asynclocator). the asynclocator value is included in the errors array of the result. you can retrieve this identifier with database.getasynclocator(). retrieve the final result with database.getasyncdeleteresult(). deleteasync(sobjects, callback, accesslevel) initiates requests to delete the external data that corresponds to the specified external object records. the request is executed asynchronously, as a background operation, and is sent to the external system that's defined by the external object's associated external data source. allows referencing a callback class whose processdelete method is called for each record after deletion. signature public static list deleteasync(list sobjects, datasource.asyncdeletecallback callback, system.accesslevel accesslevel) 2883apex reference guide database class parameters sobjects type: list list of external object records to delete. callback type: datasource.asyncdeletecallback the callback that contains the state in the originating context and an action (the processdelete method) that is executed after the insert operation is completed. the execution is in system mode regardless of the accesslevel parameter. use the action callback to update org data according to the operation’s results. the callback object must extend datasource.asyncdeletecallback. accesslevel type: system.accesslevel (optional) the accesslevel parameter specifies whether the method runs in system mode (accesslevel.system_mode) or user mode (accesslevel.user_mode). in system mode, the object and field-level permissions of the current user are ignored, and the record sharing rules are controlled by the class sharing keywords. in user mode, the object permissions, field-level security, and sharing rules of the current user are enforced. system mode is the default. return value type: list status results for the delete operation. each result corresponds to a record processed by this asynchronous operation and is associated with a unique identifier (asynclocator). the asynclocator value is included in the errors array of the result. you can retrieve this identifier with database.getasynclocator(). retrieve the final result with database.getasyncdeleteresult(). deleteasync(sobject, callback, accesslevel) initiates a request to delete the external data that corresponds to the specified external object record. the request is executed asynchronously, as a background operation, and is sent to the external system that's defined by the external object's associated external data source. allows referencing a callback class whose processdelete method is called after deletion. signature public static database.deleteresult deleteasync(sobject sobject, datasource.asyncdeletecallback callback, system.accesslevel accesslevel) parameters sobject type: sobject the external object record to delete. callback type: datasource.asyncdeletecallback the callback that contains the state in the originating context and an action (the processdelete method) that is executed after the insert operation is completed. the execution is in system mode regardless of the accesslevel parameter. use the action callback to update org data according to the operation’s results. the callback object must extend datasource.asyncdeletecallback. 2884apex reference guide database class accesslevel type: system.accesslevel (optional) the accesslevel parameter specifies whether the method runs in system mode (accesslevel.system_mode) or user mode (accesslevel.user_mode). in" "system mode, the object and field-level permissions of the current user are ignored, and the record sharing rules are controlled by the class sharing keywords. in user mode, the object permissions, field-level security, and sharing rules of the current user are enforced. system mode is the default. return value type: database.deleteresult status result for the delete operation. the result corresponds to the record processed by this asynchronous operation and is associated with a unique identifier (asynclocator). the asynclocator value is included in the errors array of the result. you can retrieve this identifier with database.getasynclocator(). retrieve the final result with database.getasyncdeleteresult(). deleteasync(sobjects, accesslevel) initiates requests to delete the external data that corresponds to the specified external object records. the requests are executed asynchronously, as background operations, and are sent to the external systems that are defined by the external objects' associated external data sources. signature public static list deleteasync(list sobjects, system.accesslevel accesslevel) parameters sobjects type: list list of external object records to delete. accesslevel type: system.accesslevel (optional) the accesslevel parameter specifies whether the method runs in system mode (accesslevel.system_mode) or user mode (accesslevel.user_mode). in system mode, the object and field-level permissions of the current user are ignored, and the record sharing rules are controlled by the class sharing keywords. in user mode, the object permissions, field-level security, and sharing rules of the current user are enforced. system mode is the default. return value type: list status results for the delete operation. each result corresponds to a record processed by this asynchronous operation and is associated with a unique identifier (asynclocator). the asynclocator value is included in the errors array of the result. you can retrieve this identifier with database.getasynclocator(). retrieve the final result with database.getasyncdeleteresult(). 2885apex reference guide database class deleteasync(sobject, accesslevel) initiates a request to delete the external data that corresponds to the specified external object record. the request is executed asynchronously, as a background operation, and is sent to the external system that's defined by the external object's associated external data source. signature public static database.deleteresult deleteasync(sobject sobject, system.accesslevel accesslevel) parameters sobject type: sobject the external object record to delete. accesslevel type: system.accesslevel (optional) the accesslevel parameter specifies whether the method runs in system mode (accesslevel.system_mode) or user mode (accesslevel.user_mode). in system mode, the object and field-level permissions of the current user are ignored, and the record sharing rules are controlled by the class sharing keywords. in user mode, the object permissions, field-level security, and sharing rules of the current user are enforced. system mode is the default. return value type: database.deleteresult status result for the delete operation. the result corresponds to the record processed by this asynchronous operation and is associated with a unique identifier (asynclocator). the asynclocator value is included in the errors array of the result. you can retrieve this identifier with database.getasynclocator(). retrieve the final result with database.getasyncdeleteresult(). deleteimmediate(sobjects) initiates requests to delete the external data that corresponds to the specified external object records. the requests are executed synchronously and are sent to the external systems that are defined by the external objects' associated external data sources. if the apex transaction contains pending changes, the synchronous operations can't be completed and throw exceptions. signature public static list deleteimmediate(list sobjects) parameters sobjects type: list list of external object records to delete. return value type: list 2886apex reference guide database class status results for the delete operation. usage the batch limit for big objects using deleteimmediate() is 50,000 records at once. deleteimmediate(sobject) initiates a request to delete the external data that corresponds to the specified external object record. the request is executed synchronously and is sent to the external system that's defined by the external object's associated external data source. if the apex transaction contains" "pending changes, the synchronous operation can't be completed and throws an exception. signature public static database.deleteresult deleteimmediate(sobject sobject) parameters sobject type: sobject the external object record to delete. return value type: database.deleteresult status result for the delete operation. deleteimmediate(sobjects, accesslevel) initiates requests to delete the external data that corresponds to the specified external object records. the requests are executed synchronously and are sent to the external systems that are defined by the external objects' associated external data sources. if the apex transaction contains pending changes, the synchronous operations can't be completed and throw exceptions. signature public static list deleteimmediate(list sobjects, system.accesslevel accesslevel) parameters sobjects type: list list of external object records to delete. accesslevel type: system.accesslevel (optional) the accesslevel parameter specifies whether the method runs in system mode (accesslevel.system_mode) or user mode (accesslevel.user_mode). in system mode, the object and field-level permissions of the current user are ignored, and the record sharing rules are controlled by the class sharing keywords. in user mode, the object permissions, field-level security, and sharing rules of the current user are enforced. system mode is the default. 2887apex reference guide database class return value type: list status results for the delete operation. usage the batch limit for big objects using deleteimmediate() is 50,000 records at once. deleteimmediate(sobject, accesslevel) initiates a request to delete the external data that corresponds to the specified external object record. the request is executed synchronously and is sent to the external system that's defined by the external object's associated external data source. if the apex transaction contains pending changes, the synchronous operation can't be completed and throws an exception. signature public static database.deleteresult deleteimmediate(sobject sobject, system.accesslevel accesslevel) parameters sobject type: sobject the external object record to delete. accesslevel type: system.accesslevel (optional) the accesslevel parameter specifies whether the method runs in system mode (accesslevel.system_mode) or user mode (accesslevel.user_mode). in system mode, the object and field-level permissions of the current user are ignored, and the record sharing rules are controlled by the class sharing keywords. in user mode, the object permissions, field-level security, and sharing rules of the current user are enforced. system mode is the default. return value type: database.deleteresult status result for the delete operation. emptyrecyclebin(recordids) permanently deletes the specified records from the recycle bin. signature public static database.emptyrecyclebinresult[] emptyrecyclebin(id [] recordids) parameters recordids type: id[] 2888apex reference guide database class return value type: database.emptyrecyclebinresult[] usage note the following: • after records are deleted using this method, they cannot be undeleted. • only 10,000 records can be specified for deletion. • logged in users can delete any record that they can query in their recycle bin, or the recycle bins of any subordinates. if logged in users have “modify all data” permission, they can query and delete records from any recycle bin in the organization. • cascade delete record ids should not be included in the list of ids; otherwise an error occurs. for example, if an account record is deleted, all related contacts, opportunities, contracts, and so on are also deleted. only include the id of the top-level account. all related records are automatically removed. • deleted items are added to the number of items processed by a dml statement, and the method call is added to the total number of dml statements issued. each executed emptyrecyclebin method counts against the governor limit for dml statements. emptyrecyclebin(obj) permanently deletes the specified sobject from the recycle bin. signature public static database.emptyrecyclebinresult emptyrecyclebin(sobject obj) parameters obj type: sobject return value type: database.emptyrecyclebinresult usage note the following: • after an sobject is deleted using" "this method, it cannot be undeleted. • only 10,000 sobjects can be specified for deletion. • the logged-in user can delete any sobject (that can be queried) in their recycle bin, or the recycle bins of any subordinates. if the logged-in user has “modify all data” permission, they can query and delete sobjects from any recycle bin in the organization. • do not include an sobject that was deleted due to a cascade delete; otherwise an error occurs. for example, if an account is deleted, all related contacts, opportunities, contracts, and so on are also deleted. only include sobjects of the top-level account. all related sobjects are automatically removed. emptyrecyclebin(listofsobjects) permanently deletes the specified sobjects from the recycle bin. 2889apex reference guide database class signature public static database.emptyrecyclebinresult[] emptyrecyclebin(sobject[] listofsobjects) parameters listofsobjects type: sobject[] return value type: database.emptyrecyclebinresult[] usage note the following: • after an sobject is deleted using this method, it cannot be undeleted. • only 10,000 sobjects can be specified for deletion. • the logged-in user can delete any sobject (that can be queried) in their recycle bin, or the recycle bins of any subordinates. if the logged-in user has “modify all data” permission, they can query and delete sobjects from any recycle bin in the organization. • do not include an sobject that was deleted due to a cascade delete; otherwise an error occurs. for example, if an account is deleted, all related contacts, opportunities, contracts, and so on are also deleted. only include sobjects of the top-level account. all related sobjects are automatically removed. executebatch(batchclassobject) submits a batch apex job for execution corresponding to the specified class. signature public static id executebatch(object batchclassobject) parameters batchclassobject type: object an instance of a class that implements the database.batchable interface. return value type: id the id of the new batch job (asyncapexjob). usage when calling this method, salesforce chunks the records returned by the start method of the batch class into batches of 200, and then passes each batch to the execute method. apex governor limits are reset for each execution of execute. for more information, see using batch apex. 2890apex reference guide database class versioned behavior changes if the executebatch call fails to acquire an apex flex queue lock: • in api version 52.0 and later, the call throws a system.asyncexception. • in api version 51.0 and earlier, the call returns an empty id, ""000000000000000"", instead of throwing an exception. executebatch(batchclassobject, scope) submits a batch apex job for execution using the specified class and scope. signature public static id executebatch(object batchclassobject, integer scope) parameters batchclassobject type: object an instance of a class that implements the database.batchable interface. scope type: integer number of records to be passed into the execute method for batch processing. return value type: id the id of the new batch job (asyncapexjob). usage the value for scope must be greater than 0. if the start method of the batch class returns a database.querylocator, the scope parameter of database.executebatch can have a maximum value of 2,000. if set to a higher value, salesforce chunks the records returned by the querylocator into smaller batches of up to 200 records. if the start method of the batch class returns an iterable, the scope parameter value has no upper limit; however, if you use a very high number, you could run into other limits. apex governor limits are reset for each execution of execute. for more information, see using batch apex. versioned behavior changes if the executebatch call fails to acquire an apex flex queue lock: • in api version 52.0 and later, the call throws a system.asyncexception. • in api version 51.0 and earlier, the call returns an empty id, ""000000000000000"", instead of throwing an exception. getasyncdeleteresult(deleteresult) retrieves the status of an asynchronous delete operation that’s identified by a database.deleteresult object." "2891apex reference guide database class signature public static database.deleteresult getasyncdeleteresult(database.deleteresult deleteresult) parameters deleteresult type: database.deleteresult the result record for the delete operation being retrieved. return value type: database.deleteresult the result of a completed asynchronous delete of a record or records. getasyncdeleteresult(asynclocator) retrieves the result of an asynchronous delete operation based on the result’s unique identifier. signature public static database.deleteresult getasyncdeleteresult(string asynclocator) parameters asynclocator type: string the unique identifier associated with the result of an asynchronous operation. return value type: database.deleteresult the result of a completed asynchronous delete of a record or records. getasynclocator(result) returns the asynclocator associated with the result of a specified asynchronous insert, update, or delete operation. signature public static string getasynclocator(object result) parameters result type: object the saved result of an asynchronous insert, update, or delete operation. the result object can be of type database.saveresult or database.deleteresult. 2892apex reference guide database class return value type: string the unique identifier associated with the result of the specified operation. getasyncsaveresult(saveresult) returns the status of an asynchronous insert or update operation that’s identified by a database.saveresult object. signature public static database.saveresult getasyncsaveresult(database.saveresult saveresult) parameters saveresult type: database.saveresult the result record for the insert or update operation being retrieved. return value database.saveresult the result of a completed asynchronous operation on a record or records. getasyncsaveresult(asynclocator) returns the status of an asynchronous insert or update operation based on the unique identifier associated with each modification. signature public static database.saveresult getasyncsaveresult(string asynclocator) parameters asynclocator type: string the unique identifier associated with the result of an asynchronous operation. return value database.saveresult the result of a completed asynchronous operation on a record or records. getdeleted(sobjecttype, startdate, enddate) returns the list of individual records that have been deleted for an sobject type within the specified start and end dates and times and that are still in the recycle bin. 2893apex reference guide database class signature public static database.getdeletedresult getdeleted(string sobjecttype, datetime startdate, datetime enddate) parameters sobjecttype type: string the sobjecttype argument is the sobject type name for which to get the deleted records, such as account or merchandise__c. startdate type: datetime start date and time of the deleted records time window. enddate type: datetime end date and time of the deleted records time window. return value type: database.getdeletedresult usage because the recycle bin holds records up to 15 days, results are returned for no more than 15 days previous to the day the call is executed (or earlier if an administrator has purged the recycle bin). example database.getdeletedresult r = database.getdeleted( 'merchandise__c', datetime.now().addhours(-1), datetime.now()); getquerylocator(listofqueries) creates a querylocator object used in batch apex or visualforce. signature public static database. querylocator getquerylocator(sobject [] listofqueries) parameters listofqueries type: sobject [] 2894apex reference guide database class return value type: database.querylocator usage you can't use getquerylocator with any query that contains an aggregate function. each executed getquerylocator method counts against the governor limit of 10,000 total records retrieved and the total number of soql queries issued. for more information, see understanding apex managed sharing, and ideastandardsetcontroller class. getquerylocator(query) creates a querylocator object used in batch apex or visualforce. signature public static database.querylocator getquerylocator(string query) parameters query type: string return value type: database.querylocator usage you can't use getquerylocator with any query that contains an aggregate function. each executed getquerylocator method counts against the governor limit of 10,000 total records retrieved and the total" "number of soql queries issued. for more information, see understanding apex managed sharing, and standardsetcontroller class. getquerylocator(listofqueries, accesslevel) creates a querylocator object used in batch apex or visualforce. signature public static database.querylocator getquerylocator(sobject [] listofqueries, system.accesslevel accesslevel) parameters listofqueries type: sobject [] 2895apex reference guide database class accesslevel type: system.accesslevel (optional) the accesslevel parameter specifies whether the method runs in system mode (accesslevel.system_mode) or user mode (accesslevel.user_mode). in system mode, the object and field-level permissions of the current user are ignored, and the record sharing rules are controlled by the class sharing keywords. in user mode, the object permissions, field-level security, and sharing rules of the current user are enforced. system mode is the default. return value type: database.querylocator usage the access level is evaluated only when the querylocator is created. a querylocator can be long lived, such as when used in a batch. we don’t reevaluate the object and field-level security with each iteration of the querylocator. as a result, if you specify user mode, and then change the security settings after the querylocator is created, the new settings aren’t enforced. you can't use getquerylocator with any query that contains an aggregate function. each executed getquerylocator method counts against the governor limit of 10,000 total records retrieved and the total number of soql queries issued. for more information, see understanding apex managed sharing, and ideastandardsetcontroller class. getquerylocator(query, accesslevel) creates a querylocator object used in batch apex or visualforce. signature public static database.querylocator getquerylocator(string query, system.accesslevel accesslevel) parameters query type: string accesslevel type: system.accesslevel (optional) the accesslevel parameter specifies whether the method runs in system mode (accesslevel.system_mode) or user mode (accesslevel.user_mode). in system mode, the object and field-level permissions of the current user are ignored, and the record sharing rules are controlled by the class sharing keywords. in user mode, the object permissions, field-level security, and sharing rules of the current user are enforced. system mode is the default. return value type: database.querylocator 2896apex reference guide database class usage the access level is evaluated only when the querylocator is created. a querylocator can be long lived, such as when used in a batch. we don’t reevaluate the object and field-level security with each iteration of the querylocator. as a result, if you specify user mode, and then change the security settings after the querylocator is created, the new settings aren’t enforced. you can't use getquerylocator with any query that contains an aggregate function. each executed getquerylocator method counts against the governor limit of 10,000 total records retrieved and the total number of soql queries issued. for more information, see understanding apex managed sharing, and standardsetcontroller class. getquerylocatorwithbinds(query, bindmap, accesslevel) creates a querylocator object used in batch apex or visualforce. bind variables in the query are resolved from the bindmap map parameter directly with the key, rather than from apex code variables. signature public static database.querylocator getquerylocatorwithbinds(string query, map bindmap, system.accesslevel accesslevel) parameters query type: string soql query that includes apex bind variables preceded by a colon. all bind variables must have a key in the bindmap map. bindmap type: map a map that contains keys for each bind variable specified in the soql querystring and its value. the keys can’t be null or duplicates, and the values can’t be null or empty strings. accesslevel type: system.accesslevel the accesslevel parameter specifies whether the method runs in system mode (accesslevel.system_mode) or user mode (accesslevel.user_mode). in system mode, the object and field-level permissions of the current user are ignored, and the record sharing rules are controlled by the class sharing keywords. in user mode, the object permissions, field-level security" ", and sharing rules of the current user are enforced. return value type: database.querylocator usage the access level is evaluated only when the querylocator is created. a querylocator can be long lived, such as when used in a batch. we don’t reevaluate the object and field-level security with each iteration of the querylocator. as a result, if you specify user mode, and then change the security settings after the querylocator is created, the new settings aren’t enforced. you can't use getquerylocatorwithbinds with any query that contains an aggregate function. 2897apex reference guide database class each executed getquerylocatorwithbinds method counts against the governor limit for the total number of records retrieved by database.getquerylocator(10,000) and the total number of soql queries issued. see per transaction apex limits. for more information, see understanding apex managed sharing, and standardsetcontroller class. example in this example, the soql query uses a bind variable for an account name. its value (acme corporation) is passed in using the acctbinds map. public class testbatch implements database.batchable{ private map acctbinds = new map{'acctname' => 'acme corporation'}; private string query = 'select id from account where name = :acctname'; public database.querylocator start(database.batchablecontext bc){ return database.getquerylocatorwithbinds(query, acctbinds, accesslevel.user_mode); } public void execute(database.batchablecontext bc, list scope){ } public void finish(database.batchablecontext bc){ } } getupdated(sobjecttype, startdate, enddate) returns the list of individual records that have been updated for an sobject type within the specified start and end dates and times. signature public static database.getupdatedresult getupdated(string sobjecttype, datetime startdate, datetime enddate) parameters sobjecttype type: string the sobjecttype argument is the sobject type name for which to get the updated records, such as account or merchandise__c. startdate type: datetime the startdate argument is the start date and time of the updated records time window. enddate type: datetime the enddate argument is the end date and time of the updated records time window. 2898apex reference guide database class return value type: database.getupdatedresult usage the date range for the returned results is no more than 30 days previous to the day the call is executed. example database.getupdatedresult r = database.getupdated( 'merchandise__c', datetime.now().addhours(-1), datetime.now()); insert(recordtoinsert, allornone) adds an sobject, such as an individual account or contact, to your organization's data. signature public static database.saveresult insert(sobject recordtoinsert, boolean allornone) parameters recordtoinsert type: sobject allornone type: boolean the optional allornone parameter specifies whether the operation allows partial success. if you specify false for this parameter and a record fails, the remainder of the dml operation can still succeed. this method returns a result object that can be used to verify which records succeeded, which failed, and why. if the parameter is not set or is set true, an exception is thrown if the method is not successful. return value type: database.saveresult usage insert is analogous to the insert statement in sql. apex classes and triggers saved (compiled) using api version 15.0 and higher produce a runtime error if you assign a string value that is too long for the field. each executed insert method counts against the governor limit for dml statements. insert(recordstoinsert, allornone) adds one or more sobjects, such as individual accounts or contacts, to your organization’s data. 2899apex reference guide database class signature public static database.saveresult[] insert(sobject[] recordstoinsert, boolean allornone) parameters recordstoinsert type: sobject [] allornone type: boolean the optional allornone parameter specifies whether the operation allows partial success. if you specify false for this parameter and a record fails, the remainder of the dml operation can still succeed. this" "method returns a result object that can be used to verify which records succeeded, which failed, and why. if the parameter isn’t set or is set true, an exception is thrown if the method isn’t successful. if the parameter is specified as false and a before-trigger assigns an invalid value to a field, the partial set of valid records isn’t inserted. return value type: database.saveresult[] usage insert is analogous to the insert statement in sql. apex classes and triggers saved (compiled) using api version 15.0 and higher produce a runtime error if you assign a string value that is too long for the field. each executed insert method counts against the governor limit for dml statements. example example: the following example inserts two accounts: account a = new account(name = 'acme1'); database.saveresult[] lsr = database.insert( new account[]{a, new account(name = 'acme2')}, false); insert(recordtoinsert, dmloptions) adds an sobject, such as an individual account or contact, to your organization's data. signature public static database.saveresult insert(sobject recordtoinsert, database.dmloptions dmloptions) parameters recordtoinsert type: sobject 2900apex reference guide database class dmloptions type: database.dmloptions the optional dmloptions parameter specifies additional data for the transaction, such as assignment rule information or rollback behavior when errors occur during record insertions. return value type: database.saveresult usage insert is analogous to the insert statement in sql. apex classes and triggers saved (compiled) using api version 15.0 and higher produce a runtime error if you assign a string value that is too long for the field. each executed insert method counts against the governor limit for dml statements. insert(recordstoinsert, dmloptions) adds one or more sobjects, such as individual accounts or contacts, to your organization's data. signature public static database.saveresult insert(sobject[] recordstoinsert, database.dmloptions dmloptions) parameters recordstoinsert type: sobject[] dmloptions type: database.dmloptions the optional dmloptions parameter specifies additional data for the transaction, such as assignment rule information or rollback behavior when errors occur during record insertions. return value type: database.saveresult[] usage insert is analogous to the insert statement in sql. apex classes and triggers saved (compiled) using api version 15.0 and higher produce a runtime error if you assign a string value that is too long for the field. each executed insert method counts against the governor limit for dml statements. insert(recordtoinsert, allornone, accesslevel) adds an sobject, such as an individual account or contact, to your organization's data. 2901apex reference guide database class signature public static database.saveresult insert(sobject recordtoinsert, boolean allornone, system.accesslevel accesslevel) parameters recordtoinsert type: sobject allornone type: boolean the optional allornone parameter specifies whether the operation allows partial success. if you specify false for this parameter and a record fails, the remainder of the dml operation can still succeed. this method returns a result object that can be used to verify which records succeeded, which failed, and why. if the parameter is not set or is set true, an exception is thrown if the method is not successful. accesslevel type: system.accesslevel (optional) the accesslevel parameter specifies whether the method runs in system mode (accesslevel.system_mode) or user mode (accesslevel.user_mode). in system mode, the object and field-level permissions of the current user are ignored, and the record sharing rules are controlled by the class sharing keywords. in user mode, the object permissions, field-level security, and sharing rules of the current user are enforced. system mode is the default. return value type: database.saveresult usage if you use the accesslevel parameter to specify that the method runs in user mode, we report all encountered inaccessible fields. the way to retrieve the names of these inaccessible fields depends on the value of this method's allornone parameter, or the equivalent dmloptions.optallornone property. if you specify that: • allornone=true or dmloptions.optallornone=true: catch the dmlexception and use the dmlex" "ception.getdmlfieldnames() method to retrieve the list of inaccessible fields. see exception class and built-in exceptions for more information. • allornone=false or dmloptions.optallornone=false: for each failing record, we update the database.error object that results from the dml operation. use the error.getfields() method to retrieve the list of inaccessible fields. see the error class methods for more information. insert is analogous to the insert statement in sql. apex classes and triggers saved (compiled) using api version 15.0 and higher produce a runtime error if you assign a string value that is too long for the field. each executed insert method counts against the governor limit for dml statements. insert(recordstoinsert, allornone, accesslevel) adds one or more sobjects, such as individual accounts or contacts, to your organization’s data. 2902apex reference guide database class signature public static list insert(list recordstoinsert, boolean allornone, system.accesslevel accesslevel) parameters recordstoinsert type: list allornone type: boolean the optional allornone parameter specifies whether the operation allows partial success. if you specify false for this parameter and a record fails, the remainder of the dml operation can still succeed. this method returns a result object that can be used to verify which records succeeded, which failed, and why. if the parameter isn’t set or is set true, an exception is thrown if the method isn’t successful. if the parameter is specified as false and a before-trigger assigns an invalid value to a field, the partial set of valid records isn’t inserted. accesslevel type: system.accesslevel (optional) the accesslevel parameter specifies whether the method runs in system mode (accesslevel.system_mode) or user mode (accesslevel.user_mode). in system mode, the object and field-level permissions of the current user are ignored, and the record sharing rules are controlled by the class sharing keywords. in user mode, the object permissions, field-level security, and sharing rules of the current user are enforced. system mode is the default. return value type: list usage if you use the accesslevel parameter to specify that the method runs in user mode, we report all encountered inaccessible fields. the way to retrieve the names of these inaccessible fields depends on the value of this method's allornone parameter, or the equivalent dmloptions.optallornone property. if you specify that: • allornone=true or dmloptions.optallornone=true: catch the dmlexception and use the dmlexception.getdmlfieldnames() method to retrieve the list of inaccessible fields. see exception class and built-in exceptions for more information. • allornone=false or dmloptions.optallornone=false: for each failing record, we update the database.error object that results from the dml operation. use the error.getfields() method to retrieve the list of inaccessible fields. see the error class methods for more information. insert is analogous to the insert statement in sql. apex classes and triggers saved (compiled) using api version 15.0 and higher produce a runtime error if you assign a string value that is too long for the field. each executed insert method counts against the governor limit for dml statements. insert(recordtoinsert, dmloptions, accesslevel) adds an sobject, such as an individual account or contact, to your organization's data. 2903apex reference guide database class signature public static database.saveresult insert(sobject recordtoinsert, database.dmloptions dmloptions, system.accesslevel accesslevel) parameters recordtoinsert type: sobject dmloptions type: database.dmloptions the optional dmloptions parameter specifies additional data for the transaction, such as assignment rule information or rollback behavior when errors occur during record insertions. accesslevel type: system.accesslevel (optional) the accesslevel parameter specifies whether the method runs in system mode (accesslevel.system_mode) or user mode (accesslevel.user_mode). in system mode, the object and field-level permissions of the current user are ignored, and the record sharing rules are controlled by the class sharing keywords. in user mode, the object permissions, field-level security, and sharing rules of the current user are enforced. system mode" "is the default. return value type: database.saveresult usage insert is analogous to the insert statement in sql. apex classes and triggers saved (compiled) using api version 15.0 and higher produce a runtime error if you assign a string value that is too long for the field. each executed insert method counts against the governor limit for dml statements. insert(recordstoinsert, dmloptions, accesslevel) adds one or more sobjects, such as individual accounts or contacts, to your organization's data. signature public static list insert(list recordstoinsert, database.dmloptions dmloptions, system.accesslevel accesslevel) parameters recordstoinsert type: list dmloptions type: database.dmloptions the optional dmloptions parameter specifies additional data for the transaction, such as assignment rule information or rollback behavior when errors occur during record insertions. 2904apex reference guide database class accesslevel type: system.accesslevel (optional) the accesslevel parameter specifies whether the method runs in system mode (accesslevel.system_mode) or user mode (accesslevel.user_mode). in system mode, the object and field-level permissions of the current user are ignored, and the record sharing rules are controlled by the class sharing keywords. in user mode, the object permissions, field-level security, and sharing rules of the current user are enforced. system mode is the default. return value type: list usage insert is analogous to the insert statement in sql. apex classes and triggers saved (compiled) using api version 15.0 and higher produce a runtime error if you assign a string value that is too long for the field. each executed insert method counts against the governor limit for dml statements. insertasync(sobjects, callback) initiates requests to add external object data to the relevant external systems. the requests are executed asynchronously, as background operations, and are sent to the external systems that are defined by the external objects' associated external data sources. allows referencing a callback class whose processsave method is called for each record after the remote operations are completed. signature public static list insertasync(list sobjects, datasource.asyncsavecallback callback) parameters sobjects type: list list of external object records to insert. callback type: datasource.asyncsavecallback the callback object that contains the state in the originating context and an action (the processsave method) that executes after the insert operation is completed. use the action callback to update org data according to the operation’s results. the callback object must extend datasource.asyncsavecallback. return value type: list status results for the insert operation. each result corresponds to a record processed by this asynchronous operation and is associated with a unique identifier (asynclocator). the asynclocator value is included in the errors array of the result. you can retrieve this identifier with database.getasynclocator(). retrieve the final result with database.getasyncsaveresult(). 2905apex reference guide database class usage database.insertasync() methods can’t be executed in the context of a portal user, even when the portal user is a community member. to add external object records via apex, use database.insertimmediate() methods. insertasync(sobject, callback) initiates a request to add external object data to the relevant external system. the request is executed asynchronously, as a background operation, and is sent to the external system that's defined by the external object's associated external data source. allows referencing a callback class whose processsave method is called after the remote operation is completed. signature public static database.saveresult insertasync(sobject sobject, datasource.asyncsavecallback callback) parameters sobject type: sobject the external object record to insert. callback type: datasource.asyncsavecallback the callback object that contains the state in the originating context and an action (the processsave method) that executes after the insert operation is completed. use the action callback to update org data according to the operation’s results. the callback object must extend datasource.asyncsavecallback. return value type: database.saveresult status result for the insert operation. the result corresponds to the record processed by this asynchronous operation and is associated with a unique identifier (asynclocator). the asyncloc" "ator value is included in the errors array of the result. you can retrieve this identifier with database.getasynclocator(). retrieve the final result with database.getasyncsaveresult(). usage database.insertasync() methods can’t be executed in the context of a portal user, even when the portal user is a community member. to add external object records via apex, use database.insertimmediate() methods. insertasync(sobjects) initiates requests to add external object data to the relevant external systems. the requests are executed asynchronously, as background operations, and are sent to the external systems that are defined by the external objects' associated external data sources. signature public static list insertasync(list sobjects) 2906apex reference guide database class parameters sobjects type: list list of external object records to insert. return value type: list status results for the insert operation. each result corresponds to a record processed by this asynchronous operation and is associated with a unique identifier (asynclocator). the asynclocator value is included in the errors array of the result. you can retrieve this identifier with database.getasynclocator(). retrieve the final result with database.getasyncsaveresult(). usage database.insertasync() methods can’t be executed in the context of a portal user, even when the portal user is a community member. to add external object records via apex, use database.insertimmediate() methods. insertasync(sobject) initiates a request to add external object data to the relevant external system. the request is executed asynchronously, as a background operation, and is sent to the external system that's defined by the external object's associated external data source. signature public static database.saveresult insertasync(sobject sobject) parameters sobject type: sobject the external object record to insert. return value type: database.saveresult status result for the insert operation. the result corresponds to the record processed by this asynchronous operation and is associated with a unique identifier (asynclocator). the asynclocator value is included in the errors array of the result. you can retrieve this identifier with database.getasynclocator(). retrieve the final result with database.getasyncsaveresult(). usage database.insertasync() methods can’t be executed in the context of a portal user, even when the portal user is a community member. to add external object records via apex, use database.insertimmediate() methods. insertasync(sobjects, callback, accesslevel) initiates requests to add external object data to the relevant external systems. the requests are executed asynchronously, as background operations, and are sent to the external systems that are defined by the external objects' associated external data sources. allows referencing a callback class whose processsave method is called for each record after the remote operations are completed. 2907apex reference guide database class signature> public static list insertasync(list sobjects, datasource.asyncsavecallback callback, system.accesslevel accesslevel) parameters> sobjects type: list list of external object records to insert. callback type: datasource.asyncsavecallback the callback object that contains the state in the originating context and an action (the processsave method) that executes after the insert operation is completed. the execution is in system mode regardless of the accesslevel parameter. use the action callback to update org data according to the operation’s results. the callback object must extend datasource.asyncsavecallback. accesslevel type: system.accesslevel (optional) the accesslevel parameter specifies whether the method runs in system mode (accesslevel.system_mode) or user mode (accesslevel.user_mode). in system mode, the object and field-level permissions of the current user are ignored, and the record sharing rules are controlled by the class sharing keywords. in user mode, the object permissions, field-level security, and sharing rules of the current user are enforced. system mode is the default. return value> type: list status results for the insert operation. each result corresponds to a record processed by this asynchronous operation and is associated with a unique identifier (asynclocator). the asynclocator value is included in the errors array of the result. you can retrieve this identifier with database.getasynclocator(). retrieve the final result with database.getasync" "saveresult(). usage> database.insertasync() methods can’t be executed in the context of a portal user, even when the portal user is a community member. to add external object records via apex, use database.insertimmediate() methods. insertasync(sobject, callback, accesslevel) initiates a request to add external object data to the relevant external system. the request is executed asynchronously, as a background operation, and is sent to the external system that's defined by the external object's associated external data source. allows referencing a callback class whose processsave method is called after the remote operation is completed. signature public static database.saveresult insertasync(sobject sobject, datasource.asyncsavecallback callback, system.accesslevel accesslevel) 2908apex reference guide database class parameters sobject type: sobject the external object record to insert. callback type: datasource.asyncsavecallback the callback object that contains the state in the originating context and an action (the processsave method) that executes after the insert operation is completed. the execution is in system mode regardless of the accesslevel parameter. use the action callback to update org data according to the operation’s results. the callback object must extend datasource.asyncsavecallback. accesslevel type: system.accesslevel (optional) the accesslevel parameter specifies whether the method runs in system mode (accesslevel.system_mode) or user mode (accesslevel.user_mode). in system mode, the object and field-level permissions of the current user are ignored, and the record sharing rules are controlled by the class sharing keywords. in user mode, the object permissions, field-level security, and sharing rules of the current user are enforced. system mode is the default. return value type: database.saveresult status result for the insert operation. the result corresponds to the record processed by this asynchronous operation and is associated with a unique identifier (asynclocator). the asynclocator value is included in the errors array of the result. you can retrieve this identifier with database.getasynclocator(). retrieve the final result with database.getasyncsaveresult(). usage database.insertasync() methods can’t be executed in the context of a portal user, even when the portal user is a community member. to add external object records via apex, use database.insertimmediate() methods. insertasync(sobjects, accesslevel) initiates requests to add external object data to the relevant external systems. the requests are executed asynchronously, as background operations, and are sent to the external systems that are defined by the external objects' associated external data sources. signature public static list insertasync(list sobjects, system.accesslevel accesslevel) parameters sobjects type: list list of external object records to insert. accesslevel type: system.accesslevel 2909apex reference guide database class (optional) the accesslevel parameter specifies whether the method runs in system mode (accesslevel.system_mode) or user mode (accesslevel.user_mode). in system mode, the object and field-level permissions of the current user are ignored, and the record sharing rules are controlled by the class sharing keywords. in user mode, the object permissions, field-level security, and sharing rules of the current user are enforced. system mode is the default. return value type: list status results for the insert operation. each result corresponds to a record processed by this asynchronous operation and is associated with a unique identifier (asynclocator). the asynclocator value is included in the errors array of the result. you can retrieve this identifier with database.getasynclocator(). retrieve the final result with database.getasyncsaveresult(). usage database.insertasync() methods can’t be executed in the context of a portal user, even when the portal user is a community member. to add external object records via apex, use database.insertimmediate() methods. insertasync(sobject, accesslevel) initiates a request to add external object data to the relevant external system. the request is executed asynchronously, as a background operation, and is sent to the external system that's defined by the external object's associated external data source. signature public static database.saveresult insertasync(sobject sobject, system.accesslevel accesslevel) parameters sobject type: sobject the external object record to insert. accesslevel type: system." "accesslevel (optional) the accesslevel parameter specifies whether the method runs in system mode (accesslevel.system_mode) or user mode (accesslevel.user_mode). in system mode, the object and field-level permissions of the current user are ignored, and the record sharing rules are controlled by the class sharing keywords. in user mode, the object permissions, field-level security, and sharing rules of the current user are enforced. system mode is the default. return value type: database.saveresult status result for the insert operation. the result corresponds to the record processed by this asynchronous operation and is associated with a unique identifier (asynclocator). the asynclocator value is included in the errors array of the result. you can retrieve this identifier with database.getasynclocator(). retrieve the final result with database.getasyncsaveresult(). 2910apex reference guide database class usage database.insertasync() methods can’t be executed in the context of a portal user, even when the portal user is a community member. to add external object records via apex, use database.insertimmediate() methods. insertimmediate(sobjects) initiates requests to add external object data to the relevant external systems. the requests are executed synchronously and are sent to the external systems that are defined by the external objects' associated external data sources. if the apex transaction contains pending changes, the synchronous operations can't be completed and throw exceptions. signature public static list insertimmediate(list sobjects) parameters sobjects type: list list of external object records to insert. return value type: list status results for the insert operation. usage the operation allows partial success. if one or more record inserts fail, the method doesn’t throw an exception and the remainder of the dml operation can still succeed. the returned saveresult objects indicate whether the operation was successful. if it wasn’t successful, the objects also return the error code and description. insertimmediate(sobject) initiates a request to add external object data to the relevant external system. the request is executed synchronously and is sent to the external system that's defined by the external object's associated external data source. if the apex transaction contains pending changes, the synchronous operation can't be completed and throws an exception. signature public static database.saveresult insertimmediate(sobject sobject) parameters sobject type: sobject the external object record to insert. 2911apex reference guide database class return value type: database.saveresult status result for the insert operation. usage if a record insert fails, the method doesn’t throw an exception. the returned saveresult object indicates whether the operation was successful. if it wasn’t successful, the object returns the error code and description. insertimmediate(sobjects, accesslevel) initiates requests to add external object data to the relevant external systems. the requests are executed synchronously and are sent to the external systems that are defined by the external objects' associated external data sources. if the apex transaction contains pending changes, the synchronous operations can't be completed and throw exceptions. signature public static list insertimmediate(list sobjects, system.accesslevel accesslevel) parameters sobjects type: list list of external object records to insert. accesslevel type: system.accesslevel (optional) the accesslevel parameter specifies whether the method runs in system mode (accesslevel.system_mode) or user mode (accesslevel.user_mode). in system mode, the object and field-level permissions of the current user are ignored, and the record sharing rules are controlled by the class sharing keywords. in user mode, the object permissions, field-level security, and sharing rules of the current user are enforced. system mode is the default. return value type: list status results for the insert operation. usage the operation allows partial success. if one or more record inserts fail, the method doesn’t throw an exception and the remainder of the dml operation can still succeed. the returned saveresult objects indicate whether the operation was successful. if it wasn’t successful, the objects also return the error code and description. insertimmediate(sobject, accesslevel) initiates a request to add external object data to the relevant external system. the request is executed synchronously and is" "sent to the external system that's defined by the external object's associated external data source. if the apex transaction contains pending changes, the synchronous operation can't be completed and throws an exception. 2912apex reference guide database class signature public static database.saveresult insertimmediate(sobject sobject, system.accesslevel accesslevel) parameters sobject type: sobject the external object record to insert. accesslevel type: system.accesslevel (optional) the accesslevel parameter specifies whether the method runs in system mode (accesslevel.system_mode) or user mode (accesslevel.user_mode). in system mode, the object and field-level permissions of the current user are ignored, and the record sharing rules are controlled by the class sharing keywords. in user mode, the object permissions, field-level security, and sharing rules of the current user are enforced. system mode is the default. return value type: database.saveresult status result for the insert operation. usage if a record update fails, the method doesn’t throw an exception. the returned saveresult object indicates whether the operation was successful. if it failed, the object returns the error code and description. merge(masterrecord, duplicateid) merges the specified duplicate record into the master sobject record of the same type, deleting the duplicate, and reparenting any related records. merges only accounts, contacts, or leads. signature public static database.mergeresult merge(sobject masterrecord, id duplicateid) parameters masterrecord type: sobject the master sobject record the duplicate record is merged into. duplicateid type: id the id of the record to merge with the master. this record must be of the same sobject type as the master. return value type: database.mergeresult 2913apex reference guide database class usage each executed merge method counts against the governor limit for dml statements. merge(masterrecord, duplicaterecord) merges the specified duplicate sobject record into the master sobject of the same type, deleting the duplicate, and reparenting any related records. signature public static database.mergeresult merge(sobject masterrecord, sobject duplicaterecord) parameters masterrecord type: sobject the master sobject record the duplicate record is merged into. duplicaterecord type: sobject the sobject record to merge with the master. this sobject must be of the same type as the master. return value type: database.mergeresult usage each executed merge method counts against the governor limit for dml statements. merge(masterrecord, duplicateids) merges up to two records of the same sobject type into the master sobject record, deleting the others, and reparenting any related records. signature public static list merge(sobject masterrecord, list duplicateids) parameters masterrecord type: sobject the master sobject record the other records are merged into. duplicateids type: list a list of ids of up to two records to merge with the master. these records must be of the same sobject type as the master. 2914apex reference guide database class return value type: list usage each executed merge method counts against the governor limit for dml statements. merge(masterrecord, duplicaterecords) merges up to two records of the same object type into the master sobject record, deleting the others, and reparenting any related records. signature public static list merge(sobject masterrecord, list duplicaterecords) parameters masterrecord type: sobject the master sobject record the other sobjects are merged into. duplicaterecords type: list a list of up to two sobject records to merge with the master. these sobjects must be of the same type as the master. return value type: list usage each executed merge method counts against the governor limit for dml statements. merge(masterrecord, duplicateid, allornone) merges the specified duplicate record into the master sobject record of the same type, optionally returning errors, if any, deleting the duplicate, and reparenting any related records. merges only accounts, contacts, or leads. signature public static database.mergeresult merge(" "sobject masterrecord, id duplicateid, boolean allornone) parameters masterrecord type: sobject the master sobject record the duplicate record is merged into. 2915apex reference guide database class duplicate type: id the id of the record to merge with the master. this record must be of the same sobject type as the master. allornone type: boolean set to false to return any errors encountered in this operation as part of the returned result. if set to true, this method throws an exception if the operation fails. the default is true. return value type: database.mergeresult usage each executed merge method counts against the governor limit for dml statements. merge(masterrecord, duplicaterecord, allornone) merges the specified duplicate sobject record into the master sobject of the same type, optionally returning errors, if any, deleting the duplicate, and reparenting any related records. signature public static database.mergeresult merge(sobject masterrecord, sobject duplicaterecord, boolean allornone) parameters masterrecord type: sobject the master sobject record the duplicate record is merged into. duplicaterecord type: sobject the sobject record to merge with the master. this sobject must be of the same type as the master. allornone type: boolean set to false to return any errors encountered in this operation as part of the returned result. if set to true, this method throws an exception if the operation fails. the default is true. return value type: database.mergeresult usage each executed merge method counts against the governor limit for dml statements. 2916apex reference guide database class merge(masterrecord, duplicateids, allornone) merges up to two records of the same sobject type into the master sobject record, optionally returning errors, if any, deleting the duplicates, and reparenting any related records. signature public static list merge(sobject masterrecord, list duplicateids, boolean allornone) parameters masterrecord type: sobject the master sobject record the other records are merged into. duplicateids type: list a list of ids of up to two records to merge with the master. these records must be of the same sobject type as the master. allornone type: boolean set to false to return any errors encountered in this operation as part of the returned result. if set to true, this method throws an exception if the operation fails. the default is true. return value type: list usage each executed merge method counts against the governor limit for dml statements. merge(masterrecord, duplicaterecords, allornone) merges up to two records of the same object type into the master sobject record, optionally returning errors, if any, deleting the duplicates, and reparenting any related records. signature public static list merge(sobject masterrecord, list duplicaterecords, boolean allornone) parameters masterrecord type: sobject the master sobject record the other sobjects are merged into. duplicaterecords type: list 2917apex reference guide database class a list of up to two sobject records to merge with the master. these sobjects must be of the same type as the master. allornone type: boolean set to false to return any errors encountered in this operation as part of the returned result. if set to true, this method throws an exception if the operation fails. the default is true. return value type: list usage each executed merge method counts against the governor limit for dml statements. merge(masterrecord, duplicateid, accesslevel) merges the specified duplicate record into the master sobject record of the same type, deleting the duplicate, and reparenting any related records. merges only accounts, contacts, or leads. signature public static database.mergeresult merge(sobject masterrecord, id duplicateid, system.accesslevel accesslevel) parameters masterrecord type: sobject the master sobject record the duplicate record is merged into. duplicateid type: id the id of the record to merge with the master. this record must be of the same sobject type as the master. accesslevel type: system.access" "level (optional) the accesslevel parameter specifies whether the method runs in system mode (accesslevel.system_mode) or user mode (accesslevel.user_mode). in system mode, the object and field-level permissions of the current user are ignored, and the record sharing rules are controlled by the class sharing keywords. in user mode, the object permissions, field-level security, and sharing rules of the current user are enforced. system mode is the default. return value type: database.mergeresult usage each executed merge method counts against the governor limit for dml statements. 2918apex reference guide database class merge(masterrecord, duplicaterecord, accesslevel) merges the specified duplicate sobject record into the master sobject of the same type, deleting the duplicate, and reparenting any related records. signature public static database.mergeresult merge(sobject masterrecord, sobject duplicaterecord, system.accesslevel accesslevel) parameters masterrecord type: sobject the master sobject record the duplicate record is merged into. duplicaterecord type: sobject the sobject record to merge with the master. this sobject must be of the same type as the master. accesslevel type: system.accesslevel (optional) the accesslevel parameter specifies whether the method runs in system mode (accesslevel.system_mode) or user mode (accesslevel.user_mode). in system mode, the object and field-level permissions of the current user are ignored, and the record sharing rules are controlled by the class sharing keywords. in user mode, the object permissions, field-level security, and sharing rules of the current user are enforced. system mode is the default. return value type: database.mergeresult usage each executed merge method counts against the governor limit for dml statements. merge(masterrecord, duplicateids, accesslevel) merges up to two records of the same sobject type into the master sobject record, deleting the others, and reparenting any related records. signature public static list merge(sobject masterrecord, list duplicateids, system.accesslevel accesslevel) parameters masterrecord type: sobject the master sobject record the other records are merged into. 2919apex reference guide database class duplicateids type: list a list of ids of up to two records to merge with the master. these records must be of the same sobject type as the master. accesslevel type: system.accesslevel (optional) the accesslevel parameter specifies whether the method runs in system mode (accesslevel.system_mode) or user mode (accesslevel.user_mode). in system mode, the object and field-level permissions of the current user are ignored, and the record sharing rules are controlled by the class sharing keywords. in user mode, the object permissions, field-level security, and sharing rules of the current user are enforced. system mode is the default. return value type: list usage each executed merge method counts against the governor limit for dml statements. merge(masterrecord, duplicaterecords, accesslevel) merges up to two records of the same object type into the master sobject record, deleting the others, and reparenting any related records. signature public static list merge(sobject masterrecord, list duplicaterecords, system.accesslevel accesslevel) parameters masterrecord type: sobject the master sobject record the other sobjects are merged into. duplicaterecords type: list a list of up to two sobject records to merge with the master. these sobjects must be of the same type as the master. accesslevel type: system.accesslevel (optional) the accesslevel parameter specifies whether the method runs in system mode (accesslevel.system_mode) or user mode (accesslevel.user_mode). in system mode, the object and field-level permissions of the current user are ignored, and the record sharing rules are controlled by the class sharing keywords. in user mode, the object permissions, field-level security, and sharing rules of the current user are enforced. system mode is the default. return value type: list 2920apex reference guide database class usage each executed merge method counts against the governor limit for dml statements. merge(masterrecord" ", duplicateid, allornone, accesslevel) merges the specified duplicate record into the master sobject record of the same type, optionally returning errors, if any, deleting the duplicate, and reparenting any related records. merges only accounts, contacts, or leads. signature public static database.mergeresult merge(sobject masterrecord, id duplicateid, boolean allornone, system.accesslevel accesslevel) parameters masterrecord type: sobject the master sobject record the duplicate record is merged into. duplicateid type: id the id of the record to merge with the master. this record must be of the same sobject type as the master. allornone type: boolean set to false to return any errors encountered in this operation as part of the returned result. if set to true, this method throws an exception if the operation fails. the default is true. accesslevel type: system.accesslevel (optional) the accesslevel parameter specifies whether the method runs in system mode (accesslevel.system_mode) or user mode (accesslevel.user_mode). in system mode, the object and field-level permissions of the current user are ignored, and the record sharing rules are controlled by the class sharing keywords. in user mode, the object permissions, field-level security, and sharing rules of the current user are enforced. system mode is the default. return value type: database.mergeresult usage if you use the accesslevel parameter to specify that the method runs in user mode, we report all encountered inaccessible fields. the way to retrieve the names of these inaccessible fields depends on the value of this method's allornone parameter, or the equivalent dmloptions.optallornone property. if you specify that: • allornone=true or dmloptions.optallornone=true: catch the dmlexception and use the dmlexception.getdmlfieldnames() method to retrieve the list of inaccessible fields. see exception class and built-in exceptions for more information. 2921apex reference guide database class • allornone=false or dmloptions.optallornone=false: for each failing record, we update the database.error object that results from the dml operation. use the error.getfields() method to retrieve the list of inaccessible fields. see the error class methods for more information. each executed merge method counts against the governor limit for dml statements. merge(masterrecord, duplicaterecord, allornone, accesslevel) merges the specified duplicate sobject record into the master sobject of the same type, optionally returning errors, if any, deleting the duplicate, and reparenting any related records. signature public static database.mergeresult merge(sobject masterrecord, sobject duplicaterecord, boolean allornone, system.accesslevel accesslevel) parameters masterrecord type: sobject the master sobject record the duplicate record is merged into. duplicaterecord type: sobject the sobject record to merge with the master. this sobject must be of the same type as the master. allornone type: boolean set to false to return any errors encountered in this operation as part of the returned result. if set to true, this method throws an exception if the operation fails. the default is true. accesslevel type: system.accesslevel (optional) the accesslevel parameter specifies whether the method runs in system mode (accesslevel.system_mode) or user mode (accesslevel.user_mode). in system mode, the object and field-level permissions of the current user are ignored, and the record sharing rules are controlled by the class sharing keywords. in user mode, the object permissions, field-level security, and sharing rules of the current user are enforced. system mode is the default. return value type: database.mergeresult usage if you use the accesslevel parameter to specify that the method runs in user mode, we report all encountered inaccessible fields. the way to retrieve the names of these inaccessible fields depends on the value of this method's allornone parameter, or the equivalent dmloptions.optallornone property. if you specify that: • allornone=true or dmloptions.optallornone=true: catch the dmlexception and use the dmlexception.getdmlfieldnames() method to retrieve the list of inaccessible fields. see exception class and built-in exceptions for more information. 2922apex reference guide database class • allornone=false or dmloptions." "optallornone=false: for each failing record, we update the database.error object that results from the dml operation. use the error.getfields() method to retrieve the list of inaccessible fields. see the error class methods for more information. each executed merge method counts against the governor limit for dml statements. merge(masterrecord, duplicateids, allornone, accesslevel) merges up to two records of the same sobject type into the master sobject record, optionally returning errors, if any, deleting the duplicates, and reparenting any related records. signature public static list merge(sobject masterrecord, list duplicateids, boolean allornone, system.accesslevel accesslevel) parameters masterrecord type: sobject the master sobject record the other records are merged into. duplicateids type: list a list of ids of up to two records to merge with the master. these records must be of the same sobject type as the master. allornone type: boolean set to false to return any errors encountered in this operation as part of the returned result. if set to true, this method throws an exception if the operation fails. the default is true. accesslevel type: system.accesslevel (optional) the accesslevel parameter specifies whether the method runs in system mode (accesslevel.system_mode) or user mode (accesslevel.user_mode). in system mode, the object and field-level permissions of the current user are ignored, and the record sharing rules are controlled by the class sharing keywords. in user mode, the object permissions, field-level security, and sharing rules of the current user are enforced. system mode is the default. return value type: list usage if you use the accesslevel parameter to specify that the method runs in user mode, we report all encountered inaccessible fields. the way to retrieve the names of these inaccessible fields depends on the value of this method's allornone parameter, or the equivalent dmloptions.optallornone property. if you specify that: • allornone=true or dmloptions.optallornone=true: catch the dmlexception and use the dmlexception.getdmlfieldnames() method to retrieve the list of inaccessible fields. see exception class and built-in exceptions for more information. 2923apex reference guide database class • allornone=false or dmloptions.optallornone=false: for each failing record, we update the database.error object that results from the dml operation. use the error.getfields() method to retrieve the list of inaccessible fields. see the error class methods for more information. each executed merge method counts against the governor limit for dml statements. merge(masterrecord, duplicaterecords, allornone, accesslevel) merges up to two records of the same object type into the master sobject record, optionally returning errors, if any, deleting the duplicates, and reparenting any related records. signature public static list merge(sobject masterrecord, list duplicaterecords, boolean allornone, system.accesslevel accesslevel) parameters masterrecord type: sobject the master sobject record the other sobjects are merged into. duplicaterecords type: list a list of up to two sobject records to merge with the master. these sobjects must be of the same type as the master. allornone type: boolean set to false to return any errors encountered in this operation as part of the returned result. if set to true, this method throws an exception if the operation fails. the default is true. accesslevel type: system.accesslevel (optional) the accesslevel parameter specifies whether the method runs in system mode (accesslevel.system_mode) or user mode (accesslevel.user_mode). in system mode, the object and field-level permissions of the current user are ignored, and the record sharing rules are controlled by the class sharing keywords. in user mode, the object permissions, field-level security, and sharing rules of the current user are enforced. system mode is the default. return value type: list usage if you use the accesslevel parameter to specify that the method runs in user mode, we report all encountered inaccessible fields. the way to retrieve the names of these inaccessible fields depends on the value of" "this method's allornone parameter, or the equivalent dmloptions.optallornone property. if you specify that: • allornone=true or dmloptions.optallornone=true: catch the dmlexception and use the dmlexception.getdmlfieldnames() method to retrieve the list of inaccessible fields. see exception class and built-in exceptions for more information. 2924apex reference guide database class • allornone=false or dmloptions.optallornone=false: for each failing record, we update the database.error object that results from the dml operation. use the error.getfields() method to retrieve the list of inaccessible fields. see the error class methods for more information. each executed merge method counts against the governor limit for dml statements. query(querystring) creates a dynamic soql query at runtime. signature public static list query(string querystring) parameters querystring type: string return value type: list on page 3123 usage this method can be used wherever a static soql query can be used, such as in regular assignment statements and for loops. unlike inline soql, fields in bind variables are not supported. for more information, see dynamic soql. each executed query method counts against the governor limit for soql queries. query(querystring, accesslevel) creates a dynamic soql query at runtime. signature public static list query(string querystring, system.accesslevel accesslevel) parameters querystring type: string accesslevel type: system.accesslevel (optional) the accesslevel parameter specifies whether the method runs in system mode (accesslevel.system_mode) or user mode (accesslevel.user_mode). in system mode, the object and field-level permissions of the current user are ignored, and the record sharing rules are controlled by the class sharing keywords. in user mode, the object permissions, field-level security, and sharing rules of the current user are enforced. system mode is the default. 2925apex reference guide database class return value type: list on page 3123 usage this method can be used wherever a static soql query can be used, such as in regular assignment statements and for loops. unlike inline soql, fields in bind variables are not supported. for more information, see dynamic soql. each executed query method counts against the governor limit for soql queries. querywithbinds(querystring, bindmap, accesslevel) creates a dynamic soql query at runtime. bind variables in the query are resolved from the bindmap map parameter directly with the key, rather than from apex code variables. signature public static list querywithbinds(string querystring, map bindmap, system.accesslevel accesslevel) parameters querystring type: string soql query that includes apex bind variables or expressions preceded by a colon. all bind variables must have a key in the bindmap map. bindmap type: map a map that contains keys for each bind variable specified in the soql querystring and its value. the keys can’t be null or duplicates, and the values can’t be null or empty strings. accesslevel type: system.accesslevel the accesslevel parameter specifies whether the method runs in system mode (accesslevel.system_mode) or user mode (accesslevel.user_mode). in system mode, the object and field-level permissions of the current user are ignored, and the record sharing rules are controlled by the class sharing keywords. in user mode, the object permissions, field-level security, and sharing rules of the current user are enforced. return value type: list on page 3123 usage this method can be used wherever a static soql query can be used, such as in regular assignment statements and for loops. for more information, see dynamic soql. each executed querywithbinds method counts against the governor limit for soql queries. 2926apex reference guide database class example in this example, the soql query uses a bind variable for an account name. its value (acme inc.) is passed in to the method using the namebind map. the accountname variable isn't (and doesn’t have to be) in scope when the query is executed within the method. public static list simplebindingsoqlquery(map bindparams) { string" "querystring = 'select id, name ' + 'from account ' + 'where name = :name'; return database.querywithbinds( querystring, bindparams, accesslevel.user_mode ); } string accountname = 'acme inc.'; map namebind = new map{'name' => accountname}; list accounts = simplebindingsoqlquery(namebind); system.debug(accounts); rollback(databasesavepoint) restores the database to the state specified by the savepoint variable. any emails submitted since the last savepoint are also rolled back and not sent. signature public static void rollback(system.savepoint databasesavepoint) parameters databasesavepoint type: system.savepoint return value type: void usage note the following: • static variables are not reverted during a rollback. if you try to run the trigger again, the static variables retain the values from the first run. • each rollback counts against the governor limit for dml statements. you will receive a runtime error if you try to rollback the database additional times. • the id on an sobject inserted after setting a savepoint is not cleared after a rollback. create an sobject to insert after a rollback. attempting to insert the sobject using the variable created before the rollback fails because the sobject variable has an id. updating or upserting the sobject using the same variable also fails because the sobject is not in the database and, thus, cannot be updated. 2927apex reference guide database class for an example, see transaction control. setsavepoint() returns a savepoint variable that can be stored as a local variable, then used with the rollback method to restore the database to that point. signature public static system.savepoint setsavepoint() return value type: system.savepoint usage note the following: • if you set more than one savepoint, then roll back to a savepoint that is not the last savepoint you generated, the later savepoint variables become invalid. for example, if you generated savepoint sp1 first, savepoint sp2 after that, and then you rolled back to sp1, the variable sp2 would no longer be valid. you will receive a runtime error if you try to use it. • references to savepoints cannot cross trigger invocations because each trigger invocation is a new trigger context. if you declare a savepoint as a static variable then try to use it across trigger contexts, you will receive a run-time error. • each savepoint you set counts against the governor limit for dml statements. for an example, see transaction control. undelete(recordtoundelete, allornone) restores an existing sobject record, such as an individual account or contact, from your organization's recycle bin. signature public static database.undeleteresult undelete(sobject recordtoundelete, boolean allornone) parameters recordtoundelete type: sobject allornone type: boolean the optional allornone parameter specifies whether the operation allows partial success. if you specify false for this parameter and a record fails, the remainder of the dml operation can still succeed. this method returns a result object that can be used to verify which records succeeded, which failed, and why. if the parameter is not set or is set true, an exception is thrown if the method is not successful. return value type: database.undeleteresult 2928apex reference guide database class usage undelete is analogous to the undelete statement in sql. each executed undelete method counts against the governor limit for dml statements. undelete(recordstoundelete, allornone) restores one or more existing sobject records, such as individual accounts or contacts, from your organization’s recycle bin. signature public static database.undeleteresult[] undelete(sobject[] recordstoundelete, boolean allornone) parameters recordstoundelete type: sobject [] allornone type: boolean the optional allornone parameter specifies whether the operation allows partial success. if you specify false for this parameter and a record fails, the remainder of the dml operation can still succeed. this method returns a result object that can be used to verify which records succeeded, which failed, and why. if the parameter is not set or is set true, an exception is thrown if the method is not" "successful. return value type: database.undeleteresult[] usage undelete is analogous to the undelete statement in sql. each executed undelete method counts against the governor limit for dml statements. example the following example restores all accounts named 'universal containers'. the all rows keyword queries all rows for both top-level and aggregate relationships, including deleted records and archived activities. account[] savedaccts = [select id, name from account where name = 'universal containers' all rows]; database.undeleteresult[] udr_dels = database.undelete(savedaccts); undelete(recordid, allornone) restores an existing sobject record, such as an individual account or contact, from your organization's recycle bin. 2929apex reference guide database class signature public static database.undeleteresult undelete(id recordid, boolean allornone) parameters recordid type: id allornone type: boolean the optional allornone parameter specifies whether the operation allows partial success. if you specify false for this parameter and a record fails, the remainder of the dml operation can still succeed. this method returns a result object that can be used to verify which records succeeded, which failed, and why. if the parameter is not set or is set true, an exception is thrown if the method is not successful. return value type: database.undeleteresult usage undelete is analogous to the undelete statement in sql. each executed undelete method counts against the governor limit for dml statements. undelete(recordids, allornone) restores one or more existing sobject records, such as individual accounts or contacts, from your organization’s recycle bin. signature public static database.undeleteresult[] undelete(id[] recordids, boolean allornone) parameters recordids type: id[] allornone type: boolean the optional allornone parameter specifies whether the operation allows partial success. if you specify false for this parameter and a record fails, the remainder of the dml operation can still succeed. this method returns a result object that can be used to verify which records succeeded, which failed, and why. if the parameter is not set or is set true, an exception is thrown if the method is not successful. return value type: database.undeleteresult[] 2930apex reference guide database class usage undelete is analogous to the undelete statement in sql. each executed undelete method counts against the governor limit for dml statements. undelete(recordtoundelete, allornone, accesslevel) restores an existing sobject record, such as an individual account or contact, from your organization's recycle bin. signature public static database.undeleteresult undelete(sobject recordtoundelete, boolean allornone, system.accesslevel accesslevel) parameters recordtoundelete type: sobject allornone type: boolean the optional allornone parameter specifies whether the operation allows partial success. if you specify false for this parameter and a record fails, the remainder of the dml operation can still succeed. this method returns a result object that can be used to verify which records succeeded, which failed, and why. if the parameter is not set or is set true, an exception is thrown if the method is not successful. accesslevel type: system.accesslevel (optional) the accesslevel parameter specifies whether the method runs in system mode (accesslevel.system_mode) or user mode (accesslevel.user_mode). in system mode, the object and field-level permissions of the current user are ignored, and the record sharing rules are controlled by the class sharing keywords. in user mode, the object permissions, field-level security, and sharing rules of the current user are enforced. system mode is the default. return value type: database.undeleteresult usage undelete is analogous to the undelete statement in sql. each executed undelete method counts against the governor limit for dml statements. undelete(recordstoundelete, allornone, accesslevel) restores one or more existing sobject records, such as individual accounts or contacts, from your organization’s recycle bin. signature public static list undelete(list recordstoundelete, boolean allornone, system.accesslevel accesslevel) 2931" "apex reference guide database class parameters recordstoundelete type: list allornone type: boolean the optional allornone parameter specifies whether the operation allows partial success. if you specify false for this parameter and a record fails, the remainder of the dml operation can still succeed. this method returns a result object that can be used to verify which records succeeded, which failed, and why. if the parameter is not set or is set true, an exception is thrown if the method is not successful. accesslevel type: system.accesslevel (optional) the accesslevel parameter specifies whether the method runs in system mode (accesslevel.system_mode) or user mode (accesslevel.user_mode). in system mode, the object and field-level permissions of the current user are ignored, and the record sharing rules are controlled by the class sharing keywords. in user mode, the object permissions, field-level security, and sharing rules of the current user are enforced. system mode is the default. return value type: list usage undelete is analogous to the undelete statement in sql. each executed undelete method counts against the governor limit for dml statements. undelete(recordid, allornone, accesslevel) restores an existing sobject record, such as an individual account or contact, from your organization's recycle bin. signature public static database.undeleteresult undelete(id recordid, boolean allornone, system.accesslevel accesslevel) parameters recordid type: id allornone type: boolean the optional allornone parameter specifies whether the operation allows partial success. if you specify false for this parameter and a record fails, the remainder of the dml operation can still succeed. this method returns a result object that can be used to verify which records succeeded, which failed, and why. if the parameter is not set or is set true, an exception is thrown if the method is not successful. accesslevel type: system.accesslevel 2932" "apex reference guide database class (optional) the accesslevel parameter specifies whether the method runs in system mode (accesslevel.system_mode) or user mode (accesslevel.user_mode). in system mode, the object and field-level permissions of the current user are ignored, and the record sharing rules are controlled by the class sharing keywords. in user mode, the object permissions, field-level security, and sharing rules of the current user are enforced. system mode is the default. return value type: database.undeleteresult usage undelete is analogous to the undelete statement in sql. each executed undelete method counts against the governor limit for dml statements. undelete(recordids, allornone, accesslevel) restores one or more existing sobject records, such as individual accounts or contacts, from your organization’s recycle bin. signature public static list undelete(list recordids, boolean allornone, system.accesslevel accesslevel) parameters recordids type: list allornone type: boolean the optional allornone parameter specifies whether the operation allows partial success. if you specify false for this parameter and a record fails, the remainder of the dml operation can still succeed. this method returns a result object that can be used to verify which records succeeded, which failed, and why. if the parameter is not set or is set true, an exception is thrown if the method is not successful. accesslevel type: system.accesslevel (optional) the accesslevel parameter specifies whether the method runs in system mode (accesslevel.system_mode) or user mode (accesslevel.user_mode). in system mode, the object and field-level permissions of the current user are ignored, and the record sharing rules are controlled by the class sharing keywords. in user mode, the object permissions, field-level security, and sharing rules of the current user are enforced. system mode is the default. return value type: list usage undelete is analogous to the undelete statement in sql. each executed undelete method counts against the governor limit for dml statements. 2933apex reference guide database class update(recordtoupdate, allornone) modifies an existing sobject record, such as an individual account or contact, in your organization's data. signature public static database.saveresult update(sobject recordtoupdate, boolean allornone) parameters recordtoupdate type: sobject allornone type: boolean the optional allornone parameter specifies whether the operation allows partial success. if you specify false for this parameter and a record fails, the remainder of the dml operation can still succeed. this method returns a result object that can be used to verify which records succeeded, which failed, and why. if the parameter is not set or is set true, an exception is thrown if the method is not successful. return value type: database.saveresult usage update is analogous to the update statement in sql. apex classes and triggers saved (compiled) using api version 15.0 and higher produce a runtime error if you assign a string value that is too long for the field. each executed update method counts against the governor limit for dml statements. example the following example updates the billingcity field on a single account. account a = new account(name='sfdc'); insert(a); account myacct = [select id, name, billingcity from account where id = :a.id]; myacct.billingcity = 'san francisco'; database.saveresult sr = database.update(myacct); update(recordstoupdate, allornone) modifies one or more existing sobject records, such as individual accounts or contacts, in your organization’s data. 2934apex reference guide database class signature public static database.saveresult[] update(sobject[] recordstoupdate, boolean allornone) parameters recordstoupdate type: sobject [] allornone type: boolean the optional allornone parameter specifies whether the operation allows partial success. if you specify false for this parameter and a record fails, the remainder of the dml operation can still succeed. this method returns a result object that can be used to verify which records succeeded, which failed, and why. if the parameter is not set or is set true, an exception is thrown if the method is not successful. return value type: database.save" "result[] usage update is analogous to the update statement in sql. each executed update method counts against the governor limit for dml statements. update(recordtoupdate, dmloptions) modifies an existing sobject record, such as an individual account or contact, in your organization's data. signature public static database.saveresult update(sobject recordtoupdate, database.dmloptions dmloptions) parameters recordtoupdate type: sobject dmloptions type: database.dmloptions the optional dmloptions parameter specifies additional data for the transaction, such as assignment rule information or rollback behavior when errors occur during record insertions. return value type: database.saveresult usage update is analogous to the update statement in sql. 2935apex reference guide database class apex classes and triggers saved (compiled) using api version 15.0 and higher produce a runtime error if you assign a string value that is too long for the field. each executed update method counts against the governor limit for dml statements. update(recordstoupdate, dmloptions) modifies one or more existing sobject records, such as individual accounts or contacts, in your organization’s data. signature public static database.saveresult[] update(sobject[] recordstoupdate, database.dmloptions dmloptions) parameters recordstoupdate type: sobject [] dmloptions type: database.dmloptions the optional dmloptions parameter specifies additional data for the transaction, such as assignment rule information or rollback behavior when errors occur during record insertions. return value type: database.saveresult[] usage update is analogous to the update statement in sql. apex classes and triggers saved (compiled) using api version 15.0 and higher produce a runtime error if you assign a string value that is too long for the field. each executed update method counts against the governor limit for dml statements. update(recordtoupdate, allornone, accesslevel) modifies an existing sobject record, such as an individual account or contact, in your organization's data. signature public static database.saveresult update(sobject recordtoupdate, boolean allornone, system.accesslevel accesslevel) parameters recordtoupdate type: sobject allornone type: boolean 2936apex reference guide database class the optional allornone parameter specifies whether the operation allows partial success. if you specify false for this parameter and a record fails, the remainder of the dml operation can still succeed. this method returns a result object that can be used to verify which records succeeded, which failed, and why. if the parameter is not set or is set true, an exception is thrown if the method is not successful. accesslevel type: system.accesslevel (optional) the accesslevel parameter specifies whether the method runs in system mode (accesslevel.system_mode) or user mode (accesslevel.user_mode). in system mode, the object and field-level permissions of the current user are ignored, and the record sharing rules are controlled by the class sharing keywords. in user mode, the object permissions, field-level security, and sharing rules of the current user are enforced. system mode is the default. return value type: database.saveresult usage if you use the accesslevel parameter to specify that the method runs in user mode, we report all encountered inaccessible fields. the way to retrieve the names of these inaccessible fields depends on the value of this method's allornone parameter, or the equivalent dmloptions.optallornone property. if you specify that: • allornone=true or dmloptions.optallornone=true: catch the dmlexception and use the dmlexception.getdmlfieldnames() method to retrieve the list of inaccessible fields. see exception class and built-in exceptions for more information. • allornone=false or dmloptions.optallornone=false: for each failing record, we update the database.error object that results from the dml operation. use the error.getfields() method to retrieve the list of inaccessible fields. see the error class methods for more information. update(recordstoupdate, allornone, accesslevel) modifies one or more existing sobject records, such as individual accounts or contacts, in your organization’s data. signature public static list update(list recordstoupdate, boolean allornone, system.accesslevel accesslevel) parameters recordstoupdate type" ": list allornone type: boolean the optional allornone parameter specifies whether the operation allows partial success. if you specify false for this parameter and a record fails, the remainder of the dml operation can still succeed. this method returns a result object that can be used to verify which records succeeded, which failed, and why. if the parameter is not set or is set true, an exception is thrown if the method is not successful. accesslevel type: system.accesslevel 2937apex reference guide database class (optional) the accesslevel parameter specifies whether the method runs in system mode (accesslevel.system_mode) or user mode (accesslevel.user_mode). in system mode, the object and field-level permissions of the current user are ignored, and the record sharing rules are controlled by the class sharing keywords. in user mode, the object permissions, field-level security, and sharing rules of the current user are enforced. system mode is the default. return value type: list usage if you use the accesslevel parameter to specify that the method runs in user mode, we report all encountered inaccessible fields. the way to retrieve the names of these inaccessible fields depends on the value of this method's allornone parameter, or the equivalent dmloptions.optallornone property. if you specify that: • allornone=true or dmloptions.optallornone=true: catch the dmlexception and use the dmlexception.getdmlfieldnames() method to retrieve the list of inaccessible fields. see exception class and built-in exceptions for more information. • allornone=false or dmloptions.optallornone=false: for each failing record, we update the database.error object that results from the dml operation. use the error.getfields() method to retrieve the list of inaccessible fields. see the error class methods for more information. update(recordtoupdate, dmloptions, accesslevel) modifies an existing sobject record, such as an individual account or contact, in your organization's data. signature public static database.saveresult update(sobject recordtoupdate, database.dmloptions dmloptions, system.accesslevel accesslevel) parameters recordtoupdate type: sobject dmloptions type: database.dmloptions the optional dmloptions parameter specifies additional data for the transaction, such as assignment rule information or rollback behavior when errors occur during record insertions. accesslevel type: system.accesslevel (optional) the accesslevel parameter specifies whether the method runs in system mode (accesslevel.system_mode) or user mode (accesslevel.user_mode). in system mode, the object and field-level permissions of the current user are ignored, and the record sharing rules are controlled by the class sharing keywords. in user mode, the object permissions, field-level security, and sharing rules of the current user are enforced. system mode is the default. return value type: database.saveresult 2938apex reference guide database class update(recordstoupdate, dmloptions, accesslevel) modifies one or more existing sobject records, such as individual accounts or contacts, in your organization’s data. signature public static list update(list recordstoupdate, database.dmloptions dmloptions, system.accesslevel accesslevel) parameters recordstoupdate type: list dmloptions type: database.dmloptions the optional dmloptions parameter specifies additional data for the transaction, such as assignment rule information or rollback behavior when errors occur during record insertions. accesslevel type: system.accesslevel (optional) the accesslevel parameter specifies whether the method runs in system mode (accesslevel.system_mode) or user mode (accesslevel.user_mode). in system mode, the object and field-level permissions of the current user are ignored, and the record sharing rules are controlled by the class sharing keywords. in user mode, the object permissions, field-level security, and sharing rules of the current user are enforced. system mode is the default. return value type: list upsert(recordtoupsert, externalidfield, allornone) creates a new sobject record or updates an existing sobject record within a single statement, using a specified field to determine the presence of existing objects, or the id field if no field is specified. signature public static database.u" "psertresult upsert(sobject recordtoupsert, schema.sobjectfield externalidfield, boolean allornone) parameters recordtoupsert type: sobject externalidfield type: schema.sobjectfield (optional) the externalidfield is of type schema.sobjectfield, that is, a field token. find the token for the field by using the fields special method. for example, schema.sobjectfield f = account.fields.myexternalid. the externalidfield parameter is the field that upsert() uses to match sobjects with existing records. this field can be a custom field marked as external id, or a standard field with the idlookup attribute. 2939apex reference guide database class note: if externalidfield isn’t specified, then the id field is used to determine a match with existing records. allornone type: boolean the optional allornone parameter specifies whether the operation allows partial success. if you specify false for this parameter and a record fails, the remainder of the dml operation can still succeed. this method returns a result object that can be used to verify which records succeeded, which failed, and why. if the parameter is not set or is set true, an exception is thrown if the method is not successful. return value type: database.upsertresult usage apex classes and triggers saved (compiled) using api version 15.0 and higher produce a runtime error if you assign a string value that is too long for the field. each executed upsert method counts against the governor limit for dml statements. for more information on how the upsert operation works, see the upsert() statement. upsert(recordstoupsert, externalidfield, allornone) creates new sobject records or updates existing sobject records within a single statement, using a specified field to determine the presence of existing objects, or the id field if no field is specified. signature public static database.upsertresult[] upsert(sobject[] recordstoupsert, schema.sobjectfield externalidfield, boolean allornone) parameters recordstoupsert type: sobject [] externalidfield type: schema.sobjectfield (optional) the externalidfield is of type schema.sobjectfield, that is, a field token. find the token for the field by using the fields special method. for example, schema.sobjectfield f = account.fields.myexternalid. the externalidfield parameter is the field that upsert() uses to match sobjects with existing records. this field can be a custom field marked as external id, or a standard field with the idlookup attribute. note: if externalidfield isn’t specified, then the id field is used to determine a match with existing records. allornone type: boolean the optional allornone parameter specifies whether the operation allows partial success. if you specify false for this parameter and a record fails, the remainder of the dml operation can still succeed. this method returns a result object that can be used to verify which records succeeded, which failed, and why. if the parameter isn’t set or is set true, an exception is thrown if the method 2940apex reference guide database class isn’t successful. if the parameter is specified as false and a before-trigger assigns an invalid value to a field, the partial set of valid records isn’t inserted. return value type: database.upsertresult[] usage apex classes and triggers saved (compiled) using api version 15.0 and higher produce a runtime error if you assign a string value that is too long for the field. each executed upsert method counts against the governor limit for dml statements. for more information on how the upsert operation works, see the upsert() statement. upsert(recordtoupsert, externalidfield, allornone, accesslevel) creates a new sobject record or updates an existing sobject record within a single statement, using a specified field to determine the presence of existing objects, or the id field if no field is specified. signature public static database.upsertresult upsert(sobject recordtoupsert, schema.sobjectfield externalidfield, boolean allornone, system.accesslevel accesslevel) parameters recordtoupsert type: sobject externalidfield type: schema.sobjectfield (optional) the externalidfield is of type schema" ".sobjectfield, that is, a field token. find the token for the field by using the fields special method. for example, schema.sobjectfield f = account.fields.myexternalid. the externalidfield parameter is the field that upsert() uses to match sobjects with existing records. this field can be a custom field marked as external id, or a standard field with the idlookup attribute. note: if externalidfield isn’t specified, then the id field is used to determine a match with existing records. allornone type: boolean the optional allornone parameter specifies whether the operation allows partial success. if you specify false for this parameter and a record fails, the remainder of the dml operation can still succeed. this method returns a result object that can be used to verify which records succeeded, which failed, and why. if the parameter is not set or is set true, an exception is thrown if the method is not successful. accesslevel type: system.accesslevel (optional) the accesslevel parameter specifies whether the method runs in system mode (accesslevel.system_mode) or user mode (accesslevel.user_mode). in system mode, the object and field-level permissions of the current user are 2941apex reference guide database class ignored, and the record sharing rules are controlled by the class sharing keywords. in user mode, the object permissions, field-level security, and sharing rules of the current user are enforced. system mode is the default. return value type: database.upsertresult usage if you use the accesslevel parameter to specify that the method runs in user mode, we report all encountered inaccessible fields. the way to retrieve the names of these inaccessible fields depends on the value of this method's allornone parameter, or the equivalent dmloptions.optallornone property. if you specify that: • allornone=true or dmloptions.optallornone=true: catch the dmlexception and use the dmlexception.getdmlfieldnames() method to retrieve the list of inaccessible fields. see exception class and built-in exceptions for more information. • allornone=false or dmloptions.optallornone=false: for each failing record, we update the database.error object that results from the dml operation. use the error.getfields() method to retrieve the list of inaccessible fields. see the error class methods for more information. apex classes and triggers saved (compiled) using api version 15.0 and higher produce a runtime error if you assign a string value that is too long for the field. each executed upsert method counts against the governor limit for dml statements. for more information on how the upsert operation works, see the upsert() statement. upsert(recordstoupsert, externalidfield, allornone, accesslevel) creates new sobject records or updates existing sobject records within a single statement, using a specified field to determine the presence of existing objects, or the id field if no field is specified. signature public static list upsert(list recordstoupsert, schema.sobjectfield externalidfield, boolean allornone, system.accesslevel accesslevel) parameters recordstoupsert type: list externalidfield type: schema.sobjectfield (optional) the externalidfield is of type schema.sobjectfield, that is, a field token. find the token for the field by using the fields special method. for example, schema.sobjectfield f = account.fields.myexternalid. the externalidfield parameter is the field that upsert() uses to match sobjects with existing records. this field can be a custom field marked as external id, or a standard field with the idlookup attribute. note: if externalidfield isn’t specified, then the id field is used to determine a match with existing records. allornone type: boolean 2942apex reference guide database class the optional allornone parameter specifies whether the operation allows partial success. if you specify false for this parameter and a record fails, the remainder of the dml operation can still succeed. this method returns a result object that can be used to verify which records succeeded, which failed, and why. if the parameter isn’t set or is set true, an exception is thrown if the method isn’t successful. if the parameter is specified as false and a before-trigger assigns an invalid value" "to a field, the partial set of valid records isn’t inserted. accesslevel type: system.accesslevel (optional) the accesslevel parameter specifies whether the method runs in system mode (accesslevel.system_mode) or user mode (accesslevel.user_mode). in system mode, the object and field-level permissions of the current user are ignored, and the record sharing rules are controlled by the class sharing keywords. in user mode, the object permissions, field-level security, and sharing rules of the current user are enforced. system mode is the default. return value type: list usage if you use the accesslevel parameter to specify that the method runs in user mode, we report all encountered inaccessible fields. the way to retrieve the names of these inaccessible fields depends on the value of this method's allornone parameter, or the equivalent dmloptions.optallornone property. if you specify that: • allornone=true or dmloptions.optallornone=true: catch the dmlexception and use the dmlexception.getdmlfieldnames() method to retrieve the list of inaccessible fields. see exception class and built-in exceptions for more information. • allornone=false or dmloptions.optallornone=false: for each failing record, we update the database.error object that results from the dml operation. use the error.getfields() method to retrieve the list of inaccessible fields. see the error class methods for more information. apex classes and triggers saved (compiled) using api version 15.0 and higher produce a runtime error if you assign a string value that is too long for the field. each executed upsert method counts against the governor limit for dml statements. for more information on how the upsert operation works, see the upsert() statement. updateasync(sobjects, callback) initiates requests to update external object data on the relevant external systems. the requests are executed asynchronously, as background operations, and are sent to the external systems that are defined by the external objects' associated external data sources. allows referencing a callback class whose processsave method is called for each record after the remote operations are completed. signature public static list updateasync(list sobjects, datasource.asyncsavecallback callback) parameters sobjects type: list 2943apex reference guide database class list of external object records to modify. callback type: datasource.asyncsavecallback the callback object that contains the state in the originating context and an action (the processsave method) that executes after the insert operation is completed. use the action callback to update org data according to the operation’s results. the callback object must extend datasource.asyncsavecallback. return value type: list status results for the update operation. each result corresponds to a record processed by this asynchronous operation and is associated with a unique identifier (asynclocator). the asynclocator value is included in the errors array of the result. you can retrieve this identifier with database.getasynclocator(). retrieve the final result with database.getasyncsaveresult(). updateasync(sobject, callback) initiates a request to update external object data on the relevant external system. the request is executed asynchronously, as a background operation, and is sent to the external system that's defined by the external object's associated external data source. allows referencing a callback class whose processsave method is called after the remote operation is completed. signature public static database.saveresult updateasync(sobject sobject, datasource.asyncsavecallback callback) parameters sobject type: sobject external object record to modify. callback type: datasource.asyncsavecallback the callback object that contains the state in the originating context and an action (the processsave method) that executes after the insert operation is completed. use the action callback to update org data according to the operation’s results. the callback object must extend datasource.asyncsavecallback. return value type: database.saveresult status result for the insert operation. the result corresponds to a record processed by this asynchronous operation and is associated with a unique identifier (asynclocator). the asynclocator value is included in the errors array of the result. you can retrieve this identifier with database.getasynclocator(). retrieve the final result with database.getasyncsaveresult(). updateasync(sobjects) initiates" "requests to update external object data on the relevant external systems. the requests are executed asynchronously, as background operations, and are sent to the external systems that are defined by the external objects' associated external data sources. 2944apex reference guide database class signature public static list updateasync(list sobjects) parameters sobjects type: list list of external object records to modify. return value type: list status results for the update operation. each result corresponds to a record processed by this asynchronous operation and is associated with a unique identifier (asynclocator). the asynclocator value is included in the errors array of the result. you can retrieve this identifier with database.getasynclocator(). retrieve the final result with database.getasyncsaveresult(). updateasync(sobject) initiates a request to update external object data on the relevant external system. the request is executed asynchronously, as a background operation, and is sent to the external system that's defined by the external object's associated external data source. signature public static database.saveresult updateasync(sobject sobject) parameters sobject type: sobject external object record to modify. return value type: database.saveresult status result for the insert operation. the result corresponds to a record processed by this asynchronous operation and is associated with a unique identifier (asynclocator). the asynclocator value is included in the errors array of the result. you can retrieve this identifier with database.getasynclocator(). retrieve the final result with database.getasyncsaveresult(). updateasync(sobjects, callback, accesslevel) initiates requests to update external object data on the relevant external systems. the requests are executed asynchronously, as background operations, and are sent to the external systems that are defined by the external objects' associated external data sources. allows referencing a callback class whose processsave method is called for each record after the remote operations are completed. signature public static list updateasync(list sobjects, datasource.asyncsavecallback callback, system.accesslevel accesslevel) 2945apex reference guide database class parameters sobjects type: list list of external object records to modify. callback type: datasource.asyncsavecallback the callback object that contains the state in the originating context and an action (the processsave method) that executes after the insert operation is completed. the execution is in system mode regardless of the accesslevel parameter. use the action callback to update org data according to the operation’s results. the callback object must extend datasource.asyncsavecallback. accesslevel type: system.accesslevel (optional) the accesslevel parameter specifies whether the method runs in system mode (accesslevel.system_mode) or user mode (accesslevel.user_mode). in system mode, the object and field-level permissions of the current user are ignored, and the record sharing rules are controlled by the class sharing keywords. in user mode, the object permissions, field-level security, and sharing rules of the current user are enforced. system mode is the default. return value type: list status results for the update operation. each result corresponds to a record processed by this asynchronous operation and is associated with a unique identifier (asynclocator). the asynclocator value is included in the errors array of the result. you can retrieve this identifier with database.getasynclocator(). retrieve the final result with database.getasyncsaveresult(). updateasync(sobject, callback, accesslevel) initiates a request to update external object data on the relevant external system. the request is executed asynchronously, as a background operation, and is sent to the external system that's defined by the external object's associated external data source. allows referencing a callback class whose processsave method is called after the remote operation is completed. signature public static database.saveresult updateasync(sobject sobject, datasource.asyncsavecallback callback, system.accesslevel accesslevel) parameters sobject type: sobject external object record to modify. callback type: datasource.asyncsavecallback the callback object that contains the state in the originating context and an action (the processsave method) that executes after the insert operation is completed. the execution is in system mode regardless of the accesslevel parameter. use the action callback to update org data according to the operation’s" "results. the callback object must extend datasource.asyncsavecallback. 2946apex reference guide database class accesslevel type: system.accesslevel (optional) the accesslevel parameter specifies whether the method runs in system mode (accesslevel.system_mode) or user mode (accesslevel.user_mode). in system mode, the object and field-level permissions of the current user are ignored, and the record sharing rules are controlled by the class sharing keywords. in user mode, the object permissions, field-level security, and sharing rules of the current user are enforced. system mode is the default. return value type: database.saveresult status result for the insert operation. the result corresponds to a record processed by this asynchronous operation and is associated with a unique identifier (asynclocator). the asynclocator value is included in the errors array of the result. you can retrieve this identifier with database.getasynclocator(). retrieve the final result with database.getasyncsaveresult(). updateasync(sobjects, accesslevel) initiates requests to update external object data on the relevant external systems. the requests are executed asynchronously, as background operations, and are sent to the external systems that are defined by the external objects' associated external data sources. signature public static list updateasync(list sobjects, system.accesslevel accesslevel) parameters sobjects type: list list of external object records to modify. accesslevel type: system.accesslevel (optional) the accesslevel parameter specifies whether the method runs in system mode (accesslevel.system_mode) or user mode (accesslevel.user_mode). in system mode, the object and field-level permissions of the current user are ignored, and the record sharing rules are controlled by the class sharing keywords. in user mode, the object permissions, field-level security, and sharing rules of the current user are enforced. system mode is the default. return value type: list status results for the update operation. each result corresponds to a record processed by this asynchronous operation and is associated with a unique identifier (asynclocator). the asynclocator value is included in the errors array of the result. you can retrieve this identifier with database.getasynclocator(). retrieve the final result with database.getasyncsaveresult(). updateasync(sobject, accesslevel) initiates a request to update external object data on the relevant external system. the request is executed asynchronously, as a background operation, and is sent to the external system that's defined by the external object's associated external data source. 2947apex reference guide database class signature public static database.saveresult updateasync(sobject sobject, system.accesslevel accesslevel) parameters sobject type: sobject external object record to modify. accesslevel type: system.accesslevel (optional) the accesslevel parameter specifies whether the method runs in system mode (accesslevel.system_mode) or user mode (accesslevel.user_mode). in system mode, the object and field-level permissions of the current user are ignored, and the record sharing rules are controlled by the class sharing keywords. in user mode, the object permissions, field-level security, and sharing rules of the current user are enforced. system mode is the default. return value type: database.saveresult status result for the insert operation. the result corresponds to a record processed by this asynchronous operation and is associated with a unique identifier (asynclocator). the asynclocator value is included in the errors array of the result. you can retrieve this identifier with database.getasynclocator(). retrieve the final result with database.getasyncsaveresult(). updateimmediate(sobjects) initiates requests to update external object data on the relevant external systems. the requests are executed synchronously and are sent to the external systems that are defined by the external objects' associated external data sources. if the apex transaction contains pending changes, the synchronous operations can't be completed and throw exceptions. signature public static list updateimmediate(list sobjects) parameters sobjects type: list list of external object records to modify. return value type: list status results for the update operation. 2948apex reference guide database class usage the operation allows partial success. if one or more record updates fail, the method doesn’t throw" "an exception and the remainder of the dml operation can still succeed. the returned saveresult objects indicate whether the operation was successful. if it wasn’t successful, the objects also return the error code and description. updateimmediate(sobject) initiates a request to update external object data on the relevant external system. the request is executed synchronously and is sent to the external system that's defined by the external object's associated external data source. if the apex transaction contains pending changes, the synchronous operation can't be completed and throws an exception. signature public static database.saveresult updateimmediate(sobject sobject) parameters sobject type: sobject external object record to modify. return value type: database.saveresult status result for the update operation. usage if a record update fails, the method doesn’t throw an exception. the returned saveresult object indicates whether the operation was successful. if it wasn’t successful, the object returns the error code and description. updateimmediate(sobjects, accesslevel) initiates requests to update external object data on the relevant external systems. the requests are executed synchronously and are sent to the external systems that are defined by the external objects' associated external data sources. if the apex transaction contains pending changes, the synchronous operations can't be completed and throw exceptions. signature public static list updateimmediate(list sobjects, system.accesslevel accesslevel) parameters sobjects type: list list of external object records to modify. accesslevel type: system.accesslevel 2949apex reference guide database class (optional) the accesslevel parameter specifies whether the method runs in system mode (accesslevel.system_mode) or user mode (accesslevel.user_mode). in system mode, the object and field-level permissions of the current user are ignored, and the record sharing rules are controlled by the class sharing keywords. in user mode, the object permissions, field-level security, and sharing rules of the current user are enforced. system mode is the default. return value type: list status results for the update operation. usage the operation allows partial success. if one or more record updates fail, the method doesn’t throw an exception and the remainder of the dml operation can still succeed. the returned saveresult objects indicate whether the operation was successful. if it wasn’t successful, the objects also return the error code and description. updateimmediate(sobject, accesslevel) initiates a request to update external object data on the relevant external system. the request is executed synchronously and is sent to the external system that's defined by the external object's associated external data source. if the apex transaction contains pending changes, the synchronous operation can't be completed and throws an exception. signature public static database.saveresult updateimmediate(sobject sobject, system.accesslevel accesslevel) parameters sobject type: sobject external object record to modify. accesslevel type: system.accesslevel (optional) the accesslevel parameter specifies whether the method runs in system mode (accesslevel.system_mode) or user mode (accesslevel.user_mode). in system mode, the object and field-level permissions of the current user are ignored, and the record sharing rules are controlled by the class sharing keywords. in user mode, the object permissions, field-level security, and sharing rules of the current user are enforced. system mode is the default. return value type: database.saveresult status result for the update operation. usage if a record update fails, the method doesn’t throw an exception. the returned saveresult object indicates whether the operation was successful. if it failed, the object returns the error code and description. 2950apex reference guide date class date class contains methods for the date primitive data type. namespace system usage for more information on dates, see date data type. date methods the following are methods for date. in this section: adddays(additionaldays) adds the specified number of additional days to a date. addmonths(additionalmonths) adds the specified number of additional months to a date addyears(additionalyears) adds the specified number of additional years to a date day() returns the day-of-month component of a date. dayofyear() returns the day-of-year component of a date. daysbetween(seconddate" ") returns the number of days between the date that called the method and the specified date. daysinmonth(year, month) returns the number of days in the month for the specified year and month (1=jan). format() returns the date as a string using the locale of the context user isleapyear(year) returns true if the specified year is a leap year. issameday(datetocompare) returns true if the date that called the method is the same as the specified date. month() returns the month component of a date (1=jan). monthsbetween(seconddate) returns the number of months between the date that called the method and the specified date, ignoring the difference in days. newinstance(year, month, day) constructs a date from integer representations of the year, month (1=jan), and day. 2951apex reference guide date class parse(stringdate) constructs a date from a string. the format of the string depends on the local date format. today() returns the current date in the current user's time zone. tostartofmonth() returns the first of the month for the date that called the method. tostartofweek() returns the start of the week for the date that called the method, depending on the context user's locale. valueof(stringdate) returns a date that contains the value of the specified string. valueof(fieldvalue) converts the specified object to a date. use this method to convert a history tracking field value or an object that represents a date value. year() returns the year component of a date adddays(additionaldays) adds the specified number of additional days to a date. signature public date adddays(integer additionaldays) parameters additionaldays type: integer return value type: date example date mydate = date.newinstance(1960, 2, 17); date newdate = mydate.adddays(2); addmonths(additionalmonths) adds the specified number of additional months to a date signature public date addmonths(integer additionalmonths) 2952apex reference guide date class parameters additionalmonths type: integer return value type: date example date mydate = date.newinstance(1990, 11, 21); date newdate = mydate.addmonths(3); date expecteddate = date.newinstance(1991, 2, 21); system.assertequals(expecteddate, newdate); addyears(additionalyears) adds the specified number of additional years to a date signature public date addyears(integer additionalyears) parameters additionalyears type: integer return value type: date example date mydate = date.newinstance(1983, 7, 15); date newdate = mydate.addyears(2); date expecteddate = date.newinstance(1985, 7, 15); system.assertequals(expecteddate, newdate); day() returns the day-of-month component of a date. signature public integer day() return value type: integer 2953apex reference guide date class example date mydate = date.newinstance(1989, 4, 21); integer day = mydate.day(); system.assertequals(21, day); dayofyear() returns the day-of-year component of a date. signature public integer dayofyear() return value type: integer example date mydate = date.newinstance(1998, 10, 21); integer day = mydate.dayofyear(); system.assertequals(294, day); daysbetween(seconddate) returns the number of days between the date that called the method and the specified date. signature public integer daysbetween(date seconddate) parameters seconddate type: date return value type: integer usage if the date that calls the method occurs after the seconddate, the return value is negative. example date startdate = date.newinstance(2008, 1, 1); date duedate = date.newinstance(2008, 1, 30); integer numberdaysdue = startdate.daysbetween(duedate); 2954apex reference guide date class daysinmonth(year, month) returns the number of days in the month for the specified year and month (1=jan). signature public static integer daysinmonth(integer year, integer month) parameters year type: integer month type: integer return value" "type: integer example the following example finds the number of days in the month of february in the year 1960. integer numberdays = date.daysinmonth(1960, 2); format() returns the date as a string using the locale of the context user signature public string format() return value type: string example // in american-english locale date mydate = date.newinstance(2001, 3, 21); string daystring = mydate.format(); system.assertequals('3/21/2001', daystring); isleapyear(year) returns true if the specified year is a leap year. signature public static boolean isleapyear(integer year) 2955apex reference guide date class parameters year type: integer return value type: boolean example system.assert(date.isleapyear(2004)); issameday(datetocompare) returns true if the date that called the method is the same as the specified date. signature public boolean issameday(date datetocompare) parameters datetocompare type: date return value type: boolean example date mydate = date.today(); date duedate = date.newinstance(2008, 1, 30); boolean duenow = mydate.issameday(duedate); month() returns the month component of a date (1=jan). signature public integer month() return value type: integer 2956apex reference guide date class example date mydate = date.newinstance(2004, 11, 21); integer month = mydate.month(); system.assertequals(11, month); monthsbetween(seconddate) returns the number of months between the date that called the method and the specified date, ignoring the difference in days. signature public integer monthsbetween(date seconddate) parameters seconddate type: date return value type: integer example date firstdate = date.newinstance(2006, 12, 2); date seconddate = date.newinstance(2012, 12, 8); integer monthsbetween = firstdate.monthsbetween(seconddate); system.assertequals(72, monthsbetween); newinstance(year, month, day) constructs a date from integer representations of the year, month (1=jan), and day. signature public static date newinstance(integer year, integer month, integer day) parameters year type: integer month type: integer day type: integer return value type: date 2957apex reference guide date class example the following example creates the date february 17th, 1960: date mydate = date.newinstance(1960, 2, 17); parse(stringdate) constructs a date from a string. the format of the string depends on the local date format. signature public static date parse(string stringdate) parameters stringdate type: string return value type: date example the following example works in some locales. date mydate = date.parse('12/27/2009'); today() returns the current date in the current user's time zone. signature public static date today() return value type: date tostartofmonth() returns the first of the month for the date that called the method. signature public date tostartofmonth() return value type: date 2958apex reference guide date class example date mydate = date.newinstance(1987, 12, 17); date firstdate = mydate.tostartofmonth(); date expecteddate = date.newinstance(1987, 12, 1); system.assertequals(expecteddate, firstdate); tostartofweek() returns the start of the week for the date that called the method, depending on the context user's locale. signature public date tostartofweek() return value type: date example for example, the start of a week is sunday in the united states locale, and monday in european locales. for example: date mydate = date.today(); date weekstart = mydate.tostartofweek(); valueof(stringdate) returns a date that contains the value of the specified string. signature public static date valueof(string stringdate) parameters stringdate type: string return value type: date usage the specified string should use the standard date format “yyyy-mm-dd hh:mm:ss” in the local time zone. example string year" "= '2008'; string month = '10'; 2959apex reference guide date class string day = '5'; string hour = '12'; string minute = '20'; string second = '20'; string stringdate = year + '-' + month + '-' + day + ' ' + hour + ':' + minute + ':' + second; date mydate = date.valueof(stringdate); valueof(fieldvalue) converts the specified object to a date. use this method to convert a history tracking field value or an object that represents a date value. signature public static date valueof(object fieldvalue) parameters fieldvalue type: object return value type: date usage use this method with the oldvalue or newvalue fields of history sobjects, such as accounthistory, when the field is a date field. example this example converts history tracking fields to date values. list ahlist = [select field,oldvalue,newvalue from accounthistory]; for(accounthistory ah : ahlist) { system.debug('field: ' + ah.field); if (ah.field == 'mydate__c') { date oldvalue = date.valueof(ah.oldvalue); date newvalue = date.valueof(ah.newvalue); } } versioned behavior changes date.valueof has been versioned in these releases. 2960apex reference guide datetime class api version 33.0 or earlier if you call date.valueof with a datetime object, the method returns a date value that contains the hours, minutes, seconds, and milliseconds set. api version 34.0 to api version 53.0 if you call date.valueof with a datetime object, the method converts datetime to a valid date without the time information, but the result depends on the manner in which the datetime object was initialized. for example, if the datetime object was initialized using datetime.valueof(stringdate), the returned date value contains time (hours) information. if the datetime object is initialized using datetime.newinstance(year, month, day, hour, minute, second) the returned date value doesn’t contain time information. api version 54.0 and later if you call date.valueof with a datetime object, the method converts the object to a valid date without the time information. year() returns the year component of a date signature public integer year() return value type: integer example date mydate = date.newinstance(1988, 12, 17); system.assertequals(1988, mydate.year()); datetime class contains methods for the datetime primitive data type. namespace system usage for more information about the datetime, see datetime data type. datetime methods the following are methods for datetime. 2961apex reference guide datetime class in this section: adddays(additionaldays) adds the specified number of days to a datetime. addhours(additionalhours) adds the specified number of hours to a datetime. addminutes(additionalminutes) adds the specified number of minutes to a datetime. addmonths(additionalmonths) adds the specified number of months to a datetime. addseconds(additionalseconds) adds the specified number of seconds to a datetime. addyears(additionalyears) adds the specified number of years to a datetime. date() returns the date component of a datetime in the local time zone of the context user. dategmt() return the date component of a datetime in the gmt time zone. day() returns the day-of-month component of a datetime in the local time zone of the context user. daygmt() returns the day-of-month component of a datetime in the gmt time zone. dayofyear() returns the day-of-year component of a datetime in the local time zone of the context user. dayofyeargmt() returns the day-of-year component of a datetime in the gmt time zone. format() converts the date to the local time zone and returns the converted date as a formatted string using the locale of the context user. if the time zone cannot be determined, gmt is used. format(dateformatstring) converts the date to the local time zone and returns the converted date as a string using the supplied java simple date format. if the time zone cannot be determined, gmt is used." "format(dateformatstring, timezone) converts the date to the specified time zone and returns the converted date as a string using the supplied java simple date format. if the supplied time zone is not in the correct format, gmt is used. formatgmt(dateformatstring) returns a datetime as a string using the supplied java simple date format and the gmt time zone. formatlong() converts the date to the local time zone and returns the converted date in long date format. gettime() returns the number of milliseconds since january 1, 1970, 00:00:00 gmt represented by this datetime object. 2962apex reference guide datetime class hour() returns the hour component of a datetime in the local time zone of the context user. hourgmt() returns the hour component of a datetime in the gmt time zone. issameday(datetocompare) returns true if the datetime that called the method is the same as the specified datetime in the local time zone of the context user. millisecond() return the millisecond component of a datetime in the local time zone of the context user. millisecondgmt() return the millisecond component of a datetime in the gmt time zone. minute() returns the minute component of a datetime in the local time zone of the context user. minutegmt() returns the minute component of a datetime in the gmt time zone. month() returns the month component of a datetime in the local time zone of the context user (1=jan). monthgmt() returns the month component of a datetime in the gmt time zone (1=jan). newinstance(milliseconds) constructs a datetime and initializes it to represent the specified number of milliseconds since january 1, 1970, 00:00:00 gmt. newinstance(date, time) constructs a datetime from the specified date and time in the local time zone. newinstance(year, month, day) constructs a datetime from integer representations of the specified year, month (1=jan), and day at midnight in the local time zone. newinstance(year, month, day, hour, minute, second) constructs a datetime from integer representations of the specified year, month (1=jan), day, hour, minute, and second in the local time zone. newinstancegmt(date, time) constructs a datetime from the specified date and time in the gmt time zone. newinstancegmt(year, month, date) constructs a datetime from integer representations of the specified year, month (1=jan), and day at midnight in the gmt time zone newinstancegmt(year, month, date, hour, minute, second) constructs a datetime from integer representations of the specified year, month (1=jan), day, hour, minute, and second in the gmt time zone now() returns the current datetime based on a gmt calendar. parse(datetimestring) constructs a datetime from the given string in the local time zone and in the format of the user locale. second() returns the second component of a datetime in the local time zone of the context user. 2963apex reference guide datetime class secondgmt() returns the second component of a datetime in the gmt time zone. time() returns the time component of a datetime in the local time zone of the context user. timegmt() returns the time component of a datetime in the gmt time zone. valueof(datetimestring) returns a datetime that contains the value of the specified string. valueof(fieldvalue) converts the specified object to a datetime. use this method to convert a history tracking field value or an object that represents a datetime value. valueofgmt(datetimestring) returns a datetime that contains the value of the specified string. year() returns the year component of a datetime in the local time zone of the context user. yeargmt() returns the year component of a datetime in the gmt time zone. adddays(additionaldays) adds the specified number of days to a datetime. signature public datetime adddays(integer additionaldays) parameters additionaldays type: integer return value type: datetime example datetime mydatetime = datetime.newinstance(1960, 2, 17); datetime newdatetime = mydatetime.adddays(2); datetime expected = datetime.newinstance(1960, 2, 19); system.assertequals(expected, new" "datetime); addhours(additionalhours) adds the specified number of hours to a datetime. 2964apex reference guide datetime class signature public datetime addhours(integer additionalhours) parameters additionalhours type: integer return value type: datetime example datetime mydatetime = datetime.newinstance(1997, 1, 31, 7, 8, 16); datetime newdatetime = mydatetime.addhours(3); datetime expected = datetime.newinstance(1997, 1, 31, 10, 8, 16); system.assertequals(expected, newdatetime); addminutes(additionalminutes) adds the specified number of minutes to a datetime. signature public datetime addminutes(integer additionalminutes) parameters additionalminutes type: integer return value type: datetime example datetime mydatetime = datetime.newinstance(1999, 2, 11, 8, 6, 16); datetime newdatetime = mydatetime.addminutes(7); datetime expected = datetime.newinstance(1999, 2, 11, 8, 13, 16); system.assertequals(expected, newdatetime); addmonths(additionalmonths) adds the specified number of months to a datetime. signature public datetime addmonths(integer additionalmonths) 2965apex reference guide datetime class parameters additionalmonths type: integer return value type: datetime example datetime mydatetime = datetime.newinstance(2000, 7, 7, 7, 8, 12); datetime newdatetime = mydatetime.addmonths(1); datetime expected = datetime.newinstance(2000, 8, 7, 7, 8, 12); system.assertequals(expected, newdatetime); addseconds(additionalseconds) adds the specified number of seconds to a datetime. signature public datetime addseconds(integer additionalseconds) parameters additionalseconds type: integer return value type: datetime example datetime mydatetime = datetime.newinstance(2001, 7, 19, 10, 7, 12); datetime newdatetime = mydatetime.addseconds(4); datetime expected = datetime.newinstance(2001, 7, 19, 10, 7, 16); system.assertequals(expected, newdatetime); addyears(additionalyears) adds the specified number of years to a datetime. signature public datetime addyears(integer additionalyears) 2966apex reference guide datetime class parameters additionalyears type: integer return value type: datetime example datetime mydatetime = datetime.newinstance(2009, 12, 17, 13, 6, 6); datetime newdatetime = mydatetime.addyears(1); datetime expected = datetime.newinstance(2010, 12, 17, 13, 6, 6); system.assertequals(expected, newdatetime); date() returns the date component of a datetime in the local time zone of the context user. signature public date date() return value type: date example datetime mydatetime = datetime.newinstance(2006, 3, 16, 12, 6, 13); date mydate = mydatetime.date(); date expected = date.newinstance(2006, 3, 16); system.assertequals(expected, mydate); dategmt() return the date component of a datetime in the gmt time zone. signature public date dategmt() return value type: date example // california local time, pst datetime mydatetime = datetime.newinstance(2006, 3, 16, 23, 0, 0); 2967apex reference guide datetime class date mydate = mydatetime.dategmt(); date expected = date.newinstance(2006, 3, 17); system.assertequals(expected, mydate); day() returns the day-of-month component of a datetime in the local time zone of the context user. signature public integer day() return value type: integer example datetime mydatetime = datetime.newinstance(1986, 2, 21, 23, 0, 0); system.assertequals(21, mydatetime.day()); daygmt() returns the day-of-month component of" "a datetime in the gmt time zone. signature public integer daygmt() return value type: integer example // california local time, pst datetime mydatetime = datetime.newinstance(1987, 1, 14, 23, 0, 3); system.assertequals(15, mydatetime.daygmt()); dayofyear() returns the day-of-year component of a datetime in the local time zone of the context user. signature public integer dayofyear() return value type: integer 2968apex reference guide datetime class example for example, february 5, 2008 08:30:12 would be day 36. datetime mydate = datetime.newinstance(2008, 2, 5, 8, 30, 12); system.assertequals(mydate.dayofyear(), 36); dayofyeargmt() returns the day-of-year component of a datetime in the gmt time zone. signature public integer dayofyeargmt() return value type: integer example // this sample assumes we are in the pst timezone datetime mydatetime = datetime.newinstance(1999, 2, 5, 23, 0, 3); // january has 31 days + 5 days in february = 36 days // dayofyeargmt() adjusts the time zone from the current time zone to gmt // by adding 8 hours to the pst time zone, so it's 37 days and not 36 days system.assertequals(37, mydatetime.dayofyeargmt()); format() converts the date to the local time zone and returns the converted date as a formatted string using the locale of the context user. if the time zone cannot be determined, gmt is used. signature public string format() return value type: string example note: the sample is executed in an org where the “enable icu locale formats” crucial update is enabled. see https://releasenotes.docs.salesforce.com/en-us/spring20/release-notes/rn_forcecom_globalization_enable_icu_cruc.htm. datetime.mydatetime = datetime.newinstance(1993, 6, 6, 3, 3, 3); system.assertequals('6/6/1993, 3:03 am', mydatetime.format()); 2969apex reference guide datetime class format(dateformatstring) converts the date to the local time zone and returns the converted date as a string using the supplied java simple date format. if the time zone cannot be determined, gmt is used. signature public string format(string dateformatstring) parameters dateformatstring type: string return value type: string usage for more information on the java simple date format, see java simpledateformat. example datetime mydt = datetime.newinstance(2022, 5, 4, 19, 37, 55); string mydate = mydt.format('yyyy-mm-dd h:mm a'); string expected = '2022-05-04 7:37 pm'; system.assertequals(expected, mydate); format(dateformatstring, timezone) converts the date to the specified time zone and returns the converted date as a string using the supplied java simple date format. if the supplied time zone is not in the correct format, gmt is used. signature public string format(string dateformatstring, string timezone) parameters dateformatstring type: string timezone type: string valid time zone values for the timezone argument are the time zones of the java timezone class that correspond to the time zones returned by the timezone.getavailableids method in java. we recommend you use full time zone names, not the three-letter abbreviations. 2970apex reference guide datetime class return value type: string usage for more information on the java simple date format, see java simpledateformat. example this example uses format to convert a gmt date to the america/new_york time zone and formats the date using the specified date format. datetime gmtdate = datetime.newinstancegmt(2011,6,1,12,1,5); string strconverteddate = gmtdate.format('mm/dd/yyyy hh:mm:ss', 'america/new_york'); // date is converted to // the new time zone and is adjusted // for daylight saving time. system.assertequals( '06/" "01/2011 08:01:05', strconverteddate); formatgmt(dateformatstring) returns a datetime as a string using the supplied java simple date format and the gmt time zone. signature public string formatgmt(string dateformatstring) parameters dateformatstring type: string return value type: string usage for more information on the java simple date format, see java simpledateformat. example datetime mydatetime = datetime.newinstance(1993, 6, 6, 3, 3, 3); string formatted = mydatetime.formatgmt('eee, mmm d yyyy hh:mm:ss'); string expected = 'sun, jun 6 1993 10:03:03'; system.assertequals(expected, formatted); 2971apex reference guide datetime class formatlong() converts the date to the local time zone and returns the converted date in long date format. signature public string formatlong() return value type: string example // passing local date based on the pst time zone datetime dt = datetime.newinstance(2012,12,28,10,0,0); // writes 12/28/2012 10:00:00 am pst system.debug('dt.formatlong()=' + dt.formatlong()); gettime() returns the number of milliseconds since january 1, 1970, 00:00:00 gmt represented by this datetime object. signature public long gettime() return value type: long example datetime dt = datetime.newinstance(2007, 6, 23, 3, 3, 3); long gettime = dt.gettime(); long expected = 1182592983000l; system.assertequals(expected, gettime); hour() returns the hour component of a datetime in the local time zone of the context user. signature public integer hour() return value type: integer 2972apex reference guide datetime class example datetime mydatetime = datetime.newinstance(1998, 11, 21, 3, 3, 3); system.assertequals(3 , mydatetime.hour()); hourgmt() returns the hour component of a datetime in the gmt time zone. signature public integer hourgmt() return value type: integer example // california local time datetime mydatetime = datetime.newinstance(2000, 4, 27, 3, 3, 3); system.assertequals(10 , mydatetime.hourgmt()); issameday(datetocompare) returns true if the datetime that called the method is the same as the specified datetime in the local time zone of the context user. signature public boolean issameday(datetime datetocompare) parameters datetocompare type: datetime return value type: boolean example datetime mydate = datetime.now(); datetime duedate = datetime.newinstance(2008, 1, 30); boolean duenow = mydate.issameday(duedate); millisecond() return the millisecond component of a datetime in the local time zone of the context user. 2973apex reference guide datetime class signature public integer millisecond() return value type: integer example datetime mydatetime = datetime.now(); system.debug(mydatetime.millisecond()); millisecondgmt() return the millisecond component of a datetime in the gmt time zone. signature public integer millisecondgmt() return value type: integer example datetime mydatetime = datetime.now(); system.debug(mydatetime.millisecondgmt()); minute() returns the minute component of a datetime in the local time zone of the context user. signature public integer minute() return value type: integer example datetime mydatetime = datetime.newinstance(2001, 2, 27, 3, 3, 3); system.assertequals(3, mydatetime.minute()); minutegmt() returns the minute component of a datetime in the gmt time zone. 2974apex reference guide datetime class signature public integer minutegmt() return value type: integer example datetime mydatetime = datetime.newinstance(2002, 12, 3, 3, 3, 3); system.assertequals(3, mydatetime.minutegmt()); month() returns the month component of a datetime in the" "local time zone of the context user (1=jan). signature public integer month() return value type: integer example datetime mydatetime = datetime.newinstance(2004, 11, 4, 3, 3, 3); system.assertequals(11, mydatetime.month()); monthgmt() returns the month component of a datetime in the gmt time zone (1=jan). signature public integer monthgmt() return value type: integer example datetime mydatetime = datetime.newinstance(2006, 11, 19, 3, 3, 3); system.assertequals(11, mydatetime.monthgmt()); newinstance(milliseconds) constructs a datetime and initializes it to represent the specified number of milliseconds since january 1, 1970, 00:00:00 gmt. 2975apex reference guide datetime class signature public static datetime newinstance(long milliseconds) parameters milliseconds type: long return value type: datetime the returned date is in the gmt time zone. example long longtime = 1341828183000l; datetime dt = datetime.newinstance(longtime); datetime expected = datetime.newinstance(2012, 7, 09, 3, 3, 3); system.assertequals(expected, dt); newinstance(date, time) constructs a datetime from the specified date and time in the local time zone. signature public static datetime newinstance(date date, time time) parameters date type: date time type: time return value type: datetime the returned date is in the gmt time zone. example date mydate = date.newinstance(2011, 11, 18); time mytime = time.newinstance(3, 3, 3, 0); datetime dt = datetime.newinstance(mydate, mytime); datetime expected = datetime.newinstance(2011, 11, 18, 3, 3, 3); system.assertequals(expected, dt); 2976apex reference guide datetime class newinstance(year, month, day) constructs a datetime from integer representations of the specified year, month (1=jan), and day at midnight in the local time zone. signature public static datetime newinstance(integer year, integer month, integer day) parameters year type: integer month type: integer day type: integer return value type: datetime the returned date is in the gmt time zone. example datetime mydate = datetime.newinstance(2008, 12, 1); newinstance(year, month, day, hour, minute, second) constructs a datetime from integer representations of the specified year, month (1=jan), day, hour, minute, and second in the local time zone. signature public static datetime newinstance(integer year, integer month, integer day, integer hour, integer minute, integer second) parameters year type: integer month type: integer day type: integer hour type: integer minute type: integer 2977apex reference guide datetime class second type: integer return value type: datetime the returned date is in the gmt time zone. example datetime mydate = datetime.newinstance(2008, 12, 1, 12, 30, 2); newinstancegmt(date, time) constructs a datetime from the specified date and time in the gmt time zone. signature public static datetime newinstancegmt(date date, time time) parameters date type: date time type: time return value type: datetime example date mydate = date.newinstance(2013, 11, 12); time mytime = time.newinstance(3, 3, 3, 0); datetime dt = datetime.newinstancegmt(mydate, mytime); datetime expected = datetime.newinstancegmt(2013, 11, 12, 3, 3, 3); system.assertequals(expected, dt); newinstancegmt(year, month, date) constructs a datetime from integer representations of the specified year, month (1=jan), and day at midnight in the gmt time zone signature public static datetime newinstancegmt(integer year, integer month, integer date) 2978apex reference guide datetime class parameters year type: integer month type: integer date" "type: integer return value type: datetime example datetime dt = datetime.newinstancegmt(1996, 3, 22); newinstancegmt(year, month, date, hour, minute, second) constructs a datetime from integer representations of the specified year, month (1=jan), day, hour, minute, and second in the gmt time zone signature public static datetime newinstancegmt(integer year, integer month, integer date, integer hour, integer minute, integer second) parameters year type: integer month type: integer date type: integer hour type: integer minute type: integer second type: integer return value type: datetime 2979apex reference guide datetime class example //california local time datetime dt = datetime.newinstancegmt(1998, 1, 29, 2, 2, 3); datetime expected = datetime.newinstance(1998, 1, 28, 18, 2, 3); system.assertequals(expected, dt); now() returns the current datetime based on a gmt calendar. signature public static datetime now() return value type: datetime the format of the returned datetime is: 'mm/dd/yyyy hh:mm period' example datetime mydatetime = datetime.now(); parse(datetimestring) constructs a datetime from the given string in the local time zone and in the format of the user locale. signature public static datetime parse(string datetimestring) parameters datetimestring type: string return value type: datetime the returned date is in the gmt time zone. example this example uses parse to create a datetime from a date passed in as a string and that is formatted for the english (united states) locale. you may need to change the format of the date string if you have a different locale. 2980apex reference guide datetime class note: this sample is executed in an org where the “enable icu locale formats” crucial update is enabled. see https://releasenotes.docs.salesforce.com/en-us/spring20/release-notes/rn_forcecom_globalization_enable_icu_cruc.htm. datetime dt = datetime.parse('10/14/2011, 11:46 am'); string mydtstring = dt.format(); system.assertequals(mydtstring, '10/14/2011, 11:46 am'); second() returns the second component of a datetime in the local time zone of the context user. signature public integer second() return value type: integer example datetime dt = datetime.newinstancegmt(1999, 9, 22, 3, 1, 2); system.assertequals(2, dt.second()); secondgmt() returns the second component of a datetime in the gmt time zone. signature public integer secondgmt() return value type: integer example datetime dt = datetime.newinstance(2000, 2, 3, 3, 1, 5); system.assertequals(5, dt.secondgmt()); time() returns the time component of a datetime in the local time zone of the context user. signature public time time() 2981apex reference guide datetime class return value type: time example datetime dt = datetime.newinstance(2002, 11, 21, 0, 2, 2); time expected = time.newinstance(0, 2, 2, 0); system.assertequals(expected, dt.time()); timegmt() returns the time component of a datetime in the gmt time zone. signature public time timegmt() return value type: time example // this sample is based on the pst time zone datetime dt = datetime.newinstance(2004, 1, 27, 4, 1, 2); time expected = time.newinstance(12, 1, 2, 0); // 8 hours are added to the time to convert it from // pst to gmt system.assertequals(expected, dt.timegmt()); valueof(datetimestring) returns a datetime that contains the value of the specified string. signature public static datetime valueof(string datetimestring) parameters datetimestring type: string return value type: datetime" the returned date is in the gmt time zone. 2982 "apex reference guide datetime class usage the specified string should use the standard date format “yyyy-mm-dd hh:mm:ss” in the local time zone. example string year = '2008'; string month = '10'; string day = '5'; string hour = '12'; string minute = '20'; string second = '20'; string stringdate = year + '-' + month + '-' + day + ' ' + hour + ':' + minute + ':' + second; datetime mydate = datetime.valueof(stringdate); valueof(fieldvalue) converts the specified object to a datetime. use this method to convert a history tracking field value or an object that represents a datetime value. signature public static datetime valueof(object fieldvalue) parameters fieldvalue type: object return value type: datetime usage use this method with the oldvalue or newvalue fields of history sobjects, such as accounthistory, when the field is a date/time field. example list ahlist = [select field,oldvalue,newvalue from accounthistory]; for(accounthistory ah : ahlist) { system.debug('field: ' + ah.field); if (ah.field == 'mydatetime__c') { datetime oldvalue = datetime.valueof(ah.oldvalue); datetime newvalue = datetime.valueof(ah.newvalue); } } 2983apex reference guide datetime class valueofgmt(datetimestring) returns a datetime that contains the value of the specified string. signature public static datetime valueofgmt(string datetimestring) parameters datetimestring type: string return value type: datetime usage the specified string should use the standard date format “yyyy-mm-dd hh:mm:ss” in the gmt time zone. example // california locale time string year = '2009'; string month = '3'; string day = '5'; string hour = '5'; string minute = '2'; string second = '2'; string stringdate = year + '-' + month + '-' + day + ' ' + hour + ':' + minute + ':' + second; datetime mydate = datetime.valueofgmt(stringdate); datetime expected = datetime.newinstance(2009, 3, 4, 21, 2, 2); system.assertequals(expected, mydate); year() returns the year component of a datetime in the local time zone of the context user. signature public integer year() return value type: integer 2984apex reference guide decimal class example datetime dt = datetime.newinstance(2012, 1, 26, 5, 2, 4); system.assertequals(2012, dt.year()); yeargmt() returns the year component of a datetime in the gmt time zone. signature public integer yeargmt() return value type: integer example datetime dt = datetime.newinstance(2012, 10, 4, 6, 4, 6); system.assertequals(2012, dt.yeargmt()); decimal class contains methods for the decimal primitive data type. namespace system usage note: two decimal objects that are numerically equivalent but differ in scale (such as 1.1 and 1.10) generally do not have the same hashcode. use caution when such decimal objects are used in sets or as map keys. for more information on decimal, see decimal data type. in this section: rounding mode rounding mode specifies the rounding behavior for numerical operations capable of discarding precision. decimal methods rounding mode rounding mode specifies the rounding behavior for numerical operations capable of discarding precision. each rounding mode indicates how the least significant returned digit of a rounded result is to be calculated. the following are the valid values for roundingmode. 2985apex reference guide decimal class name description ceiling rounds towards positive infinity. that is, if the result is positive, this mode behaves the same as the up rounding mode; if the result is negative, it behaves the same as the down rounding mode. note that this rounding mode never decreases the calculated value. for example: • input number 5.5: ceiling round mode result: 6 • input number 1.1: ceiling round mode result: 2 • input number" "-1.1: ceiling round mode result: -1 • input number -2.7: ceiling round mode result: -2 decimal[] example = new decimal[]{5.5, 1.1, -1.1, -2.7}; long[] expected = new long[]{6, 2, -1, -2}; for(integer x = 0; x < example.size(); x++){ system.assertequals(expected[x], example[x].round(system.roundingmode.ceiling)); } down rounds towards zero. this rounding mode always discards any fractions (decimal points) prior to executing. note that this rounding mode never increases the magnitude of the calculated value. for example: • input number 5.5: down round mode result: 5 • input number 1.1: down round mode result: 1 • input number -1.1: down round mode result: -1 • input number -2.7: down round mode result: -2 decimal[] example = new decimal[]{5.5, 1.1, -1.1, -2.7}; long[] expected = new long[]{5, 1, -1, -2}; for(integer x = 0; x < example.size(); x++){ system.assertequals(expected[x], example[x].round(system.roundingmode.down)); } floor rounds towards negative infinity. that is, if the result is positive, this mode behaves the same as thedown rounding mode; if negative, this mode behaves the same as the up rounding mode. note that this rounding mode never increases the calculated value. for example: • input number 5.5: floor round mode result: 5 • input number 1.1: floor round mode result: 1 • input number -1.1: floor round mode result: -2 • input number -2.7: floor round mode result: -3 decimal[] example = new decimal[]{5.5, 1.1, -1.1, -2.7}; long[] expected = new long[]{5, 1, -2, -3}; for(integer x = 0; x < example.size(); x++){ system.assertequals(expected[x], example[x].round(system.roundingmode.floor)); } 2986apex reference guide decimal class name description half_down rounds towards the “nearest neighbor” unless both neighbors are equidistant, in which case this mode rounds down. this rounding mode behaves the same as the up rounding mode if the discarded fraction (decimal point) is > 0.5; otherwise, it behaves the same as down rounding mode. for example: • input number 5.5: half_down round mode result: 5 • input number 1.1: half_down round mode result: 1 • input number -1.1: half_down round mode result: -1 • input number -2.7: half_down round mode result: -3 decimal[] example = new decimal[]{5.5, 1.1, -1.1, -2.7}; long[] expected = new long[]{5, 1, -1, -3}; for(integer x = 0; x < example.size(); x++){ system.assertequals(expected[x], example[x].round(system.roundingmode.half_down)); } half_even rounds towards the “nearest neighbor” unless both neighbors are equidistant, in which case, this mode rounds towards the even neighbor. this rounding mode behaves the same as the half_up rounding mode if the digit to the left of the discarded fraction (decimal point) is odd. it behaves the same as the half_down rounding method if it is even. for example: • input number 5.5: half_even round mode result: 6 • input number 1.1: half_even round mode result: 1 • input number -1.1: half_even round mode result: -1 • input number -2.7: half_even round mode result: -3 decimal[] example = new decimal[]{5.5, 1.1, -1.1, -2.7}; long[] expected = new long[]{6, 1, -1, -3}; for(integer x =" "0; x < example.size(); x++){ system.assertequals(expected[x], example[x].round(system.roundingmode.half_even)); } note that this rounding mode statistically minimizes cumulative error when applied repeatedly over a sequence of calculations. half_up rounds towards the “nearest neighbor” unless both neighbors are equidistant, in which case, this mode rounds up. this rounding method behaves the same as the up rounding method if the discarded fraction (decimal point) is >= 0.5; otherwise, this rounding method behaves the same as the down rounding method. for example: • input number 5.5: half_up round mode result: 6 • input number 1.1: half_up round mode result: 1 • input number -1.1: half_up round mode result: -1 • input number -2.7: half_up round mode result: -3 decimal[] example = new decimal[]{5.5, 1.1, -1.1, -2.7}; long[] expected = new long[]{6, 1, -1, -3}; for(integer x = 0; x < example.size(); x++){ 2987apex reference guide decimal class name description system.assertequals(expected[x], example[x].round(system.roundingmode.half_up)); } unnecessary asserts that the requested operation has an exact result, which means that no rounding is necessary. if this rounding mode is specified on an operation that yields an inexact result, a mathexception is thrown. for example: • input number 5.5: unnecessary round mode result: mathexception • input number 1.1: unnecessary round mode result: mathexception • input number 1.0: unnecessary round mode result: 1 • input number -1.0: unnecessary round mode result: -1 • input number -2.2: unnecessary round mode result: mathexception decimal example1 = 5.5; decimal example2 = 1.0; system.assertequals(1, example2.round(system.roundingmode.unnecessary)); try{ example1.round(system.roundingmode.unnecessary); } catch(exception e) { system.assertequals('system.mathexception', e.gettypename()); } up rounds away from zero. this rounding mode always truncates any fractions (decimal points) prior to executing. note that this rounding mode never decreases the magnitude of the calculated value. for example: • input number 5.5: up round mode result: 6 • input number 1.1: up round mode result: 2 • input number -1.1: up round mode result: -2 • input number -2.7: up round mode result: -3 decimal[] example = new decimal[]{5.5, 1.1, -1.1, -2.7}; long[] expected = new long[]{6, 2, -2, -3}; for(integer x = 0; x < example.size(); x++){ system.assertequals(expected[x], example[x].round(system.roundingmode.up)); } decimal methods the following are methods for decimal. in this section: abs() returns the absolute value of the decimal. 2988apex reference guide decimal class divide(divisor, scale) divides this decimal by the specified divisor, and sets the scale, that is, the number of decimal places, of the result using the specified scale. divide(divisor, scale, roundingmode) divides this decimal by the specified divisor, sets the scale, that is, the number of decimal places, of the result using the specified scale, and if necessary, rounds the value using the rounding mode. doublevalue() returns the double value of this decimal. format() returns the string value of this decimal using the locale of the context user. intvalue() returns the integer value of this decimal. longvalue() returns the long value of this decimal. pow(exponent) returns the value of this decimal raised to the power of the specified exponent. precision() returns the total number of digits for the decimal. round() returns the rounded approximation" "of this decimal. the number is rounded to zero decimal places using half-even rounding mode, that is, it rounds towards the “nearest neighbor” unless both neighbors are equidistant, in which case, this mode rounds towards the even neighbor. round(roundingmode) returns the rounded approximation of this decimal. the number is rounded to zero decimal places using the rounding mode specified by the rounding mode. scale() returns the scale of the decimal, that is, the number of decimal places. setscale(scale) returns the decimal scaled to the specified number of decimal places, using half-even rounding, if necessary. half-even rounding mode rounds toward the “nearest neighbor.” if both neighbors are equidistant, the number is rounded toward the even neighbor. setscale(scale, roundingmode) returns the decimal scaled to the specified number of decimal places, using the specified rounding mode, if necessary. striptrailingzeros() returns the decimal with any trailing zeros removed. toplainstring() returns the string value of this decimal, without using scientific notation. valueof(doubletodecimal) returns a decimal that contains the value of the specified double. valueof(longtodecimal) returns a decimal that contains the value of the specified long. 2989apex reference guide decimal class valueof(stringtodecimal) returns a decimal that contains the value of the specified string. as in java, the string is interpreted as representing a signed decimal. abs() returns the absolute value of the decimal. signature public decimal abs() return value type: decimal example decimal mydecimal = -6.02214129; system.assertequals(6.02214129, mydecimal.abs()); divide(divisor, scale) divides this decimal by the specified divisor, and sets the scale, that is, the number of decimal places, of the result using the specified scale. signature public decimal divide(decimal divisor, integer scale) parameters divisor type: decimal scale type: integer return value type: decimal example decimal decimalnumber = 19; decimal result = decimalnumber.divide(100, 3); system.assertequals(0.190, result); divide(divisor, scale, roundingmode) divides this decimal by the specified divisor, sets the scale, that is, the number of decimal places, of the result using the specified scale, and if necessary, rounds the value using the rounding mode. 2990apex reference guide decimal class signature public decimal divide(decimal divisor, integer scale, system.roundingmode roundingmode) parameters divisor type: decimal scale type: integer roundingmode type: system.roundingmode return value type: decimal example decimal mydecimal = 12.4567; decimal divdec = mydecimal.divide(7, 2, system.roundingmode.up); system.assertequals(divdec, 1.78); doublevalue() returns the double value of this decimal. signature public double doublevalue() return value type: double example decimal mydecimal = 6.62606957; double value = mydecimal.doublevalue(); system.assertequals(6.62606957, value); format() returns the string value of this decimal using the locale of the context user. signature public string format() 2991apex reference guide decimal class return value type: string usage scientific notation will be used if an exponent is needed. example // u.s. locale decimal mydecimal = 12345.6789; system.assertequals('12,345.679', mydecimal.format()); intvalue() returns the integer value of this decimal. signature public integer intvalue() return value type: integer example decimal mydecimal = 1.602176565; system.assertequals(1, mydecimal.intvalue()); longvalue() returns the long value of this decimal. signature public long longvalue() return value type: long example decimal mydecimal = 376.730313461; system.assertequals(376, mydecimal.longvalue()); pow(exponent" ") returns the value of this decimal raised to the power of the specified exponent. 2992apex reference guide decimal class signature public decimal pow(integer exponent) parameters exponent type: integer the value of exponent must be between 0 and 32,767. return value type: decimal usage if you use mydecimal.pow(0), 1 is returned. the math.pow method does accept negative values. example decimal mydecimal = 4.12; decimal powdec = mydecimal.pow(2); system.assertequals(powdec, 16.9744); precision() returns the total number of digits for the decimal. signature public integer precision() return value type: integer example for example, if the decimal value was 123.45, precision returns 5. if the decimal value is 123.123, precision returns 6. decimal d1 = 123.45; integer precision1 = d1.precision(); system.assertequals(precision1, 5); decimal d2 = 123.123; integer precision2 = d2.precision(); system.assertequals(precision2, 6); 2993apex reference guide decimal class round() returns the rounded approximation of this decimal. the number is rounded to zero decimal places using half-even rounding mode, that is, it rounds towards the “nearest neighbor” unless both neighbors are equidistant, in which case, this mode rounds towards the even neighbor. signature public long round() return value type: long usage note that this rounding mode statistically minimizes cumulative error when applied repeatedly over a sequence of calculations. example decimal d = 4.5; long l = d.round(); system.assertequals(4, l); decimal d1 = 5.5; long l1 = d1.round(); system.assertequals(6, l1); decimal d2 = 5.2; long l2 = d2.round(); system.assertequals(5, l2); decimal d3 = -5.7; long l3 = d3.round(); system.assertequals(-6, l3); round(roundingmode) returns the rounded approximation of this decimal. the number is rounded to zero decimal places using the rounding mode specified by the rounding mode. signature public long round(system.roundingmode roundingmode) parameters roundingmode type: system.roundingmode 2994apex reference guide decimal class return value type: long scale() returns the scale of the decimal, that is, the number of decimal places. signature public integer scale() return value type: integer example decimal mydecimal = 9.27400968; system.assertequals(8, mydecimal.scale()); setscale(scale) returns the decimal scaled to the specified number of decimal places, using half-even rounding, if necessary. half-even rounding mode rounds toward the “nearest neighbor.” if both neighbors are equidistant, the number is rounded toward the even neighbor. signature public decimal setscale(integer scale) parameters scale type: integer the value of scale must be between –33 and 33. if the value of scale is negative, your unscaled value is multiplied by 10 to the power of the negation of scale. for example, after this operation, the value of d is 4*10^3. decimal d = 4000; d = d.setscale(-3); return value type: decimal usage if you do not explicitly set the scale for a decimal, the item from which the decimal is created determines the scale. • if the decimal is created as part of a query, the scale is based on the scale of the field returned from the query. • if the decimal is created from a string, the scale is the number of characters after the decimal point of the string. 2995apex reference guide decimal class • if the decimal is created from a non-decimal number, the number is first converted to a string. scale is then set using the number of characters after the decimal point. example decimal mydecimal = 8.987551787; decimal setscaled = mydecimal.setscale(3); system.assertequals(8.988, setscaled); setscale(scale, roundingmode" ") returns the decimal scaled to the specified number of decimal places, using the specified rounding mode, if necessary. signature public decimal setscale(integer scale, system.roundingmode roundingmode) parameters scale type: integer the value of scale must be between –33 and 33. if the value of scale is negative, your unscaled value is multiplied by 10 to the power of the negation of scale. for example, after this operation, the value of d is 4*10^3. decimal d = 4000; d = d.setscale(-3); roundingmode type: system.roundingmode return value type: decimal usage if you do not explicitly set the scale for a decimal, the item from which the decimal is created determines the scale. • if the decimal is created as part of a query, the scale is based on the scale of the field returned from the query. • if the decimal is created from a string, the scale is the number of characters after the decimal point of the string. • if the decimal is created from a non-decimal number, the number is first converted to a string. scale is then set using the number of characters after the decimal point. striptrailingzeros() returns the decimal with any trailing zeros removed. signature public decimal striptrailingzeros() 2996apex reference guide decimal class return value type: decimal example decimal mydecimal = 1.10000; decimal stripped = mydecimal.striptrailingzeros(); system.assertequals(stripped, 1.1); toplainstring() returns the string value of this decimal, without using scientific notation. signature public string toplainstring() return value type: string example decimal mydecimal = 12345.6789; system.assertequals('12345.6789', mydecimal.toplainstring()); valueof(doubletodecimal) returns a decimal that contains the value of the specified double. signature public static decimal valueof(double doubletodecimal) parameters doubletodecimal type: double return value type: decimal example double mydouble = 2.718281828459045; decimal mydecimal = decimal.valueof(mydouble); system.assertequals(2.718281828459045, mydecimal); 2997apex reference guide domain class valueof(longtodecimal) returns a decimal that contains the value of the specified long. signature public static decimal valueof(long longtodecimal) parameters longtodecimal type: long return value type: decimal example long mylong = 299792458; decimal mydecimal = decimal.valueof(mylong); system.assertequals(299792458, mydecimal); valueof(stringtodecimal) returns a decimal that contains the value of the specified string. as in java, the string is interpreted as representing a signed decimal. signature public static decimal valueof(string stringtodecimal) parameters stringtodecimal type: string return value type: decimal example string temp = '12.4567'; decimal mydecimal = decimal.valueof(temp); domain class represents an existing domain hosted by salesforce that serves the org or its content. contains methods to obtain information about these domains, such as the domain type, my domain name, and sandbox name. 2998apex reference guide domain class namespace system usage use the domain class to obtain information about the domains that salesforce hosts for your org. this class only applies to domains hosted by salesforce, and can’t be used to generate a new domain. example this code uses the system.domainparser class to parse a hostname. it then gets the associated domain type. system.domain d = domainparser.parse('mycompany.lightning.force.com'); string mydomainname = d.getmydomainname(); system.domaintype domaintype = d.getdomaintype(); in this section: domain methods domain methods the following are methods for domain. in this section: getdomaintype() returns the domain’s type, such as content_domain, experience_cloud_sites_domain, or lightning_domain. getmydomainname() returns" "the domain’s my domain name. getpackagename() for a domain that includes the package name, such as a lightning component domain or visualforce page domain, returns the package name. for a domain that doesn’t contain a package name, this method returns null. getsandboxname() for a sandbox org domain, returns the sandbox name. for a production org domain, returns null. getsitessubdomainname() for a system-managed experience cloud site domain or salesforce site domain, returns the sites subdomain name. if enhanced domains are enabled, this method always returns null. when enhanced domains are enabled, the org’s my domain name is the subdomain for the system-managed domains for experience cloud sites and salesforce sites domains. getdomaintype() returns the domain’s type, such as content_domain, experience_cloud_sites_domain, or lightning_domain. signature public system.domaintype getdomaintype() 2999apex reference guide domain class return value type: system.domaintype getmydomainname() returns the domain’s my domain name. signature public string getmydomainname() return value type: string getpackagename() for a domain that includes the package name, such as a lightning component domain or visualforce page domain, returns the package name. for a domain that doesn’t contain a package name, this method returns null. signature public string getpackagename() return value type: string getsandboxname() for a sandbox org domain, returns the sandbox name. for a production org domain, returns null. signature public string getsandboxname() return value type: string getsitessubdomainname() for a system-managed experience cloud site domain or salesforce site domain, returns the sites subdomain name. if enhanced domains are enabled, this method always returns null. when enhanced domains are enabled, the org’s my domain name is the subdomain for the system-managed domains for experience cloud sites and salesforce sites domains. signature public string getsitessubdomainname() 3000apex reference guide domaincreator class return value type: string domaincreator class use the domaincreator class to return a hostname specific to the org. for example, get the org’s visualforce hostname. values are returned as a hostname, such as mydomainname.lightning.force.com. namespace system examples this example code fetches the org’s my domain login hostname and the visualforce hostname for the uat package. //get the my domain login hostname string mydomainhostname = domaincreator.getorgmydomainhostname(); //get the visualforce hostname string vfhostname = domaincreator.getvisualforcehostname('uat'); in this case, in a production org with a my domain name of mycompany, mydomainhostname returns mycompany.my.salesforce.com. and in the same production org with enhanced domains, vfhostname returns mycompany--uat.vf.force.com. this example code creates a link to a salesforce account record. it gets the lightning hostname associated with this org. it then gets the account record id and uses concatenation to build the link url. //get the org’s lightning hostname string mylightninghostname = domaincreator.getlightninghostname(); //get the id of a record account with the name ‘acme’ account acct = [select id from account where name = 'acme' limit 1]; //build the url to view the account record string fullrecordurl = 'https://' + mylightninghostname + '/lightning/r/account/' + acct.id + '/view'; in this section: domaincreator methods domaincreator methods the following are methods for domaincreator. in this section: getcontenthostname() returns the hostname for content stored in the org, such as files. 3001apex reference guide domaincreator class getexperiencecloudsitesbuilderhostname() returns the hostname to access experience builder for the org’s experience cloud sites. getexperiencecloudsiteshostname() returns the system-managed hostname for the org’s experience cloud sites, such as experiencecloudsitessubdomainname.force.com. if digital experiences aren’t enabled, this method throws an invalidparametervalue" "exception. getexperiencecloudsiteslivepreviewhostname() returns the hostname to access experience builder live preview for the org’s experience cloud sites. getexperiencecloudsitespreviewhostname() returns the hostname to access experience builder preview for the org’s experience cloud sites. getlightningcontainercomponenthostname(packagename) returns the hostname for the org’s lightning container components. getlightninghostname() returns the hostname for the org’s lightning pages. getorgmydomainhostname() returns the hostname for the org’s my domain login domain. getsalesforcesiteshostname() returns the hostname for the org’s salesforce sites. if salesforce sites aren’t enabled, this method throws an invalidparametervalueexception. getvisualforcehostname(packagename) returns the hostname for the org’s visualforce pages. getcontenthostname() returns the hostname for content stored in the org, such as files. signature public static string getcontenthostname() return value type: string getexperiencecloudsitesbuilderhostname() returns the hostname to access experience builder for the org’s experience cloud sites. signature public static string getexperiencecloudsitesbuilderhostname() return value type: string 3002apex reference guide domaincreator class getexperiencecloudsiteshostname() returns the system-managed hostname for the org’s experience cloud sites, such as experiencecloudsitessubdomainname.force.com. if digital experiences aren’t enabled, this method throws an invalidparametervalueexception. signature public static string getexperiencecloudsiteshostname() return value type: string getexperiencecloudsiteslivepreviewhostname() returns the hostname to access experience builder live preview for the org’s experience cloud sites. signature public static string getexperiencecloudsiteslivepreviewhostname() return value type: string getexperiencecloudsitespreviewhostname() returns the hostname to access experience builder preview for the org’s experience cloud sites. signature public static string getexperiencecloudsitespreviewhostname() return value type: string getlightningcontainercomponenthostname(packagename) returns the hostname for the org’s lightning container components. signature public static string getlightningcontainercomponenthostname(string packagename) parameters packagename type: string the package name for this component. 3003apex reference guide domaincreator class if packagename is null, this method uses the org’s namespace prefix as the package name. otherwise, it uses the default namespace. return value type: string getlightninghostname() returns the hostname for the org’s lightning pages. signature public static string getlightninghostname() return value type: string getorgmydomainhostname() returns the hostname for the org’s my domain login domain. signature public static string getorgmydomainhostname() return value type: string getsalesforcesiteshostname() returns the hostname for the org’s salesforce sites. if salesforce sites aren’t enabled, this method throws an invalidparametervalueexception. signature public static string getsalesforcesiteshostname() return value type: string getvisualforcehostname(packagename) returns the hostname for the org’s visualforce pages. signature public static string getvisualforcehostname(string packagename) 3004apex reference guide domainparser class parameters packagename type: string the package name for this component. if packagename is null, this method uses the org’s namespace prefix as the package name. otherwise, it uses the default namespace. return value type: string domainparser class use the domainparser class to parse a domain that salesforce hosts for the org and extract information about the domain. namespace system examples this example code parses the org’s lightning domain and gets the my domain name and domain type from the system.domain object. system.domain d = domainparser.parser('mycompany.lightning.force.com'); string mydomainname = d.getmydomainname(); system.domaintype domaintype = d.getdomaintype(); this example code parses a known visualforce url to get the domain type, the org’s my domain name, and the package name. //parse a known url system" ".domain domain = domainparser.parse('https://mycompany--abcpackage.vf.force.com'); //get the domain type system.domaintype domaintype = domain.getdomaintype(); // returns visualforce_domain //get the org’s my domain name string mydomainname = domain.getmydomainname(); // returns mycompany //get the package name string packagename = domain.getpackagename(); // returns abcpackage in this section: domainparser methods domainparser methods the following are methods for domainparser. 3005apex reference guide domainparser class in this section: parse(hostname) parses a passed hostname of a domain that salesforce hosts for the org, and returns the system.domain. parse(url) parses a passed uniform resource locator (url) of a domain that salesforce hosts for the org, and returns the system.domain. parse(hostname) parses a passed hostname of a domain that salesforce hosts for the org, and returns the system.domain. signature public static system.domain parse(string hostname) parameters hostname type: string the label that identifies a salesforce host, including all subdomains but without the protocol, path, or any parameters. for example, mycompany.my.site.com or mycompany--sandbox1.sandbox.my.salesforceforce.com. if the hostname format is invalid, it isn’t a salesforce hosted domain, or it isn’t owned by this org, this method throws an invalidparametervalueexception. return value type: system.domain parse(url) parses a passed uniform resource locator (url) of a domain that salesforce hosts for the org, and returns the system.domain. signature public static system.domain parse(system.url url) parameters url type: system.url a uniform resource locator (url) for a salesforce org, including all subdomains and the protocol. for example, https://mycompany--sandbox1.sandbox.my.salesforceforce.com. the url can also include paths and parameters. for example, https://mycompany.my.site.com/en/us/help or https://mycompany.file.force.com/servlet/servlet.filedownload?file=015300000000xvu. if the url format is invalid, it isn’t a salesforce hosted domain, or it isn’t owned by this org, this method throws an invalidparametervalueexception. 3006apex reference guide domaintype enum return value type: system.domain domaintype enum specifies the domain type for a system.domain. usage use the domaintype enum to obtain the type of a domain parsed through the system.domainparser class. enum values the following are the values of the system.domaintype enum. these values only apply to salesforce-hosted domains. value description cms_domain content management system (cms) public channel domains. content_domain domains that serve content (files) stored in salesforce. customer_360_admin_domain customer 360 data manager domains. customer_360_domain customer 360 data manager admin domains. experience_cloud_sites_builder_domain experience builder for experience cloud sites domains. experience_cloud_sites_domain salesforce-hosted domains that serve experience cloud sites. experience_cloud_sites_live_preview_domain experience builder live preview domains. experience_cloud_sites_preview_domain experience builder preview domains. lightning_container_component_domain lightning container component domains. lightning_domain domains that serve lighting pages. org_my_domain my domain login domains. salesforce_sites_domain salesforce-hosted domains that serve salesforce sites. visualforce_domain domains that serve visualforce pages. double class contains methods for the double primitive data type. namespace system 3007apex reference guide double class usage for more information on double, see double data type. double methods the following are methods for double. in this section: format() returns the string value for this double using the locale of the context user intvalue() returns" "the integer value of this double by casting it to an integer. longvalue() returns the long value of this double. round() returns the closest long to this double value. valueof(stringtodouble) returns a double that contains the value of the specified string. as in java, the string is interpreted as representing a signed decimal. valueof(fieldvalue) converts the specified object to a double value. use this method to convert a history tracking field value or an object that represents a double value. format() returns the string value for this double using the locale of the context user signature public string format() return value type: string example double mydouble = 1261992; system.assertequals('1,261,992', mydouble.format()); intvalue() returns the integer value of this double by casting it to an integer. signature public integer intvalue() 3008apex reference guide double class return value type: integer example double dd1 = double.valueof('3.14159'); integer value = dd1.intvalue(); system.assertequals(value, 3); longvalue() returns the long value of this double. signature public long longvalue() return value type: long example double mydouble = 421994; long value = mydouble.longvalue(); system.assertequals(421994, value); round() returns the closest long to this double value. signature public long round() return value type: long example double d1 = 4.5; long l1 = d1.round(); system.assertequals(5, l1); double d2= 4.2; long l2= d2.round(); system.assertequals(4, l2); double d3= -4.7; 3009apex reference guide double class long l3= d3.round(); system.assertequals(-5, l3); valueof(stringtodouble) returns a double that contains the value of the specified string. as in java, the string is interpreted as representing a signed decimal. signature public static double valueof(string stringtodouble) parameters stringtodouble type: string return value type: double example double dd1 = double.valueof('3.14159'); valueof(fieldvalue) converts the specified object to a double value. use this method to convert a history tracking field value or an object that represents a double value. signature public static double valueof(object fieldvalue) parameters fieldvalue type: object return value type: double usage use this method with the oldvalue or newvalue fields of history sobjects, such as accounthistory, when the field type corresponds to a double type, like a number field. 3010apex reference guide emailmessages class example list ahlist = [select field,oldvalue,newvalue from accounthistory]; for(accounthistory ah : ahlist) { system.debug('field: ' + ah.field); if (ah.field == 'numberofemployees') { double oldvalue = double.valueof(ah.oldvalue); double newvalue = double.valueof(ah.newvalue); } emailmessages class use the methods in the emailmessages class to interact with emails and email threading. namespace system emailmessages methods the following are static methods for emailmessages. in this section: getformattedthreadingtoken(recordid) returns an email threading token that’s formatted with the correct prefix and suffix. this token can be embedded in an outbound email body, email subject, or both the body and subject. when users reply to the email, threading tokens can be used to attach responses to a record, such as a case record in email-to-case. getrecordidfromemail(subject, textbody, htmlbody) returns the record id corresponding to the specified email threading token, or returns null if none is found. getformattedthreadingtoken(recordid) returns an email threading token that’s formatted with the correct prefix and suffix. this token can be embedded in an outbound email body, email subject, or both the body and subject. when users reply to the email, threading tokens can be used to attach responses to a record, such as a case record in email-to-case. signature public static id getformatted" "threadingtoken(id recordid) parameters recordid type:id 3011apex reference guide emailmessages class the record id associated with the threading token. only case record ids are supported. return value type: string the returned value is a formatted string that includes a prefix and suffix, for example: thread::pp5xpgfmnf2hrzdrcwnrohc:: usage requires lightning threading to be enabled in email-to-case. when sending emails in apex, use the returned string to match emails to a record, such as a case record, that’s associated with the email thread. embed the formatted token in the body or subject of outgoing emails. to find the corresponding record id in incoming emails, use emailmessages.getrecordidfromemail(subject, textbody, htmlbody) on page 3012. example in this sample, we send an email with a threading token so that the email and any responses are associated with the related case. // get your record id. here, we're using a dummy case id. id caseid = id.valueof('500xx000000bpktaaq'); // get the formatted threading token. string formattedtoken = emailmessages.getformattedthreadingtoken(caseid); // create a singleemailmessage object. messaging.singleemailmessage email = new messaging.singleemailmessage(); // set recipients and other fields. email.settoaddresses(new string[] {'test@example.com'}); // append the threading token to the email body (text or html), subject, // or both body and subject. email.setplaintextbody('test email notification text body' + '\n\n' + formattedtoken); email.sethtmlbody('test email notification html body' + '

' + formattedtoken); email.setsubject('test notification ' + '[ ' + formattedtoken + ' ]'); // ........... more fields ........... // send out the email. messaging.sendemail(new messaging.singleemailmessage[]{email}); getrecordidfromemail(subject, textbody, htmlbody) returns the record id corresponding to the specified email threading token, or returns null if none is found. signature public static id getrecordidfromemail(string subject, string textbody, string htmlbody) 3012apex reference guide emailmessages class parameters subject type: string the subject of the email. textbody type: string the body of the email in text format. htmlbody type: string the body of the email in html format. return value type: id the record id that corresponds to the embedded threading token. usage requires lightning threading to be enabled in email-to-case. when you send emails with threading tokens embedded in the email subject, the email body, or in both the subject and body, most email clients quote the email body and maintain the email subject in a response. this method finds a corresponding record that matches the embedded threading token in a response. typically this method is used in email services so that you can provide your own handling of inbound emails using apex code. example if you implement header-based threading in your email services currently, we recommend that you use lightning threading, which combines token-based threading and header-based threading. for header-based threading to continue to work, store emails as emailmessage records with the messagedidentifier field set properly. with lightning threading, you can use threading tokens as the primary threading method and rely on header-based threading as a fallback, or vice versa. in this example, we rely on threading tokens and use header-based threading as a fallback. global class attachemailmessagetocaseexample implements messaging.inboundemailhandler { global messaging.inboundemailresult handleinboundemail(messaging.inboundemail email, messaging.inboundenvelope env) { // create an inboundemailresult object for returning the result of the // apex email service. messaging.inboundemailresult result = new messaging.inboundemailresult(); // try to find the case id using threading tokens in email attributes. id caseid = emailmessages.getrecordidfromemail(email.subject, email.plaintextbody, email.htmlbody); // if we haven't found the case id, try finding it using headers. if (caseid == null) { caseid = cases.getcaseidfromemailhead" "ers(email.headers); 3013apex reference guide emailmessages class } // if a case isn’t found, create a new case record. if (caseid == null) { case c = new case(subject = email.subject); insert c; system.debug('new case object: ' + c); caseid = c.id; } // process recipients string toaddresses; if (email.toaddresses != null) { toaddresses = string.join(email.toaddresses, '; '); } // to store an emailmessage for threading, you need at minimum // the status, the messageidentifier, and the parentid fields. emailmessage em = new emailmessage( status = '0', messageidentifier = email.messageid, parentid = caseid, // other important fields. fromaddress = email.fromaddress, fromname = email.fromname, toaddress = toaddresses, textbody = email.plaintextbody, htmlbody = email.htmlbody, subject = email.subject, // parse thread-index header to remain consistent with email-to-case. clientthreadidentifier = getclientthreadidentifier(email.headers) // other fields you wish to add. ); // insert the new emailmessage. insert em; system.debug('new emailmessage object: ' + em ); // set the result to true. no need to send an email back to the user // with an error message. result.success = true; // return the result for the apex email service. return result; } private string getclientthreadidentifier(list headers) { if (headers == null || headers.size() == 0) return null; try { for (messaging.inboundemail.header header : headers) { if (header.name.equalsignorecase('thread-index')) { blob threadindex = encodingutil.base64decode(header.value.trim()); return encodingutil.converttohex(threadindex).substring(0, 44).touppercase(); 3014apex reference guide encodingutil class } } } catch (exception e){ return null; } return null; } } encodingutil class use the methods in the encodingutil class to encode and decode url strings, and convert strings to hexadecimal format. namespace system usage note: you cannot use the encodingutil methods to move documents with non-ascii characters to salesforce. you can, however, download a document from salesforce. to do so, query the id of the document using the api query call, then request it by id. encodingutil methods the following are methods for encodingutil. all methods are static. in this section: base64decode(inputstring) converts a base64-encoded string to a blob representing its normal form. base64encode(inputblob) converts a blob to an unencoded string representing its normal form. convertfromhex(inputstring) converts the specified hexadecimal (base 16) string to a blob value and returns this blob value. converttohex(inputblob) returns a hexadecimal (base 16) representation of the inputblob. this method can be used to compute the client response (for example, ha1 or ha2) for http digest authentication (rfc2617). urldecode(inputstring, encodingscheme) decodes a string in application/x-www-form-urlencoded format using a specific encoding scheme, for example “utf-8.” urlencode(inputstring, encodingscheme) encodes a string into the application/x-www-form-urlencoded format using a specific encoding scheme, for example “utf-8.” 3015apex reference guide encodingutil class base64decode(inputstring) converts a base64-encoded string to a blob representing its normal form. signature public static blob base64decode(string inputstring) parameters inputstring type: string return value type: blob base64encode(inputblob) converts a blob to an unencoded string representing its normal form. signature public static string base64encode(bl" "ob inputblob) parameters inputblob type: blob return value type: string convertfromhex(inputstring) converts the specified hexadecimal (base 16) string to a blob value and returns this blob value. signature public static blob convertfromhex(string inputstring) parameters inputstring type: string the hexadecimal string to convert. the string can contain only valid hexadecimal characters (0-9, a-f, a-f) and must have an even number of characters. 3016apex reference guide encodingutil class return value type: blob usage each byte in the blob is constructed from two hexadecimal characters in the input string. the convertfromhex method throws the following exceptions. • nullpointerexception — the inputstring is null. • invalidparametervalueexception — the inputstring contains invalid hexadecimal characters or doesn’t contain an even number of characters. example blob blobvalue = encodingutil.convertfromhex('4a4b4c'); system.assertequals('jkl', blobvalue.tostring()); converttohex(inputblob) returns a hexadecimal (base 16) representation of the inputblob. this method can be used to compute the client response (for example, ha1 or ha2) for http digest authentication (rfc2617). signature public static string converttohex(blob inputblob) parameters inputblob type: blob return value type: string urldecode(inputstring, encodingscheme) decodes a string in application/x-www-form-urlencoded format using a specific encoding scheme, for example “utf-8.” signature public static string urldecode(string inputstring, string encodingscheme) parameters inputstring type: string encodingscheme type: string 3017apex reference guide enum methods return value type: string usage this method uses the supplied encoding scheme to determine which characters are represented by any consecutive sequence of the form \""%xy\"". for more information about the format, see the form-urlencoded media type in hypertext markup language - 2.0. urlencode(inputstring, encodingscheme) encodes a string into the application/x-www-form-urlencoded format using a specific encoding scheme, for example “utf-8.” signature public static string urlencode(string inputstring, string encodingscheme) parameters inputstring type: string encodingscheme type: string return value type: string usage this method uses the supplied encoding scheme to obtain the bytes for unsafe characters. for more information about the format, see the form-urlencoded media type in hypertext markup language - 2.0. example string encoded = encodingutil.urlencode(url, 'utf-8'); enum methods an enum is an abstract data type with values that each take on exactly one of a finite set of identifiers that you specify. apex provides built-in enums, such as logginglevel, and you can define your own enum. all apex enums, whether user-defined enums or built-in enums, have these common methods: values this method returns the values of the enum as a list of the same enum type. valueof(string enumstr) this method converts a specified string to an enum constant value. an exception is thrown if the input string doesn’t match an enum value. 3018apex reference guide eventbus class each enum value has the following methods that take no arguments. name returns the name of the enum item as a string. ordinal returns the position of the item, as an integer, in the list of enum values starting with zero. enum values cannot have user-defined methods added to them. for more information about enum, see enums. example integer i = statuscode.delete_failed.ordinal(); string s = statuscode.delete_failed.name(); list values = statuscode.values(); statuscode statuscodevalue = statuscode.valueof('delete_failed'); eventbus class contains methods for publishing platform events. namespace system in this section: eventbus methods see also: platform events developer guide: publishing platform events eventbus methods" "the following are methods for eventbus. all methods are static. in this section: getoperationid(result) returns the event uuid, which identifies a published event message. publish(event) publishes the given platform event. publish(events) publishes the given list of platform events. 3019apex reference guide eventbus class getoperationid(result) returns the event uuid, which identifies a published event message. signature public static string getoperationid(object result) parameters result type: object the saveresult that is returned by the eventbus.publish call. return value type: string publish(event) publishes the given platform event. signature public static database.saveresult publish(sobject event) parameters event type: sobject an instance of a platform event. for example, an instance of myevent__e. you must first define your platform event object in your org. return value type: database.saveresult the result of publishing the given event. database.saveresult contains information about whether the operation was successful and the errors encountered. if the issuccess() method returns true, the publish request is queued in salesforce and the event message is published asynchronously. for more information, see high-volume platform event persistence. if issuccess() returns false, the event publish operation resulted in errors, which are returned in the database.error object. this method doesn’t throw an exception due to an unsuccessful publish operation. database.saveresult also contains the id system field. the id field value isn’t included in the event message delivered to subscribers. it isn’t used to identify an event message, and isn’t always unique. usage • the platform event message is published either immediately or after a transaction is committed, depending on the publish behavior you set in the platform event definition. for more information, see platform event fields in the platform events developer guide. 3020apex reference guide exception class and built-in exceptions • apex governor limits apply. for events configured with the publish after commit behavior, each method execution is counted as one dml statement against the apex dml statement limit. you can check limit usage using the apex limits.getdmlstatements() on page 3115 method. for events configured with the publish immediately behavior, each method execution is counted against a separate event publishing limit of 150 eventbus.publish() calls. you can check limit usage using the apex limits.getpublishimmediatedml() on page 3118 method. publish(events) publishes the given list of platform events. signature public static list publish(list events) parameters events type: list a list of platform event instances. for example, a list of myevent__e objects. you must first define your platform event object in your salesforce org. return value type: list a list of results, each corresponding to the result of publishing one event. for each event, database.saveresult contains information about whether the operation was successful and the errors encountered. if the issuccess() method returns true, the publish request is queued in salesforce and the event message is published asynchronously. for more information, see high-volume platform event persistence. if issuccess() returns false, the event publish operation resulted in errors, which are returned in the database.error object. eventbus.publish() can publish some passed-in events, even when other events can’t be published due to errors. the eventbus.publish() method doesn’t throw exceptions caused by an unsuccessful publish operation. it’s similar in behavior to the apex database.insert method when called with the partial success option. database.saveresult also contains the id system field. the id field value isn’t included in the event message delivered to subscribers. it isn’t used to identify an event message, and isn’t always unique. usage • the platform event message is published either immediately or after a transaction is committed, depending on the publish behavior you set in the platform event definition. for more information, see platform event fields in the platform events developer guide. • apex governor limits apply. for events configured with the publish after commit behavior, each method execution is counted as one dml statement against the apex dml statement limit. you can check limit usage using the apex limits.getdmlstatements() on page 3115 method. for events configured with the publish immediately behavior, each method execution" "is counted against a separate event publishing limit of 150 eventbus.publish() calls. you can check limit usage using the apex limits.getpublishimmediatedml() on page 3118 method. exception class and built-in exceptions an exception denotes an error that disrupts the normal flow of code execution. you can use apex built-in exceptions or create custom exceptions. all exceptions have common methods. 3021apex reference guide exception class and built-in exceptions all exceptions support built-in methods for returning the error message and exception type. in addition to the standard exception class, there are several different types of exceptions: the following are exceptions in the system namespace. exception description assertexception a system.assert failure that halts code execution. optionally contains the custom message specified in the last (msg) argument to the assert() method. auraexception legacy aura-related exception. use system.aurahandledexception instead. aurahandledexception returns a custom error message to a javascript controller. see returning errors from an apex server-side controller. asyncexception any problem with an asynchronous operation, such as failing to enqueue an asynchronous call. bigobjectexception any problem with big object records, such as connection timeouts during attempts to access or insert big object records. calloutexception any problem with a web service operation, such as failing to make a callout to an external system. dataweavescriptexception any run-time script errors that occur within dataweave in apex. dmlexception any problem with a dml statement, such as an insert statement missing a required field on a record. emailexception any problem with email, such as failure to deliver. for more information, see outbound email. externalobjectexception any problem with external object records, such as connection timeouts during attempts to access the data that’s stored on external systems. finalexception any attempt to mutate a read-only collection or record such as an sobject in an after-update trigger, or a final variable. this exception causes execution to halt. flowexception any problem with starting flow interviews from apex. for example, if an active version of the flow can’t be found or it can’t be started from apex. handledexception a generic handled exception. illegalargumentexception an illegal argument was provided to a method call. for example, a method that requires a non-null argument throws this exception if a null value is passed into the method. invalidheaderexception an illegal header argument was provided to an apex rest call. for example, a call to the restresponse.addheader(name, value) method throws this exception if the header name is cookie. invalidparametervalueexception this exception is used with both visualforce pages and salesforce functions. visualforce the exception is thrown when an invalid parameter is supplied for a method, or any problem is encountered with a url used with visualforce pages. for more information on visualforce, see the visualforce developer's guide. 3022apex reference guide exception class and built-in exceptions exception description salesforce functions the exception is thrown when the functionname parameter to function.get() doesn’t have the correct project name.function name format. for more information on salesforce functions, see function.get(). limitexception a governor limit has been exceeded. this exception can’t be caught. jsonexception any problem with json serialization and deserialization operations. for more information, see the methods of system.json, system.jsonparser, and system.jsongenerator. listexception any problem with a list, such as attempting to access an index that is out of bounds. mathexception any problem with a mathematical operation, such as dividing by zero. noaccessexception any problem with unauthorized access, such as trying to access an sobject that the current user doesn’t have access to. this exception is used with visualforce pages. for more information on visualforce, see the visualforce developer's guide. nodatafoundexception this exception is used with both visualforce pages and salesforce functions. visualforce the exception is thrown with data that doesn't exist, such as trying to access an sobject that has been deleted. for more information on visualforce, see the visualforce developer's guide. salesforce functions the exception is thrown when the project or function name provided in the functionname parameter to the function.get() method can't be found. for more information on salesforce functions, see function.get(). nosuchelementexception this exception is thrown if you try to access items that are outside the bounds of a list. this exception is used by the iter" "ator next method. for example, if iterator.hasnext() == false and you call iterator.next(), this exception is thrown. this exception is also used by the apex flex queue methods and is thrown if you attempt to access a job at an invalid position in the flex queue. nullpointerexception any problem with dereferencing null, such as in the following code: string s; s.tolowercase(); // since s is null, this call causes // a nullpointerexception queryexception any problem with soql queries, such as assigning a query that returns no records or more than one record to a singleton sobject variable. requiredfeaturemissing a chatter feature is required for code that has been deployed to an organization that doesn’t have chatter enabled. 3023apex reference guide exception class and built-in exceptions exception description searchexception any problem with sosl queries executed with soap api search() call, for example, when the searchstring parameter contains fewer than two characters. for more information, see the soap api developer guide. securityexception any problem with static methods in the crypto utility class. for more information, see crypto class. serializationexception any problem with the serialization of data. this exception is used with visualforce pages. for more information on visualforce, see the visualforce developer's guide. sobjectexception any problem with sobject records, such as attempting to change a field in an update statement that can only be changed during insert. stringexception any problem with strings, such as a string that is exceeding your heap size. typeexception any problem with type conversions, such as attempting to convert the string 'a' to an integer using the valueof method. unexpectedexception a non-recoverable internal error within salesforce has occurred. this exception causes execution to halt. if necessary, contact salesforce customer support for more information. visualforceexception any problem with a visualforce page. for more information on visualforce, see the visualforce developer's guide. xmlexception any problem with the xmlstream classes, such as failing to read or write xml. the following is an example using the dmlexception exception: account[] accts = new account[]{new account(billingcity = 'san jose')}; try { insert accts; } catch (system.dmlexception e) { for (integer i = 0; i < e.getnumdml(); i++) { // process exception here system.debug(e.getdmlmessage(i)); } } for exceptions in other namespaces, see: • cache exceptions • canvas exceptions • connectapi exceptions • datasource exceptions • reports exceptions • site exceptions common exception methods exception methods are all called by and operate on an instance of an exception. this table describes all instance exception methods. all types of exceptions have these methods in common. 3024apex reference guide exception class and built-in exceptions name arguments return type description getcause exception returns the cause of the exception as an exception object. getlinenumber integer returns the line number from where the exception was thrown. getmessage string returns the error message that displays for the user. getstacktracestring string returns the stack trace of a thrown exception as a string. gettypename string returns the type of exception, such as dmlexception, listexception, mathexception, and so on. initcause exception cause void sets the cause for this exception, if one hasn’t already been set. setmessage string s void sets the error message that displays for the user. dmlexception and emailexception methods in addition to the common exception methods, dmlexception and emailexception have these methods: name arguments return type description getdmlfieldnames integer i string [] returns the names of the field or fields that caused the error described by the ith failed row. getdmlfields integer i schema.sobjectfield [] returns the field token or tokens for the field or fields that caused the error described by the ith failed row. for more information on field tokens, see dynamic apex. getdmlid integer i string returns the id of the failed record that caused the error described by the ith failed row. getdmlindex integer i integer returns the original row position of the ith failed row. getdmlmessage integer i string returns the user message for the ith failed row. getdmlstatuscode integer i string deprecated. use getdmltype instead. returns the apex failure code for the ith failed" "row. getdmltype integer i system.statuscode returns the value of the system.statuscode enum. for example: try { insert new account(); } catch (system.dmlexception ex) { system.assertequals( statuscode.required_field_missing, ex.getdmltype(0)); } for more information about system.statuscode, see enums. 3025apex reference guide flexqueue class name arguments return type description getnumdml integer returns the number of failed rows for dml exceptions. queryexception method in addition to the common exception methods, queryexception has this method. name arguments return type description getinaccessiblefields map on page returns a map in which each key is an sobjecttype 3144> names in fully qualified format (namespace__fieldname__c). use this method to determine the cause of the queryexception. the returned map contains data only if the method that threw the queryexception is running in user mode (as opposed to the default system mode). in this code sample, it's assumed that the user doesn’t have field level security access to the contact.email and account.website fields. try { list accounts = [select website, (select email from contacts) from account with user_mode]; } catch (queryexception qe) { // handle inaccessible fields map> inaccessible = qe.getinaccessiblefields(); set accountfields = inaccessible.get('account'); set contactfields = inaccessible.get('contact'); } flexqueue class contains methods that reorder batch jobs in the apex flex queue. namespace system 3026apex reference guide flexqueue class usage you can place up to 100 batch jobs in a holding status for future execution. when system resources become available, the jobs are taken from the top of the apex flex queue and moved to the batch job queue. up to five queued or active jobs can be processed simultaneously for each org. when a job is moved out of the flex queue for processing, its status changes from holding to queued. queued jobs are executed when the system is ready to process new jobs. use this class’s methods to reorder your holding jobs in the flex queue. as best practice and for safe usage, a flexqueue reorder method must be the final statement in a transaction. example this example moves a job to the front of the flex queue so that it’s executed immediately. the job is moved by calling the system.flexqueue.movejobtofront() method with the high priority job id as the parameter. id highpriorityjobid = database.executebatch(new highprioritybatchclass(), 200); boolean jobmovedtofrontofqueue = flexqueue.movejobtofront(highpriorityjobid); in this section: flexqueue methods see also: monitoring the apex flex queue apex developer guide: using batch apex flexqueue methods the following are methods for flexqueue. in this section: moveafterjob(jobtomoveid, jobinqueueid) moves the job with the id jobtomoveid immediately after the job with the id jobinqueueid in the flex queue. you can move jobtomoveid forward or backward in the queue. if either job isn’t in the queue, it throws an element-not-found exception. returns true if the job is moved, or false if jobtomoveid is already immediately after jobinqueueid, so no change is made. movebeforejob(jobtomoveid, jobinqueueid) moves the job with the id jobtomoveid immediately before the job with the id jobinqueueid in the flex queue. you can move jobtomoveid forward or backward in the queue. if either job isn’t in the queue, it throws an element-not-found exception. returns true if the job is moved, or false if jobtomoveid is already immediately before jobinqueueid, so no change is made. movejobtoend(jobid) moves the specified job the end of the flex queue, to index position (size - 1). all jobs after the job’s starting position move one spot forward. if the job isn’t in the queue, it throws an element-not-found exception." "returns true if the job is moved, or false if the job is already at the end of the queue, so no change is made. 3027apex reference guide flexqueue class movejobtofront(jobid) moves the specified job to the front of the flex queue, to index position 0. all other jobs move back one spot. if the job isn’t in the queue, it throws an element-not-found exception. returns true if the job is moved, or false if the job is already at the front of the queue, so no change is made. moveafterjob(jobtomoveid, jobinqueueid) moves the job with the id jobtomoveid immediately after the job with the id jobinqueueid in the flex queue. you can move jobtomoveid forward or backward in the queue. if either job isn’t in the queue, it throws an element-not-found exception. returns true if the job is moved, or false if jobtomoveid is already immediately after jobinqueueid, so no change is made. signature public static boolean moveafterjob(id jobtomoveid, id jobinqueueid) parameters jobtomoveid type: id the id of the job to move. jobinqueueid type: id the id of the job to move after. return value type: boolean movebeforejob(jobtomoveid, jobinqueueid) moves the job with the id jobtomoveid immediately before the job with the id jobinqueueid in the flex queue. you can move jobtomoveid forward or backward in the queue. if either job isn’t in the queue, it throws an element-not-found exception. returns true if the job is moved, or false if jobtomoveid is already immediately before jobinqueueid, so no change is made. signature public static boolean movebeforejob(id jobtomoveid, id jobinqueueid) parameters jobtomoveid type: id the id of the job to move. jobinqueueid type: id the id of the job to use as a reference point. 3028apex reference guide featuremanagement class return value type: boolean movejobtoend(jobid) moves the specified job the end of the flex queue, to index position (size - 1). all jobs after the job’s starting position move one spot forward. if the job isn’t in the queue, it throws an element-not-found exception. returns true if the job is moved, or false if the job is already at the end of the queue, so no change is made. signature public static boolean movejobtoend(id jobid) parameters jobid type: id the id of the job to move. return value type: boolean movejobtofront(jobid) moves the specified job to the front of the flex queue, to index position 0. all other jobs move back one spot. if the job isn’t in the queue, it throws an element-not-found exception. returns true if the job is moved, or false if the job is already at the front of the queue, so no change is made. signature public static boolean movejobtofront(id jobid) parameters jobid type: id the id of the job to move. return value type: boolean featuremanagement class use the methods in the system.featuremanagement class to check and modify the values of feature parameters, and to show or hide custom objects and custom permissions in your subscribers’ orgs. 3029apex reference guide featuremanagement class namespace system usage for information about feature parameters, see manage features in second generation managed packages in the salesforce dx developer guide, or manage features in first-generation managed packages in the isvforce guide. the set methods (setpackagebooleanvalue, setpackagedatevalue, setpackageintegervalue) use dml operations on setup sobjects. to learn more about mixing operations in a test, see mixed dml operations in test methods. in this section: featuremanagement methods featuremanagement methods the following are methods for featuremanagement. in this section: changeprotection(apiname, typeapiname, protection) hides or reveals custom permissions, or reveals custom objects, in your subscriber’s org. checkpackagebooleanvalue(apiname) checks the value__c value of the featureparameterboolean__c record for a feature parameter in your subscriber’s org." "you set the record’s value using setpackagebooleanvalue(apiname, value). checkpackagedatevalue(apiname) checks the value__c value of the featureparameterdate__c record for a feature parameter in your subscriber’s org. you can set the record’s value using setpackagedatevalue(apiname, value). checkpackageintegervalue(apiname) checks the value__c value of the featureparameterinteger__c record for a feature parameter in your subscriber’s org. you can set the record’s value using setpackageintegervalue(apiname, value). checkpermission(apiname) checks whether a custom permission is enabled. setpackagebooleanvalue(apiname, value) sets the value__c value of the featureparameterboolean__c record for a subscriber-to-lmo feature parameter in your subscriber’s org. you can check the record’s value using checkpackagebooleanvalue(apiname). setpackagedatevalue(apiname, value) sets the value__c value of the featureparameterdate__c record for a subscriber-to-lmo feature parameter in your subscriber’s org. you can check the record’s value using checkpackagedatevalue(apiname). setpackageintegervalue(apiname, value) sets the value__c value of the featureparameterinteger__c record for a subscriber-to-lmo feature parameter in your subscriber’s org. you can check the record’s value using checkpackageintegervalue(apiname). 3030apex reference guide featuremanagement class changeprotection(apiname, typeapiname, protection) hides or reveals custom permissions, or reveals custom objects, in your subscriber’s org. signature public static void changeprotection(string apiname, string typeapiname, string protection) parameters apiname type: string the api name of the custom object or custom permission to show or hide—for example, 'mycustomobject__c' or 'mycustompermission'. typeapiname type: string the api name of the type that you want to show or hide: 'customobject' or 'custompermission'. protection type: string to show a custom object or custom permission, 'unprotected'. to hide a custom permission, 'protected'. return value type: void usage warning: for custom permissions, you can toggle the protected value indefinitely. however, after you’ve released unprotected objects to subscribers, you can’t set visibility to protected. be sure to protect any custom objects that you want to hide before you release the first package version that contains them. to hide custom permissions in released packages: featuremanagement.changeprotection('yourcustompermissionname', 'custompermission', 'protected'); to unhide custom permissions and custom objects in released packages: featuremanagement.changeprotection('yourcustompermissionname', 'custompermission', 'unprotected'); featuremanagement.changeprotection('yourcustomobjectname__c', 'customobject', 'unprotected'); checkpackagebooleanvalue(apiname) checks the value__c value of the featureparameterboolean__c record for a feature parameter in your subscriber’s org. you set the record’s value using setpackagebooleanvalue(apiname, value). 3031apex reference guide featuremanagement class signature public static boolean checkpackagebooleanvalue(string apiname) parameters apiname type: string the fullname__c value of the feature parameter whose value you want to check—for example, 'specialaccessavailable'. return value type: boolean the value that’s currently assigned to the value__c field on the featureparameterboolean__c record that associates the feature parameter with its related license. checkpackagedatevalue(apiname) checks the value__c value of the featureparameterdate__c record for a feature parameter in your subscriber’s org. you can set the record’s value using setpackagedatevalue(apiname, value). signature public static date checkpackagedatevalue(string apiname) parameters apiname type: string the fullname__c value of the feature parameter whose value you want to check—for example, 'trialexpirationdate'. return value type: date the value that’s currently assigned to the value__c field on the featureparameterdate__c record that associates the feature parameter with its related license. checkpackageintegervalue(apiname)" "checks the value__c value of the featureparameterinteger__c record for a feature parameter in your subscriber’s org. you can set the record’s value using setpackageintegervalue(apiname, value). signature public static integer checkpackageintegervalue(string apiname) 3032" "apex reference guide featuremanagement class parameters apiname type: string the fullname__c value of the feature parameter whose value you want to check—for example, 'numberoflicenses'. return value type: integer the value that’s currently assigned to the value__c field on the featureparameterinteger__c record that associates the feature parameter with its related license. checkpermission(apiname) checks whether a custom permission is enabled. signature public static boolean checkpermission(string apiname) parameters apiname type: string the api name of the custom permission to check the value of—for example, 'mycustompermission'. return value type: boolean shows whether the permission is enabled (true) or disabled (false). setpackagebooleanvalue(apiname, value) sets the value__c value of the featureparameterboolean__c record for a subscriber-to-lmo feature parameter in your subscriber’s org. you can check the record’s value using checkpackagebooleanvalue(apiname). signature public static void setpackagebooleanvalue(string apiname, boolean value) parameters apiname type: string the fullname__c value of the feature parameter whose value you want to set—for example, 'specialaccessavailable'. value type: boolean 3033apex reference guide featuremanagement class the value to assign to the value__c field on the featureparameterboolean__c record that associates the feature parameter with its related license. return value type: void setpackagedatevalue(apiname, value) sets the value__c value of the featureparameterdate__c record for a subscriber-to-lmo feature parameter in your subscriber’s org. you can check the record’s value using checkpackagedatevalue(apiname). signature public static void setpackagedatevalue(string apiname, date value) parameters apiname type: string the fullname__c value of the feature parameter whose value you want to set—for example, 'trialexpirationdate'. value type: date the value to assign to the value__c field on the featureparameterdate__c record that associates the feature parameter with its related license. return value type: void setpackageintegervalue(apiname, value) sets the value__c value of the featureparameterinteger__c record for a subscriber-to-lmo feature parameter in your subscriber’s org. you can check the record’s value using checkpackageintegervalue(apiname). signature public static void setpackageintegervalue(string apiname, integer value) parameters apiname type: string the fullname__c value of the feature parameter whose value you want to set—for example, 'numberoflicenses'. value type: integer the value to assign to the value__c field on the featureparameterinteger__c record that associates the feature parameter with its related license. 3034apex reference guide formula class return value type: void formula class contains the recalculateformulas method that updates (recalculates) all formula fields on the input sobjects. namespace system usage recalculate formula fields on new or queried sobjects. if all data is present on the sobjects, soql limits are not affected. if the data required to evaluate a formula field is missing, that data is loaded and limits are changed accordingly. the new formula values are stored in the sobjects themselves and overwrite previous values of formula fields. example account a = new account(); a.name = 'salesforce'; a.billingcity = 'san francisco'; list accounts = new list{a}; list results = formula.recalculateformulas(accounts); system.assert(results[0].issuccess()); // option 1 system.debug('new value: ' + accounts[0].get('my_formula_field__c')); // option 2 system.debug('new value: ' + results[0].getsobject().get(‘my_formula_field__c’)); in this section: formula methods formula methods the following are methods for formula. in this section: recalculateformulas(sobjects) updates (recalculates) all formula fields on the input sobjects. recalculateformulas(sobject" "s) updates (recalculates) all formula fields on the input sobjects. 3035apex reference guide formularecalcfielderror class signature public static list recalculateformulas(list sobjects) parameters sobjects type: list list of sobjects whose formula fields are to be recalculated. return value type: list formularecalcfielderror class the return type of the formularecalcresult.geterrors method. namespace system in this section: formularecalcfielderror methods formularecalcfielderror methods the following are methods for formularecalcfielderror. in this section: getfielderror() returns a message describing the errors encountered during formula recalculation. getfieldname() returns the name of the formula recalculation error field. getfielderror() returns a message describing the errors encountered during formula recalculation. signature public string getfielderror() return value type: string 3036apex reference guide formularecalcresult class getfieldname() returns the name of the formula recalculation error field. signature public string getfieldname() return value type: string formularecalcresult class the return type of the formula.recalculateformulas method. namespace system usage indicates the result and status of recalculating formulas on a single sobject. holds a reference to the sobject and a list of all the fields that were recalculated. example this example assumes that you have a formula field called divide__c with formula “1 / len(name). list accounts = [select name from account where name='acme']; accounts[0].name = ''; list results = formula.recalculateformulas(accounts); formularecalcresult result0 = results[0]; formularecalcfielderror fielderror = result0.geterrors()[0]; system.debug(fielderror.getfieldname()); // 'divide' system.debug(fielderror.getfielderror()); // 'division by zero' in this section: formularecalcresult methods formularecalcresult methods the following are methods for formularecalcresult. in this section: geterrors() if an error occurs during formula recalculation, an array of one or more database error objects, along with error codes and descriptions, is returned. 3037apex reference guide http class getsobject() returns the sobject with formulas recalculated. issuccess() returns a boolean value that is set to true if the formula recalculation process completed successfully; otherwise, it is set to false. geterrors() if an error occurs during formula recalculation, an array of one or more database error objects, along with error codes and descriptions, is returned. signature public list geterrors() return value type: list getsobject() returns the sobject with formulas recalculated. signature public sobject getsobject() return value type: sobject issuccess() returns a boolean value that is set to true if the formula recalculation process completed successfully; otherwise, it is set to false. signature public boolean issuccess() return value type: boolean http class use the http class to initiate an http request and response. namespace system 3038apex reference guide httpcalloutmock interface http methods the following are methods for http. all are instance methods. in this section: send(request) sends an httprequest and returns the response. tostring() returns a string that displays and identifies the object's properties. send(request) sends an httprequest and returns the response. signature public httpresponse send(httprequest request) parameters request type: system.httprequest return value type: system.httpresponse tostring() returns a string that displays and identifies the object's properties. signature public string tostring() return value type: string httpcalloutmock interface enables sending fake responses when testing http callouts. namespace system 3039apex reference guide httprequest class usage" "for an implementation example, see testing http callouts by implementing the httpcalloutmock interface. httpcalloutmock methods the following are methods for httpcalloutmock. in this section: respond(request) returns an http response for the given request. the implementation of this method is called by the apex runtime to send a fake response when an http callout is made after test.setmock has been called. respond(request) returns an http response for the given request. the implementation of this method is called by the apex runtime to send a fake response when an http callout is made after test.setmock has been called. signature public httpresponse respond(httprequest request) parameters request type: system.httprequest return value type: system.httpresponse httprequest class use the httprequest class to programmatically create http requests like get, post, patch, put, and delete. namespace system usage use the xml classes or json classes to parse xml or json content in the body of a request created by httprequest. example the following example illustrates how you can use an authorization header with a request and handle the response. public class authcallout { 3040apex reference guide httprequest class public void basicauthcallout(){ httprequest req = new httprequest(); req.setendpoint('http://www.yahoo.com'); req.setmethod('get'); // specify the required user name and password to access the endpoint // as well as the header and header information string username = 'myname'; string password = 'mypwd'; blob headervalue = blob.valueof(username + ':' + password); string authorizationheader = 'basic ' + encodingutil.base64encode(headervalue); req.setheader('authorization', authorizationheader); // create a new http object to send the request object // a response object is generated as a result of the request http http = new http(); httpresponse res = http.send(req); system.debug(res.getbody()); } } note: you can set the endpoint as a named credential url. a named credential url contains the scheme callout:, the name of the named credential, and an optional path. for example: callout:my_named_credential/some_path. a named credential specifies the url of a callout endpoint and its required authentication parameters in one definition. salesforce manages all authentication for apex callouts that specify a named credential as the callout endpoint so that your code doesn’t have to. see named credentials as callout endpoints. compression to compress the data you send, use setcompressed. httprequest req = new httprequest(); req.setendpoint('my_endpoint'); req.setcompressed(true); req.setbody('some post body'); if a response comes back in compressed format, getbody recognizes the format, uncompresses it, and returns the uncompressed value. in this section: httprequest constructors httprequest methods see also: apex developer guide: json support apex developer guide: xml support 3041apex reference guide httprequest class httprequest constructors the following are constructors for httprequest. in this section: httprequest() creates a new instance of the httprequest class. httprequest() creates a new instance of the httprequest class. signature public httprequest() httprequest methods the following are methods for httprequest. all are instance methods. in this section: getbody() retrieves the body of this request. getbodyasblob() retrieves the body of this request as a blob. getbodydocument() retrieves the body of this request as a dom document. getcompressed() if true, the request body is compressed, false otherwise. getendpoint() retrieves the url for the endpoint of the external server for this request. getheader(key) retrieves the contents of the request header. getmethod() returns the type of method used by httprequest. setbody(body) sets the contents of the body for this request. setbodyasblob(body) sets the contents of the body for this request using a blob. setbodydocument(document) sets the contents of the body for this request. the contents represent a dom document. set" "clientcertificate(clientcert, password) this method is deprecated. use setclientcertificatename instead. 3042apex reference guide httprequest class setclientcertificatename(certdevname) if the external service requires a client certificate for authentication, set the certificate name. setcompressed(flag) if true, the data in the body is delivered to the endpoint in the gzip compressed format. if false, no compression format is used. setendpoint(endpoint) specifies the endpoint for this request. setheader(key, value) sets the contents of the request header. setmethod(method) sets the type of method to be used for the http request. settimeout(timeout) sets a timeout for the request between 1 and 120,000 milliseconds. the timeout is the maximum time to wait for establishing the http connection. the same timeout is used for waiting for the request to start. when the request is executing, such as retrieving or posting data, the connection is kept alive until the request finishes. tostring() returns a string containing the url for the endpoint of the external server for this request and the method used, for example, endpoint=http://yourserver, method=post getbody() retrieves the body of this request. signature public string getbody() return value type: string getbodyasblob() retrieves the body of this request as a blob. signature public blob getbodyasblob() return value type: blob getbodydocument() retrieves the body of this request as a dom document. 3043apex reference guide httprequest class signature public dom.document getbodydocument() return value type: dom.document example use this method as a shortcut for: string xml = httprequest.getbody(); dom.document domdoc = new dom.document(xml); getcompressed() if true, the request body is compressed, false otherwise. signature public boolean getcompressed() return value type: boolean getendpoint() retrieves the url for the endpoint of the external server for this request. signature public string getendpoint() return value type: string getheader(key) retrieves the contents of the request header. signature public string getheader(string key) parameters key type: string 3044apex reference guide httprequest class return value type: string getmethod() returns the type of method used by httprequest. signature public string getmethod() return value type: string usage examples of return values: • delete • get • head • patch • post • put • trace setbody(body) sets the contents of the body for this request. signature public void setbody(string body) parameters body type: string return value type: void usage limit: 6 mb for synchronous apex or 12 mb for asynchronous apex. the http request and response sizes count towards the total heap size. 3045apex reference guide httprequest class setbodyasblob(body) sets the contents of the body for this request using a blob. signature public void setbodyasblob(blob body) parameters body type: blob return value type: void usage limit: 6 mb for synchronous apex or 12 mb for asynchronous apex. the http request and response sizes count towards the total heap size. setbodydocument(document) sets the contents of the body for this request. the contents represent a dom document. signature public void setbodydocument(dom.document document) parameters document type: dom.document return value type: void usage limit: 6 mb for synchronous apex or 12 mb for asynchronous apex. setclientcertificate(clientcert, password) this method is deprecated. use setclientcertificatename instead. signature public void setclientcertificate(string clientcert, string password) 3046apex reference guide httprequest class parameters clientcert type: string password type: string return value type: void usage if the server requires a client certificate for authentication, set the client certificate pkcs12 key store and password. setclientcertificatename(certdevname) if the external service requires a client certificate for authentication, set the certificate name. signature public void setclientcertificatename(string certdevname)" "parameters certdevname type: string return value type: void usage see using certificates with http requests. setcompressed(flag) if true, the data in the body is delivered to the endpoint in the gzip compressed format. if false, no compression format is used. signature public void setcompressed(boolean flag) parameters flag type: boolean 3047apex reference guide httprequest class return value type: void setendpoint(endpoint) specifies the endpoint for this request. signature public void setendpoint(string endpoint) parameters endpoint type: string possible values for the endpoint: • endpoint url https://my_endpoint.example.com/some_path • named credential url, which contains the scheme callout, the name of the named credential, and, optionally, an appended path callout:my_named_credential/some_path return value type: void see also: apex developer guide: named credentials as callout endpoints setheader(key, value) sets the contents of the request header. signature public void setheader(string key, string value) parameters key type: string value type: string 3048apex reference guide httprequest class return value type: void usage limit 100 kb. setmethod(method) sets the type of method to be used for the http request. signature public void setmethod(string method) parameters method type: string possible values for the method type include: • delete • get • head • patch • post • put • trace return value type: void usage you can also use this method to set any required options. settimeout(timeout) sets a timeout for the request between 1 and 120,000 milliseconds. the timeout is the maximum time to wait for establishing the http connection. the same timeout is used for waiting for the request to start. when the request is executing, such as retrieving or posting data, the connection is kept alive until the request finishes. signature public void settimeout(integer timeout) 3049apex reference guide httpresponse class parameters timeout type: integer return value type: void tostring() returns a string containing the url for the endpoint of the external server for this request and the method used, for example, endpoint=http://yourserver, method=post signature public string tostring() return value type: string httpresponse class use the httpresponse class to handle the http response returned by the http class. namespace system usage use the xml classes or json classes to parse xml or json content in the body of a response accessed by httpresponse. example in the following getxmlstreamreader example, content is retrieved via an http callout, then the xml is parsed using the xmlstreamreader class. public class readerfromcalloutsample { public void getandparse() { // get the xml document from the endpoint http http = new http(); httprequest req = new httprequest(); req.setendpoint(url.getorgdomainurl().toexternalform() + '/services/data'); req.setmethod('get'); req.setheader('accept', 'application/xml'); httpresponse res = http.send(req); // log the xml content 3050apex reference guide httpresponse class system.debug(res.getbody()); // generate the http response as an xml stream xmlstreamreader reader = res.getxmlstreamreader(); // read through the xml while(reader.hasnext()) { system.debug('event type:' + reader.geteventtype()); if (reader.geteventtype() == xmltag.start_element) { system.debug(reader.getlocalname()); } reader.next(); } } } see also: apex developer guide: json support apex developer guide: xml support httpresponse methods the following are methods for httpresponse. all are instance methods. in this section: getbody() retrieves the body returned in the response. getbodyasblob() retrieves the body returned in the response as a blob. getbodydocument() retrieves the body returned in the response as a dom document. getheader(key) retrieves the contents of the response header." "getheaderkeys() retrieves an array of header keys returned in the response. getstatus() retrieves the status message returned for the response. getstatuscode() retrieves the value of the status code returned in the response. getxmlstreamreader() returns an xmlstreamreader that parses the body of the callout response. setbody(body) specifies the body returned in the response. 3051apex reference guide httpresponse class setbodyasblob(body) specifies the body returned in the response using a blob. setheader(key, value) specifies the contents of the response header. setstatus(status) specifies the status message returned in the response. setstatuscode(statuscode) specifies the value of the status code returned in the response. tostring() returns the status message and status code returned in the response, for example: getbody() retrieves the body returned in the response. signature public string getbody() return value type: string usage limit 6 mb for synchronous apex or 12 mb for asynchronous apex. the http request and response sizes count towards the total heap size. getbodyasblob() retrieves the body returned in the response as a blob. signature public blob getbodyasblob() return value type: blob usage limit 6 mb for synchronous apex or 12 mb for asynchronous apex. the http request and response sizes count towards the total heap size. getbodydocument() retrieves the body returned in the response as a dom document. 3052apex reference guide httpresponse class signature public dom.document getbodydocument() return value type: dom.document example use it as a shortcut for: string xml = httpresponse.getbody(); dom.document domdoc = new dom.document(xml); getheader(key) retrieves the contents of the response header. signature public string getheader(string key) parameters key type: string return value type: string getheaderkeys() retrieves an array of header keys returned in the response. signature public string[] getheaderkeys() return value type: string[] getstatus() retrieves the status message returned for the response. signature public string getstatus() 3053apex reference guide httpresponse class return value type: string getstatuscode() retrieves the value of the status code returned in the response. signature public integer getstatuscode() return value type: integer getxmlstreamreader() returns an xmlstreamreader that parses the body of the callout response. signature public xmlstreamreader getxmlstreamreader() return value type: system.xmlstreamreader usage use it as a shortcut for: string xml = httpresponse.getbody(); xmlstreamreader xsr = new xmlstreamreader(xml); setbody(body) specifies the body returned in the response. signature public void setbody(string body) parameters body type: string return value type: void 3054apex reference guide httpresponse class setbodyasblob(body) specifies the body returned in the response using a blob. signature public void setbodyasblob(blob body) parameters body type: blob return value type: void setheader(key, value) specifies the contents of the response header. signature public void setheader(string key, string value) parameters key type: string value type: string return value type: void setstatus(status) specifies the status message returned in the response. signature public void setstatus(string status) parameters status type: string 3055apex reference guide id class return value type: void setstatuscode(statuscode) specifies the value of the status code returned in the response. signature public void setstatuscode(integer statuscode) parameters statuscode type: integer return value type: void tostring() returns the status message and status code returned in the response, for example: signature public string tostring() return value type: string example status=ok, statuscode=200 id class contains methods for the id primitive data type. namespace system example: getting an sobject token from an id" "this sample shows how to use the getsobjecttype method to obtain an sobject token from an id. the updateowner method in this sample accepts a list of ids of the sobjects to update the ownerid field of. this list contains ids of sobjects of the same type. the second parameter is the new owner id. note that since it is a future method, it doesn’t accept sobject types as parameters; this is why 3056apex reference guide id class it accepts ids of sobjects. this method gets the sobject token from the first id in the list, then does a describe to obtain the object name and constructs a query dynamicallly. it then queries for all sobjects and updates their owner id fields to the new owner id. public class mydynamicsolution { @future public static void updateowner(list objids, id newownerid) { // validate input system.assert(objids != null); system.assert(objids.size() > 0); system.assert(newownerid != null); // get the sobject token from the first id // (the list contains ids of sobjects of the same type). schema.sobjecttype token = objids[0].getsobjecttype(); // using the token, do a describe // and construct a query dynamically. schema.describesobjectresult dr = token.getdescribe(); string querystring = 'select ownerid from ' + dr.getname() + ' where '; for(id objid : objids) { querystring += 'id=\'' + objid + '\' or '; } // remove the last ' or' querystring = querystring.substring(0, querystring.length() - 4); sobject[] objdblist = database.query(querystring); system.assert(objdblist.size() > 0); // update the owner id on the sobjects for(integer i=0;i, &, "", \, \u2028, \u" "2029, and \u00a9. as a result, html markup is not rendered; instead, it is displayed as text in the salesforce user interface. 3058apex reference guide id class example trigger.new[0].id.adderror('bad'); adderror(errormsg, escape) marks a trigger record with a custom error message, specifies if the error message should be escaped, and prevents any dml operation from occurring. signature public void adderror(string errormsg, boolean escape) parameters errormsg type: string the error message to mark the record with. escape type: boolean indicates whether any html markup in the custom error message should be escaped (true) or not (false). this parameter is ignored in both lightning experience and the salesforce mobile app, and the html is always escaped. the escape parameter only applies in salesforce classic. return value type: void usage the escaped characters are: \n, <, >, &, "", \, \u2028, \u2029, and \u00a9. as a result, html markup is not rendered; instead, it is displayed as text in the salesforce user interface. warning: be cautious if you specify false for the escape argument. unescaped strings displayed in the salesforce user interface can represent a vulnerability in the system because these strings might contain harmful code. if you want to include html markup in the error message, call this method with a false escape argument. make sure that you escape any dynamic content, such as input field values. otherwise, specify true for the escape argument or call adderror(string errormsg) instead. example trigger.new[0].id.adderror('fix & resubmit', false); adderror(exceptionerror) marks a trigger record with a custom error message and prevents any dml operation from occurring. 3059apex reference guide id class signature public void adderror(exception exceptionerror) parameters exceptionerror type: system.exception an exception object or a custom exception object that contains the error message to mark the record with. return value type: void usage this method is similar to the adderror(exceptionerror) sobject method. this method escapes any html markup in the specified error message. the escaped characters are: \n, <, >, &, "", \, \u2028, \u2029, and \u00a9. as a result, html markup is not rendered; instead, it is displayed as text in the salesforce user interface. example public class myexception extends exception{} trigger.new[0].id.adderror(new myexception('invalid id')); adderror(exceptionerror, escape) marks a trigger record with a custom error message and prevents any dml operation from occurring. signature public void adderror(exception exceptionerror, boolean escape) parameters exceptionerror type: system.exception an exception object or a custom exception object that contains the error message to mark the record with. escape type: boolean indicates whether any html markup in the custom error message should be escaped (true) or not (false). this parameter is ignored in both lightning experience and the salesforce mobile app, and the html is always escaped. the escape parameter only applies in salesforce classic. return value type: void 3060apex reference guide id class usage the escaped characters are: \n, <, >, &, "", \, \u2028, \u2029, and \u00a9. as a result, html markup is not rendered; instead, it is displayed as text in the salesforce user interface. warning: be cautious if you specify false for the escape argument. unescaped strings displayed in the salesforce user interface can represent a vulnerability in the system because these strings might contain harmful code. if you want to include html markup in the error message, call this method with a false escape argument. make sure that you escape any dynamic content, such as input field values. otherwise, specify true for the escape argument or call adderror(exception e) instead. example public class myexception extends exception{} account a = new account(); a.adderror(new myexception('invalid id & other issues'), false); getsobjecttype() returns the token for the sobject corresponding to this id. this method is primarily used with describe information. signature public schema.sobjecttype getsobjecttype() return value type: schema.sobjecttype usage for more information about describes, see understanding" "apex describe information. example account a = new account(name = 'account'); insert a; id myid = a.id; system.assertequals(schema.account.sobjecttype, myid.getsobjecttype()); to15(id) converts an 18-character id value to a 15-character case-sensitive string. signature public static string to15() 3061apex reference guide id class return value type: string example string id_15_char = '0d5b000001dvm9t'; string id_18_char = '0d5b000001dvm9tkah'; id testid = id_18_char; system.assertequals(testid.to15(),id_15_char); valueof(toid) converts the specified string into an id and returns the id. signature public static id valueof(string toid) parameters toid type: string return value type: id example id myid = id.valueof('001xa000003dilo'); versioned behavior changes in api version 54.0 and later, assignment of an invalid 15 or 18 character id to a variable results in a system.stringexception exception. valueof(str, restorecasing) converts the specified string into an id and returns the id. if restorecasing is true, and the string represents an 18-character id that has incorrect casing, the method returns an 18-character id that is correctly aligned with its encoded casing. signature public static id valueof(string str, boolean restorecasing) parameters str type: string 3062apex reference guide ideas class string to be converted to an id restorecasing type: boolean if set to true, and str represents an 18-character id, the method returns an 18-character id that is correctly aligned with its casing. return value type: id the return value depends on both the str and the restorecasing parameter values. note: if the str is invalid, the method throws a system.stringexception exception. parameters restorecasing=true restorecasing=false valid 15-character str value because the 15-character input value can’t the method returns a 15-character id. be encoded for casing, the method throws a system.stringexception. valid 18-character str value the method returns an 18-character id that the method doesn’t attempt to correctly is correctly aligned with its encoded casing. align the casing of the 18-character id and returns an 18-character id. ideas class represents zone ideas. namespace system usage ideas is a zone of users who post, vote for, and comment on ideas. an ideas zone provides an online, transparent way for you to attract, manage, and showcase innovation. a set of recent replies (returned by methods, see below) includes ideas that a user posted or commented on that already have comments posted by another user. the returned ideas are listed based on the time of the last comment made by another user, with the most recent ideas appearing first. the userid argument is a required argument that filters the results so only the ideas that the specified user has posted or commented on are returned. the communityid argument filters the results so only the ideas within the specified zone are returned. if this argument is the empty string, then all recent replies for the specified user are returned regardless of the zone. for more information on ideas, see “using ideas” in the salesforce online help. 3063apex reference guide ideas class example the following example finds ideas in a specific zone that have similar titles as a new idea: public class findsimilarideascontroller { public static void test() { // instantiate a new idea idea idea = new idea (); // specify a title for the new idea idea.title = 'increase vacation time for employees'; // specify the communityid (internal_ideas) in which to find similar ideas. community community = [ select id from community where name = 'internal_ideas' ]; idea.communityid = community.id; id[] results = ideas.findsimilar(idea); } } the following example uses a visualforce page in conjunction with a custom controller, that is, a special apex class. for more information on visualforce, see the visualforce developer's guide. this example creates an apex method in the controller that returns unread recent replies. you can leverage this same example for the" "getallrecentreplies and getreadrecentreplies methods. for this example to work, there must be ideas posted to the zone. in addition, at least one zone member must have posted a comment to another zone member's idea or comment. // create an apex method to retrieve the recent replies marked as unread in all communities public class ideascontroller { public idea[] getunreadrecentreplies() { idea[] recentreplies; if (recentreplies == null) { id[] recentrepliesids = ideas.getunreadrecentreplies(userinfo.getuserid(), ''); recentreplies = [select id, title from idea where id in :recentrepliesids]; } return recentreplies; } } the following is the markup for a visualforce page that uses the above custom controller to list unread recent replies. 3064apex reference guide ideas class the following example uses a visualforce page in conjunction with a custom controller to list ideas. then, a second visualforce page and custom controller is used to display a specific idea and mark it as read. for this example to work, there must be ideas posted to the zone. // create a controller to use on a visualforce page to list ideas public class idealistcontroller { public final idea[] ideas {get; private set;} public idealistcontroller() { integer i = 0; ideas = new idea[10]; for (idea tmp : database.query ('select id, title from idea where id != null and parentideaid = null limit 10')) { i++; ideas.add(tmp); } } } the following is the markup for a visualforce page that uses the above custom controller to list ideas: the following example also uses a visualforce page and custom controller, this time, to display the idea that is selected on the above idea list page. in this example, the markread method marks the selected idea and associated comments as read by the user that is currently logged in. note that the markread method is in the constructor so that the idea is marked read immediately when the user goes to a page that uses this controller. for this example to work, there must be ideas posted to the zone. in addition, at least one zone member must have posted a comment to another zone member's idea or comment. // create an apex method in the controller that marks all comments as read for the // selected idea public class viewideacontroller { private final string id = system.currentpage().getparameters().get('id'); public viewideacontroller(apexpages.standardcontroller controller) { ideas.markread(id); } } the following is the markup for a visualforce page that uses the above custom controller to display the idea as read.

3065apex reference guide ideas class
ideas methods the following are methods for ideas. all methods are static. in this section: findsimilar(idea) returns a list of similar ideas based on the title of the specified idea. getallrecentreplies(userid, communityid) returns ideas that have recent replies for the specified user or zone. this includes all read and unread replies. getreadrecentreplies(userid, communityid) returns ideas that have recent replies marked as read. getunreadrecentreplies" "(userid, communityid) returns ideas that have recent replies marked as unread. markread(ideaid) marks all comments as read for the user that is currently logged in. findsimilar(idea) returns a list of similar ideas based on the title of the specified idea. signature public static id[] findsimilar(idea idea) parameters idea type: idea return value type: id[] usage each findsimilar call counts against the sosl query limits. see execution governors and limits. getallrecentreplies(userid, communityid) returns ideas that have recent replies for the specified user or zone. this includes all read and unread replies. signature public static id[] getallrecentreplies(string userid, string communityid) 3066apex reference guide ideas class parameters userid type: string communityid type: string return value type: id[] usage each getallrecentreplies call counts against the soql query limits. see execution governors and limits. getreadrecentreplies(userid, communityid) returns ideas that have recent replies marked as read. signature public static id[] getreadrecentreplies(string userid, string communityid) parameters userid type: string communityid type: string return value type: id[] usage each getreadrecentreplies call counts against the soql query limits. see execution governors and limits. getunreadrecentreplies(userid, communityid) returns ideas that have recent replies marked as unread. signature public static id[] getunreadrecentreplies(string userid, string communityid) parameters userid type: string 3067apex reference guide installhandler interface communityid type: string return value type: id[] usage each getunreadrecentreplies call counts against the soql query limits. see execution governors and limits. markread(ideaid) marks all comments as read for the user that is currently logged in. signature public static void markread(string ideaid) parameters ideaid type: string return value type: void installhandler interface enables custom code to run after a managed package installation or upgrade. namespace system usage app developers can implement this interface to specify apex code that runs automatically after a subscriber installs or upgrades a managed package. this makes it possible to customize the package install or upgrade, based on details of the subscriber’s organization. for instance, you can use the script to populate custom settings, create sample data, send an email to the installer, notify an external system, or kick off a batch operation to populate a new field across a large set of data. the post install script is invoked after tests have been run, and is subject to default governor limits. it runs as a special system user that represents your package, so all operations performed by the script appear to be done by your package. you can access this user by using userinfo. you will only see this user at runtime, not while running tests. if the script fails, the install/upgrade is aborted. any errors in the script are emailed to the user specified in the notify on apex error field of the package. if no user is specified, the install/upgrade details will be unavailable. the post install script has the following additional properties. 3068apex reference guide installhandler interface • it can initiate batch, scheduled, and future jobs. • it can’t access session ids. • it can only perform callouts using an async operation. the callout occurs after the script is run and the install is complete and committed. • it can’t call another apex class in the package if that apex class uses the with sharing keyword. this keyword can prevent the package from successfully installing. see the apex developer guide to learn more. the installhandler interface has a single method called oninstall, which specifies the actions to be performed on install/upgrade. global interface installhandler { void oninstall(installcontext context) }; the oninstall method takes a context object as its argument, which provides the following information. • the org id of the organization in which the installation takes place. • the user id of the user who initiated the installation. • the version number of the previously installed package (specified using the version class). this is always a three-part number, such as 1.2.0. • whether the installation is an upgrade. • whether the installation is a push. the context argument is an object whose type is the installcontext interface. this" "interface is automatically implemented by the system. the following definition of the installcontext interface shows the methods you can call on the context argument. global interface installcontext { id organizationid(); id installerid(); boolean isupgrade(); boolean ispush(); version previousversion(); } in this section: installhandler methods installhandler example implementation installhandler methods the following are methods for installhandler. in this section: oninstall(context) specifies the actions to be performed on install/upgrade. oninstall(context) specifies the actions to be performed on install/upgrade. 3069apex reference guide installhandler interface signature public void oninstall(installcontext context) parameters context type: system.installcontext return value type: void installhandler example implementation the following sample post install script performs these actions on package install/upgrade. • if the previous version is null, that is, the package is being installed for the first time, the script: – creates a new account called “newco” and verifies that it was created. – creates a new instance of the custom object survey, called “client satisfaction survey”. – sends an email message to the subscriber confirming installation of the package. • if the previous version is 1.0, the script creates a new instance of survey called “upgrading from version 1.0”. • if the package is an upgrade, the script creates a new instance of survey called “sample survey during upgrade”. • if the upgrade is being pushed, the script creates a new instance of survey called “sample survey during push”. global class postinstallclass implements installhandler { global void oninstall(installcontext context) { if(context.previousversion() == null) { account a = new account(name='newco'); insert(a); survey__c obj = new survey__c(name='client satisfaction survey'); insert obj; user u = [select id, email from user where id =:context.installerid()]; string toaddress= u.email; string[] toaddresses = new string[]{toaddress}; messaging.singleemailmessage mail = new messaging.singleemailmessage(); mail.settoaddresses(toaddresses); mail.setreplyto('support@package.dev'); mail.setsenderdisplayname('my package support'); mail.setsubject('package install successful'); mail.setplaintextbody('thanks for installing the package.'); messaging.sendemail(new messaging.email[] { mail }); } else if(context.previousversion().compareto(new version(1,0)) == 0) { survey__c obj = new survey__c(name='upgrading from version 1.0'); insert(obj); } if(context.isupgrade()) { 3070apex reference guide integer class survey__c obj = new survey__c(name='sample survey during upgrade'); insert obj; } if(context.ispush()) { survey__c obj = new survey__c(name='sample survey during push'); insert obj; } } } you can test a post install script using the new testinstall method of the test class. this method takes the following arguments. • a class that implements the installhandler interface. • a version object that specifies the version number of the existing package. • an optional boolean value that is true if the installation is a push. the default is false. this sample shows how to test a post install script implemented in the postinstallclass apex class. @istest static void testinstallscript() { postinstallclass postinstall = new postinstallclass(); test.testinstall(postinstall, null); test.testinstall(postinstall, new version(1,0), true); list a = [select id, name from account where name ='newco']; system.assertequals(a.size(), 1, 'account not found'); } integer class contains methods for the integer primitive data type. namespace system usage for more information on integers, see integer data type. integer methods the following are methods for integer. in this section: format() returns the integer as a string using the locale of the context user. valueof(stringtointeger) returns an integer that contains the value of the specified string. as in java, the string is interpreted as representing a signed decimal integer. 3071apex reference guide" "integer class valueof(fieldvalue) converts the specified object to an integer. use this method to convert a history tracking field value or an object that represents an integer value. format() returns the integer as a string using the locale of the context user. signature public string format() return value type: string example integer myint = 22; system.assertequals('22', myint.format()); valueof(stringtointeger) returns an integer that contains the value of the specified string. as in java, the string is interpreted as representing a signed decimal integer. signature public static integer valueof(string stringtointeger) parameters stringtointeger type: string return value type: integer example integer myint = integer.valueof('123'); valueof(fieldvalue) converts the specified object to an integer. use this method to convert a history tracking field value or an object that represents an integer value. 3072apex reference guide json class signature public static integer valueof(object fieldvalue) parameters fieldvalue type: object return value type: integer usage use this method with the oldvalue or newvalue fields of history sobjects, such as accounthistory, when the field type corresponds to an integer type, like a number field. example: example list ahlist = [select field,oldvalue,newvalue from accounthistory]; for(accounthistory ah : ahlist) { system.debug('field: ' + ah.field); if (ah.field == 'numberofemployees') { integer oldvalue = integer.valueof(ah.oldvalue); integer newvalue = integer.valueof(ah.newvalue); } json class contains methods for serializing apex objects into json format and deserializing json content that was serialized using the serialize method in this class. namespace system usage use the methods in the system.json class to perform round-trip json serialization and deserialization of apex objects. see also: apex developer guide: roundtrip serialization and deserialization 3073apex reference guide json class json methods the following are methods for json. all methods are static. in this section: creategenerator(prettyprint) returns a new json generator. createparser(jsonstring) returns a new json parser. deserialize(jsonstring, apextype) deserializes the specified json string into an apex object of the specified type. deserializestrict(jsonstring, apextype) deserializes the specified json string into an apex object of the specified type. deserializeuntyped(jsonstring) deserializes the specified json string into collections of primitive data types. serialize(objecttoserialize) serializes apex objects into json content. serialize(objecttoserialize, suppressapexobjectnulls) suppresses null values when serializing apex objects into json content. serializepretty(objecttoserialize) serializes apex objects into json content and generates indented content using the pretty-print format. serializepretty(objecttoserialize, suppressapexobjectnulls) suppresses null values when serializing apex objects into json content and generates indented content using the pretty-print format. creategenerator(prettyprint) returns a new json generator. signature public static system.jsongenerator creategenerator(boolean prettyprint) parameters prettyprint type: boolean determines whether the json generator creates json content in pretty-print format with the content indented. set to true to create indented content. return value type: system.jsongenerator 3074apex reference guide json class createparser(jsonstring) returns a new json parser. signature public static system.jsonparser createparser(string jsonstring) parameters jsonstring type: string the json content to parse. return value type: system.jsonparser deserialize(jsonstring, apextype) deserializes the specified json string into an apex object of the specified type. signature public static object deserialize(string jsonstring, system.type apextype) parameters jsonstring type: string the json content to deserialize. apextype type: system.type the apex type of the object that this method creates after deserializing the json content. return value type: object usage if the json content contains attributes not present in the system.type argument, such" "as a missing field or object, deserialization fails in some circumstances. when deserializing json content into a custom object or an sobject using salesforce api version 34.0 or earlier, this method throws a runtime exception when passed extraneous attributes. when deserializing json content into an apex class in any api version, or into an object in api version 35.0 or later, no exception is thrown. when no exception is thrown, this method ignores extraneous attributes and parses the rest of the json content. 3075apex reference guide json class example the following example deserializes a decimal value. decimal n = (decimal)json.deserialize( '100.1', decimal.class); system.assertequals(n, 100.1); deserializestrict(jsonstring, apextype) deserializes the specified json string into an apex object of the specified type. signature public static object deserializestrict(string jsonstring, system.type apextype) parameters jsonstring type: string the json content to deserialize. apextype type: system.type the apex type of the object that this method creates after deserializing the json content. return value type: object usage all attributes in the json string must be present in the specified type. if the json content contains attributes not present in the system.type argument, such as a missing field or object, deserialization fails in some circumstances. when deserializing json content with extraneous attributes into an apex class, this method throws an exception in all api versions. however, no exception is thrown when you use this method to deserialize json content into a custom object or an sobject. example the following example deserializes a json string into an object of a user-defined type represented by the car class, which this example also defines. public class car { public string make; public string year; } public void parse() { car c = (car)json.deserializestrict( '{""make"":""sfdc"",""year"":""2020""}', car.class); system.assertequals(c.make, 'sfdc'); 3076apex reference guide json class system.assertequals(c.year, '2020'); } deserializeuntyped(jsonstring) deserializes the specified json string into collections of primitive data types. signature public static object deserializeuntyped(string jsonstring) parameters jsonstring type: string the json content to deserialize. return value type: object example the following example deserializes a json representation of an appliance object into a map that contains primitive data types and further collections of primitive types. it then verifies the deserialized values. string jsoninput = '{\n' + ' ""description"" :""an appliance"",\n' + ' ""accessories"" : [ ""powercord"", ' + '{ ""right"":""door handle1"", ' + '""left"":""door handle2"" } ],\n' + ' ""dimensions"" : ' + '{ ""height"" : 5.5 , ' + '""width"" : 3.0 , ' + '""depth"" : 2.2 },\n' + ' ""type"" : null,\n' + ' ""inventory"" : 2000,\n' + ' ""price"" : 1023.45,\n' + ' ""isshipped"" : true,\n' + ' ""modelnumber"" : ""123""\n' + '}'; map m = (map) json.deserializeuntyped(jsoninput); system.assertequals( 'an appliance', m.get('description')); list a = (list)m.get('accessories'); system.assertequals('powercord', a[0]); 3077apex reference guide json class map a2 = (map)a[1]; system.assertequals( 'door handle1', a2.get('right')); system.assertequals( 'door handle2', a2.get('left')); map dim = (map)m.get('dimensions'); system.assertequals( 5.5, dim.get('height')); system.assertequals( 3.0, dim." "get('width')); system.assertequals( 2.2, dim.get('depth')); system.assertequals(null, m.get('type')); system.assertequals( 2000, m.get('inventory')); system.assertequals( 1023.45, m.get('price')); system.assertequals( true, m.get('isshipped')); system.assertequals( '123', m.get('modelnumber')); serialize(objecttoserialize) serializes apex objects into json content. signature public static string serialize(object objecttoserialize) parameters objecttoserialize type: object the apex object to serialize. return value type: string example the following example serializes a new datetime value. datetime dt = datetime.newinstance( date.newinstance( 2011, 3, 22), time.newinstance( 3078apex reference guide json class 1, 15, 18, 0)); string str = json.serialize(dt); system.assertequals( '""2011-03-22t08:15:18.000z""', str); serialize(objecttoserialize, suppressapexobjectnulls) suppresses null values when serializing apex objects into json content. signature public static string serialize(object objecttoserialize, boolean suppressapexobjectnulls) parameters objecttoserialize type: object the apex object to serialize. suppressapexobjectnulls type: boolean if true, remove null values before serializing the json object. note: this parameter doesn’t apply to sobjects retrieved via soql. return value type: string usage this method allows you to specify whether to suppress null values when serializing apex objects into json content. serializepretty(objecttoserialize) serializes apex objects into json content and generates indented content using the pretty-print format. signature public static string serializepretty(object objecttoserialize) parameters objecttoserialize type: object the apex object to serialize. 3079apex reference guide jsongenerator class return value type: string serializepretty(objecttoserialize, suppressapexobjectnulls) suppresses null values when serializing apex objects into json content and generates indented content using the pretty-print format. signature public static string serializepretty(object objecttoserialize, boolean suppressapexobjectnulls) parameters objecttoserialize type: object the apex object to serialize. suppressapexobjectnulls type: boolean if true, remove null values before serializing the json object. note: this parameter doesn’t apply to sobjects retrieved via soql. return value type: string jsongenerator class contains methods used to serialize objects into json content using the standard json encoding. namespace system usage the system.jsongenerator class is provided to enable the generation of standard json-encoded content and gives you more control on the structure of the json output. see also: apex developer guide: json generator jsongenerator methods the following are methods for jsongenerator. all are instance methods. 3080apex reference guide jsongenerator class in this section: close() closes the json generator. getasstring() returns the generated json content. isclosed() returns true if the json generator is closed; otherwise, returns false. writeblob(blobvalue) writes the specified blob value as a base64-encoded string. writeblobfield(fieldname, blobvalue) writes a field name and value pair using the specified field name and blob value. writeboolean(blobvalue) writes the specified boolean value. writebooleanfield(fieldname, booleanvalue) writes a field name and value pair using the specified field name and boolean value. writedate(datevalue) writes the specified date value in the iso-8601 format. writedatefield(fieldname, datevalue) writes a field name and value pair using the specified field name and date value. the date value is written in the iso-8601 format. writedatetime(datetimevalue) writes the specified date and time value in the iso-8601 format. writedatetimefield(fieldname, datetimevalue) writes a field name and value pair using the" "specified field name and date and time value. the date and time value is written in the iso-8601 format. writeendarray() writes the ending marker of a json array (']'). writeendobject() writes the ending marker of a json object ('}'). writefieldname(fieldname) writes a field name. writeid(identifier) writes the specified id value. writeidfield(fieldname, identifier) writes a field name and value pair using the specified field name and identifier value. writenull() writes the json null literal value. writenullfield(fieldname) writes a field name and value pair using the specified field name and the json null literal value. writenumber(number) writes the specified decimal value. 3081apex reference guide jsongenerator class writenumber(number) writes the specified double value. writenumber(number) writes the specified integer value. writenumber(number) writes the specified long value. writenumberfield(fieldname, number) writes a field name and value pair using the specified field name and decimal value. writenumberfield(fieldname, number) writes a field name and value pair using the specified field name and double value. writenumberfield(fieldname, number) writes a field name and value pair using the specified field name and integer value. writenumberfield(fieldname, number) writes a field name and value pair using the specified field name and long value. writeobject(anyobject) writes the specified apex object in json format. writeobjectfield(fieldname, value) writes a field name and value pair using the specified field name and apex object. writestartarray() writes the starting marker of a json array ('['). writestartobject() writes the starting marker of a json object ('{'). writestring(stringvalue) writes the specified string value. writestringfield(fieldname, stringvalue) writes a field name and value pair using the specified field name and string value. writetime(timevalue) writes the specified time value in the iso-8601 format. writetimefield(fieldname, timevalue) writes a field name and value pair using the specified field name and time value in the iso-8601 format. close() closes the json generator. signature public void close() return value type: void 3082" "apex reference guide jsongenerator class usage no more content can be written after the json generator is closed. getasstring() returns the generated json content. signature public string getasstring() return value type: string usage this method closes the json generator if it isn't closed already. isclosed() returns true if the json generator is closed; otherwise, returns false. signature public boolean isclosed() return value type: boolean writeblob(blobvalue) writes the specified blob value as a base64-encoded string. signature public void writeblob(blob blobvalue) parameters blobvalue type: blob return value type: void 3083apex reference guide jsongenerator class writeblobfield(fieldname, blobvalue) writes a field name and value pair using the specified field name and blob value. signature public void writeblobfield(string fieldname, blob blobvalue) parameters fieldname type: string blobvalue type: blob return value type: void writeboolean(blobvalue) writes the specified boolean value. signature public void writeboolean(boolean blobvalue) parameters blobvalue type: boolean return value type: void writebooleanfield(fieldname, booleanvalue) writes a field name and value pair using the specified field name and boolean value. signature public void writebooleanfield(string fieldname, boolean booleanvalue) parameters fieldname type: string booleanvalue type: boolean 3084apex reference guide jsongenerator class return value type: void writedate(datevalue) writes the specified date value in the iso-8601 format. signature public void writedate(date datevalue) parameters datevalue type: date return value type: void writedatefield(fieldname, datevalue) writes a field name and value pair using the specified field name and date value. the date value is written in the iso-8601 format. signature public void writedatefield(string fieldname, date datevalue) parameters fieldname type: string datevalue type: date return value type: void writedatetime(datetimevalue) writes the specified date and time value in the iso-8601 format. signature public void writedatetime(datetime datetimevalue) 3085apex reference guide jsongenerator class parameters datetimevalue type: datetime return value type: void writedatetimefield(fieldname, datetimevalue) writes a field name and value pair using the specified field name and date and time value. the date and time value is written in the iso-8601 format. signature public void writedatetimefield(string fieldname, datetime datetimevalue) parameters fieldname type: string datetimevalue type: datetime return value type: void writeendarray() writes the ending marker of a json array (']'). signature public void writeendarray() return value type: void writeendobject() writes the ending marker of a json object ('}'). signature public void writeendobject() 3086apex reference guide jsongenerator class return value type: void writefieldname(fieldname) writes a field name. signature public void writefieldname(string fieldname) parameters fieldname type: string return value type: void writeid(identifier) writes the specified id value. signature public void writeid(id identifier) parameters identifier type: id return value type: void writeidfield(fieldname, identifier) writes a field name and value pair using the specified field name and identifier value. signature public void writeidfield(string fieldname, id identifier) parameters fieldname type: string 3087apex reference guide jsongenerator class identifier type: id return value type: void writenull() writes the json null literal value. signature public void writenull() return value type: void writenullfield(fieldname) writes a field name and value pair using the specified field name and the json null literal value. signature public void writenullfield(string fieldname) parameters fieldname type: string return value type: void writenumber" "(number) writes the specified decimal value. signature public void writenumber(decimal number) parameters number type: decimal 3088apex reference guide jsongenerator class return value type: void writenumber(number) writes the specified double value. signature public void writenumber(double number) parameters number type: double return value type: void writenumber(number) writes the specified integer value. signature public void writenumber(integer number) parameters number type: integer return value type: void writenumber(number) writes the specified long value. signature public void writenumber(long number) parameters number type: long 3089apex reference guide jsongenerator class return value type: void writenumberfield(fieldname, number) writes a field name and value pair using the specified field name and decimal value. signature public void writenumberfield(string fieldname, decimal number) parameters fieldname type: string number type: decimal return value type: void writenumberfield(fieldname, number) writes a field name and value pair using the specified field name and double value. signature public void writenumberfield(string fieldname, double number) parameters fieldname type: string number type: double return value type: void writenumberfield(fieldname, number) writes a field name and value pair using the specified field name and integer value. signature public void writenumberfield(string fieldname, integer number) 3090apex reference guide jsongenerator class parameters fieldname type: string number type: integer return value type: void writenumberfield(fieldname, number) writes a field name and value pair using the specified field name and long value. signature public void writenumberfield(string fieldname, long number) parameters fieldname type: string number type: long return value type: void writeobject(anyobject) writes the specified apex object in json format. signature public void writeobject(object anyobject) parameters anyobject type: object return value type: void writeobjectfield(fieldname, value) writes a field name and value pair using the specified field name and apex object. 3091apex reference guide jsongenerator class signature public void writeobjectfield(string fieldname, object value) parameters fieldname type: string value type: object return value type: void writestartarray() writes the starting marker of a json array ('['). signature public void writestartarray() return value type: void writestartobject() writes the starting marker of a json object ('{'). signature public void writestartobject() return value type: void writestring(stringvalue) writes the specified string value. signature public void writestring(string stringvalue) parameters stringvalue type: string 3092apex reference guide jsongenerator class return value type: void writestringfield(fieldname, stringvalue) writes a field name and value pair using the specified field name and string value. signature public void writestringfield(string fieldname, string stringvalue) parameters fieldname type: string stringvalue type: string return value type: void writetime(timevalue) writes the specified time value in the iso-8601 format. signature public void writetime(time timevalue) parameters timevalue type: time return value type: void writetimefield(fieldname, timevalue) writes a field name and value pair using the specified field name and time value in the iso-8601 format. signature public void writetimefield(string fieldname, time timevalue) 3093apex reference guide jsonparser class parameters fieldname type: string timevalue type: time return value type: void jsonparser class represents a parser for json-encoded content. namespace system usage use the system.jsonparser methods to parse a response that's returned from a call to an external service that is in json format, such as a json-encoded response of a web service callout. see also: apex developer guide: json parsing jsonparser methods the following are methods for jsonparser. all are instance methods. in" "this section: clearcurrenttoken() removes the current token. getblobvalue() returns the current token as a blob value. getbooleanvalue() returns the current token as a boolean value. getcurrentname() returns the name associated with the current token. getcurrenttoken() returns the token that the parser currently points to or null if there's no current token. getdatetimevalue() returns the current token as a date and time value. 3094apex reference guide jsonparser class getdatevalue() returns the current token as a date value. getdecimalvalue() returns the current token as a decimal value. getdoublevalue() returns the current token as a double value. getidvalue() returns the current token as an id value. getintegervalue() returns the current token as an integer value. getlastclearedtoken() returns the last token that was cleared by the clearcurrenttoken method. getlongvalue() returns the current token as a long value. gettext() returns the textual representation of the current token or null if there's no current token. gettimevalue() returns the current token as a time value. hascurrenttoken() returns true if the parser currently points to a token; otherwise, returns false. nexttoken() returns the next token or null if the parser has reached the end of the input stream. nextvalue() returns the next token that is a value type or null if the parser has reached the end of the input stream. readvalueas(apextype) deserializes json content into an object of the specified apex type and returns the deserialized object. readvalueasstrict(apextype) deserializes json content into an object of the specified apex type and returns the deserialized object. all attributes in the json content must be present in the specified type. skipchildren() skips all child tokens of type jsontoken.start_array and jsontoken.start_object that the parser currently points to. clearcurrenttoken() removes the current token. signature public void clearcurrenttoken() 3095apex reference guide jsonparser class return value type: void usage after this method is called, a call to hascurrenttoken returns false and a call to getcurrenttoken returns null. you can retrieve the cleared token by calling getlastclearedtoken. getblobvalue() returns the current token as a blob value. signature public blob getblobvalue() return value type: blob usage the current token must be of type jsontoken.value_string and must be base64-encoded. getbooleanvalue() returns the current token as a boolean value. signature public boolean getbooleanvalue() return value type: boolean usage the current token must be of type jsontoken.value_true or jsontoken.value_false. the following example parses a sample json string and retrieves a boolean value. string jsoncontent = '{""isactive"":true}'; jsonparser parser = json.createparser(jsoncontent); // advance to the start object marker. parser.nexttoken(); // advance to the next value. parser.nextvalue(); // get the boolean value. boolean isactive = parser.getbooleanvalue(); 3096apex reference guide jsonparser class getcurrentname() returns the name associated with the current token. signature public string getcurrentname() return value type: string usage if the current token is of type jsontoken.field_name, this method returns the same value as gettext. if the current token is a value, this method returns the field name that precedes this token. for other values such as array values or root-level values, this method returns null. the following example parses a sample json string. it advances to the field value and retrieves its corresponding field name. example string jsoncontent = '{""firstname"":""john""}'; jsonparser parser = json.createparser(jsoncontent); // advance to the start object marker. parser.nexttoken(); // advance to the next value. parser.nextvalue(); // get the field name for the current value. string fieldname = parser.getcurrentname(); // get the textual representation // of the value. string fieldvalue = parser.gettext(); getcurrenttoken() returns the token that the parser currently points to or null if there's no current token. signature public system.jsontoken getcurrent" "token() return value type: system.jsontoken usage the following example iterates through all the tokens in a sample json string. string jsoncontent = '{""firstname"":""john""}'; jsonparser parser = 3097apex reference guide jsonparser class json.createparser(jsoncontent); // advance to the next token. while (parser.nexttoken() != null) { system.debug('current token: ' + parser.getcurrenttoken()); } getdatetimevalue() returns the current token as a date and time value. signature public datetime getdatetimevalue() return value type: datetime usage the current token must be of type jsontoken.value_string and must represent a datetime value in the iso-8601 format. the following example parses a sample json string and retrieves a datetime value. string jsoncontent = '{""transactiondate"":""2011-03-22t13:01:23""}'; jsonparser parser = json.createparser(jsoncontent); // advance to the start object marker. parser.nexttoken(); // advance to the next value. parser.nextvalue(); // get the transaction date. datetime transactiondate = parser.getdatetimevalue(); getdatevalue() returns the current token as a date value. signature public date getdatevalue() return value type: date usage the current token must be of type jsontoken.value_string and must represent a date value in the iso-8601 format. 3098apex reference guide jsonparser class the following example parses a sample json string and retrieves a date value. string jsoncontent = '{""dateofbirth"":""2011-03-22""}'; jsonparser parser = json.createparser(jsoncontent); // advance to the start object marker. parser.nexttoken(); // advance to the next value. parser.nextvalue(); // get the date of birth. date dob = parser.getdatevalue(); getdecimalvalue() returns the current token as a decimal value. signature public decimal getdecimalvalue() return value type: decimal usage the current token must be of type jsontoken.value_number_float or jsontoken.value_number_int and is a numerical value that can be converted to a value of type decimal. the following example parses a sample json string and retrieves a decimal value. string jsoncontent = '{""gpa"":3.8}'; jsonparser parser = json.createparser(jsoncontent); // advance to the start object marker. parser.nexttoken(); // advance to the next value. parser.nextvalue(); // get the gpa score. decimal gpa = parser.getdecimalvalue(); getdoublevalue() returns the current token as a double value. signature public double getdoublevalue() 3099apex reference guide jsonparser class return value type: double usage the current token must be of type jsontoken.value_number_float and is a numerical value that can be converted to a value of type double. the following example parses a sample json string and retrieves a double value. string jsoncontent = '{""gpa"":3.8}'; jsonparser parser = json.createparser(jsoncontent); // advance to the start object marker. parser.nexttoken(); // advance to the next value. parser.nextvalue(); // get the gpa score. double gpa = parser.getdoublevalue(); getidvalue() returns the current token as an id value. signature public id getidvalue() return value type: id usage the current token must be of type jsontoken.value_string and must be a valid id. the following example parses a sample json string and retrieves an id value. string jsoncontent = '{""recordid"":""001r0000002no6h""}'; jsonparser parser = json.createparser(jsoncontent); // advance to the start object marker. parser.nexttoken(); // advance to the next value. parser.nextvalue(); // get the record id. id recordid = parser.getidvalue(); getintegervalue() returns the current token as an integer value. 3100apex reference guide jsonparser class signature public integer getintegervalue() return value type: integer usage the current token must be of type jsontoken.value_num" "ber_int and must represent an integer. the following example parses a sample json string and retrieves an integer value. string jsoncontent = '{""recordcount"":10}'; jsonparser parser = json.createparser(jsoncontent); // advance to the start object marker. parser.nexttoken(); // advance to the next value. parser.nextvalue(); // get the record count. integer count = parser.getintegervalue(); getlastclearedtoken() returns the last token that was cleared by the clearcurrenttoken method. signature public system.jsontoken getlastclearedtoken() return value type: system.jsontoken getlongvalue() returns the current token as a long value. signature public long getlongvalue() return value type: long usage the current token must be of type jsontoken.value_number_int and is a numerical value that can be converted to a value of type long . 3101apex reference guide jsonparser class the following example parses a sample json string and retrieves a long value. string jsoncontent = '{""recordcount"":2097531021}'; jsonparser parser = json.createparser(jsoncontent); // advance to the start object marker. parser.nexttoken(); // advance to the next value. parser.nextvalue(); // get the record count. long count = parser.getlongvalue(); gettext() returns the textual representation of the current token or null if there's no current token. signature public string gettext() return value type: string usage no current token exists, and therefore this method returns null, if nexttoken has not been called yet for the first time or if the parser has reached the end of the input stream. gettimevalue() returns the current token as a time value. signature public time gettimevalue() return value type: time usage the current token must be of type jsontoken.value_string and must represent a time value in the iso-8601 format. the following example parses a sample json string and retrieves a datetime value. string jsoncontent = '{""arrivaltime"":""18:05""}'; jsonparser parser = json.createparser(jsoncontent); // advance to the start object marker. 3102apex reference guide jsonparser class parser.nexttoken(); // advance to the next value. parser.nextvalue(); // get the arrival time. time arrivaltime = parser.gettimevalue(); hascurrenttoken() returns true if the parser currently points to a token; otherwise, returns false. signature public boolean hascurrenttoken() return value type: boolean nexttoken() returns the next token or null if the parser has reached the end of the input stream. signature public system.jsontoken nexttoken() return value type: system.jsontoken usage advances the stream enough to determine the type of the next token, if any. nextvalue() returns the next token that is a value type or null if the parser has reached the end of the input stream. signature public system.jsontoken nextvalue() return value type: system.jsontoken usage advances the stream enough to determine the type of the next token that is of a value type, if any, including a json array and object start and end markers. 3103apex reference guide jsonparser class readvalueas(apextype) deserializes json content into an object of the specified apex type and returns the deserialized object. signature public object readvalueas(system.type apextype) parameters apextype type: system.type the apextype argument specifies the type of the object that this method returns after deserializing the current value. return value type: object usage if the json content contains attributes not present in the system.type argument, such as a missing field or object, deserialization fails in some circumstances. when deserializing json content into a custom object or an sobject using salesforce api version 34.0 or earlier, this method throws a runtime exception when passed extraneous attributes. when deserializing json content into an apex class in any api version, or into an object in api version 35.0 or later, no exception is thrown. when no exception is thrown, this method ignores extraneous attributes and parses the rest of the json content. example the following example parses a sample json string and retrieves a datetime value. before being able to run this sample, you must create a" "new apex class as follows: public class person { public string name; public string phone; } next, insert the following sample in a class method: // json string that contains a person object. string jsoncontent = '{""person"":{' + '""name"":""john smith"",' + '""phone"":""555-1212""}}'; jsonparser parser = json.createparser(jsoncontent); // make calls to nexttoken() // to point to the second // start object marker. parser.nexttoken(); parser.nexttoken(); parser.nexttoken(); // retrieve the person object // from the json string. 3104apex reference guide jsonparser class person obj = (person)parser.readvalueas( person.class); system.assertequals( obj.name, 'john smith'); system.assertequals( obj.phone, '555-1212'); readvalueasstrict(apextype) deserializes json content into an object of the specified apex type and returns the deserialized object. all attributes in the json content must be present in the specified type. signature public object readvalueasstrict(system.type apextype) parameters apextype type: system.type the apextype argument specifies the type of the object that this method returns after deserializing the current value. return value type: object usage if the json content contains attributes not present in the system.type argument, such as a missing field or object, deserialization fails in some circumstances. when deserializing json content with extraneous attributes into an apex class, this method throws an exception in all api versions. however, no exception is thrown when you use this method to deserialize json content into a custom object or an sobject. the following example parses a sample json string and retrieves a datetime value. before being able to run this sample, you must create a new apex class as follows: public class person { public string name; public string phone; } next, insert the following sample in a class method: // json string that contains a person object. string jsoncontent = '{""person"":{' + '""name"":""john smith"",' + '""phone"":""555-1212""}}'; jsonparser parser = json.createparser(jsoncontent); // make calls to nexttoken() // to point to the second 3105apex reference guide jsontoken enum // start object marker. parser.nexttoken(); parser.nexttoken(); parser.nexttoken(); // retrieve the person object // from the json string. person obj = (person)parser.readvalueasstrict( person.class); system.assertequals( obj.name, 'john smith'); system.assertequals( obj.phone, '555-1212'); skipchildren() skips all child tokens of type jsontoken.start_array and jsontoken.start_object that the parser currently points to. signature public void skipchildren() return value type: void jsontoken enum contains all token values used for parsing json content. namespace system enum value description end_array the ending of an array value. this token is returned when ']' is encountered. end_object the ending of an object value. this token is returned when '}' is encountered. field_name a string token that is a field name. not_available the requested token isn't available. start_array the start of an array value. this token is returned when '[' is encountered. start_object the start of an object value. this token is returned when '{' is encountered. 3106apex reference guide label class enum value description value_embedded_object an embedded object that isn't accessible as a typical object structure that includes the start and end object tokens start_object and end_object but is represented as a raw object. value_false the literal “false” value. value_null the literal “null” value. value_number_float a float value. value_number_int an integer value. value_string a string value. value_true a value that corresponds to the “true” string literal. label class provides methods to retrieve a custom label or to check if translation exists for a" "label in a specific language and namespace. label names are dynamically resolved at run time, overriding the user’s current language if a translation exists for the requested language. you can’t access labels that are protected in a different namespace. namespace system usage custom labels enable developers to create multilingual applications by automatically presenting information (for example, help text or error messages) in a user’s native language. custom labels have a limit of 1000 characters and can be accessed from apex classes, visualforce pages, lightning pages, or lightning components. for more information on custom labels, see custom labels in salesforce help.the label values can be translated into any language salesforce supports. for supported languages, see supported languages in salesforce help. • to define custom labels, from setup, in the quick find box, enter custom labels, and then select custom labels. • to assign translated values, turn on translation workbench and add translation mappings. • to retrieve the label for a default language setting or for a language and namespace, use system.label.get(namespace, label, language). • to check if translation exists for a label and language in a namespace, use label.translationexists(namespace, label, language). in apex code, you can refer to or instantiate a label like this: system.label.mylabelname for information on passing in labels into aura components, see getting labels in apex in the lightning aura components developer guide. 3107apex reference guide label class examples this example returns true if an english label called mylabel exists in the mynamespace namespace. boolean exists = label.translationexists('mynamespace', 'mylabel', 'en') this example retrieves the custom label translation text for mylabel in french. string value = label.get('mynamespace', 'mylabel', 'fr') in this section: label methods label methods the following are methods for label. in this section: get(namespace, label) retrieve a custom label for the specified namespace and a default language setting. get(namespace, label, language) retrieve a custom label for the specified namespace and language. translationexists(namespace, label, language) check if translation exists for a label and language in a namespace. get(namespace, label) retrieve a custom label for the specified namespace and a default language setting. signature public static string get(string namespace, string label) parameters namespace type: string if the namespace name is null, it defaults to the package namespace. if the namespace name is an empty string, it implies the org namespace. label type: string the label name cannot be null or an empty string. return value type: string 3108apex reference guide label class get(namespace, label, language) retrieve a custom label for the specified namespace and language. signature public static string get(string namespace, string label, string language) parameters namespace type: string if the namespace name is null, it defaults to the package namespace. if the namespace name is an empty string, it implies the org namespace. label type: string the label name cannot be null or an empty string. language type: string this parameter must be a valid language iso code. see the platform-only languages section in supported languages in salesforce help. return value type: string translationexists(namespace, label, language) check if translation exists for a label and language in a namespace. signature public static boolean translationexists(string namespace, string label, string language) parameters namespace type: string if the namespace name is null, it defaults to the package namespace. if the namespace name is an empty string, it implies the org namespace. label type: string the label name cannot be null or an empty string. language type: string this parameter must be a valid language iso code. see the platform-only languages section in supported languages in salesforce help. 3109apex reference guide limits class return value type: boolean limits class contains methods that return limit information for specific resources. namespace system usage the limits methods return the specific limit for the particular governor, such as the number of calls of a method or the amount of heap size remaining. because apex runs in a multitenant environment, the apex runtime engine strictly enforces a number of limits to ensure that runaway apex doesn’t monopolize shared resources. none of the limits methods require an argument. the format of the limits methods" "is as follows: mydmllimit = limits.getdmlstatements(); there are two versions of every method: the first returns the amount of the resource that has been used while the second version contains the word limit and returns the total amount of the resource that is available. see execution governors and limits. limits methods the following are methods for limits. all methods are static. in this section: getaggregatequeries() returns the number of aggregate queries that have been processed with any soql query statement. getlimitaggregatequeries() returns the total number of aggregate queries that can be processed with soql query statements. getasynccalls() reserved for future use. getlimitasynccalls() reserved for future use. getcallouts() returns the number of web service statements that have been processed. getchildrelationshipsdescribes() deprecated. returns the number of child relationship objects that have been returned. getlimitcallouts() returns the total number of web service statements that can be processed. 3110apex reference guide limits class getcputime() returns the cpu time (in milliseconds) that has been used in the current transaction. getlimitcputime() returns the maximum cpu time (in milliseconds) that can be used in a transaction. getdmlrows() returns the number of records that have been processed with any statement that counts against dml limits, such as dml statements, the database.emptyrecyclebin method, and other methods. getlimitdmlrows() returns the total number of records that can be processed with any statement that counts against dml limits, such as dml statements, the database.emptyrecyclebin method, and other methods. getdmlstatements() returns the number of dml statements (such as insert, update or the database.emptyrecyclebin method) that have been called. getlimitdmlstatements() returns the total number of dml statements or the database.emptyrecyclebin methods that can be called. getemailinvocations() returns the number of email invocations (such as sendemail) that have been called. getlimitemailinvocations() returns the total number of email invocation (such as sendemail) that can be called. getfindsimilarcalls() deprecated. returns the same value as getsoslqueries. the number of findsimilar methods is no longer a separate limit, but is tracked as the number of sosl queries issued. getlimitfindsimilarcalls() deprecated. returns the same value as getlimitsoslqueries. the number of findsimilar methods is no longer a separate limit, but is tracked as the number of sosl queries issued. getfuturecalls() returns the number of methods with the future annotation that have been executed (not necessarily completed). getlimitfuturecalls() returns the total number of methods with the future annotation that can be executed (not necessarily completed). getheapsize() returns the approximate amount of memory (in bytes) that has been used for the heap. getlimitheapsize() returns the total amount of memory (in bytes) that can be used for the heap. getmobilepushapexcalls() returns the number of apex calls that have been used by mobile push notifications during the current metering interval. getlimitmobilepushapexcalls() returns the total number of apex calls that are allowed per transaction for mobile push notifications. getpublishimmediatedml() returns the number of eventbus.publish calls that have been made for platform events configured to publish immediately. 3111apex reference guide limits class getlimitpublishimmediatedml() returns the total number of eventbus.publish statements that can be called for platform events configured to publish immediately. getqueries() returns the number of soql queries that have been issued. getlimitqueries() returns the total number of soql queries that can be issued. getquerylocatorrows() returns the number of records that have been returned by the database.getquerylocator method. getlimitquerylocatorrows() returns the total number of records that can be returned by the database.getquerylocator method. getqueryrows() returns the number of records that have been returned by issuing soql queries. getlimitqueryrows() returns the total number of records that can be returned by issuing soql queries. getqueueablejobs() returns the number of queueable jobs that have been added to the queue per transaction. a queueable job corresponds to a class" "that implements the queueable interface. getlimitqueueablejobs() returns the maximum number of queueable jobs that can be added to the queue per transaction. a queueable job corresponds to a class that implements the queueable interface. getrunas() deprecated. returns the same value as getdmlstatements. getlimitrunas() deprecated. returns the same value as getlimitdmlstatements. getsavepointrollbacks() deprecated. returns the same value as getdmlstatements. getlimitsavepointrollbacks() deprecated. returns the same value as getlimitdmlstatements. getsavepoints() deprecated. returns the same value as getdmlstatements. getlimitsavepoints() deprecated. returns the same value as getlimitdmlstatements. getsoslqueries() returns the number of sosl queries that have been issued. getlimitsoslqueries() returns the total number of sosl queries that can be issued. getaggregatequeries() returns the number of aggregate queries that have been processed with any soql query statement. 3112apex reference guide limits class signature public static integer getaggregatequeries() return value type: integer getlimitaggregatequeries() returns the total number of aggregate queries that can be processed with soql query statements. signature public static integer getlimitaggregatequeries() return value type: integer getasynccalls() reserved for future use. signature public static integer getasynccalls() return value type: integer getlimitasynccalls() reserved for future use. signature public static integer getlimitasynccalls() return value type: integer getcallouts() returns the number of web service statements that have been processed. signature public static integer getcallouts() 3113apex reference guide limits class return value type: integer getchildrelationshipsdescribes() deprecated. returns the number of child relationship objects that have been returned. signature public static integer getchildrelationshipsdescribes() return value type: integer usage note: because describe limits are no longer enforced in any api version, this method is no longer available. in api version 30.0 and earlier, this method is available but is deprecated. getlimitcallouts() returns the total number of web service statements that can be processed. signature public static integer getlimitcallouts() return value type: integer getcputime() returns the cpu time (in milliseconds) that has been used in the current transaction. signature public static integer getcputime() return value type: integer getlimitcputime() returns the maximum cpu time (in milliseconds) that can be used in a transaction. 3114apex reference guide limits class signature public static integer getlimitcputime() return value type: integer getdmlrows() returns the number of records that have been processed with any statement that counts against dml limits, such as dml statements, the database.emptyrecyclebin method, and other methods. signature public static integer getdmlrows() return value type: integer getlimitdmlrows() returns the total number of records that can be processed with any statement that counts against dml limits, such as dml statements, the database.emptyrecyclebin method, and other methods. signature public static integer getlimitdmlrows() return value type: integer getdmlstatements() returns the number of dml statements (such as insert, update or the database.emptyrecyclebin method) that have been called. signature public static integer getdmlstatements() return value type: integer getlimitdmlstatements() returns the total number of dml statements or the database.emptyrecyclebin methods that can be called. 3115apex reference guide limits class signature public static integer getlimitdmlstatements() return value type: integer getemailinvocations() returns the number of email invocations (such as sendemail) that have been called. signature public static integer getemailinvocations() return value type: integer getlimitemailinvocations() returns the total number of email invocation (such as sendemail) that can be called. signature public static integer getlimitemailinvocations() return value type: integer getfindsimilarcalls() dep" "recated. returns the same value as getsoslqueries. the number of findsimilar methods is no longer a separate limit, but is tracked as the number of sosl queries issued. signature public static integer getfindsimilarcalls() return value type: integer getlimitfindsimilarcalls() deprecated. returns the same value as getlimitsoslqueries. the number of findsimilar methods is no longer a separate limit, but is tracked as the number of sosl queries issued. 3116apex reference guide limits class signature public static integer getlimitfindsimilarcalls() return value type: integer getfuturecalls() returns the number of methods with the future annotation that have been executed (not necessarily completed). signature public static integer getfuturecalls() return value type: integer getlimitfuturecalls() returns the total number of methods with the future annotation that can be executed (not necessarily completed). signature public static integer getlimitfuturecalls() return value type: integer getheapsize() returns the approximate amount of memory (in bytes) that has been used for the heap. signature public static integer getheapsize() return value type: integer getlimitheapsize() returns the total amount of memory (in bytes) that can be used for the heap. signature public static integer getlimitheapsize() 3117apex reference guide limits class return value type: integer getmobilepushapexcalls() returns the number of apex calls that have been used by mobile push notifications during the current metering interval. signature public static integer getmobilepushapexcalls() return value type:integer getlimitmobilepushapexcalls() returns the total number of apex calls that are allowed per transaction for mobile push notifications. signature public static integer getlimitmobilepushapexcalls() return value type:integer getpublishimmediatedml() returns the number of eventbus.publish calls that have been made for platform events configured to publish immediately. signature public static integer getpublishimmediatedml() return value type: integer getlimitpublishimmediatedml() returns the total number of eventbus.publish statements that can be called for platform events configured to publish immediately. signature public static integer getlimitpublishimmediatedml() return value type: integer 3118apex reference guide limits class getqueries() returns the number of soql queries that have been issued. signature public static integer getqueries() return value type: integer getlimitqueries() returns the total number of soql queries that can be issued. signature public static integer getlimitqueries() return value type: integer getquerylocatorrows() returns the number of records that have been returned by the database.getquerylocator method. signature public static integer getquerylocatorrows() return value type: integer getlimitquerylocatorrows() returns the total number of records that can be returned by the database.getquerylocator method. signature public static integer getlimitquerylocatorrows() return value type: integer getqueryrows() returns the number of records that have been returned by issuing soql queries. 3119apex reference guide limits class signature public static integer getqueryrows() return value type: integer getlimitqueryrows() returns the total number of records that can be returned by issuing soql queries. signature public static integer getlimitqueryrows() return value type: integer getqueueablejobs() returns the number of queueable jobs that have been added to the queue per transaction. a queueable job corresponds to a class that implements the queueable interface. signature public static integer getqueueablejobs() return value type: integer getlimitqueueablejobs() returns the maximum number of queueable jobs that can be added to the queue per transaction. a queueable job corresponds to a class that implements the queueable interface. signature public static integer getlimitqueueablejobs() return value type: integer getrunas() deprecated. returns the same value as getdmlstatements. 3120apex reference guide limits class signature public static integer getrunas() return value type: integer usage the number of runas methods is no longer a separate limit, but is tracked as the number of" "dml statements issued. getlimitrunas() deprecated. returns the same value as getlimitdmlstatements. signature public static integer getlimitrunas() return value type: integer usage the number of runas methods is no longer a separate limit, but is tracked as the number of dml statements issued. getsavepointrollbacks() deprecated. returns the same value as getdmlstatements. signature public static integer getsavepointrollbacks() return value type: integer usage the number of rollback methods is no longer a separate limit, but is tracked as the number of dml statements issued. getlimitsavepointrollbacks() deprecated. returns the same value as getlimitdmlstatements. signature public static integer getlimitsavepointrollbacks() 3121apex reference guide limits class return value type: integer usage the number of rollback methods is no longer a separate limit, but is tracked as the number of dml statements issued. getsavepoints() deprecated. returns the same value as getdmlstatements. signature public static integer getsavepoints() return value type: integer usage the number of setsavepoint methods is no longer a separate limit, but is tracked as the number of dml statements issued. getlimitsavepoints() deprecated. returns the same value as getlimitdmlstatements. signature public static integer getlimitsavepoints() return value type: integer usage the number of setsavepoint methods is no longer a separate limit, but is tracked as the number of dml statements issued. getsoslqueries() returns the number of sosl queries that have been issued. signature public static integer getsoslqueries() return value type: integer 3122apex reference guide list class getlimitsoslqueries() returns the total number of sosl queries that can be issued. signature public static integer getlimitsoslqueries() return value type: integer list class contains methods for the list collection type. namespace system usage the list methods are all instance methods, that is, they operate on a particular instance of a list. for example, the following removes all elements from mylist: mylist.clear(); even though the clear method does not include any parameters, the list that calls it is its implicit parameter. note: • when using a custom type for the list elements, provide an equals method in your class. apex uses this method to determine equality and uniqueness for your objects. for more information on providing an equals method, see using custom types in map keys and sets. • if the list contains string elements, the elements are case-sensitive. two list elements that differ only by case are considered distinct. for more information on lists, see lists. in this section: list constructors list methods list constructors the following are constructors for list. 3123apex reference guide list class in this section: list() creates a new instance of the list class. a list can hold elements of any data type t. list(listtocopy) creates a new instance of the list class by copying the elements from the specified list. t is the data type of the elements in both lists and can be any data type. list(settocopy) creates a new instance of the list class by copying the elements from the specified set. t is the data type of the elements in the set and list and can be any data type. list() creates a new instance of the list class. a list can hold elements of any data type t. signature public list() example // create a list list ls1 = new list(); // add two integers to the list ls1.add(1); ls1.add(2); list(listtocopy) creates a new instance of the list class by copying the elements from the specified list. t is the data type of the elements in both lists and can be any data type. signature public list(list listtocopy) parameters listtocopy type: list the list containing the elements to initialize this list from. t is the data type of the list elements. example list ls1 = new list(); ls1.add(1); ls1.add(2); // create a list based on" "an existing one list ls2 = new list(ls1); 3124apex reference guide list class // ls2 elements are copied from ls1 system.debug(ls2);// debug|(1, 2) list(settocopy) creates a new instance of the list class by copying the elements from the specified set. t is the data type of the elements in the set and list and can be any data type. signature public list(set settocopy) parameters settocopy type: set the set containing the elements to initialize this list with. t is the data type of the set elements. example set s1 = new set(); s1.add(1); s1.add(2); // create a list based on a set list ls = new list(s1); // ls elements are copied from s1 system.debug(ls);// debug|(1, 2) list methods the following are methods for list. all are instance methods. in this section: add(listelement) adds an element to the end of the list. add(index, listelement) inserts an element into the list at the specified index position. addall(fromlist) adds all of the elements in the specified list to the list that calls the method. both lists must be of the same type. addall(fromset) add all of the elements in specified set to the list that calls the method. the set and the list must be of the same type. clear() removes all elements from a list, consequently setting the list's length to zero. clone() makes a duplicate copy of a list. 3125apex reference guide list class contains(listelement) returns true if the list contains the specified element. deepclone(preserveid, preservereadonlytimestamps, preserveautonumber) makes a duplicate copy of a list of sobject records, including the sobject records themselves. equals(list2) compares this list with the specified list and returns true if both lists are equal; otherwise, returns false. get(index) returns the list element stored at the specified index. getsobjecttype() returns the token of the sobject type that makes up a list of sobjects. hashcode() returns the hashcode corresponding to this list and its contents. indexof(listelement) returns the index of the first occurrence of the specified element in this list. if this list does not contain the element, returns -1. isempty() returns true if the list has zero elements. iterator() returns an instance of an iterator for this list. remove(index) removes the list element stored at the specified index, returning the element that was removed. set(index, listelement) sets the specified value for the element at the given index. size() returns the number of elements in the list. sort() sorts the items in the list in ascending order. tostring() returns the string representation of the list. add(listelement) adds an element to the end of the list. signature public void add(object listelement) parameters listelement type: object 3126apex reference guide list class return value type: void example list mylist = new list(); mylist.add(47); integer mynumber = mylist.get(0); system.assertequals(47, mynumber); add(index, listelement) inserts an element into the list at the specified index position. signature public void add(integer index, object listelement) parameters index type: integer listelement type: object return value type: void example in the following example, a list with six elements is created, and integers are added to the first and second index positions. list mylist = new integer[6]; mylist.add(0, 47); mylist.add(1, 52); system.assertequals(52, mylist.get(1)); addall(fromlist) adds all of the elements in the specified list to the list that calls the method. both lists must be of the same type. signature public void addall(list fromlist) parameters fromlist type: list 3127apex reference guide list class return value type: void addall(fromset)" "add all of the elements in specified set to the list that calls the method. the set and the list must be of the same type. signature public void addall(set fromset) parameters fromset type: set return value type: void clear() removes all elements from a list, consequently setting the list's length to zero. signature public void clear() return value type: void clone() makes a duplicate copy of a list. signature public list clone() return value type: list usage the cloned list is of the same type as the current list. note that if this is a list of sobject records, the duplicate list will only be a shallow copy of the list. that is, the duplicate will have references to each object, but the sobject records themselves will not be duplicated. for example: to also copy the sobject records, you must use the deepclone method. 3128apex reference guide list class example account a = new account(name='acme', billingcity='new york'); account b = new account(); account[] q1 = new account[]{a,b}; account[] q2 = q1.clone(); q1[0].billingcity = 'san francisco'; system.assertequals( 'san francisco', q1[0].billingcity); system.assertequals( 'san francisco', q2[0].billingcity); contains(listelement) returns true if the list contains the specified element. signature public boolean contains(object listelement) parameters listelement type: object return value type: boolean example list mystrings = new list{'a', 'b'}; boolean result = mystrings.contains('z'); system.assertequals(false, result); deepclone(preserveid, preservereadonlytimestamps, preserveautonumber) makes a duplicate copy of a list of sobject records, including the sobject records themselves. signature public list deepclone(boolean preserveid, boolean preservereadonlytimestamps, boolean preserveautonumber) 3129apex reference guide list class parameters preserveid type: boolean the optional preserveid argument determines whether the ids of the original objects are preserved or cleared in the duplicates. if set to true, the ids are copied to the cloned objects. the default is false, that is, the ids are cleared. preservereadonlytimestamps type: boolean the optional preservereadonlytimestamps argument determines whether the read-only timestamp and user id fields are preserved or cleared in the duplicates. if set to true, the read-only fields createdbyid, createddate, lastmodifiedbyid, and lastmodifieddate are copied to the cloned objects. the default is false, that is, the values are cleared. preserveautonumber type: boolean the optional preserveautonumber argument determines whether the autonumber fields of the original objects are preserved or cleared in the duplicates. if set to true, auto number fields are copied to the cloned objects. the default is false, that is, auto number fields are cleared. return value type: list usage the returned list is of the same type as the current list. note: • deepclone only works with lists of sobjects, not with lists of primitives. • for apex saved using salesforce api version 22.0 or earlier, the default value for the preserve_id argument is true, that is, the ids are preserved. to make a shallow copy of a list without duplicating the sobject records it contains, use the clone method. example this example performs a deep clone for a list with two accounts. account a = new account(name='acme', billingcity='new york'); account b = new account(name='salesforce'); account[] q1 = new account[]{a,b}; account[] q2 = q1.deepclone(); q1[0].billingcity = 'san francisco'; system.assertequals( 'san francisco', q1[0].billingcity); 3130apex reference guide list class system.assertequals( 'new york', q2[0].billingcity); this example is based on the previous example and shows how to clone a list with preserved read-only timestamp and user id fields. insert q1" "; list accts = [select createdbyid, createddate, lastmodifiedbyid, lastmodifieddate, billingcity from account where name='acme' or name='salesforce']; // clone list while preserving timestamp and user id fields. account[] q3 = accts.deepclone(false,true,false); // verify timestamp fields are preserved for the first list element. system.assertequals( accts[0].createdbyid, q3[0].createdbyid); system.assertequals( accts[0].createddate, q3[0].createddate); system.assertequals( accts[0].lastmodifiedbyid, q3[0].lastmodifiedbyid); system.assertequals( accts[0].lastmodifieddate, q3[0].lastmodifieddate); equals(list2) compares this list with the specified list and returns true if both lists are equal; otherwise, returns false. signature public boolean equals(list list2) parameters list2 type: list the list to compare this list with. return value type: boolean usage two lists are equal if their elements are equal and are in the same order. the == operator is used to compare the elements of the lists. 3131apex reference guide list class the == operator is equivalent to calling the equals method, so you can call list1.equals(list2); instead of list1 == list2;. get(index) returns the list element stored at the specified index. signature public object get(integer index) parameters index type: integer return value type: object usage to reference an element of a one-dimensional list of primitives or sobjects, you can also follow the name of the list with the element's index position in square brackets as shown in the example. example list mylist = new list(); mylist.add(47); integer mynumber = mylist.get(0); system.assertequals(47, mynumber); list colors = new string[3]; colors[0] = 'red'; colors[1] = 'blue'; colors[2] = 'green'; getsobjecttype() returns the token of the sobject type that makes up a list of sobjects. signature public schema.sobjecttype getsobjecttype() return value type: schema.sobjecttype 3132" "apex reference guide list class usage use this method with describe information to determine if a list contains sobjects of a particular type. note that this method can only be used with lists that are composed of sobjects. for more information, see understanding apex describe information. example // create a generic sobject variable. sobject sobj = database.query('select id from account limit 1'); // verify if that sobject variable is an account token. system.assertequals( account.sobjecttype, sobj.getsobjecttype()); // create a list of generic sobjects. list q = new account[]{}; // verify if the list of sobjects // contains account tokens. system.assertequals( account.sobjecttype, q.getsobjecttype()); hashcode() returns the hashcode corresponding to this list and its contents. signature public integer hashcode() return value type: integer indexof(listelement) returns the index of the first occurrence of the specified element in this list. if this list does not contain the element, returns -1. signature public integer indexof(object listelement) parameters listelement type: object 3133apex reference guide list class return value type: integer example list mystrings = new list{'a', 'b', 'a'}; integer result = mystrings.indexof('a'); system.assertequals(0, result); isempty() returns true if the list has zero elements. signature public boolean isempty() return value type: boolean iterator() returns an instance of an iterator for this list. signature public iterator iterator() return value type: iterator usage from the returned iterator, you can use the iterable methods hasnext and next to iterate through the list. note: you don’t have to implement the iterable interface to use the iterable methods with a list. see custom iterators. example public class customiterator implements iterator{ private list accounts; private integer currentindex; public customiterator(list accounts){ this.accounts = accounts; 3134apex reference guide list class this.currentindex = 0; } public boolean hasnext(){ return currentindex < accounts.size(); } public account next(){ if(hasnext()) { return accounts[currentindex++]; } else { throw new nosuchelementexception('iterator has no more elements.'); } } } remove(index) removes the list element stored at the specified index, returning the element that was removed. signature public object remove(integer index) parameters index type: integer return value type: object example list colors = new string[3]; colors[0] = 'red'; colors[1] = 'blue'; colors[2] = 'green'; string s1 = colors.remove(2); system.assertequals('green', s1); set(index, listelement) sets the specified value for the element at the given index. signature public void set(integer index, object listelement) 3135apex reference guide list class parameters index type: integer the index of the list element to set. listelement type: object the value of the list element to set. return value type: void usage to set an element of a one-dimensional list of primitives or sobjects, you can also follow the name of the list with the element's index position in square brackets. example list mylist = new integer[6]; mylist.set(0, 47); mylist.set(1, 52); system.assertequals(52, mylist.get(1)); list colors = new string[3]; colors[0] = 'red'; colors[1] = 'blue'; colors[2] = 'green'; size() returns the number of elements in the list. signature public integer size() return value type: integer example list mylist = new list(); integer size = mylist.size(); system.assertequals(0, size); list mylist2 = new integer[6]; 3136apex reference guide list class integer size" "2 = mylist2.size(); system.assertequals(6, size2); sort() sorts the items in the list in ascending order. signature public void sort() return value type: void usage using this method, you can sort primitive types, selectoption elements, and sobjects (standard objects and custom objects). for more information on the sort order used for sobjects, see sorting lists of sobjects. you can also sort custom types (your apex classes) if they implement the comparable interface interface. when you use sort() methods on lists that contain both 15-character and 18-character ids, ids for the same record sort together in api version 35.0 and later. example in the following example, the list has three elements. when the list is sorted, the first element is null because it has no value assigned. the second element and third element have values of 5 and 10. list q1 = new integer[3]; // assign values to the first two elements. q1[0] = 10; q1[1] = 5; q1.sort(); // verify sorted list. elements are sorted in nulls-first order: null, 5, and 10 system.assertequals(null, q1.get(0)); system.assertequals(5, q1.get(1)); system.assertequals(10, q1.get(2)); 3137apex reference guide location class tostring() returns the string representation of the list. signature public string tostring() return value type: string usage when used in cyclic references, the output is truncated to prevent infinite recursion. when used with large collections, the output is truncated to avoid exceeding total heap size and maximum cpu time. • up to 10 items per collection are included in the output, followed by an ellipsis (…). • if the same object is included multiple times in a collection, it’s shown in the output only once; subsequent references are shown as (already output). location class contains methods for accessing the component fields of geolocation compound fields. namespace system usage each of these methods is also equivalent to a read-only property. for each getter method you can access the property using dot notation. for example, mylocation.getlatitude() is equivalent to mylocation.latitude. you can’t use dot notation to access compound fields’ subfields directly on the parent field. instead, assign the parent field to a variable of type location, and then access its components. location loc = myaccount.mylocation__c; double lat = loc.latitude; important: “location” in salesforce can also refer to the location standard object. when referencing the location object in your apex code, always use schema.location instead of location to prevent confusion with the standard location compound field. if referencing both the location object and the location field in the same snippet, you can differentiate between the two by using system.location for the field and schema.location for the object. example // select and access the location field. mylocation__c is the name of a geolocation field on account. account[] records = [select id, mylocation__c from account limit 10]; 3138apex reference guide location class for(account acct : records) { location loc = acct.mylocation__c; double lat = loc.latitude; double lon = loc.longitude; } // instantiate new location objects and compute the distance between them in different ways. location loc1 = location.newinstance(28.635308,77.22496); location loc2 = location.newinstance(37.7749295,-122.4194155); double dist = location.getdistance(loc1, loc2, 'mi'); double dist2 = loc1.getdistance(loc2, 'mi'); in this section: location methods location methods the following are methods for location. in this section: getdistance(tolocation, unit) calculates the distance between this location and the specified location, using an approximation of the haversine formula and the specified unit. getdistance(firstlocation, secondlocation, unit) calculates the distance between the two specified locations, using an approximation of the haversine formula and the specified unit. getlatitude() returns the latitude field of this location. getlongitude() returns the longitude field of this" "location. newinstance(latitude, longitude) creates an instance of the location class, with the specified latitude and longitude. getdistance(tolocation, unit) calculates the distance between this location and the specified location, using an approximation of the haversine formula and the specified unit. signature public double getdistance(location tolocation, string unit) parameters tolocation type: location 3139apex reference guide location class the location to which you want to calculate the distance from the current location. unit type: string the distance unit you want to use: mi or km. return value type: double getdistance(firstlocation, secondlocation, unit) calculates the distance between the two specified locations, using an approximation of the haversine formula and the specified unit. signature public static double getdistance(location firstlocation, location secondlocation, string unit) parameters firstlocation type: location the first of two locations used to calculate distance. secondlocation type: location the second of two locations used to calculate distance. unit type: string the distance unit you want to use: mi or km. return value type: double getlatitude() returns the latitude field of this location. signature public double getlatitude() return value type: double 3140apex reference guide logginglevel enum getlongitude() returns the longitude field of this location. signature public double getlongitude() return value type: double newinstance(latitude, longitude) creates an instance of the location class, with the specified latitude and longitude. signature public static location newinstance(decimal latitude, decimal longitude) parameters latitude type: decimal longitude type: decimal return value type: location logginglevel enum specifies the logging level for the system.debug method. enum values the following are the values of the system.logginglevel enum, listed from the lowest to the highest levels. the level is cumulative, that is, if you select fine, the log also includes all events logged at the debug, info, warn, and error levels. value description none no logging. error error and exception logging. warn warning logging. info informational logging. debug user-specified debug logging. 3141apex reference guide long class value description fine high level of logging. finer higher level of logging than fine. finest highest level of logging. usage log levels are cumulative. for example, if the lowest level, error, is specified for apex code, only system.debug methods with the log level of error are logged. if the next log level, warn, is specified, system.debug methods specified with either error or warn levels are logged. in this example, if the log level is set to error, the string msgtxt isn’t written to the debug log because the debug method has a level of info. system.debug(logginglevel.info, 'msgtxt'); for more information on log levels, see debug log levels in salesforce help. long class contains methods for the long primitive data type. namespace system usage for more information on long, see long data type. long methods the following are methods for long. in this section: format() returns the string format for this long using the locale of the context user. intvalue() returns the integer value for this long. valueof(stringtolong) returns a long that contains the value of the specified string. as in java, the string is interpreted as representing a signed decimal long. 3142apex reference guide long class format() returns the string format for this long using the locale of the context user. signature public string format() return value type: string example long mylong = 4271990; system.assertequals('4,271,990', mylong.format()); intvalue() returns the integer value for this long. signature public integer intvalue() return value type: integer example long mylong = 7191991; integer value = mylong.intvalue(); system.assertequals(7191991, mylong.intvalue()); valueof(stringtolong) returns a long that contains the value of the specified string. as in java, the string is interpreted as representing a signed decimal long. signature public static long valueof(string stringtolong) parameters stringtolong type: string" "return value type: long 3143apex reference guide map class example long l1 = long.valueof('123456789'); map class contains methods for the map collection type. namespace system usage the map methods are all instance methods, that is, they operate on a particular instance of a map. the following are the instance methods for maps. note: • map keys and values can be of any data type—primitive types, collections, sobjects, user-defined types, and built-in apex types. • uniqueness of map keys of user-defined types is determined by the equals and hashcode methods, which you provide in your classes. uniqueness of keys of all other non-primitive types, such as sobject keys, is determined by comparing the objects’ field values. • map keys of type string are case-sensitive. two keys that differ only by the case are considered unique and have corresponding distinct map entries. subsequently, the map methods, including put, get, containskey, and remove treat these keys as distinct. for more information on maps, see maps. in this section: map constructors map methods map constructors the following are constructors for map. in this section: map() creates a new instance of the map class. t1 is the data type of the keys and t2 is the data type of the values. map(maptocopy) creates a new instance of the map class and initializes it by copying the entries from the specified map. t1 is the data type of the keys and t2 is the data type of the values. map(recordlist) creates a new instance of the map class and populates it with the passed-in list of sobject records. the keys are populated with the sobject ids and the values are the sobjects. 3144apex reference guide map class map() creates a new instance of the map class. t1 is the data type of the keys and t2 is the data type of the values. signature public map() example map m1 = new map(); m1.put(1, 'first item'); m1.put(2, 'second item'); map(maptocopy) creates a new instance of the map class and initializes it by copying the entries from the specified map. t1 is the data type of the keys and t2 is the data type of the values. signature public map(map maptocopy) parameters maptocopy type: map the map to initialize this map with. t1 is the data type of the keys and t2 is the data type of the values. all map keys and values are copied to this map. example map m1 = new map(); m1.put(1, 'first item'); m1.put(2, 'second item'); map m2 = new map(m1); // the map elements of m2 are copied from m1 system.debug(m2); map(recordlist) creates a new instance of the map class and populates it with the passed-in list of sobject records. the keys are populated with the sobject ids and the values are the sobjects. signature public map(list recordlist) 3145apex reference guide map class parameters recordlist type: list the list of sobjects to populate the map with. example list ls = [select id,name from account]; map m = new map(ls); map methods the following are methods for map. all are instance methods. in this section: clear() removes all of the key-value mappings from the map. clone() makes a duplicate copy of the map. containskey(key) returns true if the map contains a mapping for the specified key. deepclone() makes a duplicate copy of a map, including sobject records if this is a map with sobject record values. equals(map2) comp" "ares this map with the specified map and returns true if both maps are equal; otherwise, returns false. get(key) returns the value to which the specified key is mapped, or null if the map contains no value for this key. getsobjecttype() returns the token of the sobject type that makes up the map values. hashcode() returns the hashcode corresponding to this map. isempty() returns true if the map has zero key-value pairs. keyset() returns a set that contains all of the keys in the map. put(key, value) associates the specified value with the specified key in the map. putall(frommap) copies all of the mappings from the specified map to the original map. putall(sobjectarray) adds the list of sobject records to a map declared as map or map. 3146apex reference guide map class remove(key) removes the mapping for the specified key from the map, if present, and returns the corresponding value. size() returns the number of key-value pairs in the map. tostring() returns the string representation of the map. values() returns a list that contains all the values in the map. clear() removes all of the key-value mappings from the map. signature public void clear() return value type: void clone() makes a duplicate copy of the map. signature public map clone() return value type: map (of same type) usage if this is a map with sobject record values, the duplicate map will only be a shallow copy of the map. that is, the duplicate will have references to each sobject record, but the records themselves are not duplicated. for example: to also copy the sobject records, you must use the deepclone method. example account a = new account( name='acme', billingcity='new york'); map map1 = new map {}; map1.put(1, a); map map2 = map1.clone(); 3147apex reference guide map class map1.get(1).billingcity = 'san francisco'; system.assertequals( 'san francisco', map1.get(1).billingcity); system.assertequals( 'san francisco', map2.get(1).billingcity); containskey(key) returns true if the map contains a mapping for the specified key. signature public boolean containskey(object key) parameters key type: object return value type: boolean usage if the key is a string, the key value is case-sensitive. example map colorcodes = new map(); colorcodes.put('red', 'ff0000'); colorcodes.put('blue', '0000a0'); boolean contains = colorcodes.containskey('blue'); system.assertequals(true, contains); deepclone() makes a duplicate copy of a map, including sobject records if this is a map with sobject record values. signature public map deepclone() 3148apex reference guide map class return value type: map (of the same type) usage to make a shallow copy of a map without duplicating the sobject records it contains, use the clone() method. example account a = new account( name='acme', billingcity='new york'); map map1 = new map {}; map1.put(1, a); map map2 = map1.deepclone(); // update the first entry of map1 map1.get(1).billingcity = 'san francisco'; // verify that the billingcity is updated in map1 but not in map2 system.assertequals('san francisco', map1.get(1).billingcity); system.assertequals('new york', map2.get(1).billingcity); equals(map2) compares this map with the specified map and returns true if both maps are equal; otherwise, returns false. signature public boolean equals(map map2) parameters map2 type: map the map2 argument is the map to compare this map with." "return value type: boolean usage two maps are equal if their key/value pairs are identical, regardless of the order of those pairs. the == operator is used to compare the map keys and values. the == operator is equivalent to calling the equals method, so you can call map1.equals(map2); instead of map1 == map2;. 3149apex reference guide map class get(key) returns the value to which the specified key is mapped, or null if the map contains no value for this key. signature public object get(object key) parameters key type: object return value type: object usage if the key is a string, the key value is case-sensitive. example map colorcodes = new map(); colorcodes.put('red', 'ff0000'); colorcodes.put('blue', '0000a0'); string code = colorcodes.get('blue'); system.assertequals('0000a0', code); // the following is not a color in the map string code2 = colorcodes.get('magenta'); system.assertequals(null, code2); getsobjecttype() returns the token of the sobject type that makes up the map values. signature public schema.sobjecttype getsobjecttype() return value type: schema.sobjecttype usage use this method with describe information, to determine if a map contains sobjects of a particular type. 3150apex reference guide map class note that this method can only be used with maps that have sobject values. for more information, see understanding apex describe information. example // create a generic sobject variable. sobject sobj = database.query('select id from account limit 1'); // verify if that sobject variable is an account token. system.assertequals( account.sobjecttype, sobj.getsobjecttype()); // create a map of generic sobjects map m = new map(); // verify if the map contains account tokens. system.assertequals( account.sobjecttype, m.getsobjecttype()); hashcode() returns the hashcode corresponding to this map. signature public integer hashcode() return value type: integer isempty() returns true if the map has zero key-value pairs. signature public boolean isempty() return value type: boolean example map colorcodes = new map(); boolean empty = colorcodes.isempty(); system.assertequals(true, empty); 3151apex reference guide map class keyset() returns a set that contains all of the keys in the map. signature public set keyset() return value type: set (of key type) example map colorcodes = new map(); colorcodes.put('red', 'ff0000'); colorcodes.put('blue', '0000a0'); set colorset = new set(); colorset = colorcodes.keyset(); put(key, value) associates the specified value with the specified key in the map. signature public object put(object key, object value) parameters key type: object value type: object return value type: object usage if the map previously contained a mapping for this key, the old value is returned by the method and then replaced. if the key is a string, the key value is case-sensitive. example map colorcodes = new map(); 3152apex reference guide map class colorcodes.put('red', 'ff0000'); colorcodes.put('red', '#ff0000'); // red is now #ff0000 putall(frommap) copies all of the mappings from the specified map to the original map. signature public void putall(map frommap) parameters frommap type: map return value type: void usage the new mappings from frommap replace any mappings that the original map had. example map map1 = new map(); map1.put('red','ff0000'); map map2 = new map();" "map2.put('blue','0000ff'); // add map1 entries to map2 map2.putall(map1); system.assertequals(2, map2.size()); putall(sobjectarray) adds the list of sobject records to a map declared as map or map. signature public void putall(sobject[] sobjectarray) parameters sobjectarray type: sobject[] return value type: void 3153apex reference guide map class usage this method is similar to calling the map constructor with the same input. example list accts = new list(); accts.add(new account(name='account1')); accts.add(new account(name='account2')); // insert accounts so their ids are populated. insert accts; map m = new map(); // add all the records to the map. m.putall(accts); system.assertequals(2, m.size()); remove(key) removes the mapping for the specified key from the map, if present, and returns the corresponding value. signature public object remove(key key) parameters key type: key return value type: object usage if the key is a string, the key value is case-sensitive. example map colorcodes = new map(); colorcodes.put('red', 'ff0000'); colorcodes.put('blue', '0000a0'); string mycolor = colorcodes.remove('blue'); string code2 = colorcodes.get('blue'); system.assertequals(null, code2); size() returns the number of key-value pairs in the map. 3154apex reference guide map class signature public integer size() return value type: integer example map colorcodes = new map(); colorcodes.put('red', 'ff0000'); colorcodes.put('blue', '0000a0'); integer msize = colorcodes.size(); system.assertequals(2, msize); tostring() returns the string representation of the map. signature public string tostring() return value type: string usage when used in cyclic references, the output is truncated to prevent infinite recursion. when used with large collections, the output is truncated to avoid exceeding total heap size and maximum cpu time. • up to 10 items per collection are included in the output, followed by an ellipsis (…). • if the same object is included multiple times in a collection, it’s shown in the output only once; subsequent references are shown as (already output). values() returns a list that contains all the values in the map. signature public list values() return value type: list 3155apex reference guide matcher class usage the order of map elements is deterministic. you can rely on the order being the same in each subsequent execution of the same code. for example, suppose the values() method returns a list containing value1 and index 0 and value2 and index 1. subsequent runs of the same code result in those values being returned in the same order. example map colorcodes = new map(); colorcodes.put('red', 'ff0000'); colorcodes.put('blue', '0000a0'); list colors = new list(); colors = colorcodes.values(); matcher class matchers use patterns to perform match operations on a character string. namespace system matcher methods the following are methods for matcher. in this section: end() returns the position after the last matched character. end(groupindex) returns the position after the last character of the subsequence captured by the group index during the previous match operation. if the match was successful but the group itself did not match anything, this method returns -1. find() attempts to find the next subsequence of the input sequence that matches the pattern. this method returns true if a subsequence of the input sequence matches this matcher object's pattern. find(group) resets the matcher object and then tries to find the next subsequence of the input sequence that matches the" "pattern. this method returns true if a subsequence of the input sequence matches this matcher object's pattern. group() returns the input subsequence returned by the previous match. group(groupindex) returns the input subsequence captured by the specified group index during the previous match operation. if the match was successful but the specified group failed to match any part of the input sequence, null is returned. 3156apex reference guide matcher class groupcount() returns the number of capturing groups in this matching object's pattern. group zero denotes the entire pattern and is not included in this count. hasanchoringbounds() returns true if the matcher object has anchoring bounds, false otherwise. by default, a matcher object uses anchoring bounds regions. hastransparentbounds() returns true if the matcher object has transparent bounds, false if it uses opaque bounds. by default, a matcher object uses opaque region boundaries. hitend() returns true if the end of input was found by the search engine in the last match operation performed by this matcher object. when this method returns true, it is possible that more input would have changed the result of the last search. lookingat() attempts to match the input sequence, starting at the beginning of the region, against the pattern. matches() attempts to match the entire region against the pattern. pattern() returns the pattern object from which this matcher object was created. quotereplacement(inputstring) returns a literal replacement string for the specified string inputstring. the characters in the returned string match the sequence of characters in inputstring. region(start, end) sets the limits of this matcher object's region. the region is the part of the input sequence that is searched to find a match. regionend() returns the end index (exclusive) of this matcher object's region. regionstart() returns the start index (inclusive) of this matcher object's region. replaceall(replacementstring) replaces every subsequence of the input sequence that matches the pattern with the replacement string. replacefirst(replacementstring) replaces the first subsequence of the input sequence that matches the pattern with the replacement string. requireend() returns true if more input could change a positive match into a negative one. reset() resets this matcher object. resetting a matcher object discards all of its explicit state information. reset(inputsequence) resets this matcher object with the new input sequence. resetting a matcher object discards all of its explicit state information. start() returns the start index of the first character of the previous match. 3157apex reference guide matcher class start(groupindex) returns the start index of the subsequence captured by the group specified by the group index during the previous match operation. captured groups are indexed from left to right, starting at one. group zero denotes the entire pattern, so the expression m.start(0) is equivalent to m.start(). useanchoringbounds(anchoringbounds) sets the anchoring bounds of the region for the matcher object. by default, a matcher object uses anchoring bounds regions. usepattern(pattern) changes the pattern object that the matcher object uses to find matches. this method causes the matcher object to lose information about the groups of the last match that occurred. the matcher object's position in the input is maintained. usetransparentbounds(transparentbounds) sets the transparency bounds for this matcher object. by default, a matcher object uses anchoring bounds regions. end() returns the position after the last matched character. signature public integer end() return value type: integer end(groupindex) returns the position after the last character of the subsequence captured by the group index during the previous match operation. if the match was successful but the group itself did not match anything, this method returns -1. signature public integer end(integer groupindex) parameters groupindex type: integer return value type: integer usage captured groups are indexed from left to right, starting at one. group zero denotes the entire pattern, so the expressionm.end(0) is equivalent to m.end(). see understanding capturing groups. 3158apex reference guide matcher class find() attempts to find the next subsequence of the input sequence that matches the pattern. this method returns true if a subsequence of the input sequence matches this matcher object's pattern. signature public boolean find() return value type: boolean usage this method starts at" "the beginning of this matcher object's region, or, if a previous invocation of the method was successful and the matcher object has not since been reset, at the first character not matched by the previous match. if the match succeeds, more information can be obtained using the start, end, and group methods. for more information, see using regions. find(group) resets the matcher object and then tries to find the next subsequence of the input sequence that matches the pattern. this method returns true if a subsequence of the input sequence matches this matcher object's pattern. signature public boolean find(integer group) parameters group type: integer return value type: boolean usage if the match succeeds, more information can be obtained using the start, end, and group methods. group() returns the input subsequence returned by the previous match. signature public string group() 3159apex reference guide matcher class return value type: string usage note that some groups, such as (a*), match the empty string. this method returns the empty string when such a group successfully matches the empty string in the input. group(groupindex) returns the input subsequence captured by the specified group index during the previous match operation. if the match was successful but the specified group failed to match any part of the input sequence, null is returned. signature public string group(integer groupindex) parameters groupindex type: integer return value type: string usage captured groups are indexed from left to right, starting at one. group zero denotes the entire pattern, so the expression m.group(0) is equivalent to m.group(). note that some groups, such as (a*), match the empty string. this method returns the empty string when such a group successfully matches the empty string in the input. see understanding capturing groups. groupcount() returns the number of capturing groups in this matching object's pattern. group zero denotes the entire pattern and is not included in this count. signature public integer groupcount() return value type: integer usage see understanding capturing groups. 3160apex reference guide matcher class hasanchoringbounds() returns true if the matcher object has anchoring bounds, false otherwise. by default, a matcher object uses anchoring bounds regions. signature public boolean hasanchoringbounds() return value type: boolean usage if a matcher object uses anchoring bounds, the boundaries of this matcher object's region match start and end of line anchors such as ^ and $. for more information, see using bounds. hastransparentbounds() returns true if the matcher object has transparent bounds, false if it uses opaque bounds. by default, a matcher object uses opaque region boundaries. signature public boolean hastransparentbounds() return value type: boolean usage for more information, see using bounds. hitend() returns true if the end of input was found by the search engine in the last match operation performed by this matcher object. when this method returns true, it is possible that more input would have changed the result of the last search. signature public boolean hitend() return value type: boolean lookingat() attempts to match the input sequence, starting at the beginning of the region, against the pattern. 3161apex reference guide matcher class signature public boolean lookingat() return value type: boolean usage like the matches method, this method always starts at the beginning of the region; unlike that method, it does not require the entire region be matched. if the match succeeds, more information can be obtained using the start, end, and group methods. see using regions. matches() attempts to match the entire region against the pattern. signature public boolean matches() return value type: boolean usage if the match succeeds, more information can be obtained using the start, end, and group methods. see using regions. pattern() returns the pattern object from which this matcher object was created. signature public pattern object pattern() return value type: system.pattern quotereplacement(inputstring) returns a literal replacement string for the specified string inputstring. the characters in the returned string match the sequence of characters in inputstring. 3162apex reference guide matcher class signature public static string quotereplacement(string inputstring) parameters inputstring type: string return value type: string usage metacharacters (such as $ or ^) and" "escape sequences in the input string are treated as literal characters with no special meaning. region(start, end) sets the limits of this matcher object's region. the region is the part of the input sequence that is searched to find a match. signature public matcher object region(integer start, integer end) parameters start type: integer end type: integer return value type: matcher usage this method first resets the matcher object, then sets the region to start at the index specified by start and end at the index specified by end. depending on the transparency boundaries being used, certain constructs such as anchors may behave differently at or around the boundaries of the region. see using regions and using bounds. regionend() returns the end index (exclusive) of this matcher object's region. 3163apex reference guide matcher class signature public integer regionend() return value type: integer usage see using regions. regionstart() returns the start index (inclusive) of this matcher object's region. signature public integer regionstart() return value type: integer usage see using regions. replaceall(replacementstring) replaces every subsequence of the input sequence that matches the pattern with the replacement string. signature public string replaceall(string replacementstring) parameters replacementstring type: string return value type: string usage this method first resets the matcher object, then scans the input sequence looking for matches of the pattern. characters that are not part of any match are appended directly to the result string; each match is replaced in the result by the replacement string. the replacement string may contain references to captured subsequences. 3164apex reference guide matcher class note that backslashes (\) and dollar signs ($) in the replacement string may cause the results to be different than if the string was treated as a literal replacement string. dollar signs may be treated as references to captured subsequences, and backslashes are used to escape literal characters in the replacement string. invoking this method changes this matcher object's state. if the matcher object is to be used in further matching operations it should first be reset. given the regular expression a*b, the input ""aabxyzaabxyzabxyzb"", and the replacement string ""-"", an invocation of this method on a matcher object for that expression would yield the string ""-xyz-xyz-xyz-"". replacefirst(replacementstring) replaces the first subsequence of the input sequence that matches the pattern with the replacement string. signature public string replacefirst(string replacementstring) parameters replacementstring type: string return value type: string usage note that backslashes (\) and dollar signs ($) in the replacement string may cause the results to be different than if the string was treated as a literal replacement string. dollar signs may be treated as references to captured subsequences, and backslashes are used to escape literal characters in the replacement string. invoking this method changes this matcher object's state. if the matcher object is to be used in further matching operations it should first be reset. given the regular expression dog, the input ""zzzdogzzzdogzzz"", and the replacement string ""cat"", an invocation of this method on a matcher object for that expression would return the string ""zzzcatzzzdogzzz"". requireend() returns true if more input could change a positive match into a negative one. signature public boolean requireend() return value type: boolean 3165apex reference guide matcher class usage if this method returns true, and a match was found, then more input could cause the match to be lost. if this method returns false and a match was found, then more input might change the match but the match won't be lost. if a match was not found, then requireend has no meaning. reset() resets this matcher object. resetting a matcher object discards all of its explicit state information. signature public matcher object reset() return value type: matcher usage this method does not change whether the matcher object uses anchoring bounds. you must explicitly use the useanchoringbounds method to change the anchoring bounds. for more information, see using bounds. reset(inputsequence) resets this matcher object with the new input sequence. resetting a matcher object discards all of its explicit state information. signature public matcher reset(string inputsequence) parameters inputsequence" "type: string return value type: matcher start() returns the start index of the first character of the previous match. signature public integer start() 3166apex reference guide matcher class return value type: integer start(groupindex) returns the start index of the subsequence captured by the group specified by the group index during the previous match operation. captured groups are indexed from left to right, starting at one. group zero denotes the entire pattern, so the expression m.start(0) is equivalent to m.start(). signature public integer start(integer groupindex) parameters groupindex type: integer return value type: integer usage see understanding capturing groups. useanchoringbounds(anchoringbounds) sets the anchoring bounds of the region for the matcher object. by default, a matcher object uses anchoring bounds regions. signature public matcher object useanchoringbounds(boolean anchoringbounds) parameters anchoringbounds type: boolean if you specify true, the matcher object uses anchoring bounds. if you specify false, non-anchoring bounds are used. return value type: matcher usage if a matcher object uses anchoring bounds, the boundaries of this matcher object's region match start and end of line anchors such as ^ and $. for more information, see using bounds. 3167apex reference guide math class usepattern(pattern) changes the pattern object that the matcher object uses to find matches. this method causes the matcher object to lose information about the groups of the last match that occurred. the matcher object's position in the input is maintained. signature public matcher object usepattern(pattern pattern) parameters pattern type: system.pattern return value type: matcher usetransparentbounds(transparentbounds) sets the transparency bounds for this matcher object. by default, a matcher object uses anchoring bounds regions. signature public matcher object usetransparentbounds(boolean transparentbounds) parameters transparentbounds type: boolean if you specify true, the matcher object uses transparent bounds. if you specify false, opaque bounds are used. return value type: matcher usage for more information, see using bounds. math class contains methods for mathematical operations. namespace system 3168apex reference guide math class math fields the following are fields for math. in this section: e returns the mathematical constant e, which is the base of natural logarithms. pi returns the mathematical constant pi, which is the ratio of the circumference of a circle to its diameter. e returns the mathematical constant e, which is the base of natural logarithms. signature public static final double e property value type: double pi returns the mathematical constant pi, which is the ratio of the circumference of a circle to its diameter. signature public static final double pi property value type: double math methods the following are methods for math. all methods are static. in this section: abs(decimalvalue) returns the absolute value of the specified decimal. abs(doublevalue) returns the absolute value of the specified double. abs(integervalue) returns the absolute value of the specified integer. abs(longvalue) returns the absolute value of the specified long. 3169apex reference guide math class acos(decimalangle) returns the arc cosine of an angle, in the range of 0.0 through pi. acos(doubleangle) returns the arc cosine of an angle, in the range of 0.0 through pi. asin(decimalangle) returns the arc sine of an angle, in the range of -pi/2 through pi/2. asin(doubleangle) returns the arc sine of an angle, in the range of -pi/2 through pi/2. atan(decimalangle) returns the arc tangent of an angle, in the range of -pi/2 through pi/2. atan(doubleangle) returns the arc tangent of an angle, in the range of -pi/2 through pi/2. atan2(xcoordinate, ycoordinate) converts rectangular coordinates (xcoordinate and ycoordinate) to polar (r and theta). this method computes the phase theta by computing an arc tangent of xcoordinate/ycoordinate in the range of -pi to pi." "atan2(xcoordinate, ycoordinate) converts rectangular coordinates (xcoordinate and ycoordinate) to polar (r and theta). this method computes the phase theta by computing an arc tangent of xcoordinate/ycoordinate in the range of -pi to pi. cbrt(decimalvalue) returns the cube root of the specified decimal. the cube root of a negative value is the negative of the cube root of that value's magnitude. cbrt(doublevalue) returns the cube root of the specified double. the cube root of a negative value is the negative of the cube root of that value's magnitude. ceil(decimalvalue) returns the smallest (closest to negative infinity) decimal that is not less than the argument and is equal to a mathematical integer. ceil(doublevalue) returns the smallest (closest to negative infinity) double that is not less than the argument and is equal to a mathematical integer. cos(decimalangle) returns the trigonometric cosine of the angle specified by decimalangle. cos(doubleangle) returns the trigonometric cosine of the angle specified by doubleangle. cosh(decimalangle) returns the hyperbolic cosine of decimalangle. the hyperbolic cosine of d is defined to be (ex + e-x)/2 where e is euler's number. cosh(doubleangle) returns the hyperbolic cosine of doubleangle. the hyperbolic cosine of d is defined to be (ex + e-x)/2 where e is euler's number. exp(exponentdecimal) returns euler's number e raised to the power of the specified decimal. exp(exponentdouble) returns euler's number e raised to the power of the specified double. 3170apex reference guide math class floor(decimalvalue) returns the largest (closest to positive infinity) decimal that is not greater than the argument and is equal to a mathematical integer. floor(doublevalue) returns the largest (closest to positive infinity) double that is not greater than the argument and is equal to a mathematical integer. log(decimalvalue) returns the natural logarithm (base e) of the specified decimal. log(doublevalue) returns the natural logarithm (base e) of the specified double. log10(decimalvalue) returns the logarithm (base 10) of the specified decimal. log10(doublevalue) returns the logarithm (base 10) of the specified double. max(decimalvalue1, decimalvalue2) returns the larger of the two specified decimals. max(doublevalue1, doublevalue2) returns the larger of the two specified doubles. max(integervalue1, integervalue2) returns the larger of the two specified integers. max(longvalue1, longvalue2) returns the larger of the two specified longs. min(decimalvalue1, decimalvalue2) returns the smaller of the two specified decimals. min(doublevalue1, doublevalue2) returns the smaller of the two specified doubles. min(integervalue1, integervalue2) returns the smaller of the two specified integers. min(longvalue1, longvalue2) returns the smaller of the two specified longs. mod(integervalue1, integervalue2) returns the remainder of integervalue1 divided by integervalue2. mod(longvalue1, longvalue2) returns the remainder of longvalue1 divided by longvalue2. pow(doublevalue, exponent) returns the value of the first double raised to the power of exponent. random() returns a positive double that is greater than or equal to 0.0 and less than 1.0. rint(decimalvalue) returns the value that is closest in value to decimalvalue and is equal to a mathematical integer. rint(doublevalue) returns the value that is closest in value to doublevalue and is equal to a mathematical integer. 3171apex reference guide math class round(doublevalue) do not use. this method is deprecated as of the winter '08 release. instead, use math.roundtolong. returns the closest integer to the specified double. if the result is less than -2,147,483,648 or greater than 2,147,483,647, apex generates an error. round(decimalvalue) returns the rounded approximation of this decimal. the number" "is rounded to zero decimal places using half-even rounding mode, that is, it rounds towards the “nearest neighbor” unless both neighbors are equidistant, in which case, this mode rounds towards the even neighbor. roundtolong(decimalvalue) returns the rounded approximation of this decimal. the number is rounded to zero decimal places using half-even rounding mode, that is, it rounds towards the “nearest neighbor” unless both neighbors are equidistant, in which case, this mode rounds towards the even neighbor. roundtolong(doublevalue) returns the closest long to the specified double. signum(decimalvalue) returns the signum function of the specified decimal, which is 0 if decimalvalue is 0, 1.0 if decimalvalue is greater than 0, -1.0 if decimalvalue is less than 0. signum(doublevalue) returns the signum function of the specified double, which is 0 if doublevalue is 0, 1.0 if doublevalue is greater than 0, -1.0 if doublevalue is less than 0. sin(decimalangle) returns the trigonometric sine of the angle specified by decimalangle. sin(doubleangle) returns the trigonometric sine of the angle specified by doubleangle. sinh(decimalangle) returns the hyperbolic sine of decimalangle. the hyperbolic sine of decimalangle is defined to be (ex - e-x)/2 where e is euler's number. sinh(doubleangle) returns the hyperbolic sine of doubleangle. the hyperbolic sine of doubleangle is defined to be (ex - e-x)/2 where e is euler's number. sqrt(decimalvalue) returns the correctly rounded positive square root of decimalvalue. sqrt(doublevalue) returns the correctly rounded positive square root of doublevalue. tan(decimalangle) returns the trigonometric tangent of the angle specified by decimalangle. tan(doubleangle) returns the trigonometric tangent of the angle specified by doubleangle. tanh(decimalangle) returns the hyperbolic tangent of decimalangle. the hyperbolic tangent of decimalangle is defined to be (ex - e-x)/(ex + e-x) where e is euler's number. in other words, it is equivalent to sinh(x)/cosinh(x). the absolute value of the exact tanh is always less than 1. 3172apex reference guide math class tanh(doubleangle) returns the hyperbolic tangent of doubleangle. the hyperbolic tangent of doubleangle is defined to be (ex - e-x)/(ex + e-x) where e is euler's number. in other words, it is equivalent to sinh(x)/cosinh(x). the absolute value of the exact tanh is always less than 1. abs(decimalvalue) returns the absolute value of the specified decimal. signature public static decimal abs(decimal decimalvalue) parameters decimalvalue type: decimal return value type: decimal abs(doublevalue) returns the absolute value of the specified double. signature public static double abs(double doublevalue) parameters doublevalue type: double return value type: double abs(integervalue) returns the absolute value of the specified integer. signature public static integer abs(integer integervalue) parameters integervalue type: integer 3173apex reference guide math class return value type: integer example integer i = -42; integer i2 = math.abs(i); system.assertequals(i2, 42); abs(longvalue) returns the absolute value of the specified long. signature public static long abs(long longvalue) parameters longvalue type: long return value type: long acos(decimalangle) returns the arc cosine of an angle, in the range of 0.0 through pi. signature public static decimal acos(decimal decimalangle) parameters decimalangle type: decimal return value type: decimal acos(doubleangle) returns the arc cosine of an angle, in the range of 0.0 through pi. signature public static double acos(double doubleangle) 3174apex reference guide math class" "parameters doubleangle type: double return value type: double asin(decimalangle) returns the arc sine of an angle, in the range of -pi/2 through pi/2. signature public static decimal asin(decimal decimalangle) parameters decimalangle type: decimal return value type: decimal asin(doubleangle) returns the arc sine of an angle, in the range of -pi/2 through pi/2. signature public static double asin(double doubleangle) parameters doubleangle type: double return value type: double atan(decimalangle) returns the arc tangent of an angle, in the range of -pi/2 through pi/2. signature public static decimal atan(decimal decimalangle) 3175apex reference guide math class parameters decimalangle type: decimal return value type: decimal atan(doubleangle) returns the arc tangent of an angle, in the range of -pi/2 through pi/2. signature public static double atan(double doubleangle) parameters doubleangle type: double return value type: double atan2(xcoordinate, ycoordinate) converts rectangular coordinates (xcoordinate and ycoordinate) to polar (r and theta). this method computes the phase theta by computing an arc tangent of xcoordinate/ycoordinate in the range of -pi to pi. signature public static decimal atan2(decimal xcoordinate, decimal ycoordinate) parameters xcoordinate type: decimal ycoordinate type: decimal return value type: decimal atan2(xcoordinate, ycoordinate) converts rectangular coordinates (xcoordinate and ycoordinate) to polar (r and theta). this method computes the phase theta by computing an arc tangent of xcoordinate/ycoordinate in the range of -pi to pi. 3176apex reference guide math class signature public static double atan2(double xcoordinate, double ycoordinate) parameters xcoordinate type: double ycoordinate type: double return value type: double cbrt(decimalvalue) returns the cube root of the specified decimal. the cube root of a negative value is the negative of the cube root of that value's magnitude. signature public static decimal cbrt(decimal decimalvalue) parameters decimalvalue type: decimal return value type: decimal cbrt(doublevalue) returns the cube root of the specified double. the cube root of a negative value is the negative of the cube root of that value's magnitude. signature public static double cbrt(double doublevalue) parameters doublevalue type: double return value type: double 3177apex reference guide math class ceil(decimalvalue) returns the smallest (closest to negative infinity) decimal that is not less than the argument and is equal to a mathematical integer. signature public static decimal ceil(decimal decimalvalue) parameters decimalvalue type: decimal return value type: decimal ceil(doublevalue) returns the smallest (closest to negative infinity) double that is not less than the argument and is equal to a mathematical integer. signature public static double ceil(double doublevalue) parameters doublevalue type: double return value type: double cos(decimalangle) returns the trigonometric cosine of the angle specified by decimalangle. signature public static decimal cos(decimal decimalangle) parameters decimalangle type: decimal return value type: decimal 3178apex reference guide math class cos(doubleangle) returns the trigonometric cosine of the angle specified by doubleangle. signature public static double cos(double doubleangle) parameters doubleangle type: double return value type: double cosh(decimalangle) returns the hyperbolic cosine of decimalangle. the hyperbolic cosine of d is defined to be (ex + e-x)/2 where e is euler's number. signature public static decimal cosh(decimal decimalangle) parameters decimalangle type: decimal return value type" ": decimal cosh(doubleangle) returns the hyperbolic cosine of doubleangle. the hyperbolic cosine of d is defined to be (ex + e-x)/2 where e is euler's number. signature public static double cosh(double doubleangle) parameters doubleangle type: double return value type: double 3179apex reference guide math class exp(exponentdecimal) returns euler's number e raised to the power of the specified decimal. signature public static decimal exp(decimal exponentdecimal) parameters exponentdecimal type: decimal return value type: decimal exp(exponentdouble) returns euler's number e raised to the power of the specified double. signature public static double exp(double exponentdouble) parameters exponentdouble type: double return value type: double floor(decimalvalue) returns the largest (closest to positive infinity) decimal that is not greater than the argument and is equal to a mathematical integer. signature public static decimal floor(decimal decimalvalue) parameters decimalvalue type: decimal return value type: decimal 3180apex reference guide math class floor(doublevalue) returns the largest (closest to positive infinity) double that is not greater than the argument and is equal to a mathematical integer. signature public static double floor(double doublevalue) parameters doublevalue type: double return value type: double log(decimalvalue) returns the natural logarithm (base e) of the specified decimal. signature public static decimal log(decimal decimalvalue) parameters decimalvalue type: decimal return value type: decimal log(doublevalue) returns the natural logarithm (base e) of the specified double. signature public static double log(double doublevalue) parameters doublevalue type: double return value type: double 3181apex reference guide math class log10(decimalvalue) returns the logarithm (base 10) of the specified decimal. signature public static decimal log10(decimal decimalvalue) parameters decimalvalue type: decimal return value type: decimal log10(doublevalue) returns the logarithm (base 10) of the specified double. signature public static double log10(double doublevalue) parameters doublevalue type: double return value type: double max(decimalvalue1, decimalvalue2) returns the larger of the two specified decimals. signature public static decimal max(decimal decimalvalue1, decimal decimalvalue2) parameters decimalvalue1 type: decimal decimalvalue2 type: decimal 3182" "apex reference guide math class return value type: decimal example decimal larger = math.max(12.3, 156.6); system.assertequals(larger, 156.6); max(doublevalue1, doublevalue2) returns the larger of the two specified doubles. signature public static double max(double doublevalue1, double doublevalue2) parameters doublevalue1 type: double doublevalue2 type: double return value type: double max(integervalue1, integervalue2) returns the larger of the two specified integers. signature public static integer max(integer integervalue1, integer integervalue2) parameters integervalue1 type: integer integervalue2 type: integer return value type: integer max(longvalue1, longvalue2) returns the larger of the two specified longs. 3183apex reference guide math class signature public static long max(long longvalue1, long longvalue2) parameters longvalue1 type: long longvalue2 type: long return value type: long min(decimalvalue1, decimalvalue2) returns the smaller of the two specified decimals. signature public static decimal min(decimal decimalvalue1, decimal decimalvalue2) parameters decimalvalue1 type: decimal decimalvalue2 type: decimal return value type: decimal example decimal smaller = math.min(12.3, 156.6); system.assertequals(smaller, 12.3); min(doublevalue1, doublevalue2) returns the smaller of the two specified doubles. signature public static double min(double doublevalue1, double doublevalue2) 3184apex reference guide math class parameters doublevalue1 type: double doublevalue2 type: double return value type: double min(integervalue1, integervalue2) returns the smaller of the two specified integers. signature public static integer min(integer integervalue1, integer integervalue2) parameters integervalue1 type: integer integervalue2 type: integer return value type: integer min(longvalue1, longvalue2) returns the smaller of the two specified longs. signature public static long min(long longvalue1, long longvalue2) parameters longvalue1 type: long longvalue2 type: long return value type: long 3185apex reference guide math class mod(integervalue1, integervalue2) returns the remainder of integervalue1 divided by integervalue2. signature public static integer mod(integer integervalue1, integer integervalue2) parameters integervalue1 type: integer integervalue2 type: integer return value type: integer example integer remainder = math.mod(12, 2); system.assertequals(remainder, 0); integer remainder2 = math.mod(8, 3); system.assertequals(remainder2, 2); mod(longvalue1, longvalue2) returns the remainder of longvalue1 divided by longvalue2. signature public static long mod(long longvalue1, long longvalue2) parameters longvalue1 type: long longvalue2 type: long return value type: long pow(doublevalue, exponent) returns the value of the first double raised to the power of exponent. 3186apex reference guide math class signature public static double pow(double doublevalue, double exponent) parameters doublevalue type: double exponent type: double return value type: double random() returns a positive double that is greater than or equal to 0.0 and less than 1.0. signature public static double random() return value type: double rint(decimalvalue) returns the value that is closest in value to decimalvalue and is equal to a mathematical integer. signature public static decimal rint(decimal decimalvalue) parameters decimalvalue type: decimal return value type: decimal rint(doublevalue) returns the value that is closest in value to doublevalue and is equal to a mathematical integer. signature public static double rint(double doublevalue) 3187apex reference guide math class parameters doublevalue type: double return value type: double round(doublevalue) do not use. this method" "is deprecated as of the winter '08 release. instead, use math.roundtolong. returns the closest integer to the specified double. if the result is less than -2,147,483,648 or greater than 2,147,483,647, apex generates an error. signature public static integer round(double doublevalue) parameters doublevalue type: double return value type: integer round(decimalvalue) returns the rounded approximation of this decimal. the number is rounded to zero decimal places using half-even rounding mode, that is, it rounds towards the “nearest neighbor” unless both neighbors are equidistant, in which case, this mode rounds towards the even neighbor. signature public static integer round(decimal decimalvalue) parameters decimalvalue type: decimal return value type: integer usage note that this rounding mode statistically minimizes cumulative error when applied repeatedly over a sequence of calculations. 3188apex reference guide math class example decimal d1 = 4.5; integer i1 = math.round(d1); system.assertequals(4, i1); decimal d2 = 5.5; integer i2 = math.round(d2); system.assertequals(6, i2); roundtolong(decimalvalue) returns the rounded approximation of this decimal. the number is rounded to zero decimal places using half-even rounding mode, that is, it rounds towards the “nearest neighbor” unless both neighbors are equidistant, in which case, this mode rounds towards the even neighbor. signature public static long roundtolong(decimal decimalvalue) parameters decimalvalue type: decimal return value type: long usage note that this rounding mode statistically minimizes cumulative error when applied repeatedly over a sequence of calculations. example decimal d1 = 4.5; long i1 = math.roundtolong(d1); system.assertequals(4, i1); decimal d2 = 5.5; long i2 = math.roundtolong(d2); system.assertequals(6, i2); roundtolong(doublevalue) returns the closest long to the specified double. signature public static long roundtolong(double doublevalue) 3189apex reference guide math class parameters doublevalue type: double return value type: long signum(decimalvalue) returns the signum function of the specified decimal, which is 0 if decimalvalue is 0, 1.0 if decimalvalue is greater than 0, -1.0 if decimalvalue is less than 0. signature public static decimal signum(decimal decimalvalue) parameters decimalvalue type: decimal return value type: decimal signum(doublevalue) returns the signum function of the specified double, which is 0 if doublevalue is 0, 1.0 if doublevalue is greater than 0, -1.0 if doublevalue is less than 0. signature public static double signum(double doublevalue) parameters doublevalue type: double return value type: double sin(decimalangle) returns the trigonometric sine of the angle specified by decimalangle. 3190apex reference guide math class signature public static decimal sin(decimal decimalangle) parameters decimalangle type: decimal return value type: decimal sin(doubleangle) returns the trigonometric sine of the angle specified by doubleangle. signature public static double sin(double doubleangle) parameters doubleangle type: double return value type: double sinh(decimalangle) returns the hyperbolic sine of decimalangle. the hyperbolic sine of decimalangle is defined to be (ex - e-x)/2 where e is euler's number. signature public static decimal sinh(decimal decimalangle) parameters decimalangle type: decimal return value type: decimal 3191apex reference guide math class sinh(doubleangle) returns the hyperbolic sine of doubleangle. the hyperbolic sine of doubleangle is defined to be (ex - e-x)/2 where e is euler's number. signature public static double sinh(double doubleangle) parameters doubleangle type: double return value type: double" "sqrt(decimalvalue) returns the correctly rounded positive square root of decimalvalue. signature public static decimal sqrt(decimal decimalvalue) parameters decimalvalue type: decimal return value type: decimal sqrt(doublevalue) returns the correctly rounded positive square root of doublevalue. signature public static double sqrt(double doublevalue) parameters doublevalue type: double return value type: double 3192apex reference guide math class tan(decimalangle) returns the trigonometric tangent of the angle specified by decimalangle. signature public static decimal tan(decimal decimalangle) parameters decimalangle type: decimal return value type: decimal tan(doubleangle) returns the trigonometric tangent of the angle specified by doubleangle. signature public static double tan(double doubleangle) parameters doubleangle type: double return value type: double tanh(decimalangle) returns the hyperbolic tangent of decimalangle. the hyperbolic tangent of decimalangle is defined to be (ex - e-x)/(ex + e-x) where e is euler's number. in other words, it is equivalent to sinh(x)/cosinh(x). the absolute value of the exact tanh is always less than 1. signature public static decimal tanh(decimal decimalangle) parameters decimalangle type: decimal 3193apex reference guide messaging class return value type: decimal tanh(doubleangle) returns the hyperbolic tangent of doubleangle. the hyperbolic tangent of doubleangle is defined to be (ex - e-x)/(ex + e-x) where e is euler's number. in other words, it is equivalent to sinh(x)/cosinh(x). the absolute value of the exact tanh is always less than 1. signature public static double tanh(double doubleangle) parameters doubleangle type: double return value type: double messaging class contains messaging methods used when sending a single or mass email. namespace system messaging methods the following are methods for messaging. all are instance methods. in this section: extractinboundemail(source, includeforwardedattachments) use this method in your email service code to control how to parse and process forwarded or attached emails. returns an instance of messaging.inboundemail from a stream of data that is in rfc822 format. the data stream can be a forwarded email in an attachment to an existing inboundemail, or a stream from another source. reservemassemailcapacity(amountreserved) reserves email capacity to send mass email to the specified number of email addresses, after the current transaction commits. reservesingleemailcapacity(amountreserved) reserves email capacity to send single email to the specified number of email addresses, after the current transaction commits. 3194apex reference guide messaging class sendemail(emails, allornothing) sends the list of emails instantiated with either singleemailmessage or massemailmessage and returns a list of sendemailresult objects. when org preferences are set to save emailmessage objects and a trigger is defined for emailmessage objects, the trigger is fired for each singleemailmessage individually. the sendemail method can be called 10 times per apex transaction and each method invocation can include up to 100 ""to"", 25 ""cc"", and 25 ""bcc"" recipients. sendemailmessage(emailmessageids, allornothing) sends draft email messages as defined by the specified email message ids and returns a list of sendemailresult objects. renderemailtemplate(whoid, whatid, bodies) replaces merge fields in text bodies of email templates with values from salesforce records. returns an array of renderemailtemplatebodyresult objects, each of which corresponds to an element in the supplied array of text bodies. each renderemailtemplatebodyresult provides a success or failure indication, along with either an error code or the rendered text. renderstoredemailtemplate(templateid, whoid, whatid) renders a text, custom, html, or visualforce email template that exists in the database into an instance of messaging.singleemailmessage. includes all attachment content in the returned email message. renderstoredemailtemplate(templateid, whoid, whatid, attachmentretrievaloption) renders a text," "custom, html, or visualforce email template that exists in the database into an instance of messaging.singleemailmessage. provides options for including attachment metadata only, attachment metadata and content, or excluding attachments. renderstoredemailtemplate(templateid, whoid, whatid, attachmentretrievaloption, updateemailtemplateusage) renders a text, custom, html, or visualforce email template that exists in the database into an instance of messaging.singleemailmessage. provides options for including attachment metadata only, attachment metadata and content, or excluding attachments. extractinboundemail(source, includeforwardedattachments) use this method in your email service code to control how to parse and process forwarded or attached emails. returns an instance of messaging.inboundemail from a stream of data that is in rfc822 format. the data stream can be a forwarded email in an attachment to an existing inboundemail, or a stream from another source. signature public static messaging.inboundemail extractinboundemail(object source, boolean includeforwardedattachments) parameters source type: object an instance of messaging.inboundemail.binaryattachment whose mimetypesubtype is message/rfc822 or a blob. if source is a blob, then supply a byte array in rfc822 format. includeforwardedattachments type: boolean this parameter controls how attachments to embedded or forwarded emails are handled. set to true to provide all attachments, even attachments in embedded emails in the binaryattachments and textattachments properties of the returned value. set to false to provide only the attachments that are at the top level of the source email. 3195apex reference guide messaging class return value type: messaging.inboundemail reservemassemailcapacity(amountreserved) reserves email capacity to send mass email to the specified number of email addresses, after the current transaction commits. signature public void reservemassemailcapacity(integer amountreserved) parameters amountreserved type: integer return value type: void usage this method can be called when you know in advance how many addresses emails will be sent to as a result of the transaction. if the transaction would cause the organization to exceed its daily email limit, using this method results in the following error: system.handledexception: the daily limit for the org would be exceeded by this request.if the organization doesn’t have permission to send api or mass email, using this method results in the following error: system.noaccessexception: the organization is not permitted to send email. reservesingleemailcapacity(amountreserved) reserves email capacity to send single email to the specified number of email addresses, after the current transaction commits. signature public void reservesingleemailcapacity(integer amountreserved) parameters amountreserved type: integer return value type: void usage this method can be called when you know in advance how many addresses emails will be sent to as a result of the transaction. if the transaction would cause the organization to exceed its daily email limit, using this method results in the following error: system.handledexception: the daily limit for the org would be exceeded by this request.if 3196apex reference guide messaging class the organization doesn’t have permission to send api or mass email, using this method results in the following error: system.noaccessexception: the organization is not permitted to send email. sendemail(emails, allornothing) sends the list of emails instantiated with either singleemailmessage or massemailmessage and returns a list of sendemailresult objects. when org preferences are set to save emailmessage objects and a trigger is defined for emailmessage objects, the trigger is fired for each singleemailmessage individually. the sendemail method can be called 10 times per apex transaction and each method invocation can include up to 100 ""to"", 25 ""cc"", and 25 ""bcc"" recipients. signature public messaging.sendemailresult[] sendemail(messaging.email[] emails, boolean allornothing) parameters emails type: messaging.email[] allornothing type: boolean the optional opt_allornone parameter specifies whether sendemail prevents delivery of all other messages when any of the messages fail due to an error (true), or whether it allows delivery of the messages that don't have errors (false). the default is true. return value type: messaging.sendemailresult[] sendemailmessage(emailmessageids, allornothing) sends draft email messages as defined by the specified email message" "ids and returns a list of sendemailresult objects. signature public messaging.sendemailresult[] sendemailmessage(list emailmessageids, boolean allornothing) parameters emailmessageids type: list allornothing type: boolean return value type: messaging.sendemailresult[] if the emailmessageids parameter is null, the method throws a system.illegalargumentexception exception. 3197apex reference guide messaging class usage the sendemailmessage method assumes that the optional allornothing parameter is always false and ignores the value you set. delivery of all messages is attempted even if some messages fail due to an error. example this example shows how to send a draft email message. it creates a case and a new email message associated with the case. next, the example sends a draft email message and checks the results. before running this example, make sure to replace the email address with a valid address. case c = new case(); insert c; emailmessage e = new emailmessage(); e.parentid = c.id; // set to draft status. // this status is required // for sendemailmessage(). e.status = '5'; e.textbody = 'sample email message.'; e.subject = 'apex sample'; e.toaddress = 'customer@email.com'; insert e; list results = messaging.sendemailmessage(new id[] { e.id }); system.assertequals(1, results.size()); system.assertequals(true, results[0].success); versioned behavior changes in api version 54.0 and later, a null emailmessageids parameter results in a system.illegalargumentexception exception. in api version 53.0 and earlier, a null emailmessageids parameter results in an error. renderemailtemplate(whoid, whatid, bodies) replaces merge fields in text bodies of email templates with values from salesforce records. returns an array of renderemailtemplatebodyresult objects, each of which corresponds to an element in the supplied array of text bodies. each renderemailtemplatebodyresult provides a success or failure indication, along with either an error code or the rendered text. signature public static list renderemailtemplate(string whoid, string whatid, list bodies) 3198apex reference guide messaging class parameters whoid type: string the identifier of an object in the database, typically a contact, lead, or user. the database record for that object is read and used in merge field processing. whatid type: string identifies an object in the database like an account or opportunity. the record for that object is read and used in merge field processing. bodies type: list an array of strings that are examined for merge field references. the corresponding data from the object referenced by the whoid or whatid replaces the merge field reference. return value type: list usage use this method in situations in which you want to dynamically compose blocks of text that are enriched with data from the database. you can then use the the rendered blocks of text to compose and send an email or update a text value in another database record. executing the renderemailtemplate method counts toward the soql governor limit. the number of soql queries that this method consumes is the number of elements in the list of strings passed in the bodies parameter. see also: execution governors and limits renderstoredemailtemplate(templateid, whoid, whatid) renders a text, custom, html, or visualforce email template that exists in the database into an instance of messaging.singleemailmessage. includes all attachment content in the returned email message. signature public static messaging.singleemailmessage renderstoredemailtemplate(string templateid, string whoid, string whatid) parameters templateid type: string an email template that exists in the database, such as text, html, custom, and visualforce templates. whoid type: string the identifier of an object in the database, typically a contact, lead, or user. the database record for that object is read and used in merge field processing. 3199apex reference guide messaging class whatid type: string identifies an object in the database, like an account or opportunity. the record for that object is read and used in merge field processing. return value type" ": messaging.singleemailmessage usage executing the renderstoredemailtemplate method counts toward the soql governor limit as one query. see also: execution governors and limits renderstoredemailtemplate(templateid, whoid, whatid, attachmentretrievaloption) renders a text, custom, html, or visualforce email template that exists in the database into an instance of messaging.singleemailmessage. provides options for including attachment metadata only, attachment metadata and content, or excluding attachments. signature public static messaging.singleemailmessage renderstoredemailtemplate(string templateid, string whoid, string whatid, messaging.attachmentretrievaloption attachmentretrievaloption) parameters templateid type: string an email template that exists in the database, such as text, html, custom, and visualforce templates. whoid type: string the identifier of an object in the database, typically a contact, lead, or user. the database record for that object is read and used in merge field processing. whatid type: string identifies an object in the database, like an account or opportunity. the record for that object is read and used in merge field processing. attachmentretrievaloption type: messaging.attachmentretrievaloption 3200apex reference guide messaging class specifies options for including attachments in the fileattachments property of the returned messaging.singleemailmessage. set to one of the messaging.attachmentretrievaloption values to include attachment metadata only, attachment metadata and content, or to exclude attachments. note: when the attachmentretrievaloption parameter is not set to none, the entityattachments property of messaging.singleemailmessage contains the id of the salesforce content objects to attach (contentversion or document). the fileattachments property contains the ids of attachments, in addition to all the ids in the entityattachments property. as a result, the id values in entityattachments are duplicates of the ids in the fileattachments property. if you call renderstoredemailtemplate() by passing the metadata_with_body option, and send the rendered email message, the email will contain duplicate attachments. before using the returned email message with sendemail(emails, allornothing), you can remove attachments from fileattachments that are duplicated in entityattachments. return value type: messaging.singleemailmessage usage executing the renderstoredemailtemplate method counts toward the soql governor limit as one query. renderstoredemailtemplate(templateid, whoid, whatid, attachmentretrievaloption, updateemailtemplateusage) renders a text, custom, html, or visualforce email template that exists in the database into an instance of messaging.singleemailmessage. provides options for including attachment metadata only, attachment metadata and content, or excluding attachments. signature public static messaging.singleemailmessage renderstoredemailtemplate(string templateid, string whoid, string whatid, messaging.attachmentretrievaloption attachmentretrievaloption, boolean updateemailtemplateusage) parameters templateid type: string an email template that exists in the database, such as text, html, custom, and visualforce templates. whoid type: string the identifier of an object in the database, typically a contact, lead, or user. the database record for that object is read and used in merge field processing. whatid type: string identifies an object in the database, like an account or opportunity. the record for that object is read and used in merge field processing. 3201apex reference guide multistaticresourcecalloutmock class attachmentretrievaloption type: messaging.attachmentretrievaloption specifies options for including attachments in the fileattachments property of the returned messaging.singleemailmessage. set to one of the messaging.attachmentretrievaloption values to include attachment metadata only, attachment metadata and content, or to exclude attachments. note: when the attachmentretrievaloption parameter is not set to none, the entityattachments property of messaging.singleemailmessage contains the id of the salesforce content objects to attach (contentversion or document). the fileattachments property contains the ids of attachments, in addition to all the ids in the entityattachments property. as a result, the id values in entityattachments are duplicates of the ids in the fileattachments property. if you call renderstoredemailtemplate() by passing the metadata_with_b" "ody option, and send the rendered email message, the email will contain duplicate attachments. before using the returned email message with sendemail(emails, allornothing), you can remove attachments from fileattachments that are duplicated in entityattachments. updateemailtemplateusage type: boolean specifies whether the usage field in the emailtemplate record is updated upon successful rendering. return value type: messaging.singleemailmessage usage executing the renderstoredemailtemplate method counts toward the soql governor limit as one query. multistaticresourcecalloutmock class utility class used to specify a fake response using multiple resources for testing http callouts. namespace system usage use the methods in this class to set the response properties for testing http callouts. you can specify a resource for each endpoint. in this section: multistaticresourcecalloutmock constructors multistaticresourcecalloutmock methods multistaticresourcecalloutmock constructors the following are constructors for multistaticresourcecalloutmock. 3202apex reference guide multistaticresourcecalloutmock class in this section: multistaticresourcecalloutmock() creates a new instance of the system.multistaticresourcecalloutmock class. multistaticresourcecalloutmock() creates a new instance of the system.multistaticresourcecalloutmock class. signature public multistaticresourcecalloutmock() multistaticresourcecalloutmock methods the following are methods for multistaticresourcecalloutmock. all are instance methods. in this section: setheader(headername, headervalue) sets the specified header name and value for the fake response. setstaticresource(endpoint, resourcename) sets the specified static resource corresponding to the endpoint. the static resource contains the response body. setstatus(httpstatus) sets the specified http status for the response. setstatuscode(httpstatuscode) sets the specified http status code for the response. setheader(headername, headervalue) sets the specified header name and value for the fake response. signature public void setheader(string headername, string headervalue) parameters headername type: string headervalue type: string return value type: void 3203apex reference guide multistaticresourcecalloutmock class setstaticresource(endpoint, resourcename) sets the specified static resource corresponding to the endpoint. the static resource contains the response body. signature public void setstaticresource(string endpoint, string resourcename) parameters endpoint type: string resourcename type: string return value type: void setstatus(httpstatus) sets the specified http status for the response. signature public void setstatus(string httpstatus) parameters httpstatus type: string return value type: void setstatuscode(httpstatuscode) sets the specified http status code for the response. signature public void setstatuscode(integer httpstatuscode) parameters httpstatuscode type: integer 3204apex reference guide network class return value type: void network class manage experience cloud sites. namespace system in this section: network constructors create an instance of the system.network class. network methods get the default landing page, login page, and self-registration page of a site. asynchronously create site users and records. get the login and logout urls for a site. get a user’s current site. map dashboards and insights reports. network constructors create an instance of the system.network class. the following are constructors for network. in this section: network() creates a new instance of the system.network class. network() creates a new instance of the system.network class. signature public network() network methods get the default landing page, login page, and self-registration page of a site. asynchronously create site users and records. get the login and logout urls for a site. get a user’s current site. map dashboards and insights reports. the following are methods for network. all methods are static. in this section: communitieslanding() returns a page reference to the default landing page for the experience cloud site. this is the first tab of the site. 3205apex reference guide network class createexternaluserasync(user, contact, account) asynchronously creates an experience cloud site user for the given account or contact and associates it with the site. this method processes" "requests in batches and then sends an email with login information to the user. createrecordasync(processtype, mbobject) asynchronously creates case, lead, and custom object records. this method collects record creation requests and processes them in batches. forwardtoauthpage(starturl) returns a page reference to the default login page. starturl is included as a query paremeter for where to redirect after a successful login. getloginurl(networkid) returns the absolute url of the login page used by the experience cloud site. getlogouturl(networkid) returns the absolute url of the logout page used by the experience cloud site. getnetworkid() returns the user’s current experience cloud site. getselfregurl(networkid) returns the absolute url of the self-registration page used by the experience cloud site. loadallpackagedefaultnetworkdashboardsettings() maps the dashboards from the salesforce communities management package onto each experience cloud site’s unconfigured dashboard settings. returns the number of settings it configures. loadallpackagedefaultnetworkpulsesettings() maps the insights reports from the salesforce communities management package onto each experience cloud site’s unconfigured insights settings. returns the number of settings it configures. communitieslanding() returns a page reference to the default landing page for the experience cloud site. this is the first tab of the site. signature public static string communitieslanding() return value type: pagereference usage if digital experiences isn’t enabled for the user’s org or the user is currently in the internal org, returns null. createexternaluserasync(user, contact, account) asynchronously creates an experience cloud site user for the given account or contact and associates it with the site. this method processes requests in batches and then sends an email with login information to the user. 3206apex reference guide network class signature public static string createexternaluserasync(sobject user, sobject contact, sobject account) parameters user type: sobject (optional) information required to create a user. contact type: sobject (optional) the contact you want to associate the user with. account type: sobject the account you want to associate the user with. return value type: string returns the uuid for the site user. createrecordasync(processtype, mbobject) asynchronously creates case, lead, and custom object records. this method collects record creation requests and processes them in batches. signature public static string createrecordasync(string processtype, sobject mbobject) parameters processtype type: string the process you use to create records. mbobject type: sobject the records created for objects. objects must be supported by the high-volume record creation. return value type: string returns the uuid for the record created. 3207apex reference guide network class forwardtoauthpage(starturl) returns a page reference to the default login page. starturl is included as a query paremeter for where to redirect after a successful login. signature public static pagereference forwardtoauthpage(string starturl) parameters starturl type: string return value type: pagereference usage if digital experiences isn’t enabled for the user’s org or the user is currently in the internal org, returns null. getloginurl(networkid) returns the absolute url of the login page used by the experience cloud site. signature public static string getloginurl(string networkid) parameters networkid type: string the id of the experience cloud site you’re retrieving this information for. return value type: string usage returns the full url for the lightning platform or experience builder page used as the login page in the experience cloud site. getlogouturl(networkid) returns the absolute url of the logout page used by the experience cloud site. signature public static string getlogouturl(string networkid) 3208apex reference guide network class parameters networkid type: string the id of the experience cloud site you’re retrieving this information for. return value type: string usage returns the full url for the lightning platform page, experience builder page, or web page used as the logout page in the experience cloud site. getnetworkid() returns the user’s current experience cloud site. signature public static string getnetworkid() return value type: string usage if digital experiences isn" "’t enabled for the user’s org or the user is currently in the internal org, returns null. getselfregurl(networkid) returns the absolute url of the self-registration page used by the experience cloud site. signature public static string getselfregurl(string networkid) parameters networkid type: string the id of the experience cloud site you’re retrieving this information for. return value type: string 3209apex reference guide orglimit class usage returns the full url for the lightning platform or experience builder page used as the self-registration page in the experience cloud site. loadallpackagedefaultnetworkdashboardsettings() maps the dashboards from the salesforce communities management package onto each experience cloud site’s unconfigured dashboard settings. returns the number of settings it configures. signature public static integer loadallpackagedefaultnetworkdashboardsettings() return value type: integer usage if digital experiences is enabled, and the salesforce communities management package is installed, maps the dashboards provided in the package onto each experience cloud site’s unconfigured dashboard settings. returns the number of settings it configures. this method is invoked automatically during site creation and package installation, but isn’t typically invoked manually. if digital experiences isn’t enabled for the user’s org or the user is in the internal org, returns 0. loadallpackagedefaultnetworkpulsesettings() maps the insights reports from the salesforce communities management package onto each experience cloud site’s unconfigured insights settings. returns the number of settings it configures. signature public static integer loadallpackagedefaultnetworkpulsesettings() return value type: integer usage if digital experiences is enabled, and the salesforce communities management package is installed, maps the insights reports provided in the package onto each experience cloud site’s unconfigured insights settings. returns the number of settings it configures. this method is invoked automatically during site creation and package installation, but isn’t typically invoked manually. if digital experiences isn’t enabled for the user’s org or the user is in the internal org, returns 0. orglimit class contains methods that provide the name, maximum value, and current value of an org limit. 3210apex reference guide orglimit class namespace system usage use the system.orglimits getall and getmap methods to obtain either a list or a map of all your org limits. to get details on each limit, use instance methods from system.orglimit. for comparison, the limits class returns apex governor limits and not salesforce api limits. note: limit values are updated asynchronously, in near-real-time. in this section: orglimit methods orglimit methods the following are methods for orglimit. in this section: getlimit() returns the maximum allowed limit value. getname() returns the limit’s name. getvalue() returns the limit usage value. tostring() returns the string representation of the org limit. getlimit() returns the maximum allowed limit value. signature public integer getlimit() return value type: integer example list limits = orglimits.getall(); for (system.orglimit alimit: limits) { system.debug('limit: ' + alimit.getname()); 3211apex reference guide orglimit class system.debug('max limit is: ' + alimit.getlimit()); } getname() returns the limit’s name. signature public string getname() return value type: string example list limits = orglimits.getall(); for (system.orglimit alimit: limits) { system.debug('limit: ' + alimit.getname()); system.debug('max limit is: ' + alimit.getlimit()); } getvalue() returns the limit usage value. signature public integer getvalue() return value type: integer example list limits = orglimits.getall(); for (system.orglimit alimit: limits) { system.debug('limit: ' + alimit.getname()); system.debug('usage value is: ' + alimit.getvalue()); } tostring() returns the string representation of the org limit. signature public string tostring() 3212apex reference guide orglimits class return value type" ": string string denoting the name, current consumption, and maximum value of the org limit. for example: orglimit[dailybulkapibatches: consumed 25 of 15000] orglimits class contains methods that provide a list or map of all orglimit instances for salesforce your org, such as soap api requests, bulk api requests, and streaming api limits. namespace system usage use the system.orglimits getall and getmap methods to obtain either a list or a map of all your org limits. to get details on each limit, use instance methods from system.orglimit. for comparison, the limits class returns apex governor limits and not salesforce api limits. note: limit values are updated asynchronously, in near-real-time. in this section: orglimits methods see also: rest api developer guide: limits orglimits methods the following are methods for orglimits. in this section: getall() returns a list of orglimit instances. getmap() returns a map of all orglimit instances with the limit name as key. getall() returns a list of orglimit instances. 3213apex reference guide pagereference class signature public static list getall() return value type: list getmap() returns a map of all orglimit instances with the limit name as key. signature public static map getmap() return value type: map example map limitsmap = orglimits.getmap(); system.orglimit apirequestslimit = limitsmap.get('dailyapirequests'); system.debug('limit name: ' + apirequestslimit.getname()); system.debug('usage value: ' + apirequestslimit.getvalue()); system.debug('maximum limit: ' + apirequestslimit.getlimit()); pagereference class a pagereference is a reference to an instantiation of a page. among other attributes, pagereferences consist of a url and a set of query parameter names and values. namespace system use a pagereference object: • to view or set query string parameters and values for a page • to navigate the user to a different page as the result of an action method instantiation in a custom controller or controller extension, you can refer to or instantiate a pagereference in one of the following ways: 3214apex reference guide pagereference class • page.existingpagename refers to a pagereference for a visualforce page that has already been saved in your organization. by referring to a page in this way, the platform recognizes that this controller or controller extension is dependent on the existence of the specified page and will prevent the page from being deleted while the controller or extension exists. • pagereference pageref = new pagereference('partialurl'); creates a pagereference to any page that is hosted on the lightning platform. for example, setting 'partialurl' to '/apex/helloworld' refers to the visualforce page located at http://mysalesforceinstance/apex/helloworld. likewise, setting 'partialurl' to '/' + 'recordid' refers to the detail page for the specified record. this syntax is less preferable for referencing other visualforce pages than page.existingpagename because the pagereference is constructed at runtime, rather than referenced at compile time. runtime references are not available to the referential integrity system. consequently, the platform doesn't recognize that this controller or controller extension is dependent on the existence of the specified page and won't issue an error message to prevent user deletion of the page. • pagereference pageref = new pagereference('fullurl'); creates a pagereference for an external url. for example: pagereference pageref = new pagereference('http://www.google.com'); you can also instantiate a pagereference object for the current page with the currentpage apexpages method. for example: pagereference pageref = apexpages.currentpage(); request headers the following table is a non-exhaustive list of headers that are set on requests. header description host the host name requested in the request url. this header is always set on lightning platform site requests and my domain requests. this header is optional on other requests when http/1.0 is used instead of http/1.1. referer the url that is either included or linked to the current request's url. this header is optional. user" "-agent the name, version, and extension support of the program that initiated this request, such as a web browser. this header is optional and can be overridden in most browsers to be a different value. therefore, this header should not be relied upon. ciphersuite if this header exists and has a non-blank value, this means that the request is using https. otherwise, the request is using http. the contents of a non-blank value are not defined by this api, and can be changed without notice. x-salesforce-sip the source ip address of the request. this header is always set on http and https requests that are initiated outside of salesforce's data centers. note: if a request passes through a content delivery network (cdn) or proxy server, the source ip address might be altered, and no longer the original client ip address. 3215apex reference guide pagereference class header description x-salesforce-forwarded-to the fully qualified domain name of the salesforce instance that is handling this request. this header is always set on http and https requests that are initiated outside of salesforce's data centers. example: retrieving query string parameters the following example shows how to use a pagereference object to retrieve a query string parameter in the current page url. in this example, the getaccount method references the id query string parameter: public with sharing class mycontroller { public account getaccount() { return [select id, name from account with security_enforced where id = :apexpages.currentpage().getparameters().get('id')]; } } the following page markup calls the getaccount method from the controller above: you are viewing the {!account.name} account. note: for this example to render properly, you must associate the visualforce page with a valid account record in the url. for example, if 001d000000irt53 is the account id, the resulting url should be: https://salesforce_instance/apex/myfirstpage?id=001d000000irt53 the getaccount method uses an embedded soql query to return the account specified by the id parameter in the url of the page. to access id, the getaccount method uses the apexpages namespace: • first the currentpage method returns the pagereference instance for the current page. pagereference returns a reference to a visualforce page, including its query string parameters. • using the page reference, use the getparameters method to return a map of the specified query string parameter names and values. • then a call to the get method specifying id returns the value of the id parameter itself. example: navigating to a new page as the result of an action method any action method in a custom controller or controller extension can return a pagereference object as the result of the method. if the redirect attribute on the pagereference is set to true, the user navigates to the url specified by the pagereference. the following example shows how this can be implemented with a save method. in this example, the pagereference returned by the save method redirects the user to the detail page for the account record that was just saved: public class mysecondcontroller { account account; public account getaccount() { if(account == null) account = new account(); return account; 3216apex reference guide pagereference class } public pagereference save() { // add the account to the database. insert account; // send the user to the detail page for the new account. pagereference acctpage = new apexpages.standardcontroller(account).view(); acctpage.setredirect(true); return acctpage; } } the following page markup calls the save method from the controller above. when a user clicks save, he or she is redirected to the detail page for the account just created: example: redirect users to a replacement experience cloud site the following example shows how to redirect a user attempting to access a retired feedback site to a self-service help site. if the redirect attribute is set to true on the pagereference for the feedback site, the user navigates to the url specified by the pagereference. the redirectcode attribute defines the redirection type for search engine optimization in public experience cloud sites. public class redirectcontroller { // redirect users to the self-service help site public pagereference redirect() { final pagereference target = new pagereference(site.getbasesecureurl() + '/sitelogin'); target.setredirect(true); // this is a permanent redirection target.setredirectcode(301); return target; } } the following example shows how to call the redirectcontroller class from the retired site page. 3217apex reference guide pagereference class in this section: pagereference constructors pagereference methods pagereference constructors the following are constructors for pagereference. in this section: pagereference(partialurl) creates a new instance of the pagereference class using the specified url. pagereference(record) generate a new instance of the pagereference class for the specified sobject record. pagereference(partialurl) creates a new instance of the pagereference class using the specified url. signature public pagereference(string partialurl) parameters partialurl type: string the partial url of a page hosted on the lightning platform or a full external url. the following are some examples of the partialurl parameter values: • /apex/helloworld: refers to the visualforce page located at http://mydomainname-packagename.vf.force.com/apex/helloworld. • /recordid: refers to the detail page of a specified record. • http://www.google.com: refers to an external url. pagereference(record) generate a new instance of the pagereference class for the specified sobject record. signature public pagereference(sobject record) parameters record type: sobject 3218apex reference guide pagereference class the sobject record that references the apexpage. the reference must be an apexpage. see also: visualforce developer guide: apex:page soap api developer guide: apexpage pagereference methods the following are methods for pagereference. all are instance methods. in this section: forresource(resourcename, path) create a pagereference for nested content inside a zip static resource, by name and path. forresource(resourcename) create a pagereference for a static resource, by name. getanchor() returns the name of the anchor referenced in the page’s url. that is, the part of the url after the hashtag (#). getcontent() returns the output of the page, as displayed to a user in a web browser. getcontentaspdf() returns the page in pdf, regardless of the component’s renderas attribute. getcookies() returns a map of cookie names and cookie objects, where the key is a string of the cookie name and the the value contains the cookie object with that name. getheaders() returns a map of the request headers, where the key string contains the name of the header, and the value string contains the value of the header. getparameters() returns a map of the query string parameters for the pagereference; both post and get parameters are included. the key string contains the name of the parameter, while the value string contains the value of the parameter. getredirect() returns the current value of the pagereference object's redirect attribute. getredirectcode() returns the http redirect code used when getredirect() is set to true for the pagereference object. geturl() returns the relative url associated with the pagereference when it was originally defined, including any query string parameters and anchors. setanchor(anchor) sets the url’s anchor reference to the specified string. setcookies(cookies) creates a list of cookie objects. used in conjunction with the cookie class. 3219apex reference guide pagereference class setredirect(redirect) sets the value of the pagereference" "object's redirect attribute. if set to true, a redirect is performed through a client side redirect. setredirectcode(redirectcode) sets the http redirect code to use for the pagereference object when setredirect(redirect) is set to true. forresource(resourcename, path) create a pagereference for nested content inside a zip static resource, by name and path. signature public static system.pagereference forresource(string resourcename, string path) parameters resourcename type: string the resource name path type: string the resource path return value type: system.pagereference forresource(resourcename) create a pagereference for a static resource, by name. signature public static system.pagereference forresource(string resourcename) parameters resourcename type: string the resource name return value type: system.pagereference getanchor() returns the name of the anchor referenced in the page’s url. that is, the part of the url after the hashtag (#). 3220apex reference guide pagereference class signature public string getanchor() return value type: string note: instances of pagereference returned by apexpages.currentpage() have a null anchor attribute, because url fragments are not sent to the salesforce server during a request. getcontent() returns the output of the page, as displayed to a user in a web browser. signature public blob getcontent() return value type: blob usage the content of the returned blob depends on how the page is rendered. if the page is rendered as a pdf file, it returns the pdf document. if the page is not rendered as pdf, it returns html. to access the content of the returned html as a string, use the tostring blob method. note: if you use getcontent in a test method, the test method fails. getcontent is treated as a callout in api version 34.0 and later. this method can’t be used in: • triggers • test methods • apex email services if the visualforce page has an error, an executionexception is thrown. getcontentaspdf() returns the page in pdf, regardless of the component’s renderas attribute. signature public blob getcontentaspdf() return value type: blob 3221apex reference guide pagereference class usage note: if you use getcontentaspdf in a test method, the test method fails. getcontentaspdf is treated as a callout in api version 34.0 and later. this method can’t be used in: • triggers • test methods • apex email services getcookies() returns a map of cookie names and cookie objects, where the key is a string of the cookie name and the the value contains the cookie object with that name. signature public map getcookies() return value type: map usage used in conjunction with the cookie class. only returns cookies with the “apex__” prefix set by the setcookies method. getheaders() returns a map of the request headers, where the key string contains the name of the header, and the value string contains the value of the header. signature public map getheaders() return value type: map usage this map can be modified and remains in scope for the pagereference object. for instance, you could do: pagereference.getheaders().put('date', '9/9/99'); for a description of request headers, see request headers. getparameters() returns a map of the query string parameters for the pagereference; both post and get parameters are included. the key string contains the name of the parameter, while the value string contains the value of the parameter. 3222apex reference guide pagereference class signature public map getparameters() return value type: map usage this map can be modified and remains in scope for the pagereference object. for instance, you could do: pagereference.getparameters().put('id', myid); parameter keys are case-insensitive. for example: system.assert( apexpages.currentpage().getparameters().get('myparamname') == apexpages.currentpage().getparameters().get('myparamname')); getredirect() returns" "the current value of the pagereference object's redirect attribute. signature public boolean getredirect() return value type: boolean usage note that if the url of the pagereference object is set to a website outside of the salesforce.com domain, the redirect always occurs, regardless of whether the redirect attribute is set to true or false. getredirectcode() returns the http redirect code used when getredirect() is set to true for the pagereference object. signature public integer getredirectcode() return value type: integer possible values: • 0 — redirect using the default redirect action for this pagereference. typically a javascript-based redirection or http 302. 3223apex reference guide pagereference class note: site urlrewirter interface implementations pointing to a pagereference with a redirectcode of 0 are not redirected. • 301 — moved permanently. redirect users by sending an http get request to the target location. includes instructions to update any references to the requested url with the target location. • 302 — moved temporarily. redirect users by sending an http get request to the target location. because the redirection is temporary, it doesn’t include update instructions. • 303 — see other. redirect users by sending an http get request to the target location. not commonly used. useful when the client sends a post request and you want the client to call the new web page using a get request instead of a post request. • 307 — temporary redirect. send the same http request, regardless of the http method, to the target location. because the redirection is temporary, it doesn’t include update instructions. • 308 — permanent redirect. send the same http request, regardless of the http method, to the target location. includes instructions to update any references to the requested url with the target location. geturl() returns the relative url associated with the pagereference when it was originally defined, including any query string parameters and anchors. signature public string geturl() return value type: string setanchor(anchor) sets the url’s anchor reference to the specified string. signature public system.pagereference setanchor(string anchor) parameters anchor type: string return value type: system.pagereference setcookies(cookies) creates a list of cookie objects. used in conjunction with the cookie class. 3224apex reference guide pagereference class signature public void setcookies(cookie[] cookies) parameters cookies type: system.cookie[] return value type: void usage important: • cookie names and values set in apex are url encoded, that is, characters such as @ are replaced with a percent sign and their hexadecimal representation. • the setcookies method adds the prefix “apex__” to the cookie names. • setting a cookie's value to null sends a cookie with an empty string value instead of setting an expired attribute. • after you create a cookie, the properties of the cookie can't be changed. • be careful when storing sensitive information in cookies. pages are cached regardless of a cookie value. if you use a cookie value to generate dynamic content, you should disable page caching. for more information, see configure site caching in salesforce help. setredirect(redirect) sets the value of the pagereference object's redirect attribute. if set to true, a redirect is performed through a client side redirect. signature public system.pagereference setredirect(boolean redirect) parameters redirect type: boolean return value type: system.pagereference usage this type of redirect performs an http get request, and flushes the view state, which uses post. if set to false, the redirect is a server-side forward that preserves the view state if and only if the target page uses the same controller and contains the proper subset of extensions used by the source page. 3225apex reference guide packaging class note that if the url of the pagereference object is set to a website outside of the salesforce.com domain, or to a page with a different controller or controller extension, the redirect always occurs, regardless of whether the redirect attribute is set to true or false. setredirectcode(redirectcode) sets the http redirect code to use for the pagereference object when setredirect(redirect) is set to true. signature public system.pagereference setredirectcode(integer redirectcode) parameters redirectcode type: integer valid values:" "• 0 — redirect using the default redirect action for this pagereference. typically a javascript-based redirection or http 302. note: site urlrewirter interface implementations pointing to a pagereference with a redirectcode of 0 are not redirected. • 301 — moved permanently. redirect users by sending an http get request to the target location. includes instructions to update any references to the requested url with the target location. • 302 — moved temporarily. redirect users by sending an http get request to the target location. because the redirection is temporary, it doesn’t include update instructions. • 303 — see other. redirect users by sending an http get request to the target location. not commonly used. useful when the client sends a post request and you want the client to call the new web page using a get request instead of a post request. • 307 — temporary redirect. send the same http request, regardless of the http method, to the target location. because the redirection is temporary, it doesn’t include update instructions. • 308 — permanent redirect. send the same http request, regardless of the http method, to the target location. includes instructions to update any references to the requested url with the target location. if the redirect code contains an invalid integer, an error message is displayed when pagereference is used by salesforce for redirection. return value type: system.pagereference packaging class contains a method for obtaining information about managed and unlocked packages. namespace system 3226apex reference guide pattern class usage in the context of a package, use the getcurrentpackageid method to retrieve the packageid. in this section: packaging methods packaging methods the following are methods for packaging. in this section: getcurrentpackageid() returns the context packageid in managed and unlocked packages. getcurrentpackageid() returns the context packageid in managed and unlocked packages. signature public string getcurrentpackageid() return value type: string usage for managed packages, this method can be combined with iscurrentuserlicensedforpackage(packageid) to retrieve the packageid at runtime. then, use packageid to confirm that the contextual user is licensed to use that managed package. pattern class represents a compiled representation of a regular expression. namespace system pattern methods the following are methods for pattern. in this section: compile(regexp) compiles the regular expression into a pattern object. 3227apex reference guide pattern class matcher(stringtomatch) creates a matcher object that matches the input string stringtomatch against this pattern object. matches(regexp, stringtomatch) compiles the regular expression regexp and tries to match it against the specified string. this method returns true if the specified string matches the regular expression, false otherwise. pattern() returns the regular expression from which this pattern object was compiled. quote(yourstring) returns a string that can be used to create a pattern that matches the string yourstring as if it were a literal pattern. split(regexp) returns a list that contains each substring of the string that matches this pattern. split(regexp, limit) returns a list that contains each substring of the string that is terminated either by the regular expression regexp that matches this pattern, or by the end of the string. compile(regexp) compiles the regular expression into a pattern object. signature public static pattern compile(string regexp) parameters regexp type: string return value type: system.pattern matcher(stringtomatch) creates a matcher object that matches the input string stringtomatch against this pattern object. signature public matcher matcher(string stringtomatch) parameters stringtomatch type: string return value type: matcher 3228apex reference guide pattern class matches(regexp, stringtomatch) compiles the regular expression regexp and tries to match it against the specified string. this method returns true if the specified string matches the regular expression, false otherwise. signature public static boolean matches(string regexp, string stringtomatch) parameters regexp type: string stringtomatch type: string return value type: boolean usage if a pattern is to be used multiple times, compiling it once and reusing it is more efficient than invoking this method each time. example note that the following code example: pattern.matches(regexp, input); produces the same result as this code example: pattern" ".compile(regex). matcher(input).matches(); pattern() returns the regular expression from which this pattern object was compiled. signature public string pattern() return value type: string quote(yourstring) returns a string that can be used to create a pattern that matches the string yourstring as if it were a literal pattern. 3229apex reference guide pattern class signature public static string quote(string yourstring) parameters yourstring type: string return value type: string usage metacharacters (such as $ or ^) and escape sequences in the input string are treated as literal characters with no special meaning. split(regexp) returns a list that contains each substring of the string that matches this pattern. signature public string[] split(string regexp) parameters regexp type: string return value type: string[] note: in api version 34.0 and earlier, a zero-width regexp value produces an empty list item at the beginning of the method’s output. usage the substrings are placed in the list in the order in which they occur in the string. if regexp does not match the pattern, the resulting list has just one element containing the original string. split(regexp, limit) returns a list that contains each substring of the string that is terminated either by the regular expression regexp that matches this pattern, or by the end of the string. signature public string[] split(string regexp, integer limit) 3230apex reference guide queueable interface parameters regexp type: string limit type: integer (optional) controls the number of times the pattern is applied and therefore affects the length of the list. • if limit is greater than zero: – the pattern is applied a maximum of (limit – 1) times. – the list’s length is no greater than limit. – the list’s last entry contains all input beyond the last matched delimiter. • if limit is non-positive, the pattern is applied as many times as possible, and the list can have any length. • if limit is zero, the pattern is applied as many times as possible, the list can have any length, and trailing empty strings are discarded. return value type: string[] note: in api version 34.0 and earlier, a zero-width regexp value produces an empty list item at the beginning of the method’s output. queueable interface enables the asynchronous execution of apex jobs that can be monitored. namespace system usage to execute apex as an asynchronous job, implement the queueable interface and add the processing logic in your implementation of the execute method. to implement the queueable interface, you must first declare a class with the implements keyword as follows: public class myqueueableclass implements queueable { next, your class must provide an implementation for the following method: public void execute(queueablecontext context) { // your code here } your class and method implementation must be declared as public or global. to submit your class for asynchronous execution, call the system.enqueuejob by passing it an instance of your class implementation of the queueable interface as follows: id jobid = system.enqueuejob(new myqueueableclass()); 3231apex reference guide queueable interface in this section: queueable methods queueable example implementation see also: apex developer guide: queueable apex queueable methods the following are methods for queueable. in this section: execute(context) executes the queueable job. execute(context) executes the queueable job. signature public void execute(queueablecontext context) parameters context type: queueablecontext contains the job id. return value type: void queueable example implementation this example is an implementation of the queueable interface. the execute method in this example inserts a new account. public class asyncexecutionexample implements queueable { public void execute(queueablecontext context) { account a = new account(name='acme',phone='(415) 555-1212'); insert a; } } to add this class as a job on the queue, call this method: id jobid = system.enqueuejob(new asyncexecutionexample()); 3232" "apex reference guide queueablecontext interface after you submit your queueable class for execution, the job is added to the queue and will be processed when system resources become available. you can monitor the status of your job programmatically by querying asyncapexjob or through the user interface in setup by entering apex jobs in the quick find box, then selecting apex jobs. to query information about your submitted job, perform a soql query on asyncapexjob by filtering on the job id that the system.enqueuejob method returns. this example uses the jobid variable that was obtained in the previous example. asyncapexjob jobinfo = [select status,numberoferrors from asyncapexjob where id=:jobid]; similar to future jobs, queueable jobs don’t process batches, and so the number of processed batches and the number of total batches are always zero. testing queueable jobs this example shows how to test the execution of a queueable job in a test method. a queueable job is an asynchronous process. to ensure that this process runs within the test method, the job is submitted to the queue between the test.starttest and test.stoptest block. the system executes all asynchronous processes started in a test method synchronously after the test.stoptest statement. next, the test method verifies the results of the queueable job by querying the account that the job created. @istest public class asyncexecutionexampletest { static testmethod void test1() { // starttest/stoptest block to force async processes // to run in the test. test.starttest(); system.enqueuejob(new asyncexecutionexample()); test.stoptest(); // validate that the job has run // by verifying that the record was created. // this query returns only the account created in test context by the // queueable class method. account acct = [select name,phone from account where name='acme' limit 1]; system.assertnotequals(null, acct); system.assertequals('(415) 555-1212', acct.phone); } } note: the id of a queueable apex job isn’t returned in test context—system.enqueuejob returns null in a running test. queueablecontext interface represents the parameter type of the execute() method in a class that implements the queueable interface and contains the job id. this interface is implemented internally by apex. namespace system 3233apex reference guide quickaction class queueablecontext methods the following are methods for queueablecontext. in this section: getjobid() returns the id of the submitted job that uses the queueable interface. getjobid() returns the id of the submitted job that uses the queueable interface. signature public id getjobid() return value type: id the id of the submitted job. quickaction class use apex to request and process actions on objects that allow custom fields, on objects that appear in a chatter feed, or on objects that are available globally. namespace system example in this sample, the trigger determines if the new contacts to be inserted are created by a quick action. if so, it sets the wherefrom__c custom field to a value that depends on whether the quick action is global or local to the contact. otherwise, if the inserted contacts don’t originate from a quick action, the wherefrom__c field is set to 'noaction'. trigger acctrig2 on contact (before insert) { for (contact c : trigger.new) { if (c.getquickactionname() == quickaction.createcontact) { c.wherefrom__c = 'globaactionl'; } else if (c.getquickactionname() == schema.account.quickaction.createcontact) { c.wherefrom__c = 'accountaction'; } else if (c.getquickactionname() == null) { c.wherefrom__c = 'noaction'; } else { system.assert(false); } } } 3234apex reference guide quickaction class this sample performs a global action—quickaction.createcontact–on the passed-in contact object. public id globalcreate(contact c) { quickaction.quickactionrequest req = new quickaction.quickactionrequest(); req.quickactionname = quickaction.createcontact; req.record = c; quickaction.quickactionresult res = quickaction.performquickaction(req); return c.id" "; } see also: quickactionrequest class quickactionresult class quickaction methods the following are methods for quickaction. all methods are static. in this section: describeavailablequickactions(parenttype) returns metadata information for the available quick actions of the provided parent object. describeavailablequickactions(sobjectnames) returns the metadata information for the provided quick actions. performquickaction(quickactionrequest) performs the quick action specified in the quick action request and returns the action result. performquickaction(quickactionrequest, allornothing) performs the quick action specified in the quick action request with the option for partial success, and returns the result. performquickactions(quickactionrequests) performs the quick actions specified in the quick action request list and returns action results. performquickactions(quickactionrequests, allornothing) performs the quick actions specified in the quick action request list with the option for partial success, and returns action results. describeavailablequickactions(parenttype) returns metadata information for the available quick actions of the provided parent object. signature public static list describeavailablequickactions(string parenttype) parameters parenttype type: string 3235apex reference guide quickaction class the parent object type. this can be an object type name ('account') or 'global' (meaning that this method is called at a global level and not an entity level). return value type: list the metadata information for the available quick actions of the parent object. example // called for account entity. list result1 = quickaction.describeavailablequickactions('account'); // called at global level, not entity level. list result2 = quickaction.describeavailablequickactions('global'); describeavailablequickactions(sobjectnames) returns the metadata information for the provided quick actions. signature public static list describeavailablequickactions(list sobjectnames) parameters sobjectnames type: list the names of the quick actions. the quick action name can contain the entity name if it is at the entity level ('account.quickcreatecontact'), or 'global' if used for the action at the global level ('global.createnewcontact'). return value type: list the metadata information for the provided quick actions. example // first 3 parameter values are for actions at the entity level. // last parameter is for an action at the global level. list result = quickaction.describequickactions(new list { 'account.quickcreatecontact', 'opportunity.update1', 'contact.create1', 'global.createnewcontact' }); 3236apex reference guide quickaction class performquickaction(quickactionrequest) performs the quick action specified in the quick action request and returns the action result. signature public static quickaction.quickactionresult performquickaction(quickaction.quickactionrequest quickactionrequest) parameters quickactionrequest type: quickaction.quickactionrequest return value type: quickaction.quickactionresult performquickaction(quickactionrequest, allornothing) performs the quick action specified in the quick action request with the option for partial success, and returns the result. signature public static quickaction.quickactionresult performquickaction(quickaction.quickactionrequest quickactionrequest, boolean allornothing) parameters quickactionrequest type: quickaction.quickactionrequest allornothing type: boolean specifies whether this operation allows partial success. if you specify false for this argument and a record fails, the remainder of the dml operation can still succeed. this method returns a result object that can be used to verify which records succeeded, which failed, and why. return value type: quickaction.quickactionresult performquickactions(quickactionrequests) performs the quick actions specified in the quick action request list and returns action results. signature public static list performquickactions(list quickactionrequests) 3237apex reference guide quiddity enum parameters" "quickactionrequests type: list return value type: list performquickactions(quickactionrequests, allornothing) performs the quick actions specified in the quick action request list with the option for partial success, and returns action results. signature public static list performquickactions(list quickactionrequests, boolean allornothing) parameters quickactionrequests type: list allornothing type: boolean specifies whether this operation allows partial success. if you specify false for this argument and a record fails, the remainder of the dml operation can still succeed. this method returns a result object that can be used to verify which records succeeded, which failed, and why. return value type: list quiddity enum specifies a quiddity value used by the methods in the system.request class enum values the following are the values of the system.quiddity enum. value description anonymous execution event is an anonymous apex block. aura execution event is an aura component. batch_acs execution event is an api query cursor driven batch apex. batch_apex execution event is a batch apex job. 3238apex reference guide remoteobjectcontroller value description batch_chunk_parallel execution event is chunks of a batch apex job running in parallel. batch_chunk_serial execution event is chunks of a batch apex job running in serial. bulk_api execution event is a bulk api request. commerce_integration execution event is an apex integration for b2b commerce. discoverable_login execution event is login discoverable login page used by external users to log in to an experience cloud site. function_callback execution event is a callback function. future execution event is a future method. inbound_email_service execution event is an apex inbound email service. invocable_action execution event is an invocable action. iot execution event is a salesforce iot apex integration service. platform_event_publish_callback execution event is an apex publish callback for platform events. post_install_script execution event is a managed package install or upgrade. queueable execution event is a queueable apex operation. quick_action execution event is a quick action. remote_action execution event is a remote action. rest execution event is an apex restful web service. runtest_async execution event is apex tests running asynchronously. runtest_deploy execution event is apex tests run during deployment. runtest_sync execution event is apex tests running synchronously. scheduled execution event is a scheduled apex job. soap execution event is an apex soap web service. synchronous execution event is a synchronous apex operation. transaction_finalizer_queueable execution event is a queueable job with transaction finalizers attached. vf execution event is triggered by a visualforce page. remoteobjectcontroller use remoteobjectcontroller to access the standard visualforce remote objects operations in your remote objects override methods. 3239apex reference guide remoteobjectcontroller namespace system usage remoteobjectcontroller is supported only for use within remote objects methods. see overriding default remote objects operations in the visualforce developer’s guide for examples of how to use remoteobjectcontroller with your visualforce pages. remoteobjectcontroller methods the following are methods for remoteobjectcontroller. all methods are static. in this section: create(type, fields) create a record in the database. del(type, recordids) delete records from the database. retrieve(type, fields, criteria) retrieve records from the database. updat(type, recordids, fields) update records in the database. create(type, fields) create a record in the database. signature public static map create(string type, map fields) parameters type type: string the sobject type on which create is being called. fields type: map the fields and values to set on the new record. return value type: map" " the return value is a map that represents the result of the remote objects operation. what is returned depends on the results of the call. 3240apex reference guide remoteobjectcontroller success a map that contains a single element with the id of the record created. for example, { id: 'recordid' }. failure a map that contains a single element with the error message for the overall operation. for example, { error: 'errormessage' }. del(type, recordids) delete records from the database. signature public static map del(string type, list recordids) parameters type type: string the sobject type on which delete is being called. recordids type: list the ids of the records to be deleted. return value type: map the return value is a map that represents the result of the remote objects operation. what is returned depends on how the method was called and the results of the call. single delete—success a map that contains a single element with the id of the record that was deleted. for example, { id: 'recordid' }. batch delete—success a map that contains a single element, an array of map elements. each element contains the id of a record that was deleted and an array of errors, if there were any, for that record’s individual delete. for example, { results: [ { id: 'recordid', errors: ['errormessage', ...]}, ...] }. single and batch delete—failure a map that contains a single element with the error message for the overall operation. for example, { error: 'errormessage' }. retrieve(type, fields, criteria) retrieve records from the database. signature public static map retrieve(string type, list fields, map criteria) 3241apex reference guide remoteobjectcontroller parameters type type: string the sobject type on which retrieve is being called. fields type: list the fields to retrieve for each record. criteria type: map the criteria to use when performing the query. return value type: map the return value is a map that represents the result of the remote objects operation. what is returned depends on the results of the call. success a map that contains the following elements. • records: an array of records that match the query conditions. • type: a string that indicates the type of the sobject that was retrieved. • size: the number of records in the response. failure a map that contains a single element with the error message for the overall operation. for example, { error: 'errormessage' }. updat(type, recordids, fields) update records in the database. signature public static map updat(string type, list recordids, map fields) parameters type type: string the sobject type on which update is being called. recordids type: list the ids of the records to be updated. fields type: map 3242apex reference guide request class the fields to update, and the value to update each field with. return value type: map the return value is a map that represents the result of the remote objects operation. what is returned depends on how the method was called and the results of the call. single update—success a map that contains a single element with the id of the record that was updated. for example, { id: 'recordid' }. batch update—success a map that contains a single element, an array of map elements. each element contains the id of the record updated and an array of errors, if there were any, for that record’s individual update. for example, { results: [ { id: 'recordid', errors: ['errormessage', ...]}, ...] }. single and batch update—failure a map that contains a single element with the error message for the overall operation. for example, { error: 'errormessage' }. request class contains methods to obtain the request id and quiddity value of the current salesforce request. namespace system usage use the request class to detect the current apex context at runtime. the" "methods in the request class obtain a unique request id and the quiddity value that represent the current apex execution type. these values can also be used to correlate with debug and event logs: • the request id is universally unique and present in the debug logs that are triggered by the request. • the request id and quiddity values are the same as in the event log files of the apex execution event type used in event monitoring. example this example code shows how to obtain current apex code context by retrieving the request id and quiddity value of the current request. //get info about the current request request reqinfo = request.getcurrent(); //get the identifier for this request, which is universally unique //same as requestid in splunk or request_id in event monitoring string currentrequestid = reqinfo.getrequestid(); //enum representing how apex is running. e.g. bulk_api vs lightning quiddity currenttype = reqinfo.getquiddity(); //use this with a switch statement, //instead of checking system.isfuture() || system.isqueueable() || ... 3243apex reference guide request class in this section: request methods request methods the following are methods for request. in this section: getcurrent() returns the current request object that contains the request id and quiddity value. getquiddity() returns the quiddity value of the current request object. getrequestid() returns the request id of the current request object. getcurrent() returns the current request object that contains the request id and quiddity value. signature public static system.request getcurrent() return value type: system.request getquiddity() returns the quiddity value of the current request object. signature public system.quiddity getquiddity() return value type: system.quiddity uses the values from the quiddity enum. this value identifies the type of execution event associated with the current request. getrequestid() returns the request id of the current request object. signature public string getrequestid() 3244apex reference guide resetpasswordresult class return value type: string resetpasswordresult class represents the result of a password reset. namespace system resetpasswordresult methods the following are instance methods for resetpasswordresult. in this section: getpassword() returns the password generated by the system.resetpassword method call. getpassword() returns the password generated by the system.resetpassword method call. signature public string getpassword() return value type: string restcontext class contains the restrequest and restresponse objects. namespace system usage use the system.restcontext class to access the restrequest and restresponse objects in your apex rest methods. 3245apex reference guide restcontext class sample the following example shows how to use restcontext to access the restrequest and restresponse objects in an apex rest method. @restresource(urlmapping='/myrestcontextexample/*') global with sharing class myrestcontextexample { @httpget global static account doget() { restrequest req = restcontext.request; restresponse res = restcontext.response; string accountid = req.requesturi.substring(req.requesturi.lastindexof('/')+1); account result = [select id, name, phone, website from account where id = :accountid]; return result; } } restcontext properties the following are properties for restcontext. in this section: request returns the restrequest for your apex rest method. response returns the restresponse for your apex rest method. request returns the restrequest for your apex rest method. signature public restrequest request {get; set;} property value type: system.restrequest response returns the restresponse for your apex rest method. signature public restresponse response {get; set;} 3246apex reference guide restrequest class property value type: system.restresponse restrequest class use the system.restrequest class to access and pass request data in a restful apex method. namespace system usage an apex restful web service method is defined using one of the rest annotations. for more information about apex restful web service, see exposing apex classes as rest web services. example: an apex class with rest annotated methods the following example shows you how to implement the apex rest api in apex. this class exposes three methods that each handle a different" "http request: get, delete, and post. you can call these annotated methods from a client by issuing http requests. @restresource(urlmapping='/account/*') global with sharing class myrestresource { @httpdelete global static void dodelete() { restrequest req = restcontext.request; restresponse res = restcontext.response; string accountid = req.requesturi.substring(req.requesturi.lastindexof('/')+1); account account = [select id from account where id = :accountid]; delete account; } @httpget global static account doget() { restrequest req = restcontext.request; restresponse res = restcontext.response; string accountid = req.requesturi.substring(req.requesturi.lastindexof('/')+1); account result = [select id, name, phone, website from account where id = :accountid]; return result; } @httppost global static string dopost(string name, string phone, string website) { account account = new account(); account.name = name; account.phone = phone; account.website = website; insert account; 3247apex reference guide restrequest class return account.id; } } in this section: restrequest constructors restrequest properties restrequest methods restrequest constructors the following are constructors for restrequest. in this section: restrequest() creates a new instance of the system.restrequest class. restrequest() creates a new instance of the system.restrequest class. signature public restrequest() restrequest properties the following are properties for restrequest. note: while the restrequest list and map properties are read-only, their contents are read-write. you can modify them by calling the collection methods directly or you can use of the associated restrequest methods shown in the previous table. in this section: headers returns the headers that are received by the request. httpmethod returns one of the supported http request methods. params returns the parameters that are received by the request. remoteaddress returns the ip address of the client making the request. requestbody returns or sets the body of the request. 3248apex reference guide restrequest class requesturi returns or sets everything after the host in the http request string. resourcepath returns the rest resource path for the request. headers returns the headers that are received by the request. signature public map headers {get; set;} property value type: map httpmethod returns one of the supported http request methods. signature public string httpmethod {get; set;} property value type: string possible values returned: • delete • get • head • patch • post • put params returns the parameters that are received by the request. signature public map params {get; set;} property value type: map 3249apex reference guide restrequest class remoteaddress returns the ip address of the client making the request. signature public string remoteaddress {get; set;} property value type: string requestbody returns or sets the body of the request. signature public blob requestbody {get; set;} property value type: blob usage if the apex method has no parameters, then apex rest copies the http request body into the restrequest.requestbody property. if there are parameters, then apex rest attempts to deserialize the data into those parameters and the data won't be deserialized into the restrequest.requestbody property. requesturi returns or sets everything after the host in the http request string. signature public string requesturi {get; set;} property value type: string example for example, if the request string is https://instance.salesforce.com/services/apexrest/account/ then the requesturi is /account/. resourcepath returns the rest resource path for the request. 3250apex reference guide restrequest class signature public string resourcepath {get; set;} property value type: string example for example, if the apex rest class defines a urlmapping of /myresource/*, the resourcepath property returns /services/apexrest/myresource/*. restrequest methods the following are methods for restrequest. all are instance methods. note: at runtime," "you typically don't need to add a header or parameter to the restrequest object because they are automatically deserialized into the corresponding properties. the following methods are intended for unit testing apex rest classes. you can use them to add header or parameter values to the restrequest object without having to recreate the rest method call. in this section: addheader(name, value) adds a header to the request header map in an apex test. addparameter(name, value) adds a parameter to the request params map in an apex test. addheader(name, value) adds a header to the request header map in an apex test. signature public void addheader(string name, string value) parameters name type: string value type: string return value type: void 3251apex reference guide restresponse class usage this method is intended for unit testing of apex rest classes. the following headers aren't allowed: • cookie • set-cookie • set-cookie2 • content-length • authorization if any of these headers are used, an apex exception is thrown. addparameter(name, value) adds a parameter to the request params map in an apex test. signature public void addparameter(string name, string value) parameters name type: string value type: string return value type: void usage this method is intended for unit testing of apex rest classes. restresponse class represents an object used to pass data from an apex restful web service method to an http response. namespace system usage use the system.restresponse class to pass response data from an apex restful web service method that is defined using one of the rest annotations. 3252apex reference guide restresponse class in this section: restresponse constructors restresponse properties restresponse methods restresponse constructors the following are constructors for restresponse. in this section: restresponse() creates a new instance of the system.restresponse class. restresponse() creates a new instance of the system.restresponse class. signature public restresponse() restresponse properties the following are properties for restresponse. note: while the restresponse list and map properties are read-only, their contents are read-write. you can modify them by calling the collection methods directly or you can use of the associated restresponse methods shown in the previous table. in this section: responsebody returns or sets the body of the response. headers returns the headers to be sent to the response. statuscode returns or sets the response status code. responsebody returns or sets the body of the response. signature public blob responsebody {get; set;} 3253apex reference guide restresponse class property value type: blob usage the response is either the serialized form of the method return value or it's the value of the responsebody property based on the following rules: • if the method returns void, then apex rest returns the response in the responsebody property. • if the method returns a value, then apex rest serializes the return value as the response. if the return value contains fields with null value, those fields are not serialized in the response. headers returns the headers to be sent to the response. signature public map headers {get; set;} property value type: map statuscode returns or sets the response status code. signature public integer statuscode {get; set;} property value type: integer status codes the following are valid response status codes. the status code is returned by the restresponse.statuscode property. note: if you set the restresponse.statuscode property to a value that's not listed in the table, then an http status of 500 is returned with the error message “invalid status code for http response: nnn” where nnn is the invalid status code value. status code description 200 ok 201 created 202 accepted 204 no_content 3254apex reference guide restresponse class status code description 206 partial_content 300 multiple_choices 301 moved_permanently 302 found 304 not_modified 400 bad_request 401 unauthorized 403 forbidden 404 not_found 405 method_not_allowed 406 not_acceptable 409 conflict 410 gone 412 precondition_failed 413 request_" "entity_too_large 414 request_uri_too_large 415 unsupported_media_type 417 expectation_failed 500 internal_server_error 503 server_unavailable restresponse methods the following are instance methods for restresponse. note: at runtime, you typically don't need to add a header to the restresponse object because it's automatically deserialized into the corresponding properties. the following methods are intended for unit testing apex rest classes. you can use them to add header or parameter values to the restrequest object without having to recreate the rest method call. in this section: addheader(name, value) adds a header to the response header map. 3255apex reference guide sandboxpostcopy interface addheader(name, value) adds a header to the response header map. signature public void addheader(string name, string value) parameters name type: string value type: string return value type: void usage the following headers aren't allowed: • cookie • set-cookie • set-cookie2 • content-length • authorization • header names that aren't rfc 7230 compliant if any of these headers are used, an apex exception is thrown. sandboxpostcopy interface to make your sandbox environment business ready, automate data manipulation or business logic tasks. extend this interface and add methods to perform post-copy tasks, then specify the class during sandbox creation. namespace system usage create an apex class that implements this interface. specify your class during sandbox creation. after your sandbox is created, the runapexclass(context) method in your class runs using the automated process user’s permissions. important: the sandboxpostcopy apex class is executed at the end of the sandbox copy using a special automated process user that isn’t visible within the org. this user doesn’t have access to all object and features; therefore, the apex script cannot access all objects and features. if the script fails, run the script after sandbox activation as a user with appropriate permissions. 3256apex reference guide sandboxpostcopy interface in this section: sandboxpostcopy methods sandboxpostcopy example implementation these examples show a simple implementation of the sandboxpostcopy interface and a test for that implementation. to test your sandboxpostcopy implementation, use the system.test.testsandboxpostcopyscript() method. see also: tooling api: sandboxinfo tooling api: sandboxinfo sandboxpostcopy methods the following method is for sandboxpostcopy. in this section: runapexclass(context) executes actions in a new sandbox to prepare it for use. for example, add logic to this method to create users, run sanitizing code on records, and perform other setup tasks. runapexclass(context) executes actions in a new sandbox to prepare it for use. for example, add logic to this method to create users, run sanitizing code on records, and perform other setup tasks. signature public void runapexclass(system.sandboxcontext context) parameters context type: system.sandboxcontext the org id, sandbox id, and sandbox name for your sandbox. to work with these values, reference context.organizationid(), context.sandboxid(), and context.sandboxname() in your code. return value type: void sandboxpostcopy example implementation these examples show a simple implementation of the sandboxpostcopy interface and a test for that implementation. to test your sandboxpostcopy implementation, use the system.test.testsandboxpostcopyscript() method. important: the sandboxpostcopy apex class is executed at the end of the sandbox copy using a special automated process user that isn’t visible within the org. this user doesn’t have access to all object and features; therefore, the apex script can’t access all objects and features. if the script fails, run the script after sandbox activation as a user with appropriate permissions. 3257apex reference guide sandboxpostcopy interface this example implements the system.sandboxpostcopy interface. global class preparemysandbox implements sandboxpostcopy { global preparemysandbox() { //implementations of sandboxpostcopy must have a no-arg constructor. //this constructor is used during the sandbox copy process. //you can also implement constructors with arguments, but be aware that //they won’t be used by the sandbox copy process (unless" "as part of the //no-arg constructor). this(some_args); } global preparemysandbox(string some_args) { //logic for constructor. } global void runapexclass(sandboxcontext context) { system.debug('org id: ' + context.organizationid()); system.debug('sandbox id: ' + context.sandboxid()); system.debug('sandbox name: ' + context.sandboxname()); // insert logic here to prepare the sandbox for use. } } the following example tests the implementation using the system.test.testsandboxpostcopyscript() method. this method takes four parameters: a reference to a class that implements the sandboxpostcopy interface, and the three fields on the context object that you pass to the runapexclass(context) method. an overload on the method takes an optional boolean parameter to indicate if the test should be performed as the automated process user. @istest class preparemysandboxtest { @istest static void testmysandboxprep() { // insert logic here to create records of the objects that the class you’re testing // manipulates. test.starttest(); //execute test script with runasautoprocuser set to true test.testsandboxpostcopyscript( new preparemysandbox(), userinfo.getorganizationid(), userinfo.getorganizationid(), userinfo.getorganizationname(), true); test.stoptest(); // insert assert statements here to check that the records you created above have // the values you expect. } } 3258apex reference guide schedulable interface for more information on testing, see testing apex. schedulable interface the class that implements this interface can be scheduled to run at different intervals. namespace system see also: apex developer guide: scheduler schedulable methods the following are methods for schedulable. in this section: execute(context) executes the scheduled apex job. execute(context) executes the scheduled apex job. signature public void execute(schedulablecontext context) parameters context type: system.schedulablecontext contains the job id. return value type: void schedulablecontext interface represents the parameter type of a method in a class that implements the schedulable interface and contains the scheduled job id. this interface is implemented internally by apex. 3259apex reference guide schema class namespace system see also: schedulable interface schedulablecontext methods the following are methods for schedulablecontext. in this section: gettriggerid() returns the id of the crontrigger scheduled job. gettriggerid() returns the id of the crontrigger scheduled job. signature public id gettriggerid() return value type: id schema class contains methods for obtaining schema describe information. namespace system schema methods the following are methods for schema. all methods are static. in this section: getglobaldescribe() returns a map of all sobject names (keys) to sobject tokens (values) for the standard and custom objects defined in your organization. describedatacategorygroups(sobjectnames) returns a list of the category groups associated with the specified objects. describesobjects(sobjecttypes) describes metadata (field list and object properties) for the specified sobject or array of sobjects. 3260apex reference guide schema class describesobjects(sobjecttypes, sobjectdescribeoptions) describes metadata such as field list and object properties for the specified list of sobjects. the default describe option for this method is sobjectdescribeoptions.deferred, which indicates lazy initialization of describe attributes on first use. describetabs() returns information about the standard and custom apps available to the running user. describedatacategorygroupstructures(pairs,topcategoriesonly) returns available category groups along with their data category structure for objects specified in the request. getglobaldescribe() returns a map of all sobject names (keys) to sobject tokens (values) for the standard and custom objects defined in your organization. signature public static map getglobaldescribe() return value type: map usage for more information on accessing sobjects, see accessing all sobjects. example map gd = schema.getglobaldescribe(); describedatacategorygroups(sobjectnames) returns a list of the category groups associated with the specified objects. signature public static list describedatacategorygroups(list sobjectnames) parameters sobjectnames type: list return value type: list 3261apex reference guide schema class usage you can specify one of the following sobject names: • knowledgearticleversion—to retrieve category groups associated with article types. • question—to retrieve category groups associated with questions. for more information and code examples using describedatacategorygroups, see accessing all data categories associated with an sobject. for additional information about articles and questions, see “work with articles and translations” in the salesforce online help. describesobjects(sobjecttypes) describes metadata (field list and object properties) for the specified sobject or array of sobjects. signature public static list describesobjects(list sobjecttypes) parameters sobjecttypes type: list the sobjecttypes argument is a list of sobject type names you want to describe. return value type: list usage this method is similar to the getdescribe method on the schema.sobjecttype token. unlike the getdescribe method, this method allows you to specify the sobject type dynamically and describe more than one sobject at a time. you can first call getglobaldescribe to retrieve a list of all objects for your organization, then iterate through the list and use describesobjects to obtain metadata about individual objects. example schema.describesobjectresult[] descresult = schema.describesobjects( new string[]{'account','contact'}); describesobjects(sobjecttypes, sobjectdescribeoptions) describes metadata such as field list and object properties for the specified list of sobjects. the default describe option for this method is sobjectdescribeoptions.deferred, which indicates lazy initialization of describe attributes on first use. 3262apex reference guide schema class signature public static list describesobjects(list sobjecttypes, object sobjectdescribeoptions) parameters sobjecttypes type: list the list of sobject types to describe. sobjectdescribeoptions type: object the effective describe option used for the sobject. return value type: list describetabs() returns information about the standard and custom apps available to the running user. signature public static list describetabs() return value type: list usage an app is a group of tabs that works as a unit to provide application functionality. for example, two of the standard salesforce apps are “sales” and “service.” the describetabs method returns the minimum required metadata that can be used to render apps in another user interface. typically, this call is used by partner applications to render salesforce data in another user interface, such as in a mobile or connected app. in the salesforce user interface, users have access to standard apps (and can also have access to custom apps) as listed in the salesforce app menu at the top of the page. selecting an app name in the menu allows the user to switch between the listed apps at any time. note: the “all tabs” tab isn’t included in the list of described tabs. example this example shows how to call the describetabs method. schema.describetabsetresult[] tabsetdesc = schema.describetabs(); 3263apex reference guide schema class this longer example shows how to obtain describe metadata information for the sales app. for each tab, the example gets describe information, such as the icon url, whether the tab is custom or not, and colors. the describe information is written to the debug output. // get tab set describes for each app list tabsetdesc = schema.describetabs(); // iterate through each tab set describe for each app" "and display the info for(describetabsetresult tsr : tabsetdesc) { string applabel = tsr.getlabel(); system.debug('label: ' + applabel); system.debug('logo url: ' + tsr.getlogourl()); system.debug('isselected: ' + tsr.isselected()); string ns = tsr.getnamespace(); if (ns == '') { system.debug('the ' + applabel + ' app has no namespace defined.'); } else { system.debug('namespace: ' + ns); } // display tab info for the sales app if (applabel == 'sales') { list tabdesc = tsr.gettabs(); system.debug('-- tab information for the sales app --'); for(schema.describetabresult tr : tabdesc) { system.debug('getlabel: ' + tr.getlabel()); system.debug('getcolors: ' + tr.getcolors()); system.debug('geticonurl: ' + tr.geticonurl()); system.debug('geticons: ' + tr.geticons()); system.debug('getminiiconurl: ' + tr.getminiiconurl()); system.debug('getsobjectname: ' + tr.getsobjectname()); system.debug('geturl: ' + tr.geturl()); system.debug('iscustom: ' + tr.iscustom()); } } } // example debug statement output // debug|label: sales // debug|logo url: https://mydomainname.my.salesforce.com/img/seasonlogos/2014_winter_aloha.png // debug|isselected: true // debug|the sales app has no namespace defined.// debug|-- tab information for the sales app -- // (this is an example debug output for the accounts tab.) // debug|getlabel: accounts // debug|getcolors: (schema.describecolorresult[getcolor=236fbd;getcontext=primary;gettheme=theme4;], // schema.describecolorresult[getcolor=236fbd;getcontext=primary;gettheme=theme3;], // schema.describecolorresult[getcolor=236fbd;getcontext=primary;gettheme=theme2;]) // debug|geticonurl: https://mydomainname.my.salesforce.com/img/icon/accounts32.png // debug|geticons: (schema.describeiconresult[getcontenttype=image/png;getheight=32;gettheme=theme3; 3264apex reference guide search class // geturl=https://mydomainname.my.salesforce.com/img/icon/accounts32.png;getwidth=32;], // schema.describeiconresult[getcontenttype=image/png;getheight=16;gettheme=theme3; // geturl=https://mydomainname.my.salesforce.com/img/icon/accounts16.png;getwidth=16;]) // debug|getminiiconurl: https://mydomainname.my.salesforce.com/img/icon/accounts16.png // debug|getsobjectname: account // debug|geturl: https://mydomainname.my.salesforce.com/001/o // debug|iscustom: false describedatacategorygroupstructures(pairs,topcategoriesonly) returns available category groups along with their data category structure for objects specified in the request. signature public static list describedatacategory groupstructures(list pairs,boolean topcategoriesonly) parameters pairs type: list the pairs argument is one or more category groups and objects to query schema.datacategorygroupsobjecttypepairs. visible data categories are retrieved for the specified object. for more information on data category group visibility, see “data category visibility” in salesforce help. topcategoriesonly type: boolean use true to return only the top visible category and false to return all the visible categories, depending on the user's data category group visibility settings. for more information on data category group visibility, see data category visibility" "in salesforce help. return value type: list search class use the methods of the search class to perform dynamic sosl queries. namespace system search methods the following are static methods for search. 3265apex reference guide search class in this section: find(searchquery) performs a dynamic sosl query that can include the sosl with snippet clause. snippets provide more context for users in salesforce knowledge article search results. find(searchquery, accesslevel) performs a dynamic sosl query that can include the sosl with snippet clause. snippets provide more context for users in salesforce knowledge article search results. query(query) performs a dynamic sosl query. query(query, accesslevel) performs a dynamic sosl query. suggest(searchquery, sobjecttype, suggestions) returns a list of records or salesforce knowledge articles whose names or titles match the user’s search query string. use this method to provide users with shortcuts to navigate to relevant records or articles before they perform a search. suggest(searchquery, sobjecttype, suggestions, accesslevel) returns a list of records or salesforce knowledge articles whose names or titles match the user’s search query string. use this method to provide users with shortcuts to navigate to relevant records or articles before they perform a search. find(searchquery) performs a dynamic sosl query that can include the sosl with snippet clause. snippets provide more context for users in salesforce knowledge article search results. signature public static search.searchresults find(string searchquery) parameters searchquery type: string a sosl query string. return value type: search.searchresults usage use this method wherever a static sosl query can be used, such as in regular assignment statements and for loops. see use dynamic sosl to return snippets. see also: get(sobjecttype) apex developer guide: dynamic sosl 3266apex reference guide search class find(searchquery, accesslevel) performs a dynamic sosl query that can include the sosl with snippet clause. snippets provide more context for users in salesforce knowledge article search results. signature public static search.searchresults find(string searchquery, system.accesslevel accesslevel) parameters searchquery type: string a sosl query string. accesslevel type: system.accesslevel (optional) the accesslevel parameter specifies whether the method runs in system mode (accesslevel.system_mode) or user mode (accesslevel.user_mode). in system mode, the object and field-level permissions of the current user are ignored, and the record sharing rules are controlled by the class sharing keywords. in user mode, the object permissions, field-level security, and sharing rules of the current user are enforced. system mode is the default. return value type: search.searchresults usage use this method wherever a static sosl query can be used, such as in regular assignment statements and for loops. see use dynamic sosl to return snippets. query(query) performs a dynamic sosl query. signature public static sobject[sobject[]] query(string query) parameters query type: string a sosl query string. to create a sosl query that includes the with snippet clause, use the search.find(string searchquery) method instead. return value type: sobject[sobject[]] 3267apex reference guide search class usage this method can be used wherever a static sosl query can be used, such as in regular assignment statements and for loops. for more information, see dynamic sosl. query(query, accesslevel) performs a dynamic sosl query. signature public static list> query(string query, system.accesslevel accesslevel) parameters query type: string a sosl query string. to create a sosl query that includes the with snippet clause, use the search.find(string searchquery) method instead. accesslevel type: system.accesslevel (optional) the accesslevel parameter specifies whether the method runs in system mode (accesslevel.system_mode) or user mode (accesslevel.user_mode). in system mode, the object and field-level permissions of the current user are ignored, and the record sharing rules are controlled by the class sharing keywords. in user mode, the object permissions, field-" "level security, and sharing rules of the current user are enforced. system mode is the default. return value type: sobject[sobject[]] usage this method can be used wherever a static sosl query can be used, such as in regular assignment statements and for loops. for more information, see dynamic sosl. suggest(searchquery, sobjecttype, suggestions) returns a list of records or salesforce knowledge articles whose names or titles match the user’s search query string. use this method to provide users with shortcuts to navigate to relevant records or articles before they perform a search. signature public static search.suggestionresults suggest(string searchquery, string sobjecttype, search.suggestionoption suggestions) parameters searchquery type: string 3268apex reference guide search class a sosl query string. sobjecttype type: string an sobject type. options type: search.suggestionoption this object contains options that change the suggestion results. if the searchquery returns knowledgearticleversion objects, pass an options parameter with a search.suggestionoption object that contains a language knowledgesuggestionfilter and a publish status knowledgesuggestionfilter. for suggestions for all other record types, the only supported option is a limit, which sets the maximum number of suggestions returned. return value type: suggestionresults usage use this method to return: suggestions for salesforce knowledge articles (knowledgearticleversion) salesforce knowledge must be enabled in your organization. the user must have the “view articles” permission enabled. the articles suggested include only the articles the user can access, based on the data categories and article types the user has permissions to view. suggestions for other record types the records suggested include only the records the user can access. this method returns a record if its name field starts with the text in the search string. this method automatically appends an asterisk wildcard (*) at the end of the search string. records that contain the search string within a word aren’t considered a match. records are suggested if the entire search string is found in the record name, in the same order as specified in the search string. for example, the text string national u is treated as national u* and returns “national utility” and “national urban company” but not “national company utility” or “urban national company”. note: if the user’s search query contains quotation marks or wildcards, those symbols are automatically removed from the query string in the uri. see also: apex developer guide: suggest salesforce knowledge articles suggest(searchquery, sobjecttype, suggestions, accesslevel) returns a list of records or salesforce knowledge articles whose names or titles match the user’s search query string. use this method to provide users with shortcuts to navigate to relevant records or articles before they perform a search. signature public static search.suggestionresults suggest(string searchquery, string sobjecttype, search.suggestionoption suggestions, system.accesslevel accesslevel) 3269apex reference guide search class parameters searchquery type: string a sosl query string. sobjecttype type: string an sobject type. suggestions type: search.suggestionoption this object contains options that change the suggestion results. if the searchquery returns knowledgearticleversion objects, pass an options parameter with a search.suggestionoption object that contains a language knowledgesuggestionfilter and a publish status knowledgesuggestionfilter. for suggestions for all other record types, the only supported option is a limit, which sets the maximum number of suggestions returned. accesslevel type: system.accesslevel (optional) the accesslevel parameter specifies whether the method runs in system mode (accesslevel.system_mode) or user mode (accesslevel.user_mode). in system mode, the object and field-level permissions of the current user are ignored, and the record sharing rules are controlled by the class sharing keywords. in user mode, the object permissions, field-level security, and sharing rules of the current user are enforced. system mode is the default. return value type: suggestionresults usage use this method to return: suggestions for salesforce knowledge articles (knowledgearticleversion) salesforce knowledge must be enabled in your organization. the user must have the “view articles” permission enabled. the articles suggested include only the articles the user can access, based on the data categories and article types the user has permissions to view. suggestions for other record types the records suggested include only the records the user can access" ". this method returns a record if its name field starts with the text in the search string. this method automatically appends an asterisk wildcard (*) at the end of the search string. records that contain the search string within a word aren’t considered a match. records are suggested if the entire search string is found in the record name, in the same order as specified in the search string. for example, the text string national u is treated as national u* and returns “national utility” and “national urban company” but not “national company utility” or “urban national company”. note: if the user’s search query contains quotation marks or wildcards, those symbols are automatically removed from the query string in the uri. 3270apex reference guide security class security class contains methods to securely implement apex applications. namespace system usage in the context of the current user’s create, read, update, or upsert access permission, use the security class methods to: • strip fields that aren’t visible from query and subquery results • remove inaccessible fields before a dml operation without causing an exception • sanitize sobjects that have been deserialized from an untrusted source in this section: security methods security methods the following are methods for security. in this section: stripinaccessible(accesschecktype, sourcerecords, enforcerootobjectcrud) creates a list of sobjects from the source records, which are stripped of fields that fail the field-level security checks for the current user. the method also provides an option to enforce an object-level access check. stripinaccessible(accesschecktype, sourcerecords) creates a list of sobjects from the source records, which are stripped of fields that fail the field-level security checks for the current user. stripinaccessible(accesschecktype, sourcerecords, enforcerootobjectcrud) creates a list of sobjects from the source records, which are stripped of fields that fail the field-level security checks for the current user. the method also provides an option to enforce an object-level access check. signature public static system.sobjectaccessdecision stripinaccessible(system.accesstype accesschecktype, list sourcerecords, boolean enforcerootobjectcrud) parameters accesschecktype type: system.accesstype 3271apex reference guide security class uses values from the accesstype enum. this parameter determines the type of field-level access check to be performed. to check the current user's field-level access, use the schema.describefieldresult methods —iscreatable(), isaccessible(), or isupdatable(). sourcerecords type: list a list of sobjects to be checked for fields that aren’t accessible in the context of the current user’s operation. enforcerootobjectcrud type: boolean indicates whether an object-level access check is performed. if this parameter is set to true and the access check fails, the method throws an exception. the default value of this optional parameter is true. return value type: system.sobjectaccessdecision example in this example, the user doesn’t have permission to create the probability field of an opportunity. list opportunities = new list{ new opportunity(name='opportunity1'), new opportunity(name='opportunity2', probability=95) }; // strip fields that are not creatable sobjectaccessdecision decision = security.stripinaccessible( accesstype.creatable, opportunities); // print stripped records for (sobject strippedopportunity : decision.getrecords()) { system.debug(strippedopportunity); } // print modified indexes system.debug(decision.getmodifiedindexes()); // print removed fields system.debug(decision.getremovedfields()); //lines from output log //|debug|opportunity:{name=opportunity1} //|debug|opportunity:{name=opportunity2} //|debug|{1} //|debug|{opportunity={probability}} stripinaccessible(accesschecktype, sourcerecords) creates a list of sobjects from the source records, which are stripped of fields that fail the field-level security checks for the current user. 3272apex reference guide security class signature public static system.sobjectaccess" "decision stripinaccessible(system.accesstype accesschecktype, list sourcerecords) parameters accesschecktype type: system.accesstype uses values from the accesstype enum. this parameter determines the type of field-level access check to be performed. to check the current user's field-level access, use the schema.describefieldresult methods —iscreatable(), isaccessible(), or isupdatable(). sourcerecords type: list a list of sobjects to be checked for fields that aren’t accessible in the context of the current user’s operation. return value type: system.sobjectaccessdecision example in this example, the user doesn’t have permission to read the actualcost field of a campaign. list campaigns = new list{ new campaign(name='campaign1', budgetedcost=1000, actualcost=2000), new campaign(name='campaign2', budgetedcost=4000, actualcost=1500) }; insert campaigns; // strip fields that are not readable sobjectaccessdecision decision = security.stripinaccessible( accesstype.readable, [select name, budgetedcost, actualcost from campaign]); // print stripped records for (sobject strippedcampaign : decision.getrecords()) { system.debug(strippedcampaign); // does not display actualcost } // print modified indexes system.debug(decision.getmodifiedindexes()); // print removed fields system.debug(decision.getremovedfields()); //lines from output log //|debug|campaign:{name=campaign1, budgetedcost=1000, id=701xx00000011nhaaa} //|debug|campaign:{name=campaign2, budgetedcost=4000, id=701xx00000011niaaa} //|debug|{0, 1} //|debug|{campaign={actualcost}} 3273apex reference guide selectoption class selectoption class a selectoption object specifies one of the possible values for a visualforce selectcheckboxes, selectlist, or selectradio component. namespace system selectoption consists of a label that is displayed to the end user, and a value that is returned to the controller if the option is selected. a selectoption can also be displayed in a disabled state, so that a user cannot select it as an option, but can still view it. instantiation in a custom controller or controller extension, you can instantiate a selectoption in one of the following ways: • selectoption option = new selectoption(value, label, isdisabled); where value is the string that is returned to the controller if the option is selected by a user, label is the string that is displayed to the user as the option choice, and isdisabled is a boolean that, if true, specifies that the user cannot select the option, but can still view it. • selectoption option = new selectoption(value, label); where value is the string that is returned to the controller if the option is selected by a user, and label is the string that is displayed to the user as the option choice. because a value for isdisabled is not specified, the user can both view and select the option. example the following example shows how a list of selectoptions objects can be used to provide possible values for a selectcheckboxes component on a visualforce page. in the following custom controller, the getitems method defines and returns the list of possible selectoption objects: public class samplecon { string[] countries = new string[]{}; public pagereference test() { return null; } public list getitems() { list options = new list(); options.add(new selectoption('us','us')); options.add(new selectoption('canada','canada')); options.add(new selectoption('mexico','mexico')); return options; } public string[] getcountries() { return countries; } 3274apex reference guide selectoption class public void setcountries(string[] countries) { this.countries = countries; } } in the following page markup, the tag uses the getitems method from the controller above to retrieve the list of possible values. because is a child of the tag, the options are displayed as checkboxes:

you have selected:

{!c}
in this section: selectoption constructors selectoption methods selectoption constructors the following are constructors for selectoption. in this section: selectoption(value, label) creates a new instance of the selectoption class using the specified value and label. selectoption(value, label, isdisabled) creates a new instance of the selectoption class using the specified value, label, and disabled setting. selectoption(value, label) creates a new instance of the selectoption class using the specified value and label. 3275apex reference guide selectoption class signature public selectoption(string value, string label) parameters value type: string the string that is returned to the visualforce controller if the option is selected by a user. label type: string the string that is displayed to the user as the option choice. selectoption(value, label, isdisabled) creates a new instance of the selectoption class using the specified value, label, and disabled setting. signature public selectoption(string value, string label, boolean isdisabled) parameters value type: string the string that is returned to the visualforce controller if the option is selected by a user. label type: string the string that is displayed to the user as the option choice. isdisabled type: boolean if set to true, the option can’t be selected by the user but can still be viewed. selectoption methods the following are methods for selectoption. all are instance methods. in this section: getdisabled() returns the current value of the selectoption object's isdisabled attribute. getescapeitem() returns the current value of the selectoption object's itemescaped attribute. getlabel() returns the option label that is displayed to the user. 3276apex reference guide selectoption class getvalue() returns the option value that is returned to the controller if a user selects the option. setdisabled(isdisabled) sets the value of the selectoption object's isdisabled attribute. setescapeitem(itemsescaped) sets the value of the selectoption object's itemescaped attribute. setlabel(label) sets the value of the option label that is displayed to the user. setvalue(value) sets the value of the option value that is returned to the controller if a user selects the option. getdisabled() returns the current value of the selectoption object's isdisabled attribute. signature public boolean getdisabled() return value type: boolean usage if isdisabled is set to true, the user can view the option, but cannot select it. if isdisabled is set to false, the user can both view and select the option. getescapeitem() returns the current value of the selectoption object's itemescaped attribute. signature public boolean getescapeitem() return value type: boolean usage if itemescaped is set to true, sensitive html and xml characters are escaped in the html output generated by this component. if itemescaped is set to false, items are rendered as written. getlabel() returns the option label that is displayed to the user. 3277apex reference guide selectoption class signature public string getlabel() return value type: string getvalue() returns the option value that is returned to the controller if a user selects the option. signature public string getvalue() return value type: string setdisabled(isdisabled) sets the value of the selectoption object's isdisabled attribute. signature public void setdisabled(boo" "lean isdisabled) parameters isdisabled type: boolean return value type: void usage if isdisabled is set to true, the user can view the option, but cannot select it. if isdisabled is set to false, the user can both view and select the option. setescapeitem(itemsescaped) sets the value of the selectoption object's itemescaped attribute. signature public void setescapeitem(boolean itemsescaped) 3278apex reference guide set class parameters itemsescaped type: boolean return value type: void usage if itemescaped is set to true, sensitive html and xml characters are escaped in the html output generated by this component. if itemescaped is set to false, items are rendered as written. setlabel(label) sets the value of the option label that is displayed to the user. signature public void setlabel(string label) parameters label type: string return value type: void setvalue(value) sets the value of the option value that is returned to the controller if a user selects the option. signature public void setvalue(string value) parameters value type: string return value type: void set class represents a collection of unique elements with no duplicate values. 3279apex reference guide set class namespace system usage the set methods work on a set, that is, an unordered collection of elements that was initialized using the set keyword. set elements can be of any data type—primitive types, collections, sobjects, user-defined types, and built-in apex types. set methods are all instance methods, that is, they all operate on a particular instance of a set. the following are the instance methods for sets. note: • uniqueness of set elements of user-defined types is determined by the equals and hashcode methods, which you provide in your classes. uniqueness of all other non-primitive types is determined by comparing the objects’ fields. • if the set contains string elements, the elements are case-sensitive. two set elements that differ only by case are considered distinct. for more information on sets, see sets. in this section: set constructors set methods set constructors the following are constructors for set. in this section: set() creates a new instance of the set class. a set can hold elements of any data type t. set(settocopy) creates a new instance of the set class by copying the elements of the specified set. t is the data type of the elements in both sets and can be any data type. set(listtocopy) creates a new instance of the set class by copying the list elements. t is the data type of the elements in the set and list and can be any data type. set() creates a new instance of the set class. a set can hold elements of any data type t. signature public set() 3280apex reference guide set class example // create a set of strings set s1 = new set(); // add two strings to it s1.add('item1'); s1.add('item2'); set(settocopy) creates a new instance of the set class by copying the elements of the specified set. t is the data type of the elements in both sets and can be any data type. signature public set(set settocopy) parameters settocopy type: set the set to initialize this set with. example set s1 = new set(); s1.add('item1'); s1.add('item2'); set s2 = new set(s1); // the set elements in s2 are copied from s1 system.debug(s2); set(listtocopy) creates a new instance of the set class by copying the list elements. t is the data type of the elements in the set and list and can be any data type. signature public set(list listtocopy) parameters listtocopy type: integer the list to copy the elements of into this set. 3281apex reference guide set class example list ls = new list(); ls.add(1); ls.add(2" "); // create a set based on a list set s1 = new set(ls); // elements are copied from the list to this set system.debug(s1);// debug|{1, 2} set methods the following are methods for set. all are instance methods. in this section: add(setelement) adds an element to the set if it is not already present. addall(fromlist) adds all of the elements in the specified list to the set if they are not already present. addall(fromset) adds all of the elements in the specified set to the set that calls the method if they are not already present. clear() removes all of the elements from the set. clone() makes a duplicate copy of the set. contains(setelement) returns true if the set contains the specified element. containsall(listtocompare) returns true if the set contains all of the elements in the specified list. the list must be of the same type as the set that calls the method. containsall(settocompare) returns true if the set contains all of the elements in the specified set. the specified set must be of the same type as the original set that calls the method. equals(set2) compares this set with the specified set and returns true if both sets are equal; otherwise, returns false. hashcode() returns the hashcode corresponding to this set and its contents. isempty() returns true if the set has zero elements. remove(setelement) removes the specified element from the set if it is present. removeall(listofelementstoremove) removes the elements in the specified list from the set if they are present. 3282" "apex reference guide set class removeall(setofelementstoremove) removes the elements in the specified set from the original set if they are present. retainall(listofelementstoretain) retains only the elements in this set that are contained in the specified list. retainall(setofelementstoretain) retains only the elements in the original set that are contained in the specified set. size() returns the number of elements in the set (its cardinality). tostring() returns the string representation of the set. add(setelement) adds an element to the set if it is not already present. signature public boolean add(object setelement) parameters setelement type: object return value type: boolean usage this method returns true if the original set changed as a result of the call. for example: set mystring = new set{'a', 'b', 'c'}; boolean result = mystring.add('d'); system.assertequals(true, result); addall(fromlist) adds all of the elements in the specified list to the set if they are not already present. signature public boolean addall(list fromlist) parameters fromlist type: list 3283apex reference guide set class return value type: boolean returns true if the original set changed as a result of the call. usage this method results in the union of the list and the set. the list must be of the same type as the set that calls the method. addall(fromset) adds all of the elements in the specified set to the set that calls the method if they are not already present. signature public boolean addall(set fromset) parameters fromset type: set return value type: boolean this method returns true if the original set changed as a result of the call. usage this method results in the union of the two sets. the specified set must be of the same type as the original set that calls the method. example set mystring = new set{'a', 'b'}; set sstring = new set{'c'}; boolean result1 = mystring.addall(sstring); system.assertequals(true, result1); clear() removes all of the elements from the set. signature public void clear() return value type: void 3284apex reference guide set class clone() makes a duplicate copy of the set. signature public set clone() return value type: set (of same type) contains(setelement) returns true if the set contains the specified element. signature public boolean contains(object setelement) parameters setelement type: object return value type: boolean example set mystring = new set{'a', 'b'}; boolean result = mystring.contains('z'); system.assertequals(false, result); containsall(listtocompare) returns true if the set contains all of the elements in the specified list. the list must be of the same type as the set that calls the method. signature public boolean containsall(list listtocompare) parameters listtocompare type: list return value type: boolean 3285apex reference guide set class containsall(settocompare) returns true if the set contains all of the elements in the specified set. the specified set must be of the same type as the original set that calls the method. signature public boolean containsall(set settocompare) parameters settocompare type: set return value type: boolean example set mystring = new set{'a', 'b'}; set sstring = new set{'c'}; set rstring = new set{'a', 'b', 'c'}; boolean result1, result2; result1 = mystring.addall(sstring); system.assertequals(true, result1); result2 = mystring.containsall(rstring); system.assertequals(true, result2); equals(set2) compares this set with the specified set and returns true if both sets are" "equal; otherwise, returns false. signature public boolean equals(set set2) parameters set2 type: set the set2 argument is the set to compare this set with. return value type: boolean 3286apex reference guide set class usage two sets are equal if their elements are equal, regardless of their order. the == operator is used to compare the elements of the sets. the == operator is equivalent to calling the equals method, so you can call set1.equals(set2); instead of set1 == set2;. hashcode() returns the hashcode corresponding to this set and its contents. signature public integer hashcode() return value type: integer isempty() returns true if the set has zero elements. signature public boolean isempty() return value type: boolean example set myset = new set(); boolean result = myset.isempty(); system.assertequals(true, result); remove(setelement) removes the specified element from the set if it is present. signature public boolean remove(object setelement) parameters setelement type: object 3287apex reference guide set class return value type: boolean returns true if the original set changed as a result of the call. removeall(listofelementstoremove) removes the elements in the specified list from the set if they are present. signature public boolean removeall(list listofelementstoremove) parameters listofelementstoremove type: list return value type: boolean returns true if the original set changed as a result of the call. usage this method results in the relative complement of the two sets. the list must be of the same type as the set that calls the method. example set myset = new set{1, 2, 3}; list mylist = new list{1, 3}; boolean result = myset.removeall(mylist); system.assertequals(true, result); integer result2 = myset.size(); system.assertequals(1, result2); removeall(setofelementstoremove) removes the elements in the specified set from the original set if they are present. signature public boolean removeall(set setofelementstoremove) parameters setofelementstoremove type: set 3288apex reference guide set class return value type: boolean this method returns true if the original set changed as a result of the call. usage this method results in the relative complement of the two sets. the specified set must be of the same type as the original set that calls the method. retainall(listofelementstoretain) retains only the elements in this set that are contained in the specified list. signature public boolean retainall(list listofelementstoretain) parameters listofelementstoretain type: list return value type: boolean this method returns true if the original set changed as a result of the call. usage this method results in the intersection of the list and the set. the list must be of the same type as the set that calls the method. example set myset = new set{1, 2, 3}; list mylist = new list{1, 3}; boolean result = myset.retainall(mylist); system.assertequals(true, result); retainall(setofelementstoretain) retains only the elements in the original set that are contained in the specified set. signature public boolean retainall(set setofelementstoretain) 3289apex reference guide set class parameters setofelementstoretain type: set return value type: boolean returns true if the original set changed as a result of the call. usage this method results in the intersection of the two sets. the specified set must be of the same type as the original set that calls the method. size() returns the number of elements in the set (its cardinality). signature public integer size() return value type: integer example set myset = new set{1, 2, 3}; list mylist = new list{1" ", 3}; boolean result = myset.retainall(mylist); system.assertequals(true, result); integer result2 = myset.size(); system.assertequals(2, result2); tostring() returns the string representation of the set. signature public string tostring() return value type: string 3290apex reference guide site class usage when used in cyclic references, the output is truncated to prevent infinite recursion. when used with large collections, the output is truncated to avoid exceeding total heap size and maximum cpu time. • up to 10 items per collection are included in the output, followed by an ellipsis (…). • if the same object is included multiple times in a collection, it’s shown in the output only once; subsequent references are shown as (already output). site class use the site class to manage your sites. change, reset, validate, and check the expiration of passwords. create site users, person accounts, and portal users. get the admin email and id. get various urls, the path prefix, the id, the template, and the type of the site. log in to the site. namespace system site methods the following are methods for site. all methods are static. in this section: changepassword(newpassword, verifynewpassword, oldpassword) changes the password of the current user. createexternaluser(user, accountid) creates a salesforce site or experience cloud site user for the given account and associates it with the site. createexternaluser(user, accountid, password) creates a salesforce site or experience cloud site user for the given account and associates it with the site. this method sends an email with the specified password to the user. createexternaluser(user, accountid, password, sendemailconfirmation) creates a salesforce site or experience cloud site user and associates it with the given account. this method sends the user an email with the specified password and a new user confirmation email. createpersonaccountportaluser(user, ownerid, password) creates a person account using the default record type defined on the guest user's profile, then enables it for the site's portal. createpersonaccountportaluser(user, ownerid, recordtypeid, password) creates a person account using the specified recordtypeid, then enables it for the site's portal. createportaluser(user, accountid, password, sendemailconfirmation) creates a portal user for the given account and associates it with the site's portal. forgotpassword(username, emailtemplatename) resets the user's password and sends an email to the user with the user’s new password. you can specify a custom email template or use the default email template. returns a value indicating whether the password reset was successful. 3291apex reference guide site class forgotpassword(username) resets the user's password and sends an email to the user with the user’s new password. returns a value indicating whether the password reset was successful. getadminemail() returns the email address of the site administrator. getadminid() returns the user id of the site administrator. getanalyticstrackingcode() the tracking code associated with your site. services such as google analytics can use this code to track page request data for your site. getcurrentsiteurl() deprecated. this method was replaced by getbaseurl() in api version 30.0. returns the base url of the current site that references and links should use. getbasecustomurl() returns a base url for the current site that doesn’t use a force.com subdomain. the returned url uses the same protocol (http or https) as the current request if at least one non-force.com custom url that supports https exists on the site. the returned value never ends with a / character. if all the custom urls in this site end in force.com or this site has no custom urls, then this returns an empty string. if the current request is not a site request, then this method returns an empty string. this method replaced getcustomwebaddress and includes the custom url's path prefix.. getbaseinsecureurl() deprecated. returns a base url for the current site that uses http instead of https. the current request's domain is used. the returned value includes the path prefix and never ends with a / character. if the current request is not a site request, then this method returns an empty string. getbaserequesturl() returns the base url of the current site for the requested url" ". this isn't influenced by the referring page's url. the returned url uses the same protocol (http or https) as the current request. the returned value includes the path prefix and never ends with a / character. if the current request is not a site request, then this method returns an empty string. getbasesecureurl() returns a base url for the current site that uses https instead of http. the current request's domain is preferred if it supports https. domains that are not force.com subdomains are preferred over force.com subdomains. a force.com subdomain, if associated with the site, is used if no other https domains exist in the current site. if no https custom urls exist in the site, then this method returns an empty string. the returned value includes the path prefix and never ends with a / character. if the current request is not a site request, then this method returns an empty string. getbaseurl() returns the base url of the current site that references and links should use. note that this field may return the referring page's url instead of the current request's url. the returned value includes the path prefix and never ends with a / character. if the current request is not a site request, then this field returns an empty string. this field replaces getcurrentsiteurl. getcustomwebaddress() deprecated. this method was replaced by getbasecustomurl() in api version 30.0. getdomain() returns your salesforce sites based url. geterrordescription() returns the error description for the current page if it’s a designated error page for the site and an error exists; otherwise, returns an empty string. 3292apex reference guide site class geterrormessage() returns an error message for the current page if it’s a designated error page for the site and an error exists; otherwise, returns an empty string. getexperienceid() returns the value of the experience id (expid). this expid value comes from a cookie in the user’s web browser. getmasterlabel() returns the value of the master label field for the current site. if the current request is not a site request, then this field returns null. getname() returns the api name of the current site. getoriginalurl() returns the original url for this page if it’s a designated error page for the site; otherwise, returns null. getpasswordpolicystatement() returns the password requirements for a salesforce site or experience cloud site created with the customer service template. getpathprefix() returns the url path prefix of the current site or an empty string if none. for example, if the requested site url is https://myco.my.salesforce-sites.com/partners, then /partners is the path prefix. if the current request is not a site request, then this method returns an empty string. this method replaced getprefix in api version 30.0. getprefix() deprecated. this method was replaced by getpathprefix() in api version 30.0. getsiteid() returns the id of the current site. if the current request is not a site request, then this field returns null. gettemplate() returns the template name associated with the current site; returns the default template if no template has been designated. getsitetype() returns the api value of the site type field for the current site. this can be visualforce for a salesforce site, siteforce for a site.com site, chatternetwork for an experience cloud site, or chatternetworkpicasso for an experience cloud site. if the current request is not a site request, then this method returns null. getsitetypelabel() returns the value of the site type field's label for the current site. if the current request is not a site request, then this method returns null. isloginenabled() returns true if the current site is associated with an active login-enabled portal; otherwise returns false. ispasswordexpired() for authenticated users, returns true if the currently logged-in user's password is expired. for non-authenticated users, returns false. isregistrationenabled() returns true if the current site is associated with an active self-registration-enabled customer portal; otherwise returns false. isvalidusername(username) returns true if the given username is valid; otherwise, returns false. login(username, password, starturl) allows users to log in to the current site with the given username and password, then takes them to the starturl. if starturl is not a relative path, it defaults to the site's designated index page. 3293apex reference guide site class password" "lesslogin(userid, methods, starturl) logs in a user to a salesforce site or experience cloud site using an identity verification method, such as email or text, instead of a password. passwordless login is a convenient, mobile-centric way to welcome users into your site. let your users log in with something other than their password, like their email address or phone number. setexperienceid(expidvalue) sets the experience id for the current user. use this method to populate the value of the experience id (expid) cookie in the user’s web browser. setportaluserasauthprovider(user, contactid) sets the specified user information within the site’s portal via an authentication provider. validatepassword(user, password, confirmpassword) indicates whether a given password meets the requirements specified by org-wide or profile-based password policies in the current user’s org. changepassword(newpassword, verifynewpassword, oldpassword) changes the password of the current user. signature public static system.pagereference changepassword(string newpassword, string verifynewpassword, string oldpassword) parameters newpassword type: string verifynewpassword type: string oldpassword type: string optional only if the current user’s password has expired; otherwise, required. return value type: system.pagereference usage calls to this method in api version 30.0 and later can’t commit the transaction automatically. calls to this method before api version 30.0 commit the transaction, making it impossible to roll back to a save point before the call. createexternaluser(user, accountid) creates a salesforce site or experience cloud site user for the given account and associates it with the site. signature public static id createexternaluser(sobject user, string accountid) 3294apex reference guide site class parameters user type: sobject information required to create a user. the email address of the user is used to look for matching contacts associated with the specified accountid. if a matching contact is found and is already used by an external user, self-registration isn’t successful. if a matching contact is found but isn’t used by an external user, it is used for the new external user. if there is no matching contact, a new contact is created for the new external user. accountid type: string the id of the account you want to associate the user with. return value type: id the id of the user that this method creates. usage this method throws site.externalusercreateexception when user creation fails. the nickname field is required for the user sobject when using the createexternaluser method. note: this method is only valid when a site is associated with a customer portal. calls to this method in api version 30.0 and later can’t commit the transaction automatically. calls to this method before api version 30.0 commit the transaction, making it impossible to roll back to a save point before the call. createexternaluser(user, accountid, password) creates a salesforce site or experience cloud site user for the given account and associates it with the site. this method sends an email with the specified password to the user. signature public static id createexternaluser(sobject user, string accountid, string password) parameters user type: sobject information required to create a user. the email address of the user is used to look for matching contacts associated with the specified accountid. if a matching contact is found and is already used by an external user, self-registration isn’t successful. if a matching contact is found but isn’t used by an external user, it is used for the new external user. if there is no matching contact, a new contact is created for the new external user. accountid type: string the id of the account you want to associate the user with. 3295apex reference guide site class password type: string the password of the salesforce site or experience cloud site user. if not specified, or if set to null or an empty string, this method sends a new password email to the portal user. return value type: id the id of the user that this method creates. usage this method throws site.externalusercreateexception when user creation fails. the nickname field is required for the user sobject when using the createexternaluser method. note: this method is only valid when a site is associated with a customer portal. calls to this method in api version 30.0 and later" "can’t commit the transaction automatically. calls to this method before api version 30.0 commit the transaction, making it impossible to roll back to a save point before the call. createexternaluser(user, accountid, password, sendemailconfirmation) creates a salesforce site or experience cloud site user and associates it with the given account. this method sends the user an email with the specified password and a new user confirmation email. signature public static id createexternaluser(sobject user, string accountid, string password, boolean sendemailconfirmation) parameters user type: sobject information required to create a user. the email address of the user is used to look for matching contacts associated with the specified accountid. if a matching contact is found and is already used by an external user, self-registration isn’t successful. if a matching contact is found but isn’t used by an external user, it is used for the new external user. if there is no matching contact, a new contact is created for the new external user. accountid type: string the id of the account you want to associate the user with. password type: string the password of the salesforce site or experience cloud site user. if not specified, or if set to null or an empty string, this method sends a new password email to the portal user. sendemailconfirmation type: boolean 3296apex reference guide site class determines whether a new user email is sent to the portal user. set it to true to send a new user email to the portal user. the default is false, that is, the new user email isn't sent. return value type: id the id of the user that this method creates. usage this method throws site.externalusercreateexception when user creation fails. the nickname field is required for the user sobject when using the createexternaluser method. note: this method is only valid when a site is associated with a customer portal. calls to this method in api version 30.0 and later can’t commit the transaction automatically. calls to this method before api version 30.0 commit the transaction, making it impossible to roll back to a save point before the call. createpersonaccountportaluser(user, ownerid, password) creates a person account using the default record type defined on the guest user's profile, then enables it for the site's portal. signature public static id createpersonaccountportaluser(sobject user, string ownerid, string password) parameters user type: sobject ownerid type: string password type: string return value type: id usage calls to this method in api version 30.0 and later can’t commit the transaction automatically. calls to this method before api version 30.0 commit the transaction, making it impossible to roll back to a save point before the call. note: this method is only valid when a site is associated with a customer portal, and when the user license for the default new user profile is a high-volume portal user. 3297apex reference guide site class createpersonaccountportaluser(user, ownerid, recordtypeid, password) creates a person account using the specified recordtypeid, then enables it for the site's portal. signature public static id createpersonaccountportaluser(sobject user, string ownerid, string recordtypeid, string password) parameters user type: sobject ownerid type: string recordtypeid type: string password type: string return value type: id usage calls to this method in api version 30.0 and later can’t commit the transaction automatically. calls to this method before api version 30.0 commit the transaction, making it impossible to roll back to a save point before the call. note: this method is only valid when a site is associated with a customer portal, and when the user license for the default new user profile is a high-volume portal user. createportaluser(user, accountid, password, sendemailconfirmation) creates a portal user for the given account and associates it with the site's portal. signature public static id createportaluser(sobject user, string accountid, string password, boolean sendemailconfirmation) parameters user type: sobject accountid type: string password type: string 3298apex reference guide site class (optional) the password of the portal user. if not specified, or if set to null or an empty string, this method sends a new" "password email to the portal user. sendemailconfirmation type: boolean (optional) determines whether a new user email is sent to the portal user. set it to true to send a new user email to the portal user. the default is false, that is, the new user email isn't sent. return value type: id usage if you’re using api version 34.0 or later, we recommend using the createexternaluser() methods because they offer better error handling than this method. the nickname field is required for the user sobject when using the createportaluser method. note: this method is only valid when a site is associated with a customer portal. calls to this method in api version 30.0 and later can’t commit the transaction automatically. calls to this method before api version 30.0 commit the transaction, making it impossible to roll back to a save point before the call. forgotpassword(username, emailtemplatename) resets the user's password and sends an email to the user with the user’s new password. you can specify a custom email template or use the default email template. returns a value indicating whether the password reset was successful. signature public static boolean forgotpassword(string username,string emailtemplatename) parameters username type: string emailtemplatename type: string if provided, the method applies the template to the email. otherwise, the method applies the default system template. if an email template that doesn’t exist is provided, the system logs an exception. return value type: boolean note: the return value is always true unless it’s called outside of a visualforce page. 3299apex reference guide site class usage calls to this method in api version 30.0 and later can’t commit the transaction automatically. calls to this method before api version 30.0 commit the transaction, making it impossible to roll back to a save point before the call. note: site.forgotpassword cannot be used with the @future method, which enables asynchronous execution. forgotpassword(username) resets the user's password and sends an email to the user with the user’s new password. returns a value indicating whether the password reset was successful. signature public static boolean forgotpassword(string username) parameters username type: string return value type: boolean note: the return value is always true unless it’s called outside of a visualforce page. usage calls to this method in api version 30.0 and later can’t commit the transaction automatically. calls to this method before api version 30.0 commit the transaction, making it impossible to roll back to a save point before the call. note: site.forgotpassword cannot be used with the @future method, which enables asynchronous execution. getadminemail() returns the email address of the site administrator. signature public static string getadminemail() return value type: string getadminid() returns the user id of the site administrator. 3300apex reference guide site class signature public static id getadminid() return value type: id getanalyticstrackingcode() the tracking code associated with your site. services such as google analytics can use this code to track page request data for your site. signature public static string getanalyticstrackingcode() return value type: string getcurrentsiteurl() deprecated. this method was replaced by getbaseurl() in api version 30.0. returns the base url of the current site that references and links should use. note that this may return the referring page's url instead of the current request's url. the returned value includes the path prefix and always ends with a / character. if the current request is not a site request, then this method returns null. if the current request is not a site request, then this method returns null. this method was replaced by getbaseurl in api version 30.0. signature public static string getcurrentsiteurl() return value type: string usage use getbaseurl() instead. getbasecustomurl() returns a base url for the current site that doesn’t use a force.com subdomain. the returned url uses the same protocol (http or https) as the current request if at least one non-force.com custom url that supports https exists on the site. the returned value never ends with a / character. if all the custom urls in this site end in force.com or this site has no custom urls, then this returns an empty string. if the current request is not a site request," "then this method returns an empty string. this method replaced getcustomwebaddress and includes the custom url's path prefix.. signature public static string getbasecustomurl() 3301apex reference guide site class return value type: string usage this method replaces getcustomwebaddress() and includes the custom url's path prefix. getbaseinsecureurl() deprecated. returns a base url for the current site that uses http instead of https. the current request's domain is used. the returned value includes the path prefix and never ends with a / character. if the current request is not a site request, then this method returns an empty string. signature public static string getbaseinsecureurl() return value type: string getbaserequesturl() returns the base url of the current site for the requested url. this isn't influenced by the referring page's url. the returned url uses the same protocol (http or https) as the current request. the returned value includes the path prefix and never ends with a / character. if the current request is not a site request, then this method returns an empty string. signature public static string getbaserequesturl() return value type: string getbasesecureurl() returns a base url for the current site that uses https instead of http. the current request's domain is preferred if it supports https. domains that are not force.com subdomains are preferred over force.com subdomains. a force.com subdomain, if associated with the site, is used if no other https domains exist in the current site. if no https custom urls exist in the site, then this method returns an empty string. the returned value includes the path prefix and never ends with a / character. if the current request is not a site request, then this method returns an empty string. signature public static string getbasesecureurl() return value type: string 3302apex reference guide site class getbaseurl() returns the base url of the current site that references and links should use. note that this field may return the referring page's url instead of the current request's url. the returned value includes the path prefix and never ends with a / character. if the current request is not a site request, then this field returns an empty string. this field replaces getcurrentsiteurl. signature public static string getbaseurl() return value type: string usage this method replaces getcurrentsiteurl(). getcustomwebaddress() deprecated. this method was replaced by getbasecustomurl() in api version 30.0. returns the request's custom url if it doesn't end in lightning platform or returns the site's primary custom url. if neither exist, then this returns null. note that the url's path is always the root, even if the request's custom url has a path prefix. if the current request is not a site request, then this method returns null. the returned value always ends with a / character. signature public static string getcustomwebaddress() return value type: string usage use getbasecustomurl() instead. getdomain() returns your salesforce sites based url. signature public static string getdomain() return value type: string 3303apex reference guide site class geterrordescription() returns the error description for the current page if it’s a designated error page for the site and an error exists; otherwise, returns an empty string. signature public static string geterrordescription() return value type: string geterrormessage() returns an error message for the current page if it’s a designated error page for the site and an error exists; otherwise, returns an empty string. signature public static string geterrormessage() return value type: string getexperienceid() returns the value of the experience id (expid). this expid value comes from a cookie in the user’s web browser. signature public static string getexperienceid() return value type: string usage use the getexperienceid and setexperienceid methods to implement dynamic login experiences. you can set the experience id with setexperienceid or by extending the following endpoints with expid_value. • community-url/services/oauth2/authorize/expid_value • community-url/idp/endpoint/httppost/expid_value • community-url/idp/endpoint/httpredirect/expid_value • community-url_login_page/expid={value} • community-url/communitiesselfreg?expid={value} • secur/" "forgotpassword.jsp?expid={value} the cookie is set when the browser loads the urls with the expid values. 3304apex reference guide site class getmasterlabel() returns the value of the master label field for the current site. if the current request is not a site request, then this field returns null. signature public static string getmasterlabel() return value type: string getname() returns the api name of the current site. signature public static string getname() return value type: string getoriginalurl() returns the original url for this page if it’s a designated error page for the site; otherwise, returns null. signature public static string getoriginalurl() return value type: string getpasswordpolicystatement() returns the password requirements for a salesforce site or experience cloud site created with the customer service template. signature public static string getpasswordpolicystatement() return value type: string 3305apex reference guide site class getpathprefix() returns the url path prefix of the current site or an empty string if none. for example, if the requested site url is https://myco.my.salesforce-sites.com/partners, then /partners is the path prefix. if the current request is not a site request, then this method returns an empty string. this method replaced getprefix in api version 30.0. signature public static string getpathprefix() return value type: string getprefix() deprecated. this method was replaced by getpathprefix() in api version 30.0. returns the url path prefix of the current site. for example, if your site url is mydomainname.my.salesforce-sites.com/partners, /partners is the path prefix. returns null if the prefix isn’t defined. if the current request is not a site request, then this method returns a null. signature public static string getprefix() return value type: string getsiteid() returns the id of the current site. if the current request is not a site request, then this field returns null. signature public static string getsiteid() return value type: id gettemplate() returns the template name associated with the current site; returns the default template if no template has been designated. signature public static system.pagereference gettemplate() 3306apex reference guide site class return value type: system.pagereference getsitetype() returns the api value of the site type field for the current site. this can be visualforce for a salesforce site, siteforce for a site.com site, chatternetwork for an experience cloud site, or chatternetworkpicasso for an experience cloud site. if the current request is not a site request, then this method returns null. signature public static string getsitetype() return value type: string getsitetypelabel() returns the value of the site type field's label for the current site. if the current request is not a site request, then this method returns null. signature public static string getsitetypelabel() return value type: string isloginenabled() returns true if the current site is associated with an active login-enabled portal; otherwise returns false. signature public static boolean isloginenabled() return value type: boolean ispasswordexpired() for authenticated users, returns true if the currently logged-in user's password is expired. for non-authenticated users, returns false. signature public static boolean ispasswordexpired() 3307apex reference guide site class return value type: boolean isregistrationenabled() returns true if the current site is associated with an active self-registration-enabled customer portal; otherwise returns false. signature public static boolean isregistrationenabled() return value type: boolean isvalidusername(username) returns true if the given username is valid; otherwise, returns false. signature public static boolean isvalidusername(string username) parameters username type: string the username to test for validity. return value type: boolean login(username, password, starturl) allows users to log in to the current site with the given username and password, then takes them to the starturl. if starturl is not a relative path, it defaults to the site's designated index page. signature public static system.pagereference login(string username, string password, string starturl) parameters username type: string password type:" "string 3308apex reference guide site class starturl type: string return value type: system.pagereference usage all dml statements before the call to site.login get committed. it’s not possible to roll back to a save point that was created before a call to site.login. note: do not include http:// or https:// in the starturl. passwordlesslogin(userid, methods, starturl) logs in a user to a salesforce site or experience cloud site using an identity verification method, such as email or text, instead of a password. passwordless login is a convenient, mobile-centric way to welcome users into your site. let your users log in with something other than their password, like their email address or phone number. signature public static system.pagereference passwordlesslogin(id userid, list methods, string starturl) parameters userid type: id id of the user to log in. methods type: list list of identity verification methods available to the user for passwordless login. starturl type: string path to the page that users see after they log in. return value type: system.pagereference usage include this method in the apex controller of a custom login page implementation. 3309apex reference guide site class passwordlesslogin example this simple code example of an apex controller contains the passwordlesslogin method. the pagereference returned by passwordlesslogin redirects the user to the salesforce verify page. when the user enters the correct code, the user is redirected to the site page specified by the start url. global with sharing class mfilogincontroller { //input variables global string input {get; set;} public string starturl {get; set;} public list methods; public string error; global mfilogincontroller() { // add verification methods in priority order methods = new list(); methods.add(auth.verificationmethod.sms); methods.add(auth.verificationmethod.email); methods.add(auth.verificationmethod.u2f); methods.add(auth.verificationmethod.salesforce_authenticator); methods.add(auth.verificationmethod.totp); } global pagereference login() { list users = null; // empty input if(input == null || input == '') { error = 'enter username'; return null; } users = [select name, id, email from user where username=:input]; if(users == null || users.isempty()) { error = 'can\'t find a user'; return null; } if (starturl == null) starturl = '/'; return site.passwordlesslogin(users[0].id, methods, starturl); } } setexperienceid(expidvalue) sets the experience id for the current user. use this method to populate the value of the experience id (expid) cookie in the user’s web browser. 3310apex reference guide site class signature public static void setexperienceid(string expidvalue) parameters expidvalue type: string a value that indicates the user’s login experience. the value must contain alphanumeric characters only, up to 30 characters. usage use setexperienceid when you’re implementing dynamic login experiences. a login experience refers to a login page plus any secondary pages associated with the login page (such as multi-factor authentication (mfa) or a login flow). you define different login experiences depending on who users are or where they’re logging in from. for example, you can require a different registration process based on the user’s location. in this case, expidvalue includes a state or country code. when the user logs in, the url contains the experience id parameter, {expid}. the {expid} parameter is replaced by the value stored in expidvalue, such as .jp. then the user is redirected to the japanese login experience. example string expid = apexpages.currentpage().getparameters().get('expid'); if (expid != null) { site.setexperienceid(expid); } setportaluserasauthprovider(user, contactid) sets the specified user information within the site’s portal via an authentication provider. signature" "public static void setportaluserasauthprovider(sobject user, string contactid) parameters user type: sobject contactid type: string return value type: void usage • this method is only valid when a site is associated with a customer portal. 3311apex reference guide sobject class • calls to this method in api version 30.0 and later can’t commit the transaction automatically. calls to this method before api version 30.0 commit the transaction, making it impossible to roll back to a save point before the call. • for more information on an authentication provider, see registrationhandler. validatepassword(user, password, confirmpassword) indicates whether a given password meets the requirements specified by org-wide or profile-based password policies in the current user’s org. signature public static void validatepassword(sobject user, string password, string confirmpassword) parameters user type: sobject the user attempting to create a password during self-registration for a salesforce site or experience cloud site. password type: string the password entered by the user. confirmpassword type: string the password reentered by the user to confirm the password. return value type: void usage if validation fails when the method is run in a lightning controller, this method throws an apex exception describing the failed validation. if validation fails when the method is run in a visualforce controller, the method provides visualforce error messages. sobject class contains methods for the sobject data type. namespace system usage sobject methods are all instance methods: they are called by and operate on an sobject instance such as an account or contact. the following are the instance methods for sobjects. 3312apex reference guide sobject class for more information on sobjects, see working with sobjects. sobject methods the following are methods for sobject. all are instance methods. in this section: adderror(errormsg) marks a trigger record with a custom error message and prevents any dml operation from occurring. adderror(errormsg, escape) marks a trigger record with a custom error message, specifies if the error message should be escaped, and prevents any dml operation from occurring. adderror(exceptionerror) marks a trigger record with a custom error message and prevents any dml operation from occurring. adderror(exceptionerror, escape) marks a trigger record with a custom exception error message, specifies whether or not the exception error message should be escaped, and prevents any dml operation from occurring. adderror(errormsg) places the specified error message on a trigger record field in the salesforce user interface and prevents any dml operation from occurring. adderror(errormsg, escape) places the specified error message, which can be escaped or unescaped, on a trigger record field in the salesforce user interface, and prevents any dml operation from occurring. adderror(fieldname, errormsg) dynamically add errors to fields of an sobject associated with the specified field name. adderror(fieldtoken, errormsg) dynamically add errors to an sobject instance associated with the specified field. adderror(fieldname, errormsg, escape) dynamically add errors to fields of an sobject associated with the specified field name. adderror(fieldtoken, errormsg, escape) dynamically add errors to an sobject instance associated with the specified field. clear() clears all field values clone(preserveid, isdeepclone, preservereadonlytimestamps, preserveautonumber) creates a copy of the sobject record. get(fieldname) returns the value for the field specified by fieldname, such as accountnumber. get(field) returns the value for the field specified by the field token schema.sobjectfield, such as, schema.account.accountnumber. 3313apex reference guide sobject class getclonesourceid() returns the id of the entity from which an object was cloned. you can use it for objects cloned through the salesforce user interface. you can also use it for objects created using the system.sobject.clone(preserveid, isdeepclone, preservereadonlytimestamps, preserveautonumber) method, provided that the preserveid parameter wasn’t used or was set to false. the getclonesourceid() method can only be used within the transaction where the entity is cloned, as clone information doesn’t persist" "in subsequent transactions. geterrors() returns a list of database.error objects for an sobject instance. if the sobject has no errors, an empty list is returned. getoptions() returns the database.dmloptions object for the sobject. getpopulatedfieldsasmap() returns a map of populated field names and their corresponding values. the map contains only the fields that have been populated in memory for the sobject instance. getsobject(fieldname) returns the value for the specified field. this method is primarily used with dynamic dml to access values for external ids. getsobject(field) returns the value for the field specified by the field token schema.sobjectfield, such as, schema.myobj.myexternalid. this method is primarily used with dynamic dml to access values for external ids. getsobjects(fieldname) returns the values for the specified field. this method is primarily used with dynamic dml to access values for associated objects, such as child relationships. getsobjects(fieldname) returns the value for the field specified by the field token schema.fieldname, such as, schema.account.contact. this method is primarily used with dynamic dml to access values for associated objects, such as child relationships. getsobjecttype() returns the token for this sobject. this method is primarily used with describe information. getquickactionname() retrieves the name of a quick action associated with this sobject. typically used in triggers. haserrors() returns true if an sobject instance has associated errors. the error message can be associated to the sobject instance by using sobject.adderror(), validation rules, or by other means. isclone() returns true if an entity is cloned from something, even if the entity hasn’t been saved. the method can only be used within the transaction where the entity is cloned, as clone information doesn’t persist in subsequent transactions. isset(fieldname) returns information about the queried sobject field. returns true if the sobject field is populated, either by direct assignment or by inclusion in a soql query. returns false if the sobject field is not set. if an invalid field is specified, an sobjectexception is thrown. isset(field) returns information about the queried sobject field. returns true if the sobject field is populated, either by direct assignment or by inclusion in a soql query. returns false if the sobject field is not set. if an invalid field is specified, an sobjectexception is thrown. 3314apex reference guide sobject class put(fieldname, value) sets the value for the specified field and returns the previous value for the field. put(field, value) sets the value for the field specified by the field token schema.sobjectfield, such as, schema.account.accountnumber and returns the previous value for the field. putsobject(fieldname, value) sets the value for the specified field. this method is primarily used with dynamic dml for setting external ids. the method returns the previous value of the field. putsobject(fieldname, value) sets the value for the field specified by the token schema.sobjecttype. this method is primarily used with dynamic dml for setting external ids. the method returns the previous value of the field. recalculateformulas() deprecated as of api version 57.0. use the recalculateformulas() method in the system.formula class instead. setoptions(dmloptions) sets the dmloptions object for the sobject. adderror(errormsg) marks a trigger record with a custom error message and prevents any dml operation from occurring. signature public void adderror(string errormsg) parameters errormsg type: string the error message to mark the record with. return value type: void usage when used on trigger.new in before insert and before update triggers, and on trigger.old in before delete triggers, the error message is displayed in the application interface. see triggers and trigger exceptions. note: this method escapes any html markup in the specified error message. the escaped characters are: \n, <, >, &, "", \, \u2028, \u2029, and \u00a9. as a result, html markup is not rendered; instead, it is displayed as text in the salesforce user interface. when used in visualforce controllers, the generated message is added to the collection of" "errors for the page. for more information, see validation rules and standard controllers in the visualforce developer's guide. 3315apex reference guide sobject class example trigger.new[0].adderror('bad'); adderror(errormsg, escape) marks a trigger record with a custom error message, specifies if the error message should be escaped, and prevents any dml operation from occurring. signature public void adderror(string errormsg, boolean escape) parameters errormsg type: string the error message to mark the record with. escape type: boolean indicates whether any html markup in the custom error message should be escaped (true) or not (false). this parameter is ignored in both lightning experience and the salesforce mobile app, and the html is always escaped. the escape parameter only applies in salesforce classic. return value type: void usage the escaped characters are: \n, <, >, &, "", \, \u2028, \u2029, and \u00a9. as a result, html markup is not rendered; instead, it is displayed as text in the salesforce user interface. warning: be cautious if you specify false for the escape argument. unescaped strings displayed in the salesforce user interface can represent a vulnerability in the system because these strings might contain harmful code. if you want to include html markup in the error message, call this method with a false escape argument. make sure that you escape any dynamic content, such as input field values. otherwise, specify true for the escape argument or call adderror(string errormsg) instead. example trigger.new[0].adderror('fix & resubmit', false); adderror(exceptionerror) marks a trigger record with a custom error message and prevents any dml operation from occurring. 3316apex reference guide sobject class signature public void adderror(exception exceptionerror) parameters exceptionerror type: system.exception an exception object or a custom exception object that contains the error message to mark the record with. return value type: void usage when used on trigger.new in before insert and before update triggers, and on trigger.old in before delete triggers, the error message is displayed in the application interface. see triggers and trigger exceptions. note: this method escapes any html markup in the specified error message. the escaped characters are: \n, <, >, &, "", \, \u2028, \u2029, and \u00a9. as a result, html markup is not rendered; instead, it is displayed as text in the salesforce user interface. when used in visualforce controllers, the generated message is added to the collection of errors for the page. for more information, see validation rules and standard controllers in the visualforce developer's guide. example public class myexception extends exception {} trigger.new[0].adderror(new myexception('invalid id')); adderror(exceptionerror, escape) marks a trigger record with a custom exception error message, specifies whether or not the exception error message should be escaped, and prevents any dml operation from occurring. signature public void adderror(exception exceptionerror, boolean escape) parameters exceptionerror type: system.exception an exception object or a custom exception object that contains the error message to mark the record with. escape type: boolean 3317apex reference guide sobject class indicates whether any html markup in the custom error message should be escaped (true) or not (false). this parameter is ignored in both lightning experience and the salesforce mobile app, and the html is always escaped. the escape parameter only applies in salesforce classic. return value type: void usage the escaped characters are: \n, <, >, &, "", \, \u2028, \u2029, and \u00a9. as a result, html markup is not rendered; instead, it is displayed as text in the salesforce user interface. warning: be cautious if you specify false for the escape argument. unescaped strings displayed in the salesforce user interface can represent a vulnerability in the system because these strings might contain harmful code. if you want to include html markup in the error message, call this method with a false escape argument. make sure that you escape any dynamic content, such as input field values. otherwise, specify true for the escape argument or call adderror(exception e) instead. example public class myexception extends exception {} trigger.new[0].adderror(new myexception('" "invalid id & other issues', false)); adderror(errormsg) places the specified error message on a trigger record field in the salesforce user interface and prevents any dml operation from occurring. signature public void adderror(string errormsg) parameters errormsg type: string return value type: void usage note: • when used on trigger.new in before insert and before update triggers, and on trigger.old in before delete triggers, the error appears in the application interface. • when used in visualforce controllers, if there is an inputfield component bound to field, the message is attached to the component. for more information, see validation rules and standard controllers in the visualforce developer's guide. • this method is highly specialized because the field identifier is not actually the invoking object—the sobject record is the invoker. the field is simply used to identify the field that should be used to display the error. 3318apex reference guide sobject class see triggers and trigger exceptions. note: this method escapes any html markup in the specified error message. the escaped characters are: \n, <, >, &, "", \, \u2028, \u2029, and \u00a9. as a result, html markup is not rendered; instead, it is displayed as text in the salesforce user interface. example trigger.new[0].myfield__c.adderror('bad'); adderror(errormsg, escape) places the specified error message, which can be escaped or unescaped, on a trigger record field in the salesforce user interface, and prevents any dml operation from occurring. signature public void adderror(string errormsg, boolean escape) parameters errormsg type: string the error message to mark the record with. escape type: boolean indicates whether any html markup in the custom error message should be escaped (true) or not (false). this parameter is ignored in both lightning experience and the salesforce mobile app, and the html is always escaped. the escape parameter only applies in salesforce classic. return value type: usage the escaped characters are: \n, <, >, &, "", \, \u2028, \u2029, and \u00a9. as a result, html markup is not rendered; instead, it is displayed as text in the salesforce user interface. warning: be cautious if you specify false for the escape argument. unescaped strings displayed in the salesforce user interface can represent a vulnerability in the system because these strings might contain harmful code. if you want to include html markup in the error message, call this method with a false escape argument. make sure that you escape any dynamic content, such as input field values. otherwise, specify true for the escape argument or call field.adderror(string errormsg) instead. example trigger.new[0].myfield__c.adderror('fix & resubmit', false); 3319apex reference guide sobject class adderror(fieldname, errormsg) dynamically add errors to fields of an sobject associated with the specified field name. signature public void adderror(string fieldname, string errormsg) parameters fieldname type: string the field name of the sobject . errormsg type: string the error message to be added. html special characters in the error message string are always escaped. return value type: void usage if the field name is an empty string or null, the error is associated with the sobject and not with a specific field. example // add an error to an sobject field using the adderror() method. account acct = new account(name = 'testaccount'); acct.adderror('name', 'error in name field'); // use the haserrors() method to verify that the error is added, and then the geterrors() method to validate the error. system.assert(acct.haserrors()); list errors = acct.geterrors(); system.assertequals(1, errors.size()); adderror(fieldtoken, errormsg) dynamically add errors to an sobject instance associated with the specified field. signature public void adderror(schema.sobjectfield fieldtoken, string errormsg parameters fieldtoken type: schema.sobjectfield the field of the sobject instance. 3320apex reference guide sobject class errormsg type: string the error message to be added. html special characters in" "the error message string are always escaped. return value type: void usage use this method to add errors to the specified field token of a standard or custom object. if fieldtokenis null, the error is associated with the sobject and not with a specific field. example // add an error to a field of an sobject instance using the adderror() method. account acct = new account(name = 'testaccount'); schema.describefieldresult namedesc = account.name.getdescribe(); schema.sobjectfield namefield = namedesc.getsobjectfield(); acct.adderror(namefield, 'error is name field'); // use the haserrors() method to verify that the error is added, and then the geterrors() method to validate the error. system.assert(acct.haserrors()); list errors = acct.geterrors(); system.assertequals(1, errors.size()); adderror(fieldname, errormsg, escape) dynamically add errors to fields of an sobject associated with the specified field name. signature public void adderror(string fieldname, string errormsg, boolean escape) parameters fieldname type: string the field name of the sobject . errormsg type: string the error message to be added. escape type: boolean indicates whether any html markup in the custom error message should be escaped (true) or not (false). this parameter is ignored in both lightning experience and the salesforce mobile app, and the html is always escaped. the escape parameter only applies in salesforce classic. 3321apex reference guide sobject class return value type: void usage if the field name is an empty string or null, the error is associated with the sobject and not with a specific field. the escaped characters are: \n, <, >, &, "", \, \u2028, \u2029, and \u00a9. as a result, html markup is not rendered; instead, it is displayed as text in the salesforce user interface. warning: • the escape parameter cannot be disabled in lightning experience and in the salesforce mobile app, and will be ignored. • be cautious if you specify false for the escape argument. unescaped strings displayed in the salesforce user interface can represent a vulnerability in the system because these strings might contain harmful code. if you want to include html markup in the error message, call this method with a false escape argument. make sure that you escape any dynamic content, such as input field values. otherwise, specify true for the escape argument or call adderror(string fieldname, string errormsg) instead. example // add an error to an sobject field using the adderror() method. account acct = new account(name = 'testaccount'); acct.adderror('name', 'error in name field', false); // use the haserrors() method to verify that the error is added, and then the geterrors() method to validate the error. system.assert(acct.haserrors()); list errors = acct.geterrors(); system.assertequals(1, errors.size()); adderror(fieldtoken, errormsg, escape) dynamically add errors to an sobject instance associated with the specified field. signature public void adderror(schema.sobjectfield fieldtoken, string errormsg, boolean escape) parameters fieldtoken type: schema.sobjectfield the field of the sobject instance. errormsg type: string the error message to be added. escape type: boolean 3322apex reference guide sobject class indicates whether any html markup in the custom error message should be escaped (true) or not (false). this parameter is ignored in both lightning experience and the salesforce mobile app, and the html is always escaped. the escape parameter only applies in salesforce classic. return value type: void usage use this method to add errors to the specified field token of a standard or custom object. if fieldtokenis null, the error is associated with the sobject and not with a specific field. the escaped characters are: \n, <, >, &, "", \, \u2028, \u2029, and \u00a9. as a result, html markup is not rendered; instead, it is displayed as text in the salesforce user interface. warning: • the escape parameter cannot be disabled in lightning experience and in the" "salesforce mobile app, and will be ignored. • be cautious if you specify false for the escape argument. unescaped strings displayed in the salesforce user interface can represent a vulnerability in the system because these strings might contain harmful code. if you want to include html markup in the error message, call this method with a false escape argument. make sure that you escape any dynamic content, such as input field values. otherwise, specify true for the escape argument or call adderror(schema.sobjectfield fieldtoken, string errormsg) instead. example // add an error to a field of an sobject instance using the adderror() method. account acct = new account(name = 'testaccount'); schema.describefieldresult namedesc = account.name.getdescribe(); schema.sobjectfield namefield = namedesc.getsobjectfield(); acct.adderror(namefield, 'error is name field', false); // use the haserrors() method to verify that the error is added, and then the geterrors() method to validate the error. system.assert(acct.haserrors()); list errors = acct.geterrors(); system.assertequals(1, errors.size()); clear() clears all field values signature public void clear() return value type: void 3323apex reference guide sobject class example account acc = new account(name = 'acme'); acc.clear(); account expected = new account(); system.assertequals(expected, acc); clone(preserveid, isdeepclone, preservereadonlytimestamps, preserveautonumber) creates a copy of the sobject record. signature public sobject clone(boolean preserveid, boolean isdeepclone, boolean preservereadonlytimestamps, boolean preserveautonumber) parameters preserveid type: boolean (optional) determines whether the id of the original object is preserved or cleared in the duplicate. if set to true, the id is copied to the duplicate. the default is false, that is, the id is cleared. isdeepclone type: boolean (optional) determines whether the method creates a full copy of the sobject field or just a reference: • if set to true, the method creates a full copy of the sobject. all fields on the sobject are duplicated in memory, including relationship fields. consequently, if you change a field on the cloned sobject, the original sobject isn’t affected. • if set to false, the method performs a shallow copy of the sobject fields. all copied relationship fields reference the original sobjects. consequently, if you change a relationship field on the cloned sobject, the corresponding field on the original sobject is also affected, and vice versa. the default is false. preservereadonlytimestamps type: boolean (optional) determines whether the read-only timestamp fields are preserved or cleared in the duplicate. if set to true, the read-only fields createdbyid, createddate, lastmodifiedbyid, and lastmodifieddate are copied to the duplicate. the default is false, that is, the values are cleared. note: audit field values won’t be persisted to the database via dml on the cloned sobject instance. preserveautonumber type: boolean (optional) determines whether auto number fields of the original object are preserved or cleared in the duplicate. if set to true, auto number fields are copied to the cloned object. the default is false, that is, auto number fields are cleared. return value type: sobject (of the same type) 3324apex reference guide sobject class usage note: for apex saved using salesforce api version 22.0 or earlier, the default value for the preserveid argument is true, that is, the id is preserved. example account acc = new account(name = 'acme', description = 'acme account'); account clonedacc = acc.clone(false, false, false, false); system.assertequals(acc, clonedacc); get(fieldname) returns the value for the field specified by fieldname, such as accountnumber. signature public object get(string fieldname) parameters fieldname type: string return value type: object usage for more information, see dynamic soql. example account acc = new account(name = 'acme', description = 'acme account'); string description =" "(string)acc.get('description'); system.assertequals('acme account', description); versioned behavior changes in api version 34.0 and later, you must include the namespace name to retrieve a field from a field map using this method. for example, to get the account__c field in the mynamespace namespace from a fields field map, use: fields.get(‘mynamespace__account__c’). get(field) returns the value for the field specified by the field token schema.sobjectfield, such as, schema.account.accountnumber. 3325apex reference guide sobject class signature public object get(schema.sobjectfield field) parameters field type: schema.sobjectfield return value type: object usage for more information, see dynamic soql. note: field tokens aren't available for person accounts. if you access schema.account.fieldname, you get an exception error. instead, specify the field name as a string. example account acc = new account(name = 'acme', description = 'acme account'); string description = (string)acc.get(schema.account.description); system.assertequals('acme account', description); getclonesourceid() returns the id of the entity from which an object was cloned. you can use it for objects cloned through the salesforce user interface. you can also use it for objects created using the system.sobject.clone(preserveid, isdeepclone, preservereadonlytimestamps, preserveautonumber) method, provided that the preserveid parameter wasn’t used or was set to false. the getclonesourceid() method can only be used within the transaction where the entity is cloned, as clone information doesn’t persist in subsequent transactions. signature public id getclonesourceid() return value type: id usage if a is cloned to b, b is cloned to c, and c is cloned to d, then b, c, and d all point back to a as their clone source. example account acc0 = new account(name = 'acme'); insert acc0; account acc1 = acc0.clone(); 3326apex reference guide sobject class account acc2 = acc1.clone(); account acc3 = acc2.clone(); account acc4 = acc3.clone(); system.assert(acc0.id != null); system.assertequals(acc0.id, acc1.getclonesourceid()); system.assertequals(acc0.id, acc2.getclonesourceid()); system.assertequals(acc0.id, acc3.getclonesourceid()); system.assertequals(acc0.id, acc4.getclonesourceid()); system.assertequals(null, acc0.getclonesourceid()); geterrors() returns a list of database.error objects for an sobject instance. if the sobject has no errors, an empty list is returned. signature public list geterrors() return value type: list getoptions() returns the database.dmloptions object for the sobject. signature public database.dmloptions getoptions() return value type: database.dmloptions example database.dmloptions dmo = new database.dmloptions(); dmo.assignmentruleheader.usedefaultrule = true; account acc = new account(name = 'acme'); acc.setoptions(dmo); database.dmloptions accdmo = acc.getoptions(); getpopulatedfieldsasmap() returns a map of populated field names and their corresponding values. the map contains only the fields that have been populated in memory for the sobject instance. signature public map getpopulatedfieldsasmap() 3327apex reference guide sobject class return value type: map a map of field names and their corresponding values. usage the returned map contains only the fields that have been populated in memory for the sobject instance, which makes it easy to iterate over those fields. a field is populated in memory in the following cases. • the field has been queried by a soql statement. • the field has been explicitly set before the call to the getpopulatedfieldsasmap() method. fields on related objects that are queried or" "set are also returned in the map. the following example iterates over the map returned by the getpopulatedfieldsasmap() method after a soql query. account a = new account(); a.name = 'testmapaccount1'; insert a; a = [select id,name from account where id=:a.id]; map fieldstovalue = a.getpopulatedfieldsasmap(); for (string fieldname : fieldstovalue.keyset()){ system.debug('field name is ' + fieldname + ', value is ' + fieldstovalue.get(fieldname)); } // example debug statement output: // debug|field name is id, value is 001r0000003eppkiao // debug|field name is name, value is testmapaccount1 this example iterates over the map returned by the getpopulatedfieldsasmap() method after fields on the sobject are explicitly set. account a = new account(); a.name = 'testmapaccount2'; a.phone = '123-4567'; insert a; map fieldstovalue = a.getpopulatedfieldsasmap(); for (string fieldname : fieldstovalue.keyset()) { system.debug('field name is ' + fieldname + ', value is ' + fieldstovalue.get(fieldname)); } // example debug statement output: // debug|field name is name, value is testmapaccount2 // debug|field name is phone, value is 123-4567 // debug|field name is id, value is 001r0000003epppiao the following example shows how to use the getpopulatedfieldsasmap() method with related objects. account a = new account(); a.name='testmapaccount3'; insert a; 3328apex reference guide sobject class contact c = new contact(); c.firstname='testcontactfirstname'; c.lastname ='testcontactlastname'; c.accountid = a.id; insert c; c = [select id, contact.firstname, contact.account.name from contact where id=:c.id limit 1]; map fieldstovalue = c.getpopulatedfieldsasmap(); // to get the fields on account, get the account object // and call getmappopulatedfieldsasmap() on that object. a = (account)fieldstovalue.get('account'); fieldstovalue = a.getpopulatedfieldsasmap(); for (string fieldname : fieldstovalue.keyset()) { system.debug('field name is ' + fieldname + ', value is ' + fieldstovalue.get(fieldname)); } // example debug statement output: // debug|field name is id, value is 001r0000003eppuiao // debug|field name is name, value is testmapaccount3 versioned behavior changes in api version 39.0 and later, getpopulatedfieldsasmap returns all values set on the sobject, even if values were set after the record was queried. this behavior is dependent on the version of the apex class calling this method and not on the version of the class that generated the sobject. if you query an sobject at api version 20.0, and then call this method in a class with api version 40.0, you will get the full set of fields. getsobject(fieldname) returns the value for the specified field. this method is primarily used with dynamic dml to access values for external ids. signature public sobject getsobject(string fieldname) parameters fieldname type: string return value type: sobject 3329apex reference guide sobject class example account acc = new account(name = 'acme', description = 'acme account'); insert acc; contact con = new contact(lastname = 'acmecon', accountid = acc.id); insert con; sobject contactdb = [select id, accountid, account.name from contact where id = :con.id limit 1]; account a = (account)contactdb.getsobject('account'); system.assertequals('acme', a.name); getsobject(field) returns the value for the field specified by the field token schema.sobjectfield, such as, schema.myobj.myexternalid. this method is primarily used with dynamic dml to access values for external ids." "signature public sobject getsobject(schema.sobjectfield field) parameters field type: schema.sobjectfield return value type: sobject usage if the method references polymorphic fields, a name object is returned. use the typeof clause in the soql select statement to directly get results that depend on the runtime object type referenced by the polymorphic field. see working with polymorphic relationships in soql queries. example account acc = new account(name = 'acme', description = 'acme account'); insert acc; contact con = new contact(lastname = 'acmecon', accountid = acc.id); insert con; schema.describefieldresult fieldresult = contact.accountid.getdescribe(); schema.sobjectfield field = fieldresult.getsobjectfield(); sobject contactdb = [select id, accountid, account.name from contact where id = :con.id limit 1]; account a = (account)contactdb.getsobject(field); system.assertequals('acme', a.name); 3330apex reference guide sobject class getsobjects(fieldname) returns the values for the specified field. this method is primarily used with dynamic dml to access values for associated objects, such as child relationships. signature public sobject[] getsobjects(string fieldname) parameters fieldname type: string return value type: sobject[] usage for more information, see dynamic dml. example account acc = new account(name = 'acme', description = 'acme account'); insert acc; contact con = new contact(lastname = 'acmecon', accountid = acc.id); insert con; sobject[] a = [select id, (select name from contacts limit 1) from account where id = :acc.id]; sobject[] contactsdb = a.get(0).getsobjects('contacts'); string fieldvalue = (string)contactsdb.get(0).get('name'); system.assertequals('acmecon', fieldvalue); getsobjects(fieldname) returns the value for the field specified by the field token schema.fieldname, such as, schema.account.contact. this method is primarily used with dynamic dml to access values for associated objects, such as child relationships. signature public sobject[] getsobjects(schema.sobjecttype fieldname) parameters fieldname type: schema.sobjecttype return value type: sobject[] 3331apex reference guide sobject class getsobjecttype() returns the token for this sobject. this method is primarily used with describe information. signature public schema.sobjecttype getsobjecttype() return value type: schema.sobjecttype usage for more information, see apex_dynamic_describe_objects_understanding. example account acc = new account(name = 'acme', description = 'acme account'); schema.sobjecttype expected = schema.account.getsobjecttype(); system.assertequals(expected, acc.getsobjecttype()); getquickactionname() retrieves the name of a quick action associated with this sobject. typically used in triggers. signature public string getquickactionname() return value type: string example trigger acctrig2 on contact (before insert) { for (contact c : trigger.new) { if (c.getquickactionname() == quickaction.createcontact) { c.wherefrom__c = 'globaactionl'; } else if (c.getquickactionname() == schema.account.quickaction.createcontact) { c.wherefrom__c = 'accountaction'; } else if (c.getquickactionname() == null) { c.wherefrom__c = 'noaction'; } else { system.assert(false); } } } 3332" "apex reference guide sobject class haserrors() returns true if an sobject instance has associated errors. the error message can be associated to the sobject instance by using sobject.adderror(), validation rules, or by other means. signature public boolean haserrors() return value type: boolean isclone() returns true if an entity is cloned from something, even if the entity hasn’t been saved. the method can only be used within the transaction where the entity is cloned, as clone information doesn’t persist in subsequent transactions. signature public boolean isclone() return value type: boolean example account acc = new account(name = 'acme'); insert acc; account acc2 = acc.clone(); // test before saving system.assertequals(true, acc2.isclone()); insert acc2; // test after saving system.assertequals(true, acc2.isclone()); isset(fieldname) returns information about the queried sobject field. returns true if the sobject field is populated, either by direct assignment or by inclusion in a soql query. returns false if the sobject field is not set. if an invalid field is specified, an sobjectexception is thrown. signature public void isset(string fieldname) parameters fieldname type: string 3333apex reference guide sobject class return value type: boolean usage the isset method doesn’t check if a field is accessible to a specific user via org permissions or other specialized access permissions. example contact c = new contact(lastname = 'joyce'); system.assertequals(true, c.isset('lastname')); system.assertequals(false, c.isset('firstname')); // firstname field is not written to c.firstname = null; system.assertequals(true, c.isset('firstname')); //firstname field is written to isset(field) returns information about the queried sobject field. returns true if the sobject field is populated, either by direct assignment or by inclusion in a soql query. returns false if the sobject field is not set. if an invalid field is specified, an sobjectexception is thrown. signature public void isset(schema.sobjectfield field) parameters field type:sobjectfield class return value type: boolean usage the isset method doesn’t check if a field is accessible to a specific user via org permissions or other specialized access permissions. example contact newcontact = new contact(lastname = 'joyce'); insert(newcontact); //insert a new contact with last name joyce contact c = [select firstname from contact where id = :newcontact.id]; system.assertequals(true, c.isset(contact.firstname)); //firstname field in query system.assertequals(false, c.isset(contact.lastname)); //lastname field not in query put(fieldname, value) sets the value for the specified field and returns the previous value for the field. 3334apex reference guide sobject class signature public object put(string fieldname, object value) parameters fieldname type: string value type: object return value type: object example account acc = new account(name = 'test', description = 'old desc'); string olddesc = (string)acc.put('description', 'new desc'); system.assertequals('old desc', olddesc); system.assertequals('new desc', acc.description); put(field, value) sets the value for the field specified by the field token schema.sobjectfield, such as, schema.account.accountnumber and returns the previous value for the field. signature public object put(schema.sobjectfield field, object value) parameters field type: schema.sobjectfield value type: object return value type: object example account acc = new account(name = 'test', description = 'old desc'); string olddesc = (string)acc.put(schema.account.description, 'new desc'); system.assertequals('old desc', olddesc); system.assertequals('new desc', acc.description); 3335apex reference guide sobject class note: field tokens aren't available for person accounts. if you access schema.account.fieldname, you get an exception error. instead" ", specify the field name as a string. putsobject(fieldname, value) sets the value for the specified field. this method is primarily used with dynamic dml for setting external ids. the method returns the previous value of the field. signature public sobject putsobject(string fieldname, sobject value) parameters fieldname type: string value type: sobject return value type: sobject example account acc = new account(name = 'acme', description = 'acme account'); insert acc; contact con = new contact(lastname = 'acmecon', accountid = acc.id); insert con; account acc2 = new account(name = 'not acme'); contact contactdb = (contact)[select id, accountid, account.name from contact where id = :con.id limit 1]; account a = (account)contactdb.putsobject('account', acc2); system.assertequals('acme', a.name); system.assertequals('not acme', contactdb.account.name); putsobject(fieldname, value) sets the value for the field specified by the token schema.sobjecttype. this method is primarily used with dynamic dml for setting external ids. the method returns the previous value of the field. signature public sobject putsobject(schema.sobjecttype fieldname, sobject value) parameters fieldname type: schema.sobjecttype 3336apex reference guide sobject class value type: sobject return value type: sobject recalculateformulas() deprecated as of api version 57.0. use the recalculateformulas() method in the system.formula class instead. signature public void recalculateformulas() return value type: void usage this method doesn’t recalculate cross-object formulas. if you call this method on objects that have both cross-object and non-cross-object formula fields, only the non-cross-object formula fields are recalculated. each recalculateformulas call counts against the soql query limits. see execution governors and limits. see also: recalculateformulas(sobjects) what is a cross-object formula? setoptions(dmloptions) sets the dmloptions object for the sobject. signature public void setoptions(database.dmloptions dmloptions) parameters dmloptions type: database.dmloptions return value type: void 3337apex reference guide sobjectaccessdecision class example database.dmloptions dmo = new database.dmloptions(); dmo.assignmentruleheader.usedefaultrule = true; account acc = new account(name = 'acme'); acc.setoptions(dmo); sobjectaccessdecision class contains the results of a call to the security.stripinaccessible method and methods to retrieve those results. namespace system in this section: sobjectaccessdecision methods sobjectaccessdecision methods the following are methods for sobjectaccessdecision. in this section: getmodifiedindexes() returns the indexes of sobjects that are modified by the stripinaccessible method. getrecords() returns a list of new sobjects that are identical to the source records, except that they are stripped of fields that fail the field-level security check for the current user. getremovedfields() returns a map of sobject types to their corresponding inaccessible fields. the map key is a string representation of the sobject type. the map value is a set of strings, which denote the fields names that are inaccessible. getmodifiedindexes() returns the indexes of sobjects that are modified by the stripinaccessible method. signature public set getmodifiedindexes() return value type: set a set of unsigned integers that represent the row indexes of the modified sobjects. 3338apex reference guide sobjectaccessdecision class example in this example, the user doesn’t have permission to update the annualrevenue field of an account. list accounts = new list{ new account(name='account1', annualrevenue=1000), new account(name='account2') }; // strip fields that are not updatable sobjectaccessdecision decision = security.stripinaccessible( accesstype.updatable, accounts);" "// print stripped records for (sobject strippedaccount : decision.getrecords()) { system.debug(strippedaccount); } // print modified indexes system.debug(decision.getmodifiedindexes()); getrecords() returns a list of new sobjects that are identical to the source records, except that they are stripped of fields that fail the field-level security check for the current user. usage the stripinaccessible method performs field-level access check for the source records in the context of the current user’s operation. the getrecords() method returns the new records that contain only the fields that the current user has access to. signature public list getrecords() return value type: list even if the result list contains only one sobject, the return type is still a list (of size one). example in this example, the user doesn’t have permission to update the annualrevenue field of an account. list accounts = new list{ new account(name='account1', annualrevenue=1000), new account(name='account2') }; // strip fields that are not updatable sobjectaccessdecision decision = security.stripinaccessible( accesstype.updatable, 3339apex reference guide staticresourcecalloutmock class accounts); // print stripped records for (sobject strippedaccount : decision.getrecords()) { system.debug(strippedaccount); } getremovedfields() returns a map of sobject types to their corresponding inaccessible fields. the map key is a string representation of the sobject type. the map value is a set of strings, which denote the fields names that are inaccessible. signature public map> getremovedfields() return value type: map> example in this example, the user doesn’t have permission to update the annualrevenue field of an account. list accounts = new list{ new account(name='account1', annualrevenue=1000), new account(name='account2') }; // strip fields that are not updatable sobjectaccessdecision decision = security.stripinaccessible( accesstype.updatable, accounts); // print stripped records for (sobject strippedaccount : decision.getrecords()) { system.debug(strippedaccount); } // print removed fields system.debug(decision.getremovedfields()); staticresourcecalloutmock class utility class used to specify a fake response for testing http callouts. namespace system 3340apex reference guide staticresourcecalloutmock class usage use the methods in this class to set the response properties for testing http callouts. in this section: staticresourcecalloutmock constructors staticresourcecalloutmock methods staticresourcecalloutmock constructors the following are constructors for staticresourcecalloutmock. in this section: staticresourcecalloutmock() creates a new instance of the staticresourcecalloutmock class. staticresourcecalloutmock() creates a new instance of the staticresourcecalloutmock class. signature public staticresourcecalloutmock() staticresourcecalloutmock methods the following are methods for staticresourcecalloutmock. all are instance methods. in this section: setheader(headername, headervalue) sets the specified header name and value for the fake response. setstaticresource(resourcename) sets the specified static resource, which contains the response body. setstatus(httpstatus) sets the specified http status for the response. setstatuscode(httpstatuscode) sets the specified http status for the response. setheader(headername, headervalue) sets the specified header name and value for the fake response. signature public void setheader(string headername, string headervalue) 3341apex reference guide staticresourcecalloutmock class parameters headername type: string headervalue type: string return value type: void setstaticresource(resourcename) sets the specified static resource, which contains the response body. signature public void setstaticresource(string resourcename) parameters resourcename type: string return value type: void setstatus(httpstatus) sets the specified http status for the response. signature public void setstatus(string httpstatus)" "parameters httpstatus type: string return value type: void setstatuscode(httpstatuscode) sets the specified http status for the response. 3342apex reference guide string class signature public void setstatuscode(integer httpstatuscode) parameters httpstatuscode type: integer return value type: void string class contains methods for the string primitive data type. namespace system usage for more information on strings, see string data type. string methods the following are methods for string. in this section: abbreviate(maxwidth) returns an abbreviated version of the string, of the specified length and with ellipses appended if the current string is longer than the specified length; otherwise, returns the original string without ellipses. abbreviate(maxwidth, offset) returns an abbreviated version of the string, starting at the specified character offset and of the specified length. the returned string has ellipses appended at the start and the end if characters have been removed at these locations. capitalize() returns the current string with the first letter changed to title case. center(size) returns a version of the current string of the specified size padded with spaces on the left and right, so that it appears in the center. if the specified size is smaller than the current string size, the entire string is returned without added spaces. center(size, paddingstring) returns a version of the current string of the specified size padded with the specified string on the left and right, so that it appears in the center. if the specified size is smaller than the current string size, the entire string is returned without padding. charat(index) returns the value of the character at the specified index. 3343apex reference guide string class codepointat(index) returns the unicode code point value at the specified index. codepointbefore(index) returns the unicode code point value that occurs before the specified index. codepointcount(beginindex, endindex) returns the number of unicode code points within the specified text range. compareto(secondstring) compares two strings lexicographically, based on the unicode value of each character in the strings. contains(substring) returns true if and only if the string that called the method contains the specified sequence of characters in substring. containsany(inputstring) returns true if the current string contains any of the characters in the specified string; otherwise, returns false. containsignorecase(substring) returns true if the current string contains the specified sequence of characters without regard to case; otherwise, returns false. containsnone(inputstring) returns true if the current string doesn’t contain any of the characters in the specified string; otherwise, returns false. containsonly(inputstring) returns true if the current string contains characters only from the specified sequence of characters and not any other characters; otherwise, returns false. containswhitespace() returns true if the current string contains any white space characters; otherwise, returns false. countmatches(substring) returns the number of times the specified substring occurs in the current string. deletewhitespace() returns a version of the current string with all white space characters removed. difference(secondstring) returns the difference between the current string and the specified string. endswith(suffix) returns true if the string that called the method ends with the specified suffix. endswithignorecase(suffix) returns true if the current string ends with the specified suffix; otherwise, returns false. equals(secondstring) deprecated. this method is replaced by equals(stringorid). returns true if the passed-in string is not null and represents the same binary sequence of characters as the current string. use this method to perform case-sensitive comparisons. equals(stringorid) returns true if the passed-in object is not null and represents the same binary sequence of characters as the current string. use this method to compare a string to an object that represents a string or an id. equalsignorecase(secondstring) returns true if the secondstring isn’t null and represents the same sequence of characters as the string that called the method, ignoring case. 3344apex reference guide string class escapecsv() returns a string for a csv column enclosed in double quotes, if required. escapeecmascript() escapes the characters in the string using ecmascript string rules. escapehtml3() escapes the characters in a string using html 3.0 entities. escapeh" "tml4() escapes the characters in a string using html 4.0 entities. escapejava() returns a string whose characters are escaped using java string rules. characters escaped include quotes and control characters, such as tab, backslash, and carriage return characters. escapesinglequotes(stringtoescape) returns a string with the escape character (\) added before any single quotation marks in the string s. escapeunicode() returns a string whose unicode characters are escaped to a unicode escape sequence. escapexml() escapes the characters in a string using xml entities. format(stringtoformat, formattingarguments) treat the first argument as a pattern and return a string using the second argument for substitution and formatting. the substitution and formatting are the same as apex:outputtext and the java messageformat class. non-string types in the second argument’s list are implicitly converted to strings, respecting the tostring() method overrides that exist on the type. fromchararray(chararray) returns a string from the values of the list of integers. getchars() returns an array of character values that represent the characters in this string. getcommonprefix(strings) returns the initial sequence of characters as a string that is common to all the specified strings. getlevenshteindistance(stringtocompare) returns the levenshtein distance between the current string and the specified string. getlevenshteindistance(stringtocompare, threshold) returns the levenshtein distance between the current string and the specified string if it is less than or equal than the given threshold; otherwise, returns -1. hashcode() returns a hash code value for this string. indexof(substring) returns the index of the first occurrence of the specified substring. if the substring does not occur, this method returns -1. indexof(substring, index) returns the zero-based index of the first occurrence of the specified substring from the point of the given index. if the substring does not occur, this method returns -1. 3345apex reference guide string class indexofany(substring) returns the zero-based index of the first occurrence of any character specified in the substring. if none of the characters occur, returns -1. indexofanybut(substring) returns the zero-based index of the first occurrence of a character that is not in the specified substring. otherwise, returns -1. indexofchar(character) returns the index of the first occurrence of the character that corresponds to the specified character value. indexofchar(character, startindex) returns the index of the first occurrence of the character that corresponds to the specified character value, starting from the specified index. indexofdifference(stringtocompare) returns the zero-based index of the character where the current string begins to differ from the specified string. indexofignorecase(substring) returns the zero-based index of the first occurrence of the specified substring without regard to case. if the substring does not occur, this method returns -1. indexofignorecase(substring, startposition) returns the zero-based index of the first occurrence of the specified substring from the point of index i, without regard to case. if the substring does not occur, this method returns -1. isalllowercase() returns true if all characters in the current string are lowercase; otherwise, returns false. isalluppercase() returns true if all characters in the current string are uppercase; otherwise, returns false. isalpha() returns true if all characters in the current string are unicode letters only; otherwise, returns false. isalphaspace() returns true if all characters in the current string are unicode letters or spaces only; otherwise, returns false. isalphanumeric() returns true if all characters in the current string are unicode letters or numbers only; otherwise, returns false. isalphanumericspace() returns true if all characters in the current string are unicode letters, numbers, or spaces only; otherwise, returns false. isasciiprintable() returns true if the current string contains only ascii printable characters; otherwise, returns false. isblank(inputstring) returns true if the specified string is white space, empty (''), or null; otherwise, returns false. isempty(inputstring) returns true if the specified string is empty ('') or null; otherwise, returns false. isnotblank(inputstring) returns true if the specified string is not whitespace, not empty (''), and not null; otherwise, returns false." "isnotempty(inputstring) returns true if the specified string is not empty ('') and not null; otherwise, returns false. 3346apex reference guide string class isnumeric() returns true if the current string contains only unicode digits; otherwise, returns false. isnumericspace() returns true if the current string contains only unicode digits or spaces; otherwise, returns false. iswhitespace() returns true if the current string contains only white space characters or is empty; otherwise, returns false. join(iterableobj, separator) joins the elements of the specified iterable object, such as a list, into a single string separated by the specified separator. lastindexof(substring) returns the index of the last occurrence of the specified substring. if the substring does not occur, this method returns -1. lastindexof(substring, endposition) returns the index of the last occurrence of the specified substring, starting from the character at index 0 and ending at the specified index. lastindexofchar(character) returns the index of the last occurrence of the character that corresponds to the specified character value. lastindexofchar(character, endindex) returns the index of the last occurrence of the character that corresponds to the specified character value, starting from the specified index. lastindexofignorecase(substring) returns the index of the last occurrence of the specified substring regardless of case. lastindexofignorecase(substring, endposition) returns the index of the last occurrence of the specified substring regardless of case, starting from the character at index 0 and ending at the specified index. left(length) returns the leftmost characters of the current string of the specified length. leftpad(length) returns the current string padded with spaces on the left and of the specified length. leftpad(length, padstr) returns the current string padded with string padstr on the left and of the specified length. length() returns the number of 16-bit unicode characters contained in the string. mid(startindex, length) returns a new string that begins with the character at the specified zero-based startindex with the number of characters specified by length. normalizespace() returns the current string with leading, trailing, and repeating white space characters removed. offsetbycodepoints(index, codepointoffset) returns the index of the unicode code point that is offset by the specified number of code points, starting from the given index. remove(substring) removes all occurrences of the specified substring and returns the string result. 3347apex reference guide string class removeend(substring) removes the specified substring only if it occurs at the end of the string. removeendignorecase(substring) removes the specified substring only if it occurs at the end of the string using a case-insensitive match. removestart(substring) removes the specified substring only if it occurs at the beginning of the string. removestartignorecase(substring) removes the specified substring only if it occurs at the beginning of the string using a case-insensitive match. repeat(numberoftimes) returns the current string repeated the specified number of times. repeat(separator, numberoftimes) returns the current string repeated the specified number of times using the specified separator to separate the repeated strings. replace(target, replacement) replaces each substring of a string that matches the literal target sequence target with the specified literal replacement sequence replacement. replaceall(regexp, replacement) replaces each substring of a string that matches the regular expression regexp with the replacement sequence replacement. replacefirst(regexp, replacement) replaces the first substring of a string that matches the regular expression regexp with the replacement sequence replacement. reverse() returns a string with all the characters reversed. right(length) returns the rightmost characters of the current string of the specified length. rightpad(length) returns the current string padded with spaces on the right and of the specified length. rightpad(length, padstr) returns the current string padded with string padstr on the right and of the specified length. split(regexp) returns a list that contains each substring of the string that is terminated by either the regular expression regexp or the end of the string. split(regexp, limit) returns a list that contains each substring of the string that is terminated by either the regular expression regexp or the end of the string. splitbycharactertype() splits the current string by character type and returns a" "list of contiguous character groups of the same type as complete tokens. splitbycharactertypecamelcase() splits the current string by character type and returns a list of contiguous character groups of the same type as complete tokens, with the following exception: the uppercase character, if any, immediately preceding a lowercase character token belongs to the following character token rather than to the preceding. startswith(prefix) returns true if the string that called the method begins with the specified prefix. 3348apex reference guide string class startswithignorecase(prefix) returns true if the current string begins with the specified prefix regardless of the prefix case. striphtmltags() removes html markup and returns plain text. substring(startindex) returns a new string that begins with the character at the specified zero-based startindex and extends to the end of the string. substring(startindex, endindex) returns a new string that begins with the character at the specified zero-based startindex and extends to the character at endindex - 1. substringafter(separator) returns the substring that occurs after the first occurrence of the specified separator. substringafterlast(separator) returns the substring that occurs after the last occurrence of the specified separator. substringbefore(separator) returns the substring that occurs before the first occurrence of the specified separator. substringbeforelast(separator) returns the substring that occurs before the last occurrence of the specified separator. substringbetween(tag) returns the substring that occurs between two instances of the specified tag string. substringbetween(open, close) returns the substring that occurs between the two specified strings. swapcase() swaps the case of all characters and returns the resulting string by using the default (english us) locale. tolowercase() converts all of the characters in the string to lowercase using the rules of the default (english us) locale. tolowercase(locale) converts all of the characters in the string to lowercase using the rules of the specified locale. touppercase() converts all of the characters in the string to uppercase using the rules of the default (english us) locale. touppercase(locale) converts all of the characters in the string to the uppercase using the rules of the specified locale. trim() returns a copy of the string that no longer contains any leading or trailing white space characters. uncapitalize() returns the current string with the first letter in lowercase. unescapecsv() returns a string representing an unescaped csv column. unescapeecmascript() unescapes any ecmascript literals found in the string. 3349apex reference guide string class unescapehtml3() unescapes the characters in a string using html 3.0 entities. unescapehtml4() unescapes the characters in a string using html 4.0 entities. unescapejava() returns a string whose java literals are unescaped. literals unescaped include escape sequences for quotes (\\"") and control characters, such as tab (\\t), and carriage return (\\n). unescapeunicode() returns a string whose escaped unicode characters are unescaped. unescapexml() unescapes the characters in a string using xml entities. valueof(datetoconvert) returns a string that represents the specified date in the standard “yyyy-mm-dd” format. valueof(datetimetoconvert) returns a string that represents the specified datetime in the standard “yyyy-mm-dd hh:mm:ss” format for the local time zone. valueof(decimaltoconvert) returns a string that represents the specified decimal. valueof(doubletoconvert) returns a string that represents the specified double. valueof(integertoconvert) returns a string that represents the specified integer. valueof(longtoconvert) returns a string that represents the specified long. valueof(toconvert) returns a string representation of the specified object argument. valueofgmt(datetimetoconvert) returns a string that represents the specified datetime in the standard “yyyy-mm-dd hh:mm:ss” format for the gmt time zone. abbreviate(maxwidth) returns an abbreviated version of the string, of the specified length and with ellipses appended if the current string is longer than the specified length" "; otherwise, returns the original string without ellipses. signature public string abbreviate(integer maxwidth) parameters maxwidth type: integer if maxwidth is less than four, this method throws a run-time exception. 3350apex reference guide string class return value type: string example string s = 'hello maximillian'; string s2 = s.abbreviate(8); system.assertequals('hello...', s2); system.assertequals(8, s2.length()); abbreviate(maxwidth, offset) returns an abbreviated version of the string, starting at the specified character offset and of the specified length. the returned string has ellipses appended at the start and the end if characters have been removed at these locations. signature public string abbreviate(integer maxwidth, integer offset) parameters maxwidth type: integer note that the offset is not necessarily the leftmost character in the returned string or the first character following the ellipses, but it appears somewhere in the result. regardless, abbreviate won’t return a string of length greater than maxwidth.if maxwidth is too small, this method throws a run-time exception. offset type: integer return value type: string example string s = 'hello maximillian'; // start at m string s2 = s.abbreviate(9,6); system.assertequals('...max...', s2); system.assertequals(9, s2.length()); capitalize() returns the current string with the first letter changed to title case. signature public string capitalize() 3351apex reference guide string class return value type: string usage this method is based on the character.totitlecase(char) java method. example string s = 'hello maximillian'; string s2 = s.capitalize(); system.assertequals('hello maximillian', s2); center(size) returns a version of the current string of the specified size padded with spaces on the left and right, so that it appears in the center. if the specified size is smaller than the current string size, the entire string is returned without added spaces. signature public string center(integer size) parameters size type: integer return value type: string example string s = 'hello'; string s2 = s.center(9); system.assertequals( ' hello ', s2); center(size, paddingstring) returns a version of the current string of the specified size padded with the specified string on the left and right, so that it appears in the center. if the specified size is smaller than the current string size, the entire string is returned without padding. signature public string center(integer size, string paddingstring) 3352apex reference guide string class parameters size type: integer paddingstring type: string return value type: string example string s = 'hello'; string s2 = s.center(9, '-'); system.assertequals('--hello--', s2); charat(index) returns the value of the character at the specified index. signature public integer charat(integer index) parameters index type: integer the index of the character to get the value of. return value type: integer the integer value of the character. usage the charat method returns the value of the character pointed to by the specified index. if the index points to the beginning of a surrogate pair (the high-surrogate code point), this method returns only the high-surrogate code point. to return the supplementary code point corresponding to a surrogate pair, call codepointat instead. example this example gets the value of the first character at index 0. string str = 'ω is omega.'; system.assertequals(937, str.charat(0)); 3353apex reference guide string class this example shows the difference between charat and codepointat. the example calls these methods on escaped supplementary unicode characters. charat(0) returns the high surrogate value, which corresponds to \ud835. codepointat(0) returns the value for the entire surrogate pair. string str = '\ud835\udd0a'; system.assertequals(55349, str.charat(0), 'charat(0) didn\'t return the high surrogate.'); system.assertequals(120074, str." "codepointat(0), 'codepointat(0) didn\'t return the entire two-character supplementary value.'); codepointat(index) returns the unicode code point value at the specified index. signature public integer codepointat(integer index) parameters index type: integer the index of the characters (unicode code units) in the string. the index range is from zero to the string length minus one. return value type: integer the unicode code point value at the specified index. usage if the index points to the beginning of a surrogate pair (the high-surrogate code point), and the character value at the following index points to the low-surrogate code point, this method returns the supplementary code point corresponding to this surrogate pair. otherwise, this method returns the character value at the given index. for more information on unicode and surrogate pairs, see the unicode consortium. example this example gets the code point value of the first character at index 0, which is the escaped omega character. also, the example gets the code point at index 20, which corresponds to the escaped supplementary unicode characters (a pair of characters). finally, it verifies that the escaped and unescaped forms of omega have the same code point values. the supplementary characters in this example (\\ud835\\udd0a) correspond to mathematical fraktur capital g: string str = '\u03a9 is ω (omega), and \ud835\udd0a ' + ' is fraktur capital g.'; system.assertequals(937, str.codepointat(0)); system.assertequals(120074, str.codepointat(20)); // escaped or unescaped forms of the same character have the same code point system.assertequals(str.codepointat(0), str.codepointat(5)); 3354apex reference guide string class codepointbefore(index) returns the unicode code point value that occurs before the specified index. signature public integer codepointbefore(integer index) parameters index type: integer the index before the unicode code point that is to be returned. the index range is from one to the string length. return value type: integer the character or unicode code point value that occurs before the specified index. usage if the character value at index-1 is the low-surrogate code point, and index-2 is not negative and the character at this index location is the high-surrogate code point, this method returns the supplementary code point corresponding to this surrogate pair. if the character value at index-1 is an unpaired low-surrogate or high-surrogate code point, the surrogate value is returned. for more information on unicode and surrogate pairs, see the unicode consortium. example this example gets the code point value of the first character (before index 1), which is the escaped omega character. also, the example gets the code point at index 20, which corresponds to the escaped supplementary characters (the two characters before index 22). string str = '\u03a9 is ω (omega), and \ud835\udd0a ' + ' is fraktur capital g.'; system.assertequals(937, str.codepointbefore(1)); system.assertequals(120074, str.codepointbefore(22)); codepointcount(beginindex, endindex) returns the number of unicode code points within the specified text range. signature public integer codepointcount(integer beginindex, integer endindex) parameters beginindex type: integer the index of the first character in the range. 3355apex reference guide string class endindex type: integer the index after the last character in the range. return value type: integer the number of unicode code points within the specified range. usage the specified range begins at beginindex and ends at endindex—1. unpaired surrogates within the text range count as one code point each. example this example writes the count of code points in a substring that contains an escaped unicode character and another substring that contains unicode supplementary characters, which count as one code point. string str = '\u03a9 and \ud835\udd0a characters.'; system.debug('count of code points for ' + str.substring(0,1) + ': ' + str.codepointcount(0,1)); system.debug('count of code points for ' + str.substring(6,8)" "+ ': ' + str.codepointcount(6,8)); // output: // count of code points for ω: 1 // count of code points for (cid:0)(cid:0): 1 compareto(secondstring) compares two strings lexicographically, based on the unicode value of each character in the strings. signature public integer compareto(string secondstring) parameters secondstring type: string return value type: integer usage the result is: • a negative integer if the string that called the method lexicographically precedes secondstring 3356apex reference guide string class • a positive integer if the string that called the method lexicographically follows compsecondstringstring • zero if the strings are equal if there is no index position at which the strings differ, then the shorter string lexicographically precedes the longer string. note that this method returns 0 whenever the equals method returns true. example string mystring1 = 'abcde'; string mystring2 = 'abcd'; integer result = mystring1.compareto(mystring2); system.assertequals(result, 1); contains(substring) returns true if and only if the string that called the method contains the specified sequence of characters in substring. signature public boolean contains(string substring) parameters substring type: string return value type: boolean example string mystring1 = 'abcde'; string mystring2 = 'abcd'; boolean result = mystring1.contains(mystring2); system.assertequals(result, true); containsany(inputstring) returns true if the current string contains any of the characters in the specified string; otherwise, returns false. signature public boolean containsany(string inputstring) parameters inputstring type: string 3357apex reference guide string class return value type: boolean example string s = 'hello'; boolean b1 = s.containsany('hx'); boolean b2 = s.containsany('x'); system.assertequals(true, b1); system.assertequals(false, b2); containsignorecase(substring) returns true if the current string contains the specified sequence of characters without regard to case; otherwise, returns false. signature public boolean containsignorecase(string substring) parameters substring type: string return value type: boolean example string s = 'hello'; boolean b = s.containsignorecase('he'); system.assertequals( true, b); containsnone(inputstring) returns true if the current string doesn’t contain any of the characters in the specified string; otherwise, returns false. signature public boolean containsnone(string inputstring) parameters inputstring type: string if inputstring is an empty string or the current string is empty, this method returns true. if inputstring is null, this method returns a run-time exception. 3358apex reference guide string class return value type: boolean example string s1 = 'abcde'; system.assert(s1.containsnone('fg')); containsonly(inputstring) returns true if the current string contains characters only from the specified sequence of characters and not any other characters; otherwise, returns false. signature public boolean containsonly(string inputstring) parameters inputstring type: string return value type: boolean example string s1 = 'abba'; string s2 = 'abba xyz'; boolean b1 = s1.containsonly('abcd'); system.assertequals( true, b1); boolean b2 = s2.containsonly('abcd'); system.assertequals( false, b2); containswhitespace() returns true if the current string contains any white space characters; otherwise, returns false. signature public boolean containswhitespace() 3359apex reference guide string class return value type: boolean example string s = 'hello jane'; system.assert(s.containswhitespace()); //true s = 'hellojane '; system.assert(s.containswhitespace()); //true s = ' hellojane'; system.assert(s.containswhitespace()); //true s = 'hellojane'; system.assert(!s.containswh" "itespace()); //false countmatches(substring) returns the number of times the specified substring occurs in the current string. signature public integer countmatches(string substring) parameters substring type: string return value type: integer example string s = 'hello jane'; system.assertequals(1, s.countmatches('hello')); s = 'hello hello'; system.assertequals(2, s.countmatches('hello')); s = 'hello hello'; system.assertequals(1, s.countmatches('hello')); deletewhitespace() returns a version of the current string with all white space characters removed. signature public string deletewhitespace() return value type: string 3360apex reference guide string class example string s1 = ' hello jane '; string s2 = 'hellojane'; system.assertequals(s2, s1.deletewhitespace()); difference(secondstring) returns the difference between the current string and the specified string. signature public string difference(string secondstring) parameters secondstring type: string if secondstring is an empty string, this method returns an empty string.if secondstring is null, this method throws a run-time exception. return value type: string example string s = 'hello jane'; string d1 = s.difference('hello max'); system.assertequals( 'max', d1); string d2 = s.difference('goodbye'); system.assertequals( 'goodbye', d2); endswith(suffix) returns true if the string that called the method ends with the specified suffix. signature public boolean endswith(string suffix) parameters suffix type: string 3361apex reference guide string class return value type: boolean example string s = 'hello jason'; system.assert(s.endswith('jason')); endswithignorecase(suffix) returns true if the current string ends with the specified suffix; otherwise, returns false. signature public boolean endswithignorecase(string suffix) parameters suffix type: string return value type: boolean example string s = 'hello jason'; system.assert(s.endswithignorecase('jason')); equals(secondstring) deprecated. this method is replaced by equals(stringorid). returns true if the passed-in string is not null and represents the same binary sequence of characters as the current string. use this method to perform case-sensitive comparisons. signature public boolean equals(string secondstring) parameters secondstring type: string return value type: boolean 3362apex reference guide string class usage this method returns true when the compareto method returns 0. use this method to perform case-sensitive comparisons. in contrast, the == operator performs case-insensitive string comparisons to match apex semantics. example string mystring1 = 'abcde'; string mystring2 = 'abcd'; boolean result = mystring1.equals(mystring2); system.assertequals(result, false); equals(stringorid) returns true if the passed-in object is not null and represents the same binary sequence of characters as the current string. use this method to compare a string to an object that represents a string or an id. signature public boolean equals(object stringorid) parameters stringorid type: object return value type: boolean usage if you compare id values, the lengths of ids don’t need to be equal. for example, if you compare a 15-character id string to an object that represents the equivalent 18-character id value, this method returns true. for more information about 15-character and 18-character ids, see the id data type. use this method to perform case-sensitive comparisons. in contrast, the == operator performs case-insensitive string comparisons to match apex semantics. example these examples show comparisons between different types of variables with both equal and unequal values. the examples also show how apex automatically converts certain values before comparing them. // compare a string to an object containing a string object obj1 = 'abc'; string str = 'abc'; boolean result1 = str.equals(obj1); system.assertequals(true, result1); // compare a string to an object containing a number 3363apex reference guide string class integer obj" "2 = 100; boolean result2 = str.equals(obj2); system.assertequals(false, result2); // compare a string to an id of the same length. // 15-character id id idvalue15 = '001d000000ju1zh'; // 15-character id string value string stringvalue15 = '001d000000ju1zh'; boolean result3 = stringvalue15.equals(idvalue15); system.assertequals(true, result3); // compare two equal id values of different lengths: // 15-character id and 18-character id id idvalue18 = '001d000000ju1zhiar'; boolean result4 = stringvalue15.equals(idvalue18); system.assertequals(true, result4); equalsignorecase(secondstring) returns true if the secondstring isn’t null and represents the same sequence of characters as the string that called the method, ignoring case. signature public boolean equalsignorecase(string secondstring) parameters secondstring type: string return value type: boolean usage the string.equalsignorecase() method ignores the locale of the context user. if you want the string comparison to be performed according to the locale, use the == operator instead. the string.equalsignorecase() method typically executes faster than the operator because the method ignores the locale. example string mystring1 = 'abcd'; string mystring2 = 'abcd'; boolean result = mystring1.equalsignorecase(mystring2); system.assertequals(result, true); 3364apex reference guide string class escapecsv() returns a string for a csv column enclosed in double quotes, if required. signature public string escapecsv() return value type: string usage if the string contains a comma, newline or double quote, the returned string is enclosed in double quotes. also, any double quote characters in the string are escaped with another double quote. if the string doesn’t contain a comma, newline or double quote, it is returned unchanged. example string s1 = 'max1, ""max2""'; string s2 = s1.escapecsv(); system.assertequals('""max1, """"max2""""""', s2); escapeecmascript() escapes the characters in the string using ecmascript string rules. signature public string escapeecmascript() return value type: string usage the only difference between apex strings and ecmascript strings is that in ecmascript, a single quote and forward-slash (/) are escaped. example string s1 = '""grade"": 3.9/4.0'; string s2 = s1.escapeecmascript(); system.debug(s2); // output is: // \""grade\"": 3.9\/4.0 system.assertequals( '\\""grade\\"": 3.9\\/4.0', s2); 3365apex reference guide string class escapehtml3() escapes the characters in a string using html 3.0 entities. signature public string escapehtml3() return value type: string example string s1 = '""""'; string s2 = s1.escapehtml3(); system.debug(s2); // output: // "<black& // white>" escapehtml4() escapes the characters in a string using html 4.0 entities. signature public string escapehtml4() return value type: string example string s1 = '""""'; string s2 = s1.escapehtml4(); system.debug(s2); // output: // "<black& // white>" escapejava() returns a string whose characters are escaped using java string rules. characters escaped include quotes and control characters, such as tab, backslash, and carriage return characters. 3366apex reference guide string class signature public string escapejava() return value type: string the escaped string. example // input string contains quotation marks string s = 'company: ""salesforce.com""'; string escapedstr = s.escapejava(); // output string has the quotes escpaded system." "assertequals('company: \\""salesforce.com\\""', escapedstr); escapesinglequotes(stringtoescape) returns a string with the escape character (\) added before any single quotation marks in the string s. signature public static string escapesinglequotes(string stringtoescape) parameters stringtoescape type: string return value type: string usage this method is useful when creating a dynamic soql statement, to help prevent soql injection. for more information on dynamic soql, see dynamic soql. example string s = '\'hello jason\''; system.debug(s); // outputs 'hello jason' string escapedstr = string.escapesinglequotes(s); // outputs \'hello jason\' system.debug(escapedstr); // escapes the string \\\' to string \' system.assertequals('\\\'hello jason\\\'', escapedstr); 3367apex reference guide string class escapeunicode() returns a string whose unicode characters are escaped to a unicode escape sequence. signature public string escapeunicode() return value type: string the escaped string. example string s = 'de onde você é?'; string escapedstr = s.escapeunicode(); system.assertequals('de onde voc\\u00ea \\u00e9?', escapedstr); escapexml() escapes the characters in a string using xml entities. signature public string escapexml() return value type: string usage supports only the five basic xml entities (gt, lt, quot, amp, apos). does not support dtds or external entities. unicode characters greater than 0x7f are not escaped. example string s1 = '""""'; string s2 = s1.escapexml(); system.debug(s2); // output: // "<black& // white>" 3368apex reference guide string class format(stringtoformat, formattingarguments) treat the first argument as a pattern and return a string using the second argument for substitution and formatting. the substitution and formatting are the same as apex:outputtext and the java messageformat class. non-string types in the second argument’s list are implicitly converted to strings, respecting the tostring() method overrides that exist on the type. signature public static string format(string stringtoformat, list formattingarguments) parameters stringtoformat type: string formattingarguments type: list return value type: string versioned behavior changes from version 51.0 and later, the format() method supports single quotes in the stringtoformat parameter and returns a formatted string using the formattingarguments parameter. in version 50.0 and earlier, single quotes weren’t supported. example string template = '{0} was last updated {1}'; list parameters = new list {'universal containers', datetime.newinstance(2018, 11, 15) }; string formatted = string.format(template, parameters); system.debug ('newly formatted string is:' + formatted); fromchararray(chararray) returns a string from the values of the list of integers. signature public static string fromchararray(list chararray) parameters chararray type: list return value type: string 3369apex reference guide string class example list chararr= new integer[]{74}; string convertedchar = string.fromchararray(chararr); system.assertequals('j', convertedchar); getchars() returns an array of character values that represent the characters in this string. signature public list getchars() return value type: list a list of integers, each corresponding to a character value in the string. example this sample converts a string to a character array and then gets the first array element, which corresponds to the value of 'j'. string str = 'jane goes fishing.'; integer[] chars = str.getchars(); // get the value of 'j' system.assertequals(74, chars[0]); getcommonprefix(strings) returns the initial sequence of characters as a string that is common to all the specified strings. signature public static string getcommonprefix(list strings) parameters strings" "type: list return value type: string example list ls = new list{'sfdcapex', 'sfdcvisualforce'}; string prefix = string.getcommonprefix(ls); system.assertequals('sfdc', prefix); 3370apex reference guide string class getlevenshteindistance(stringtocompare) returns the levenshtein distance between the current string and the specified string. signature public integer getlevenshteindistance(string stringtocompare) parameters stringtocompare type: string return value type: integer usage the levenshtein distance is the number of changes needed to change one string into another. each change is a single character modification (deletion, insertion or substitution). example string s = 'hello joe'; integer i = s.getlevenshteindistance('hello max'); system.assertequals(3, i); getlevenshteindistance(stringtocompare, threshold) returns the levenshtein distance between the current string and the specified string if it is less than or equal than the given threshold; otherwise, returns -1. signature public integer getlevenshteindistance(string stringtocompare, integer threshold) parameters stringtocompare type: string threshold type: integer return value type: integer 3371apex reference guide string class usage the levenshtein distance is the number of changes needed to change one string into another. each change is a single character modification (deletion, insertion or substitution). example: in this example, the levenshtein distance is 3, but the threshold argument is 2, which is less than the distance, so this method returns -1. example string s = 'hello jane'; integer i = s.getlevenshteindistance('hello max', 2); system.assertequals(-1, i); hashcode() returns a hash code value for this string. signature public integer hashcode() return value type: integer usage this value is based on the hash code computed by the java string.hashcode counterpart method. you can use this method to simplify the computation of a hash code for a custom type that contains string member variables. you can compute your type’s hash code value based on the hash code of each string variable. for example: for more details about the use of hash code methods with custom types, see using custom types in map keys and sets. example public class mycustomclass { string x,y; // provide a custom hash code public integer hashcode() { return (31*x.hashcode())^(y.hashcode()); } } indexof(substring) returns the index of the first occurrence of the specified substring. if the substring does not occur, this method returns -1. 3372apex reference guide string class signature public integer indexof(string substring) parameters substring type: string return value type: integer example string mystring1 = 'abcde'; string mystring2 = 'cd'; integer result = mystring1.indexof(mystring2); system.assertequals(2, result); indexof(substring, index) returns the zero-based index of the first occurrence of the specified substring from the point of the given index. if the substring does not occur, this method returns -1. signature public integer indexof(string substring, integer index) parameters substring type: string index type: integer return value type: integer example string mystring1 = 'abcdabcd'; string mystring2 = 'ab'; integer result = mystring1.indexof(mystring2, 1); system.assertequals(4, result); indexofany(substring) returns the zero-based index of the first occurrence of any character specified in the substring. if none of the characters occur, returns -1. 3373apex reference guide string class signature public integer indexofany(string substring) parameters substring type: string return value type: integer example string s1 = 'abcd'; string s2 = 'xc'; integer result = s1.indexofany(s2); system.assertequals(2, result); indexofanybut(substring) returns the zero-based index of the first occurrence of a character that is not in" "the specified substring. otherwise, returns -1. signature public integer indexofanybut(string substring) parameters substring type: string return value type: integer example string s1 = 'abcd'; string s2 = 'xc'; integer result = s1.indexofanybut(s2); system.assertequals(0, result); indexofchar(character) returns the index of the first occurrence of the character that corresponds to the specified character value. signature public integer indexofchar(integer character) 3374apex reference guide string class parameters character type: integer the integer value of the character in the string. return value type: integer the index of the first occurrence of the specified character, -1 if the character is not found. usage the index that this method returns is in unicode code units. example string str = '\\u03a9 is ω (omega)'; // returns 0, which is the first character. system.debug('indexofchar(937)=' + str.indexofchar(937)); // output: // indexofchar(937)=0 indexofchar(character, startindex) returns the index of the first occurrence of the character that corresponds to the specified character value, starting from the specified index. signature public integer indexofchar(integer character, integer startindex) parameters character type: integer the integer value of the character to look for. startindex type: integer the index to start the search from. return value type: integer the index, starting from the specified start index, of the first occurrence of the specified character, -1 if the character is not found. 3375apex reference guide string class usage the index that this method returns is in unicode code units. example this example shows different ways of searching for the index of the omega character. the first call to indexofchar doesn’t specify a start index and therefore the returned index is 0, which is the first occurrence of omega in the entire string. the subsequent calls specify a start index to find the occurrence of omega in substrings that start at the specified index. string str = 'ω and \\u03a9 and ω'; system.debug('indexofchar(937)=' + str.indexofchar(937)); system.debug('indexofchar(937,1)=' + str.indexofchar(937,1)); system.debug('indexofchar(937,10)=' + str.indexofchar(937,10)); // output: // indexofchar(937)=0 // indexofchar(937,1)=6, (corresponds to the escaped form \\u03a9) // indexofchar(937,10)=12 indexofdifference(stringtocompare) returns the zero-based index of the character where the current string begins to differ from the specified string. signature public integer indexofdifference(string stringtocompare) parameters stringtocompare type: string return value type: integer example string s1 = 'abcd'; string s2 = 'abxc'; integer result = s1.indexofdifference(s2); system.assertequals(2, result); indexofignorecase(substring) returns the zero-based index of the first occurrence of the specified substring without regard to case. if the substring does not occur, this method returns -1. signature public integer indexofignorecase(string substring) 3376apex reference guide string class parameters substring type: string return value type: integer example string s1 = 'abcd'; string s2 = 'bc'; integer result = s1.indexofignorecase(s2, 0); system.assertequals(1, result); indexofignorecase(substring, startposition) returns the zero-based index of the first occurrence of the specified substring from the point of index i, without regard to case. if the substring does not occur, this method returns -1. signature public integer indexofignorecase(string substring, integer startposition) parameters substring type: string startposition type: integer return value type: integer isalllowercase() returns true if all characters in the current string are lowercase; otherwise, returns false. signature public boolean isalllowercase() return value type" ": boolean 3377apex reference guide string class example string alllower = 'abcde'; system.assert(alllower.isalllowercase()); isalluppercase() returns true if all characters in the current string are uppercase; otherwise, returns false. signature public boolean isalluppercase() return value type: boolean example string allupper = 'abcde'; system.assert(allupper.isalluppercase()); isalpha() returns true if all characters in the current string are unicode letters only; otherwise, returns false. signature public boolean isalpha() return value type: boolean example // letters only string s1 = 'abc'; // returns true boolean b1 = s1.isalpha(); system.assertequals( true, b1); // letters and numbers string s2 = 'abc 21'; // returns false boolean b2 = s2.isalpha(); system.assertequals( false, b2); 3378apex reference guide string class isalphaspace() returns true if all characters in the current string are unicode letters or spaces only; otherwise, returns false. signature public boolean isalphaspace() return value type: boolean example string alphaspace = 'aa bb'; system.assert(alphaspace.isalphaspace()); string notalphaspace = 'ab 12'; system.assert(!notalphaspace.isalphaspace()); notalphaspace = 'aa$bb'; system.assert(!notalphaspace.isalphaspace()); isalphanumeric() returns true if all characters in the current string are unicode letters or numbers only; otherwise, returns false. signature public boolean isalphanumeric() return value type: boolean example // letters only string s1 = 'abc'; // returns true boolean b1 = s1.isalphanumeric(); system.assertequals( true, b1); // letters and numbers string s2 = 'abc021'; // returns true boolean b2 = s2.isalphanumeric(); system.assertequals( true, b2); 3379apex reference guide string class isalphanumericspace() returns true if all characters in the current string are unicode letters, numbers, or spaces only; otherwise, returns false. signature public boolean isalphanumericspace() return value type: boolean example string alphanumspace = 'ae 86'; system.assert(alphanumspace.isalphanumericspace()); string notalphanumspace = 'aa$12'; system.assert(!notalphanumspace.isalphaspace()); isasciiprintable() returns true if the current string contains only ascii printable characters; otherwise, returns false. signature public boolean isasciiprintable() return value type: boolean example string ascii = 'abcd1234!@#$%^&*()`~-_+={[}]|:<,>.?'; system.assert(ascii.isasciiprintable()); string notascii = '√'; system.assert(!notascii.isasciiprintable()); isblank(inputstring) returns true if the specified string is white space, empty (''), or null; otherwise, returns false. signature public static boolean isblank(string inputstring) parameters inputstring type: string 3380apex reference guide string class return value type: boolean example string blank = ''; string nullstring = null; string whitespace = ' '; system.assert(string.isblank(blank)); system.assert(string.isblank(nullstring)); system.assert(string.isblank(whitespace)); string alpha = 'hello'; system.assert(!string.isblank(alpha)); isempty(inputstring) returns true if the specified string is empty ('') or null; otherwise, returns false. signature public static boolean isempty(string inputstring) parameters inputstring type: string return value type: boolean example string empty = ''; string nullstring = null; system.assert(string.isempty(empty)); system.assert(string.isempty(nullstring)); string whitespace = ' '; string alpha = 'hello'; system.assert(" "!string.isempty(whitespace)); system.assert(!string.isempty(alpha)); isnotblank(inputstring) returns true if the specified string is not whitespace, not empty (''), and not null; otherwise, returns false. signature public static boolean isnotblank(string inputstring) 3381apex reference guide string class parameters inputstring type: string return value type: boolean example string alpha = 'hello world!'; system.assert(string.isnotblank(alpha)); string blank = ''; string nullstring = null; string whitespace = ' '; system.assert(!string.isnotblank(blank)); system.assert(!string.isnotblank(nullstring)); system.assert(!string.isnotblank(whitespace)); isnotempty(inputstring) returns true if the specified string is not empty ('') and not null; otherwise, returns false. signature public static boolean isnotempty(string inputstring) parameters inputstring type: string return value type: boolean example string whitespace = ' '; string alpha = 'hello world!'; system.assert(string.isnotempty(whitespace)); system.assert(string.isnotempty(alpha)); string empty = ''; string nullstring = null; system.assert(!string.isnotempty(empty)); system.assert(!string.isnotempty(nullstring)); isnumeric() returns true if the current string contains only unicode digits; otherwise, returns false. 3382" "apex reference guide string class signature public boolean isnumeric() return value type: boolean usage a decimal point (1.2) is not a unicode digit. example string numeric = '1234567890'; system.assert(numeric.isnumeric()); string alphanumeric = 'r32'; string decimalpoint = '1.2'; system.assert(!alphanumeric.isnumeric()); system.assert(!decimalpoint.isnumeric()); isnumericspace() returns true if the current string contains only unicode digits or spaces; otherwise, returns false. signature public boolean isnumericspace() return value type: boolean usage a decimal point (1.2) is not a unicode digit. example string numericspace = '1 2 3'; system.assert(numericspace.isnumericspace()); string notnumericspace = 'fd3s fc3s'; system.assert(!notnumericspace.isnumericspace()); iswhitespace() returns true if the current string contains only white space characters or is empty; otherwise, returns false. signature public boolean iswhitespace() 3383apex reference guide string class return value type: boolean example string whitespace = ' '; string blank = ''; system.assert(whitespace.iswhitespace()); system.assert(blank.iswhitespace()); string alphanum = 'sil80'; system.assert(!alphanum.iswhitespace()); join(iterableobj, separator) joins the elements of the specified iterable object, such as a list, into a single string separated by the specified separator. signature public static string join(object iterableobj, string separator) parameters iterableobj type: object separator type: string return value type: string usage list li = new list {10, 20, 30}; string s = string.join( li, '/'); system.assertequals( '10/20/30', s); lastindexof(substring) returns the index of the last occurrence of the specified substring. if the substring does not occur, this method returns -1. signature public integer lastindexof(string substring) 3384apex reference guide string class parameters substring type: string return value type: integer example string s1 = 'abcdefgc'; integer i1 = s1.lastindexof('c'); system.assertequals(7, i1); lastindexof(substring, endposition) returns the index of the last occurrence of the specified substring, starting from the character at index 0 and ending at the specified index. signature public integer lastindexof(string substring, integer endposition) parameters substring type: string endposition type: integer return value type: integer usage if the substring doesn’t occur or endposition is negative, this method returns -1. if endposition is larger than the last index in the current string, the entire string is searched. example string s1 = 'abcdaacd'; integer i1 = s1.lastindexof('c', 7); system.assertequals(6, i1); integer i2 = s1.lastindexof('c', 3); system.assertequals(2, i2); lastindexofchar(character) returns the index of the last occurrence of the character that corresponds to the specified character value. 3385apex reference guide string class signature public integer lastindexofchar(integer character) parameters character type: integer the integer value of the character in the string. return value type: integer the index of the last occurrence of the specified character, -1 if the character is not found. usage the index that this method returns is in unicode code units. example string str = '\u03a9 is ω (omega)'; // get the last occurrence of omega. system.assertequals(5, str.lastindexofchar(937)); lastindexofchar(character, endindex) returns the index of the last occurrence of the character that corresponds to the specified character value, starting from the specified index. signature public integer lastindexofchar(integer character, integer endindex) parameters character type: integer the integer value of" "the character to look for. endindex type: integer the index to end the search at. return value type: integer the index, starting from the specified start index, of the last occurrence of the specified character. -1 if the character is not found. 3386apex reference guide string class usage the index that this method returns is in unicode code units. example this example shows different ways of searching for the index of the last occurrence of the omega character. the first call to lastindexofchar doesn’t specify an end index and therefore the returned index is 12, which is the last occurrence of omega in the entire string. the subsequent calls specify an end index to find the last occurrence of omega in substrings. string str = 'ω and \u03a9 and ω'; system.assertequals(12, str.lastindexofchar(937)); system.assertequals(6, str.lastindexofchar(937,11)); system.assertequals(0, str.lastindexofchar(937,5)); lastindexofignorecase(substring) returns the index of the last occurrence of the specified substring regardless of case. signature public integer lastindexofignorecase(string substring) parameters substring type: string return value type: integer usage if the substring doesn’t occur, this method returns -1. example string s1 = 'abcdaacd'; integer i1 = s1.lastindexofignorecase('daac'); system.assertequals(3, i1); lastindexofignorecase(substring, endposition) returns the index of the last occurrence of the specified substring regardless of case, starting from the character at index 0 and ending at the specified index. signature public integer lastindexofignorecase(string substring, integer endposition) 3387apex reference guide string class parameters substring type: string endposition type: integer return value type: integer usage if the substring doesn’t occur or endposition is negative, this method returns -1. if endposition is larger than the last index in the current string, the entire string is searched. example string s1 = 'abcdaacd'; integer i1 = s1.lastindexofignorecase('c', 7); system.assertequals(6, i1); left(length) returns the leftmost characters of the current string of the specified length. signature public string left(integer length) parameters length type: integer return value type: string usage if length is greater than the string size, the entire string is returned. example string s1 = 'abcdaacd'; string s2 = s1.left(3); system.assertequals('abc', s2); 3388apex reference guide string class leftpad(length) returns the current string padded with spaces on the left and of the specified length. signature public string leftpad(integer length) parameters length type: integer usage if length is less than or equal to the current string size, the entire string is returned without space padding. return value type: string example string s1 = 'abc'; string s2 = s1.leftpad(5); system.assertequals(' abc', s2); leftpad(length, padstr) returns the current string padded with string padstr on the left and of the specified length. signature public string leftpad(integer length, string padstr) parameters length type: integer padstr type: string string to pad with; if null or empty treated as single blank. usage if length is less than or equal to the current string size, the entire string is returned without space padding. return value type: string 3389apex reference guide string class example string s1 = 'abc'; string s2 = 'xy'; string s3 = s1.leftpad(7,s2); system.assertequals('xyxyabc', s3); length() returns the number of 16-bit unicode characters contained in the string. signature public integer length() return value type: integer example string mystring = 'abcd'; integer result = mystring.length(); system.assertequals(result, 4); mid(startindex, length) returns a new string that begins with the character at the specified zero-based startindex with" "the number of characters specified by length. signature public string mid(integer startindex, integer length) parameters startindex type: integer if startindex is negative, it is considered to be zero. length type: integer if length is negative or zero, an empty string is returned. if length is greater than the remaining characters, the remainder of the string is returned. return value type: string 3390apex reference guide string class usage this method is similar to the substring(startindex) and substring(startindex, endindex) methods, except that the second argument is the number of characters to return. example string s = 'abcde'; string s2 = s.mid(2, 3); system.assertequals( 'cde', s2); normalizespace() returns the current string with leading, trailing, and repeating white space characters removed. signature public string normalizespace() return value type: string usage this method normalizes the following white space characters: space, tab (\t), new line (\n), carriage return (\r), and form feed (\f). example string s1 = 'salesforce \t force.com'; string s2 = s1.normalizespace(); system.assertequals( 'salesforce force.com', s2); offsetbycodepoints(index, codepointoffset) returns the index of the unicode code point that is offset by the specified number of code points, starting from the given index. signature public integer offsetbycodepoints(integer index, integer codepointoffset) parameters index type: integer the start index in the string. 3391apex reference guide string class codepointoffset type: integer the number of code points to be offset. return value type: integer the index that corresponds to the start index that is added to the offset. usage unpaired surrogates within the text range that is specified by index and codepointoffset count as one code point each. example this example calls offsetbycodepoints on a string with a start index of 0 (to start from the first character) and an offset of three code points. the string contains one sequence of supplementary characters in escaped form (a pair of characters). after an offset of three code points when counting from the beginning of the string, the returned code point index is four. string str = 'a \ud835\udd0a bc'; system.assertequals(4, str.offsetbycodepoints(0,3)); remove(substring) removes all occurrences of the specified substring and returns the string result. signature public string remove(string substring) parameters substring type: string return value type: string example string s1 = 'salesforce and force.com'; string s2 = s1.remove('force'); system.assertequals( 'sales and .com', s2); removeend(substring) removes the specified substring only if it occurs at the end of the string. 3392apex reference guide string class signature public string removeend(string substring) parameters substring type: string return value type: string example string s1 = 'salesforce and force.com'; string s2 = s1.removeend('.com'); system.assertequals( 'salesforce and force', s2); removeendignorecase(substring) removes the specified substring only if it occurs at the end of the string using a case-insensitive match. signature public string removeendignorecase(string substring) parameters substring type: string return value type: string example string s1 = 'salesforce and force.com'; string s2 = s1.removeendignorecase('.com'); system.assertequals('salesforce and force', s2); removestart(substring) removes the specified substring only if it occurs at the beginning of the string. signature public string removestart(string substring) 3393apex reference guide string class parameters substring type: string return value type: string example string s1 = 'salesforce and force.com'; string s2 = s1.removestart('sales'); system.assertequals( 'force and force.com', s2); removestartignorecase(substring) removes the specified substring only if it occurs at" "the beginning of the string using a case-insensitive match. signature public string removestartignorecase(string substring) parameters substring type: string return value type: string example string s1 = 'salesforce and force.com'; string s2 = s1.removestartignorecase('sales'); system.assertequals( 'force and force.com', s2); repeat(numberoftimes) returns the current string repeated the specified number of times. signature public string repeat(integer numberoftimes) 3394apex reference guide string class parameters numberoftimes type: integer return value type: string example string s1 = 'sfdc'; string s2 = s1.repeat(2); system.assertequals('sfdcsfdc', s2); repeat(separator, numberoftimes) returns the current string repeated the specified number of times using the specified separator to separate the repeated strings. signature public string repeat(string separator, integer numberoftimes) parameters separator type: string numberoftimes type: integer return value type: string example string s1 = 'sfdc'; string s2 = s1.repeat('-', 2); system.assertequals( 'sfdc-sfdc', s2); replace(target, replacement) replaces each substring of a string that matches the literal target sequence target with the specified literal replacement sequence replacement. signature public string replace(string target, string replacement) 3395apex reference guide string class parameters target type: string replacement type: string return value type: string example string s1 = 'abcdbca'; string target = 'bc'; string replacement = 'xy'; string s2 = s1.replace(target, replacement); system.assertequals('axydxya', s2); replaceall(regexp, replacement) replaces each substring of a string that matches the regular expression regexp with the replacement sequence replacement. signature public string replaceall(string regexp, string replacement) parameters regexp type: string replacement type: string return value type: string usage see the java pattern class for information on regular expressions. example string s1 = 'a b c 5 xyz'; string regexp = '[a-za-z]'; string replacement = '1'; string s2 = s1.replaceall(regexp, replacement); system.assertequals('1 1 1 5 111', s2); 3396apex reference guide string class replacefirst(regexp, replacement) replaces the first substring of a string that matches the regular expression regexp with the replacement sequence replacement. signature public string replacefirst(string regexp, string replacement) parameters regexp type: string replacement type: string return value type: string usage see the java pattern class for information on regular expressions. example string s1 = 'a b c 11 xyz'; string regexp = '[a-za-z]{2}'; string replacement = '2'; string s2 = s1.replacefirst(regexp, replacement); system.assertequals('a b c 11 2z', s2); reverse() returns a string with all the characters reversed. signature public string reverse() return value type: string right(length) returns the rightmost characters of the current string of the specified length. signature public string right(integer length) 3397apex reference guide string class parameters length type: integer if length is greater than the string size, the entire string is returned. return value type: string example string s1 = 'hello max'; string s2 = s1.right(3); system.assertequals( 'max', s2); rightpad(length) returns the current string padded with spaces on the right and of the specified length. signature public string rightpad(integer length) parameters length type: integer if length is less than or equal to the current string size, the entire string is returned without space padding. return value type: string example string s1 = 'abc'; string s2 = s1.rightpad(5); system.assertequals( 'abc ', s2); rightpad(length, padstr) returns the current string" "padded with string padstr on the right and of the specified length. 3398apex reference guide string class signature public string rightpad(integer length, string padstr) parameters length type: integer padstr type: string string to pad with; if null or empty treated as single blank. usage if length is less than or equal to the current string size, the entire string is returned without space padding. return value type: string example string s1 = 'abc'; string s2 = 'xy'; string s3 = s1.rightpad(7, s2); system.assertequals('abcxyxy', s3); split(regexp) returns a list that contains each substring of the string that is terminated by either the regular expression regexp or the end of the string. signature public string[] split(string regexp) parameters regexp type: string return value type: string[] note: in api version 34.0 and earlier, a zero-width regexp value produces an empty list item at the beginning of the method’s output. usage see the java pattern class for information on regular expressions. 3399apex reference guide string class the substrings are placed in the list in the order in which they occur in the string.if regexp does not match any part of the string, the resulting list has just one element containing the original string. example in the following example, a string is split using a backslash as a delimiter. public string splitpath(string filename) { if (filename == null) return null; list parts = filename.split('\\\\'); filename = parts[parts.size()-1]; return filename; } // for example, if the file path is e:\\processed\\ppdsf100111.csv // this method splits the path and returns the last part. // returned filename is ppdsf100111.csv split(regexp, limit) returns a list that contains each substring of the string that is terminated by either the regular expression regexp or the end of the string. signature public string[] split(string regexp, integer limit) parameters regexp type: string a regular expression. limit type: integer return value type: string[] note: in api version 34.0 and earlier, a zero-width regexp value produces an empty list item at the beginning of the method’s output. usage the optional limit parameter controls the number of times the pattern is applied and therefore affects the length of the list. • if limit is greater than zero: – the pattern is applied a maximum of (limit – 1) times. – the list’s length is no greater than limit. – the list’s last entry contains all input beyond the last matched delimiter. 3400apex reference guide string class • if limit is non-positive, the pattern is applied as many times as possible, and the list can have any length. • if limit is zero, the pattern is applied as many times as possible, the list can have any length, and trailing empty strings are discarded. example for example, for string s = 'boo:and:moo': • s.split(':', 2) results in {'boo', 'and:moo'} • s.split(':', 5) results in {'boo', 'and', 'moo'} • s.split(':', -2) results in {'boo', 'and', 'moo'} • s.split('o', 5) results in {'b', '', ':and:m', '', ''} • s.split('o', -2) results in {'b', '', ':and:m', '', ''} • s.split('o', 0) results in {'b', '', ':and:m'} splitbycharactertype() splits the current string by character type and returns a list of contiguous character groups of the same type as complete tokens. signature public list splitbycharactertype() return value type: list usage for more information about the character types used, see java.lang.character.gettype(char). example string s1 = 'lightning.platform'; list ls = s1.splitbycharactertype(); system.debug(ls); // writes this output: // (l, ightning, ., platform" ") splitbycharactertypecamelcase() splits the current string by character type and returns a list of contiguous character groups of the same type as complete tokens, with the following exception: the uppercase character, if any, immediately preceding a lowercase character token belongs to the following character token rather than to the preceding. signature public list splitbycharactertypecamelcase() 3401apex reference guide string class return value type: list usage for more information about the character types used, see java.lang.character.gettype(char). example string s1 = 'lightning.platform'; list ls = s1.splitbycharactertypecamelcase(); system.debug(ls); // writes this output: // (lightning, ., platform) startswith(prefix) returns true if the string that called the method begins with the specified prefix. signature public boolean startswith(string prefix) parameters prefix type: string return value type: boolean example string s1 = 'ae86 vs ek9'; system.assert(s1.startswith('ae86')); startswithignorecase(prefix) returns true if the current string begins with the specified prefix regardless of the prefix case. signature public boolean startswithignorecase(string prefix) parameters prefix type: string 3402apex reference guide string class return value type: boolean example string s1 = 'ae86 vs ek9'; system.assert(s1.startswithignorecase('ae86')); striphtmltags() removes html markup and returns plain text. signature public string striphtmltags(string htmlinput) return value type: string usage warning: the striphtmltags function does not recursively strip tags; therefore, tags may still exist in the returned string. do not use the striphtmltags function to sanitize input for inclusion as a raw html page. the unescaped output is not considered safe to include in an html document. the function will be deprecated in a future release. example string s1 = 'hello world'; string s2 = s1.striphtmltags(); system.assertequals( 'hello world', s2); substring(startindex) returns a new string that begins with the character at the specified zero-based startindex and extends to the end of the string. signature public string substring(integer startindex) parameters startindex type: integer return value type: string 3403apex reference guide string class example string s1 = 'hamburger'; system.assertequals('burger', s1.substring(3)); substring(startindex, endindex) returns a new string that begins with the character at the specified zero-based startindex and extends to the character at endindex - 1. signature public string substring(integer startindex, integer endindex) parameters startindex type: integer endindex type: integer return value type: string example 'hamburger'.substring(4, 8); // returns ""urge"" 'smiles'.substring(1, 5); // returns ""mile"" substringafter(separator) returns the substring that occurs after the first occurrence of the specified separator. signature public string substringafter(string separator) parameters separator type: string return value type: string 3404apex reference guide string class example string s1 = 'salesforce.lightning.platform'; string s2 = s1.substringafter('.'); system.assertequals( 'lightning.platform', s2); substringafterlast(separator) returns the substring that occurs after the last occurrence of the specified separator. signature public string substringafterlast(string separator) parameters separator type: string return value type: string example string s1 = 'salesforce.lightning.platform'; string s2 = s1.substringafterlast('.'); system.assertequals( 'platform', s2); substringbefore(separator) returns the substring that occurs before the first occurrence of the specified separator. signature public string substringbefore(string separator) parameters separator type: string return value type: string" "3405apex reference guide string class example string s1 = 'salesforce.lightning.platform'; string s2 = s1.substringbefore('.'); system.assertequals( 'salesforce', s2); substringbeforelast(separator) returns the substring that occurs before the last occurrence of the specified separator. signature public string substringbeforelast(string separator) parameters separator type: string return value type: string example string s1 = 'salesforce.lightning.platform'; string s2 = s1.substringbeforelast('.'); system.assertequals( 'salesforce.lightning', s2); substringbetween(tag) returns the substring that occurs between two instances of the specified tag string. signature public string substringbetween(string tag) parameters tag type: string return value type: string 3406apex reference guide string class example string s1 = 'tagyellowtag'; string s2 = s1.substringbetween('tag'); system.assertequals('yellow', s2); substringbetween(open, close) returns the substring that occurs between the two specified strings. signature public string substringbetween(string open, string close) parameters open type: string close type: string return value type: string example string s1 = 'xyellowy'; string s2 = s1.substringbetween('x','y'); system.assertequals( 'yellow', s2); swapcase() swaps the case of all characters and returns the resulting string by using the default (english us) locale. signature public string swapcase() return value type: string usage upper case and title case converts to lower case, and lower case converts to upper case. 3407apex reference guide string class example string s1 = 'force.com'; string s2 = s1.swapcase(); system.assertequals('force.com', s2); tolowercase() converts all of the characters in the string to lowercase using the rules of the default (english us) locale. signature public string tolowercase() return value type: string example string s1 = 'this is hard to read'; system.assertequals('this is hard to read', s1.tolowercase()); tolowercase(locale) converts all of the characters in the string to lowercase using the rules of the specified locale. signature public string tolowercase(string locale) parameters locale type: string return value type: string example // example in turkish // an uppercase dotted ""i"", \u0304, which is i̇ // note this contains both a i̇ as well as a i string s1 = 'kiymetli̇'; string s1lower = s1.tolowercase('tr'); // dotless lowercase ""i"", \u0131, which is ı // note this has both a i and ı string expected = 'kıymetli'; 3408apex reference guide string class system.assertequals(expected, s1lower); // note if this was done in tolowercase(‘en’), it would output ‘kiymetli’ touppercase() converts all of the characters in the string to uppercase using the rules of the default (english us) locale. signature public string touppercase() return value type: string example string mystring1 = 'abcd'; string mystring2 = 'abcd'; mystring1 = mystring1.touppercase(); boolean result = mystring1.equals(mystring2); system.assertequals(result, true); touppercase(locale) converts all of the characters in the string to the uppercase using the rules of the specified locale. signature public string touppercase(string locale) parameters locale type: string return value type: string example // example in turkish // dotless lowercase ""i"", \u0131, which is ı // note this has both a i and ı string s1 = 'imkansız'; string s1upper = s1.touppercase" "('tr'); // an uppercase dotted ""i"", \u0304, which is i̇ // note this contains both a i̇ as well as a i 3409apex reference guide string class string expected = 'i̇mkansiz'; system.assertequals(expected, s1upper); trim() returns a copy of the string that no longer contains any leading or trailing white space characters. signature public string trim() return value type: string usage leading and trailing ascii control characters such as tabs and newline characters are also removed. white space and control characters that aren’t at the beginning or end of the sentence aren’t removed. example string s1 = ' hello! '; string trimmed = s1.trim(); system.assertequals('hello!', trimmed); uncapitalize() returns the current string with the first letter in lowercase. signature public string uncapitalize() return value type: string example string s1 = 'hello max'; string s2 = s1.uncapitalize(); system.assertequals( 'hello max', s2); 3410apex reference guide string class unescapecsv() returns a string representing an unescaped csv column. signature public string unescapecsv() return value type: string usage if the string is enclosed in double quotes and contains a comma, newline or double quote, quotes are removed. also, any double quote escaped characters (a pair of double quotes) are unescaped to just one double quote. if the string is not enclosed in double quotes, or is and does not contain a comma, newline or double quote, it is returned unchanged. example string s1 = '""max1, """"max2""""""'; string s2 = s1.unescapecsv(); system.assertequals( 'max1, ""max2""', s2); unescapeecmascript() unescapes any ecmascript literals found in the string. signature public string unescapeecmascript() return value type: string example string s1 = '\""3.8\"",\""3.9\""'; string s2 = s1.unescapeecmascript(); system.assertequals( '""3.8"",""3.9""', s2); 3411apex reference guide string class unescapehtml3() unescapes the characters in a string using html 3.0 entities. signature public string unescapehtml3() return value type: string example string s1 = '"<black&white>"'; string s2 = s1.unescapehtml3(); system.assertequals( '""""', s2); unescapehtml4() unescapes the characters in a string using html 4.0 entities. signature public string unescapehtml4() return value type: string usage if an entity isn’t recognized, it is kept as is in the returned string. example string s1 = '"<black&white>"'; string s2 = s1.unescapehtml4(); system.assertequals( '""""', s2); 3412apex reference guide string class unescapejava() returns a string whose java literals are unescaped. literals unescaped include escape sequences for quotes (\\"") and control characters, such as tab (\\t), and carriage return (\\n). signature public string unescapejava() return value type: string the unescaped string. example string s = 'company: \\""salesforce.com\\""'; string unescapedstr = s.unescapejava(); system.assertequals('company: ""salesforce.com""', unescapedstr); unescapeunicode() returns a string whose escaped unicode characters are unescaped. signature public string unescapeunicode() return value type: string the unescaped string. example string s = 'de onde voc\u00ea \u00e9?'; string unescapedstr = s.unescapeunicode(); system.assertequals('de onde você é?', unescaped" "str); unescapexml() unescapes the characters in a string using xml entities. signature public string unescapexml() return value type: string 3413apex reference guide string class usage supports only the five basic xml entities (gt, lt, quot, amp, apos). does not support dtds or external entities. example string s1 = '"<black&white>"'; string s2 = s1.unescapexml(); system.assertequals( '""""', s2); valueof(datetoconvert) returns a string that represents the specified date in the standard “yyyy-mm-dd” format. signature public static string valueof(date datetoconvert) parameters datetoconvert type: date return value type: string example date mydate = date.today(); string sdate = string.valueof(mydate); valueof(datetimetoconvert) returns a string that represents the specified datetime in the standard “yyyy-mm-dd hh:mm:ss” format for the local time zone. signature public static string valueof(datetime datetimetoconvert) parameters datetimetoconvert type: datetime 3414apex reference guide string class return value type: string example datetime dt = datetime.newinstance(1996, 6, 23); string sdatetime = string.valueof(dt); system.assertequals('1996-06-23 00:00:00', sdatetime); valueof(decimaltoconvert) returns a string that represents the specified decimal. signature public static string valueof(decimal decimaltoconvert) parameters decimaltoconvert type: decimal return value type: string example decimal dec = 3.14159265; string sdecimal = string.valueof(dec); system.assertequals('3.14159265', sdecimal); valueof(doubletoconvert) returns a string that represents the specified double. signature public static string valueof(double doubletoconvert) parameters doubletoconvert type: double return value type: string 3415apex reference guide string class example double mydouble = 12.34; string mystring = string.valueof(mydouble); system.assertequals( '12.34', mystring); valueof(integertoconvert) returns a string that represents the specified integer. signature public static string valueof(integer integertoconvert) parameters integertoconvert type: integer return value type: string example integer myinteger = 22; string sinteger = string.valueof(myinteger); system.assertequals('22', sinteger); valueof(longtoconvert) returns a string that represents the specified long. signature public static string valueof(long longtoconvert) parameters longtoconvert type: long return value type: string 3416apex reference guide string class example long mylong = 123456789; string slong = string.valueof(mylong); system.assertequals('123456789', slong); valueof(toconvert) returns a string representation of the specified object argument. signature public static string valueof(object toconvert) parameters toconvert type: object return value type: string usage if the argument is not a string, the valueof method converts it into a string by calling the tostring method on the argument, if available, or any overridden tostring method if the argument is a user-defined type. otherwise, if no tostring method is available, it returns a string representation of the argument. example list ls = new list(); ls.add(10); ls.add(20); string strlist = string.valueof(ls); system.assertequals( '(10, 20)', strlist); valueofgmt(datetimetoconvert) returns a string that represents the specified datetime in the standard “yyyy-mm-dd hh:mm:ss” format for the gmt time zone. signature public static string valueofgmt(datetime datetimetocon" "vert) 3417apex reference guide stubprovider interface parameters datetimetoconvert type: datetime return value type: string example // for a pst timezone: datetime dt = datetime.newinstance(2001, 9, 14); string sdatetime = string.valueofgmt(dt); system.assertequals('2001-09-14 07:00:00', sdatetime); stubprovider interface stubprovider is a callback interface that you can use as part of the apex stub api to implement a mocking framework. use this interface with the test.createstub() method to create stubbed apex objects for testing. namespace system usage the stubprovider interface allows you to define the behavior of a stubbed apex class. the interface specifies a single method that requires implementing: handlemethodcall(). you specify the behavior of each method of the stubbed class in the handlemethodcall() method. in your apex test, you create a stubbed object using the test.createstub() method. when you invoke methods on the stubbed object, stubprovider.handlemethodcall() is called, which performs the behavior that you’ve specified for each method. in this section: stubprovider methods see also: apex developer guide: build a mocking framework with the stub api createstub(parenttype, stubprovider) stubprovider methods the following are methods for stubprovider. 3418apex reference guide stubprovider interface in this section: handlemethodcall(stubbedobject, stubbedmethodname, returntype, listofparamtypes, listofparamnames, listofargs) use this method to define the behavior of each method of a stubbed class. handlemethodcall(stubbedobject, stubbedmethodname, returntype, listofparamtypes, listofparamnames, listofargs) use this method to define the behavior of each method of a stubbed class. signature public object handlemethodcall(object stubbedobject, string stubbedmethodname, system.type returntype, list listofparamtypes, list listofparamnames, list listofargs) parameters stubbedobject type: object the stubbed object. stubbedmethodname type: string the name of the invoked method. returntype type: system.type the return type of the invoked method. listofparamtypes type: list a list of the parameter types of the invoked method. listofparamnames type: list a list of the parameter names of the invoked method. listofargs type: list the actual argument values passed into this method at runtime. return value type: object 3419apex reference guide system class usage you can use the parameters passed into this method to identify which method on the stubbed object was invoked. then you can define the behavior for each identified method. see also: apex developer guide: build a mocking framework with the stub api system class contains methods for system operations, such as writing debug messages and scheduling jobs. namespace system system methods the following are methods for system. all methods are static. in this section: abortjob(jobid) stops the specified job. the stopped job is still visible in the job queue in the salesforce user interface. assert(condition, msg) asserts that the specified condition is true. if it isn’t , a fatal error is returned that causes code execution to halt. assertequals(expected, actual, msg) asserts that the first two arguments are the same. if they aren’t, a fatal error is returned that causes code execution to halt. assertnotequals(expected, actual, msg) asserts that the first two arguments are different. if they’re the same, a fatal error is returned that causes code execution to halt. currentpagereference() returns a reference to the current page. this is used with visualforce pages. currenttimemillis() returns the current time in milliseconds, which is expressed as the difference between the current time and midnight, january 1, 1970 utc. debug(msg) writes the specified message, in string format, to the execution debug log. the debug log level is used. debug(loglevel, msg) writes the specified message, in string format, to the execution debug log with the specified log level. enqueuejob(queueableobj) adds a job to the apex job queue" "that corresponds to the specified queueable class and returns the job id. enqueuejob(queueable, delay) adds a job to the apex job queue that corresponds to the specified queueable class and returns the job id. the job is scheduled with a specified minimum delay (0–10 minutes). the delay is ignored during apex testing. 3420apex reference guide system class enqueuejob(queueable, asyncoptions) adds a job to the apex job queue that corresponds to the specified queueable class and returns the job id. specify the maximum stack depth and the minimum queue delay in the asyncoptions parameter. equals(obj1, obj2) returns true if both arguments are equal. otherwise, returns false. getapplicationreadwritemode() returns the read write mode set for an organization during salesforce.com upgrades and downtimes. getquiddityshortcode(quiddityvalue) returns the short code for the quiddity value of the current request object. hashcode(obj) returns the hash code of the specified object. isbatch() returns true if a batch apex job invoked the executing code, or false if not. in api version 35.0 and earlier, also returns true if a queueable apex job invoked the code. isfunctioncallback() returns true if an asynchronous salesforce function callback invoked the executing code, or false if not. available in api version 51.0 and later. isfuture() returns true if the currently executing code is invoked by code contained in a method annotated with future; false otherwise. isqueueable() returns true if a queueable apex job invoked the executing code. returns false if not, including if a batch apex job or a future method invoked the code. isrunningelasticcompute() reserved for future use. isscheduled() returns true if the currently executing code is invoked by a scheduled apex job; false otherwise. movepassword(targetuserid,sourceuserid) moves the specified user’s password to a different user. now() returns the current date and time in the gmt time zone. process(workitemids, action, comments, nextapprover) processes the list of work item ids. purgeoldasyncjobs(dt) deletes asynchronous apex job records for jobs that have finished execution before the specified date with a completed, aborted, or failed status, and returns the number of records deleted. requestversion() returns a two-part version that contains the major and minor version numbers of a package. resetpassword(userid, senduseremail) resets the password for the specified user. 3421apex reference guide system class resetpasswordwithemailtemplate(userid, senduseremail, emailtemplatename) resets the user's password and sends an email to the user with their new password. you specify the email template that is sent to the specified user. use this method for external users of experience cloud sites. runas(version) changes the current package version to the package version specified in the argument. runas(usersobject) changes the current user to the specified user. schedule(jobname, cronexpression, schedulableclass) use schedule with an apex class that implements the schedulable interface to schedule the class to run at the time specified by a cron expression. schedulebatch(batchable, jobname, minutesfromnow) schedules a batch job to run once in the future after the specified time interval and with the specified job name. schedulebatch(batchable, jobname, minutesfromnow, scopesize) schedules a batch job to run once in the future after the specified the time interval, with the specified job name and scope size. returns the scheduled job id (crontrigger id). setpassword(userid, password) sets the password for the specified user. submit(workitemids, comments, nextapprover) submits the processed approvals. the current user is the submitter and the entry criteria is evaluated for all processes applicable to the current user. today() returns the current date in the current user's time zone. abortjob(jobid) stops the specified job. the stopped job is still visible in the job queue in the salesforce user interface. signature public static void abortjob(string jobid) parameters jobid type: string the jobid is the id associated with either asyncapexjob or crontrigger. return value type: void usage the following methods return the job id that can be passed to abortjob. • system.schedule" "method—returns the crontrigger object id associated with the scheduled job as a string. 3422apex reference guide system class • schedulablecontext.gettriggerid method—returns the crontrigger object id associated with the scheduled job as a string. • getjobid method—returns the asyncapexjob object id associated with the batch job as a string. • using batch apexdatabase.executebatch method—returns the asyncapexjob object id associated with the batch job as a string. assert(condition, msg) asserts that the specified condition is true. if it isn’t , a fatal error is returned that causes code execution to halt. important: we recommend that you use the methods of the assert class rather than this method. the system.assert class provides methods that handle all types of logical assertions and comparisons, which improve the clarity of your apex code. signature public static void assert(boolean condition, object msg) parameters condition type: boolean msg type: object (optional) custom message returned as part of the error message. return value type: void usage you can’t catch an assertion failure using a try/catch block even though it’s logged as an exception. assertequals(expected, actual, msg) asserts that the first two arguments are the same. if they aren’t, a fatal error is returned that causes code execution to halt. important: we recommend that you use the methods of the assert class rather than this method. the system.assert class provides methods that handle all types of logical assertions and comparisons, which improve the clarity of your apex code. signature public static void assertequals(object expected, object actual, object msg) parameters expected type: object specifies the expected value. 3423apex reference guide system class actual type: object specifies the actual value. msg type: object (optional) custom message returned as part of the error message. return value type: void usage you can’t catch an assertion failure using a try/catch block even though it’s logged as an exception. assertnotequals(expected, actual, msg) asserts that the first two arguments are different. if they’re the same, a fatal error is returned that causes code execution to halt. important: we recommend that you use the methods of the assert class rather than this method. the system.assert class provides methods that handle all types of logical assertions and comparisons, which improve the clarity of your apex code. signature public static void assertnotequals(object expected, object actual, object msg) parameters expected type: object specifies the expected value. actual type: object specifies the actual value. msg type: object (optional) custom message returned as part of the error message. return value type: void usage you can’t catch an assertion failure using a try/catch block even though it’s logged as an exception. 3424apex reference guide system class currentpagereference() returns a reference to the current page. this is used with visualforce pages. signature public static system.pagereference currentpagereference() return value type: system.pagereference usage for more information, see pagereference class. currenttimemillis() returns the current time in milliseconds, which is expressed as the difference between the current time and midnight, january 1, 1970 utc. signature public static long currenttimemillis() return value type: long debug(msg) writes the specified message, in string format, to the execution debug log. the debug log level is used. signature public static void debug(object msg) parameters msg type: object return value type: void usage if the msg argument is not a string, the debug method calls string.valueof to convert it into a string. the string.valueof method calls the tostring method on the argument, if available, or any overridden tostring method if the argument is a user-defined type. otherwise, if no tostring method is available, it returns a string representation of the argument. 3425apex reference guide system class if the log level for apex code is set to debug or higher, the message of this debug statement will be written to the debug log. note that when a map or set is printed, the output is sorted in key order and is surrounded with square brackets ([]). when an array or list is printed, the output is enclosed in parentheses (" "()). note: calls to system.debug are not counted as part of apex code coverage.calls to system.debug are not counted as part of apex code coverage. for more information on log levels, see debug log levels in the salesforce online help. debug(loglevel, msg) writes the specified message, in string format, to the execution debug log with the specified log level. signature public static void debug(logginglevel loglevel, object msg) parameters loglevel type: logginglevel enum the logging level to set for this method. msg type: object the message or object to write in string format to the execution debug log. return value type: void usage if the msg argument is not a string, the debug method calls string.valueof to convert it into a string. the string.valueof method calls the tostring method on the argument, if available, or any overridden tostring method if the argument is a user-defined type. otherwise, if no tostring method is available, it returns a string representation of the argument. note: calls to system.debug are not counted as part of apex code coverage. for more information on log levels, see debug log levels in the salesforce online help. enqueuejob(queueableobj) adds a job to the apex job queue that corresponds to the specified queueable class and returns the job id. signature public static id enqueuejob(object queueableobj) 3426apex reference guide system class parameters queueableobj type: object an instance of the class that implements the queueable interface. return value type: id the job id, which corresponds to the id of an asyncapexjob record. usage to add a job for asynchronous execution, call system.enqueuejob by passing in an instance of your class implementation of the queueable interface for execution as follows: id jobid = system.enqueuejob(new myqueueableclass()); for more information about queueable apex, including information about limits, see queueable apex. enqueuejob(queueable, delay) adds a job to the apex job queue that corresponds to the specified queueable class and returns the job id. the job is scheduled with a specified minimum delay (0–10 minutes). the delay is ignored during apex testing. signature public static id enqueuejob(object queueable, integer delay) parameters queueable type: object an instance of the class that implements the queueable interface. delay type: integer the minimum delay (0–10 minutes) before the queueable job is scheduled for execution. the delay is ignored during apex testing. warning: when you set the delay to 0 (zero), the queueable job is run as quickly as possible. with chained queueable jobs, implement a mechanism to slow down or halt the job if necessary. without such a fail-safe mechanism in place, you can rapidly reach the daily async apex limit. return value type: id the job id, which corresponds to the id of an asyncapexjob record. 3427apex reference guide system class example this example adds a job for delayed asynchronous execution by passing in an instance of your class implementation of the queueable interface for execution. there’s a minimum delay of 5 minutes before the job is executed. integer delayinminutes = 5; id jobid = system.enqueuejob(new myqueueableclass(), delayinminutes); for more information about queueable apex, including information about limits, see queueable apex. enqueuejob(queueable, asyncoptions) adds a job to the apex job queue that corresponds to the specified queueable class and returns the job id. specify the maximum stack depth and the minimum queue delay in the asyncoptions parameter. signature public static id enqueuejob(object queueable, object asyncoptions) parameters queueable type: object an instance of the class that implements the queueable interface. asyncoptions type: asyncoptions the maximum stack depth and the minimum queue delay can be specified in the asyncoptions class properties. return value type: id the job id, which corresponds to the id of an asyncapexjob record. usage the system.asyncinfo class methods help you determine if maximum stack depth is set in your queueable request and get the stack depths and queue delay for queueables that are currently running. use information about the current queueable execution to make decisions on adjusting delays on subsequent calls. these are methods in the system.asyncinfo class. • hasmaxstack" "depth() • getcurrentqueueablestackdepth() • getmaximumqueueablestackdepth() • getminimumqueueabledelayinminutes() for more information about queueable apex, including information about limits, see queueable apex. equals(obj1, obj2) returns true if both arguments are equal. otherwise, returns false. 3428apex reference guide system class signature public static boolean equals(object obj1, object obj2) parameters obj1 type: object object being compared. obj2 type: object object to compare with the first argument. return value type: boolean usage obj1 and obj2 can be of any type. they can be values, or object references, such as sobjects and user-defined types. the comparison rules for system.equals are identical to the ones for the == operator. for example, string comparison is case insensitive. for information about the comparison rules, see the == operator. getapplicationreadwritemode() returns the read write mode set for an organization during salesforce.com upgrades and downtimes. signature public static system.applicationreadwritemode getapplicationreadwritemode() return value type: system.applicationreadwritemode valid values are: • default • read_only using the system.applicationreadwritemode enum use the system.applicationreadwritemode enum returned by the getapplicationreadwritemode to programmatically determine if the application is in read-only mode during salesforce upgrades and downtimes. valid values for the enum are: • default • read_only 3429apex reference guide system class example: public class myclass { public static void execute() { applicationreadwritemode mode = system.getapplicationreadwritemode(); if (mode == applicationreadwritemode.read_only) { // do nothing. if dml operaton is attempted in readonly mode, // invalidreadonlyuserdmlexception will be thrown. } else if (mode == applicationreadwritemode.default) { account account = new account(name = 'my account'); insert account; } } } getquiddityshortcode(quiddityvalue) returns the short code for the quiddity value of the current request object. signature public string getquiddityshortcode(system.quiddity quiddityvalue) parameters quiddityvalue type: system.quiddity the quiddity enum value that has an associated short code. this short code is used in event monitoring logs. for more information, see apex execution event type. return value type: string hashcode(obj) returns the hash code of the specified object. signature public static integer hashcode(object obj) parameters obj type: object the object to get the hash code for. this parameter can be of any type, including values or object references, such as sobjects or user-defined types. 3430apex reference guide system class return value type: integer versioned behavior changes in api version 51.0 and later, the hashcode() method returns the same hashcode for identical id values. in api version 50.0 and earlier, identical id values didn’t always generate the same hashcode value. isbatch() returns true if a batch apex job invoked the executing code, or false if not. in api version 35.0 and earlier, also returns true if a queueable apex job invoked the code. signature public static boolean isbatch() return value type: boolean usage a batch apex job can’t invoke a future method. before invoking a future method, use isbatch() to check whether the executing code is a batch apex job. isfunctioncallback() returns true if an asynchronous salesforce function callback invoked the executing code, or false if not. available in api version 51.0 and later. signature public static boolean isfunctioncallback() return value type: boolean usage use this method to determine if the apex code is being invoked as part of a callback from an asynchronous salesforce functions invocation. for more details on invoking salesforce functions from apex, see functions namespace isfuture() returns true if the currently executing code is invoked by code contained in a method annotated with future; false otherwise. 3431apex reference guide system class signature public static boolean isfuture() return value type: boolean usage since a future method can't be invoked from another future method, use this method to check if the current code is executing within the context" "of a future method before you invoke a future method. isqueueable() returns true if a queueable apex job invoked the executing code. returns false if not, including if a batch apex job or a future method invoked the code. signature public static boolean isqueueable() return value type: boolean usage public class simplequeueable implements queueable { string name; public simplequeueable(string name) { this.name = name; system.assert(!system.isqueueable()); //should return false } public void execute(queueablecontext ctx) { account testaccount = new account(); testaccount.name = 'testacc'; insert(testaccount); system.assert(system.isqueueable()); //should return true } } global class complexbatch implements database.batchable { global database.querylocator start(database.batchablecontext info) { system.assert(!system.isqueueable()); //should return false return database.getquerylocator([select id, name from account limit 1]); } global void execute(database.batchablecontext info, sobject[] scope) { 3432" "apex reference guide system class system.assert(!system.isqueueable()); //should return false system.enqueuejob(new simplequeueable('callingfromcomplexbatch')); system.assert(!system.isqueueable()); //should return false } global void finish(database.batchablecontext info) { system.assert(!system.isqueueable()); //should return false } } isrunningelasticcompute() reserved for future use. signature public static boolean isrunningelasticcompute() return value type: boolean isscheduled() returns true if the currently executing code is invoked by a scheduled apex job; false otherwise. signature public static boolean isscheduled() return value type: boolean movepassword(targetuserid,sourceuserid) moves the specified user’s password to a different user. signature public static void movepassword(id targetuserid, id sourceuserid) parameters targetuserid type: id the user that the password is moved to. sourceuserid type: id the user that the password is moved from. 3433apex reference guide system class return value type: void usage moving a password simplifies converting a user to another type of user, such as when converting an external user to a user with less restrictive access. if you require access to the movepassword method, contact salesforce. keep in mind these requirements. • the targetuserid, sourceuserid, and user performing the move operation must all belong to the same salesforce org. • the targetuserid and the sourceuserid cannot be the same as the user performing the move operation. • a user without a password can’t be specified as the sourceuserid. for example, a source user who has already had their password moved is left without a password. that user can’t be a source user again. after the password is moved: • the target user can log in with the password. • the source user no longer has a password. to enable logins for this user, a password reset is required. now() returns the current date and time in the gmt time zone. signature public static datetime now() return value type: datetime process(workitemids, action, comments, nextapprover) processes the list of work item ids. signature public static list process(list workitemids, string action, string comments, string nextapprover) parameters workitemids type: list action type: string comments type: string nextapprover type: string 3434apex reference guide system class return value type: list purgeoldasyncjobs(dt) deletes asynchronous apex job records for jobs that have finished execution before the specified date with a completed, aborted, or failed status, and returns the number of records deleted. signature public static integer purgeoldasyncjobs(date dt) parameters dt type: date specifies the date up to which old records are deleted. the date comparison is based on the completeddate field of asyncapexjob, which is in the gmt time zone. return value type: integer usage asynchronous apex job records are records in asyncapexjob. the system cleans up asynchronous job records for jobs that have finished execution and are older than seven days. you can use this method to further reduce the size of asyncapexjob by cleaning up more records. each execution of this method counts as a single row against the governor limit for dml statements. example this example shows how to delete all job records for jobs that have finished before today’s date. integer count = system.purgeoldasyncjobs (date.today()); system.debug('deleted ' + count + ' old jobs.'); requestversion() returns a two-part version that contains the major and minor version numbers of a package. signature public static system.version requestversion() return value type: system.version 3435apex reference guide system class usage using this method, you can determine the version of an installed instance of your package from which the calling code is referencing your package. based on the version that the calling code has, you can customize the behavior of your package code. the requestversion method isn’t supported for unmanaged packages. if you call it from an unmanaged package, an exception will be thrown. resetpassword(user" "id, senduseremail) resets the password for the specified user. signature public static system.resetpasswordresult resetpassword(id userid, boolean senduseremail) parameters userid type: id senduseremail type: boolean return value type: system.resetpasswordresult usage when the user logs in with the new password, they are prompted to enter a new password, and to select a security question and answer if they haven't already. if you specify true for senduseremail, the user is sent an email notifying them that their password was reset. a link to sign onto salesforce using the new password is included in the email. use setpassword(userid, password) if you don't want the user to be prompted to enter a new password when they log in. warning: be careful with this method, and do not expose this functionality to end-users. resetpasswordwithemailtemplate(userid, senduseremail, emailtemplatename) resets the user's password and sends an email to the user with their new password. you specify the email template that is sent to the specified user. use this method for external users of experience cloud sites. signature public static system.resetpasswordresult resetpasswordwithemailtemplate(id userid, boolean senduseremail, string emailtemplatename) parameters userid type: id the id of the user whose password was reset. 3436apex reference guide system class senduseremail type: boolean emailtemplatename type: string name of the email template. return value type: system.resetpasswordresult usage if you specify true for senduseremail, specify the email template that is sent to the user notifying them that their password was reset. when the user logs in with the new password in the email, they are prompted to enter a new password. a link to sign onto salesforce using the new password is included in the email. use setpassword(userid, password) if you don't want the user to be prompted to enter a new password when they log in. warning: be careful with this method, and do not expose this functionality to end-users. runas(version) changes the current package version to the package version specified in the argument. signature public static void runas(system.version version) parameters version type: system.version return value type: void usage a package developer can use version methods to continue to support existing behavior in classes and triggers in previous package versions while continuing to evolve the code. apex classes and triggers are saved with the version settings for each installed managed package that the class or trigger references. this method is used for testing your component behavior in different package versions that you upload to the appexchange. this method effectively sets a two-part version consisting of major and minor numbers in a test method so that you can test the behavior for different package versions. you can only use runas in a test method. there is no limitation to the number of calls to this method in a transaction. for sample usage of this method, see testing behavior in package versions. 3437apex reference guide system class runas(usersobject) changes the current user to the specified user. signature public static void runas(user usersobject) parameters usersobject type: user return value type: void usage all of the specified user's record sharing is enforced during the execution of runas. you can only use runas in a test method. for more information, see using the runas() method. note: the runas method ignores user license limits. you can create new users with runas even if your organization has no additional user licenses. the runas method implicitly inserts the user that is passed in as parameter if the user has been instantiated, but not inserted yet. you can also use runas to perform mixed dml operations in your test by enclosing the dml operations within the runas block. in this way, you bypass the mixed dml error that is otherwise returned when inserting or updating setup objects together with other sobjects. see sobjects that cannot be used together in dml operations. note: every call to runas counts against the total number of dml statements issued in the process. schedule(jobname, cronexpression, schedulableclass) use schedule with an apex class that implements the schedulable interface to schedule the class to run at the time specified by a cron expression. signature public static string schedule(string jobname, string cronexpression, object schedulableclass)" "parameters jobname type: string cronexpression type: string schedulableclass type: object 3438apex reference guide system class return value type: string returns the scheduled job id (crontrigger id). usage use extreme care if you’re planning to schedule a class from a trigger. you must be able to guarantee that the trigger won’t add more scheduled classes than the limit. in particular, consider api bulk updates, import wizards, mass record changes through the user interface, and all cases where more than one record can be updated at a time. use the abortjob method to stop the job after it has been scheduled. note: salesforce schedules the class for execution at the specified time. actual execution may be delayed based on service availability. using the system.schedule method after you implement a class with the schedulable interface, use the system.schedule method to execute it. the scheduler runs as system—all classes are executed, whether or not the user has permission to execute the class. note: use extreme care if you’re planning to schedule a class from a trigger. you must be able to guarantee that the trigger won’t add more scheduled classes than the limit. in particular, consider api bulk updates, import wizards, mass record changes through the user interface, and all cases where more than one record can be updated at a time. the system.schedule method takes three arguments: a name for the job, an expression used to represent the time and date the job is scheduled to run, and the name of the class. this expression has the following syntax: seconds minutes hours day_of_month month day_of_week optional_year note: salesforce schedules the class for execution at the specified time. actual execution may be delayed based on service availability. the system.schedule method uses the user's timezone for the basis of all schedules. the following are the values for the expression: name values special characters seconds 0–59 none minutes 0–59 none hours 0–23 , - * / day_of_month 1–31 , - * ? / l w month 1–12 or the following: , - * / • jan • feb • mar • apr • may • jun 3439apex reference guide system class name values special characters • jul • aug • sep • oct • nov • dec day_of_week 1–7 or the following: , - * ? / l # • sun • mon • tue • wed • thu • fri • sat optional_year null or 1970–2099 , - * / the special characters are defined as follows: special character description , delimits values. for example, use jan, mar, apr to specify more than one month. - specifies a range. for example, use jan-mar to specify more than one month. * specifies all values. for example, if month is specified as *, the job is scheduled for every month. ? specifies no specific value. this is only available for day_of_month and day_of_week, and is generally used when specifying a value for one and not the other. / specifies increments. the number before the slash specifies when the intervals will begin, and the number after the slash is the interval amount. for example, if you specify 1/5 for day_of_month, the apex class runs every fifth day of the month, starting on the first of the month. l specifies the end of a range (last). this is only available for day_of_month and day_of_week. when used with day of month, l always means the last day of the month, such as january 31, february 29 for leap years, and so on. when used with day_of_week by itself, it always means 7 or sat. when used with a day_of_week value, it means the last of that type of day in the month. for example, if you specify 2l, you are specifying the last monday of the month. do not use a range of values with l as the results might be unexpected. 3440apex reference guide system class special character description w specifies the nearest weekday (monday-friday) of the given day. this is only available for day_of_month. for example, if you specify 20w, and the 20th is a saturday, the class runs on the 19th. if you specify 1w, and the" "first is a saturday, the class does not run in the previous month, but on the third, which is the following monday. tip: use the l and w together to specify the last weekday of the month. # specifies the nth day of the month, in the format weekday#day_of_month. this is only available for day_of_week. the number before the # specifies weekday (sun-sat). the number after the # specifies the day of the month. for example, specifying 2#1 means the class runs on the first monday of every month. the following are some examples of how to use the expression. expression description 0 0 13 * * ? class runs every day at 1 pm. 0 0 22 ? * 6l class runs the last friday of every month at 10 pm. 0 0 10 ? * mon-fri class runs monday through friday at 10 am. 0 0 20 * * ? 2010 class runs every day at 8 pm during the year 2010. in the following example, the class proschedule implements the schedulable interface. the class is scheduled to run at 8 am, on the 13 february. proschedule p = new proschedule(); string sch = '0 0 8 13 2 ?'; system.schedule('one time pro', sch, p); schedulebatch(batchable, jobname, minutesfromnow) schedules a batch job to run once in the future after the specified time interval and with the specified job name. signature public static string schedulebatch(database.batchable batchable, string jobname, integer minutesfromnow) parameters batchable type: database.batchable an instance of a class that implements the database.batchable interface. jobname type: string 3441apex reference guide system class the name if the job that this method will start. minutesfromnow type: integer the time interval in minutes after which the job should start executing. this argument must be greater than zero. return value type: string the scheduled job id (crontrigger id). usage note: some things to note about system.schedulebatch: • when you call system.schedulebatch, salesforce schedules the job for execution at the specified time. actual execution occurs at or after that time, depending on service availability. • the scheduler runs as system—all classes are executed, whether the user has permission to execute the class, or not. • when the job’s schedule is triggered, the system queues the batch job for processing. if apex flex queue is enabled in your org, the batch job is added at the end of the flex queue. for more information, see holding batch jobs in the apex flex queue. • all scheduled apex limits apply for batch jobs scheduled using system.schedulebatch. after the batch job is queued (with a status of holding or queued), all batch job limits apply and the job no longer counts toward scheduled apex limits. • after calling this method and before the batch job starts, you can use the returned scheduled job id to abort the scheduled job using the system.abortjob method. for an example, see using batch apex. schedulebatch(batchable, jobname, minutesfromnow, scopesize) schedules a batch job to run once in the future after the specified the time interval, with the specified job name and scope size. returns the scheduled job id (crontrigger id). signature public static string schedulebatch(database.batchable batchable, string jobname, integer minutesfromnow, integer scopesize) parameters batchable type: database.batchable the batch class that implements the database.batchable interface. jobname type: string the name of the job that this method will start. minutesfromnow type: integer 3442apex reference guide system class the time interval in minutes after which the job should start executing. scopesize type: integer the number of records that should be passed to the batch execute method. return value type: string usage note: some things to note about system.schedulebatch: • when you call system.schedulebatch, salesforce schedules the job for execution at the specified time. actual execution occurs at or after that time, depending on service availability. • the scheduler runs as system—all classes are executed, whether the user has permission to execute the class, or not. • when the job’s schedule is triggered, the system queues the batch job for processing. if apex" "flex queue is enabled in your org, the batch job is added at the end of the flex queue. for more information, see holding batch jobs in the apex flex queue. • all scheduled apex limits apply for batch jobs scheduled using system.schedulebatch. after the batch job is queued (with a status of holding or queued), all batch job limits apply and the job no longer counts toward scheduled apex limits. • after calling this method and before the batch job starts, you can use the returned scheduled job id to abort the scheduled job using the system.abortjob method. for an example, see using the system.schedulebatch method. setpassword(userid, password) sets the password for the specified user. signature public static void setpassword(id userid, string password) parameters userid type: id password type: string return value type: void usage • if a security question hasn't been previously configured, a user who logs in with a new password that was set using setpassword() is redirected to the ""change your password"" page. 3443apex reference guide test class • use resetpassword(userid, senduseremail) if you want the user to go through the reset process and create their own password. warning: be careful with this method, and don’t expose this functionality to end users. submit(workitemids, comments, nextapprover) submits the processed approvals. the current user is the submitter and the entry criteria is evaluated for all processes applicable to the current user. signature public static list submit(list workitemids, string comments, string nextapprover) parameters workitemids type: list comments type: string nextapprover type: string return value type: list usage for enhanced submit and evaluation features, see the processsubmitrequest class. today() returns the current date in the current user's time zone. signature public static date today() return value type: date test class contains methods related to apex tests. 3444apex reference guide test class namespace system test methods the following are methods for test. all methods are static. in this section: calculatepermissionsetgroup(psgids) calculates aggregate permissions in specified permission set groups for testing. calculatepermissionsetgroup(psgid) calculates aggregate permissions in a specified permission set group for testing. clearapexpagemessages() clear the messages on a visualforce page while executing apex test methods. createstub(parenttype, stubprovider) creates a stubbed version of an apex class that you can use for testing. this method is part of the apex stub api. you can use it with the system.stubprovider interface to create a mocking framework. enablechangedatacapture() use this method in an apex test so that change event notifications are generated for all supported change data capture entities. call this method at the beginning of your test before performing dml operations and calling test.geteventbus().deliver();. enqueuebatchjobs(numberofjobs) adds the specified number of jobs with no-operation contents to the test-context queue. it first fills the test batch queue, up to the maximum 5 jobs, and then places jobs in the test flex queue. it throws a limit exception when the number of jobs in the test flex queue exceeds the allowed limit of 100 jobs. geteventbus() returns an instance of the test event bus broker, which lets you operate on platform event or change event messages in an apex test. for example, you can call test.geteventbus().deliver() to deliver event messages. getflexqueueorder() returns an ordered list of job ids for jobs in the test-context flex queue. the job at index 0 is the next job slated to run. this method returns only test-context results, even if it’s annotated with @istest(seealldata=true). getstandardpricebookid() returns the id of the standard price book in the organization. invokecontinuationmethod(controller, request) invokes the callback method for the specified controller and continuation in a test method. isrunningtest() returns true if the currently executing code was called by code contained in a test method, false otherwise. use this method if you need to run different code depending on whether it was being called from a test. loaddata(sobjecttoken, resourcename) inserts test records" "from the specified static resource .csv file and for the specified sobject type, and returns a list of the inserted sobjects. 3445apex reference guide test class newsendemailquickactiondefaults(contextid, replytoid) creates a new quickaction.sendemailquickactiondefaults instance for testing a class implementing the quickaction.quickactiondefaultshandler interface. setcontinuationresponse(requestlabel, mockresponse) sets a mock response for a continuation http request in a test method. setcreateddate(recordid, createddatetime) sets createddate for a test-context sobject. setcurrentpage(page) a visualforce test method that sets the current pagereference for the controller. setcurrentpagereference(page) a visualforce test method that sets the current pagereference for the controller. setfixedsearchresults(fixedsearchresults) defines a list of fixed search results to be returned by all subsequent sosl statements in a test method. setmock(interfacetype, instance) sets the response mock mode and instructs the apex runtime to send a mock response whenever a callout is made through the http classes or the auto-generated code from wsdls. setreadonlyapplicationmode(applicationmode) sets the application mode for an organization to read-only in an apex test to simulate read-only mode during salesforce upgrades and downtimes. the application mode is reset to the default mode at the end of each apex test run. starttest() marks the point in your test code when your test actually begins. use this method when you are testing governor limits. stoptest() marks the point in your test code when your test ends. use this method in conjunction with the starttest method. testinstall(installimplementation, version, ispush) tests the implementation of the installhandler interface, which is used for specifying a post install script in packages. tests run as the test initiator in the development environment. testsandboxpostcopyscript(script, organizationid, sandboxid, sandboxname) tests the implementation of the sandboxpostcopy interface, which is used for specifying a script to run at the completion of a sandbox copy. tests run as the test initiator in the development environment. testsandboxpostcopyscript(script, organizationid, sandboxid, sandboxname, runasautoprocuser) tests the implementation of the sandboxpostcopy interface, which is used for specifying a script to run at the completion of a sandbox copy. when runasautoprocuser is true, tests run as automated process user in the development environment. testuninstall(uninstallimplementation) tests the implementation of the uninstallhandler interface, which is used for specifying an uninstall script in packages. tests run as the test initiator in the development environment. calculatepermissionsetgroup(psgids) calculates aggregate permissions in specified permission set groups for testing. signature public static void calculatepermissionsetgroup(list psgids) 3446apex reference guide test class parameters psgids type: list a list of ids for permission set groups. return value type: void calculatepermissionsetgroup(psgid) calculates aggregate permissions in a specified permission set group for testing. signature public static void calculatepermissionsetgroup(string psgid) parameters psgid type: string a single id for a specified permission set group. return value type: void clearapexpagemessages() clear the messages on a visualforce page while executing apex test methods. signature public static void clearapexpagemessages() return value type: void usage this method may only be used in tests. example: @istest static void clearmessagestest() { test.setcurrentpage(new pagereference('/')); apexpages.addmessage( new apexpages.message(apexpages.severity.warning, 'sample warning') 3447apex reference guide test class ); system.assertequals(1, apexpages.getmessages().size()); test.clearapexpagemessages(); system.assertequals(0, apexpages.getmessages().size()); } createstub(parenttype, stubprovider) creates a stubbed version of an apex class that you can use for testing. this method is part of the apex stub api. you can use it with the system.stubprovider interface to create a mocking framework. sign" "ature public static object createstub(system.type parenttype, system.stubprovider stubprovider) parameters parenttype type: system.type the type of the apex class to be stubbed. stubprovider system.stubprovider an implementation of the stubprovider interface. return value type: object returns the stubbed object to use in testing. usage the createstub() method works together with the system.stubprovider interface. you define the behavior of the stubbed object by implementing the stubprovider interface. then you create a stubbed object using the createstub() method. when you invoke methods on the stubbed object, the handlemethodcall() method of the stubprovider interface is called to perform the behavior of the stubbed method. see also: apex developer guide: build a mocking framework with the stub api enablechangedatacapture() use this method in an apex test so that change event notifications are generated for all supported change data capture entities. call this method at the beginning of your test before performing dml operations and calling test.geteventbus().deliver();. signature public static void enablechangedatacapture() 3448apex reference guide test class return value type: void usage the enablechangedatacapture() method ensures that apex tests can fire change event triggers regardless of the entities selected in setup in the change data capture page. the enablechangedatacapture() method doesn’t affect the entities selected in setup. see also: change data capture developer guide enqueuebatchjobs(numberofjobs) adds the specified number of jobs with no-operation contents to the test-context queue. it first fills the test batch queue, up to the maximum 5 jobs, and then places jobs in the test flex queue. it throws a limit exception when the number of jobs in the test flex queue exceeds the allowed limit of 100 jobs. signature public static list enqueuebatchjobs(integer numberofjobs) parameters numberofjobs type: integer number of test jobs to enqueue. return value type: list a list of ids of enqueued test jobs. usage use this method to reduce testing time. instead of using your org's real batch jobs for testing, you can use this method to simulate batch-job enqueueing. using enqueuebatchjobs(numberofjobs) is faster than enqueuing real batch jobs. geteventbus() returns an instance of the test event bus broker, which lets you operate on platform event or change event messages in an apex test. for example, you can call test.geteventbus().deliver() to deliver event messages. signature public static eventbus.testbroker geteventbus() 3449apex reference guide test class return value type: eventbus.testbroker a broker for the test event bus. usage enclose test.geteventbus().deliver() within the test.starttest() and test.stoptest() statement block. test.starttest(); // create test events // ... // publish test events with eventbus.publish() // ... // deliver test events test.geteventbus().deliver(); // perform validation // ... test.stoptest(); see also: platform events developer guide getflexqueueorder() returns an ordered list of job ids for jobs in the test-context flex queue. the job at index 0 is the next job slated to run. this method returns only test-context results, even if it’s annotated with @istest(seealldata=true). signature public static list getflexqueueorder() return value type: list an ordered list of ids of the jobs in the test’s flex queue. getstandardpricebookid() returns the id of the standard price book in the organization. signature public static id getstandardpricebookid() return value type: id the id of the standard price book. 3450apex reference guide test class usage this method returns the id of the standard price book in your organization regardless of whether the test can query organization data. by default, tests can’t query organization data unless they’re annotated with @istest(seealldata=true). creating price book entries with a standard price requires the id of the standard price book. use this method to get the standard price book id so that you can create price book entries in your tests. example this example creates some test data for price book entries. the" "test method in this example gets the standard price book id and uses this id to create a price book entry for a product with a standard price. next, the test creates a custom price book and uses the id of this custom price book to add a price book entry with a custom price. @istest public class pricebooktest { // utility method that can be called by apex tests to create price book entries. static testmethod void addpricebookentries() { // first, set up test price book entries. // insert a test product. product2 prod = new product2(name = 'laptop x200', family = 'hardware'); insert prod; // get standard price book id. // this is available irrespective of the state of seealldata. id pricebookid = test.getstandardpricebookid(); // 1. insert a price book entry for the standard price book. // standard price book entries require the standard price book id we got earlier. pricebookentry standardprice = new pricebookentry( pricebook2id = pricebookid, product2id = prod.id, unitprice = 10000, isactive = true); insert standardprice; // create a custom price book pricebook2 custompb = new pricebook2(name='custom pricebook', isactive=true); insert custompb; // 2. insert a price book entry with a custom price. pricebookentry customprice = new pricebookentry( pricebook2id = custompb.id, product2id = prod.id, unitprice = 12000, isactive = true); insert customprice; // next, perform some tests with your test price book entries. } } invokecontinuationmethod(controller, request) invokes the callback method for the specified controller and continuation in a test method. 3451apex reference guide test class signature public static object invokecontinuationmethod(object controller, continuation request) parameters controller type: object an instance of the controller class that invokes the continuation request. request type: continuation the continuation that is returned by an action method in the controller class. return value type: object the response of the continuation callback method. usage use the test.setcontinuationresponse and test.invokecontinuationmethod methods to test continuations. in test context, callouts of continuations aren’t sent to the external service. by using these methods, you can set a mock response and cause the runtime to call the continuation callback method to process the mock response. call test.setcontinuationresponse before you call test.invokecontinuationmethod. when you call test.invokecontinuationmethod, the runtime executes the callback method that is associated with the continuation. the callback method processes the mock response that is set by test.setcontinuationresponse. isrunningtest() returns true if the currently executing code was called by code contained in a test method, false otherwise. use this method if you need to run different code depending on whether it was being called from a test. signature public static boolean isrunningtest() return value type: boolean loaddata(sobjecttoken, resourcename) inserts test records from the specified static resource .csv file and for the specified sobject type, and returns a list of the inserted sobjects. signature public static list loaddata(schema.sobjecttype sobjecttoken, string resourcename) 3452apex reference guide test class parameters sobjecttoken type: schema.sobjecttype the sobject type for which to insert test records. resourcename type: string the static resource that corresponds to the .csv file containing the test records to load. the name is case insensitive. return value type: list usage you must create the static resource prior to calling this method. the static resource is a comma-delimited file ending with a .csv extension. the file contains field names and values for the test records. the first line of the file must contain the field names and subsequent lines are the field values. to learn more about static resources, see “defining static resources” in the salesforce online help. once you create a static resource for your .csv file, the static resource will be assigned a mime type. supported mime types are: • text/csv • application/vnd.ms-excel • application/octet-stream • text/plain newsendemailquickactiondefaults(contextid, replytoid) creates a new quickaction.sendemailquickactiondefaults instance for testing a class implementing the quick" "action.quickactiondefaultshandler interface. signature public static quickaction.sendemailquickactiondefaults newsendemailquickactiondefaults(id contextid, id replytoid) parameters contextid type: id parent record of the email message. replytoid type: id previous email message id if this email message is a reply. return value type: sendemailquickactiondefaults class the default values used for an email message quick action. 3453apex reference guide test class setcontinuationresponse(requestlabel, mockresponse) sets a mock response for a continuation http request in a test method. signature public static void setcontinuationresponse(string requestlabel, system.httpresponse mockresponse) parameters requestlabel type: string the unique label that corresponds to the continuation http request. this label is returned by continuation.addhttprequest. mockresponse type: httpresponse the fake response to be returned by test.invokecontinuationmethod. return value type: void usage use the test.setcontinuationresponse and test.invokecontinuationmethod methods to test continuations. in test context, callouts of continuations aren’t sent to the external service. by using these methods, you can set a mock response and cause the runtime to call the continuation callback method to process the mock response. call test.setcontinuationresponse before you call test.invokecontinuationmethod. when you call test.invokecontinuationmethod, the runtime executes the callback method that is associated with the continuation. the callback method processes the mock response that is set by test.setcontinuationresponse. setcreateddate(recordid, createddatetime) sets createddate for a test-context sobject. signature public static void setcreateddate(id recordid, datetime createddatetime) parameters recordid type: id the id of an sobject. createddatetime type: datetime the value to assign to the sobject’s createddate field. 3454apex reference guide test class return value type: void usage all database changes are rolled back at the end of a test. you can’t use this method on records that existed before your test executed. you also can’t use setcreateddate in methods annotated with @istest(seealldata=true), because those methods have access to all data in your org. if you set createddate to a future value, it can cause unexpected results. this method takes two parameters—an sobject id and a datetime value—neither of which can be null. insert your test record before you set its createddate, as shown in this example. @istest private class setcreateddatetest { static testmethod void testsetcreateddate() { account a = new account(name='myaccount'); insert a; test.setcreateddate(a.id, datetime.newinstance(2012,12,12)); test.starttest(); account myaccount = [select id, name, createddate from account where name ='myaccount' limit 1]; system.assertequals(myaccount.createddate, datetime.newinstance(2012,12,12)); test.stoptest(); } } setcurrentpage(page) a visualforce test method that sets the current pagereference for the controller. signature public static void setcurrentpage(pagereference page) parameters page type: system.pagereference return value type: void setcurrentpagereference(page) a visualforce test method that sets the current pagereference for the controller. signature public static void setcurrentpagereference(pagereference page) 3455apex reference guide test class parameters page type: system.pagereference return value type: void setfixedsearchresults(fixedsearchresults) defines a list of fixed search results to be returned by all subsequent sosl statements in a test method. signature public static void setfixedsearchresults(id[] fixedsearchresults) parameters fixedsearchresults type: id[] the list of record ids specified by opt_set_search_results replaces the results that would normally be returned by the sosl queries if they were not subject to any where or limit clauses. if these clauses exist in the sosl queries, they are applied to the list of fixed search results. return value type: void usage if opt_set_search_results is not specified, all subsequent sosl queries return no results. for more information, see dynamic sosl. set" "mock(interfacetype, instance) sets the response mock mode and instructs the apex runtime to send a mock response whenever a callout is made through the http classes or the auto-generated code from wsdls. signature public static void setmock(type interfacetype, object instance) parameters interfacetype type: system.type instance type: object 3456apex reference guide test class return value type: void usage note: to mock a callout if the code that performs the callout is in a managed package, call test.setmock from a test method in the same package with the same namespace. setreadonlyapplicationmode(applicationmode) sets the application mode for an organization to read-only in an apex test to simulate read-only mode during salesforce upgrades and downtimes. the application mode is reset to the default mode at the end of each apex test run. signature public static void setreadonlyapplicationmode(boolean applicationmode) parameters applicationmode type: boolean return value type: void usage also see the getapplicationreadwritemode() system method. do not use setreadonlyapplicationmode for purposes unrelated to read-only mode testing, such as simulating dml exceptions. example the following example sets the application mode to read-only and attempts to insert a new account record, which results in the exception. it then resets the application mode and performs a successful insert. @istest private class applicationreadonlymodetestclass { public static testmethod void test() { // create a test account that is used for querying later. account testaccount = new account(name = 'testaccount'); insert testaccount; // set the application read only mode. test.setreadonlyapplicationmode(true); // verify that the application is in read-only mode. system.assertequals( applicationreadwritemode.read_only, system.getapplicationreadwritemode()); 3457apex reference guide test class // create a new account object. account testaccount2 = new account(name = 'testaccount2'); try { // get the test account created earlier. should be successful. account testaccountfromdb = [select id, name from account where name = 'testaccount']; system.assertequals(testaccount.id, testaccountfromdb.id); // inserts should result in the invalidreadonlyuserdmlexception // being thrown. insert testaccount2; system.assertequals(false, true); } catch (system.invalidreadonlyuserdmlexception e) { // expected } // insertion should work after read only application mode gets disabled. test.setreadonlyapplicationmode(false); insert testaccount2; account testaccount2fromdb = [select id, name from account where name = 'testaccount2']; system.assertequals(testaccount2.id, testaccount2fromdb.id); } } starttest() marks the point in your test code when your test actually begins. use this method when you are testing governor limits. signature public static void starttest() return value type: void usage you can also use this method with stoptest to ensure that all asynchronous calls that come after the starttest method are run before doing any assertions or testing. each test method is allowed to call this method only once. all of the code before this method should be used to initialize variables, populate data structures, and so on, allowing you to set up everything you need to run your test. any code that executes after the call to starttest and before stoptest is assigned a new set of governor limits. stoptest() marks the point in your test code when your test ends. use this method in conjunction with the starttest method. 3458apex reference guide test class signature public static void stoptest() return value type: void usage each test method is allowed to call this method only once. any code that executes after the stoptest method is assigned the original limits that were in effect before starttest was called. all asynchronous calls made after the starttest method are collected by the system. when stoptest is executed, all asynchronous processes are run synchronously. note: asynchronous calls, such as @future or executebatch, called in a starttest, stoptest block, do not count against your limits for the number of queued jobs. testinstall(installimplementation, version, ispush) tests the implementation of the installhandler interface, which is used for specifying" "a post install script in packages. tests run as the test initiator in the development environment. signature public static void testinstall(installhandler installimplementation, version version, boolean ispush) parameters installimplementation type: system.installhandler a class that implements the installhandler interface. version type: system.version the version number of the existing package installed in the subscriber organization. ispush type: boolean (optional) specifies whether the upgrade is a push. the default value is false. return value type: void usage this method throws a run-time exception if the test install fails. 3459apex reference guide test class example @istest static void test() { postinstallclass postinstall = new postinstallclass(); test.testinstall(postinstall, new version(1,0)); } testsandboxpostcopyscript(script, organizationid, sandboxid, sandboxname) tests the implementation of the sandboxpostcopy interface, which is used for specifying a script to run at the completion of a sandbox copy. tests run as the test initiator in the development environment. signature public static void testsandboxpostcopyscript(system.sandboxpostcopy script, id organizationid, id sandboxid, string sandboxname) parameters script type: system.sandboxpostcopy a class that implements the sandboxpostcopy interface. organizationid type: id the sandbox organization id sandboxid type: id the sandbox id to be provided to the sandboxpostcopy script. sandboxname type: string the sandbox name to be provided to the sandboxpostcopy script. return value type: void usage this method throws a run-time exception if the test install fails. note: salesforce recommends that you use the testsandboxpostcopyscript(script, organizationid, sandboxid, sandboxname, isrunasautoprocuser) overload instead of this method. when isrunasautoprocuser is true, the sandboxpostcopy script is tested with the same user access permissions as used by post-copy tasks during sandbox creation. using the same permissions enables the test to better simulate the actual usage of the class, and to uncover potential issues. 3460apex reference guide test class example see sandboxpostcopy example implementation testsandboxpostcopyscript(script, organizationid, sandboxid, sandboxname, runasautoprocuser) tests the implementation of the sandboxpostcopy interface, which is used for specifying a script to run at the completion of a sandbox copy. when runasautoprocuser is true, tests run as automated process user in the development environment. signature public static void testsandboxpostcopyscript(system.sandboxpostcopy script, id organizationid, id sandboxid, string sandboxname, boolean runasautoprocuser) parameters script type: system.sandboxpostcopy a class that implements the sandboxpostcopy interface. organizationid type: id the sandbox organization id. sandboxid type: id the sandbox id to be provided to the sandboxpostcopy script. sandboxname type: string the sandbox name to be provided to the sandboxpostcopy script. runasautoprocuser type: boolean when true, the sandboxpostcopy script is tested with the same user access permissions as used by post-copy tasks during sandbox creation. using the same permissions enables the test to better simulate the actual usage of the class, and to uncover potential issues. when false, the test runs as the test initiator. this option can alter the permissions with which the script is tested, such as the ability to access objects and features. return value type: void usage this method throws a run-time exception if the test install fails. 3461apex reference guide time class example see sandboxpostcopy example implementation testuninstall(uninstallimplementation) tests the implementation of the uninstallhandler interface, which is used for specifying an uninstall script in packages. tests run as the test initiator in the development environment. signature public static void testuninstall(uninstallhandler uninstallimplementation) parameters uninstallimplementation type: system.uninstallhandler a class that implements the uninstallhandler interface. return value type: void usage this method throws a run-time exception if the test uninstall fails. example @istest static void test() { uninstallclass uninstall = new uninstallclass(); test.testun" "install(uninstall); } time class contains methods for the time primitive data type. namespace system usage for more information on time, see time data type. time methods the following are methods for time. 3462apex reference guide time class in this section: addhours(additionalhours) adds the specified number of hours to a time. addmilliseconds(additionalmilliseconds) adds the specified number of milliseconds to a time. addminutes(additionalminutes) adds the specified number of minutes to a time. addseconds(additionalseconds) adds the specified number of seconds to a time. hour() returns the hour component of a time. millisecond() returns the millisecond component of a time. minute() returns the minute component of a time. newinstance(hour, minutes, seconds, milliseconds) constructs a time from integer representations of the specified hour, minutes, seconds, and milliseconds. (utc is assumed.) second() returns the second component of a time. addhours(additionalhours) adds the specified number of hours to a time. signature public time addhours(integer additionalhours) parameters additionalhours type: integer return value type: time example time mytime = time.newinstance(1, 2, 3, 4); time expected = time.newinstance(4, 2, 3, 4); system.assertequals(expected, mytime.addhours(3)); addmilliseconds(additionalmilliseconds) adds the specified number of milliseconds to a time. 3463apex reference guide time class signature public time addmilliseconds(integer additionalmilliseconds) parameters additionalmilliseconds type: integer return value type: time example time mytime = time.newinstance(1, 2, 3, 0); time expected = time.newinstance(1, 2, 4, 400); system.assertequals(expected, mytime.addmilliseconds(1400)); addminutes(additionalminutes) adds the specified number of minutes to a time. signature public time addminutes(integer additionalminutes) parameters additionalminutes type: integer return value type: time example time mytime = time.newinstance(18, 30, 2, 20); integer myminutes = mytime.minute(); myminutes = myminutes + 5; system.assertequals(myminutes, 35); addseconds(additionalseconds) adds the specified number of seconds to a time. signature public time addseconds(integer additionalseconds) 3464apex reference guide time class parameters additionalseconds type: integer return value type: time example time mytime = time.newinstance(1, 2, 55, 0); time expected = time.newinstance(1, 3, 5, 0); system.assertequals(expected, mytime.addseconds(10)); hour() returns the hour component of a time. signature public integer hour() return value type: integer example time mytime = time.newinstance(18, 30, 2, 20); mytime = mytime.addhours(2); integer myhour = mytime.hour(); system.assertequals(myhour, 20); millisecond() returns the millisecond component of a time. signature public integer millisecond() return value type: integer example time mytime = time.newinstance(3, 14, 15, 926); system.assertequals(926, mytime.millisecond()); 3465apex reference guide time class minute() returns the minute component of a time. signature public integer minute() return value type: integer example time mytime = time.newinstance(3, 14, 15, 926); system.assertequals(14, mytime.minute()); newinstance(hour, minutes, seconds, milliseconds) constructs a time from integer representations of the specified hour, minutes, seconds, and milliseconds. (utc is assumed.) signature public static time newinstance(integer hour, integer minutes, integer seconds, integer milliseconds) parameters hour type: integer minutes type: integer seconds type: integer milliseconds type: integer return value type: time example the following example creates a time of 18:30" ":2:20 (utc). time mytime = time.newinstance(18, 30, 2, 20); 3466apex reference guide timezone class second() returns the second component of a time. signature public integer second() return value type: integer example time mytime = time.newinstance(3, 14, 15, 926); system.assertequals(15, mytime.second()); timezone class represents a time zone. contains methods for creating a new time zone and obtaining time zone properties, such as the time zone id, offset, and display name. namespace system usage you can use the methods in this class to get properties of a time zone, such as the properties of the time zone returned by userinfo.gettimezone, or the time zone returned by gettimezone of this class. example this example shows how to get properties of the current user’s time zone and displays them to the debug log. timezone tz = userinfo.gettimezone(); system.debug('display name: ' + tz.getdisplayname()); system.debug('id: ' + tz.getid()); // during daylight saving time for the america/los_angeles time zone system.debug('offset: ' + tz.getoffset(datetime.newinstance(2012,10,23,12,0,0))); // not during daylight saving time for the america/los_angeles time zone system.debug('offset: ' + tz.getoffset(datetime.newinstance(2012,11,23,12,0,0))); system.debug('string format: ' + tz.tostring()); the output of this sample varies based on the user's time zone. this is an example output if the user’s time zone is america/los_angeles. for this time zone, daylight saving time is -7 hours from gmt (-25200000 milliseconds) and standard time is -8 hours from gmt (-28800000 milliseconds). display name: pacific standard time id: america/los_angeles offset: -25200000 3467apex reference guide timezone class offset: -28800000 string format: america/los_angeles this second example shows how to create a time zone for the new york time zone and get the offset of this time zone to the gmt time zone. the example uses two dates to get the offset from. one date is before dst (daylight saving time), and one is after dst. in 2000, dst ended on sunday, october 29 for the new york time zone. because the date occurs after dst ends, the offset on the first date is –5 hours to gmt. in 2012, dst ended on sunday, november 4. because the date is within dst, the offset on the second date is –4 hours. // get the new york time zone timezone tz = timezone.gettimezone('america/new_york'); // create a date before the 2007 shift of dst into november datetime dtpre = datetime.newinstancegmt(2000, 11, 1, 0, 0, 0); system.debug(tz.getoffset(dtpre)); //-18000000 (= -5 hours = est) // create a date after the 2007 shift of dst into november datetime dtpost = datetime.newinstancegmt(2012, 11, 1, 0, 0, 0); system.debug(tz.getoffset(dtpost)); //-14400000 (= -4 hours = edt) this next example is similar to the previous one except that it gets the offset around the boundary of dst. in 2014, dst ended on sunday, november 2 at 2:00 am local time for the new york time zone. the first offset is obtained right before dst ends, and the second offset is obtained right after dst ends. the dates are created by using the datetime.newinstancegmt method. this method expects the passed-in date values to be based on the gmt time zone. // get the new york time zone timezone tz = timezone.gettimezone('america/new_york'); // before dst ends datetime dtpre = datetime.newinstancegmt(2014, 11, 2, 5, 59, 59); //1:59:59am local edt system.debug(tz.getoffset(dtpre)); //-14400000 (= -4 hours = still on dst) // after dst ends datetime dtpost = datetime.newinstancegmt(2014, 11, 2," "6, 0, 0); //1:00:00am local est system.debug(tz.getoffset(dtpost)); //-18000000 (= -5 hours = back one hour) timezone methods the following are methods for timezone. in this section: getdisplayname() returns this time zone’s display name. getid() returns this time zone’s id. getoffset(date) returns the time zone offset, in milliseconds, of the specified date to the gmt time zone. gettimezone(timezoneidstring) returns the time zone corresponding to the specified time zone id. tostring() returns the string representation of this time zone. 3468apex reference guide timezone class getdisplayname() returns this time zone’s display name. signature public string getdisplayname() return value type: string versioned behavior changes in api version 45.0 and later, getdisplayname displays daylight savings time appropriately when daylight savings are in effect. for example, british summer time is displayed for europe/london and pacific daylight time for america/los_angeles. getid() returns this time zone’s id. signature public string getid() return value type: string getoffset(date) returns the time zone offset, in milliseconds, of the specified date to the gmt time zone. signature public integer getoffset(datetime date) parameters date type: datetime the date argument is the date and time to evaluate. return value type: integer usage note: the returned offset is adjusted for daylight saving time if the date argument falls within daylight saving time for this time zone. 3469apex reference guide trigger class gettimezone(timezoneidstring) returns the time zone corresponding to the specified time zone id. signature public static timezone gettimezone(string timezoneidstring) parameters timezoneidstring type: string the time zone values you can use for the id argument are any valid time zone values that the java timezone class supports. return value type: timezone example timezone tz = timezone.gettimezone('america/los_angeles'); string tzname = tz.getdisplayname(); system.assert(tzname.equals('(gmt-08:00) pacific standard time (america/los_angeles)') || tzname.equals('(gmt-07:00) pacific daylight time (america/los_angeles)')); tostring() returns the string representation of this time zone. signature public string tostring() return value type: string trigger class use the trigger class to access run-time context information in a trigger, such as the type of trigger or the list of sobject records that the trigger operates on. namespace system trigger context variables the trigger class provides the following context variables. 3470apex reference guide trigger class variable usage isexecuting returns true if the current context for the apex code is a trigger, not a visualforce page, a web service, or an executeanonymous() api call. isinsert returns true if this trigger was fired due to an insert operation, from the salesforce user interface, apex, or the api. isupdate returns true if this trigger was fired due to an update operation, from the salesforce user interface, apex, or the api. isdelete returns true if this trigger was fired due to a delete operation, from the salesforce user interface, apex, or the api. isbefore returns true if this trigger was fired before any record was saved. isafter returns true if this trigger was fired after all records were saved. isundelete returns true if this trigger was fired after a record is recovered from the recycle bin. this recovery can occur after an undelete operation from the salesforce user interface, apex, or the api. new returns a list of the new versions of the sobject records. this sobject list is only available in insert, update, and undelete triggers, and the records can only be modified in before triggers. newmap a map of ids to the new versions of the sobject records. this map is only available in before update, after insert, after update, and after undelete triggers. old returns a list of the old versions of the sobject records. this sobject list is only available in update and delete triggers. oldmap a map of ids to the old versions of the sobject records. this map is only available in update and delete triggers. operationtype returns an enum" "of type system.triggeroperation corresponding to the current operation. possible values of the system.triggeroperation enum are: before_insert, before_update, before_delete,after_insert, after_update, after_delete, and after_undelete. if you vary your programming logic based on different trigger types, consider using the switch statement with different permutations of unique trigger execution enum states. size the total number of records in a trigger invocation, both old and new. note: the record firing a trigger can include an invalid field value, such as a formula that divides by zero. in this case, the field value is set to null in these variables: • new • newmap • old • oldmap 3471apex reference guide trigger class example for example, in this simple trigger, trigger.new is a list of sobjects and can be iterated over in a for loop. it can also be used as a bind variable in the in clause of a soql query. trigger simpletrigger on account (after insert) { for (account a : trigger.new) { // iterate over each sobject } // this single query finds every contact that is associated with any of the // triggering accounts. note that although trigger.new is a collection of // records, when used as a bind variable in a soql query, apex automatically // transforms the list of records into a list of corresponding ids. contact[] cons = [select lastname from contact where accountid in :trigger.new]; } this trigger uses boolean context variables like trigger.isbefore and trigger.isdelete to define code that only executes for specific trigger conditions: trigger myaccounttrigger on account(before delete, before insert, before update, after delete, after insert, after update) { if (trigger.isbefore) { if (trigger.isdelete) { // in a before delete trigger, the trigger accesses the records that will be // deleted with the trigger.old list. for (account a : trigger.old) { if (a.name != 'oktodelete') { a.adderror('you can\'t delete this record!'); } } } else { // in before insert or before update triggers, the trigger accesses the new records // with the trigger.new list. for (account a : trigger.new) { if (a.name == 'bad') { a.name.adderror('bad name'); } } if (trigger.isinsert) { for (account a : trigger.new) { system.assertequals('xxx', a.accountnumber); system.assertequals('industry', a.industry); system.assertequals(100, a.numberofemployees); system.assertequals(100.0, a.annualrevenue); a.accountnumber = 'yyy'; } // if the trigger is not a before trigger, it must be an after trigger. } else { if (trigger.isinsert) { list contacts = new list(); 3472apex reference guide triggeroperation enum for (account a : trigger.new) { if(a.name == 'makecontact') { contacts.add(new contact (lastname = a.name, accountid = a.id)); } } insert contacts; } } }}} triggeroperation enum system.triggeroperation enum values are associated with trigger events. enum values the following are the values of the system.triggeroperation enum: • after_delete • after_insert • after_undelete • after_update • before_delete • before_insert • before_update type class contains methods for getting the apex type that corresponds to an apex class and for instantiating new types. namespace system usage use the forname methods to retrieve the type of an apex class, which can be a built-in or a user-defined class. you can use these methods to retrieve the type of public and global classes, and not private classes even if the context user has access. also, use the newinstance method if you want to instantiate a type that implements an interface and call its methods while letting someone else, such as a subscriber of your package, provide the methods’ implementations. note: a call to type.forname() can cause the class to be compiled. example: instantiating a type based on its name the following sample shows how" "to use the type methods to instantiate a type based on its name. a typical application of this scenario is when a package subscriber provides a custom implementation of an interface that is part of an installed package. the package can 3473apex reference guide type class get the name of the class that implements the interface through a custom setting in the subscriber’s org. the package can then instantiate the type that corresponds to this class name and invoke the methods that the subscriber implemented. in this sample, vehicle represents the interface that the vehicleimpl class implements. the last class contains the code sample that invokes the methods implemented in vehicleimpl. this is the vehicle interface. global interface vehicle { long getmaxspeed(); string gettype(); } this is the implementation of the vehicle interface. global class vehicleimpl implements vehicle { global long getmaxspeed() { return 100; } global string gettype() { return 'sedan'; } } the method in this class gets the name of the class that implements the vehicle interface through a custom setting value. it then instantiates this class by getting the corresponding type and calling the newinstance method. next, it invokes the methods implemented in vehicleimpl. this sample requires that you create a public list custom setting named customimplementation with a text field named classname. create one record for this custom setting with a data set name of vehicle and a class name value of vehicleimpl. public class customerimplinvocationclass { public static void invokecustomimpl() { // get the class name from a custom setting. // this class implements the vehicle interface. customimplementation__c cs = customimplementation__c.getinstance('vehicle'); // get the type corresponding to the class name type t = type.forname(cs.classname__c); // instantiate the type. // the type of the instantiated object // is the interface. vehicle v = (vehicle)t.newinstance(); // call the methods that have a custom implementation system.debug('max speed: ' + v.getmaxspeed()); system.debug('vehicle type: ' + v.gettype()); } } class property the class property returns the system.type of the type it is called on. it’s exposed on all apex built-in types including primitive data types and collections, sobject types, and user-defined classes. this property can be used instead of forname methods. call this property on the type name. for example: system.type t = integer.class; 3474apex reference guide type class you can use this property for the second argument of json.deserialize, deserializestrict, jsonparser.readvalueas, and readvalueasstrict methods to get the type of the object to deserialize. for example: decimal n = (decimal)json.deserialize('100.1', decimal.class); type methods the following are methods for type. in this section: equals(typetocompare) returns true if the specified type is equal to the current type; otherwise, returns false. forname(fullyqualifiedname) returns the type that corresponds to the specified fully qualified class name. forname(namespace, name) returns the type that corresponds to the specified namespace and class name. getname() returns the name of the current type. hashcode() returns a hash code value for the current type. isassignablefrom(sourcetype) returns true if an object reference of the specified type can be assigned from the child type; otherwise, returns false. newinstance() creates an instance of the current type and returns this new instance. tostring() returns a string representation of the current type, which is the type name. equals(typetocompare) returns true if the specified type is equal to the current type; otherwise, returns false. signature public boolean equals(object typetocompare) parameters typetocompare type: object the type to compare with the current type. return value type: boolean 3475apex reference guide type class example type t1 = account.class; type t2 = type.forname('account'); system.assert(t1.equals(t2)); forname(fullyqualifiedname) returns the type that corresponds to the specified fully qualified class name. signature public static system.type forname(string fullyqualifiedname) parameters fullyqualifiedname type: string the fully qualified name of the class to get the type of. the fully qualified class name contains the namespace" "name, for example, mynamespace.classname. return value type: system.type usage note: • this method returns null if called outside a managed package to get the type of a non-global class in a managed package. this is because the non-global class isn’t visible outside the managed package. for apex saved using salesforce api version 27.0 and earlier, this method does return the corresponding class type for the non-global managed package class. • when called from an installed managed package to get the name of a local type in an organization with no defined namespace, the forname(fullyqualifiedname) method returns null. instead, use the forname(namespace, name) method and specify an empty string or null for the namespace argument. • a call to type.forname() can cause the class to be compiled. forname(namespace, name) returns the type that corresponds to the specified namespace and class name. signature public static system.type forname(string namespace, string name) parameters namespace type: string the namespace of the class. if the class doesn't have a namespace, set the namespace argument to null or an empty string. 3476apex reference guide type class name type: string the name of the class. return value type: system.type usage note: • this method returns null if called outside a managed package to get the type of a non-global class in a managed package. this is because the non-global class isn’t visible outside the managed package. for apex saved using salesforce api version 27.0 and earlier, this method does return the corresponding class type for the non-global managed package class. • use this method instead of forname(fullyqualifiedname) if it’s called from a managed package installed in an organization with no defined namespace. to get the name of a local type, set the namespace argument to an empty string or null. for example, type t = type.forname('', 'classname');. • a call to type.forname() can cause the class to be compiled. example this example shows how to get the type that corresponds to the classname class and the mynamespace namespace. type mytype = type.forname('mynamespace', 'classname'); getname() returns the name of the current type. signature public string getname() return value type: string example this example shows how to get a type’s name. it first obtains a type by calling forname, then calls getname on the type object. type t = type.forname('myclassname'); string typename = t.getname(); system.assertequals('myclassname', typename); 3477apex reference guide type class hashcode() returns a hash code value for the current type. signature public integer hashcode() return value type: integer usage the returned hash code value corresponds to the type name hash code that string.hashcode returns. isassignablefrom(sourcetype) returns true if an object reference of the specified type can be assigned from the child type; otherwise, returns false. signature public boolean isassignablefrom(type sourcetype) parameters sourcetype the type of the object with which you are checking compatibility. return value type: boolean the method returns true when the method is invoked as parenttype.isassignablefrom(childtype). when invoked in any of the following ways, the method returns false: • childtype.isassignablefrom(parenttype) • typea.isassignablefrom(typeb) where typeb is a sibling of typea • typea.isassignablefrom(typeb) where typeb and typea are unrelated note: a childtype is the child of a parenttype when it implements an interface, extends a virtual or abstract class, or is the same system.type as the parenttype. usage unlike the instanceof operator, this method allows you to check type compatibility without having to create a class instance. this method eliminates static compile-time dependencies that instanceof requires. the following code demonstrates how a typical isv customer can use isassignablefrom() to check compatibility between a customer-defined type (customerprovidedplugintype) and a valid plugin type. //scenario: managed package code loading a “plugin” class that implements a managed interface; the implementation done outside of the package 3478apex reference guide type class string pluginnamestr =" "config__c.getinstance().pluginapextype__c; type customerprovidedplugintype = type.forname(pluginnamestr); type plugininterface = managedplugininterface.class; // constructors may have side-effects, including potentially unsafe dml/callouts. // we want to make sure the class is really designed to be a valid plugin before we instantiate it boolean validplugin = plugininterface.isassignablefrom(customerprovidedplugintype); // validate that it implements the right interface if(!validplugin){ throw new securityexception('cannot create instance of '+customerprovidedplugintype+'. does not implement managedplugininterface'); }else{ return type.newinstance(validplugin); } example the following code snippet first defines sibling classes a and b that both implement the callable interface and an unrelated class c. then, it explores several type comparisons using isassignablefrom(). //define classes a, b, and c global class a implements database.batchable, callable { global iterable start(database.batchablecontext context) { return null; } global void execute(database.batchablecontext context, string[] scope) { } global void finish(database.batchablecontext context) { } global object call(string action, map args) { return null; } } global class b implements callable { global object call(string action, map args) { return null; } } global class c { } type listofstrings = type.forname('list'); type listofintegers = type.forname('list'); boolean flaglisttypes = listofintegers.isassignablefrom(listofstrings); // false //examples with stringtype and idtype type stringtype = type.forname('string'); type idtype = type.forname('id'); boolean isid_assignablefromstring = idtype.isassignablefrom(stringtype); // true //isassignablefrom respects that string can be assigned to id without an explicit cast //examples with typea, typeb, and typec type typea = type.forname('a'); type typeb = type.forname('b'); type typec = type.forname('c'); boolean istypeb_oftypea = typeb.isassignablefrom( typea ); // false - siblings 3479apex reference guide type class boolean istypea_oftypec = typea.isassignablefrom( typec ); // false - unrelated types boolean istypea_oftypea = typea.isassignablefrom(typea); // true - identity //examples with callabletype and batchabletype type callabletype = type.forname('callable'); type batchabletype = type.forname('database.batchable'); boolean istypea_callable = callabletype.isassignablefrom( typea ); // true - type a is a child of callable type boolean istypea_batchable = batchabletype.isassignablefrom( typea ); // true - type a is a child of batchable type boolean iscallableoftypea = typea.isassignablefrom( callabletype ); // false - callable type is not a child of type a boolean isbatchableoftypea = typea.isassignablefrom( batchabletype ); // false - batchable type is not a child of type a newinstance() creates an instance of the current type and returns this new instance. signature public object newinstance() return value type: object usage because newinstance returns the generic object type, you should cast the return value to the type of the variable that will hold this value. this method enables you to instantiate a type that implements an interface and call its methods while letting someone else provide the methods’ implementation. for example, a package developer can provide an interface that a subscriber who installs the package can implement. the code in the package calls the subscriber's implementation of the interface methods by instantiating the subscriber’s type. example this example shows how to create an instance of a type. it first gets a type by calling forname with the name of a class (shapeimpl), then calls newinstance on this type object. the newobj instance is declared with the interface type (shape)" "that the shapeimpl class implements. the return value of the newinstance method is cast to the shape type. type t = type.forname('shapeimpl'); shape newobj = (shape)t.newinstance(); tostring() returns a string representation of the current type, which is the type name. 3480apex reference guide uninstallhandler interface signature public string tostring() return value type: string usage this method returns the same value as getname. string.valueof and system.debug use this method to convert their type argument into a string. example this example calls tostring on the type corresponding to a list of integers. type t = list.class; string s = t.tostring(); system.assertequals('list', s); uninstallhandler interface enables custom code to run after a managed package is uninstalled. namespace system usage app developers can implement this interface to specify apex code that runs automatically after a subscriber uninstalls a managed package. this makes it possible to perform cleanup and notification tasks based on details of the subscriber’s organization. the uninstall script is subject to default governor limits. it runs as a special system user that represents your package, so all operations performed by the script will appear to be done by your package. you can access this user by using userinfo. you will only see this user at runtime, not while running tests. if the script fails, the uninstall continues but none of the changes performed by the script are committed. any errors in the script are emailed to the user specified in the notify on apex error field of the package. if no user is specified, the uninstall details will be unavailable. the uninstall script has the following restrictions. you can’t use it to initiate batch, scheduled, and future jobs, to access session ids, or to perform callouts. the uninstallhandler interface has a single method called onuninstall, which specifies the actions to be performed on uninstall. global interface uninstallhandler { void onuninstall(uninstallcontext context)}; the onuninstall method takes a context object as its argument, which provides the following information. • the org id of the organization in which the uninstall takes place. 3481apex reference guide uninstallhandler interface • the user id of the user who initiated the uninstall. the context argument is an object whose type is the uninstallcontext interface. this interface is automatically implemented by the system. the following definition of the uninstallcontext interface shows the methods you can call on the context argument. global interface uninstallcontext { id organizationid(); id uninstallerid(); } in this section: uninstallhandler methods uninstallhandler example implementation uninstallhandler methods the following are methods for uninstallhandler. in this section: onuninstall(context) specifies the actions to be performed on uninstall. onuninstall(context) specifies the actions to be performed on uninstall. signature public void onuninstall(uninstallcontext context) parameters context type: uninstallcontext return value type: void uninstallhandler example implementation example of an uninstall script the sample uninstall script below performs the following actions on package uninstall. • inserts an entry in the feed describing which user did the uninstall and in which organization 3482" "apex reference guide url class • creates and sends an email message confirming the uninstall to that user global class uninstallclass implements uninstallhandler { global void onuninstall(uninstallcontext ctx) { feeditem feedpost = new feeditem(); feedpost.parentid = ctx.uninstallerid(); feedpost.body = 'thank you for using our application!'; insert feedpost; user u = [select id, email from user where id =:ctx.uninstallerid()]; string toaddress= u.email; string[] toaddresses = new string[] {toaddress}; messaging.singleemailmessage mail = new messaging.singleemailmessage(); mail.settoaddresses(toaddresses); mail.setreplyto('support@package.dev'); mail.setsenderdisplayname('my package support'); mail.setsubject('package uninstall successful'); mail.setplaintextbody('thanks for uninstalling the package.'); messaging.sendemail(new messaging.email[] { mail }); } } you can test an uninstall script using the testuninstall method of the test class. this method takes as its argument a class that implements the uninstallhandler interface. this sample shows how to test an uninstall script implemented in the uninstallclass apex class. @istest static void testuninstallscript() { id uninstallerid = userinfo.getuserid(); list feedpostsbefore = [select id from feeditem where parentid=:uninstallerid and createddate=today]; test.testuninstall(new uninstallclass()); list feedpostsafter = [select id from feeditem where parentid=:uninstallerid and createddate=today]; system.assertequals(feedpostsbefore.size() + 1, feedpostsafter.size(), 'post to uninstaller failed.'); } url class represents a uniform resource locator (url) and provides access to parts of the url. enables access to the base url used to access your salesforce org. namespace system 3483apex reference guide url class usage use the methods of the system.url class to create links to objects in your organization. such objects can be files, images, logos, or records that you want to include in external emails, in activities, or in chatter posts. for example, you can create a link to a file uploaded as an attachment to a chatter post by concatenating the salesforce base url with the file id: // get a file uploaded through chatter. contentdocument doc = [select id from contentdocument where title = 'myfile']; // create a link to the file. string fullfileurl = url.getsalesforcebaseurl().toexternalform() + '/' + doc.id; system.debug(fullfileurl); the following example creates a link to a salesforce record. the full url is created by concatenating the salesforce base url with the record id. account acct = [select id from account where name = 'acme' limit 1]; string fullrecordurl = url.getsalesforcebaseurl().toexternalform() + '/' + acct.id; example in this example, the base url and the full request url of the current salesforce server instance are retrieved. next, a url pointing to a specific account object is created. finally, components of the base and full url are obtained. this example prints out all the results to the debug log output. // create a new account called acme that we will create a link for later. account myaccount = new account(name='acme'); insert myaccount; // get the base url. string sfdcbaseurl = url.getsalesforcebaseurl().toexternalform(); system.debug('base url: ' + sfdcbaseurl ); // get the url for the current request. string currentrequesturl = url.getcurrentrequesturl().toexternalform(); system.debug('current request url: ' + currentrequesturl); // create the account url from the base url. string accounturl = url.getsalesforcebaseurl().toexternalform() + '/' + myaccount.id; system.debug('url of a particular account: ' + accounturl); // get some parts of the base url. system.debug('host: ' + url.getsalesforcebaseurl().gethost()); system.debug('protocol: ' + url.getsalesforcebaseurl().getprotocol());" "// get the query string of the current request. system.debug('query: ' + url.getcurrentrequesturl().getquery()); versioned behavior changes in api version 41.0 and later, apex url objects are represented by the java.net.uri type, not the java.net.url type. the api version in which the url object was instantiated determines the behavior of subsequent method calls to the specific instance. 3484apex reference guide url class salesforce strongly encourages you to use api 41.0 and later versions for fully rfc-compliant url parsing that includes proper handling of edge cases of complex url structures. api 41.0 and later versions also enforce that inputs are valid, rfc-compliant url or uri strings. in this section: url constructors url methods url constructors the following are constructors for url. in this section: url(spec) creates a new instance of the url class using the specified string representation of the url. url(context, spec) creates a new instance of the url class by parsing the specified spec within the specified context. url(protocol, host, file) creates a new instance of the url class using the specified protocol, host, and file on the host. the default port for the specified protocol is used. url(protocol, host, port, file) creates a new instance of the url class using the specified protocol, host, port, and file on the host. url(spec) creates a new instance of the url class using the specified string representation of the url. signature public url(string spec) parameters spec type: string the string to parse as a url. url(context, spec) creates a new instance of the url class by parsing the specified spec within the specified context. signature public url(url context, string spec) 3485apex reference guide url class parameters context type: url on page 3483 the context in which to parse the specification. spec type: string the string to parse as a url. usage the new url is created from the given context url and the spec argument as described in rfc2396 ""uniform resource identifiers : generic * syntax"" : ://?# for more information about the arguments of this constructor, see the corresponding url(java.net.url, java.lang.string) constructor for java. url(protocol, host, file) creates a new instance of the url class using the specified protocol, host, and file on the host. the default port for the specified protocol is used. signature public url(string protocol, string host, string file) parameters protocol type: string the protocol name for this url. host type: string the host name for this url. file type: string the file name for this url. url(protocol, host, port, file) creates a new instance of the url class using the specified protocol, host, port, and file on the host. signature public url(string protocol, string host, integer port, string file) 3486apex reference guide url class parameters protocol type: string the protocol name for this url. host type: string the host name for this url. port type: integer the port number for this url. file type: string the file name for this url. url methods the following are methods for url. in this section: getauthority() returns the authority portion of the current url. getcurrentrequesturl() returns the url of an entire request on a salesforce instance. getdefaultport() returns the default port number of the protocol associated with the current url. getfile() returns the file name of the current url. getfilefieldurl(entityid, fieldname) returns the download url for a file attachment. gethost() returns the host name of the current url. getorgdomainurl() returns the canonical url for your org. for example, https://mydomainname.my.salesforce.com. getpath() returns the path portion of the current url. getport() returns the port of the current url. getprotocol() returns the protocol name of the current url, such as, https. getquery() returns the query portion of the current url. 3487apex reference guide url class getref() returns the anchor of the current url. getsalesforce" "baseurl() returns the url of the current connection to the salesforce org. getuserinfo() gets the userinfo portion of the current url. samefile(urltocompare) compares the current url with the specified url object, excluding the fragment component. toexternalform() returns a string representation of the current url. getauthority() returns the authority portion of the current url. signature public string getauthority() return value type: string getcurrentrequesturl() returns the url of an entire request on a salesforce instance. signature public static system.url getcurrentrequesturl() return value type: system.url usage an example of a url for an entire request is https://yourinstance.salesforce.com/apex/myvfpage.apexp. getdefaultport() returns the default port number of the protocol associated with the current url. signature public integer getdefaultport() 3488apex reference guide url class return value type: integer usage returns -1 if the url scheme or the stream protocol handler for the url doesn't define a default port number. getfile() returns the file name of the current url. signature public string getfile() return value type: string getfilefieldurl(entityid, fieldname) returns the download url for a file attachment. signature public static string getfilefieldurl(string entityid, string fieldname) parameters entityid type: string specifies the id of the entity that holds the file data. fieldname type: string specifies the api name of a file field component, such as attachmentbody. return value type: string usage example: example string fileurl = url.getfilefieldurl( 3489apex reference guide url class '087000000000123' , 'attachmentbody'); gethost() returns the host name of the current url. signature public string gethost() return value type: string getorgdomainurl() returns the canonical url for your org. for example, https://mydomainname.my.salesforce.com. signature public static system.url getorgdomainurl() return value type: system.url getorgdomainurl() always returns the login url for your org, regardless of context. use that url when making api calls to your org. usage use getorgdomainurl() to interact with salesforce rest and soap apis in apex code. get endpoints for user interface api calls, for creating and customizing picklist value sets and custom fields, and more. getorgdomainurl() can access the domain url only for the org in which the apex code is running. you don't need a remotesitesetting for your org to interact with the salesforce apis using domain urls retrieved with this method. example this example uses the salesforce rest api to get organization limit values. for information on limits, see limits in the rest api developer guide. http h = new http(); httprequest req = new httprequest(); req.setendpoint(url.getorgdomainurl().toexternalform() + '/services/data/v44.0/limits'); req.setmethod('get'); 3490apex reference guide url class req.setheader('authorization', 'bearer ' + userinfo.getsessionid()); httpresponse res = h.send(req); see also: getsalesforcebaseurl() lightning aura components developer guide: making api calls from apex user interface api developer guide: get default values to clone a record user interface api developer guide: get values for a picklist field user interface api developer guide: user inteface api resources getpath() returns the path portion of the current url. signature public string getpath() return value type: string getport() returns the port of the current url. signature public integer getport() return value type: integer getprotocol() returns the protocol name of the current url, such as, https. signature public string getprotocol() return value type: string getquery() returns the query portion of the current url. 3491apex reference guide url class signature public string getquery() return value type: string usage returns null if no query portion exists. getref() returns the anchor of the current url. signature public string getref() return value type: string usage returns null if no query portion exists" ". getsalesforcebaseurl() returns the url of the current connection to the salesforce org. signature public static system.url getsalesforcebaseurl() return value type: system.url returns the url for the current connection: for example, https://mydomainname.my.salesforce.com or https://mydomainname.lightning.force.com. see also: getorgdomainurl() getuserinfo() gets the userinfo portion of the current url. 3492apex reference guide userinfo class signature public string getuserinfo() return value type: string usage returns null if no userinfo portion exists. samefile(urltocompare) compares the current url with the specified url object, excluding the fragment component. signature public boolean samefile(system.url urltocompare) parameters urltocompare type: system.url return value type: boolean returns true if both url objects reference the same remote resource; otherwise, returns false. usage for more information about the syntax of uris and fragment components, see rfc3986. toexternalform() returns a string representation of the current url. signature public string toexternalform() return value type: string userinfo class contains methods for obtaining information about the context user. 3493apex reference guide userinfo class namespace system userinfo methods the following are methods for userinfo. all methods are static. in this section: getdefaultcurrency() returns the context user's default currency code for multiple currency organizations or the organization's currency code for single currency organizations. getfirstname() returns the context user's first name getlanguage() returns the context user's language getlastname() returns the context user's last name getlocale() returns the context user's locale. getname() returns the context user's full name. the format of the name depends on the language preferences specified for the organization. getorganizationid() returns the context organization's id. getorganizationname() returns the context organization's company name. getprofileid() returns the context user's profile id. getsessionid() returns the session id for the current session. gettimezone() returns the current user’s local time zone. getuitheme() returns the preferred theme for the current user. use getuithemedisplayed to determine the theme actually displayed to the current user. getuithemedisplayed() returns the theme being displayed for the current user. getuseremail() returns the current user’s email address. getuserid() returns the context user's id 3494apex reference guide userinfo class getusername() returns the context user's login name. getuserroleid() returns the context user's role id. getusertype() returns the context user's type. haspackagelicense(packageid) returns true if the context user has a license to the managed package via a package license only. otherwise, returns false. iscurrentuserlicensed(namespace) returns true if the context user has a license to any managed package denoted by the namespace. otherwise, returns false. iscurrentuserlicensedforpackage(packageid) returns true if the context user has a license to the managed package denoted by the package id. otherwise, returns false. if the context user has access, it’s determined either via the package license or a namespace permission set license for the package namespace. ismulticurrencyorganization() specifies whether the organization uses multiple currencies. getdefaultcurrency() returns the context user's default currency code for multiple currency organizations or the organization's currency code for single currency organizations. signature public static string getdefaultcurrency() return value type: string usage note: for apex saved using salesforce api version 22.0 or earlier, getdefaultcurrency returns null for single currency organizations. getfirstname() returns the context user's first name signature public static string getfirstname() return value type: string 3495apex reference guide userinfo class getlanguage() returns the context user's language signature public static string getlanguage() return value type: string getlastname() returns the context user's last name signature public static string getlastname() return value type: string getlocale() returns the context user's locale. signature public static string getlocale() return value type: string" "example string result = userinfo.getlocale(); system.assertequals('en_us', result); getname() returns the context user's full name. the format of the name depends on the language preferences specified for the organization. signature public static string getname() 3496apex reference guide userinfo class return value type: string usage the format is one of the following: • firstname lastname • lastname, firstname getorganizationid() returns the context organization's id. signature public static string getorganizationid() return value type: string getorganizationname() returns the context organization's company name. signature public static string getorganizationname() return value type: string getprofileid() returns the context user's profile id. signature public static string getprofileid() return value type: string getsessionid() returns the session id for the current session. 3497apex reference guide userinfo class signature public static string getsessionid() return value type: string usage you can use getsessionid() both synchronously and asynchronously. in asynchronous apex (batch, future, queueable, or scheduled apex), this method returns the session id only when the code is run by an active, valid user. when the code is run by an internal user, such as the automated process user or a proxy user, the method returns null. as a best practice, ensure that your code handles both cases: when a session id is or is not available. gettimezone() returns the current user’s local time zone. signature public static system.timezone gettimezone() return value type: system.timezone example timezone tz = userinfo.gettimezone(); system.debug( 'display name: ' + tz.getdisplayname()); system.debug( 'id: ' + tz.getid()); getuitheme() returns the preferred theme for the current user. use getuithemedisplayed to determine the theme actually displayed to the current user. signature public static string getuitheme() return value type: string the preferred theme for the current user. 3498apex reference guide userinfo class valid values include: • theme1—obsolete salesforce theme • theme2—salesforce classic 2005 user interface theme • theme3—salesforce classic 2010 user interface theme • theme4d—modern “lightning experience” salesforce theme • theme4t—salesforce mobile app theme • theme4u—lightning console theme • portaldefault—salesforce customer portal theme that applies to customer portals only and not to experience builder sites • webstore—appexchange theme getuithemedisplayed() returns the theme being displayed for the current user. signature public static string getuithemedisplayed() return value type: string the theme being displayed for the current user valid values include: • theme1—obsolete salesforce theme • theme2—salesforce classic 2005 user interface theme • theme3—salesforce classic 2010 user interface theme • theme4d—modern “lightning experience” salesforce theme • theme4t—salesforce mobile app theme • theme4u—lightning console theme • portaldefault—salesforce customer portal theme that applies to customer portals only and not to experience builder sites • webstore—appexchange theme getuseremail() returns the current user’s email address. signature public static string getuseremail() return value type: string 3499apex reference guide userinfo class example string emailaddress = userinfo.getuseremail(); system.debug( 'email address: ' + emailaddress); getuserid() returns the context user's id signature public static string getuserid() return value type: string getusername() returns the context user's login name. signature public static string getusername() return value type: string getuserroleid() returns the context user's role id. signature public static string getuserroleid() return value type: string getusertype() returns the context user's type. signature public static string getusertype() 3500apex reference guide userinfo class return value type: string haspackagelicense(packageid) returns true if the context user has a license to the managed package via a" "package license only. otherwise, returns false. signature public static boolean haspackagelicense(id packageid) parameters packageid type: string return value type: boolean iscurrentuserlicensed(namespace) returns true if the context user has a license to any managed package denoted by the namespace. otherwise, returns false. signature public static boolean iscurrentuserlicensed(string namespace) parameters namespace type: string return value type: boolean usage a typeexception is thrown if namespace is an invalid type. iscurrentuserlicensedforpackage(packageid) returns true if the context user has a license to the managed package denoted by the package id. otherwise, returns false. if the context user has access, it’s determined either via the package license or a namespace permission set license for the package namespace. signature public static boolean iscurrentuserlicensedforpackage(id packageid) 3501apex reference guide usermanagement class parameters packageid type: string return value type: boolean usage retrieve packageid at runtime, with the getcurrentpackageid() method. then, use packageid to confirm that the contextual user is licensed to use that managed package. a typeexception is thrown if packageid is an invalid type. a systemexception is thrown if packageid is the id of an unlocked or unmanaged package, or if the contextual user doesn’t have a license to the managed package. ismulticurrencyorganization() specifies whether the organization uses multiple currencies. signature public static boolean ismulticurrencyorganization() return value type: boolean usermanagement class contains methods to manage end users, for example, to register their verification methods, verify their identity, or remove their personal information. namespace system usage let users register and deregister identity verification methods. create custom login and verify pages for passwordless login and self-registration. convert mobile phone numbers to the proper format before registering users. scramble user data when users request that salesforce remove their personal information. this class is available in api version 43.0 and later. in this section: usermanagement methods 3502apex reference guide usermanagement class usermanagement methods the following are methods for usermanagement. in this section: clone() makes a duplicate copy of the system.usermanagement object. deregisterverificationmethod(userid, method) deregisters an identity verification method. use this method to let users delete an existing verification method. formatphonenumber(countrycode, phonenumber) formats a mobile phone number for a user. call this method to ensure that the phone number is formatted properly before updating a user’s mobile phone number. initpasswordlesslogin(userid, method) invokes a verification challenge for passwordless login when creating custom (visualforce) login and verify pages for customers and partners. initregisterverificationmethod(method) invokes a verification challenge for registering identity verification methods with a custom (visualforce) page. users can register either their email address or phone number. initselfregistration(method, user) invokes a verification challenge for self-registration when creating a custom (visualforce) verify page for experience cloud self-registration. initverificationmethod(method) initiates a verification service for email, phone (sms), and the salesforce authenticator verification methods. initverificationmethod(method, actionname, extras) initiates a verification service for email, phone (sms), and the salesforce authenticator verification methods. obfuscateuser(userid, username) scrambles users’ data on their request when they no longer want their personal data recognized in salesforce. when you invoke the method for the user, the data becomes anonymous, and you can never recover it. use this method to set the username to a specific value after it’s scrambled. obfuscateuser(userid) scrambles users’ data on their request when they no longer want their personal data recognized in salesforce. when you invoke the method for the user, the data becomes anonymous, and you can never recover it. registerverificationmethod(method, starturl) registers an identity verification method. verification methods can be a time-based one-time password (totp), email or text verification code, salesforce authenticator, or u2f-compatible security key. end users register verification methods for themselves. sendasyncemailconfirmation(userid, emailtemplateid, networkid, starturl) send an email message to a user�" "�s email address for verification. the message contains a verification link (url) that the user clicks to verify the email address later on. you can send email verifications in bulk. verifypasswordlesslogin(userid, method, identifier, code, starturl) completes a verification challenge during a passwordless login that uses a custom verify page (visualforce only). if the user who is trying to log in enters the verification code successfully, the user is logged in. 3503apex reference guide usermanagement class verifyregisterverificationmethod(code, method) completes registering a user’s email address or phone number as a verification method when customizing the identity verification process. verifyselfregistration(method, identifier, code, starturl) completes a verification challenge when creating a custom (visualforce) verify page for experience cloud site self-registration. if the person who is attempting to register enters the verification code successfully, the user is created and logged in. verifyverificationmethod(identifier, code, method) completes the verification service for email, phone (sms), salesforce authenticator, password, or time-based one-time password (totp) verification methods. clone() makes a duplicate copy of the system.usermanagement object. signature public object clone() return value type: user management deregisterverificationmethod(userid, method) deregisters an identity verification method. use this method to let users delete an existing verification method. signature public static void deregisterverificationmethod(id userid, auth.verificationmethod method) parameters userid type: id user id of the user deregistering the verification method. method type: auth.verificationmethod verification method used to verify the identity of the user. return value type: void 3504apex reference guide usermanagement class usage use this method to deregister an existing identity verification method. for example, your users can deregister a phone number when their phone number changes. while only end users can register an identity verification method, you and your users can deregister one. keep this behavior in mind when you implement a custom registration page. this method is available in api version 43.0 and later. note: this method doesn't support deregistering built-in authenticators. formatphonenumber(countrycode, phonenumber) formats a mobile phone number for a user. call this method to ensure that the phone number is formatted properly before updating a user’s mobile phone number. signature global static string formatphonenumber(string countrycode, string phonenumber) parameters countrycode type: string a valid country code. phonenumber type: string a mobile number that contains from 3 through 49 numeric characters, without the country code. for example, (415) 555-1234. return value type: string returns a user’s mobile phone number in the proper format. usage use this method to ensure a user’s mobile phone number is formatted as required by salesforce. then use the method’s return value to update the mobile field of the user’s record. this mobile number is used for sms-based device activation. for example, mobile phone numbers are stored along with other identity verification methods in auth.verificationmethod enum. this method is introduced in api version 43.0. it isn't available in earlier versions. here are some acceptable ways that users can enter their mobile number: • +1, (415) 555-1234 (with plus signs, parentheses, and dashes) • 1, 4155551234 (only numbers, no symbols) • 1 , 415-555-1234 (extra spaces) now, consider the following examples. • correct examples: – formatphonenumber('1', '4155551234'); – formatphonenumber('+1','(415) 555-1234'); 3505apex reference guide usermanagement class – formatphonenumber('1', '415-555-1234'); • incorrect example, because the country code and mobile number aren’t separated: – formatphonenumber(null, '+1 415-555-1234'); • example that doesn’t generate an error, but likely won’t work as intended: – formatphonenumber('+1', '+1 (415) 555-1234'); format phone number code example here's a code example that uses the formatphonenumber method. it gets the mobile number from the user and converts it to the format required by salesforce. then it updates" "the user’s record with the formatted mobile number. global with sharing class phoneregistrationcontroller { //input variables global string countrycode {get; set;} global string phonenumber {get; set;} global string addphonenumber() { if(countrycode == null) return 'country code is required'; if(phonenumber == null) return 'phone number is required'; string userid = userinfo.getuserid(); user u = [select id from user where id=:userid limit 1]; string formatnum = system.usermanagement.formatphonenumber(countrycode, phonenumber); u.mobilephone = formatnum; update u; return null; } } as long as the country code and phone number are separated, formatphonenumber returns a value in the proper format. initpasswordlesslogin(userid, method) invokes a verification challenge for passwordless login when creating custom (visualforce) login and verify pages for customers and partners. signature public static string initpasswordlesslogin(id userid, auth.verificationmethod method) parameters userid type: id id of the user who’s logging in. method type: auth.verificationmethod 3506apex reference guide usermanagement class method used to verify the user’s identity, which can be email or sms. return value type: string identifier of the verification attempt. usage use this method along with its paired verifypasswordlesslogin to customize the login experience with your own visualforce login and verify pages. invoke initpasswordlesslogin from the login page where the user enters an email address or phone number. note: an alternative to using this combination of methods is to use site.passwordlesslogin. both approaches let you customize the login page in visualforce. with the paired methods, you can create custom login and verify pages. with site.passwordlesslogin, salesforce supplies the verify page. first call the initpasswordlesslogin method to initiate an authentication challenge. this method: • gets the user id and verification method, such as email or sms, from the login page. • looks up the user and checks that the user is unique and active. • sends a verification code to the user. • adds an entry for the verification attempt to the identity verification history log, assigning an identifier to the verification attempt and setting the status to user challenged, waiting for response. • adds an entry for the passwordless login to the login history log. • returns the identifier to verifypasswordlesslogin to link the transactions. then call verifypasswordlesslogin, which, if the user enters the verification code correctly, logs in the user. note: users must verify their identity by email address or phone number before they can log in without a password. you can check whether the user is verified from the user’s detail page in setup. or you can check programmatically with twofactormethodsinfo. initregisterverificationmethod(method) invokes a verification challenge for registering identity verification methods with a custom (visualforce) page. users can register either their email address or phone number. signature public static string initregisterverificationmethod(auth.verificationmethod method) parameters method type: auth.verificationmethod method used to verify the user’s identity, which can be email or sms. return value type: string 3507apex reference guide usermanagement class the method returns an error message if the phone number is already registered, the user isn’t a customer or partner, or if the context isn’t an experience cloud site. usage use this method along with its paired verifyregisterverificationmethod on page 3517 to customize the process for registering a user’s verification method using a visualforce verify page. first call the initregisterverificationmethod method to get the verification code sent to the user as input, and validate it. if the verification code isn’t valid, it returns an error message. example here’s a code example that registers a user’s phone number as a verification method. when the user enters a verification code on the visualforce page, it invokes registeruser(). the method gets the user id of the user who’s registering the verification method and the user’s phone number. it also gets the user’s registration status to check whether the phone number is verified already. if the user is registered with a different phone number, the number is updated. public void registeruser() { try { exceptiontext=''; string userid = userinfo.getuserid();" "user u = [select mobilephone, id from user where id=:userid]; currphone = u.mobilephone; mobilephone = getformattedsms(mobilephone); if (mobilephone != null && mobilephone != '') { u.mobilephone = mobilephone; update u; // we're updating the email and phone number before verifying. roll back // the change in the verify api if it is unsuccessful. exceptiontext = system. usermanagement.initregisterverificationmethod(auth.verificationmethod.sms); if(exceptiontext!= null && exceptiontext!=''){ isinit = false; showinitexception = true; } else { isinit = false; isverify = true; } } else { showinitexception = true; } } catch (exception e) { exceptiontext = e.getmessage(); isinit = false; showinitexception = true; } } public void verifyuser() { // take the user’s input for the code sent to their phone number exceptiontext = system.usermanagement. verifyregisterverificationmethod(code, auth.verificationmethod.sms); if(exceptiontext != null && exceptiontext !=''){ 3508apex reference guide usermanagement class showinitexception = true; } else { //success } } initselfregistration(method, user) invokes a verification challenge for self-registration when creating a custom (visualforce) verify page for experience cloud self-registration. signature public static string initselfregistration(auth.verificationmethod method, user user) parameters method type: auth.verificationmethod method used to verify the identity of the user, which can be email or sms. user type: user user object to insert after successful registration. return value type: string identifier of the registration attempt. usage by default, when users sign up for your experience cloud site with an email address or phone number, salesforce sends them a verification code. at the same time, it generates a verify page for users to confirm their identity. you can replace the default salesforce verify page with your own visualforce page and then invoke the verification process. call this method to initiate the authentication challenge, and include a user object to insert if the registration is successful. the method returns the identifier for the self-registration attempt. note: if you specify a language in the languagelocalekey field on the user object, salesforce uses this language for verification email and sms messages. then call verifyselfregistration, which, if the user enters the verification code correctly, logs in the user. example this code contains the result of a verification challenge that registers a new user. string id = system.usermanagement.initselfregistration (auth.verificationmethod.sms, user); auth.verificationresult res = system.usermanagement.verifyselfregistration (auth.verificationmethod.sms, id, ‘123456’, null); if(res.success == true){ 3509apex reference guide usermanagement class //redirect } initverificationmethod(method) initiates a verification service for email, phone (sms), and the salesforce authenticator verification methods. signature public static string initverificationmethod(auth.verificationmethod method) parameters method type: auth.verificationmethod method used to initiate a verification service for email, sms, or salesforce_authenticator verification methods. return value type: string the returned identifier must be passed into verifyverificationmethod. usage use this method along with its paired verifyverificationmethod to customize a verification service for email, sms, or salesforce_authenticator verification methods. the returned identifier from initverificationmethod must be passed into verifyverificationmethod. first invoke the initverificationmethod method to send a verification code to the user’s email or phone number, or to send a push notification to the salesforce authenticator. the user then enters the code or approves the push notification. if the verification code isn’t valid or the push notification isn’t approved, the service returns an error message. email example this example shows multi-factor authentication using email. public void initverification() { // user will receive code on their registered verified email identifier = usermanagement.initverificationmethod(auth.verificationmethod.email); } public auth.verificationresult" "verifyverification() { // requiring identifier from the initverification // the code will need to be entered in this method return usermanagement.verifyverificationmethod(identifier, code , auth.verificationmethod.email); } initverificationmethod(method, actionname, extras) initiates a verification service for email, phone (sms), and the salesforce authenticator verification methods. 3510apex reference guide usermanagement class signature public static string initverificationmethod(auth.verificationmethod method, string actionname, map extras) parameters method type: auth.verificationmethod method used to initiate a verification service for email, sms, or salesforce_authenticator verification methods. actionname type: string for the salesforce_authenticator verification method only, the name of the action to display on the salesforce authenticator, such as connect to my salesforce org. the default action name is apex-defined activity. extras type: map for the salesforce_authenticator verification method only, the following extra settings. • secure_device_required–if set to true, the user’s device must be secured. for example, the user must enter the device’s passcode to approve the request. default setting is false. • challenge_required–if set to true, the user must complete a biometric challenge, such as face recognition, on the device to approve the request. default setting is false. return value type: string the returned identifier must be passed into verifyverificationmethod method. usage use this method along with its paired verifyverificationmethod to customize a verification service for email, sms, or salesforce_authenticator verification methods. the returned identifier from initverificationmethod must be passed into verifyverificationmethod method. first invoke the initverificationmethod method to send a verification code to the user’s email or phone number, or to send a push notification to the salesforce authenticator. the user then enters the code or approves the push notification. if the verification code isn’t valid or the push notification isn’t approved, the service returns an error message. salesforce authenticator example this example shows multi-factor authentication (mfa) using the salesforce authenticator mobile app. in this example, the actionname parameter is set to the default setting and the extra parameter settings are set to false. public void initverification() { // user will receive push notification on their registered mfa devices identifier = usermanagement.initverificationmethod(auth.verificationmethod.salesforce_authenticator); } public auth.verificationresult verifyverification() { 3511apex reference guide usermanagement class // requiring identifier from the initverification // user will need to take the action on their registered mfa devices return usermanagement.verifyverificationmethod(identifier, '' , auth.verificationmethod.salesforce_authenticator); } this example shows multi-factor authentication using salesforce authenticator. in this example, the actionname parameter is set to connect to my salesforce org and the challenge_required extra parameter is set to true. public void initverification() { map extras = new map(); extras.put('challenge_required','true'); // user will receive push notification in their registered mfa devices identifier = usermanagement.initverificationmethod(auth.verificationmethod.salesforce_authenticator, 'connect to my salesforce org', extras); } public auth.verificationresult verifyverification() { // requiring identifier from the initverification // user will need to take the action on their registered mfa devices return usermanagement.verifyverificationmethod(identifier, '' , auth.verificationmethod.salesforce_authenticator); } obfuscateuser(userid, username) scrambles users’ data on their request when they no longer want their personal data recognized in salesforce. when you invoke the method for the user, the data becomes anonymous, and you can never recover it. use this method to set the username to a specific value after it’s scrambled. signature public static void obfuscateuser(id userid, string username) parameters userid type: id" "id of the user whose data this method scrambles. username type: string the username after the user’s data is scrambled. sets the value of the scrambled username to a specific string. return value type: void usage this method is introduced in api version 43.0. it isn't available in earlier versions. 3512apex reference guide usermanagement class you can use the obfuscateuser method to protect the personal information of your org’s users. when invoked, salesforce permanently scrambles the user’s object data and replaces it with random character strings. the user’s detail page exists, but the fields contain meaningless strings of characters. salesforce merely obfuscates (scrambles) personal data because you can't delete a user in salesforce; you can only disable or deactivate a user. in other words, the user record remains in the database and this method performs a soft delete. note: take care when using this method. the users’ data becomes anonymous and can never be recovered. considerations • this method requires that the org’s user management setting, scramble specific users' data, is enabled from setup. • this method affects the standard fields of the user object—excluding a few fields such as the user id, timezone, locale, and profile. • it is recommended that you note the user's id and other attributes for post processing, such as the email address, if you want to send the user a confirmation. • this method changes only the user object. the association between the user and other objects is removed, but no other objects are changed. for example, contact, thirdpartyaccountlink (tpal), and user password authentication (upa) objects remain unchanged. note: assure your admins that invoking this method doesn’t trigger an email change notification. this method is part of our effort to protect users’ personal data and privacy. for more information on what you can do to actively protect user data, see data protection and privacy in salesforce help. obfuscateuser(userid) scrambles users’ data on their request when they no longer want their personal data recognized in salesforce. when you invoke the method for the user, the data becomes anonymous, and you can never recover it. signature public static void obfuscateuser(id userid) parameters userid type: id id of the user whose data this method scrambles. return value type: void usage this method is introduced in api version 43.0. it isn't available in earlier versions. you can use the obfuscateuser method to protect the personal information of your org’s users. when invoked, salesforce permanently scrambles the user’s object data and replaces it with random character strings. the user’s detail page exists, but the fields contain meaningless strings of characters. salesforce merely obfuscates (scrambles) personal data because you can't delete a user in salesforce; you can only disable or deactivate a user. in other words, the user record remains in the database and this method performs a soft delete. note: take care when using this method. the users’ data becomes anonymous and can never be recovered. 3513apex reference guide usermanagement class considerations • this method requires that the org’s user management setting, scramble specific users' data, is enabled from setup. • this method affects the standard fields of the user object—excluding a few fields such as the user id, timezone, locale, and profile. • if you want to send the user a confirmation, it’s recommended that you note the user's id and other attributes for post processing, such as the email address. • this method changes only the user object. the association between the user and other objects is removed, but no other objects are changed. for example, contact, thirdpartyaccountlink (tpal), and user password authentication (upa) objects remain unchanged. note: assure your admins that invoking this method doesn’t trigger an email change notification. this method is part of our effort to protect users’ personal data and privacy. for more information on what you can do to actively protect user data, see data protection and privacy in salesforce help. obfuscateuser code example public class usermanagementcontroller{ public list users {get; set;} public usermanagementcontroller() { profile p = [select id from profile where name = 'customer community user']; users = [select username, id from user where profileid=:p.id and isactive=true]; } //use method with extreme caution" ". data can't be recovered. @invocablemethod(label='user management' description='obfuscate user data and more') static public void obfuscate(list users) { string uid = apexpages.currentpage().getparameters().get('uid'); if(uid == null) return; user u = [select contactid from user where id=:uid]; system.usermanagement.obfuscateuser(uid); } } registerverificationmethod(method, starturl) registers an identity verification method. verification methods can be a time-based one-time password (totp), email or text verification code, salesforce authenticator, or u2f-compatible security key. end users register verification methods for themselves. signature public static system.pagereference registerverificationmethod(auth.verificationmethod method, string starturl) 3514apex reference guide usermanagement class parameters method type: auth.verificationmethod verification method used to verify the identity of the user. starturl type: string path to the page that users see after they log in. return value type:system.pagereference usage use this method to enable users to complete identity verification, such as multi-factor authentication (mfa), or to log in to their experience cloud site without a password. users register these methods to verify their identity when logging in. you create a custom registration page when implementing mobile-centric passwordless logins. see verifypasswordlesslogin. the pagereference returned by registerverificationmethod redirects the user to the salesforce verify page. if the user enters the correct code, the user is redirected to the experience cloud site page specified by the start url. for example: pagereference pr = system.usermanagement.registerverificationmethod(auth.verificationmethod.totp,starturl); pagereference p = system.usermanagement.deregisterverificationmethod(userid,auth.verificationmethod.salesforce_authenticator); this method is available in api version 43.0 and later. note: as a security measure, when users add or update mobile numbers in their detail page, they must log in again to verify their identity. as a result, unsaved changes in the app are lost. to disable this security measure, contact salesforce support. sendasyncemailconfirmation(userid, emailtemplateid, networkid, starturl) send an email message to a user’s email address for verification. the message contains a verification link (url) that the user clicks to verify the email address later on. you can send email verifications in bulk. signature public static boolean sendasyncemailconfirmation(string userid, string emailtemplateid, string networkid, string starturl) parameters userid type: string id of the user to receive the email confirmation. 3515apex reference guide usermanagement class emailtemplateid type: string id of the email template in which the verification link is defined. networkid type: string id of the experience cloud site. starturl type: string the user is redirected to this page after verification, with a success or error message as the parameter. if null, the user is redirected to the login page. return value type: boolean indicates whether sending the email message succeeded or failed. usage sending an async email message is good practice to ensure that users are registered with a valid email address that they truly own. to determine which users receive an email with the verification link, check whether the user verified email field in the user detail page is set to true. you can also get this information from the twofactormethodsinfo api. send async email verification to customers and partners to verify their email address. these users must verify their email address before they can log in with email otp (passwordless login). the error code and description are passed as query parameters so that you can process any errors when building a custom landing page. example system.usermanagement.sendasyncemailconfirmation('005rm000001a0ox', '00xrm000000hxng','0dbrm000000015i', '/s/contactsupport'); verifypasswordlesslogin(userid, method, identifier, code, starturl) completes a verification challenge during a passwordless login that uses a custom verify page (visualforce only). if the user who is trying to log in enters the verification code successfully, the user is logged in. signature public static auth.verificationresult verifypasswordlesslogin(id userid, auth.verification" "method method, string identifier, string code, string starturl) parameters userid type: id id of the user who’s logging in. 3516apex reference guide usermanagement class method type: auth.verificationmethod method used to verify the identity of the user, which can be either email or sms. identifier type: string id of the verification attempt received from the initpasswordlesslogin method. code type: string code used to verify the identity of the user. starturl type: string the page where the user is directed after successful login. return value type: auth.verificationresult result of the verification challenge, which includes the message displayed, and where the user is directed if they enter the verification code correctly. usage call this method to complete the passwordless login authentication process. it validates the verification method and verification code. it also checks that the identifier is the same as the one returned by initpasswordlesslogin on page 3506. example for an example, see auth.verificationresult. verifyregisterverificationmethod(code, method) completes registering a user’s email address or phone number as a verification method when customizing the identity verification process. signature public static string verifyregisterverificationmethod(string code, auth.verificationmethod method) parameters code type: string code used to verify the identity of the user. method type: auth.verificationmethod method used to verify the identity of the user, which can be either email or sms. 3517apex reference guide usermanagement class return value type: string if the user enters an incorrect verification code, the method returns an error message. usage call verifyregisterverificationmethod to complete the process of registering a user’s verification method. this method checks whether the user entered the correct verification code. if the verification code is correct, the method • confirms that the user entered the correct verification code • from the user’s detail page, updates the user's verification method status (sets the verification bit) • sends an email to the user confirming that a verification method has been added to their record if the verification code is incorrect, an error message is returned. note: if users want to change their email address after registering one, don’t use the initregisterverificationmethod and verify registerverificationmethod methods. to enable automatic identity verification for email address changes, from the identity verification setup page, select the field require email confirmations for email address changes (applies to users in experience builder sites). example here’s a code example that registers a user’s phone number as a verification method. when the user enters a verification code on the visualforce page, it invokes registeruser(). the method gets the user id of the user who’s registering the verification method and the user’s phone number. it also gets the user’s registration status to check whether the phone number is verified already. if the user is registered with a different phone number, the number is updated. public void registeruser() { try { exceptiontext=''; string userid = userinfo.getuserid(); user u = [select mobilephone, id from user where id=:userid]; currphone = u.mobilephone; mobilephone = getformattedsms(mobilephone); if (mobilephone != null && mobilephone != '') { u.mobilephone = mobilephone; update u; // we're updating the email and phone number before verifying. roll back // the change in the verify api if it is unsuccessful. exceptiontext = system. usermanagement.initregisterverificationmethod(auth.verificationmethod.sms); if(exceptiontext!= null && exceptiontext!=''){ isinit = false; showinitexception = true; } else { isinit = false; isverify = true; } } else { showinitexception = true; } } catch (exception e) { exceptiontext = e.getmessage(); 3518apex reference guide usermanagement class isinit = false; showinitexception = true; } } public void verifyuser() { // take the user’s input for the code sent to their phone number exceptiontext = system.usermanagement. verifyregisterverificationmethod(code, auth.verificationmethod.sms); if(exceptiontext != null && exceptiontext !=''){ showinitexception = true; } else { //success }" "} verifyselfregistration(method, identifier, code, starturl) completes a verification challenge when creating a custom (visualforce) verify page for experience cloud site self-registration. if the person who is attempting to register enters the verification code successfully, the user is created and logged in. signature public static auth.verificationresult verifyselfregistration(auth.verificationmethod method, string identifier, string code, string starturl) parameters method type: auth.verificationmethod method used to verify the identity of the user, which can be either email or sms. identifier type: string the unique identifier received from the initselfregistration method. code type: string code used to verify the identity of the user. starturl type: string the page where the user is directed after successful self-registration. return value type: auth.verificationresult result of the verification challenge, which includes the message displayed, and where the user is directed when they enter the verification code correctly. 3519apex reference guide usermanagement class usage by default, when users sign up for your experience cloud site with an email address or phone number, salesforce sends them a verification code and generates a verify page. this verify page is where users enter the verification code to confirm their identity. you can replace this salesforce-generated verify page with a custom verify page that you create with visualforce. then you invoke the verification process with apex methods. first, call the initselfregistration method, which returns the identifier of the user to create. then call this verifyselfregistration method to complete the verification process. if the user enters the verification code correctly, the user is created and directed to the page specified in the starturl. this method returns the verification result, which contains the verification status and, if the user is created, the session id. if the verification method is sms, the user object must contain a properly formatted mobile number, which is country code, space, and then phone number, for example, +1 1234567890. use system.usermanagement.formatphonenumber to ensure that the phone number is formatted correctly. example this code contains the result of a verification challenge that registers a new user. string id = system.usermanagement.initselfregistration (auth.verificationmethod.sms, user); auth.verificationresult res = system.usermanagement.verifyselfregistration (auth.verificationmethod.sms, id, ‘123456’, null); if(res.success == true){ //redirect } verifyverificationmethod(identifier, code, method) completes the verification service for email, phone (sms), salesforce authenticator, password, or time-based one-time password (totp) verification methods. signature public static verificationresult verifyverificationmethod(string identifier, string code, auth.verificationmethod method) parameters identifier type: string identifier returned from initverificationmethod for email, sms, and salesforce_authenticator. code type: string code used to verify the user’s identity for email, sms, or password. method type: auth.verificationmethod method used to verify the user’s identity, which can be email, password, salesforce_authenticator, sms, or totp. 3520apex reference guide version class return value type: verificationresult usage use this method along with its paired initverificationmethod to customize a verification service for email, sms, or salesforce_authenticator verification methods. or use this method alone to provide a complete verification service for password and totp verification methods. this method checks whether the user entered the correct verification code or password. if the verification code or password is correct, the method verifies the user’s identity. if the verification code or password isn’t valid, the service returns an error message. examples this example shows multi-factor authentication using email. public void initverification() { // user will receive code on their registered verified email identifier = usermanagement.initverificationmethod(auth.verificationmethod.email); } public auth.verificationresult verifyverification() { // requiring identifier from the initverification // the code will need to be entered in this method return usermanagement.verifyverificationmethod(identifier, code , auth.verificationmethod.email); }" "the next two examples show multi-factor authentication using only the verifyverificationmethod for password and totp verifications. public auth.verificationresult verifyverification() { // user will enter their password as a param in the verifyverificationmethod for password verification method return usermanagement.verifyverificationmethod('', password , auth.verificationmethod.password); } public auth.verificationresult verifyverification() { // user will enter their registered time-based one-time password (totp) code (token) return usermanagement.verifyverificationmethod('', code , auth.verificationmethod.totp); } version class use the version methods to get the version of a first-generation managed package, and to compare package versions. namespace system 3521apex reference guide version class usage a package version is a number that identifies the set of components uploaded in a package. the version number has the format majornumber.minornumber.patchnumber (for example, 2.1.3). the major and minor numbers increase to a chosen value during every major release. the patchnumber is generated and updated only for a patch release. a called component can check the version against which the caller was compiled using the system.requestversion method and behave differently depending on the caller’s expectations. this allows you to continue to support existing behavior in classes and triggers in previous package versions while continuing to evolve the code. the value returned by the system.requestversion method is an instance of this class with a two-part version number containing a major and a minor number. since the system.requestversion method doesn’t return a patch number, the patch number in the returned version object is null. the system.version class can also hold also a three-part version number that includes a patch number. example this example shows how to use the methods in this class, along with the requestversion method, to determine the managed package version of the code that is calling your package. if (system.requestversion() == new version(1,0)) { // do something } if ((system.requestversion().major() == 1) && (system.requestversion().minor() > 0) && (system.requestversion().minor() <=9)) { // do something different for versions 1.1 to 1.9 } else if (system.requestversion().compareto(new version(2,0)) >= 0) { // do something completely different for versions 2.0 or greater } in this section: version constructors version methods version constructors the following are constructors for version. in this section: version(major, minor) creates a new instance of the version class as a two-part package version using the specified major and minor version numbers. version(major, minor, patch) creates a new instance of the version class as a three-part package version using the specified major, minor, and patch version numbers. 3522apex reference guide version class version(major, minor) creates a new instance of the version class as a two-part package version using the specified major and minor version numbers. signature public version(integer major, integer minor) parameters major type: integer the major version number. minor type: integer the minor version number. version(major, minor, patch) creates a new instance of the version class as a three-part package version using the specified major, minor, and patch version numbers. signature public version(integer major, integer minor, integer patch) parameters major type: integer the major version number. minor type: integer the minor version number. patch type: integer the patch version number. version methods the following are methods for version. all are instance methods. in this section: compareto(version) compares the current version with the specified version. 3523apex reference guide version class major() returns the major package version of the of the calling code. minor() returns the minor package version of the calling code. patch() returns the patch package version of the calling code or null if there is no patch version. compareto(version) compares the current version with the specified version. signature public integer compareto(system.version version) parameters version type: system.version return value type: integer returns one of the following values: • zero if the current package version is equal to the specified package version • an" "integer value greater than zero if the current package version is greater than the specified package version • an integer value less than zero if the current package version is less than the specified package version usage if a two-part version is being compared to a three-part version, the patch number is ignored and the comparison is based only on the major and minor numbers. major() returns the major package version of the of the calling code. signature public integer major() return value type: integer minor() returns the minor package version of the calling code. 3524apex reference guide webservicecallout class signature public integer minor() return value type: integer patch() returns the patch package version of the calling code or null if there is no patch version. signature public integer patch() return value type: integer webservicecallout class enables making callouts to soap operations on an external web service. this class is used in the apex stub class that is auto-generated from a wsdl. namespace system in this section: webservicecallout methods see also: apex developer guide: soap services: defining a class from a wsdl document webservicecallout methods the following is the static method for webservicecallout. in this section: invoke(stub, request, response, infoarray) invokes an external soap web service operation based on an apex class that is auto-generated from a wsdl. invoke(stub, request, response, infoarray) invokes an external soap web service operation based on an apex class that is auto-generated from a wsdl. 3525apex reference guide webservicemock interface signature public static void invoke(object stub, object request, map response, list infoarray) parameters stub type: object an instance of the apex class that is auto-generated from a wsdl (the stub class). request type: object the request to the external service. the request is an instance of a type that is created as part of the auto-generated stub class. response type: map a map of key-value pairs that represent the response that the external service sends after receiving the request. in each pair, the key is a response identifier. the value is the response object, which is an instance of a type that is created as part of the auto-generated stub class. infoarray type: string[] an array of strings that contains information about the callout—web service endpoint, soap action, request, and response. the order of the elements in the array matters. • element at index 0 ([0]): one of the following options for identifying the url of the external web service. – endpoint url. for example: 'http://yourserver/yourservice' – named credential url, which contains the scheme callout, the name of the named credential, and optionally, an appended path. for example: 'callout:mynamedcredential/some/path' • element at index 1 ([1]): the soap action. for example: 'urn:dotnet.callouttest.soap.sforce.com/echostring' • element at index 2 ([2]): the request namespace. for example: 'http://doc.sample.com/docsample' • element at index 3 ([3]): the request name. for example: 'echostring' • element at index 4 ([4]): the response namespace. for example: 'http://doc.sample.com/docsample' • element at index 5 ([5]): the response name. for example: 'echostringresponse' • element at index 6 ([6]): the response type. for example: 'docsample.echostringresponse_element' return value type: void see also: apex developer guide: named credentials as callout endpoints webservicemock interface enables sending fake responses when testing web service callouts of a class auto-generated from a wsdl. 3526apex reference guide webservicemock interface namespace system usage for an implementation example, see test web service callouts. webservicemock methods the following are methods for webservicemock. in this section: doinvoke(stub, soaprequest, responsemap, endpoint, soapaction, requestname, responsenamespace, responsename, responsetype) the implementation of this method is called by the apex runtime to send a fake response when a web service call" "out is made after test.setmock has been called. doinvoke(stub, soaprequest, responsemap, endpoint, soapaction, requestname, responsenamespace, responsename, responsetype) the implementation of this method is called by the apex runtime to send a fake response when a web service callout is made after test.setmock has been called. signature public void doinvoke(object stub, object soaprequest, map responsemap, string endpoint, string soapaction, string requestname, string responsenamespace, string responsename, string responsetype) parameters stub type: object an instance of the auto-generated class. soaprequest type: object the soap web service request being invoked. responsemap type: map a collection of key/value pairs representing the response to send for the request. when implementing this interface, set the responsemap argument to a key/value pair representing the response desired. endpoint type: string the endpoint url for the request. 3527apex reference guide xmlstreamreader class soapaction type: string the requested soap operation. requestname type: string the requested soap operation name. responsenamespace type: string the response namespace. responsename type: string the name of the response element as defined in the wsdl. responsetype type: string the class for the response as defined in the auto-generated class. return value type: void usage xmlstreamreader class the xmlstreamreader class provides methods for forward, read-only access to xml data. you can pull data from xml or skip unwanted events. you can parse nested xml content that’s up to 50 nodes deep. namespace system usage the xmlstreamreader class is similar to the xmlstreamreader utility class from stax (streaming api for xml). stax is an api to read and write xml documents, originating from the java programming language community. note: the xmlstreamreader class in apex is based on its counterpart in java. see java xmlstreamreader class. in this section: xmlstreamreader constructors 3528apex reference guide xmlstreamreader class xmlstreamreader methods see also: apex developer guide: reading xml using streams xmlstreamreader constructors the following are constructors for xmlstreamreader. in this section: xmlstreamreader(xmlinput) creates a new instance of the xmlstreamreader class for the specified xml input. xmlstreamreader(xmlinput) creates a new instance of the xmlstreamreader class for the specified xml input. signature public xmlstreamreader(string xmlinput) parameters xmlinput type: string the xml string input. xmlstreamreader methods the following are methods for xmlstreamreader. all are instance methods. in this section: getattributecount() returns the number of attributes on the start element, excluding namespace definitions. getattributelocalname(index) returns the local name of the attribute at the specified index. getattributenamespace(index) returns the namespace uri of the attribute at the specified index. getattributeprefix(index) returns the prefix of this attribute at the specified index. getattributetype(index) returns the xml type of the attribute at the specified index. getattributevalue(namespaceuri, localname) returns the value of the attribute in the specified localname at the specified uri. 3529apex reference guide xmlstreamreader class getattributevalueat(index) returns the value of the attribute at the specified index. geteventtype() returns the type of xml event the cursor is pointing to. getlocalname() returns the local name of the current event. getlocation() return the current location of the cursor. getnamespace() if the current event is a start element or end element, this method returns the uri of the prefix or the default namespace. getnamespacecount() returns the number of namespaces declared on a start element or end element. getnamespaceprefix(index) returns the prefix for the namespace declared at the index. getnamespaceuri(prefix) return the uri for the given prefix. getnamespaceuriat(index) returns the uri for the namespace declared at the index. getpidata() returns the data section of a processing instruction. getpitarget() returns the target section of a processing instruction. getprefix()" "returns the prefix of the current xml event or null if the event does not have a prefix. gettext() returns the current value of the xml event as a string. getversion() returns the xml version specified on the xml declaration. returns null if none was declared. hasname() returns true if the current xml event has a name. returns false otherwise. hasnext() returns true if there are more xml events and false if there are no more xml events. hastext() returns true if the current event has text, false otherwise. ischaracters() returns true if the cursor points to a character data xml event. otherwise, returns false. isendelement() returns true if the cursor points to an end tag. otherwise, it returns false. isstartelement() returns true if the cursor points to a start tag. otherwise, it returns false. 3530apex reference guide xmlstreamreader class iswhitespace() returns true if the cursor points to a character data xml event that consists of all white space. otherwise it returns false. next() reads the next xml event. a processor may return all contiguous character data in a single chunk, or it may split it into several chunks. returns an integer which indicates the type of event. nexttag() skips any white space (the iswhitespace method returns true), comment, or processing instruction xml events, until a start element or end element is reached. returns the index for that xml event. setcoalescing(returnassingleblock) if you specify true for returnassingleblock, text is returned in a single block, from a start element to the first end element or the next start element, whichever comes first. if you specify it as false, the parser may return text in multiple blocks. setnamespaceaware(isnamespaceaware) if you specify true for isnamespaceaware, the parser recognizes namespace. if you specify it as false, the parser does not. the default value is true. tostring() returns a string containing the length of the input xml given to xmlstreamreader and the first 50 characters of the input xml. getattributecount() returns the number of attributes on the start element, excluding namespace definitions. signature public integer getattributecount() return value type: integer usage this method is only valid on a start element or attribute xml events. the count for the number of attributes for an attribute xml event starts with zero. getattributelocalname(index) returns the local name of the attribute at the specified index. signature public string getattributelocalname(integer index) parameters index type: integer 3531apex reference guide xmlstreamreader class return value type: string usage if there is no name, an empty string is returned. this method is only valid with start element or attribute xml events. getattributenamespace(index) returns the namespace uri of the attribute at the specified index. signature public string getattributenamespace(integer index) parameters index type: integer return value type: string usage if no namespace is specified, null is returned. this method is only valid with start element or attribute xml events. getattributeprefix(index) returns the prefix of this attribute at the specified index. signature public string getattributeprefix(integer index) parameters index type: integer return value type: string usage if no prefix is specified, null is returned. this method is only valid with start element or attribute xml events. 3532" "apex reference guide xmlstreamreader class getattributetype(index) returns the xml type of the attribute at the specified index. signature public string getattributetype(integer index) parameters index type: integer return value type: string usage for example, id is an attribute type. this method is only valid with start element or attribute xml events. getattributevalue(namespaceuri, localname) returns the value of the attribute in the specified localname at the specified uri. signature public string getattributevalue(string namespaceuri, string localname) parameters namespaceuri type: string localname type: string return value type: string usage returns null if the value is not found. you must specify a value for localname. this method is only valid with start element or attribute xml events. getattributevalueat(index) returns the value of the attribute at the specified index. 3533apex reference guide xmlstreamreader class signature public string getattributevalueat(integer index) parameters index type: integer return value type: string usage this method is only valid with start element or attribute xml events. geteventtype() returns the type of xml event the cursor is pointing to. signature public system.xmltag geteventtype() return value type: system.xmltag xmltag enum the values for xmltag are: • attribute • cdata • characters • comment • dtd • end_document • end_element • entity_declaration • entity_reference • namespace • notation_declaration • processing_instruction • space • start_document • start_element 3534apex reference guide xmlstreamreader class getlocalname() returns the local name of the current event. signature public string getlocalname() return value type: string usage for start element or end element xml events, it returns the local name of the current element. for the entity reference xml event, it returns the entity name. the current xml event must be start element, end element, or entity reference. getlocation() return the current location of the cursor. signature public string getlocation() return value type: string usage if the location is unknown, returns -1. the location information is only valid until the next method is called. getnamespace() if the current event is a start element or end element, this method returns the uri of the prefix or the default namespace. signature public string getnamespace() return value type: string usage returns null if the xml event does not have a prefix. 3535apex reference guide xmlstreamreader class getnamespacecount() returns the number of namespaces declared on a start element or end element. signature public integer getnamespacecount() return value type: integer usage this method is only valid on a start element, end element, or namespace xml event. getnamespaceprefix(index) returns the prefix for the namespace declared at the index. signature public string getnamespaceprefix(integer index) parameters index type: integer return value type: string usage returns null if this is the default namespace declaration. this method is only valid on a start element, end element, or namespace xml event. getnamespaceuri(prefix) return the uri for the given prefix. signature public string getnamespaceuri(string prefix) parameters prefix type: string 3536apex reference guide xmlstreamreader class return value type: string usage the returned uri depends on the current state of the processor. getnamespaceuriat(index) returns the uri for the namespace declared at the index. signature public string getnamespaceuriat(integer index) parameters index type: integer return value type: string usage this method is only valid on a start element, end element, or namespace xml event. getpidata() returns the data section of a processing instruction. signature public string getpidata() return value type: string getpitarget() returns the target section of a processing instruction. signature public string getpitarget() return value type: string 3537apex reference guide xmlstreamreader class getprefix()" "returns the prefix of the current xml event or null if the event does not have a prefix. signature public string getprefix() return value type: string gettext() returns the current value of the xml event as a string. signature public string gettext() return value type: string usage the valid values for the different events are: • the string value of a character xml event • the string value of a comment • the replacement value for an entity reference. for example, assume gettext reads the following xml snippet: ]> name &title;'; the gettext method returns salesforce for dummies, not &title. • the string value of a cdata section • the string value for a space xml event • the string value of the internal subset of the dtd getversion() returns the xml version specified on the xml declaration. returns null if none was declared. signature public string getversion() 3538apex reference guide xmlstreamreader class return value type: string hasname() returns true if the current xml event has a name. returns false otherwise. signature public boolean hasname() return value type: boolean usage this method is only valid for start element and stop element xml events. hasnext() returns true if there are more xml events and false if there are no more xml events. signature public boolean hasnext() return value type: boolean usage this method returns false if the current xml event is end document. hastext() returns true if the current event has text, false otherwise. signature public boolean hastext() return value type: boolean usage the following xml events have text: characters, entity reference, comment and space. 3539apex reference guide xmlstreamreader class ischaracters() returns true if the cursor points to a character data xml event. otherwise, returns false. signature public boolean ischaracters() return value type: boolean isendelement() returns true if the cursor points to an end tag. otherwise, it returns false. signature public boolean isendelement() return value type: boolean isstartelement() returns true if the cursor points to a start tag. otherwise, it returns false. signature public boolean isstartelement() return value type: boolean iswhitespace() returns true if the cursor points to a character data xml event that consists of all white space. otherwise it returns false. signature public boolean iswhitespace() return value type: boolean 3540apex reference guide xmlstreamreader class next() reads the next xml event. a processor may return all contiguous character data in a single chunk, or it may split it into several chunks. returns an integer which indicates the type of event. signature public integer next() return value type: integer nexttag() skips any white space (the iswhitespace method returns true), comment, or processing instruction xml events, until a start element or end element is reached. returns the index for that xml event. signature public integer nexttag() return value type: integer usage this method throws an error if elements other than white space, comments, processing instruction, start elements or stop elements are encountered. setcoalescing(returnassingleblock) if you specify true for returnassingleblock, text is returned in a single block, from a start element to the first end element or the next start element, whichever comes first. if you specify it as false, the parser may return text in multiple blocks. signature public void setcoalescing(boolean returnassingleblock) parameters returnassingleblock type: boolean return value type: void 3541apex reference guide xmlstreamwriter class setnamespaceaware(isnamespaceaware) if you specify true for isnamespaceaware, the parser recognizes namespace. if you specify it as false, the parser does not. the default value is true. signature public void setnamespaceaware(boolean isnamespaceaware) parameters isnamespaceaware type: boolean return value type: void tostring() returns a string containing the length of the input xml given to xmlstreamreader and the first 50 characters of the input xml. signature public string tostring() return value type: string xmlstreamwriter class the xmlstreamwriter class provides methods for writing xml" "data. namespace system usage you can use the xmlstreamwriter class to programmatically construct an xml document, then use http classes to send the document to an external server. the xmlstreamwriter class is similar to the xmlstreamwriter utility class from stax (streaming api for xml). stax is an api to read and write xml documents, originating from the java programming language community. note: the xmlstreamwriter class in apex is based on its counterpart in java. see java xmlstreamwriter class. in this section: xmlstreamwriter constructors 3542apex reference guide xmlstreamwriter class xmlstreamwriter methods see also: http class httprequest class httpresponse class xmlstreamwriter constructors the following are constructors for xmlstreamwriter. in this section: xmlstreamwriter() creates a new instance of the xmlstreamwriter class. xmlstreamwriter() creates a new instance of the xmlstreamwriter class. signature public xmlstreamwriter() xmlstreamwriter methods the following are methods for xmlstreamwriter. all are instance methods. in this section: close() closes this instance of an xmlstreamwriter and free any resources associated with it. getxmlstring() returns the xml written by the xmlstreamwriter instance. setdefaultnamespace(uri) binds the specified uri to the default namespace. this uri is bound in the scope of the current start_element – end_element pair. writeattribute(prefix, namespaceuri, localname, value) writes an attribute to the output stream. writecdata(data) writes the specified cdata to the output stream. writecharacters(text) writes the specified text to the output stream. writecomment(comment) writes the specified comment to the output stream. 3543apex reference guide xmlstreamwriter class writedefaultnamespace(namespaceuri) writes the specified namespace to the output stream. writeemptyelement(prefix, localname, namespaceuri) writes an empty element tag to the output stream. writeenddocument() closes any start tags and writes corresponding end tags to the output stream. writeendelement() writes an end tag to the output stream, relying on the internal state of the writer to determine the prefix and local name. writenamespace(prefix, namespaceuri) writes the specified namespace to the output stream. writeprocessinginstruction(target, data) writes the specified processing instruction. writestartdocument(encoding, version) writes the xml declaration using the specified xml encoding and version. writestartelement(prefix, localname, namespaceuri) writes the start tag specified by localname to the output stream. close() closes this instance of an xmlstreamwriter and free any resources associated with it. signature public void close() return value type: void getxmlstring() returns the xml written by the xmlstreamwriter instance. signature public string getxmlstring() return value type: string setdefaultnamespace(uri) binds the specified uri to the default namespace. this uri is bound in the scope of the current start_element – end_element pair. 3544apex reference guide xmlstreamwriter class signature public void setdefaultnamespace(string uri) parameters uri type: string return value type: void writeattribute(prefix, namespaceuri, localname, value) writes an attribute to the output stream. signature public void writeattribute(string prefix, string namespaceuri, string localname, string value) parameters prefix type: string namespaceuri type: string localname type: string specifies the name of the attribute. value type: string return value type: void writecdata(data) writes the specified cdata to the output stream. signature public void writecdata(string data) parameters data type: string 3545apex reference guide xmlstreamwriter class return value type: void writecharacters(text) writes the specified text to the output stream. signature public void writecharacters(string text) parameters text type: string return value type: void writecomment(comment) writes the specified comment to the output stream. signature public void writecomment(string comment) parameters comment type: string" "return value type: void writedefaultnamespace(namespaceuri) writes the specified namespace to the output stream. signature public void writedefaultnamespace(string namespaceuri) parameters namespaceuri type: string 3546apex reference guide xmlstreamwriter class return value type: void writeemptyelement(prefix, localname, namespaceuri) writes an empty element tag to the output stream. signature public void writeemptyelement(string prefix, string localname, string namespaceuri) parameters prefix type: string localname type: string specifies the name of the tag to be written. namespaceuri type: string return value type: void writeenddocument() closes any start tags and writes corresponding end tags to the output stream. signature public void writeenddocument() return value type: void writeendelement() writes an end tag to the output stream, relying on the internal state of the writer to determine the prefix and local name. signature public void writeendelement() return value type: void 3547apex reference guide xmlstreamwriter class writenamespace(prefix, namespaceuri) writes the specified namespace to the output stream. signature public void writenamespace(string prefix, string namespaceuri) parameters prefix type: string namespaceuri type: string return value type: void writeprocessinginstruction(target, data) writes the specified processing instruction. signature public void writeprocessinginstruction(string target, string data) parameters target type: string data type: string return value type: void writestartdocument(encoding, version) writes the xml declaration using the specified xml encoding and version. signature public void writestartdocument(string encoding, string version) parameters encoding type: string 3548apex reference guide territorymgmt namespace version type: string return value type: void writestartelement(prefix, localname, namespaceuri) writes the start tag specified by localname to the output stream. signature public void writestartelement(string prefix, string localname, string namespaceuri) parameters prefix type: string localname type: string namespaceuri type: string return value type: void territorymgmt namespace the territorymgmt namespace provides an interface used for territory management. the following is the interface in the territorymgmt namespace. in this section: opportunityterritory2assignmentfilter global interface apex interface that allows an implementing class to assign a single territory to an opportunity. opportunityterritory2assignmentfilter global interface apex interface that allows an implementing class to assign a single territory to an opportunity. namespace territorymgmt 3549apex reference guide opportunityterritory2assignmentfilter global interface usage method called by opportunity territory assignment job to assign territory to opportunity. input is a list of (up to 1000) opportunityids that have isexcludedfromterritory2filter=false. returns a map of opportunityid to territory2id, which is used to update the territory2id field on the opportunity object. in this section: opportunityterritory2assignmentfilter methods opportunityterritory2assignmentfilter example implementation opportunityterritory2assignmentfilter methods the following are methods for opportunityterritory2assignmentfilter. in this section: getopportunityterritory2assignments(opportunityids) returns the mapping of opportunities to territory ids. when salesforce invokes this method, it supplies the list of opportunity ids, except for opportunities that have been excluded from territory assignment (isexcludedfromterritory2filter=false). getopportunityterritory2assignments(opportunityids) returns the mapping of opportunities to territory ids. when salesforce invokes this method, it supplies the list of opportunity ids, except for opportunities that have been excluded from territory assignment (isexcludedfromterritory2filter=false). signature public map getopportunityterritory2assignments(list opportunityids) parameters opportunityids type: list opportunity ids. return value type: map a key value pair associating each territory id to an opportunity" "id. opportunityterritory2assignmentfilter example implementation this is an example implementation of the territorymgmt.opportunityterritory2assignmentfilter interface. /*** apex version of the default logic. * if opportunity's assigned account is assigned to * case 1: 0 territories in active model * then set territory2id = null * case 2: 1 territory in active model 3550apex reference guide opportunityterritory2assignmentfilter global interface * then set territory2id = account's territory2id * case 3: 2 or more territories in active model * then set territory2id = account's territory2id that is of highest priority. * but if multiple territories have same highest priority, then set territory2id = null */ global class oppterrassigndefaultlogicfilter implements territorymgmt.opportunityterritory2assignmentfilter { /** * no-arg constructor. */ global oppterrassigndefaultlogicfilter() {} /** * get mapping of opportunity to territory2id. the incoming list of opportunityids contains only those with isexcludedfromterritory2filter=false. * if territory2id = null in result map, clear the opportunity.territory2id if set. * if opportunity is not present in result map, its territory2id remains intact. */ global map getopportunityterritory2assignments(list opportunityids) { map oppidterritoryidresult = new map(); // get the active territory model id id activemodelid = getactivemodelid(); if(activemodelid != null){ list opportunities = [select id, accountid, territory2id from opportunity where id in :opportunityids]; set accountids = new set(); // create set of parent accountids for(opportunity opp:opportunities){ if(opp.accountid != null){ accountids.add(opp.accountid); } } map accountmaxpriorityterritory = getaccountmaxpriorityterritory(activemodelid, accountids); // for each opportunity, assign the highest priority territory if there is no conflict, else assign null. for(opportunity opp: opportunities){ territory2priority tp = accountmaxpriorityterritory.get(opp.accountid); // assign highest priority territory if there is only 1. if((tp != null) && (tp.moreterritoriesatpriority == false) && (tp.territory2id != opp.territory2id)){ oppidterritoryidresult.put(opp.id, tp.territory2id); }else{ oppidterritoryidresult.put(opp.id, null); } } } return oppidterritoryidresult; 3551apex reference guide opportunityterritory2assignmentfilter global interface } /** * query assigned territoryids in active model for given accountids. * create a map of accountid to max priority territory. */ private map getaccountmaxpriorityterritory(id activemodelid, set accountids){ map accountmaxpriorityterritory = new map(); for(objectterritory2association ota:[select objectid, territory2id, territory2.territory2type.priority from objectterritory2association where objectid in :accountids and territory2.territory2modelid = :activemodelid]){ territory2priority tp = accountmaxpriorityterritory.get(ota.objectid); if((tp == null) || (ota.territory2.territory2type.priority > tp.priority)){ // if this is the first territory examined for account or it has greater priority than current highest priority territory, then set this as new highest priority territory. tp = new territory2priority(ota.territory2id,ota.territory2.territory2type.priority,false); }else if(ota.territ" "ory2.territory2type.priority == tp.priority){ // the priority of current highest territory is same as this, so set moreterritoriesatpriority to indicate multiple highest priority territories seen so far. tp.moreterritoriesatpriority = true; } accountmaxpriorityterritory.put(ota.objectid, tp); } return accountmaxpriorityterritory; } /** * get the id of the active territory model. * if none exists, return null. */ private id getactivemodelid() { list models = [select id from territory2model where state = 'active']; id activemodelid = null; if(models.size() == 1){ activemodelid = models.get(0).id; } return activemodelid; } /** * helper class to help capture territory2id, its priority, and whether there are more territories with same priority assigned to the account. */ private class territory2priority { public id territory2id { get; set; } 3552apex reference guide txnsecurity namespace public integer priority { get; set; } public boolean moreterritoriesatpriority { get; set; } territory2priority(id territory2id, integer priority, boolean moreterritoriesatpriority){ this.territory2id = territory2id; this.priority = priority; this.moreterritoriesatpriority = moreterritoriesatpriority; } } } txnsecurity namespace the txnsecurity namespace provides an interface used for transaction security. the following is the interface and its supporting class in the txnsecurity namespace. in this section: event class contains event information that the evaluate method uses to evaluate a transaction security policy. eventcondition interface allows an implementing class to specify whether to take action when certain events occur based on a transaction security policy. this interface is only used for apex policies created in real-time event monitoring. asynccondition interface allows an implementing class to make asynchronous apex calls. this interface is used only for transaction security apex policies created in real-time event monitoring. policycondition interface apex interface that allows an implementing class to specify actions to take when certain events occur based on a transaction security policy. event class contains event information that the evaluate method uses to evaluate a transaction security policy. namespace txnsecurity usage the event class contains the information needed to determine if the event triggers a transaction security policy. not all class attributes are used for every type of event. tip: the eventclass interface applies only to legacy transaction security, which is a retired feature as of summer '20. use the eventcondition interface instead of the eventclass interface. 3553apex reference guide event class in this section: event constructors event properties event constructors the following is the constructor for event. in this section: event() creates an instance of the txnsecurity.event class. event() creates an instance of the txnsecurity.event class. signature public event() event properties the following are properties for event. in this section: action specifies the action being taken on the resource for an entity event. for example, a login ip resource for an entity event could have an action of create. the action attribute is not used by any other event type. data contains data used by actions. for example, data for a login event includes the login history id. returns a map whose keys are the type of event data, like sourceip. entityid the id of any entity associated with the event. for example, the entityid of a dataexport event for an account object contains the account id. entityname the name of the object the event acts on. organizationid the id of the salesforce org where the event occurred. resourcetype the type of resource for the event. for example, an accessresource event could have a connected application as a resource type. not all event types have resources. timestamp the time the event occurred. 3554apex reference guide event class userid identifies the user that caused the event. action specifies the action being taken on the resource for an entity event. for example, a login ip resource for an entity event could have an action of create. the action attribute is not used by any other event type. signature public string action {get; set;} property value type" ": string data contains data used by actions. for example, data for a login event includes the login history id. returns a map whose keys are the type of event data, like sourceip. signature public map data {get; set;} property value type: map the following table lists all the available data types. not all types appear with all event types. the data type values are always string representations. for example, the isapi value is a string in the map, but is actually a boolean value. convert the value from a string to its true type this way: boolean.valueof(event.data.get('isapi')); key name true value type events supported actionname string values are: entity • convert • delete • insert • undelete • update • upsert apitype string (enum manifested as a string) dataexport, login application string accessresource, dataexport clientid string (id of the client) dataexport connectedappid string (id of the connected app) accessresource, dataexport 3555apex reference guide event class key name true value type events supported executiontime milliseconds dataexport isapi boolean dataexport isscheduled boolean dataexport loginhistoryid string dataexport, login numberofrecords integer dataexport policyid string (id of the current policy) all events sessionlevel string (enum manifested as a string. values include accessresource standard and high_assurance) sourceip string (ipv4 address) accessresource username string entity entityid the id of any entity associated with the event. for example, the entityid of a dataexport event for an account object contains the account id. signature public string entityid {get; set;} property value type: string entityname the name of the object the event acts on. signature public string entityname {get; set;} property value type: string organizationid the id of the salesforce org where the event occurred. signature public string organizationid {get; set;} 3556apex reference guide eventcondition interface property value type: string resourcetype the type of resource for the event. for example, an accessresource event could have a connected application as a resource type. not all event types have resources. signature public string resourcetype {get; set;} property value type: string timestamp the time the event occurred. signature public datetime timestamp {get; set;} property value type: datetime userid identifies the user that caused the event. signature public string userid {get; set;} property value type: string eventcondition interface allows an implementing class to specify whether to take action when certain events occur based on a transaction security policy. this interface is only used for apex policies created in real-time event monitoring. usage the evaluate method is called upon the occurrence of a real-time event monitored by a transaction security policy. a typical implementation first selects the fields of interest from the event. then the fields are tested to see if they meet the conditions being monitored. if the conditions are met, the method returns true. 3557apex reference guide eventcondition interface for example, imagine a transaction security policy that triggers when a user queries more than 1,000 lead records. for each api event, the evaluate method checks whether the rowsprocessed value is greater than 1,000 and the queriedentities value contains “lead”. if so, true is returned. we recommend having test classes for the policy condition interface to ensure it works correctly. testing is required regardless of whether the policy is moved from a sandbox to production, with a change set, or some other way. for example, test your policies in your development environment before moving the policies to production. for more information about testing apex transaction security policies, read transaction security apex testing. in this section: eventcondition methods eventcondition example implementation eventcondition methods the following are methods for eventcondition. in this section: evaluate(event) evaluates an event against a transaction security policy created in real-time event monitoring. if the event triggers the policy, the method returns true. evaluate(event) evaluates an event against a transaction security policy created in real-time event monitoring. if the event triggers the policy, the method returns true. signature public boolean evaluate(sobject event) parameters var1 type: sobject the" "event to check against the transaction security policy. return value type: boolean returns true when the policy is triggered. for example, suppose that the policy is to limit users to a single login session. if a user tries to log in a second time, the policy blocks the attempted login, and updates the status, policyid, and policyoutcome fields of that loginevent. the policy also sends an email notification to the salesforce admin. the evaluate method only checks the login event, and returns true if it’s the user’s second login attempt. the system performs the action and notification, not the evaluate method. 3558apex reference guide asynccondition interface eventcondition example implementation this example shows an implementation of the txnsecurity.eventcondition interface. the transaction security policy triggers when the user queries an account object. global class blockaccountquerieseventcondition implements txnsecurity.eventcondition { public boolean evaluate(sobject event) { switch on event { when apievent apievent { return handleapievent(apievent); } when null { // trigger action if event is null return true; } when else { // trigger action for unhandled events return true; } } } private boolean handleapievent(apievent apievent){ if(apievent.queriedentities.contains('account')){ return true; } return false; } } for more examples, see enhanced apex transaction security implementation examples. asynccondition interface allows an implementing class to make asynchronous apex calls. this interface is used only for transaction security apex policies created in real-time event monitoring. namespace txnsecurity usage if you make an asynchronous apex call in the class that implements your transaction security policy condition, the class must implement the txnsecurity.asynccondition interface in addition to txnsecurity.eventcondition. use asynchronous apex instead of apex callouts and dml statements, neither of which is allowed in transaction security apex policies. apex offers multiple ways to run your apex code asynchronously and all are supported in the txnsecurity.asynccondition interface. this interface has no methods. 3559apex reference guide policycondition interface in this section: asynccondition example implementation see also: apex developer guide:asynchronous apex asynccondition example implementation here’s an example implementation of the txnsecurity.asynccondition interface. the transaction security policy triggers when a user logs in. in the example, externalvalidation__c is a custom object that contains information from an external validation system. the result of the soql query on externalvalidation__c determines whether to block the user from logging in. the policy then queues the callouttoexternalvalidator class for asynchronous execution. when it executes, the callouttoexternalvalidator class makes an external call to the validation system to update it with information about this log in event. because callouttoexternalvalidator is triggered by asynchronous apex, you must implement the txnsecurity.asynccondition interface in the externallyvalidatedlogincondition apex class along with the usual txnsecurity.eventcondition interface. global class externallyvalidatedlogincondition implements txnsecurity.eventcondition, txnsecurity.asynccondition { public boolean evaluate(sobject event) { loginevent loginevent = (loginevent) event; boolean userblocked = [select blocked from externalvalidation__c where loginid = loginevent.userid][0].blocked; system.enqueuejob(new callouttoexternalvalidator(loginevent.sourceip, loginevent.loginurl)); return userblocked; } } public class callouttoexternalvalidator implements queueable { private string sourceip; private string loginurl; public callouttoexternalvalidator(string sourceip, string loginurl) { this.sourceip = sourceip; this.loginurl = loginurl; } public void execute(queueablecontext context) { // callout to external validation service // pass sourceip, loginurl // update externalvalidation__c } } policycondition interface apex interface that allows an implementing class to specify actions to take when certain events occur based on a transaction security policy. 3560apex reference guide policycondition interface namespace txnsecurity usage tip: the policycondition interface applies only to legacy transaction security, which is a retired feature as of summer '20. use the eventcondition interface instead of the policycondition interface. the evaluate method is called upon the" "occurrence of an event monitored by a transaction security policy. a typical implementation first selects the item of interest from the event. then the item is tested to see if it meets the condition being monitored. if the condition is met, the method returns true. for example, imagine a transaction security policy that checks for the same user logging in more than once. for each login event, the method would check if the user logging in already has a login session in progress, and if so, true is returned. we recommend having test classes for the policy condition interface to ensure it works correctly. testing is required regardless of whether the policy is moved from a sandbox to production, with a change set, or some other way. for example, test your policies in your development environment before moving the policies to production. don’t include dml statements in your custom policies because they can cause errors. when you send a custom email via apex during transaction policy evaluation, you get an error, even if the record isn’t explicitly related to another record. for more information, see apex dml operations in the apex reference guide. in this section: policycondition methods policycondition methods the following is the method for policycondition. in this section: evaluate(event) evaluates an event against a transaction security policy. if the event triggers the policy, true is returned. evaluate(event) evaluates an event against a transaction security policy. if the event triggers the policy, true is returned. signature public boolean evaluate(txnsecurity.event event) parameters event type: txnsecurity.event the event to check against the transaction security policy. 3561apex reference guide userprovisioning namespace return value type: boolean when the policy is triggered, true is returned. for example, let’s suppose the policy is to limit users to a single login session. if anyone tries to log in a second time, the policy’s action requires that they end their current session. the policy also sends an email notification to the salesforce admin. the evaluate() method only checks the login event, and returns true if it’s the user’s second login. the transaction security system performs the action and notification, and not the evaluate() method. userprovisioning namespace the userprovisioning namespace provides methods for monitoring outbound user provisioning requests. the following is the class in the userprovisioning namespace. in this section: connectortestutil class enables developers to write apex test classes for connectors used by the connected app provisioning solution. this class simulates provisioning for the associated app. userprovisioninglog class provides methods for writing messages to monitor outbound user provisioning requests. userprovisioningplugin class the userprovisioningplugin base class implements process.plugin for programmatic customization of the user provisioning process for connected apps. connectortestutil class enables developers to write apex test classes for connectors used by the connected app provisioning solution. this class simulates provisioning for the associated app. namespace userprovisioning usage use this class for connector-based test accelerators. you can invoke it only from within an apex test. example this example creates an instance of a connected app, gets a value, and checks whether the value is correct. the test is simply a row inserted in the database table. @istest private class scimcreateuserplugintest { public static void callplugin(boolean validinputparams) { 3562apex reference guide connectortestutil class //create an instance of a connected app connectedapplication capp =userprovisioning.connectortestutil.createconnectedapp('testapp'); profile p = [select id from profile where name='standard user']; //create a user user user = new user(username='testuser1@scimuserprov.test', firstname= 'test', lastname='user1', email='testuser1@testemail.com', federationidentifier='testuser1@testemail.com', profileid= p.id, communitynickname='tuser1', alias='tuser', timezonesidkey='gmt', localesidkey='en_us', emailencodingkey='iso-8859-1', languagelocalekey='en_us'); //insert user into a row in the database table insert user; //create a upr userprovisioningrequest upr = new userprovisioningrequest(appname = capp.name, connectedappid=capp.id, operation='create'," "state='new', approvalstatus='notrequired',salesforceuserid=user.id); //insert the upr to test the flow end to end insert upr; }} in this section: connectortestutil method see also: salesforce help: user provisioning for connected apps connectortestutil method the connectortestutil class has 1 method. in this section: createconnectedapp(connectedappname) creates an instance of a connected app to simulate provisioning. createconnectedapp(connectedappname) creates an instance of a connected app to simulate provisioning. signature public static connectedapplication createconnectedapp(string connectedappname) parameters connectedappname type: string 3563apex reference guide userprovisioninglog class name of the connected app to test for provisioning. return value type: connectedapplication the instance of the connected app to test for provisioning. userprovisioninglog class provides methods for writing messages to monitor outbound user provisioning requests. namespace userprovisioning example this example writes the user account information sent to a third-party system for a provisioning request to the userprovisioninglog object. string inputparamsstr = 'input parameters: uprid=' + uprid + ', endpointurl=' + endpointurl + ', adminusername=' + adminusername + ', email=' + email + ', username=' + username + ', defaultpassword=' + defaultpassword + ', defaultroles =' + defaultroles; userprovisioning.userprovisioninglog.log(uprid, inputparamsstr); in this section: userprovisioninglog methods userprovisioninglog methods the following are methods for userprovisioninglog. all methods are static. in this section: log(userprovisioningrequestid, details) writes a specific message, such as an error message, to monitor the progress of a user provisioning request. log(userprovisioningrequestid, status, details) writes a specific status and message, such a status and detailed error message, to monitor the progress of a user provisioning request. log(userprovisioningrequestid, externaluserid, externalusername, userid, details) writes a specific message, such as an error message, to monitor the progress of a user provisioning request associated with a specific user. log(userprovisioningrequestid, details) writes a specific message, such as an error message, to monitor the progress of a user provisioning request. 3564apex reference guide userprovisioninglog class signature public void log(string userprovisioningrequestid, string details) parameters userprovisioningrequestid type: string a unique identifier for the user provisioning request. details type: string the text for the message. return value type: void log(userprovisioningrequestid, status, details) writes a specific status and message, such a status and detailed error message, to monitor the progress of a user provisioning request. signature public void log(string userprovisioningrequestid, string status, string details) parameters userprovisioningrequestid type: string a unique identifier for the user provisioning request. status type: string a description of the current state. for example, while invoking a third-party api, the status could be invoke. details type: string the text for the message. return value type: void log(userprovisioningrequestid, externaluserid, externalusername, userid, details) writes a specific message, such as an error message, to monitor the progress of a user provisioning request associated with a specific user. 3565apex reference guide userprovisioningplugin class signature public void log(string userprovisioningrequestid, string externaluserid, string externalusername, string userid, string details) parameters userprovisioningrequestid type: string a unique identifier for the user provisioning request. externaluserid type: string the unique identifier for the user in the target system. externalusername type: string the username for the user in the target system. userid type: string salesforce id of the user making the request. details type: string the text for the message. return value type: void userprovisioningplugin class the userprovisioningplugin base class implements process.plugin for programmatic customization of" "the user provisioning process for connected apps. namespace userprovisioning usage extending this class gives you a plug-in that can be used flow builder as a legacy apex action, with the following input and output parameters. input parameter name description userprovisioningrequestid the unique id of the request for the plug-in to process. userid the id of the associated user for the request. 3566apex reference guide userprovisioningplugin class input parameter name description namedcreddevname the unique api name for the named credential to use for a request. the named credential identifies the third-party system and the third-party authentication settings. when the named credential is set in the user provisioning wizard, salesforce stores the value in the userprovisioningconfig.namedcredentialid field. reconfilter when collecting and analyzing users on a third-party system, the plug-in uses this filter to limit the scope of the collection. when the filter is set in the user provisioning wizard, salesforce stores the value in the userprovisioningconfig.reconfilter field. reconoffset when collecting and analyzing users on a third-party system, the plug-in uses this value as the starting point for the collection. output parameter name description status the vendor-specific status of the provisioning operation on the third-party system. details the vendor-specific message related to the status of the provisioning operation on the third-party system. externaluserid the vendor-specific id for the associated user on the third-party system. externalusername the vendor-specific username for the associated user on the third-party system. externalemail the email address assigned to the user on the third-party system. externalfirstname the first name assigned to the user on the third-party system. externallastname the last name assigned to the user on the third-party system. reconstate the state of the collecting and analyzing process on the third-party system. when the value is complete, the process is finished and a subsequent call to the plug-in is no longer needed, nor made. nextreconoffset when collecting and analyzing users on a third-party system, the process may encounter a transaction limit and have to stop before finishing. the value specified here initiates a call to the plug-in with a new quota limit. if you want to add more custom parameters, use the builddescribecall() method. 3567apex reference guide userprovisioningplugin class example the following example uses the builddescribecall() method to add a new input parameter and a new output parameter. the example also demonstrates how to bypass the limit of the 10,000 records processed in dml statements in an apex transaction. global class sampleconnector extends userprovisioning.userprovisioningplugin { // example of adding more input and output parameters to those defined in the base class global override process.plugindescriberesult builddescribecall() { process.plugindescriberesult describeresult = new process.plugindescriberesult(); describeresult.inputparameters = new list{ new process.plugindescriberesult.inputparameter('testinputparam', process.plugindescriberesult.parametertype.string, false) }; describeresult.outputparameters = new list{ new process.plugindescriberesult.outputparameter('testoutputparam', process.plugindescriberesult.parametertype.string) }; return describeresult; } // example plugin that demonstrates how to leverage the reconoffset/nextreconoffset/reconstate // parameters to create more than 10,000 users. (i.e. go beyond the 10,000 dml limit per transaction) global override process.pluginresult invoke(process.pluginrequest request) { map result = new map(); string uprid = (string) request.inputparameters.get('userprovisioningrequestid'); userprovisioning.userprovisioninglog.log(uprid, 'inserting log from test apex connector'); userprovisioningrequest upr = [select id, operation, connectedappid, state from userprovisioningrequest where id = :uprid]; if (upr.operation.equals('reconcile')) { string reconoffsetstr = (string) request.inputparameters.get('reconoffset'); integer reconoffset" "= 0; if (reconoffsetstr != null) { reconoffset = integer.valueof(reconoffsetstr); } if (reconoffset > 44999) { result.put('reconstate', 'completed'); } integer i = 0; list upaslist = new list(); for (i = 0; i < 5000; i++) { userprovaccountstaging upas = new userprovaccountstaging(); 3568apex reference guide userprovisioningplugin class upas.name = i + reconoffset + ''; upas.externalfirstname = upas.name; upas.externalemail = 'externaluser@externalsystem.com'; upas.linkstate = 'orphaned'; upas.status = 'active'; upas.connectedappid = upr.connectedappid; upaslist.add(upas); } insert upaslist; result.put('nextreconoffset', reconoffset + 5000 + ''); } return new process.pluginresult(result); } } in this section: userprovisioningplugin methods userprovisioningplugin methods the following are methods for userprovisioningplugin. in this section: builddescribecall() use this method to add more input and output parameters to those defined in the base class. describe() returns a process.plugindescriberesult object that describes this method call. getpluginclassname() returns the name of the class implementing the plugin. invoke(request) primary method that the system invokes when the class that implements the interface is instantiated. builddescribecall() use this method to add more input and output parameters to those defined in the base class. signature public process.plugindescriberesult builddescribecall() return value type: process.plugindescriberesult 3569apex reference guide visualeditor namespace describe() returns a process.plugindescriberesult object that describes this method call. signature public process.plugindescriberesult describe() return value type: process.plugindescriberesult getpluginclassname() returns the name of the class implementing the plugin. signature public string getpluginclassname() return value type: string invoke(request) primary method that the system invokes when the class that implements the interface is instantiated. signature public process.pluginresult invoke(process.pluginrequest request) parameters request type: process.pluginrequest return value type: process.plugindescriberesult visualeditor namespace the visualeditor namespace provides classes and methods for interacting with the lightning app builder. the classes and methods in this namespace operate on lightning components, which include lightning web components and aura components. as of spring ’19 (api version 45.0), you can build lightning components using two programming models: the lightning web components model, and the original aura components model. lightning web components are custom html elements built using html and modern javascript. lightning web components and aura components can coexist and interoperate on a page. 3570apex reference guide datarow class configure lightning web components and aura components to work in lightning app builder and experience builder. admins and end users don’t know which programming model was used to develop the components. to them, they’re simply lightning components. the following are the classes in the visualeditor namespace. in this section: datarow class contains information about one item in a picklist used in a lightning component on a lightning page. designtimepagecontext class an abstract class that provides context information about a lightning page. it can be used to help define the values of a picklist in a lightning component on a lightning page based on the page’s type and the object with which it’s associated. dynamicpicklist class an abstract class, used to display the values of a picklist in a lightning component on a lightning page. dynamicpicklistrows class contains a list of picklist items in a lightning component on a lightning page. datarow class contains information about one item in a picklist used in a lightning component on a lightning page. namespace visualeditor in this section: datarow constructors datarow methods datarow constructors the following are constructors for datarow. in this section: datarow(label, value, selected) creates an instance of the visualeditor.datarow class using the specified label, value, and selected option. datarow(label" ", value) creates an instance of the visualeditor.datarow class using the specified label and value. datarow(label, value, selected) creates an instance of the visualeditor.datarow class using the specified label, value, and selected option. signature public datarow(string label, object value, boolean selected) 3571apex reference guide datarow class parameters label type: string user-facing label for the picklist item. value type: object the value of the picklist item. selected type: boolean specifies whether the picklist item is selected (true) or not (false). datarow(label, value) creates an instance of the visualeditor.datarow class using the specified label and value. signature public datarow(string label, object value) parameters label type: string user-facing label for the picklist item. value type: object the value of the picklist item. datarow methods the following are methods for datarow. in this section: clone() makes a duplicate copy of the visualeditor.datarow object. compareto(o) compares the current visualeditor.datarow object to the specified one. returns an integer value that is the result of the comparison. getlabel() returns the user-facing label of the picklist item. getvalue() returns the value of the picklist item. isselected() returns the state of the picklist item, indicating whether it’s selected or not. 3572apex reference guide datarow class clone() makes a duplicate copy of the visualeditor.datarow object. signature public object clone() return value type: object compareto(o) compares the current visualeditor.datarow object to the specified one. returns an integer value that is the result of the comparison. signature public integer compareto(visualeditor.datarow o) parameters o type: visualeditor.datarow a single item in a picklist. return value type: integer returns one of the following values: • zero if the current package version is equal to the specified package version • an integer value greater than zero if the current package version is greater than the specified package version • an integer value less than zero if the current package version is less than the specified package version getlabel() returns the user-facing label of the picklist item. signature public string getlabel() return value type: string getvalue() returns the value of the picklist item. 3573apex reference guide designtimepagecontext class signature public object getvalue() return value type: object isselected() returns the state of the picklist item, indicating whether it’s selected or not. signature public boolean isselected() return value type: boolean designtimepagecontext class an abstract class that provides context information about a lightning page. it can be used to help define the values of a picklist in a lightning component on a lightning page based on the page’s type and the object with which it’s associated. namespace visualeditor usage to use this class, create a parameterized constructor in the custom apex class that extends visualeditor.dynamicpicklist. example here’s an example of a custom apex class extending the visualeditor.dynamicpicklist class. it includes visualeditor.designtimepagecontext to define a picklist value that is available only if the page type is homepage. global class mycustompicklist extends visualeditor.dynamicpicklist{ visualeditor.designtimepagecontext context; global mycustompicklist(visualeditor.designtimepagecontext context) { this.context = context; } global override visualeditor.datarow getdefaultvalue(){ visualeditor.datarow defaultvalue = new visualeditor.datarow('red', 'red'); return defaultvalue; } global override visualeditor.dynamicpicklistrows getvalues() { visualeditor.datarow value1 = new visualeditor.datarow('red', 'red'); 3574apex reference guide designtimepagecontext class visualeditor.datarow value2 = new visualeditor.datarow('yellow', 'yellow'); visualeditor.dynamicpicklistrows myvalues = new visualeditor.dynamicpicklistrows(); myvalues.addrow(value1); myvalues.addrow(value2); if (context.pagetype == 'homepage') { visualeditor.datarow value3" "= new visualeditor.datarow('purple', 'purple'); myvalues.addrow(value3); } return myvalues; } } in this section: designtimepagecontext properties designtimepagecontext methods designtimepagecontext properties the following are properties for designtimepagecontext. in this section: entityname the api name of the sobject that a lightning page is associated with, such as account, contact or custom_object__c. not all lightning pages are associated with objects. pagetype the type of lightning page, such as homepage, apppage, or recordpage. entityname the api name of the sobject that a lightning page is associated with, such as account, contact or custom_object__c. not all lightning pages are associated with objects. signature public string entityname {get; set;} property value type: string pagetype the type of lightning page, such as homepage, apppage, or recordpage. 3575apex reference guide dynamicpicklist class signature public string pagetype {get; set;} property value type: string designtimepagecontext methods the following are methods for designtimepagecontext. in this section: clone() makes a duplicate copy of the visualeditor.designtimepagecontext object. clone() makes a duplicate copy of the visualeditor.designtimepagecontext object. signature public object clone() return value type: object dynamicpicklist class an abstract class, used to display the values of a picklist in a lightning component on a lightning page. namespace visualeditor usage to use this class as the datasource of a picklist in a lightning component, it must be extended by a custom apex class and then that class must be called in the component’s design file. example here’s an example of a custom apex class extending the visualeditor.dynamicpicklist class. global class mycustompicklist extends visualeditor.dynamicpicklist{ global override visualeditor.datarow getdefaultvalue(){ visualeditor.datarow defaultvalue = new visualeditor.datarow('red', 'red'); 3576apex reference guide dynamicpicklist class return defaultvalue; } global override visualeditor.dynamicpicklistrows getvalues() { visualeditor.datarow value1 = new visualeditor.datarow('red', 'red'); visualeditor.datarow value2 = new visualeditor.datarow('yellow', 'yellow'); visualeditor.dynamicpicklistrows myvalues = new visualeditor.dynamicpicklistrows(); myvalues.addrow(value1); myvalues.addrow(value2); return myvalues; } } here’s an example of how the custom apex class gets called in a design file so that the picklist appears in the lightning component. in this section: dynamicpicklist methods dynamicpicklist methods the following are methods for dynamicpicklist. in this section: clone() makes a duplicate copy of the visualeditor.dynamicpicklist object. getdefaultvalue() returns the picklist item that is set as the default value for the picklist. getlabel(attributevalue) returns the user-facing label for a specified picklist value. getvalues() returns the list of picklist item values. isvalid(attributevalue) returns the valid state of the picklist item’s value. a picklist value is considered valid if it’s a part of any visualeditor.datarow in the visualeditor.dynamicpicklistrows returned by getvalues(). clone() makes a duplicate copy of the visualeditor.dynamicpicklist object. signature public object clone() 3577apex reference guide dynamicpicklist class return value type: object getdefaultvalue() returns the picklist item that is set as the default value for the picklist. signature public visualeditor.datarow getdefaultvalue() return value type: visualeditor.datarow getlabel(attributevalue) returns the user-facing label for a specified picklist value. signature public string getlabel(object attributevalue) parameters attributevalue type: object the value of the picklist item. return value type: string getvalues() returns the list of picklist item values. signature public visualeditor.dynamicpicklistrows getvalues() return" "value type: visualeditor.dynamicpicklistrows isvalid(attributevalue) returns the valid state of the picklist item’s value. a picklist value is considered valid if it’s a part of any visualeditor.datarow in the visualeditor.dynamicpicklistrows returned by getvalues(). 3578apex reference guide dynamicpicklistrows class signature public boolean isvalid(object attributevalue) parameters attributevalue type: object the value of the picklist item. return value type: boolean dynamicpicklistrows class contains a list of picklist items in a lightning component on a lightning page. namespace visualeditor in this section: dynamicpicklistrows constructors dynamicpicklistrows methods dynamicpicklistrows constructors the following are constructors for dynamicpicklistrows. in this section: dynamicpicklistrows(rows, containsallrows) creates an instance of the visualeditor.dynamicpicklistrows class using the specified parameters. dynamicpicklistrows(rows) creates an instance of the visualeditor.dynamicpicklistrows class using the specified parameter. dynamicpicklistrows() creates an instance of the visualeditor.dynamicpicklistrows class. you can then add rows by using the class’s addrow or addallrows methods. dynamicpicklistrows(rows, containsallrows) creates an instance of the visualeditor.dynamicpicklistrows class using the specified parameters. signature public dynamicpicklistrows(list rows, boolean containsallrows) 3579apex reference guide dynamicpicklistrows class parameters rows type: list visualeditor.datarow list of picklist items. containsallrows type: boolean indicates if all values of the picklist are included in a type-ahead search query (true) or only those values initially displayed when the list is clicked on (false). a picklist in a lightning component can display only the first 200 values of a list. if containsallrows is set to false, when a user does a type-ahead search to find values in the picklist, the search will only look at those first 200 values that were displayed, not the complete set of picklist values. dynamicpicklistrows(rows) creates an instance of the visualeditor.dynamicpicklistrows class using the specified parameter. signature public dynamicpicklistrows(list rows) parameters rows type: list visualeditor.datarow list of picklist rows. dynamicpicklistrows() creates an instance of the visualeditor.dynamicpicklistrows class. you can then add rows by using the class’s addrow or addallrows methods. signature public dynamicpicklistrows() dynamicpicklistrows methods the following are methods for dynamicpicklistrows. in this section: addallrows(rows) adds a list of picklist items to a dynamic picklist rendered in a lightning component on a lightning page. addrow(row) adds a single picklist item to a dynamic picklist rendered in a lightning component on a lightning page. clone() makes a duplicate copy of the visualeditor.dynamicpicklistrows object. 3580apex reference guide dynamicpicklistrows class containsallrows() returns a boolean value indicating whether all values of the picklist are included when a user does a type-ahead search query (true) or only those values initially displayed when the list is clicked on (false). get(i) returns a picklist element stored at the specified index. getdatarows() returns a list of picklist items. setcontainsallrows(containsallrows) sets the value indicating whether all values of the picklist are included when a user does a type-ahead search query (true) or only those values initially displayed when the list is clicked on (false). size() returns the size of the list of visualeditor.dynamicpicklistrows. sort() sorts the list of visualeditor.dynamicpicklistrows. addallrows(rows) adds a list of picklist items to a dynamic picklist rendered in a lightning component on a lightning page. signature public void addallrows(list rows) parameters rows type: list visualeditor.datarow list of picklist items. return value" "type: void addrow(row) adds a single picklist item to a dynamic picklist rendered in a lightning component on a lightning page. signature public void addrow(visualeditor.datarow row) parameters row type: visualeditor.datarow a single picklist item. 3581apex reference guide dynamicpicklistrows class return value type: void clone() makes a duplicate copy of the visualeditor.dynamicpicklistrows object. signature public object clone() return value type: object containsallrows() returns a boolean value indicating whether all values of the picklist are included when a user does a type-ahead search query (true) or only those values initially displayed when the list is clicked on (false). signature public boolean containsallrows() return value type: boolean a picklist in a lightning component can display only the first 200 values of a list. if containsallrows is set to false, when a user does a type-ahead search to find values in the picklist, the search will only look at those first 200 values that were displayed, not the complete set of picklist values. get(i) returns a picklist element stored at the specified index. signature public visualeditor.datarow get(integer i) parameters i type: integer the index. return value type: visualeditor.datarow 3582" "apex reference guide dynamicpicklistrows class getdatarows() returns a list of picklist items. signature public list getdatarows() return value type: list visualeditor.datarow setcontainsallrows(containsallrows) sets the value indicating whether all values of the picklist are included when a user does a type-ahead search query (true) or only those values initially displayed when the list is clicked on (false). signature public void setcontainsallrows(boolean containsallrows) parameters containsallrows type: boolean indicates if all values of the picklist are included in a type-ahead search query (true) or only those values initially displayed when the list is clicked on (false). a picklist in a lightning component can display only the first 200 values of a list. if containsallrows is set to false, when a user does a type-ahead search to find values in the picklist, the search will only look at those first 200 values that were displayed, not the complete set of picklist values. return value type: void size() returns the size of the list of visualeditor.dynamicpicklistrows. signature public integer size() return value type: integer sort() sorts the list of visualeditor.dynamicpicklistrows. 3583apex reference guide wave namespace signature public void sort() return value type: void wave namespace the classes in the wave namespace are part of the crm analytics analytics sdk, designed to facilitate querying crm analytics data from apex code. the following are the classes in the wave namespace. in this section: querybuilder class the querybuilder class provides methods for constructing well-formed saql queries to pass to crm analytics. querynode class define each node of the query - such as projection, groups, order, filters. execute the query. projectionnode class add aggregate functions to the query, or define an alias. templates class the templates class provides methods for retrieving crm analytics template collections, individual templates, and template configurations. templatessearchoptions class the templatessearchoptions class provides optional properties to filter the template collection. querybuilder class the querybuilder class provides methods for constructing well-formed saql queries to pass to crm analytics. namespace wave usage use querybuilder and its associated classes, wave.projectionnode and wave.querynode, to incrementally build your saql statement. for example: public static void executeapexquery(string name){ wave.projectionnode[] projs = new wave.projectionnode[]{ wave.querybuilder.get('state').alias('state'), wave.querybuilder.get('city').alias('city'), wave.querybuilder.get('revenue').avg().alias('avg_revenue'), wave.querybuilder.get('revenue').sum().alias('sum_revenue'), 3584apex reference guide querybuilder class wave.querybuilder.count().alias('count')}; connectapi.literaljson result = wave.querybuilder.load('0fbd00000004dszkam', '0fcd00000004fezka2') .group(new string[]{'state', 'city'}) .foreach(projs) .execute('q'); string response = result.json; } examples querybuilder is the core of this first phase of the crm analytics apex sdk, so let’s take a closer look. here’s a simple count query. wave.projectionnode[] projs = new wave.projectionnode[]{wave.querybuilder.count().alias('c')}; string query = wave.querybuilder.load('datasetid', 'datasetversionid').group().foreach(projs).build('q'); the resulting saql query looks like this: q = load ""datasetid/datasetversionid""; q = group q by all; q = foreach q generate count as c; here’s a more complex example that uses a union statement. wave.projectionnode[] projs = new wave.projectionnode[]{wave.querybuilder.get('name'), wave.querybuilder.get('annualrevenue').alias('revenue')}; wave.querynode nodeone = wave.querybuilder.load('datasetone','datasetversionone').foreach" "(projs); wave.querynode nodetwo = wave.querybuilder.load('datasettwo', 'datasetversiontwo').foreach(projs); string query = wave.querybuilder.union(new list{nodeone, nodetwo}).build('q'); the resulting saql query has two projection streams, qa and qb. qa = load ""datasetone/datasetversionone""; qa = foreach q generate name,annualrevenue as revenue; qb = load ""datasettwo/datasetversiontwo""; qb = foreach q generate name,annualrevenue as revenue; q = union qa, qb; in this section: querybuilder methods querybuilder methods the following are methods for querybuilder. 3585apex reference guide querybuilder class in this section: load(datasetid, datasetversionid) load a stream from a dataset. count() calculate the number of rows that match the query criteria. get(projection) query by selecting specific attributes. union(unionnodes) combine multiple result sets into one result set. cogroup(cogroupnodes, groups) cogrouping means that two input streams are grouped independently and arranged side by side. only data that exists in both groups appears in the results. load(datasetid, datasetversionid) load a stream from a dataset. signature public static wave.querynode load(string datasetid, string datasetversionid) parameters datasetid type: string the id of the dataset. datasetversionid type: string the id identifying the version of the dataset. return value type: wave.querynode count() calculate the number of rows that match the query criteria. signature public static wave.projectionnode count() return value type: wave.projectionnode 3586apex reference guide querybuilder class get(projection) query by selecting specific attributes. signature public static wave.projectionnode get(string proj) parameters proj type: string the name of the column to query. return value type: wave.projectionnode union(unionnodes) combine multiple result sets into one result set. signature global static wave.querynode union(list unionnodes) parameters unionnodes type: list list of nodes to combine. return value type: wave.querynode cogroup(cogroupnodes, groups) cogrouping means that two input streams are grouped independently and arranged side by side. only data that exists in both groups appears in the results. signature global static wave.querynode cogroup(list cogroupnodes, list> groups) parameters cogroupnodes type: wave.querynode 3587apex reference guide querynode class list of nodes to group. groups type: string the type of grouping. return value type: wave.querynode querynode class define each node of the query - such as projection, groups, order, filters. execute the query. namespace wave usage refer to the querybuilder example. in this section: querynode methods querynode methods the following are methods for querynode. in this section: build(streamname) build the query string represented by this querynode and assign it to a stream name. foreach(projections) applies a set of expressions to every row in a dataset. this action is often referred to as projection. group(groups) groups matched records (group by specific dataset attributes). group() groups matched records (group by all). order(orders) sorts in ascending or descending order on one or more fields. cap(cap) limits the number of results that are returned. filter(filtercondition) selects rows from a dataset based on a filter condition (a predicate). 3588apex reference guide querynode class filter(filterconditions) selects rows from a dataset based on multiple filter conditions (predicates). execute(streamname) execute the query and return rows as json. build(streamname) build the query string represented by this querynode and assign it to a stream name. signature public string build(string streamname) parameters streamname type" ": string the identifier for the stream - for example, “q”. return value type: string the saql query string represented by the querynode. foreach(projections) applies a set of expressions to every row in a dataset. this action is often referred to as projection. signature public wave.querynode foreach(list projections) parameters projections type: list a list of projectionnodes to be added to this querynode. return value type: wave.querynode group(groups) groups matched records (group by specific dataset attributes). signature public wave.querynode group(list groups) 3589apex reference guide querynode class parameters groups type: list a list of expressions. return value type: wave.querynode example wave.projectionnode[] projs = new wave.projectionnode[]{wave.querybuilder.get('name'), wave.querybuilder.get('revenue').sum().alias('revenue_sum')}; connectapi.literaljson result = wave.querybuilder.load('datasetid', 'datasetversionid').group(new string[]{'name'}).foreach(projs).build('q'); group() groups matched records (group by all). signature public wave.querynode group() return value type: wave.querynode example string query = wave.querybuilder.load('datasetid', 'datasetversionid').group().foreach(projs).build('q'); order(orders) sorts in ascending or descending order on one or more fields. signature public wave.querynode group(list groups) parameters groups type: list a list of column names and associated ascending or descending keywords, for example list>{new list{'name', 'asc'}, new list{'revenue', 'desc'}} 3590apex reference guide querynode class return value type: wave.querynode cap(cap) limits the number of results that are returned. signature global wave.querynode cap(integer cap) parameters cap type: integer the maximum number of rows to return. return value type: wave.querynode filter(filtercondition) selects rows from a dataset based on a filter condition (a predicate). signature public wave.querynode filter(string filtercondition) parameters filtercondition type: string for example: filter('name != \'my name\'') return value type: wave.querynode filter(filterconditions) selects rows from a dataset based on multiple filter conditions (predicates). signature public wave.querynode filter(list filtercondition) 3591apex reference guide projectionnode class parameters filtercondition type: list a list of filter conditions. return value type: wave.querynode execute(streamname) execute the query and return rows as json. signature global connectapi.literaljson execute(string streamname) parameters streamname type: string the query stream to execute. for example: connectapi.literaljson result = wave.querybuilder.load('datasetid', 'datasetversionid').group().foreach(projs).execute('q'); return value type: connectapi.literaljson projectionnode class add aggregate functions to the query, or define an alias. namespace wave on page 3584 usage refer to the querybuilder example. in this section: projectionnode methods projectionnode methods the following are methods for projectionnode. 3592apex reference guide projectionnode class in this section: sum() returns the sum of a numeric field. avg() returns the average value of a numeric field. min() returns the minimum value of a field. max() returns the maximum value of a field. count() returns the number of rows that match the query criteria. unique() returns the count of unique values. alias(name) define output column names. sum() returns the sum of a numeric field. signature public wave.projectionnode sum() return value type: wave.projectionnode avg()" "returns the average value of a numeric field. signature public wave.projectionnode avg() return value type: wave.projectionnode min() returns the minimum value of a field. signature public wave.projectionnode min() 3593apex reference guide projectionnode class return value type: wave.projectionnode max() returns the maximum value of a field. signature public wave.projectionnode max() return value type: wave.projectionnode count() returns the number of rows that match the query criteria. signature public wave.projectionnode count() return value type: wave.projectionnode unique() returns the count of unique values. signature public wave.projectionnode unique() return value type: wave.projectionnode alias(name) define output column names. signature public wave.projectionnode alias(string name) 3594apex reference guide templates class parameters name type: string the name to use for this column. for example, this code defines the alias c: wave.projectionnode[] projs = new wave.projectionnode[]{wave.querybuilder.count().alias('c')}; return value type: wave.projectionnode templates class the templates class provides methods for retrieving crm analytics template collections, individual templates, and template configurations. namespace wave usage use templates and its associated class wave.templatessearchoptions to get crm analytics template information. examples this code sample declares a method that returns a list of the template names. @auraenabled(cacheable=true) public static void list gettemplatenames() { map o = wave.templates.gettemplates(new wave.templatessearchoptions()); list templates = (list) o.get('templates'); list names = new list(); for (object templateobj : templates) { names.add((string) ((map) templateobj.get('name')); } return names; } adding the @auraenabled annotation allows lightning web components to access templates methods directly. for example, in the lwc.js file: import gettemplates from '@salesforce/apex/wave.templates.gettemplates'; export default class templates extends lightningelement { @wire(gettemplates, { // specifying 'options' is optional options: { // values in templatessearchoptions go here; all optional type: 'app' } 3595apex reference guide templates class }) ontemplates({ data, error }) { if (data) { console.log('template names=' + data.templates.map(l => l.name).join(', ')); } } } in this section: templates methods templates methods the following are methods for templates. in this section: gettemplate(templateidorapiname) gets a crm analytics template by the specified id or api name. the returned template is a map of the template json attributes as name/value pairs. gettemplateconfig(templateidorapiname) gets the crm analytics template configuration by the specified id or api name. the returned template configuration is a map of the json attributes as name/value pairs. gettemplates(options) get a filtered collection of crm analytics templates using search options. gettemplates() gets all crm analytics templates. gettemplate(templateidorapiname) gets a crm analytics template by the specified id or api name. the returned template is a map of the template json attributes as name/value pairs. signature public static map gettemplate(string templateidorapiname) parameters templateidorapiname type: string the template id or api name of the template to retrieve. return value type: map 3596apex reference guide templates class a map of the template json attribute name/value pairs, where the name is a string with an object value. for attributes details, see templaterepresentation. example string templatename = (string) wave.templates.gettemplate(templateid).get('name'); gettemplateconfig(templateidorapiname) gets the crm analytics template configuration by the specified id or api name. the returned template configuration is a map of the" "json attributes as name/value pairs. signature public static map gettemplateconfig(string templateidorapiname) parameters templateidorapiname type: string the template id or developer name to retrieve the template configuration for. return value type: map a map of template configuration json attribute names and the object values. for attribute details, see templateconfigurationrepresentation. example map templatevariables = (map) wave.templates.gettemplateconfig(templateid).get('variables'); gettemplates(options) get a filtered collection of crm analytics templates using search options. signature public static map gettemplates(wave.templatessearchoptions options) parameters options type: wave.templatessearchoptions on page 3598 the search options to use for filtering the template collection. 3597apex reference guide templatessearchoptions class return value type: map a map of template names and the template object values. for template collection details, see templatecollectionrepresentation. example map templatesmap = wave.templates.gettemplates(new wave.templatessearchoptions()); gettemplates() gets all crm analytics templates. signature public static map gettemplates() return value type: map a map of template names and the template object values. for template collection details, see templatecollectionrepresentation. example map templatesmap = wave.templates.gettemplates(); templatessearchoptions class the templatessearchoptions class provides optional properties to filter the template collection. namespace wave usage use templatessearchoptions with wave.templates class to filter the crm analytics template collection returned. for example: public static void list getapptemplates() { wave.templatesearchoptions tsoptions = new wave.templatessearchoptions(); tsoptions.type = 'app'; map o = wave.templates.gettemplates(tsoptions); list apptemplates = (list) o.get('templates'); list names = new list(); for (object templateobj : apptemplates) { names.add((string) ((map) templateobj.get('name')); } 3598apex reference guide templatessearchoptions class return names; } in this section: templatessearchoptions properties templatessearchoptions properties the following are properties for templatessearchoptions. in this section: filtergroup specifies the connect api filter group for crm analytics template search options. options specifies the template visibility option to filter the crm analytics template collection by. type sets the template type to filter the crm analytics template collection by. filtergroup specifies the connect api filter group for crm analytics template search options. signature public string filtergroup {get; set;} property value type: string uses the connectfiltergroupenum values. example wave.templatesearchoptions tsoptions = new wave.templatessearchoptions(); tsoptions.filtergroup = 'small'; options specifies the template visibility option to filter the crm analytics template collection by. signature public string options {get; set;} 3599apex reference guide appendices property value type: string uses the connectwavetemplatevisibilityoptionsenum values. valid values are createapp, viewonly, and manageableonly. example wave.templatesearchoptions tsoptions = new wave.templatessearchoptions(); tsoptions.options = 'viewonly'; type sets the template type to filter the crm analytics template collection by. signature public string type {get; set;} property value type: string uses the connectwavetemplatetypeenum values. valid values are app, dashboard, embedded, and lens. example wave.templatesearchoptions tsoptions = new wave.templatessearchoptions(); tsoptions.type = 'app'; appendices in this section: shipping invoice example reserved keywords documentation typographical conventions glossary shipping invoice example this appendix provides an example of an apex application. this is a more complex example than the hello world example. • shipping invoice walk-through • shipping invoice example code in this section: 1. shipping invoice example walk" "-through 3600apex reference guide shipping invoice example 2. shipping invoice example code shipping invoice example walk-through the sample application in this section includes traditional salesforce functionality blended with apex. many of the syntactic and semantic features of apex, along with common idioms, are illustrated in this application. note: the shipping invoice sample requires custom objects. you can either create these on your own, or download the objects and apex code as an unmanaged package from the salesforce appexchange. to obtain the sample assets in your org, install the apex tutorials package. this package also contains sample code and objects for the apex quick start. scenario in this sample application, the user creates a new shipping invoice, or order, and then adds items to the invoice. the total amount for the order, including shipping cost, is automatically calculated and updated based on the items added or deleted from the invoice. data and code models this sample application uses two new objects: item and shipping_invoice. the following assumptions are made: • item a cannot be in both orders shipping_invoice1 and shipping_invoice2. two customers cannot obtain the same (physical) product. • the tax rate is 9.25%. • the shipping rate is 75 cents per pound. • once an order is over $100, the shipping discount is applied (shipping becomes free). the fields in the item custom object include: name type description name string the name of the item price currency the price of the item quantity number the number of items in the order weight number the weight of the item, used to calculate shipping costs shipping_invoice master-detail (shipping_invoice) the order this item is associated with the fields in the shipping_invoice custom object include: name type description name string the name of the shipping invoice/order subtotal currency the subtotal grandtotal currency the total amount, including tax and shipping shipping currency the amount charged for shipping (assumes $0.75 per pound) 3601apex reference guide shipping invoice example name type description shippingdiscount currency only applied once when subtotal amount reaches $100 tax currency the amount of tax (assumes 9.25%) totalweight number the total weight of all items all of the apex for this application is contained in triggers. this application has the following triggers: object trigger name when runs description item calculate after insert, after update, after delete updates the shipping invoice, calculates the totals and shipping shipping_invoice shippingdiscount after update updates the shipping invoice, calculating if there is a shipping discount the following is the general flow of user actions and when triggers run: flow of user action and triggers for the shopping cart application 1. user clicks orders > new, names the shipping invoice and clicks save. 2. user clicks new item, fills out information, and clicks save. 3. calculate trigger runs. part of the calculate trigger updates the shipping invoice. 4. shippingdiscount trigger runs. 3602apex reference guide shipping invoice example 5. user can then add, delete or change items in the invoice. in shipping invoice example code both of the triggers and the test class are listed. the comments in the code explain the functionality. testing the shipping invoice application before an application can be included as part of a package, 75% of the code must be covered by unit tests. therefore, one piece of the shipping invoice application is a class used for testing the triggers. the test class verifies the following actions are completed successfully: • inserting items • updating items • deleting items • applying shipping discount • negative test for bad input shipping invoice example code the following triggers and test class make up the shipping invoice example application: • calculate trigger • shippingdiscount trigger • test class calculate trigger trigger calculate on item__c (after insert, after update, after delete) { // use a map because it doesn't allow duplicate values map updatemap = new map(); // set this integer to -1 if we are deleting integer subtract ; // populate the list of items based on trigger type list itemlist; if(trigger.isinsert || trigger.isupdate){ itemlist = trigger.new; subtract = 1; } else if(trigger.isdelete) { // note -- there is no trigger.new in delete itemlist = trigger.old; subtract = -1; } // access all the information we" "need in a single query // rather than querying when we need it. // this is a best practice for bulkifying requests 3603apex reference guide shipping invoice example set allitems = new set(); for(item__c i :itemlist){ // assert numbers are not negative. // none of the fields would make sense with a negative value system.assert(i.quantity__c > 0, 'quantity must be positive'); system.assert(i.weight__c >= 0, 'weight must be non-negative'); system.assert(i.price__c >= 0, 'price must be non-negative'); // if there is a duplicate id, it won't get added to a set allitems.add(i.shipping_invoice__c); } // accessing all shipping invoices associated with the items in the trigger list allshippinginvoices = [select id, shippingdiscount__c, subtotal__c, totalweight__c, tax__c, grandtotal__c from shipping_invoice__c where id in :allitems]; // take the list we just populated and put it into a map. // this will make it easier to look up a shipping invoice // because you must iterate a list, but you can use lookup for a map, map simap = new map(); for(shipping_invoice__c sc : allshippinginvoices) { simap.put(sc.id, sc); } // process the list of items if(trigger.isupdate) { // treat updates like a removal of the old item and addition of the // revised item rather than figuring out the differences of each field // and acting accordingly. // note updates have both trigger.new and trigger.old for(integer x = 0; x < trigger.old.size(); x++) { shipping_invoice__c myorder; myorder = simap.get(trigger.old[x].shipping_invoice__c); // decrement the previous value from the subtotal and weight. myorder.subtotal__c -= (trigger.old[x].price__c * trigger.old[x].quantity__c); myorder.totalweight__c -= (trigger.old[x].weight__c * trigger.old[x].quantity__c); // increment the new subtotal and weight. myorder.subtotal__c += (trigger.new[x].price__c * trigger.new[x].quantity__c); myorder.totalweight__c += (trigger.new[x].weight__c * trigger.new[x].quantity__c); } 3604apex reference guide shipping invoice example for(shipping_invoice__c myorder : allshippinginvoices) { // set tax rate to 9.25% please note, this is a simple example. // generally, you would never hard code values. // leveraging custom settings for tax rates is a best practice. // see custom settings in the apex developer guide // for more information. myorder.tax__c = myorder.subtotal__c * .0925; // reset the shipping discount myorder.shippingdiscount__c = 0; // set shipping rate to 75 cents per pound. // generally, you would never hard code values. // leveraging custom settings for the shipping rate is a best practice. // see custom settings in the apex developer guide // for more information. myorder.shipping__c = (myorder.totalweight__c * .75); myorder.grandtotal__c = myorder.subtotal__c + myorder.tax__c + myorder.shipping__c; updatemap.put(myorder.id, myorder); } } else { for(item__c itemtoprocess : itemlist) { shipping_invoice__c myorder; // look up the correct shipping invoice from the ones we got earlier myorder = simap.get(itemtoprocess.shipping_invoice__c); myorder.subtotal__c += (itemtoprocess.price__c * itemtoprocess.quantity__c * subtract); myorder.totalweight__c += (itemtoprocess.weight__c * itemtoprocess.quantity__c * subtract); } for(shipping_invoice__c my" "order : allshippinginvoices) { // set tax rate to 9.25% please note, this is a simple example. // generally, you would never hard code values. // leveraging custom settings for tax rates is a best practice. // see custom settings in the apex developer guide // for more information. myorder.tax__c = myorder.subtotal__c * .0925; // reset shipping discount myorder.shippingdiscount__c = 0; // set shipping rate to 75 cents per pound. // generally, you would never hard code values. // leveraging custom settings for the shipping rate is a best practice. 3605apex reference guide shipping invoice example // see custom settings in the apex developer guide // for more information. myorder.shipping__c = (myorder.totalweight__c * .75); myorder.grandtotal__c = myorder.subtotal__c + myorder.tax__c + myorder.shipping__c; updatemap.put(myorder.id, myorder); } } // only use one dml update at the end. // this minimizes the number of dml requests generated from this trigger. update updatemap.values(); } shippingdiscount trigger trigger shippingdiscount on shipping_invoice__c (before update) { // free shipping on all orders greater than $100 for(shipping_invoice__c myshippinginvoice : trigger.new) { if((myshippinginvoice.subtotal__c >= 100.00) && (myshippinginvoice.shippingdiscount__c == 0)) { myshippinginvoice.shippingdiscount__c = myshippinginvoice.shipping__c * -1; myshippinginvoice.grandtotal__c += myshippinginvoice.shippingdiscount__c; } } } shipping invoice test @istest private class testshippinginvoice{ // test for inserting three items at once public static testmethod void testbulkiteminsert(){ // create the shipping invoice. it's a best practice to either use defaults // or to explicitly set all values to zero so as to avoid having // extraneous data in your test. shipping_invoice__c order1 = new shipping_invoice__c(subtotal__c = 0, totalweight__c = 0, grandtotal__c = 0, shippingdiscount__c = 0, shipping__c = 0, tax__c = 0); // insert the order and populate with items insert order1; list list1 = new list(); item__c item1 = new item__c(price__c = 10, weight__c = 1, quantity__c = 1, shipping_invoice__c = order1.id); item__c item2 = new item__c(price__c = 25, weight__c = 2, quantity__c = 1, 3606apex reference guide shipping invoice example shipping_invoice__c = order1.id); item__c item3 = new item__c(price__c = 40, weight__c = 3, quantity__c = 1, shipping_invoice__c = order1.id); list1.add(item1); list1.add(item2); list1.add(item3); insert list1; // retrieve the order, then do assertions order1 = [select id, subtotal__c, tax__c, shipping__c, totalweight__c, grandtotal__c, shippingdiscount__c from shipping_invoice__c where id = :order1.id]; system.assert(order1.subtotal__c == 75, 'order subtotal was not $75, but was '+ order1.subtotal__c); system.assert(order1.tax__c == 6.9375, 'order tax was not $6.9375, but was ' + order1.tax__c); system.assert(order1.shipping__c == 4.50, 'order shipping was not $4.50, but was ' + order1.shipping__c); system.assert(order1.totalweight__c == 6.00, 'order weight was not 6 but was ' + order1.totalweight__c); system.assert(order1.grandtotal__c == 86.4375, 'order grand total was not $86.4375 but was ' + order1.grandtotal__c);" "system.assert(order1.shippingdiscount__c == 0, 'order shipping discount was not $0 but was ' + order1.shippingdiscount__c); } // test for updating three items at once public static testmethod void testbulkitemupdate(){ // create the shipping invoice. it's a best practice to either use defaults // or to explicitly set all values to zero so as to avoid having // extraneous data in your test. shipping_invoice__c order1 = new shipping_invoice__c(subtotal__c = 0, totalweight__c = 0, grandtotal__c = 0, shippingdiscount__c = 0, shipping__c = 0, tax__c = 0); // insert the order and populate with items. insert order1; list list1 = new list(); item__c item1 = new item__c(price__c = 1, weight__c = 1, quantity__c = 1, shipping_invoice__c = order1.id); item__c item2 = new item__c(price__c = 2, weight__c = 2, quantity__c = 1, shipping_invoice__c = order1.id); item__c item3 = new item__c(price__c = 4, weight__c = 3, quantity__c = 1, shipping_invoice__c = order1.id); list1.add(item1); list1.add(item2); list1.add(item3); insert list1; 3607apex reference guide shipping invoice example // update the prices on the 3 items list1[0].price__c = 10; list1[1].price__c = 25; list1[2].price__c = 40; update list1; // access the order and assert items updated order1 = [select id, subtotal__c, tax__c, shipping__c, totalweight__c, grandtotal__c, shippingdiscount__c from shipping_invoice__c where id = :order1.id]; system.assert(order1.subtotal__c == 75, 'order subtotal was not $75, but was '+ order1.subtotal__c); system.assert(order1.tax__c == 6.9375, 'order tax was not $6.9375, but was ' + order1.tax__c); system.assert(order1.shipping__c == 4.50, 'order shipping was not $4.50, but was ' + order1.shipping__c); system.assert(order1.totalweight__c == 6.00, 'order weight was not 6 but was ' + order1.totalweight__c); system.assert(order1.grandtotal__c == 86.4375, 'order grand total was not $86.4375 but was ' + order1.grandtotal__c); system.assert(order1.shippingdiscount__c == 0, 'order shipping discount was not $0 but was ' + order1.shippingdiscount__c); } // test for deleting items public static testmethod void testbulkitemdelete(){ // create the shipping invoice. it's a best practice to either use defaults // or to explicitly set all values to zero so as to avoid having // extraneous data in your test. shipping_invoice__c order1 = new shipping_invoice__c(subtotal__c = 0, totalweight__c = 0, grandtotal__c = 0, shippingdiscount__c = 0, shipping__c = 0, tax__c = 0); // insert the order and populate with items insert order1; list list1 = new list(); item__c item1 = new item__c(price__c = 10, weight__c = 1, quantity__c = 1, shipping_invoice__c = order1.id); item__c item2 = new item__c(price__c = 25, weight__c = 2, quantity__c = 1, shipping_invoice__c = order1.id); item__c item3 = new item__c(price__c = 40, weight__c = 3, quantity__c = 1, shipping_invoice__c = order1.id); item__c itema = new item__c(price__c = 1, weight" "__c = 3, quantity__c = 1, shipping_invoice__c = order1.id); item__c itemb = new item__c(price__c = 1, weight__c = 3, quantity__c = 1, shipping_invoice__c = order1.id); item__c itemc = new item__c(price__c = 1, weight__c = 3, quantity__c = 1, 3608apex reference guide shipping invoice example shipping_invoice__c = order1.id); item__c itemd = new item__c(price__c = 1, weight__c = 3, quantity__c = 1, shipping_invoice__c = order1.id); list1.add(item1); list1.add(item2); list1.add(item3); list1.add(itema); list1.add(itemb); list1.add(itemc); list1.add(itemd); insert list1; // seven items are now in the shipping invoice. // the following deletes four of them. list list2 = new list(); list2.add(itema); list2.add(itemb); list2.add(itemc); list2.add(itemd); delete list2; // retrieve the order and verify the deletion order1 = [select id, subtotal__c, tax__c, shipping__c, totalweight__c, grandtotal__c, shippingdiscount__c from shipping_invoice__c where id = :order1.id]; system.assert(order1.subtotal__c == 75, 'order subtotal was not $75, but was '+ order1.subtotal__c); system.assert(order1.tax__c == 6.9375, 'order tax was not $6.9375, but was ' + order1.tax__c); system.assert(order1.shipping__c == 4.50, 'order shipping was not $4.50, but was ' + order1.shipping__c); system.assert(order1.totalweight__c == 6.00, 'order weight was not 6 but was ' + order1.totalweight__c); system.assert(order1.grandtotal__c == 86.4375, 'order grand total was not $86.4375 but was ' + order1.grandtotal__c); system.assert(order1.shippingdiscount__c == 0, 'order shipping discount was not $0 but was ' + order1.shippingdiscount__c); } // testing free shipping public static testmethod void testfreeshipping(){ // create the shipping invoice. it's a best practice to either use defaults // or to explicitly set all values to zero so as to avoid having // extraneous data in your test. shipping_invoice__c order1 = new shipping_invoice__c(subtotal__c = 0, totalweight__c = 0, grandtotal__c = 0, shippingdiscount__c = 0, shipping__c = 0, tax__c = 0); // insert the order and populate with items. insert order1; 3609apex reference guide shipping invoice example list list1 = new list(); item__c item1 = new item__c(price__c = 10, weight__c = 1, quantity__c = 1, shipping_invoice__c = order1.id); item__c item2 = new item__c(price__c = 25, weight__c = 2, quantity__c = 1, shipping_invoice__c = order1.id); item__c item3 = new item__c(price__c = 40, weight__c = 3, quantity__c = 1, shipping_invoice__c = order1.id); list1.add(item1); list1.add(item2); list1.add(item3); insert list1; // retrieve the order and verify free shipping not applicable order1 = [select id, subtotal__c, tax__c, shipping__c, totalweight__c, grandtotal__c, shippingdiscount__c from shipping_invoice__c where id = :order1.id]; // free shipping not available on $75 orders system.assert(" "order1.subtotal__c == 75, 'order subtotal was not $75, but was '+ order1.subtotal__c); system.assert(order1.tax__c == 6.9375, 'order tax was not $6.9375, but was ' + order1.tax__c); system.assert(order1.shipping__c == 4.50, 'order shipping was not $4.50, but was ' + order1.shipping__c); system.assert(order1.totalweight__c == 6.00, 'order weight was not 6 but was ' + order1.totalweight__c); system.assert(order1.grandtotal__c == 86.4375, 'order grand total was not $86.4375 but was ' + order1.grandtotal__c); system.assert(order1.shippingdiscount__c == 0, 'order shipping discount was not $0 but was ' + order1.shippingdiscount__c); // add items to increase subtotal item1 = new item__c(price__c = 25, weight__c = 20, quantity__c = 1, shipping_invoice__c = order1.id); insert item1; // retrieve the order and verify free shipping is applicable order1 = [select id, subtotal__c, tax__c, shipping__c, totalweight__c, grandtotal__c, shippingdiscount__c from shipping_invoice__c where id = :order1.id]; // order total is now at $100, so free shipping should be enabled system.assert(order1.subtotal__c == 100, 'order subtotal was not $100, but was '+ order1.subtotal__c); system.assert(order1.tax__c == 9.25, 'order tax was not $9.25, but was ' + order1.tax__c); system.assert(order1.shipping__c == 19.50, 'order shipping was not $19.50, but was ' + order1.shipping__c); system.assert(order1.totalweight__c == 26.00, 3610apex reference guide shipping invoice example 'order weight was not 26 but was ' + order1.totalweight__c); system.assert(order1.grandtotal__c == 109.25, 'order grand total was not $86.4375 but was ' + order1.grandtotal__c); system.assert(order1.shippingdiscount__c == -19.50, 'order shipping discount was not -$19.50 but was ' + order1.shippingdiscount__c); } // negative testing for inserting bad input public static testmethod void testnegativetests(){ // create the shipping invoice. it's a best practice to either use defaults // or to explicitly set all values to zero so as to avoid having // extraneous data in your test. shipping_invoice__c order1 = new shipping_invoice__c(subtotal__c = 0, totalweight__c = 0, grandtotal__c = 0, shippingdiscount__c = 0, shipping__c = 0, tax__c = 0); // insert the order and populate with items. insert order1; item__c item1 = new item__c(price__c = -10, weight__c = 1, quantity__c = 1, shipping_invoice__c = order1.id); item__c item2 = new item__c(price__c = 25, weight__c = -2, quantity__c = 1, shipping_invoice__c = order1.id); item__c item3 = new item__c(price__c = 40, weight__c = 3, quantity__c = -1, shipping_invoice__c = order1.id); item__c item4 = new item__c(price__c = 40, weight__c = 3, quantity__c = 0, shipping_invoice__c = order1.id); try{ insert item1; } catch(exception e) { system.assert(e.getmessage().contains('price must be non-negative'), 'price was negative but was not caught'); } try{ insert item2; } catch(exception e) { system.assert(e.getmessage().contains('weight must be non-negative'), '" "weight was negative but was not caught'); } try{ insert item3; } catch(exception e) { system.assert(e.getmessage().contains('quantity must be positive'), 3611apex reference guide reserved keywords 'quantity was negative but was not caught'); } try{ insert item4; } catch(exception e) { system.assert(e.getmessage().contains('quantity must be positive'), 'quantity was zero but was not caught'); } } } reserved keywords the following words can only be used as keywords. table 3: reserved keywords abstract false package activate final parallel and finally pragma any float private array for protected as from public asc global retrieve autonomous goto return begin group rollback bigdecimal having select blob hint set boolean if short break implements sobject bulk import sort by in static byte inner string case insert super cast instanceof switch catch int synchronized char integer system class interface testmethod collect into then commit join this 3612apex reference guide documentation typographical conventions const like throw continue limit time currency list transaction date long trigger datetime loop true decimal map try default merge undelete delete new update desc not upsert do null using double nulls virtual else number void end object webservice enum of when exception on where exit or while export outer extends override the following are special types of keywords that aren't reserved words and can be used as identifiers. • after • before • count • excludes • first • includes • last • order • sharing • with documentation typographical conventions apex and visualforce documentation uses the following typographical conventions. 3613apex reference guide glossary convention description courier font in descriptions of syntax, monospace font indicates items that you should type as shown, except for brackets. for example: public class helloworld italics in descriptions of syntax, italics represent variables. you supply the actual value. in the following example, three values need to be supplied: datatype variable_name [ = value]; if the syntax is bold and italic, the text represents a code element that needs a value supplied by you, such as a class name or variable value: public static class yourclasshere { ... } bold courier font in code samples and syntax descriptions, bold courier font emphasizes a portion of the code or syntax. < > in descriptions of syntax, less-than and greater-than symbols (< >) are typed exactly as shown. { } in descriptions of syntax, braces ({ }) are typed exactly as shown. hello {!$user.firstname}! [ ] in descriptions of syntax, anything included in brackets is optional. in the following example, specifying value is optional: data_type variable_name [ = value]; | in descriptions of syntax, the pipe sign means “or”. you can do one of the following (not all). in the following example, you can create a new unpopulated set in one of two ways, or you can populate the set: set set_name [= new set();] | [= new set. visualforce includes a number of standard components, or you can create your own custom components. component reference, visualforce a description of the standard and custom visualforce components that are available in your organization. you can access the component library from the development footer of any visualforce page or the visualforce developer's guide. 3616apex reference guide glossary composite app an app that combines native platform functionality with one or more external web services, such as yahoo! maps. composite apps allow for more flexibility and integration with other services, but can require running and managing external code. see also client app and native app. controller, visualforce an apex class that provides a visualforce page with the data and business logic it must run. visualforce pages can use the standard controllers that come by default with every standard or custom object, or they can use custom controllers. controller extension a controller extension is an apex class that extends the functionality of a standard or custom controller. cookie client-specific data used by some web applications to store user and session-specific information. salesforce issues a session “cookie” only to record encrypted authentication information for the duration of a specific session. custom app see app. custom controller a custom controller is an apex class that implements all of the logic for a page without using a standard controller. use custom controllers when you want your visualforce page to run entirely in system mode, which doesn’t enforce the permissions and field-level security of the current user. custom field a field that can be added in addition to the standard fields to customize salesforce for your organization's needs. custom links custom links are urls defined by administrators to integrate your salesforce data with external websites and back-office systems. formerly known as web links. custom object custom records that allow you to store information unique to your organization. custom settings custom settings are similar to custom objects and enable application developers to create custom sets of data, as well as create and associate custom data for an organization, profile, or specific user. all custom settings data is exposed in the application cache, which enables efficient access without the cost of repeated queries to the database. this data can then be used by formula fields, validation rules, flows, apex, and soap api. see also hierarchy custom settings and list custom settings. d database an organized collection of information. the underlying architecture of the lightning platform includes a database where your data is stored. database table a list of information, presented with rows and columns, about the person, thing, or concept you want to track. see also object. data loader a lightning 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. 3617apex reference guide glossary data state the structure of data in an object at a particular point in time. date literal a keyword in a soql or sosl query that represents a relative range of time such as last month or next year. decimal places parameter for number, currency, and percent custom fields that indicates the total number of digits you can enter to the right of a decimal point, for example, 4.98 for an entry of 2. the system rounds the decimal numbers you enter, if necessary. for example, if you enter 4.986 in a field with decimal places of 2, the number rounds to 4.99. salesforce uses the round half-up rounding algorithm. half-way values are always rounded up. for example, 1.45 is rounded to 1.5. –1.45 is rounded to –1.5. dependency a relationship where one object's existence depends on that of another. there are a number of different kinds of dependencies including mandatory fields, dependent objects (parent-child), file inclusion (referenced images, for example), and ordering dependencies (when one object must be deployed before another object). dependent field any custom picklist or multi-select picklist field that displays available values based on the value selected in its" "corresponding controlling field. deploy to move functionality from an inactive state to active. for example, when developing new features in the salesforce user interface, you must select the “deployed” option to make the functionality visible to other users. the process by which an application or other functionality is moved from development to production. to move metadata components from a local file system to a salesforce organization. for installed apps, deployment makes any custom objects in the app available to users in your organization. before a custom object is deployed, it’s only available to administrators and any users with the “customize application” permission. deprecated component developers can refine the functionality in a managed package over time as the requirements evolve, such as redesign some of the components in the managed package.developers can’t delete some components in a managed - released package, but they can deprecate a component in a later package version so that new subscribers don’t receive the component, while the component continues to function for existing subscribers and api integrations. detail a page that displays information about a single object record. the detail page of a record allows you to view the information, whereas the edit page allows you to modify it. a term used in reports to distinguish between summary information and inclusion of all column data for all information in a report. you can toggle the show details/hide details button to view and hide report detail information. developer edition a free, fully functional salesforce organization designed for developers to extend, integrate, and develop with the lightning platform. developer edition accounts are available on developer.salesforce.com. salesforce developers the salesforce developers website at developer.salesforce.com provides a full range of resources for platform developers, including sample code, toolkits, an online developer community, and the ability to obtain limited lightning platform environments. development environment a salesforce organization where you can make configuration changes that don’t affect users on the production organization. there are two kinds of development environments, sandboxes and developer edition organizations. 3618apex reference guide glossary e email alert email alerts are actions that send emails, using a specified email template, to specified recipients. email template a form email that communicates a standard message, such as a welcome letter to new employees or an acknowledgment that a customer service request has been received. email templates can be personalized with merge fields, and can be written in text, html, or custom format. note: lightning email templates aren’t packageable. enterprise edition a salesforce edition designed for larger, more complex businesses. enterprise wsdl a strongly typed wsdl for customers who want to build an integration with their salesforce organization only, or for partners who are using tools like tibco or webmethods to build integrations that require strong typecasting. the downside of the enterprise wsdl is that it only works with the schema of a single salesforce organization because it’s bound to all of the unique objects and fields that exist in that organization's data model. entity relationship diagram (erd) a data modeling tool that helps you organize your data into entities (or objects, as they’re called in the lightning platform) and define the relationships between them. erds for key salesforce objects are published in the salesforce object reference. enumeration field an enumeration is the wsdl equivalent of a picklist field. the valid values of the field are restricted to a strict set of possible values, all having the same data type. f facet a child of another visualforce component that allows you to override an area of the rendered parent with the contents of the facet. field a part of an object that holds a specific piece of information, such as a text or currency value. field dependency a filter that allows you to change the contents of a picklist based on the value of another field. field-level security settings that determine whether fields are hidden, visible, read only, or editable for users. available in professional, enterprise, unlimited, performance, and developer editions. foreign key a field whose value is the same as the primary key of another table. you can think of a foreign key as a copy of a primary key from another table. a 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. g getter methods methods that enable developers to display database and other computed values in page markup. methods that return values. see also setter methods. 3619apex reference guide glossary global variable a special merge field that you can use to reference" "data in your organization. a method access modifier for any method that must be referenced outside of the application, either in soap api or by other apex code. governor limits apex execution limits that prevent developers who write inefficient code from monopolizing the resources of other salesforce users. gregorian year a calendar based on a 12-month structure used throughout much of the world. h hierarchy custom settings a type of custom setting that uses a built-in hierarchical logic that lets you “personalize” settings for specific profiles or users. the hierarchy logic checks the organization, profile, and user settings for the current user and returns the most specific, or “lowest,” value. in the hierarchy, settings for an organization are overridden by profile settings, which, in turn, are overridden by user settings. 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. ideaexchange salesforce’s always-on feedback platform that connects the trailblazer community with salesforce product managers. it’s the go-to place to post ideas and contribute feedback about how to improve products and experiences. visit ideaexchange at ideas.salesforce.com. import wizard a tool for importing data into your salesforce organization, accessible from setup. instance the cluster of software and hardware represented as a single logical server that hosts an organization's data and runs their applications. the lightning platform runs on multiple instances, but data for any single organization is always stored on a single instance. integrated development environment (ide) a software application that provides comprehensive facilities for software developers including a source code editor, testing and debugging tools, and integration with source code control systems. integration user a salesforce user defined solely for client apps or integrations. also referred to as the logged-in user in a soap api context. iso code the international organization for standardization country code, which represents each country by two letters. 3620apex reference guide glossary 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 create 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. l length parameter for custom text fields that specifies the maximum number of characters (up to 255) that a user can enter in the field. parameter for number, currency, and percent fields that specifies the number of digits you can enter to the left of the decimal point, for example, 123.98 for an entry of 3. lightning platform the salesforce platform for building applications in the cloud. lightning platform combines a powerful user interface, operating system, and database to allow you to customize and deploy applications in the cloud for your entire enterprise. list custom settings a type of custom setting that provides a reusable set of static data that can be accessed across your organization. if you use a particular set of data frequently within your application, putting that data in a list custom setting streamlines access to it. data in list settings doesn’t vary with profile or user, but is available organization-wide. examples of list data include two-letter state abbreviations, international dialing prefixes, and catalog numbers for products. because the data is cached, access is low-cost and efficient: you don't have to use soql queries that count against your governor limits. list view a list display of items (for example, accounts or contacts) based on specific criteria. salesforce provides some predefined views. in the agent console, the list view is the top frame that displays a list view of records based on specific criteria. the list views you can select to display in the console are the same list views defined on the tabs of other objects. you can’t create a list view within the console. local name the value stored for the field in the user's or account's language. the local name for a field is associated with the standard name for that field. locale the country or geographic region in which the user is located. the setting affects the format of date and number fields, for example, dates in the english (united states) locale display as 06/30/2000 and as 30/06/2000 in the english (united kingdom) locale. in professional, enterprise, unlimited, performance, and developer edition" "organizations, a user's individual locale setting overrides the organization's default locale setting. in personal and group editions, the organization-level locale field is called locale, not default locale. long text area data type of custom field that allows entry of up to 32,000 characters on separate lines. lookup relationship a relationship between two records so you can associate records with each other. for example, cases have a lookup relationship with assets that lets you associate a particular asset with a case. on one side of the relationship, a lookup field allows users to click a lookup icon and select another record from a window. on the associated record, you can then display a related list to show all of the records that have been linked to it. if a lookup field references a record that has been deleted, by default salesforce clears the lookup field. alternatively, you can prevent records from being deleted if they're in a lookup relationship. 3621apex reference guide glossary m managed package a collection of application components that is posted as a unit on appexchange and associated with a namespace and possibly a license management organization.to support upgrades, a package must be managed. an organization can create a single managed package that can be downloaded and installed by many different organizations. managed packages differ from unmanaged packages by having some locked components, allowing the managed package to be upgraded later. unmanaged packages don’t include locked components and can’t be upgraded. in addition, managed packages obfuscate certain components (like apex) on subscribing organizations to protect the intellectual property of the developer. manual sharing record-level access rules that allow record owners to give read and edit permissions to other users who don’t have access to the record any other way. many-to-many relationship a relationship where each side of the relationship can have many children on the other side. many-to-many relationships are implemented through the use of junction objects. master-detail relationship a relationship between two different types of records that associates the records with each other. for example, accounts have a master-detail relationship with opportunities. this type of relationship affects record deletion, security, and makes the lookup relationship field required on the page layout. metadata information about the structure, appearance, and functionality of an organization and any of its parts. lightning platform uses xml to describe metadata. metadata-driven development an app development model that allows apps to be defined as declarative “blueprints,” with no code required. apps built on the platform—their data models, objects, forms, workflows, and more—are defined by metadata. metadata wsdl a wsdl for users who want to use the lightning platform metadata api calls. multitenancy an application model where all users and apps share a single, common infrastructure and code base. mvc (model-view-controller) a design paradigm that deconstructs applications into components that represent data (the model), ways of displaying that data in a user interface (the view), and ways of manipulating that data with business logic (the controller). n namespace in a packaging context, a one- to 15-character alphanumeric identifier that distinguishes your package and its contents from packages of other developers on appexchange, similar to a domain name. salesforce automatically prepends your namespace prefix, followed by two underscores (“__”), to all unique component names in your salesforce organization. native app an app that is built exclusively with setup (metadata) configuration on lightning platform. native apps don’t require any external services or infrastructure. 3622apex reference guide glossary o object an object allows you to store information in your salesforce organization. the object is the overall definition of the type of information you’re storing. for example, the case object lets you store information regarding customer inquiries. for each object, your organization has multiple records that store the information about specific instances of that type of data. for example, you can have a case record to store the information about joe smith's training inquiry and another case record to store the information about mary johnson's configuration issue. object-level help custom help text that you can provide for any custom object. it displays on custom object record home (overview), detail, and edit pages, as well as list views and related lists. object-level security settings that allow an administrator to hide whole objects from users so that they don't know that type of data exists. object-level security is specified with object permissions. one-to-many relationship a relationship in which a single object is related to many other objects. for example, an" "account can have one or more related contacts. organization a deployment of salesforce with a defined set of licensed users. an organization is the virtual space provided to an individual customer of salesforce. your organization includes all of your data and applications, and is separate from all other organizations. organization-wide defaults settings that allow you to specify the baseline level of data access that a user has in your organization. for example, you can set organization-wide defaults so that any user can see any record of a particular object that is enabled via their object permissions, but they need extra permissions to edit one. outbound call any call that originates from a user to a number outside of a call center in salesforce crm call center. outbound message an outbound message sends information to a designated endpoint, like an external service. outbound messages are configured from setup. you must configure the external endpoint and create a listener for the messages using soap api. owner individual user to which a record (for example, a contact or case) is assigned. p paas see platform as a service. package a group of lightning platform components and applications that are made available to other organizations through appexchange. you use packages to bundle an app along with any related components so that you can upload them to appexchange together. package dependency this dependency is created when one component references another component, permission, or preference that is required for the component to be valid. components can include but aren’t limited to: • standard or custom fields • standard or custom objects • visualforce pages 3623apex reference guide glossary • apex code permissions and preferences can include but aren’t limited to: • divisions • multicurrency • record types package installation installation incorporates the contents of a package into your salesforce organization. a package on appexchange can include an app, a component, or a combination of the two. after you install a package, you can deploy components in the package to make it generally available to the users in your organization. package version a package version is a number that identifies the set of components uploaded in a package. the version number has the format majornumber.minornumber.patchnumber (for example, 2.1.3). the major and minor numbers increase to a chosen value during every major release. the patchnumber is generated and updated only for a patch release. unmanaged packages aren’t upgradeable, so each package version is simply a set of components for distribution. a package version has more significance for managed packages. packages can exhibit different behavior for different versions.publishers can use package versions to evolve the components in their managed packages gracefully by releasing subsequent package versions without breaking existing customer integrations using the package.see also patch and patch development organization. partner wsdl a loosely typed wsdl for customers, partners, and isvs who want to build an integration or an appexchange app that can work across multiple salesforce organizations. with this wsdl, the developer is responsible for marshaling data in the correct object representation, which typically involves editing the xml. however, the developer is also freed from being dependent on any particular data model or salesforce organization. contrast to the enterprise wsdl, which is strongly typed. patch a patch enables a developer to change the functionality of existing components in a managed package, while ensuring subscribing organizations that there are no visible behavior changes to the package.for example, you can add new variables or change the body of an apex class, but you can’t add, deprecate, or remove any of its methods. patches are tracked by a patchnumber appended to every package version. see also patch development organization and package version. patch development organization the organization where patch versions are developed, maintained, and uploaded. patch development organizations are created automatically for a developer organization when they request to create a patch. see also patch and package version. personal edition product designed for individual sales representatives and single users. platform as a service (paas) an environment where developers use programming tools offered by a service provider to create applications and deploy them in a cloud. the application is hosted as a service and provided to customers via the internet. the paas vendor provides an api for creating and extending specialized applications. the paas vendor also takes responsibility for the daily maintenance, operation, and support of the deployed application and each customer's data. the service alleviates the need for programmers to install, configure, and maintain the applications on their own hardware, software, and related it resources. services can be delivered using the paas environment to any market segment" ". platform edition a salesforce edition based on enterprise, unlimited, or performance edition that doesn’t include any of the standard salesforce apps, such as sales or service & support. 3624apex reference guide glossary primary key a relational database concept. each table in a relational database has a field in which the data value uniquely identifies the record. this field 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. prototype the classes, methods, and variables that are available to other apex code. q query locator a parameter returned from the query() or querymore() api call that specifies the index of the last result record that was returned. query string parameter a name-value pair that's included in a url, typically after a '?' character. for example: https://yourinstance.salesforce.com/001/e?name=value r record a single instance of a salesforce object. for example, “john jones” can be the name of a contact record. record id the unique identifier for each record. record-level security a method of controlling data in which you can allow a particular user to view and edit an object, but then restrict the records that the user is allowed to see. record locking record locking prevents users from editing a record, regardless of field-level security or sharing settings. by default, salesforce locks records that are pending approval. only admins can edit locked records. record name a standard field on all salesforce objects. whenever a record name is displayed in a lightning platform 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 field. record name doesn’t have to be a unique value. recycle bin a page that lets you view and restore deleted information. access the recycle bin either by using the link in the sidebar in salesforce classic or from the app launcher in lightning experience. relationship a connection between two objects, used to create related lists in page layouts and detail levels in reports. matching values in a specified field in both objects are used to link related data; for example, if one object stores data about companies and another object stores data about people, a relationship allows you to find out which people work at the company. 3625apex reference guide glossary relationship query in a soql context, a query that traverses the relationships between objects to identify and return results. parent-to-child and child-to-parent syntax differs in soql queries. role hierarchy a record-level security setting that defines 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. roll-up summary field a field type that automatically provides aggregate values from child records in a master-detail relationship. running user each dashboard has a running user, whose security settings determine which data to display in a dashboard. if the running user is a specific user, all dashboard viewers see data based on the security settings of that user—regardless of their own personal security settings. for dynamic dashboards, you can set the running user to be the logged-in user, so that each user sees the dashboard according to their own access level. s saas see software as a service (saas). s-control note: s-controls have been superseded by visualforce pages. after march 2010 organizations that have never created s-controls, as well as new organizations, won't be allowed to create them. existing s-controls 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 file, or a custom html web form. salesforce certificate and key pair salesforce certificates and key pairs are used for signatures that verify a request is coming from your organization. they’re used for authenticated ssl communications with an external website, or when using your organization as an identity provider. you only must generate a salesforce certificate and key pair if you're working with an external website that wants verification that a request is coming from a salesforce organization. salesforce connect" "salesforce connect provides access to data that’s stored outside the salesforce org, such as data in an enterprise resource planning (erp) system and records in another org. salesforce connect represents the data in external objects and accesses the external data in real time via web service callouts to external data sources. salesforce extensions for visual studio code the salesforce extension pack for visual studio code includes tools for developing on the salesforce platform in the lightweight, extensible vs code editor. these tools provide features for working with development orgs (scratch orgs, sandboxes, and de orgs), apex, aura components, and visualforce. salesforce record id a unique 15-character or 18-character alphanumeric string that identifies a single record in salesforce. salesforce service oriented architecture a powerful capability of lightning platform that allows you to make calls to external web services from within apex. sandbox a nearly identical copy of a salesforce production organization for development, testing, and training. the content and size of a sandbox varies depending on the type of sandbox and the edition of the production organization associated with the sandbox. 3626apex reference guide glossary semi-join a semi-join is a subquery on another object in an in clause in a soql query. you can use semi-joins to create advanced queries, such as getting all contacts for accounts that have an opportunity with a particular record type. see also anti-join. session id an authentication token that is returned when a user successfully logs in to salesforce. the session id prevents a user from having to log in again every time they want to perform another action in salesforce. different from a record id or salesforce id, which are terms for the unique id of a salesforce record. session timeout the time after login before a user is automatically logged out. sessions expire automatically after a predetermined length of inactivity, which can be configured in salesforce from setup by clicking security controls. the default is 120 minutes (two hours). the inactivity timer is reset to zero if a user takes an action in the web interface or makes an api call. setter methods methods that assign values. see also getter methods. setup a menu where administrators can customize and define organization settings and lightning platform apps. depending on your organization's user interface settings, setup can be a link in the user interface header or in the dropdown list under your name. sharing allowing other users to view or edit information you own. there are different ways to share data: • sharing model—defines the default organization-wide access levels that users have to each other's information and whether to use the hierarchies when determining access to data. • role hierarchy—defines 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 rules—allow 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 sharing—allows individual users to share records with other users or groups. • apex-managed sharing—enables developers to programmatically manipulate sharing to support their application's behavior. see apex-managed sharing. sharing model behavior defined by your administrator that determines default access by users to different types of records. sharing rule type of default sharing created by administrators. allows users in a specified group or role to have access to all information created by users within a given group or role. sites salesforce sites enables you to create public websites and applications that are directly integrated with your salesforce organization—without requiring users to log in with a username and password. soap (simple object access protocol) a protocol that defines a uniform way of passing xml-encoded data. soap api a soap-based web services application programming interface that provides access to your salesforce organization's information. sobject the abstract or parent object for all objects that can be stored in the lightning platform. software as a service (saas) a delivery model where a software application is hosted as a service and provided to customers via the internet. the saas vendor takes responsibility for the daily maintenance, operation, and support of the application and each customer's data. the service 3627apex reference guide glossary alleviates the need for customers to install, configure, and maintain applications with their own hardware, software, and related it resources. services can be delivered using the saas model to any market segment. soql (salesforce object query language) a query language that allows you to construct simple" "but powerful query strings and to specify the criteria that selects data from the lightning platform database. sosl (salesforce object search language) a query language that allows you to perform text-based searches using the lightning platform api. standard object a built-in object included with the lightning platform. you can also build custom objects to store information that is unique to your app. system log part of the developer console, a separate window console that can be used for debugging code snippets. enter the code you want to test at the bottom of the window and click execute. the body of the system log displays system resource information, such as how long a line took to execute or how many database calls were made. if the code didn’t run to completion, the console also displays debugging information. t tag in salesforce, a word or short phrases that users can associate with most records to describe and organize their data in a personalized way. administrators can enable tags for accounts, activities, assets, campaigns, cases, contacts, contracts, dashboards, documents, events, leads, notes, opportunities, reports, solutions, tasks, and any custom objects (except relationship group members) tags can also be accessed through soap api. test case coverage test cases are the expected real-world scenarios in which your code is used. test cases aren’t actual unit tests, but are documents that specify what your unit tests do. high test case coverage means that most or all the real-world scenarios you have identified are implemented as unit tests. see also code coverage and unit test. test method an apex class method that verifies whether a particular piece of code is working properly. test methods take no arguments, commit no data to the database, and can be executed by the runtests() system method either through the command line or in an apex ide, such as the salesforce extensions for visual studio code. test organization see sandbox. transaction, apex an apex transaction represents a set of operations that are executed as a single unit. all dml operations in a transaction either complete successfully, or if an error occurs in one operation, the entire transaction is rolled back and no data is committed to the database. the boundary of a transaction can be a trigger, a class method, an anonymous block of code, a visualforce page, or a custom web service method. trigger a piece of apex that executes before or after records of a particular type are inserted, updated, or deleted from the database. every trigger runs with a set of context variables that provide access to the records that caused the trigger to fire, and all triggers run in bulk mode—that is, they process several records at once, rather than just one record at a time. trigger context variable default variables that provide access to information about the trigger and the records that caused it to fire. 3628apex reference guide glossary u unit test a unit is the smallest testable part of an application, usually a method. a unit test operates on that piece of code to make sure it works correctly. see also test method. unlimited edition unlimited edition is salesforce’s solution for maximizing your success and extending that success across the entire enterprise through the lightning platform. unmanaged package a package that can’t be upgraded or controlled by its developer. url (uniform resource locator) the global address of a website, document, or other resource on the internet. for example, https://salesforce.com. user acceptance testing (uat) a process used to confirm that the functionality meets the planned requirements. uat is one of the final stages before deployment to production. v validation rule a rule that prevents a record from being saved if it doesn’t meet the standards that are specified. version a number value that indicates the release of an item. items that can have a version include api objects, fields, and calls; apex classes and triggers; and visualforce pages and components. view the user interface in the model-view-controller model, defined by visualforce. view state where the information necessary to maintain the state of the database between requests is saved. visualforce a simple, tag-based markup language that allows developers to easily define custom pages and components for apps built on the platform. each tag corresponds to a coarse or fine-grained component, such as a section of a page, a related list, or a field. the components can either be controlled by the same logic that is used in standard salesforce pages, or developers can associate their own logic with a controller written in apex. visualforce controller see controller, visualforce. visualforce lifecycle the stages of execution" "of a visualforce page, including how the page is created and destroyed during a user session. visualforce page a web page created using visualforce. typically, visualforce pages present information relevant to your organization, but they can also modify or capture data. they can be rendered in several ways, such as a pdf document or an email attachment, and can be associated with a css style. w web service a mechanism by which two applications can easily exchange data over the internet, even if they run on different platforms, are written in different languages, or are geographically remote from each other. 3629apex reference guide glossary webservice method an apex class method or variable that external systems can use, like a mash-up with a third-party application. web service methods must be defined in a global class. web services api term describing the original salesforce platform web services application programming interface (api) that provides access to your salesforce org's information. see relevant developer guides for soap, rest, or bulk apis of interest. automated actions automated actions, such as email alerts, tasks, field updates, and outbound messages, can be triggered by a process, workflow rule, approval process, or milestone. wrapper class a class that abstracts common functions such as logging in, managing sessions, and querying and batching records. a wrapper class makes an integration more straightforward to develop and maintain, keeps program logic in one place, and affords easy reuse across components. examples of wrapper classes in salesforce include the ajax toolkit, which is a javascript wrapper around the salesforce soap api, wrapper classes such as ccritical section in the cti adapter for salesforce crm call center, or wrapper classes created as part of a client integration application that accesses salesforce using soap api. wsdl (web services description language) file an xml file that describes the format of messages you send and receive from a web service. your development environment's soap client uses the salesforce enterprise wsdl or partner wsdl to communicate with salesforce using soap api. x xml (extensible markup language) a markup language that enables the sharing and transportation of structured data. all lightning platform components that are retrieved or deployed through the metadata api are represented by xml definitions. y no glossary items for this entry. z no glossary items for this entry. 3630"