• Bhanu Mahesh
  • SMARTIE
  • 1767 Points
  • Member since 2015

  • Chatter
    Feed
  • 57
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 1
    Questions
  • 224
    Replies
Hi,

I would like to know how I can retrieve a Case Object based on the Attachment Parent ID (Trigger). Been trying to do so but not making any progress. Would appreciate some advice on how I can go about doing so~!

Cheers
HI Experts,

i need to write a forumla like this, could you guys me shape for this please

IF Date Assessed/ Rejected = NULL AND If (Related) tRIIO_Application.Days Left for Approval <= 0 Then
Forecast D+12 = Today() 
IF Date Assessed/ Rejected = NULL AND If (Related) tRIIO_Application.Days Left for Approval > 0 THEN
( TODAY() + Application_Ref__r.Days_Left_for_Approval__c ))
ELSE
Forecast D+12 = Date Assessed/ Rejected,

 existing forumala: IF( Application_Ref__r.Days_Left_for_Approval__c >=0, TODAY() ,( TODAY() + Application_Ref__r.Days_Left_for_Approval__c ))

could any one tell me how to write for this , thanks in advance
Hi,

I have tried to create the tasks via Workflow in ( managed package object) this particular custom object  only not visible in action drop down. other objects having the task in workflow action drop down. Is any customization need to get this or any think else have to do. Guide me to solve this issue as earely as possible. 
 Thanks 
Maheshwar
Screen Shot: 
User-added image
I'm open to using either a trigger or Flow. I've been trying to do it as a Flow, but I'm getting stuck on getting it to loop through everything and can only get it to create a Demographic for the first Qualification in the list. I'm sure it's something in how to set the Loop and Assign. But I'm more familiar with Apex triggers, so I'm happy to go back to that.

This scenario uses 3 objects: Opportunity, Qualification, and Demographic. 
  • Qualifications have a picklist field called Default_Country__c
  • On Opportunities, the user selects their country from a picklist field Country__c
  • Demographics have a lookup to both Qualification and Opportunity.
I want when an Opportunity is created, for any Qualifications where Default_Country__c matches the Opportunity__c, a Demographic is created. My brain is a bit fried on this so I could use a bit of guidance. 

Thanks!
Hi,

I am getting the above error after cllicking on the (C2F) button. The debug logs are showing "successful" callout to webservice.


Apex Class from WSDL
 
//Generated by wsdl2apex

public class TmpCnv {
    public class FahrenheitToCelsiusResponse_element {
        public String FahrenheitToCelsiusResult;
        private String[] FahrenheitToCelsiusResult_type_info = new String[]{'FahrenheitToCelsiusResult','http://www.w3schools.com/webservices/',null,'0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://www.w3schools.com/webservices/','true','false'};
        private String[] field_order_type_info = new String[]{'FahrenheitToCelsiusResult'};
    }
    public class CelsiusToFahrenheitResponse_element {
        public String CelsiusToFahrenheitResult;
        private String[] CelsiusToFahrenheitResult_type_info = new String[]{'CelsiusToFahrenheitResult','http://www.w3schools.com/webservices/',null,'0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://www.w3schools.com/webservices/','true','false'};
        private String[] field_order_type_info = new String[]{'CelsiusToFahrenheitResult'};
    }
    public class FahrenheitToCelsius_element {
        public String Fahrenheit;
        private String[] Fahrenheit_type_info = new String[]{'Fahrenheit','http://www.w3schools.com/webservices/',null,'0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://www.w3schools.com/webservices/','true','false'};
        private String[] field_order_type_info = new String[]{'Fahrenheit'};
    }
    public class CelsiusToFahrenheit_element {
        public String Celsius;
        private String[] Celsius_type_info = new String[]{'Celsius','http://www.w3schools.com/webservices/',null,'0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://www.w3schools.com/webservices/','true','false'};
        private String[] field_order_type_info = new String[]{'Celsius'};
    }
    public class TempConvertSoap {
        public String endpoint_x = 'http://www.w3schools.com/webservices/tempconvert.asmx';
        public Map<String,String> inputHttpHeaders_x;
        public Map<String,String> outputHttpHeaders_x;
        public String clientCertName_x;
        public String clientCert_x;
        public String clientCertPasswd_x;
        public Integer timeout_x;
        private String[] ns_map_type_info = new String[]{'http://www.w3schools.com/webservices/', 'TmpCnv'};
        public String FahrenheitToCelsius(String Fahrenheit) {
            TmpCnv.FahrenheitToCelsius_element request_x = new TmpCnv.FahrenheitToCelsius_element();
            request_x.Fahrenheit = Fahrenheit;
            TmpCnv.FahrenheitToCelsiusResponse_element response_x;
            Map<String, TmpCnv.FahrenheitToCelsiusResponse_element> response_map_x = new Map<String, TmpCnv.FahrenheitToCelsiusResponse_element>();
            response_map_x.put('response_x', response_x);
            WebServiceCallout.invoke(
              this,
              request_x,
              response_map_x,
              new String[]{endpoint_x,
              'http://www.w3schools.com/webservices/FahrenheitToCelsius',
              'http://www.w3schools.com/webservices/',
              'FahrenheitToCelsius',
              'http://www.w3schools.com/webservices/',
              'FahrenheitToCelsiusResponse',
              'TmpCnv.FahrenheitToCelsiusResponse_element'}
            );
            response_x = response_map_x.get('response_x');
            return response_x.FahrenheitToCelsiusResult;
        }
        public String CelsiusToFahrenheit(String Celsius) {
            TmpCnv.CelsiusToFahrenheit_element request_x = new TmpCnv.CelsiusToFahrenheit_element();
            request_x.Celsius = Celsius;
            TmpCnv.CelsiusToFahrenheitResponse_element response_x;
            Map<String, TmpCnv.CelsiusToFahrenheitResponse_element> response_map_x = new Map<String, TmpCnv.CelsiusToFahrenheitResponse_element>();
            response_map_x.put('response_x', response_x);
            WebServiceCallout.invoke(
              this,
              request_x,
              response_map_x,
              new String[]{endpoint_x,
              'http://www.w3schools.com/webservices/CelsiusToFahrenheit',
              'http://www.w3schools.com/webservices/',
              'CelsiusToFahrenheit',
              'http://www.w3schools.com/webservices/',
              'CelsiusToFahrenheitResponse',
              'TmpCnv.CelsiusToFahrenheitResponse_element'}
            );
            response_x = response_map_x.get('response_x');
            return response_x.CelsiusToFahrenheitResult;
        }
    }
}

VisualForce Controller
public class TmpCntrl {

    Public String Celsius{get;set;}
    Public String Fahrenheit{get;set;}
    Public String FResult{get;set;}
    Public String CResult{get;set;}
    
    PageReference pageRef = ApexPages.currentPage();
    TmpCnv.TempConvertSoap TC = new TmpCnv.TempConvertSoap();
      
    public string FCalculate() {
        FResult = TC.CelsiusToFahrenheit(Celsius);
        return null;
    }
    
    public String CCalculate() {
        CResult = TC.FahrenheitToCelsius(Fahrenheit);
        return null;
    }
}

VisualForce Page
<apex:page controller="TmpCntrl">
    <apex:form >
        <apex:inputText value="{!Celsius}"/>
          <p>{!FResult}</p> 
        <apex:commandButton value="C2F" action="{!FCalculate}" rerender="all" >
            <apex:param name="Celsius" value="{!Celsius}" assignTo="{!FResult}"/>
        </apex:commandButton>
    </apex:form>
</apex:page>
Please give me some light.

Thanks.
Hi.

I would like to create a new field in the task that contain an information already present in the case.
For example: I would lile to add in the task view the case record type.

I can creat a customized field in the task but I am not able to relate this field with the Case record type.

I think is not so hard but I am a principiant :(

Thanks!!
 Is there way where i can call the javascript from controller ?  I want to execute a javascript when the controler function ends
  • March 20, 2015
  • Like
  • 0
I am trying to copy multi-select picklist values into a Long Text Area field. The issue I am running into is I'm able to copy over a single value, but when multiple values are selected it throws an error.
User-added image
How can I split the String value so that the selection is copied into the Long Text Area with line breaks as follows:
Germany
Kentucky

Here's my code:
public class updateMultiSelectPicklistField {
    public static void updateMSelectPickField (ContentVersion[] ContentVersion1){
        for(ContentVersion c: ContentVersion1){        
            c.Main_Offices__c = c.Office__c;  
        }
    }
}
and trigger:
trigger updatefields on ContentVersion (before insert, before update) {
    ContentVersion[] ContentVersion1 = Trigger.new;
    updateMultiSelectPicklistField.updateMSelectPickField(ContentVersion1);
}


 
Problem is in the one of the formula field.

Its automatically calculating values and displaying "INR 0.00".

But i dont want to display this formula field, if the output is INR 0.00.

But its recognizing this value and rendering in it pdf, how to avoid this issue.
 
  <tr style="display: {!IF(ISBLANK(Quotation__c.Sub_Total2__c), 'none', 'table-row')};">
  <td align="right" colspan="8"><b>Sub Total ({!Quotation__c.CurrencyIsoCode}) : </b></td>
  <td align="right" >{!Quotation__c.Sub_Total2__c} </td>
  </tr>
  
  <tr style="display: {!IF(ISBLANK(Quotation__c.Discount2__c), 'none', 'table-row')};">
  <td align="right" colspan="8"><b>Discount ({!Quotation__c.CurrencyIsoCode}) : </b></td>
  <td align="right" >{!Quotation__c.Discount2__c} </td>
  </tr>
  
  <tr style="display: {!IF(ISBLANK(Quotation__c.Total2__c), 'none', 'table-row')};">
  <td align="right" colspan="8"><b>Total ({!Quotation__c.CurrencyIsoCode}) : </b></td>
  <td align="right" >{!Quotation__c.Total2__c} </td>
  </tr>

Formula fields are "Total2__c, Discount2__c, Sub_Total2__c"
<apex:page controller="VF10ActionRegion_Control" >
    <apex:form >
    <apex:pageMessage id="MyMess" severity="info"></apex:pageMessage>

        <apex:outputText >Account Name:</apex:outputText>
        <apex:actionRegion >

        <apex:InputText value="{!recAccNo}"/>
        <apex:commandButton action="{!recordFill}" value="Search"/>
        
        <apex:pageBlock >
        <apex:pageBlockSection >
        <apex:pageBlockTable value="{!accObj}" var="a">
 <table>
 <tr>
<td> <apex:outputLabel value="Account Type"> </apex:outputLabel> </td>
<td> <apex:inputField value="{!a.name}"/> </td>
</tr>
</table>
        
            <apex:outputField value="{!a.name}"/>
        
          <apex:outputText value="{!a.name}"/>
          </apex:pageBlockTable>
        </apex:pageBlockSection>

         </apex:pageBlock>
        </apex:actionRegion>

    </apex:form>
</apex:page>

***********************************
public class VF10ActionRegion_Control {

  Public String recAccNo{set; get;}
  Public List<Account> accObj{ get; set;}

    public void recordFill() {
       If(recAccNo != null && recAccNo != ''){
           accObj = [Select name from Account where name =: recAccNo];
           system.debug(accObj);
           
        }else{
         accObj = null;
        }
    }

}
Hi All,
I am new to sfdc and I am trying to achieve something that would be a novice task for most of you.

I have a checkbox in a vf page, now when the checkbox is checked I want to make a textbox visible. And similarly whenever the box will be unchecked, the textboxes must be hidden. 

Many thanks in advance in this regard.
Hi folks!
My requirement
my apec class is
public class fetch {
   public String accountname{set;get;}
    public string destquery{set;get;}
    public List<customer__c> cust{set;get;}
    public fetch(){
       string accountname;
        cust=new List<customer__c>();
    }
    public void show(){   
        destquery='select Balance__c,City__c,State__c from Customer__c where name=\'' +accountname+'\'';       
    }
}

My vf page is
<apex:page controller="fetch">
    <apex:form >
    <apex:pageBlock >
        <apex:outputLabel value="Name" /><apex:inputText >{!accountname}</apex:inputText>
        <apex:commandButton value="Ok" action="{!show}"/>
    </apex:pageBlock>
        <apex:pageBlock >
      <!--    <apex:pageBlockTable value="{!destquery}" var="a">
               <apex:column value="{!a.Balance__c}" /> 
                 <apex:column value="{!a.City__c}" />
                 <apex:column value="{!a.State__c}" />          
            </apex:pageBlockTable> -->
           {!accountname}
        </apex:pageBlock>
    </apex:form>
</apex:page>

butI'm not getting the fetching records pls help where I done wrong.

Thanks in Advance
  • March 18, 2015
  • Like
  • 0
Hello. I'm posting here as I used code from here as my starter for one of the standard zip code issues. In my instance, the sales and customer service teams have requested a field where the agent assigned to a particular zip code is returned. These assignments can differ based on line of business, but they are supposed to be unique.  It cannot be a straight lead assignment rule, as the rules are ... porous. Here is where I am at:
  1. Custom object created. It has 5 fields: zip code, assigned agent, line of business, and 2 fields used for duplicate checking.
  2. Workflow that populates one of fields from another formula field. The workflow target field is a text(unique), so it causes a failure as planned if the zip code and line of business combination is already found.
  3. All of my sample data was uploaded using Dataloader.io. This was necessary over the standard import tool because the Assigned Agent field is a lookup to User.
  4. Apex target field was created on Lead (Agent for Zip Code). Rather than do a standard lead assignment rule, I will need to place in the suggestion of who the lead owner should be.
  5. The last step, the Apex code, has been started. That is where I am currently stuck.
When I add a record without a zip code, it works fine as it escapes out of the code as designed. When I add a record with an invalid zip code (not assigned), same story. When I hit the positive test, I'm encountering an error. Basically it is trying to insert the entire array. I cannot seem to figure out why. I know it's just something I'm doing wrong, but I can't seem to nail it down. I have had the code through about a hundred permutations (no joke) and have dug around a lot of Salesforce support sites. No luck so far.

If I run the original code found here (https://developer.salesforce.com/forums/ForumsMain?id=906F0000000Af9nIAC), it pastes in the ID instead of the name. I need the literal name. My code (below) errors out as follows: "Zip_Code_Agent_Populate: data changed by trigger for field Agent for Zip Code: data value too large: (User:{Name="Agent Name", Id=00540000002oOO3AAM}) (max length=40)". FYI, I replaced "Agent Name" here, but it is the name I'm looking for when running the code.

Help in resolving this array woe would be greatly appreciated. The code is below.

trigger Zip_Code_Agent_Populate on Lead (before insert) {
  List<Lead> leadsToUpdate = new List<Lead>();
    for (Lead lead : Trigger.new)
    {   
      if (lead.PostalCode != NULL)
      {
          // Find the sales rep for the current zip code
          List <Zip_Code__c> zip = [select Assigned_Agent__c from Zip_Code__c
                                      where Zip_Code__c = :lead.PostalCode
                                      and Line_of_Business__c = :lead.Lead_Line_of_Business__c
                                      limit 1];    
          // if you found one
          if (zip.size() > 0)
          {  
              //find the name literal from the user ID
              String agentName = '' + [SELECT Name FROM User WHERE Id =: zip[0].Assigned_Agent__c limit 1];
              //assign the lead owner suggestion to the agent for zip code field
              lead.Agent_for_Zip_Code__c = agentName;
              //lead.Agent_for_Zip_Code__c = zip[0].Assigned_Agent__c; -- this code returns only the ID
              leadsToUpdate.add(lead);
          }
       }
Hello Experts,
I would like to create a custom button(OnClick JavaScript) in the Contact detail page and when we click on it, it sends an email template capturing the information of that paricular contact.

How can I do this? Any code would be very much appreciate it!

Thanks!
I need to geenrate a report with Count /List of opportunities where Opportunity team member is not added. How can i do this without customization?

I am able to generate opportunitieis with team members and thier count.
I have an Apex Class to send an Email to someone as a Contact.
I want to send the 'Email' and the 'FirstName' fields of a particular Contact associated to a Task as parameters to the Apex Class when I click the Custom Button - 'Send' on the task detail page, so that I can send the email from the Apex Class using these field values.

My Apex Class : 
 
global class TestMailClass
{
    WebService static Integer TestMailMethod(String emailAddress, String fname1)
    {
          // Create a new Email
          
          Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();

 
      String[] toAddresses = new String[] {emailAddress};
      mail.setToAddresses(toAddresses);
    
      // Set who the email is sent from
      mail.setReplyTo('myemail@abc.com');
      mail.setSenderDisplayName('ABC');
    
      // Set email contents - used variables!
      mail.setSubject('TEST EMAIL');
      String body = 'Dear ' + fname1 + ', ';
      body += 'This is a sample mail that I am trying for the first time.';
      body += 'I write to send a random email ';
      mail.setHtmlBody(body);
    
    Messaging.sendEmail(new Messaging.SingleEmailMessage[] {mail});
    
    return 0;

    }

}

My Custom Buttom in Task :
 
{!REQUIRESCRIPT("/soap/ajax/14.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/14.0/apex.js")}

var cntct = new sforce.SObject("Contact");

cntct.Id = "{!Contact.Id}";

var eid = new String(cntct.Email);
var fname = new String(cntct.FirstName);

var result = sforce.apex.execute("TestMailClass", "TestMailMethod",{emailAddress:eid, fname1:fname});

The problem here is the variables 'eid' and 'fname' remains undefined and is not passing into the Apex Class.
Need some help on this. Hope I made the question clear.
Hello,

I have a snippet like below,
public with sharing class customClass{

	public List<CustomClassOne> x{get;set;}

	public customClass(){
		x = Select column1 From CustomClassOne; 

		for(CustomClassOne counter : x) {
			Integer i;
			i = Select count() From CustomClassTwo where column2=counter; 
		}
	} 
}
How can i set column2=counter in where clause ?
  • March 13, 2015
  • Like
  • 0
I have a custom object called Address that has a picklist called Address Type. I need to prevent a record from saving with the Address Type of "Home" if a record for that specific parent object already has an Address record with the Address Type of "Home". How can I create that validation rule?

Let me know if you need more info and please keep in mind that I have 0 Apex coding knowledge.  Thanks!
All,

I need some help with some Apex coding since I am a beginner and I appreciate all help. I have tried to modfiy the coding completed by another developer but it is not working.

below are the object and fields that will be involved with the trigger

Object
Opportunities

Field 
Engagement_Total_Fees__c  (Currency(16, 2) - label name Engagement

Custom Object
Matter__c

Fields
Total_Fees__c    (Currency(16, 2) 
Deal__c  Lookup(Opportunity) 

Schema below - Lookup relationship from Matters__c (object label Engagement)
User-added image

Request.

When a  record is updated, created, or deleted in the Total_Fees__c field in Matter__c object, I want a total sum in Total_Fees__c field to be inserted in the Engagement_Total_Fees__c field within the related Opportunity.

Will it best to place this trigger in Opportunities Or Matter__c object? 

I appreciate all of your help.

Regards


 
Hi All,

I am trying to seach for feedItems unser a specific topic in a community. But I am getting the below error

"Search is not supported for this feed type"

There is a method in ConnectApi to search for feeds under a specific topic.

searchFeedElementsInFeed(communityId, feedType, subjectId, q)

But when pass the query string I am getting exceprion.

If I pass null, then I am getting the feedelements under the topic.

I need to search for feedItems under the specific topic using the search string.

Please help in resolving this
String communityId = 'Id of community';
String q = 'test';
String topicId = 'Id of Topic';
ConnectApi.FeedElementPage topicsFeedElementPage = ConnectApi.ChatterFeeds.serchFeedElementsInFeed(communityId , ConnectApi.FeedType.Topics,topicId,q);
Thanks in Advance
 
HI All,

 I am executing below code. 

global class CustomIterable implements Iterator<Object>{ 
   List<Account> accs {get; set;} 
   List<Object> listOfAccounts {get; set;}
   Integer i {get; set;} 
   global CustomIterable(){ 
       string s = '{"d":[{"Sede":"Crai","Cedi":"A.R.Ce.V","CodECR":"0010001","IDPV":1,"IDNielsen":"","CodAgente":"","RagSoc":"Punto vend. 1","PartitaIVA":""},{"Sede":"Crai","Cedi":"A.R.Ce.V","CodECR":"0010001","IDPV":1,"IDNielsen":"","CodAgente":"","RagSoc":"Punto vend. 1","PartitaIVA":""}]}';
       Map<String, Object> m = (Map<String, Object>) JSON.deserializeUntyped(s);
       List<Object> listOfAccounts = (List<Object>) m.get('d');
       System.debug('Size Of Account oBjects:' + listOfAccounts.size());
       accs = [SELECT id, name, numberofEmployees FROM Account LIMIT 10]; 
       //System.debug('size of Total Account List:' + accs.size());
       i = 0; 
   }   
   global boolean hasNext(){ 
       System.debug('Size of ListOfAccounts:' + listOfAccounts.size());
       if(i >= listOfAccounts.size()) 
           return false; 
       else 
           return true; 
   }    
   global Object next(){ 
       i=i+1; 
       return listOfAccounts[i-1]; 
   } 
}

I am getting the below error on line System.debug('Size of ListOfAccounts:' + listOfAccounts.size());
FATAL_ERROR System.NullPointerException: Attempt to de-reference a null object

I cab get the size of list listOfAccounts in cinstructor. However, I am getting the error on mentioned line.

Please help me resolve this query.

Thanks,
Nikhil Khandare
Hi all,

When I am closing the case, I want to create case comment for that particular case, when I am editing the same closed case I don’t want to create another case comment.

So, can you help me out to write trigger for this.
 
Hello,

I want to implement a functionality
Where on a button click Phone number field will eliminate non-numeric values
There are phone numbers like 030 / 3906 345-61 ,07272 / 7704 1245 O etc,I want to eliminate all non-numeric values in these numbers.
Any sample code snippet on this.

Thanks,
Tejas
I have a requirement. Contact related to activity, I need to pull his functional role ( custom field) on Activity page layout. So whenever I create an activity and relate with ant contact so his/her functional role should populate automatic.

Please help! How can I achieve it? I tried formula field but unable to get. I tried through trigger but it is not updating the field.
 
trigger updatefunctionalrole on Event (before insert, before update) {
// Create a map between the contact ID and its functional role value
Map<ID,String> confunrole = new Map<ID,String>();
List<Event> conEvents = new List<Event>();

// Loop through the triggered Events and add all of the contact IDs (for those associated with conortunities)
for (Event e : trigger.new) {
    // Only Events associated with contact
    if (e.whoID!= null && ((String)e.whoID).startsWith('003 ')) {
        // And only newly inserted events or those being reparented to an contact
        if (trigger.isInsert || (trigger.isUpdate && e.WhoID != trigger.oldMap.get(e.id).WhoID)) {
            confunrole.put(e.whoID,'');
            conEvents.add(e);
        }
    }
}
// Query the contact and add their functional role to the map
for (contact con : [SELECT Functional_Role__c FROM contact WHERE ID IN :confunrole.keySet()]) {
    confunrole.put(con.id,con.Functional_Role__c);
}
// Update the contact functional role field on the Event with the relevant value
for (Event e : conEvents) {
    e.contact_functional role__c = confunrole.get(e.whoID);
}
}

 
  Error: Invalid Data. 
Review all error messages below to correct your data.
Apex trigger myruchika.contact caused an unexpected exception, contact your administrator: myruchika.contact: execution of AfterUpdate caused by: System.NullPointerException: Attempt to de-reference a null object: Class.myruchika.contact1.Managefeeonupdate: line 48, column 1



public void onafterupdate(list<contact>Triggernew,list<contact>Triggerold,map<ID,contact>Triggernewmap,map<ID,contact>Triggeroldmap)
{
  Managefeeonupdate(TriggerNew,Triggeroldmap);
}
void Managefeeonupdate(list<contact>Triggernew,Map<ID,contact>Triggeroldmap)
{
    set<ID> setAccID= New set<ID>();
    list<Account> lstAcc=New list<Account>();
    for(contact objC: TriggerNew)
    {
        if (objC.AccountId!=null && objC.myruchika__fee__c!=TriggeroldMap.get(objC.AccountID).myruchika__fee__c)
           {
           setAccID.Add(objC.AccountId);
           }
    }         
     if(setAccID.size()>0)
           {
               for(Account objA:[select ID,myruchika__totalfees__c,(select ID,myruchika__fee__c From contacts Where myruchika__fee__c!=null) From Account Where ID in :setAccID])
               {
                   
               
           Decimal amt=0;
           for(contact objC:objA.contacts)
           {
               amt += objC.myruchika__fee__c;
           }
         objA.myruchika__totalfees__c=amt;
               
           lstAcc.add(objA);
           }
           If(lstAcc.size()>0)
           {
               update lstAcc;
               
           }
}
Hi 
I am trying to display Opportunity records based on their picklist value either "Closed Won" or "Closed Lost".
Upon selecting the radio button A all "Closed won" opportunities should be displayed,similarly
Upon selecting the radio button B all "Closed Lost " opportunities should be displayed.
so, in order to achieve this ,do i need to create radio buttons on my object or is is possible without creating radio buttons on the object.
i am unable to add radio buttons to my vf page when it has a pageblock table,

below is my VF Page Code for the reference,
please help me with the controller if required.

VF page:

<apex:page standardcontroller="Opportunity" tabstyle="Opportunity">
  <Apex:form >
  <Apex:pageblock Title="Records">
  <Apex:PageBlockTable value="{!Opportunity}" var="O">
   <Apex:Column value="{!O.Name}"/>
   <Apex:Column value="{!O.StageName}"/>
   <Apex:Column value="{!O.Amount}"/> 
   </Apex:PageBlockTable>
  </Apex:pageblock>
  </Apex:form>
</apex:page> 

Thanks in advance
I am fairly new to writing triggers, so I took a shot at this one because I thought it would be pretty simple. I have looked a tons of example and can't seem to figure out what I am doing wrong. I would like to update base address information from a field called Metro Area when address is null. However I keep getting the error "Expression cannot be a statement at line 4 column 14".
Code is listed below:

trigger UpdateMailingAddressMetro on Contact (Before Insert, Before Update) {
    for(contact c: trigger.new){
        If(c.Metro_Area__c.contains('Houston') && (c.mailingcity == NULL) && (c.mailingstate == NULL) && (c.mailingpostalcode == NULL)){
            (c.mailingcity == 'Houston');
            (c.mailingstate == 'TX');
            (c.mailingpostalcode == '77001');
            (c.mailingcountry == 'United States');
                }else {
                    c.mailingstate == NULL;
                    }
        }
}
Hi,

I would like to know how I can retrieve a Case Object based on the Attachment Parent ID (Trigger). Been trying to do so but not making any progress. Would appreciate some advice on how I can go about doing so~!

Cheers
HI Experts,

i need to write a forumla like this, could you guys me shape for this please

IF Date Assessed/ Rejected = NULL AND If (Related) tRIIO_Application.Days Left for Approval <= 0 Then
Forecast D+12 = Today() 
IF Date Assessed/ Rejected = NULL AND If (Related) tRIIO_Application.Days Left for Approval > 0 THEN
( TODAY() + Application_Ref__r.Days_Left_for_Approval__c ))
ELSE
Forecast D+12 = Date Assessed/ Rejected,

 existing forumala: IF( Application_Ref__r.Days_Left_for_Approval__c >=0, TODAY() ,( TODAY() + Application_Ref__r.Days_Left_for_Approval__c ))

could any one tell me how to write for this , thanks in advance
I have created permission set for a user and assigned it.
The user does not have view all/,odify all for the object
When I see results on visualforce page , it brings back ll the records,
Cn you suggest a solution ?
Hi,

I have tried to create the tasks via Workflow in ( managed package object) this particular custom object  only not visible in action drop down. other objects having the task in workflow action drop down. Is any customization need to get this or any think else have to do. Guide me to solve this issue as earely as possible. 
 Thanks 
Maheshwar
Screen Shot: 
User-added image
I have a field on the product that I would like visible as quote line items are entered. Can someone please tell me what is wrong with my code below?
trigger UpdateFormulaFields on QuoteLineItem (before insert,before update) {

 set<id> PIds = new set<id>();
   for(QuoteLineItem qli : Trigger.new){
       PIds.add(qli.Product2Id);
   }
     list<Product2> pList = [select id, name , Cost_Price__c, Quantity_On_Hand__c, In_Stock_Pricing__c  from Product2 where Id IN : PIds];  
     for(Product2 p : pList){
      
         for(QuoteLineItem ql : Trigger.new){
             if(p.id == ql.product2Id){
                
                 if(Trigger.isInsert){
                     
                 	ql.Cost_Price__c = p.Cost_Price__c;
                    ql.Quantity_On_Hand__c = p.Quantity_On_Hand__c;
                    ql.In_Stock_Price2__c = p.In_Stock_Pricing__c;
             	
                 }
                 if(Trigger.isUpdate){
                                     
                    ql.Cost_Price__c = p.Cost_Price__c;
                    ql.Quantity_On_Hand__c = p.Quantity_On_Hand__c;
                    ql.In_Stock_Price2__c = p.In_Stock_Pricing__c;
                     
                 }
             }
             
       }
    }
    update pList;
  
}
Hi all i want a trigger if i change owner of a particular record then we need to notify all the record owners of that object records if any one helps i am very thankfull you
I'm open to using either a trigger or Flow. I've been trying to do it as a Flow, but I'm getting stuck on getting it to loop through everything and can only get it to create a Demographic for the first Qualification in the list. I'm sure it's something in how to set the Loop and Assign. But I'm more familiar with Apex triggers, so I'm happy to go back to that.

This scenario uses 3 objects: Opportunity, Qualification, and Demographic. 
  • Qualifications have a picklist field called Default_Country__c
  • On Opportunities, the user selects their country from a picklist field Country__c
  • Demographics have a lookup to both Qualification and Opportunity.
I want when an Opportunity is created, for any Qualifications where Default_Country__c matches the Opportunity__c, a Demographic is created. My brain is a bit fried on this so I could use a bit of guidance. 

Thanks!
Hi,

I am getting the above error after cllicking on the (C2F) button. The debug logs are showing "successful" callout to webservice.


Apex Class from WSDL
 
//Generated by wsdl2apex

public class TmpCnv {
    public class FahrenheitToCelsiusResponse_element {
        public String FahrenheitToCelsiusResult;
        private String[] FahrenheitToCelsiusResult_type_info = new String[]{'FahrenheitToCelsiusResult','http://www.w3schools.com/webservices/',null,'0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://www.w3schools.com/webservices/','true','false'};
        private String[] field_order_type_info = new String[]{'FahrenheitToCelsiusResult'};
    }
    public class CelsiusToFahrenheitResponse_element {
        public String CelsiusToFahrenheitResult;
        private String[] CelsiusToFahrenheitResult_type_info = new String[]{'CelsiusToFahrenheitResult','http://www.w3schools.com/webservices/',null,'0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://www.w3schools.com/webservices/','true','false'};
        private String[] field_order_type_info = new String[]{'CelsiusToFahrenheitResult'};
    }
    public class FahrenheitToCelsius_element {
        public String Fahrenheit;
        private String[] Fahrenheit_type_info = new String[]{'Fahrenheit','http://www.w3schools.com/webservices/',null,'0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://www.w3schools.com/webservices/','true','false'};
        private String[] field_order_type_info = new String[]{'Fahrenheit'};
    }
    public class CelsiusToFahrenheit_element {
        public String Celsius;
        private String[] Celsius_type_info = new String[]{'Celsius','http://www.w3schools.com/webservices/',null,'0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://www.w3schools.com/webservices/','true','false'};
        private String[] field_order_type_info = new String[]{'Celsius'};
    }
    public class TempConvertSoap {
        public String endpoint_x = 'http://www.w3schools.com/webservices/tempconvert.asmx';
        public Map<String,String> inputHttpHeaders_x;
        public Map<String,String> outputHttpHeaders_x;
        public String clientCertName_x;
        public String clientCert_x;
        public String clientCertPasswd_x;
        public Integer timeout_x;
        private String[] ns_map_type_info = new String[]{'http://www.w3schools.com/webservices/', 'TmpCnv'};
        public String FahrenheitToCelsius(String Fahrenheit) {
            TmpCnv.FahrenheitToCelsius_element request_x = new TmpCnv.FahrenheitToCelsius_element();
            request_x.Fahrenheit = Fahrenheit;
            TmpCnv.FahrenheitToCelsiusResponse_element response_x;
            Map<String, TmpCnv.FahrenheitToCelsiusResponse_element> response_map_x = new Map<String, TmpCnv.FahrenheitToCelsiusResponse_element>();
            response_map_x.put('response_x', response_x);
            WebServiceCallout.invoke(
              this,
              request_x,
              response_map_x,
              new String[]{endpoint_x,
              'http://www.w3schools.com/webservices/FahrenheitToCelsius',
              'http://www.w3schools.com/webservices/',
              'FahrenheitToCelsius',
              'http://www.w3schools.com/webservices/',
              'FahrenheitToCelsiusResponse',
              'TmpCnv.FahrenheitToCelsiusResponse_element'}
            );
            response_x = response_map_x.get('response_x');
            return response_x.FahrenheitToCelsiusResult;
        }
        public String CelsiusToFahrenheit(String Celsius) {
            TmpCnv.CelsiusToFahrenheit_element request_x = new TmpCnv.CelsiusToFahrenheit_element();
            request_x.Celsius = Celsius;
            TmpCnv.CelsiusToFahrenheitResponse_element response_x;
            Map<String, TmpCnv.CelsiusToFahrenheitResponse_element> response_map_x = new Map<String, TmpCnv.CelsiusToFahrenheitResponse_element>();
            response_map_x.put('response_x', response_x);
            WebServiceCallout.invoke(
              this,
              request_x,
              response_map_x,
              new String[]{endpoint_x,
              'http://www.w3schools.com/webservices/CelsiusToFahrenheit',
              'http://www.w3schools.com/webservices/',
              'CelsiusToFahrenheit',
              'http://www.w3schools.com/webservices/',
              'CelsiusToFahrenheitResponse',
              'TmpCnv.CelsiusToFahrenheitResponse_element'}
            );
            response_x = response_map_x.get('response_x');
            return response_x.CelsiusToFahrenheitResult;
        }
    }
}

VisualForce Controller
public class TmpCntrl {

    Public String Celsius{get;set;}
    Public String Fahrenheit{get;set;}
    Public String FResult{get;set;}
    Public String CResult{get;set;}
    
    PageReference pageRef = ApexPages.currentPage();
    TmpCnv.TempConvertSoap TC = new TmpCnv.TempConvertSoap();
      
    public string FCalculate() {
        FResult = TC.CelsiusToFahrenheit(Celsius);
        return null;
    }
    
    public String CCalculate() {
        CResult = TC.FahrenheitToCelsius(Fahrenheit);
        return null;
    }
}

VisualForce Page
<apex:page controller="TmpCntrl">
    <apex:form >
        <apex:inputText value="{!Celsius}"/>
          <p>{!FResult}</p> 
        <apex:commandButton value="C2F" action="{!FCalculate}" rerender="all" >
            <apex:param name="Celsius" value="{!Celsius}" assignTo="{!FResult}"/>
        </apex:commandButton>
    </apex:form>
</apex:page>
Please give me some light.

Thanks.
Hi.

I would like to create a new field in the task that contain an information already present in the case.
For example: I would lile to add in the task view the case record type.

I can creat a customized field in the task but I am not able to relate this field with the Case record type.

I think is not so hard but I am a principiant :(

Thanks!!
Hi Team,

We are facing an issue with a date field in Salesforce. The complete object is populated by a batch job by reading a csv file.  The object has few date fields. One of the date fields is populating incorrectly. That is always populating as one day less than the actual date supplied, where as remainign all the fields are getting populating correctly. 

I've verified the success file that generated after the upsert operation by job and observed that the success file also contains the date supplied in source csv file. Not sure where the problem is? Could someone help in resolving this issue.  There is no trigger associated with that field as as well.

Please let us know for any more details. 

Thanks, 
Kishore
RWE Npower
Why the Duplicate Record Items Trigger can't be run while Duplicate Lead is Created?