Skip to content

Instantly share code, notes, and snippets.

@A-pZ
Created August 7, 2023 04:21
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save A-pZ/865401d5a9cae37bfdba665e146fe90d to your computer and use it in GitHub Desktop.
Save A-pZ/865401d5a9cae37bfdba665e146fe90d to your computer and use it in GitHub Desktop.
登録した取引先を検索する
public Company find(String objectId, AuthenticationResult authenticationResult) {
Company result = salesforceWebClient.get()
.uri( salesforceProperties.getApplicationPath()+ "/sobjects/Account/" + objectId) // 作成した取引先のオブジェクトid
.header("Authorization", authenticationResult.bearerToken())
.retrieve()
.bodyToMono(Company.class)
.block();
log.info("result :{}", result);
return result;
}
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 SalesforceSearchTest extends Specification {
@Autowired
SalesforceAuthentication authentication
@Autowired
CompanyRepository repository
def "取引先検索"() {
when:
def authenticationResult = authentication.authentication();
def result = repository.find("0010l00001dKTpjAAG", authenticationResult)
then:
noExceptionThrown()
result
result.getName() == 'テストコードから登録した会社'
}
}
INFO 14256 --- [ Test worker] c.g.a.s.repository.CompanyRepository :
result :Company(
name=テストコードから登録した会社,
id=0010l00001dKUmEAAW,
recordTypeId=0120o000001TahMAAS
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment