• Shailesh Patil
  • NEWBIE
  • 25 Points
  • Member since 2012

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 6
    Replies

Guys - Can you help me out. I have a custom object CC Card. I need to update a picklist value field on this object depending on the task logged under this CC Card object. My requirement are:-

 

Trigger should fire only when task gets closed.

If task subject contains "Kick-Off" and is being closed, it should update the picklist field, say stage as Kick-Off .

 

I am new to triggers, see if you experts can help me out. Here is my try at it.

 

trigger TestVishal on Task (before update) {

//Preparting CCCards to Update
public list<CC_Card__c> CardsToUpdate = new List<CC_Card__c>();
public set<Id> CCCardIDs = new Set<Id>();

 if(Trigger.isUpdate){

 for(Task t : Trigger.new)
 {
      if(t.WhoId<>null)
      {
      
               if(string.valueOf(t.WhoId).startsWith('a0P') && t.IsClosed == True)
               CCCardIDs.add(t.whoId);
               
       }
               
 }
 }
 if(CCCardIDs.size()<>0){
  for(CC_Card__c c : [Select c.Id, c.stage__c,(Select Id, Ownerid From Tasks where IsClosed = True AND subject like '%Kick-Off%')From CC_Card__c c where Id in :CCCardIDs])
             
             CardsToUpdate.add(new CC_Card__c(Id=c.Id, stage__c = 'Kick-Off'));                
                                       
        }     
        
        update CardsToUpdate;                     
     
  }

 

It's not giving me any error message when I save it but it's not working either :(

Hello guys,

 

I need your help.

 

I am using some API to get the exchange rates using javascript and I am successful in that.

 

Now, I want these rates should be passed to the Save method defined in the controller.

 

To clarify, my JS function is :

function newnee(){
		dollar1 = fx.convert(1, {from: 'USD', to: 'EUR'});
		}

 As you can see, I have set the value of dollar1. Here is my save in VF :

<apex:commandButton action="{!NewSave}" value="Save" onclick="newnee();"/>

 Here is the Save in my controller :

 public Pagereference NewSave()
        {
         //.......Some code and then insert ......//
            insert objInv ;
            PageReference acctPage = new ApexPages.StandardController(objInv).view();
            acctPage.setRedirect(true);
            return acctPage;
        }

 

I have tried Actionfunction as well as inputhidden. But seems I am missing something.

 

What would be the best way to pass the values to the Save function(Custom)?

 

Can someone help me?

 

Thanks,

Rocky

How to create a not allowed list in “Custom Settings” and add values are exe, vbs, dll, bat  ( We can add more later). Implement a filter to restrict file upload types in Saleforce environment by fetching values from custom setting.

Guys - Can you help me out. I have a custom object CC Card. I need to update a picklist value field on this object depending on the task logged under this CC Card object. My requirement are:-

 

Trigger should fire only when task gets closed.

If task subject contains "Kick-Off" and is being closed, it should update the picklist field, say stage as Kick-Off .

 

I am new to triggers, see if you experts can help me out. Here is my try at it.

 

trigger TestVishal on Task (before update) {

//Preparting CCCards to Update
public list<CC_Card__c> CardsToUpdate = new List<CC_Card__c>();
public set<Id> CCCardIDs = new Set<Id>();

 if(Trigger.isUpdate){

 for(Task t : Trigger.new)
 {
      if(t.WhoId<>null)
      {
      
               if(string.valueOf(t.WhoId).startsWith('a0P') && t.IsClosed == True)
               CCCardIDs.add(t.whoId);
               
       }
               
 }
 }
 if(CCCardIDs.size()<>0){
  for(CC_Card__c c : [Select c.Id, c.stage__c,(Select Id, Ownerid From Tasks where IsClosed = True AND subject like '%Kick-Off%')From CC_Card__c c where Id in :CCCardIDs])
             
             CardsToUpdate.add(new CC_Card__c(Id=c.Id, stage__c = 'Kick-Off'));                
                                       
        }     
        
        update CardsToUpdate;                     
     
  }

 

It's not giving me any error message when I save it but it's not working either :(