Skip to content

Instantly share code, notes, and snippets.

@A-pZ
Created August 7, 2023 02:51
Show Gist options
  • Save A-pZ/1038dcda9ee6a2dae96761cea129b54a to your computer and use it in GitHub Desktop.
Save A-pZ/1038dcda9ee6a2dae96761cea129b54a to your computer and use it in GitHub Desktop.
取引先の削除処理
public void delete(String objectId, AuthenticationResult authenticationResult) {
salesforceWebClient.delete() // 削除はDELETE
.uri( salesforceProperties.getApplicationPath()+ "/sobjects/Account/" + objectId) // 更新同様、削除するオブジェクトIDを指定
.header("Authorization", authenticationResult.bearerToken())
.retrieve()
.bodyToMono(Company.class)
.block();
}
package com.github.apz.salesforcesample.repository
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.test.context.SpringBootTest
import spock.lang.Specification
@SpringBootTest
class SalesforceDeleteTest extends Specification {
@Autowired
SalesforceAuthentication authentication
@Autowired
CompanyRepository repository
def "削除"() {
when:
def authenticationResult = authentication.authentication()
repository.delete("0010l00001dKU2XAAW", authenticationResult)
then:
noExceptionThrown()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment