• Samba G
  • NEWBIE
  • 35 Points
  • Member since 2013

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

Hi, 

Iam very new to salesforce please help me for the below senario, please its urgent.

 

I have an opportunity object which have record types opportunity a, opportunity b, when ever i choose the price book for opportunity a record type, then in product it shows the opportunity a in one custom field, for that i created a picklist field on opportunity 

 

please help how to write the trigger for it, on which object we should write the trigger

 

regards

sri

 

Hi All,

We are trying to integrate external system(.Net) to SFDC(server).  For this we are using oauth setup to establish connection between .Net to SFDC. In this setup we are using Call Back URL, https://localhost:8443/RestTest/oauth/_callback. 
In .Net code we are using consumer key, consumer secret, call back URL, while running .Net code we are not able to get access token from SFDC

Is there any issues with above Call Back URL.

Thanks Inadvance.

Hello everyone!

 

We are an engineering company based in Moscow, Russia and are currently looking specifically for a Remote Freelance admin (not a company) /developer to handle our day-to-day tasks in terms of different customisations, fixings, configurations, like creating complicated customised reports and dashboards, providing customisation of forms within SF and implementing code.

 

 

If you are interested, please write below with your contact details, stating the number of years of experience you have in working with SF and your location.

 

Thanks,

 

Yulia

 

 

Hi,

I am trying to insert/update the value when the status change to Reviewed it should put the date time in a_date__C  and

when status changed to Approved it should put the date time in r_date__C. 

But it's not giving me an error neither its' updating the field.

 

 

trigger updatefield on imp__c (after update) {
Map<String,imp__c > recordsimp = new Map<String,imp__c >();
List<account> accountToUpdate = new List<account>();

List<imp__c> impToInsert = new List<imp__c>();

 

if (Trigger.isInsert){
        for (imp__c impRecord : trigger.new){
            if(imprecord.Status__c == 'Reviewed' || imprecord.Status__c == 'Approved'){
                imp__c impObj = new imp__c (a_Date__c = datetime.Now(),r_date__c=datetime.now());
                insert  impObj;                  
            }
              
        }
        insert impToInsert;
    }

 

 

Else{

 

 


for(imp__c impRecord : trigger.new){

Imp__c oldImp = trigger.oldMap.get(impRecord.Id);

// only add IMP record Ids to the Map if the IMP record Status__c field changes

if(impRecord.Status__c != oldImp.Status__c)
recordsimp.put(impRecord.rec_ID__c,impRecord);
}

 

// only execute below if the Map is not empty (any Status__c changes occured above)

if(!recordsimp.isEmpty(){
accountToUpdate = [select id,Status__c,account_num__c from account where account_num__c IN: recordsimp.keyset()];
for(account accounts: accountToUpdate){
accounts.status__c = recordsimp.get(accounts.account_num__c).Status__c;
}
if(accountToUpdate.size() > 0){
update accountToUpdate;
}
}

}

}

Hi, I need to insert an Opportunity when another object is created - both will be linked to the same Account.

Below is my code.

I cannot get the Opportunity to link to the Account. Debug tells me it is finding the right Accout. Thanks

 

 

trigger addProspectfromLeadshort on short__c (after insert) {
List <opportunity> NewOpp = new List<Opportunity>();

List <id> ProspAcct = new List <id>();

Date prepDate = date.today();
Date CloseDate = prepDate.addDays(60);

for (short__c newshort: Trigger.New)
    if (newshort.Status__c=='Lead' && newshort.Account__c != NULL){
       ProspAcct.add(newshort.Account__c);
       system.debug('prospAcct============================='+ProspAcct);
       
       List <Account> TheAcct = [select id, name from Account where ID IN: ProspAcct limit 1];
       system.debug('theAcct============================='+theAcct);
       
        NewOpp.add (new Opportunity (
        Name = newshort.name+TheAcct,
        CloseDate = closeDate,
        StageName = 'Prospecting',
        Account= TheAcct
        ));
}
insert newOpp;
}

 

  • August 15, 2013
  • Like
  • 0

Good morning everyone!

 

   So I encountered an issues and it seems that it would be very common, so I thought you guys might be able to help me out.  

 

I created a trigger that runs on UPDATE, however, anytime a record is inserted the update trigger fires.  I believe I know why it happens but I need to prevent it.  I believe that when a record is inserted, workflow rules with field updates cause the record to be updated thus fireing the UPDATE trigger. 

 

So my question is, what can I do to my trigger to prevent the workflow rule from making my UPDATE trigger fire on INSERT?

 

I give kudos and follow up on all posts so if you can help I will return the favor.

 

Thanks, 

Hi,

 

I have a large amount of data in a custom object - ( around 1lakh records).

 

I want a scheduler class which can export the data in a csv and attach to chatter files daily. I have tried many things but it is hitting one or the other limit. String limit, Collection limit, Code Statements limit.

 

Is it possible? Is there any API for this purpose?

 

Thanks!

I'm brand new to APEX and visualforce with background in Java. I was wondering if anyone could tell me the steps to take to be able to read a .csv file from APEX code. 

 

Basically, my application will read a .csv file which contains information pertaining to constants in an application. So I'm trying to write code that will parse through the csv file and populate class fields with data in the csv file. 

 

So far, I've uploaded the csv file into the Documents page, from there I'm not too sure what to do so that I can access the file from Documents and read it into something like a List/array. 

 

If anyone has any sample code or tips that would be greatly appreciated!

  • August 15, 2013
  • Like
  • 0

Does anyone know how to call the People object in VisualForce or Apex,

The object that has all the administrators?

 

Thanks

Can I give an "id" the value in following manner while using <apex:inputfield> component?

 

<apex:inputField value={!x} id ="{!value}" />

 

What am trying to achieve here is; I have this inputField inside an <apex:repeat> component and I need to give it a separate id everytime this component gets repeated.

 

Any suggestion is helpful.

 

Thanks ~ justin_sfdc

Hi, 

Iam very new to salesforce please help me for the below senario, please its urgent.

 

I have an opportunity object which have record types opportunity a, opportunity b, when ever i choose the price book for opportunity a record type, then in product it shows the opportunity a in one custom field, for that i created a picklist field on opportunity 

 

please help how to write the trigger for it, on which object we should write the trigger

 

regards

sri

 

Hi, I want to create a custom button in visualforce and On clicking that button i should be redirected to a form.

Could someone help me out for this scenario

  • August 13, 2013
  • Like
  • 0

I have a project application that has milestones and tasks.  Milestones can have multiple tasks.  On Milestones, there can be a lookup to another milestone, which also has it's own tasks.

My trigger updates all the dates of the tasks and the related milestone when the original milestone's date changes.  The problem I'm running into is that when the trigger updates the related milestone, that then runs the trigger again, since it's and update to milestone.

The code works if i'm updating a milestone with only 2 levels of related milestones, but once I get to something higher, I run into soql limits.  Is there a more efficient way for me to write this trigger?

 

trigger MilestoneTrigger on MPM4_BASE__Milestone1_Milestone__c (after update) {
    Integer DaysToAdd;
    
    //get ID of Milestones
    Set<ID> msid = new Set<ID>();
    for(MPM4_BASE__Milestone1_Milestone__c ms: trigger.new){
        msid.add(ms.id);
        //if kickoff date is changed then do code
        //calculate the day difference of old and new date    
        MPM4_BASE__Milestone1_Milestone__c oldms = Trigger.oldMap.get(ms.Id);
        DaysToAdd = oldms.MPM4_BASE__Kickoff__c.daysBetween(ms.MPM4_BASE__Kickoff__c);
    }
    
    //get list of all tasks in milestone
    List<MPM4_BASE__Milestone1_Task__c> tasks = [SELECT Id, MPM4_BASE__Due_Date__c,MPM4_BASE__Start_Date__c FROM MPM4_BASE__Milestone1_Task__c WHERE MPM4_BASE__Project_Milestone__c IN: msid];
    //get list of all child milestones
    List<MPM4_BASE__Milestone1_Milestone__c> cmilestone = [SELECT Id, MPM4_BASE__Deadline__c, MPM4_BASE__Kickoff__c FROM MPM4_BASE__Milestone1_Milestone__c WHERE MPM4_BASE__Predecessor_Milestone__c IN: msid ];  
    
    
    
    List<MPM4_BASE__Milestone1_Task__c> updateTask = new List<MPM4_BASE__Milestone1_Task__c>();
    List<MPM4_BASE__Milestone1_Milestone__c> updateCMilestone = new List<MPM4_BASE__Milestone1_Milestone__c>();
    
    
    //add those dates to all tasks
    for(MPM4_BASE__Milestone1_Task__c t : tasks){
        t.MPM4_BASE__Due_Date__c += DaysToAdd;
        t.MPM4_BASE__Start_Date__c += DaysToAdd;
        updateTask.add(t);
    }
    if(updateTask.isEmpty()==false){
        update updateTask;}
    
    // add those dates to child milestones dates
    for(MPM4_BASE__Milestone1_Milestone__c m : cmilestone){
        m.MPM4_BASE__Deadline__c += DaysToAdd;
        m.MPM4_BASE__Kickoff__c += DaysToAdd;
        updateCMileStone.add(m);
    }  
    if(updateCMilestone.isEmpty()==false){
        update updateCMilestone;}
    
}

 

I want to add two list which differnet data into one list How is it possible please find the sceneario below

outer class is a

inner class  : inner_a and inner_b

and a method

 

 

class a

{

   class inner_a

  {

 

  }

 

 class inner_b

{

 list<inner_a> innera

 }

 

 Method(list<inner_b> innerb)

{

  list<inner_a> some = new list<inner_a>();

 

  some.add(innerb.innera);      // this line is giving error ..concrete sobject

}

 

}

 

please suggest