function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Ken sfdc1Ken sfdc1 

Convert the workflow field update to trigger as the field is changed to text encrypted data type noy supporting in workflow

Can anyone help me to create a small trigger on Patient Profile object:

Condition Created and every time edited.
AND(ISPICKVAL($User.AEGR_User_Country__c,"Brazil"),
OR(ISPICKVAL(AEGR_Product__c , "Lomitapide"),
ISPICKVAL(AEGR_Product__c , "Metreleptin"),
ISPICKVAL(AEGR_Product__c , "")),ISPICKVAL( AEGR_Status__c,"Identified" ))

Object : Patient Profile    
Field to Update Patient Profile: Patient ID
Formula value:
IF(ISPICKVAL(AEGR_Product__c , "Lomitapide"), 
AEGR_Patient_Initials__c & "-" & "LOM-BR" & "-" & TRIM(RIGHT( Name , 4)), 
IF(ISPICKVAL(AEGR_Product__c , "Metreleptin"), 
AEGR_Patient_Initials__c & "-" & "MET-BR" & "-" & TRIM(RIGHT( Name , 4)), 
IF(ISPICKVAL(AEGR_Product__c ,""),"", 
"")))

 
sfdcsushilsfdcsushil
trigger TriggerName on ObjectName (before insert, before update)
for(Patient_Profile__c prof:Trigger.new){

if(prof.sample_field1__c = 'test' || prof.sample_field2__c = 'test1'){

prof.Sample_Field_To_Update__C= 'something';

}

}
Sample code given above