• darron clarison
  • NEWBIE
  • 0 Points
  • Member since 2023

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 3
    Replies
Hi ,
I have a case records with status as Resolved. The Last modified date is captured as we change the status. Considering this dateTime field, I need to run a schedule flow to update the status as Closed automaticaly after 3 business days from the Resolved status.

Formula of type Number  : NOW() - record.lastmodified date 
This will return number and check if greater than 3,and updateto  closed. But this is considering weekends.
How can I achieve this considering Business Days.
Thanks in Advance!
I have the below trigger to create Person Account when a new record is created in a custom object Student__c

I would like to seek some expert help on how to modify the trigger to have 'after update' if the record on Student__c is modified, the changes also should be done on the corresponding person account.

The external ID field on Student__c is Student_id__c and also unique field is NRIC__c. I also store the Id from Student__c into Person Account (Student_Id_from_Student_Prospects__pc,NRIC_PC, Salesforce_Id_from_Student_Object__pc

Please help to modify the below trigger to have 'after insert' and 'after update'
-------------------
trigger CreatePersonAccountfromStudent on Student__c (after insert)
{
    List<account> acc=new List<account>();
    Map<Id, String> m = new Map<Id, String>();
    RecordType rt = [select id from RecordType where SobjectType='Account' and Name='Student' Limit 1];
    for(student__c stud:Trigger.New)
    {
      acc.add(new account(
        Autocreated__pc=True,
        Block__pc=Stud.Block__c,
        Bulk_Load__pc=Stud.Bulk_Load__c,
        Current_Acedamic_Year__pc=Stud.Current_Acedamic_Year__c,
        Date_of_Collection__pc=Stud.Date_of_Collection__c,
        Discount_Percentage__pc=Stud.Discount_Percentage__c,
        Discount_Policy__pc=Stud.Discount_Policy__c,
        Discount_Remarks__pc=Stud.Discount_Remarks__c,
        Discount_Type__pc=Stud.Discount_Type__c,
        English__pc=Stud.English__c,
        Event_Name__pc=Stud.Event_Name__c,
        Exclude_Registration__pc=Stud.Exclude_Registration__c,
        Father_Email__pc=Stud.Father_Email__c,
        Father_Name__pc=Stud.Father_Name__c,
        Father_NRIC__pc=Stud.Father_NRIC__c,
        Father_Office_Phone__pc=Stud.Father_Office_Phone__c,
        Father_Primary_Contact__pc=Stud.Father_Primary_Contact__c,
        Father_Remark__pc=Stud.Father_Remark__c,
        Father_Staff__pc=Stud.Father_Staff__c,
        Gender__pc=Stud.Gender__c,
        GEP__pc=Stud.GEP__c,
        Guardian_Email__pc=Stud.Guardian_Email__c,
        Guardian_Mobile__pc=Stud.Guardian_Mobile__c,
        Guardian_Name__pc=Stud.Guardian_Name__c,
        Guardian_NRIC__pc=Stud.Guardian_NRIC__c,
        Guardian_Office_Phone__pc=Stud.Guardian_Office_Phone__c,
        Guardian_Primary_Contact__pc=Stud.Guardian_Primary_Contact__c,
        Guardian_Relationship__pc=Stud.Guardian_Relationship__c,
        Guardian_Remarks__pc=Stud.Guardian_Remark__c,
        Guardian_Staff__pc=Stud.Guardian_Staff__c,
        How_did_you_hear_about_us__pc=Stud.How_did_you_hear_about_us__c,
        Is_Mind_Stretcher_Staff_Mother__pc=Stud.Is_Mind_Stretcher_Staff_Mother__c,
        LastName=Stud.name__c,
        Level__pc=Stud.Level__c,
        Level_Promoted_DateTime__pc=Stud.Level_Promoted_DateTime__c,
        Maths__pc=Stud.Maths__c,
        Mobile_No_Father__pc=Stud.Mobile_No_Father__c,
        Mother_Email__pc=Stud.Mother_Email__c,
        Mother_Name__pc=Stud.Mother_Name__c,
        Mother_No_Mobile__pc=Stud.Mobile_No_Mother__c,
        Mother_NRIC__pc=Stud.Mother_NRIC__c,
        Mother_Office_Phone__pc=Stud.Mother_Office_Phone__c,
        Mother_Primary_Contact__pc=Stud.Mother_Primary_Contact__c,
        Mother_Remark__pc=Stud.Mother_Remark__c,
        Mother_Staff__pc=Stud.Mother_Staff__c,
        MS_Start_Kit_Bag__pc=Stud.MS_Start_Kit_Bag__c,
        Nationality__pc=Stud.Nationality__c,
        NRIC__pc=Stud.NRIC__c,
        NTUC_10_Discount__pc=Stud.NTUC_10_Discount__c,
        NTUC_Card_Expiry__pc=Stud.NTUC_Card_Expiry__c,
        NTUC_Remark__pc=Stud.NTUC_Remark__c,
        Others__pc=Stud.Others__c,
        Others_How_did_you_hear_about_us__pc=Stud.Others_How_did_you_hear_about_us__c,
        Person_Contact__pc=Stud.Person_Contact__c,
        PersonBirthdate=Stud.DOB__c,
        PersonHomePhone=Stud.Home_No__c,
        PersonMailingPostalCode=Stud.Postal_Code__c,
        PersonMailingStreet=Stud.Street_Temp__C,
        Primary_Contact_Number__pc=Stud.Contact_number__c,
        Primary_Email__pc=Stud.Primary_Email__c,
        Primary_Name__pc=Stud.Primary_Name__c,
        Primary_Remark__pc=Stud.Primary_Remark__c,
        Promotion__pc=Stud.Promotion__c,
        Reading_Oceans_Email__pc=Stud.Reading_Oceans_Email__c,
        Reading_Oceans_End_Date__pc=Stud.Reading_Oceans_End_Date__c,
        Reading_Oceans_Start_Date__pc=Stud.Reading_Oceans_Start_Date__c,
        Reading_Oceans_Subscrip__pc=Stud.Reading_Oceans_Subscrip__c,
        recordtypeid=rt.id,
        Registration_Centre__pc=Stud.Registration_Centre__c,
        Related_Centres__pc=Stud.Related_Centres__c,
        Remarks__pc=Stud.Remarks__c,
        RO_Date_Send_User__pc=Stud.RO_Date_Send_User__c,
        RO_Remark__pc=Stud.RO_Remark__c,
        RO_Type__pc=Stud.RO_Type__c,
        Safra_Card_Expiry__pc=Stud.Safra_Card_Expiry__c,
        Safra_Card_Holding__pc=Stud.Safra_Card_Holding__c,
        Safra_Remark__pc=Stud.Safra_Remark__c,
        Salesforce_Id_from_Student_Object__pc=Stud.ID,
        School__pc=Stud.School__c,
        Science__pc=Stud.Science__c,
        Secondary_Stream__pc=Stud.Secondary_Stream__c,
        Start_Date__pc=Stud.Start_Date__c,
        Street__pc=Stud.Street__c,
        Student_Id_from_Student_Prospects__pc=Stud.name,
        Student_Old_Reference_ID__pc=Stud.Student_Old_Reference_ID__c,
        Student_Status__pc=Stud.Student_Status__c,
        Student_Type__pc='Student',
        Tick_to_activate_inter_branch_discount__pc=Stud.Tick_to_activate_inter_branch_discount__c,
        Type_Course_Fee__pc=Stud.Type_Course_Fee__c,
        Unit_Number__pc=Stud.Unit_Number__c
    ));
 }
    insert acc;
}
  • July 24, 2017
  • Like
  • 0

Hi, I desperatly need some help creating my first trigger and i'm a bit lost.
I'm trying to create a trigger on a custom object called wp_leads__c which looks up a field called code_entered__c against another custom object called wp_cid__c on a field called coupon__c.

If wp_leads__c. code_entered__c = wp_cid__c.coupon__c I want to update a tickbox field called matched_code__c in the wp_leads__c object with a tick.

Please help!

  • March 02, 2015
  • Like
  • 0