a!sfcUpdate() Function

Updates data for an existing business object in Salesforce. For more information on what objects can be updated, the required permissions, and which fields can be updated, refer to the Salesforce API documentation for the update operation.

Syntax

a!sfcUpdate( scsExternalSystemKey, usePerUserCredentials, endpoint, parameters)

Common Parameters:

scsExternalSystemKey: (Text) The key from the Third Party Credentials admin console page that corresponds to the set of credentials that should be used to authenticate.

usePerUserCredentials: (Boolean) If true the credentials set in the Third-Party Credentials settings page by the current user running the expression will be used. If false the site-wide credential values will be used.

endpoint: (Text) The Salesforce endpoint URL to use for authentication. Possible values are "https://login.salesforce.com/services/Soap/u/27.0", which is used for production and development environments, and "https://test.salesforce.com/services/Soap/u/27.0", which is used for the Salesforce "sandbox" test environment. Update the 27.0 portion of the endpoint URL to match the version of the API that you are accessing. As a best practice, create a constant for this value.

Specific Parameters:

parameters: (Any Type) The data to update, given as a dictionary with the same field structure as the sObject to update.

Returns

Writer

This function returns a writer and must be used with the bind() function.

See also:

Examples

Update Account Information

Copy and paste the expression into the INTERFACE DEFINITION in EXPRESSION MODE, save it, then call the interface in a Tempo Report to test.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
=load(
  local!accountId,
  local!updatedAccountName,
  local!updatedAccountUrl,
  local!account: bind(
    a!sfcQuery(
      scsExternalSystemKey: cons!SALESFORCE_SCS_KEY,
      usePerUserCredentials: true,
      endpoint: cons!SALESFORCE_ENDPOINT,
      query: "SELECT Name, Website FROM Account Where Id='"& local!accountId & "'"
    ),
    a!sfcUpdate(
      scsExternalSystemKey: cons!SALESFORCE_SCS_KEY,
      usePerUserCredentials: true,
      endpoint: cons!SALESFORCE_ENDPOINT,
      parameters: _
    )
  ),
  with(
    local!accountName: if(local!account.success, index(local!account.result.result.Account, "Name", null), null),
    local!accountUrl:  if(local!account.success, index(local!account.result.result.Account, "Website", null), null),
    {
        a!textField(
          label: "Account ID",
          instructions: "Enter an ID to retrieve account info, then update the info",
          value: local!accountId,
          saveInto: { 
            local!accountId,
            a!save(local!updatedAccountName, null),
            a!save(local!updatedAccountUrl, null)
          }
        ),
        if(
          local!account.success,
          {
            if(
              isnull(local!account.result.result),
              {},
              {
                a!textField(
                  label: "Account Name",
                  value: if(
                    isnull(local!updatedAccountName),
                    local!accountName,
                    local!updatedAccountName
                  ),
                  saveInto: local!updatedAccountName
                ),
                a!textField(
                  label: "Account Website",
                  value: if(
                    isnull(local!updatedAccountUrl),
                    local!accountUrl,
                    local!updatedAccountUrl
                  ),
                  saveInto: local!updatedAccountUrl
                ),
                a!buttonArrayLayout(
                  buttons: {
                    a!buttonWidget(
                      label: "Update",
                      value: {
                        Account: {
                          {
                            Id: local!accountId, 
                            Name: local!updatedAccountName, 
                            Website: local!updatedAccountUrl
                          }
                        }
                      },
                      saveInto: local!account
                    )
                  }
                )
              }
            )
          },
          a!textField(
            label: "An error occurred",
            readOnly:true,
            value: local!account.error.message
          )
        )
    }
  )
)
FEEDBACK