簡體   English   中英

Apex觸發器根據與聯系人的相關聯系來更新任務對象上與公司相關的字段的值(如果僅為空)

[英]Apex Trigger to update the value of Related to company field ( if it is null only) on the task object based on the related to contact

在提交記錄之前,我需要根據“相關於:聯系人”字段值在任務對象上編寫一個觸發器來預填充“相關:公司”字段的值(如果僅為空)。 請幫助我如何實現這一目標。

謝謝,Shweta

在Task上觸發TaskTrigger(更新后){for(Task newTask:Trigger.New){// Task.WhoId!= null ----檢查Contact是否為null // //((string)Task.WhoId).startsWith( '003') ----檢查任務是否與聯系人 // Task.WhatId == null ----檢查相關字段是否為null if(Task.WhoId!= null &&((string)Task。 WhoId).startsWith('003')&& Task.WhatId == null){ //根據需要添加代碼。 }}}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM