• Sean Nolans
  • NEWBIE
  • 40 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 9
    Questions
  • 7
    Replies
No way in SF to update worklow (field) when a file is attached to a record in using native SF
So using a trigger - I took an example from the forums 

I am trying to say when the attachment contains signed as it will be Esigned 

But I am getting this 
Error: Compile Error: Unexpected token '.'. at line 11 column 44

This is what I have 

trigger TestAttachmentCheck on Attachment (after insert, after update, after delete, after undelete) {
    List <Account> AccountList = new List<Account>();
     List <Account> AccountListToUdpdate = new List<Account>();
    Set <Id> AccountIds = new Set <Id>();
    
    if(trigger.isInsert || trigger.isUpdate)
    {
    for(Attachment attach : trigger.New){
         //Check if added attachment is related to Account or not
         if(attach.ParentId.getSobjectType() == Account.SobjectType){
            if(string.valueOf(attach.Name)).contains('signed'))
               AccountIds.add(attach.ParentId);
         }
    }
    }
    
    if(trigger.isDelete || trigger.isUndelete)
    {
    for(Attachment attach : trigger.old){
         //Check if added attachment is related to Account or not
         if(attach.ParentId.getSobjectType() == Account.SobjectType){
            if(string.valueOf(attach.Name)).startswith('.xls'))
               AccountIds.add(attach.ParentId);
         }
    }
    }
    
    AccountList = [select id, CIN_Uploaded__c from Account where id in : AccountIds];
    for(Account Account : AccountList){    
    
           Account accountToUpdate = new accountToUpdate();
           AccountToUpdate.Id = account.Id;
           AccountToUpdate.CIN_Uploaded__c  = true;
           AccountListToUdpdate.add(accountToUpdate);
                
    }
       
        update AccountListToUdpdate;
}
I wish to generate a URL in order to pass data from a thrid party connctor (Zapier) to SFDC. Does anyone know how I could generate such a URl from SFDC that could be query a REST API endpoint ?

https://zapier.com/help/how-get-started-webhooks-zapier/#using-the-retrieve-poll-trigger-option

The would be used to listne for changes in another application ?

thanks



 
I have created a simply trigger that adds the values of two currency fields and renders the full amout into a total field.
I need assistance creating a class for this trigger so that I can deploy it

trigger Sum ON order__c(before insert, before update) {

    for (order__c o: Trigger.new) {
        if (Trigger.isUpdate && o.new_total_field__c != Trigger.oldMap.get(o.Id).new_total_field__c) {
            
            continue;       
        }
        o.new_total_field__c = o.hss_qty_price__c + o.sb_qty_price__c ;

    }
}

Any feedback would be greatly appreciated 

Thanks

D

I wish to render an field output on a VF page if another field value is  > 0 

 <apex:pageBlockSection >
  
  <apex:outputField> value= "{!IF(order__c.hss_qty_price__c >  0, "This includes HSS and Stay Behind price",  "All clear no extras" )} />
             
  
   </apex:pageBlockSection>


This is hwo it works in my formula but I have hit a compile error there so need to move into a page

IF(hss_qty_price__c > 0, "This price includes HSS price",  "All clear no extras" 
Hi Experts,

I need your assistance updating TIN_Uploaded__c (Checkbox) on Lead if the Attachment (Notes and Attachment) Name starts with "TIN". This box should be unchecked if the Attachment is deleted. Also I have another box that will do the same behavior SLA_Uploaded__c but I don't know how to nest them in the code. I've tried building the code but I'm getting error "Variable does not exist: attach.Name" in Line 14.
 
trigger TestAttachmentCheck on Attachment (after insert, after update, after delete, after undelete) {
    List <Lead> LeadList = new List<Lead>();
    Set <Id> LeadIds = new Set <Id>();
    
    for(Attachment attach : trigger.New){
         //Check if added attachment is related to Lead or not
         if(attach.ParentId.getSobjectType() == Lead.SobjectType){
              LeadIds.add(attach.ParentId);
         }
    }
    LeadList = [select id, CIN_Uploaded__c from Lead where id in : LeadIds];
   	for(Lead lead : LeadList){    
    	if((string.valueOf(attach.Name)).startswith('.xls')){
            lead.CIN_Uploaded__c  = true;
        }
        else{
            lead.CIN_Uploaded__c = false;
        }
    }
        update LeadList;
}
I would appreciate any help.

Thanks.