發表文章

目前顯示的是有「flow」標籤的文章

如何在 list view 一次刪除多筆 record / How to mass delete records from list view

圖片
要如何在 list view 選擇多筆 record 後一鍵刪除呢? 這個功能在 Salesforce 目前沒有內建。 你可以選擇下列幾種方式 安裝 APP 用 flow 來做 用 apex class 來做 安裝 App 有一個由 Salesforce Labs 釋出的 app ,名字很直白就叫做 Mass Delete 官方說明文字 A set of custom list buttons that you can add to your standard list views or related lists. Users can select any number of records and delete all of them with a single click. 優點 快速簡單,即裝即用。 缺點 僅支援下列幾個現成的 standard object,如果需要用在 custom object,需要進行一點客製修改。 支援 object:  Product Solution Contact Contract Lead Opportunity Account Asset Campaign Case 使用在 custom object 的修改教學參考: https://blog.cloudanalogy.com/salesforce-lightning-how-to-mass-delete-records-from-list-view/ 概念上來說就只要 clone 它的 Visualforce Page 然後改第一行的 controller 即可。 用 Flow 來做 教學影片: https://youtu.be/3cdj8QCtYvI 用 Apex Class 來做 https://muskanagarwal1499.blogspot.com/2022/06/mass-delete-records-using-list-button.html

創建了一筆 record 從無到有,其上的 field 到底算不算"Is Changed"呢? 論"Is Changed"的具體定義

創建了一筆 record 從無到有,其上的 field 到底算不算"Is Changed"呢? 直接講結論:不算。 Is Changed 的具體定義 技術上來說, IsChanged 指的是 PRIORVALUE 和 current value 不一樣時,才叫做 IsChanged。 因為新創建的 record 根本沒有 PRIORVALUE,無從比對 PRIORVALUE 和 current value 是否不一致,所以不能算是 IsChanged。 根據官方文件: The Is Changed operator is available for flows that are triggered when a record is updated .  The Is Changed operator isn’t available for flows that are triggered when a record is created or deleted.  參考資料 IsChanged Flow Entry Criteria when record is created Use Is Changed in Condition Logic for Start Elements and Decision Elements

用 Workflow/Flow/After Trigger 繞過 Custom Validation 的限制

根據此篇所言  Triggers and Order of Execution 11. Executes workflow rules. If there are workflow field updates: a. Updates the record again. b. Runs system validations again. Custom validation rules, flows, duplicate rules, processes, and escalation rules are not run again. c. Executes   before  update   triggers and   after  update   triggers, regardless of the record operation (insert or update), one more time (and only one more time) 意即在 Custom Validation 做完檢查後,work flow/flow/After trigger才會作動。而且 Custom Validation 不會對這些後發的動作再次檢查。 換句話說如果發現某個 field 的值突破了現行 validation rule的限制,可能是因為 在 validation rule 實施前,這個 value 就已經存在了 這個值是來自某個自動化流程,例如 workflow field update record-triggered flows that are configured to run before the record is saved. After trigger

Salesforce 之 Knowledge Object 之 mass update published article

  最近為了一項關於 Knowledge 的任務感到傷腦筋,是關於要一次更新數萬篇 article 的任務。 背景說明 Salesforce 裡面的 Knowledge ,是一個特別的模組。有著特別的功能……以及一些特別的限制。隨便講幾個出來,背後可能都藏了無數人踩過的坑。(詳細內容可見文末之參考資料) 光看他的 object API name,既不像一般 custom object 一樣有著「__c」的後綴,也不像 standard object 一樣的乾淨俐落毫無後綴。而是帶著一個「__kav」的後綴。光這一點就獨步於全 org 了。 而此次我要做的 patch 任務,如果以其它 object 的概念來說,就是一次 update 數萬筆 record 而已。不管是要用 data loader,或是用 workbench,甚或是寫一支 Apex Code 去跑個 update,都不是什麼困難的事。 但對於 Knowledge 來說,可說是無比的麻煩。 因為已經 publish 的 article 是不容編輯的。 When an article is published, the PublishStatus field on the KnowledgeArticleVersion object is changed from “Draft” to Online. If an attempt is made to update a published article via API, a message will be received indicating that only Draft articles can be updated. (  https://help.salesforce.com/s/articleView?id=000333316&type=1  ) 若以手動更新 article 的方式來說,就是要做這些步驟 Edit the article as a draft。先把已經 publish 的 article 弄成 draft 的狀態。 Update the fields。把你要更新的值填入 article 上的欄位並 save。 Publish the artilce。把你新編輯好的 article publ...