개발-IT/Salesforce

Salesforce 개발일지.

바다로그 2021. 3. 4. 21:30

현재 개발된 사이트가 salesforce classic knowledge base기초로 작업되어 있다.   salesforce lightning 으로 변경 작업을 진행중이다.  salesforce lightning 변경되면서 여러가지 변경사항을 적용해야 됬다. 

 

SOQL query 

SELECT  Id,
        KnowledgeArticleId,
        ArticleNumber,
        Title,
        FAQ_Subscribers_Answer__c, 
        Language, 
        IsVisibleInApp,
        LastPublishedDate,
        LastModifiedDate,
        PublishStatus,
        RecordTypeId
FROM Knowledge__kav 
WHERE Language='en_US'
AND RecordTypeId IN ('0129E000000gMxpQAE') LIMIT 1

output 

[0] => Array
        (
            [totalSize] => 5
            [done] => 1
            [records] => Array
                (
                    [0] => Array
                        (
                            [attributes] => Array
                                (
                                    [type] => Knowledge__kav
                                    [url] => /services/data/v50.0/sobjects/Knowledge__kav/ka99E00000000k4QAA
                                )

                            [Id] => ka99E00000000k4QAA
                            [KnowledgeArticleId] => kA99E00000000fBSAQ
                            [ArticleNumber] => 000003252
                  {생략}


        

 

   

  • Ref URL:/services/data/vXX.X/sobjects/sObject/id/richTextImageFields/fieldName/contentReferenceId
    • sObjectName: Indicates the name of the standard object of the record.
    • id: The ID of the object.
    • fieldName: The name of the rich text area field.
    • contentReferenceId: The reference ID that uniquely identifies an image within a rich text area field. You can obtain the reference by retrieving information for the object. The description will show the contents of the rich text area field.
  • Sample URL
    /services/data/v50.0/sobjects/Knowledge__kav/ka99E00000000lRQAQ/richTextImageFields/FAQ_Subscribers_Answer__c/0EM2p000001SHHM 
    • sObjectName: Knowledge__kav
    • id: ka99E00000000lRQAQ
    • fieldName: FAQ_Subscribers_Answer__cv
    • contentReferenceId: 0EM2p000001SHHI
 <img src="https://xxx.documentforce.com/servlet/rtaImage?eid=ka99E00000000lR&amp;feoid=00N9E000005g2pd&amp;refid=0EM2p000001SHHI" alt="kA0600000008j7OCAQ_en_US_1_1">

  

이미지 다운로드 순서 
1. SOQL 실행 후 결과 값중  [url] => /services/data/v50.0/sobjects/Knowledge__kav/ka99E00000000k4QAA 뽑는다

2.  reach text 필드인 FAQ_Subscribers_Answer__c에서  이미지 URL에서 refid=0EM2p000001SHHI값을 뽑아와서 

3. 아래와 같이 생성
/services/data/v50.0/sobjects/Knowledge__kav/ka99E00000000lRQAQ/richTextImageFields/FAQ_Subscribers_Answer__c/0EM2p000001SHHM

  

 


find record type id. 
SELECT Title,Product_FAQ_Category__c,PublishStatus,RecordTypeId FROM Knowledge__kav
where articlenumber='000003531'

find record type name. 
SELECT DeveloperName,Id,IsActive,IsPersonType,LastModifiedById FROM RecordType
Where id='0127Y000001uhdhQAA'

 API version

'/services/data/v50.0/';   get all articles
'/services/data/v46.0/';    get only one article 

 

도구
API 작업은 workbench를 사용해왔다. 이번 개발에는 postman을 사용하는것으로.   잠깐 사용해봤는대  편하다. 

 

 

'개발-IT > Salesforce' 카테고리의 다른 글

No such column of Knowledge__kav even if exiting it.  (0) 2021.06.18