您位於此處:
將 Apex 觸發更新為畫面重新認證應用程式
更新當建立「福利」種類的個別應用程式記錄時執行的 Apex 觸發。設定觸發以在重新認證應用程式通過篩選且處於檢閱中時發佈 BMRecertEvent。BMRecertEvent 的事件處理常式會更新與應用程式相關之福利指派的重新認證狀態。
必要版本
| 檢視支援的產品版本。 |
| 需要的使用者權限 | |
|---|---|
| 若要更新 Apex 觸發: | Author Apex |
- 進入「設定」,在「物件管理員」中選取「個人申請」。
- 按一下「觸發」。
-
針對 ProcessIAForBenefitAssistance,按一下
,然後選取「編輯」。
-
在文字方塊中貼上此程式碼。使用您組織中所安裝 Omnistudio 封裝的命名空間字首取代 Omnistudio-Namespace-Prefix。
在「設定」的「已安裝的封裝」頁面上尋找 Omnistudio 封裝的命名空間字首。
trigger ProcessIAForBenefitAssistance on IndividualApplication (after update) { String procedureNameForNewIA = 'BenefitManagement_ProcessIndividualApplication'; Map <String, Object> ipInput = new Map <String, Object> (); Map <String, Object> ipOutput = new Map <String, Object> (); Map <String, Object> ipOptions = new Map <String, Object> (); // List to hold the Platform Events to be published List<BMRecertEvent__e> eventsToPublish = new List<BMRecertEvent__e>(); // Iterate through the inserted or updated records for (IndividualApplication ia : Trigger.new) { if(ia.Status == 'Submitted' && ia.Category == 'Benefit') { String recordId = ia.Id; ipInput.put('RecordId', recordId); /* Call the IP via runIntegrationService, and save the output to ipOutput */ ipOutput = (Map <String, Object>) Omnistudio-Namespace-Prefix.IntegrationProcedureService.runIntegrationService(procedureNameForNewIA, ipInput, ipOptions); System.debug('IP Output: ' + ipOutput); IndividualApplication iaRecord = [SELECT Id, Status, ApplicationType, Category FROM IndividualApplication WHERE Id = :ia.Id]; if(iaRecord.Status != 'Denied' && iaRecord.ApplicationType == 'Recertification'){ BMRecertEvent__e event = new BMRecertEvent__e(); // Set fields on the Platform Event based on the inserted or updated record event.RecordId__c = iaRecord.Id; // Add the Platform Event to the list of events to be published eventsToPublish.add(event); } } } // Publish the list of Platform Events if (!eventsToPublish.isEmpty()) { EventBus.publish(eventsToPublish); } } - 請儲存您的變更。
此文章是否解決您的問題?
請讓我們知道,以便我們改進!

