• Mariappan Perumal
  • NEWBIE
  • 118 Points
  • Member since 2012
  • Software Engineer
  • Accenture


  • Chatter
    Feed
  • 3
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 21
    Questions
  • 48
    Replies

I am trying to create a trigger that will populate a custom lookup field (Opportunity1_c) to Opportunities on Opp Team  with the value of the Opp that the Team Member is being added onto.

 

The reason being that I want to run workflows etc off the vlaues from the parent Opp but it cant be got to by standard methods - can this be done with a trigger?

 

 I have started to try and code one but my skills are not the best. Any help would be appreciated 

 

Here is what I have come up with so far 

 

trigger Opp_Team on OpportunityTeamMember (before insert, before update) {

Map <String, Opportunity > OppMap = new Map <String, Opportunity>();
for (Opportunity p : [SELECT Id, Name from Opportunity])
{
OppMap.put(p.Name,p);
}

for (OpportunityTeamMember a: Trigger.new)
{
a.Opportunity1__c = OppMap.get(Opportunity);
}


}

  • November 26, 2013
  • Like
  • 0

Hi All

 

              I am tryign to use like this. Can I Use this.

 

Select id, Name, (Select id,name,CreatedDate from Contact ORDER BY CreatedDate LIMIT 5) from Account.

 

How Can I use Limit With in the SubQuery Is it possible.

 

Regards

Venkat

Hi Everyone.

Recently i tried to insall chatter desktop , it just show me this error ,

Installer file broken and ask me to bring the new  installer file from the provider, Adobe AIR is installed properly in my machine.

Did anyone faced the same issue.
Hi Everyone.

Can you anyone help me on this. Is it possible to user merge field in Email Footers in salesforce.

{!User.FirstName} {!User.LastName}

Will it display the merger field of current logged in user. Or Still it display that as Text.

Thanks in advance

Hi Everyone,

I would like to know about the scenario where exactly service contract and entitlement management are used. and How they are related to each other. 

I could a sales rep work with service contracts and entitlment in real time. 

Thanks & Regards
Mariappan Perumal

Hi Everyone ,

 

Nice to come with the wonderful doubt to the board.

 

I have written a trigger which is perform the rollup operation in lookup relation between 2 objects , I mean only counts the child records . 

 

I could have gone with the rollup summary field here but because of requirements , I wrote the trigger , the things here is like , we need to count the accounts which are all associated to single opportunity . 

 

Here is trigger i came up with  :

 

trigger OpportunityRollup on Account (after insert, after update, 
                                        before delete, after undelete) {

if(Trigger.isInsert)
{
Set<Id>oppids=new Set<Id>();
List<Opportunity> oplist=new List<Opportunity>();
List<Opportunity> oppo=new List<Opportunity>();
    For(Account acc: Trigger.New)
    {
    if(acc.RecordTypeId=='012R0000000D9iF' && acc.Opportunity__c!=null)
    {
    oppids.add(acc.Opportunity__c);
    }
    }
    oppo =[select Actual_Student_Accounts__c from Opportunity where Id IN: oppids];
    For(Opportunity oo:oppo)
    {
    oo.Actual_Student_Accounts__c=oo.Actual_Student_Accounts__c+1;
    oplist.add(oo);
    }
    
    update oplist;

}

}

 

The trigger will fine , it bulkified by making query and dml outside of loop .

 

My quuestion here is :

Whenever a account is inserted , it will increament the count field in opportunity to which it is associated, 

so 2 accounts which are associated to 2 different accounts will increament the counter field in the opportunity to which it is associated respectively ,

 

But if 2 accounts which are associated to same accounts , since set is used to hold the opportunity id of the account , it increaments the counter field once . I tried with the List instead of Set . 

 

What should we do to make it work perfectly ?

 

Thanks in advance
    

Hi All,

 

I have requirement like i need to refer the values of the picklist field( custom field) from some other custom object picklist field ,

We can do this in vf page and controller and

 

We could also use custom setting incase of vf page and controller .

 

But i want  the custom object picklist field values dependent on values of some other custom object picklist field

 

Thanks in advance

Hi all ,

 

I have written the trigger on task  , whenever i closed the task i will generated another task after 5 days from the due date ,

 

But it fire the trigger exactly twice in my salesforce org,

 

I found that some other workflow make my trigger to fire again , I have also attached the crietria and field update of that workflow below for the reference ,

Evaluation CriteriaEvaluate the rule when a record is created, and any time it’s edited to subsequently meet criteria

Rule CriteriaTask: StatusEQUALSCompleted

 

Field Update: some date/time field in the task .

 

 

 

trigger TaskforEnrolledStatus on Task (before update) {
Date mydate;
List<Task> tasksupd = new List<Task>();
for(Task tsk: Trigger.new)
{
Task oldtask=Trigger.oldMap.get(tsk.Id);
Task newtask=Trigger.newMap.get(tsk.Id);

if(newtask.Status=='Completed'&& oldtask.Status!=newtask.Status ){
Account aa=[Select id,Account_Status__c from Account where id=:newtask.whatId];
if(aa.Account_Status__c=='Accepted')
{
mydate=newtask.ActivityDate+5;

Task tskupd=new Task(ownerId=newtask.ownerId,whatId=newtask.whatId,Subject='Send11 Letter',Priority='Normal',Status='Not Started',ActivityDate=mydate);

tasksupd.add(tskupd);


}
Database.insert(tasksupd);

}
}
}

 

My Question here is like Order of execution on salesforce is trigger and then workflow ,

1.Trigger will fire and create the task when we close one task, and then workflow will fire and update the date/time field and 

How come the trigger will fire again ?.

 

Thanks in advance

 

Hi all ,

 

I have written the apex scheduled class and which will fire everyday and it will fetch the records from the custom object of certain criteria and try to update the account to which the record is associated .

 

I just paste my code below is it possible to write like :

 

global class AccountStatusUpdat Implements Schedulable
 { 


     global void execute(SchedulableContext sc)
        {  
       List<Online_Application__c> oa=new List<Online_Application__c>();
       List<Online_Application__c> os=new List<Online_Application__c>();
       oa=[Select id,Account__r.Account_Status__c from Online_Application__c where StatusUpdatedDate__c < Last_N_Days:15  ];
       for(Online_Application__c oo: oa)
       {
       oo.Account__r.Account_Status__c='Disengaged';
       os.add(oo);
       
       }  
     update os;  
  }
  
  }

 

My question is :

I have queried the like

Select id,Account__r.Account_Status__c from Online_Application__c where StatusUpdatedDate__c < Last_N_Days:15 through i get the account status of the application and i try to update the status of the account below

like this

 

 oo.Account__r.Account_Status__c='Disengaged';  Is it right way of doing this ?

oo.Account_Status__c='Disengaged '; is enough .

 

Can anyone help me out of this ..

 

 

Thanks in advance

 

 

 

Hi Everyone,

 

I have created endpoint URL for google analytics,

 

https://www.googleapis.com/analytics/v3/data/ga?ids=ga%3A731335&dimensions=ga%3Adate&metrics=ga%3Avisitors%2Cga%3AnewVisits&start-date=2013-04-01&end-date=2013-05-01&max-results=50

then how to add remaining attributes in HttpRequest ?

For example,,

HttpRequest req = new HttpRequest();

req.setEndpoint('https://www.googleapis.com/analytics/v3/data');

My Question is how to add remaining attribute that mean like (ids=ga%3A731335) in the same class, and how to call this?

Hi Everyone.

 

 

I have written conntroller which will fetch the records from my google analytics account the response i got is in json format.

 

I am unable to parse the json file.

 

Its seems like not a key , value pair format in json.

 

Can anyone assist me on this

 

|{
"kind":"analytics#gaData",
"id":"https://www.googleapis.com/analytics/v3/data/ga?ids=ga:71511635&dimensions=ga:date&metrics=ga:visitors,ga:newVisits&start-date=2013-04-01&end-date=2013-05-03&max-results=50",
"query":
{
"start-date":"2013-04-01",
"end-date":"2013-05-03",
"ids":"ga:71511635",
"dimensions":"ga:date",
"metrics":["ga:visitors","ga:newVisits"],
"start-index":1,
"max-results":50
},
"itemsPerPage":50,
"totalResults":33,
"selfLink":"https://www.googleapis.com/analytics/v3/data/ga?ids=ga:71511635&dimensions=ga:date&metrics=ga:visitors,ga:newVisits&start-date=2013-04-01&end-date=2013-05-03&max-results=50",
"profileInfo":
{
"profileId":"71511635",
"accountId":"40258520",
"webPropertyId":"UA-40258520-2",
"internalWebPropertyId":"69406345",
"profileName":"All Web Site Data",
"tableId":"ga:71511635"
},
"containsSampledData":false,
"columnHeaders":
[
{
"name":"ga:date",
"columnType":"DIMENSION",
"dataType":"STRING"
},
{
"name":"ga:visitors",
"columnType":"METRIC",
"dataType":"INTEGER"
},
{
"name":"ga:newVisits",
"columnType":"METRIC",
"dataType":"INTEGER"
}],
"totalsForAllResults":
{
"ga:visitors":"31",
"ga:newVisits":"25"
},
"rows":
[
["20130401","0","0"],
["20130402","0","0"],
["20130403","0","0"],
["20130404","0","0"],
["20130405","0","0"],
["20130406","0","0"],
["20130407","0","0"],
["20130408","0","0"],
["20130409","0","0"],
["20130410","0","0"],
["20130411","0","0"],
["20130412","0","0"],
["20130413","0","0"],
["20130414","0","0"],
["20130415","0","0"],
["20130416","0","0"],
["20130417","0","0"],
["20130418","0","0"],
["20130419","5","4"],
["20130420","0","0"],
["20130421","0","0"],
["20130422","1","1"],
["20130423","17","15"],
["20130424","2","1"],
["20130425","2","1"],
["20130426","0","0"],
["20130427","0","0"],
["20130428","0","0"],
["20130429","2","1"],
["20130430","0","0"],
["20130501","0","0"],
["20130502","1","1"],
["20130503","1","1"]
]

 

Thanks in advance
}

Hi all,

 

I have been using TabPanel in my visualforce page(inline vf page) with 5 tabs . Each of my tab contains some fields in some X object (in my instance - Case object)

 

I am getting and updating the data in case object in that visualforce page respectively(save and edit functionality) in each tab.

 

When i am trying to save the data in 5th tab , Its working fine but after save it redirects me to 1st tab(control got switched to 1st tab)  

 

how can i avoid this problem , Can anyone help me out of this problem.

 

Thanks in advance

Hi everyone ,

 

I have been working in java integration in salesforce via rest api.

 

I am following the wiki page below 

http://wiki.developerforce.com/page/Getting_Started_with_the_Force.com_REST_API

 

I have done most of the things,

 

!) Successfully enabled the SSL for my tomcat apache server.

2)I have developed the application as specified in the above link..

3) I have debuged the entire and keep that with the required jar file and authentication needed for the integration.

4)The problem is after doing everything , am unable to start my server in my eclipse instance but i am able to start the server in tomcat apache installed directory.

 

Can  anyone helped me out of this.

 

Thanks in advance

 

Hi all,

 

I have written a vf page in which i am comparing 2 fieldset and have one more condition 

 

I tried to rendered the inputfield based on condition , Its working fine but the problem is it simply hide the field.

and showing me blank row for the condition which didn't met the condition.

 

I have pasted the code below.

 

apex:repeat value="{!PersonalinfoFields}" var="f">
<apex:repeat value="{!Fieldsconfig}" var="conf">
<tr><td> <p><apex:outputlabel value="{!f.label}" rendered="{!AND(a[conf.fieldPath]==true,f.label==conf.label)}" /></p></td><td><div style="margin-left:85px;"> <apex:inputField value="{!app[f.fieldPath]}" rendered="{!AND(a[conf.fieldPath]==true,f.label==conf.label)}" style="width: 250px; height: 20px; border:inset 2px;" id="fname"
/></div></td></tr>
</apex:repeat>
</apex:repeat>

 

Can anyone help me out of this.

 

Thanks in advance.

 

 

Hi everyone.

 

I have  requirement which is confusing me a lot.

 

I got the fieldset from 2 object( which is almost cloned one) and am putting that fields in 2 different list and processing that list and I have done the thing like passing the record from controller to vf page and processing but the situation i had is like processing inside controller itself and the code i have written ishere :

 

 

 public List<Schema.FieldSetMember> Fieldsconfig;

  public List<Schema.FieldSetMember> getFieldsconfig() {

       Fieldsconfig=SObjectType.Educationcenter__ApplicationConfig__c.FieldSets.Educationcenter__PersonalInformation.getFields();

       return null;

    }

  public List<Schema.FieldSetMember> PersonalinfoFields; 

  public List<Schema.FieldSetMember> getPersonalinfoFields() {

        PersonalinfoFields=SObjectType.Application__c.FieldSets.Educationcenter__PersonalInformation.getFields();

        return null;

    }

  public List<Schema.FieldSetMember> sampleFields;

  public List<Schema.FieldSetMember> getsampleFields()

  {

  for(Schema.FieldSetMember s:Fieldsconfig)

  {

  for(Schema.FieldSetMember sp:PersonalinfoFields)

  {

  if(a.sp==true)                     the error am getting is here ,.... compiler didn't mean to recognize this.

 

                                              actually a is querey record from sp object . 

  {

 sampleField.add(sp)

  }

 

  }

  }

 

  return sampleFields;

  }

 Can anyone help me out of this. Is there any other way to do the same .

 

Thanks in advance

Hi all,

 

I have been working with Live agent implementation for force.com site, I have successfully created the deployment and button code and paste that in the force.com site.

 

Its working fine in force.com site and i wish to move the same for my customer portal and let my customer use the live agent feature of salesforce.

 

I have make the code in the text file and put that in a document and used the file in the footer of the customer portal look and feel section.

 

I couldnt make the code working but the same is working for force.com site.

 

Can anyone help me out of this.

 

Thanks in advance.

 

Hi all,

 

I have been trying to integrate salesforce with java. 

 

I got the wsdl (enterprise wsdl ) file from my developer org and  i wish to use that wsdl file in eclipse to convert that to java class and accessing that class in my java application.

 

I have used salesforce session which speaks about the integration between salesforce and java as reference.

 

I am moving forward as per the thing discussed in that session. I have downloaded the wsdl file and make it in the src folder of my java application. 

 

On the way to parse the wsdl file , I have tried to create the external tool in eclipse , I have given the location and working directory in that perfectly and 

 

I dont what to do with arguement variable and i am facing the problem right here.

 

So it didn't let me to run the external tool so the wsdl file will be converted to java class.

 

Can anyone help me out of this.

 

Thanks in advance

Hi all,

 

I have written a trigger which will fetch the email field from contact and put it in email field in opportunity everytime after insert.

 

It doesn't work for myself. Its working only on workemail is selected and i am unable to guess where i am going wrong.

 

can anyone help me out of this.

 

trigger EmailRemainder on Opportunity (after insert)
{

Set<Id> ids=trigger.newmap.keySet();

List <OpportunityContactRole> ocr;
List<Contact> c;
List <Opportunity> op;
List <Opportunity> opList = new List<Opportunity>();
op=[select EmailRemainder__c from Opportunity where Id IN : ids];
ocr=[Select ContactId From OpportunityContactRole where OpportunityId IN : ids ];
if(ocr.isEmpty())
{

}
else
{
for(OpportunityContactRole r:ocr)
{

c=[select npe01__Preferred_Email__c,npe01__WorkEmail__c,npe01__AlternateEmail__c,npe01__HomeEmail__c from Contact where ID=: r.ContactId ];
}
for(Contact cc : c)
{
if(cc.npe01__Preferred_Email__c=='')
{
}
if(cc.npe01__Preferred_Email__c=='Work')
{
for(Opportunity ops:op)
{
for(Contact ci : c)
{
ops.EmailRemainder__c = ci.npe01__WorkEmail__c;
opList.add(ops);
}
}
update opList;
}
if(cc.npe01__AlternateEmail__c=='Alternate')
{
for(Opportunity ops:op)
{
for(Contact ci : c)
{
ops.EmailRemainder__c = ci.npe01__AlternateEmail__c;
opList.add(ops);
}
}
update opList;
}
if(cc.npe01__HomeEmail__c=='Personal')
{
for(Opportunity ops:op)
{
for(Contact ci : c)
{
ops.EmailRemainder__c =ci.npe01__HomeEmail__c;
opList.add(ops);
}
}
update opList;
}
}

}
}

 

Thanks in advance

Hi All ,

 

I have written this trigger . Its working fine for the single record and i am not sure with whether this trigger work well for bulk operation .

 

I don't know whats work with it. Can anyone help me out of this.

 

 

trigger EmailRemainder on Opportunity (after update)
{

Set<Id> ids=trigger.newmap.keySet();
Set<Id> idd=new Set<Id>();

List <OpportunityContactRole> ocr;
List<Contact> c;
List <Opportunity>op;
op=[select EmailRemainder__c from Opportunity where OpportunityId IN : ids];
ocr=[Select ContactId From OpportunityContactRole where OpportunityId IN : ids ];
for(OpportunityContactRole r:ocr)
{
idd.add(r.ContactId);
}
c=[select npe01__WorkEmail__c from Contact where ID IN : idd ];
for(Opportunity ops:op)
{
for(Contact ci : c)
{
ops.EmailRemainder__c = ci.npe01__WorkEmail__c;

}

update ops;
}

}

 

Thanks in advance

 

Hi all,

I had a requirement to sort out the campaigns held at different states. 

 

I created 3 view which will sort out the campaign as per the 3 states.

 

But suddenly the requirement is changed to 50 states , so we can't create 50 views for that even if we can , it looks awkward.

 

So I tried to create visualforce page with controller that get State name as input and based on that  visualforce page will dynamically  fetch the records campaign at that particular state.

 

I tried to override this visualforce page with standard buttons and links , (LIST ) but i didn't show me the visualforce page there.

 

But the fact is that I can override the same visualforce page with VIEW standard button and I also tried to override them with new button. Both of them respond good . 

 

I dont' know why i am unable to do that with LIST Button.

 

My question is "Is it possible with LIST standard button (i mean override that button)

 

If not , Is there any other way to do that.

 

Thanks in advance.

Hi Everyone,

 

I have used vlookup function in excel and i don't how to use vlookup function in salesforce.

 

In Excel , I can fetch the values in particular cells with values to be entered in separate cell.

 

Can anyone tell me the way to use vlookup in SFDC.

 

Thanks in advance

Hi all, 

 

I have written a trigger on opportunity , whenever a record created on opportunity whose campaignId and Are you donor or vendor(custom field) is vendor.

 

Then Fields updates will be in custom object (junction object which will relate campaign and accoun ).

 

I don't whether my trigger work properly or not.

 

The doubt is I got the id of campaignId and AccountId in opportunity and put in a set and doing the process and there were no relationship between those set . 

 

can anyone tell me whether my trigger properly or not..

 

trigger VendorAmount on Opportunity (before insert) 
{
set<ID> cids = new set<ID>();
set<ID> aids = new set<ID>();
for (Opportunity t : trigger.new)
{
if (t.CampaignId!= null && t.Are_you_Donor_Vendor__c=='Vendor' )
cids.add(t.CampaignId);
aids.add(t.AccountId);
}
List<CampaignVendor__c> cv=[Select id, Campaign__c,vendoramount__c From CampaignVendor__c where Campaign__c =:cids and Account__c=:aids ];
for (Opportunity t : trigger.new)
{
 for(CampaignVendor__c cc:cv)
    {
    cc.vendoramount__c= t.Amount ;
    update cc;
    }
   
 }
}

 

 

Hi, 

  There is a custom object with name NSP__c When every object is either inserted or updated with values. I am firing a trigger to update 
Amount field in OpportunityLineItem Problem is value is not getting updated. I am not sure what is the issue. 

I tried creating a test field in opportunity to test this value is getting updated. Please suggest me how to fix this issue. 

trigger NSPActiveAmount on NSP__c (after insert,after update)
{
  List <Id> OpportunityIds = new List<Id>();

    for(NSP__c N : trigger.new)
    {
      OpportunityIds.add(N.Opportunity__c);
    }

  List <Opportunity> opiRecords = [SELECT test__c FROM Opportunity
                                             WHERE Id = :OpportunityIds];
 
   List <OpportunityLineItem> oliRecords = [SELECT UnitPrice FROM OpportunityLineItem
                                             WHERE OpportunityId = :OpportunityIds];
                                            
    List <NSP_Details__c>  NSPDetails = [ SELECT  Distributor_Requested_Unit_Price__c
                                          FROM NSP_Details__c
                                          WHERE NSP__c in ( SELECT ID FROM NSP__c
                                                            WHERE opportunity__c  = :OpportunityIds) ];
  
    for (Opportunity opp :opiRecords)
     {    
      for (OpportunityLineItem oppItem :oliRecords )
       { 
       for (NSP_Details__c NSP_Details :NSPDetails)
        {       
        opp.test__c = NSP_Details.Distributor_Requested_Unit_Price__c;
        oppItem.UnitPrice =  NSP_Details.Distributor_Requested_Unit_Price__c;                    
        }
      } 
   } 
  Update  opiRecords;
  Update oliRecords;                          
}

Thanks

Sudhir

Need Help: Child Object :-   Test_site_audience__c
                      Master Object :-  Site_Placement__c
Demo__c is multi picklist field on child object. Demo__c has three values 'all', 'Male 12-23','Female 12-23'. There is one more field on chiled object called Impression_share__c. Based on each Demo__c value , Impression_Share__c has some value. i have created a visual force page. I am trying to sum the IMPRESSION_SHARE__C based on whatever user selects in Multi select picklist field. Below is the SOQL query. It is working if user selects one value in multipicklist field. But it is not working if user selects more than one value . Below is SOQL query.


Sumofimpressionshare = (Decimal)([ SELECT sum(Impression__share__c) FROM
             Test_site_audience__c Where (demo__c includes (:test.demo__c)) AND  site_placement_lookup__c in (select id FROM Site_Placements__c WHERE((Ad_Positioning__c like :matchString3)AND (Inventory_Type__c like :matchString4)AND (Language__c like :matchString5)AND (Flagged__c like :matchString6) ) )][0].get('expr0'));
This is in regards to dynamic search .

I have two date fields

When i print the SOQL , the Date fields as seen from the soql below are string.

I tried converting to date in the format 1-12-2014 but have been unsuccessful.

any ideas? Thanks.

Debug - SOQL

select Name,Branch__c,  Order__c,Status__c,TC_Date__c,Report_Date__c from Transaction__c Where Transaction__c.name!=null and Branch__c LIKE '%' and Report_Date__c = '1/12/2014' order by Branch__c asc limit 1000
Hi Everyone.

Recently i tried to insall chatter desktop , it just show me this error ,

Installer file broken and ask me to bring the new  installer file from the provider, Adobe AIR is installed properly in my machine.

Did anyone faced the same issue.
Hi Everyone,

I would like to know about the scenario where exactly service contract and entitlement management are used. and How they are related to each other. 

I could a sales rep work with service contracts and entitlment in real time. 

Thanks & Regards
Mariappan Perumal
Need to get code coverage .Test class is getting passed. But it is not calling ther method
"
global void execute(Database.BatchableContext bc, List<case> caselist) ". Coverage is only 45%.

Please suggest me , how to get the 75%%coverage..
Class:


global class  BatchUpdateCase implements Schedulable, Database.Batchable<sObject> {
    public void execute(SchedulableContext ctx) {
        run();
    }

    public static void run() {
        Database.executeBatch(new BatchUpdateCase());
    }

     global Database.QueryLocator start(Database.BatchableContext bc)
    {
       
        return Database.getQueryLocator([select id,SuppliedEmail__c from Case Where SuppliedEmail__c = 'km@gmail.com' AND Test_Record__c = false]); 
    }

global void execute(Database.BatchableContext bc, List<case> caselist){
    
      for(case cas:caselist)
      {
          cas.Test_Record__c=TRUE;
      System.debug('### Test Record Updated');
      }
      
       update caselist;
}
    global void finish(Database.BatchableContext BC) {
      
    }
}



Test Class:

@isTest(SeeAllData=true)
public class  batchUpdateCaseTestClass {

    private static testMethod void testBatch() {
   
        Case cas=new Case();
        cas.SuppliedEmail__c = 'km@gmail.com' ;
        cas.Test_Record__c = false;

            insert cas;

         Test.startTest();

        BatchUpdateCase.run();

        Test.stopTest();

     
      
    }

   
}

hi friends

can anyone tell me...

what is the error we get when we use soql quiry in any for loop?

thnks

I am trying to create a trigger that will populate a custom lookup field (Opportunity1_c) to Opportunities on Opp Team  with the value of the Opp that the Team Member is being added onto.

 

The reason being that I want to run workflows etc off the vlaues from the parent Opp but it cant be got to by standard methods - can this be done with a trigger?

 

 I have started to try and code one but my skills are not the best. Any help would be appreciated 

 

Here is what I have come up with so far 

 

trigger Opp_Team on OpportunityTeamMember (before insert, before update) {

Map <String, Opportunity > OppMap = new Map <String, Opportunity>();
for (Opportunity p : [SELECT Id, Name from Opportunity])
{
OppMap.put(p.Name,p);
}

for (OpportunityTeamMember a: Trigger.new)
{
a.Opportunity1__c = OppMap.get(Opportunity);
}


}

  • November 26, 2013
  • Like
  • 0

Hi All,

 

Please help me on bellow error

 

Error: Compile Error: Initial term of field expression must be a concrete SObject: List<New__c> at line 17 column 33

 

R_Type__c is picklist filed

 

trigger Updateallcases on Case (after insert) {
 
  List<Case> updatedCases=new List<Case>();
  List<RecordType> recType = [select id from RecordType where name = 'New Rec' AND sobjecttype = 'Case' AND IsActive = TRUE limit 1];
  List<New__c> customSettingMap = New__c.getall().values();
 
  if(!recType.isempty())
  {
   String RecordTypeAid = rectype[0].id;
   for(case c : Trigger.new)
   {
     if(c.RecordTypeId == RecordTypeAid )
     {
          if(c.Comments__c == customSettingMap.External__c)
          {
            c.R_Type__c = customSettingMap.Case_Type__c;
            updatedCases.add(c);
          }
        
     }
 
   }
  }
  Update updatedCases;
}

  • October 22, 2013
  • Like
  • 0

Hi All

 

              I am tryign to use like this. Can I Use this.

 

Select id, Name, (Select id,name,CreatedDate from Contact ORDER BY CreatedDate LIMIT 5) from Account.

 

How Can I use Limit With in the SubQuery Is it possible.

 

Regards

Venkat

Hi can any body help me in this,

I have multiselect picklist values of countries in account object and same  field i created in opportunity object,

i need display only selected values of multiselectpicklist from account on Opportunity object, both are in same vfpage and i need to save also in opportunity....

 

Advanced thanks its very urgent......

  • October 06, 2013
  • Like
  • 0

If you don't want to hard code your recordtype ids in a SOQL query, here is an example on how to query using the record type name:

 

Select id, name,  type, RecordType.Name, AMOUNT, closedate, stagename

FROM Opportunity
WHERE recordtypeid in (Select Id From RecordType where sobjecttype = 'Opportunity' and name in ('Daily Open Quote Record Type', 'Prospect Record Type'))
limit 100

trigger OnAccount_ConfirmToChange on Account (before update) {
  List<Account> accList = [select Id,Name,(select AccountId,Name from Contacts) from account where Id =                 :Trigger.newMap.keySet()];
// Map<Id,Contact> conMap = new Map<Id,Contact>([select Id from Contact where AccountId in: accList.Id]);
List<Contact> conList = [select Name,isAccountChanged__c from Contact where AccountId in: accList];
for(Account acc:accList){
for(Contact con:conList){
if(conList.size() > 0){
if(con.isAccountChanged__c == false){
Account ar = Trigger.oldMap.get(acc.Id);
ar.addError('Only if the isAccountChanged is checked,You can modify the account!');
}
}
}
}
}

  • September 05, 2012
  • Like
  • 0
I created a simple Visualforce page using the standardController for Contact to display Account information and included it on the contact page layout.  It worked fine until I recevied my email this morning that Person Accounts have been enabled in my developer organization.  Now the contact page displays the native contact information correctly but produces the following error in the section where the custom page should appear:
 
"SObject row was retrieved via SOQL without querying the requested field: IsPersonAccount"
 
 
I have included a scaled down version of the custom page as a reference.
 
Code:
<apex:page showHeader="false" sidebar="false" standardController="Contact">
<apex:pageBlock>
 <apex:outputField value="{!contact.Account.Name}"/> 
</apex:pageBlock> 
</apex:page>

 

Since Person accounts were just enabled in my organization none of the contact records are "PersonAccounts"

thanx.



Message Edited by thedge on 12-11-2007 02:55 PM
  • December 11, 2007
  • Like
  • 0

This is actually a confirmation to SFDC (so if some God in the SFDC heaven or any other wild heaven is watching me, please answer to my question...)

I got an parse error when I tried to generate apex class from WSDL by WSDL2APEX.

 

Error: Unable to find schema for element; {http://www.w3.org/2001/XMLSchema}string

like this post: http://community.salesforce.com/sforce/board/message?board.id=general_development&message.id=28929

Long story in short, I found the reason. Request/Response message doesn't accept just a xsd:string. It has to be complexType.

This post

http://community.salesforce.com/sforce/board/message?board.id=apex&message.id=2058

mentioned that SFDC doesn't support simpleType restriction, but I wonder it also mens it doesn't support single-standard type Request/Response.

 

Question: Am I correct? which means there is no way to use this WSDL? (this WSDL is from a product, so I can't change the actual format... only way to use this is to create a custom HTTP request...)

 

So, this doesn't work, because SessionID is xsd:string.

<definitions xmlns:tns="http://www.hoge.com/hoge/Object"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
name="Companies"
targetNamespace="http://www.hoge.com/hoge/Object">
<types>
<xsd:schema elementFormDefault="qualified" targetNamespace="http://www.hoge.com/hoge/Object">
<xsd:element name="Login">
<xsd:complexType>
<xsd:sequence>
<xsd:element minOccurs="1" name="Username" type="xsd:string"/>
<xsd:element minOccurs="0" name="Password" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="SessionID" type="xsd:string"/>
</xsd:schema>
</types>
<message name="Login">
<part element="tns:Login" name="parameters"/>
</message>
<message name="LoginResponse">
<part element="tns:SessionID" name="body"/>
</message>

<portType name="CompaniesPort">
<operation name="Login">
<input message="tns:Login"/>
<output message="tns:LoginResponse"/>
</operation>
</portType>
<binding name="CompaniesSoapBinding" type="tns:CompaniesPort">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="Login">
<soap:operation soapAction="https://morethan/foo/bar/Login" style="document"/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
</binding>
<service name="CompaniesService">
<port binding="tns:CompaniesSoapBinding" name="CompaniesService">
<soap:address location="https://morethan/foo/bar"/>
</port>
</service>
</definitions>

 This works because LoginOut is complexType.

<definitions xmlns:tns="http://www.hoge.com/hoge/Object"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
name="Companies"
targetNamespace="http://www.hoge.com/hoge/Object">
<types>
<xsd:schema elementFormDefault="qualified" targetNamespace="http://www.hoge.com/hoge/Object">
<xsd:element name="Login">
<xsd:complexType>
<xsd:sequence>
<xsd:element minOccurs="1" name="Username" type="xsd:string"/>
<xsd:element minOccurs="0" name="Password" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="LoginOut">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="SessionID" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>

</xsd:schema>
</types>
<message name="Login">
<part element="tns:Login" name="parameters"/>
</message>
<message name="LoginResponse">
<part element="tns:LoginOut" name="body"/>
</message>
<portType name="CompaniesPort">
<operation name="Login">
<input message="tns:Login"/>
<output message="tns:LoginResponse"/>
</operation>
</portType>
<binding name="CompaniesSoapBinding" type="tns:CompaniesPort">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="Login">
<soap:operation soapAction="https://morethan/foo/bar/Login" style="document"/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
</binding>
<service name="CompaniesService">
<port binding="tns:CompaniesSoapBinding" name="CompaniesService">
<soap:address location="https://morethan/foo/bar"/>
</port>
</service>
</definitions>
ThomasTT