• Glenn Balmonte
  • NEWBIE
  • 10 Points
  • Member since 2015
  • The Design People

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 5
    Replies
Hello Experts,

Need your inputs on how we can assign particular records created by this trigger to specific user. Say the record "Website Audit Report and Recommendations" will be assign to User A and the record "Optimize keywords in footer links" will be assign to User B. 

=================================================

trigger AutoCreateProductionTask on SFDC_Project__c (after insert) {

   List<Production_Task__c> newRecord = new List<Production_Task__c>(); 

   List<String> namePT = new List<String>();
   namePT.add('Website Audit Report and Recommendations');
   namePT.add('Keyword Research');
   namePT.add('Competitor Research');
   namePT.add('Run page speed loading test and make improvements');
   namePT.add('Run site on validator and fix broken links and html errors');
   namePT.add('Run crawl test and redirect any obsolete urls');
   namePT.add('Keyword mapping, meta data creation and implementation');
   namePT.add('Text content creation');
   namePT.add('Upload optimized text content, insert and highlight ketwords');
   namePT.add('Optimize keywords in footer links');
   namePT.add('Optimize alt tags of images');
   namePT.add('Create or improve HTML sitemap page');
   namePT.add('Add breadcrumbs navigation on inner pages');
   namePT.add('Create Google Places listing');
   namePT.add('URL and Directory Submission');
   namePT.add('Create Google Webmaster Tools profile');
   namePT.add('Create Google Analytics profile');
   namePT.add('Create Google Analytics Contact Forms Goal Setup');
   namePT.add('Add in AI Directory');   
   namePT.add('Create and submit xml sitemap to Google');
   namePT.add('Create and publish 1 Press Release');
   
    for (SFDC_Project__c aim : Trigger.new) {
        
        if (aim.RecordTypeID == Schema.SObjectType.SFDC_Project__c.getRecordTypeInfosByName().get('AIM Project').getRecordTypeId())
        if (aim.Product_Service__c == 'SEO - Premium'|| aim.Product_Service__c == 'SEO - Pro'|| aim.Product_Service__c == 'SEO - Starter'|| aim.Product_Service__c == 'SEO - Plus')
        
                {

          for(Integer i = 0; i < namePT.size(); i++){
            
            Production_Task__c aimTask = new Production_Task__c();
            aimTask.recordTypeId = Schema.SObjectType.Production_Task__c.getRecordTypeInfosByName().get('AIM').getRecordTypeId();
            aimTask.Name = namePT [i];
            aimTask.Due_Date__c = Date.today().addDays(30);
            aimTask.Project__c = aim.Id;
            aimTask.Instructions__c = 'test';
            
                newRecord.add(aimTask);   
            
           }
           }
            insert newRecord;
   }
   }

=================================================

Any assistance is highly appreciated. Thank you. 
Hello Experts,

Need your assistance. We have a trigger that wil automatically create child records every time that the Parent Record Type is selected (e.g. If User selected the Parent Record Type "AIM"). I just need your inputs on how I can set all of these Child Records to one record type which is also AIM. Here is the code:


//trigger that creates a new production task for every new AIM Project with SEO products
 
trigger AutoCreateProductionTask on SFDC_Project__c (after insert) {

   List<Production_Task__c> newRecord = new List<Production_Task__c>(); 

   List<String> namePT = new List<String>();
   namePT.add('Website Audit Report and Recommendations');
   namePT.add('Keyword Research');
   namePT.add('Competitor Research');
   namePT.add('Run page speed loading test and make improvements');
   namePT.add('Run site on validator and fix broken links and html errors');
   namePT.add('Run crawl test and redirect any obsolete urls');
   namePT.add('Keyword mapping, meta data creation and implementation');
   namePT.add('Text content creation');
   namePT.add('Upload optimized text content, insert and highlight ketwords');
   namePT.add('Optimize keywords in footer links');
   namePT.add('Optimize alt tags of images');
   namePT.add('Create or improve HTML sitemap page');
   namePT.add('Add breadcrumbs navigation on inner pages');
   namePT.add('Add Google+ Authorship code on inner pages');
   namePT.add('Create Google Places listing');
   namePT.add('Submit site to web directories');
   namePT.add('Create Google Webmaster Tools profile');
   namePT.add('Create Google Analytics profile');
   namePT.add('Create and submit xml sitemap to Google');
   namePT.add('Create and publish 1 Press Release');
   
    for (SFDC_Project__c aim : Trigger.new) {
        
        if (aim.RecordTypeID == '012300000009FLk')
        if (aim.Product_Service__c == 'SEO - Premium'|| aim.Product_Service__c == 'SEO - Pro'|| aim.Product_Service__c == 'SEO - Starter')
        
                {

          for(Integer i = 0; i < namePT.size(); i++){
            
            Production_Task__c aimTask = new Production_Task__c();
            aimTask.Name = namePT [i];
            aimTask.Due_Date__c = Date.today().addDays(30);
            aimTask.Project__c = aim.Id;
            aimTask.Instructions__c = 'test';
            
                newRecord.add(aimTask);   
            
           }
           }
            insert newRecord;
   }
   }

Any assistance is greatly appreciated. Thank you. 
Hello Experts,

Just a newbie here. Do you have any resources where I can have a reference for Salesforce to Slack Integration. We want to integrate our Salesforce to Slack and based from the resources I found so far, this is for Opportunity Records only. Can you guide me in creating class where every time there is a record created, there will be post on Slack? 

Here is the link that I found: 
http://coenraets.org/blog/2016/01/slack-salesforce-integration/
http://coenraets.org/blog/2016/01/slack-salesforce-integration-part-2/

Appreciate any response here. Thank you. 

 
Hello Experts,

Need your inputs on how we can assign particular records created by this trigger to specific user. Say the record "Website Audit Report and Recommendations" will be assign to User A and the record "Optimize keywords in footer links" will be assign to User B. 

=================================================

trigger AutoCreateProductionTask on SFDC_Project__c (after insert) {

   List<Production_Task__c> newRecord = new List<Production_Task__c>(); 

   List<String> namePT = new List<String>();
   namePT.add('Website Audit Report and Recommendations');
   namePT.add('Keyword Research');
   namePT.add('Competitor Research');
   namePT.add('Run page speed loading test and make improvements');
   namePT.add('Run site on validator and fix broken links and html errors');
   namePT.add('Run crawl test and redirect any obsolete urls');
   namePT.add('Keyword mapping, meta data creation and implementation');
   namePT.add('Text content creation');
   namePT.add('Upload optimized text content, insert and highlight ketwords');
   namePT.add('Optimize keywords in footer links');
   namePT.add('Optimize alt tags of images');
   namePT.add('Create or improve HTML sitemap page');
   namePT.add('Add breadcrumbs navigation on inner pages');
   namePT.add('Create Google Places listing');
   namePT.add('URL and Directory Submission');
   namePT.add('Create Google Webmaster Tools profile');
   namePT.add('Create Google Analytics profile');
   namePT.add('Create Google Analytics Contact Forms Goal Setup');
   namePT.add('Add in AI Directory');   
   namePT.add('Create and submit xml sitemap to Google');
   namePT.add('Create and publish 1 Press Release');
   
    for (SFDC_Project__c aim : Trigger.new) {
        
        if (aim.RecordTypeID == Schema.SObjectType.SFDC_Project__c.getRecordTypeInfosByName().get('AIM Project').getRecordTypeId())
        if (aim.Product_Service__c == 'SEO - Premium'|| aim.Product_Service__c == 'SEO - Pro'|| aim.Product_Service__c == 'SEO - Starter'|| aim.Product_Service__c == 'SEO - Plus')
        
                {

          for(Integer i = 0; i < namePT.size(); i++){
            
            Production_Task__c aimTask = new Production_Task__c();
            aimTask.recordTypeId = Schema.SObjectType.Production_Task__c.getRecordTypeInfosByName().get('AIM').getRecordTypeId();
            aimTask.Name = namePT [i];
            aimTask.Due_Date__c = Date.today().addDays(30);
            aimTask.Project__c = aim.Id;
            aimTask.Instructions__c = 'test';
            
                newRecord.add(aimTask);   
            
           }
           }
            insert newRecord;
   }
   }

=================================================

Any assistance is highly appreciated. Thank you. 
Hello Experts,

Need your assistance. We have a trigger that wil automatically create child records every time that the Parent Record Type is selected (e.g. If User selected the Parent Record Type "AIM"). I just need your inputs on how I can set all of these Child Records to one record type which is also AIM. Here is the code:


//trigger that creates a new production task for every new AIM Project with SEO products
 
trigger AutoCreateProductionTask on SFDC_Project__c (after insert) {

   List<Production_Task__c> newRecord = new List<Production_Task__c>(); 

   List<String> namePT = new List<String>();
   namePT.add('Website Audit Report and Recommendations');
   namePT.add('Keyword Research');
   namePT.add('Competitor Research');
   namePT.add('Run page speed loading test and make improvements');
   namePT.add('Run site on validator and fix broken links and html errors');
   namePT.add('Run crawl test and redirect any obsolete urls');
   namePT.add('Keyword mapping, meta data creation and implementation');
   namePT.add('Text content creation');
   namePT.add('Upload optimized text content, insert and highlight ketwords');
   namePT.add('Optimize keywords in footer links');
   namePT.add('Optimize alt tags of images');
   namePT.add('Create or improve HTML sitemap page');
   namePT.add('Add breadcrumbs navigation on inner pages');
   namePT.add('Add Google+ Authorship code on inner pages');
   namePT.add('Create Google Places listing');
   namePT.add('Submit site to web directories');
   namePT.add('Create Google Webmaster Tools profile');
   namePT.add('Create Google Analytics profile');
   namePT.add('Create and submit xml sitemap to Google');
   namePT.add('Create and publish 1 Press Release');
   
    for (SFDC_Project__c aim : Trigger.new) {
        
        if (aim.RecordTypeID == '012300000009FLk')
        if (aim.Product_Service__c == 'SEO - Premium'|| aim.Product_Service__c == 'SEO - Pro'|| aim.Product_Service__c == 'SEO - Starter')
        
                {

          for(Integer i = 0; i < namePT.size(); i++){
            
            Production_Task__c aimTask = new Production_Task__c();
            aimTask.Name = namePT [i];
            aimTask.Due_Date__c = Date.today().addDays(30);
            aimTask.Project__c = aim.Id;
            aimTask.Instructions__c = 'test';
            
                newRecord.add(aimTask);   
            
           }
           }
            insert newRecord;
   }
   }

Any assistance is greatly appreciated. Thank you. 
Hello Experts,

Just a newbie here. Do you have any resources where I can have a reference for Salesforce to Slack Integration. We want to integrate our Salesforce to Slack and based from the resources I found so far, this is for Opportunity Records only. Can you guide me in creating class where every time there is a record created, there will be post on Slack? 

Here is the link that I found: 
http://coenraets.org/blog/2016/01/slack-salesforce-integration/
http://coenraets.org/blog/2016/01/slack-salesforce-integration-part-2/

Appreciate any response here. Thank you.