• Ashishyadav
  • NEWBIE
  • 94 Points
  • Member since 2012

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

Hi all does anyone know how i do a comparison on a record type name?

 

My test method is failing because this bit is never true:

 

if(opportunity.RecordType.Name == 'MDS')

 

and when i look in the debug log is if i do

 

system.debug('opportunity.RecordType.Name = ' + opportunity.RecordType.Name);

 

then all i see is null, but my test opportunit has a recored type, this is how i set the opp up:

 

        opportunity3 = new Opportunity(Name = 'Test3', AccountId = account.Id, StageName = 'Final Contract Issued', Probability = 95, CloseDate = Date.today(), MCS_Commercials_Approved__c = true, HLD_created__c = 'HLD signed off', RecordTypeId = [select id, DeveloperName, Name from RecordType where Name = 'MDS' and sObjecttype = 'Opportunity' limit 1].id);        

This is driving me crazy, Thanks All

With the new apex test execution, i cant see the coverage of  a single test class am working on and what are the lines covered/not covered.

 

how can i get that info with this new spring 13?

  • February 11, 2013
  • Like
  • 0

I have one Custom Object Named 'Purchase_Order__c' with  field ' Total_Amount__c' - Data Type  Number(16,2)

 

When i query : select id from Purchase_Order__c Where Total_Amount__c= 9999999911 

 

Its giving me error

 

MALFORMED_QUERY:
Purchase_Order__c Where Total_Amount__c= 9999999911
^
ERROR at Row:1:Column:57
For input string: "9999999911"

 

I am taking Number(16,2) , so It should allow me in where clause upto 16 digit numbers. but its throwing me error.

If i remove one digit then its work fine.

 

Please Help me ASAP.

 

Thanks,

Dipesh 

 

  • January 21, 2013
  • Like
  • 0
If some one can help me here to understand , How can I connect Mobile iOS App to Salesforce. 

Detail: An iOS app has a contact form , when use clicks the submit button , the data should get saved in the Contact object. 

What approach should I take to establish connection and point the mobile app to create record in contact object.
I was wondering what will be the best way to create a custom indicator for required field. 
Standard one always show Red color indicator , how to go about creating a different color indicator for VF page.
Is it through Image or Is is through style attribute? Iam not sure what is the best way to do 
Iam suprised that we can call standard button in VF page but we cannot call the custom button which is created through UI in VF page. We need to create a custom controller in order to define the custom button functionality.

is there any other way we can call the custom button in VF page, without creating a custom controller
How can we split street field into two different fields via Apex coding.

I know there is a way to do it through split method dividing using delimiters ex:
String s1 = 'Hello Max wrwer 345345';
//String s2 = s1.left(3);
List<String> s3 = s1.split(' ',2);
//List<String> s3 = s1.split('\n');

System.debug('s2'+s3);
System.debug('s2'+s3[0]);
System.debug('s2'+s3[1]);


But How can we split on the basis of Number of characters for example Before 8th character it should store in field1 and after 8th to 30th character in field 2 and so on ....

Could you please help me here
 
Iam having hard time in creating the date format in Apex code,
Variable to store : Datetime dte
Need to store time in this format :'1999-05-31T13:20:00-05:00' ;

 
Having an issue pushing data from salesforce to external system , everything is ok but later I realized the salesforce is sending the data i XML format but the external machine which is middleware is requesting in WSDl definition.
How can I change XML to WSDl format in Salesforce Callout
Doing Callout ,
Whenever I try to send request to secured Gateway , it ends up giving me this error , Could you please help
I have a integration callout with external system , but when I try to connect it gives me Handshake_failure
I checked and realized I do not have certificate on my end, So I created a certificate CA one , NOW my issue is how to get it signed, I have never ever did this before , So please could someone help  me with that
Endpoints are always hard coded in remote settings and in the code, Is there a way that endpoints which I am hard coding can be dynamic .
So that If Target System url changes , I need not to make changes in code
Any Idea how to achieve this functionality?

Thank you
While consuming a WSDL, to generate a class, I have reciving a following error, I have not seen this kind of error before ever.
I have searched but not able to find out any solution for the same.
Error: "Error: Failed to parse wsdl: Unsupported transport http://www.tibco.com/namespaces/.........  "

Do any one came across same kind of Issue earlier.
Need to disable some fields after a button si being clicked so that field cannot be edited further.
How can we do it .

How to show number of validations and workflows in a VF page for an object. Any possiblity

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

Iam trying to update a lookup 

 

I have an object A   and Object B     : Master Detail Relationship ( Master Object A)

 

Object B has a master detail look up field of A 

 

When Iam creating new record of Object B it gets created  but when i am updating the Object B it doesnt allow me to update bcoz I have already inserted or passed the value of Lookup ( that is Object A field) 

 

How to go about updating Master field in child object .. Is there any way to do 

how can we add link or VF page in sidebar in all  the tabs

Hi,

 

Is it possible as soon as i upload a document or file  in documents through VF page . Automtically path should show up as a hyperlink on same page

 

how?

How to get endpoint and fro where.. and what to define in end point please anybody can explain .. iam not able to understand through help

Iam trying to integrate oracle erp with saleforce ... in between there are webmethods... so how proceed with the flow.
Iam not able to figure out .
Please help ... do i have to consume the wsdl and expose through apex class or something else i have to .. how to go around inbound and outbound process from salesforce

If anyone knows the flow how it works plz help me to understand
Please dont put the salesforce docs i have already gone through if you have some relevant docs then only post
Does Governor limits comes into act when we are integration with some ERP system.

Suppose Iam integraton salesforce to oracle ERP and updating few records in Oracle

Does Governor limits specifies that only this many reocrds can be update or flow from one end to another

Hi,

 

Iam trying to pull Salesforce id of record in Account on the basis of a record value (field: Duns number) from the contact 
Iam new to Triggers and Apex ..
please help me how to go about this,...  

public class JSONObject {
    public class value {


   }



public class JSONException extends Exception {}


public class JSONTokener {
   }

    public static  testmethod void test_valueToString() {
        /*
        Make sure that the JSON rendered by this class passes validation by parsers
        from http://json.org/json2.js and http://www.jsonlint.com.
        For example:    {foo: "bar"} is invalid
                        {"foo": "bar"} is valid
        */
    }

}
getting below exception 

Error: Compile Error: Defining type for testMethod methods must be declared as IsTest at line 15 column 36


if i try adding @isTest method  end up with this error 
Compile Error: testMethod are by default IsTest at line 16 column 36

Can someone please help with this
 
I was wondering what will be the best way to create a custom indicator for required field. 
Standard one always show Red color indicator , how to go about creating a different color indicator for VF page.
Is it through Image or Is is through style attribute? Iam not sure what is the best way to do 
Please help me in this trailhead challenge, create a flow that implements the business process of Account, Contact, and Opportunity data entry and place it on a Visualforce page.

*The Flow will need to be called 'New Customer Flow'.
*The Flow should have a screen with fields for First Name, Last Name, Company Name, Opportunity Amount, and Opportunity Stage.
*The Flow needs to have steps to create an account, a contact, and an opportunity from the data entered.
*Opportunity name, close date and stage are required fields. Name the Opportunity '{Company Name} - {Last Name}', set the close date to one month from today and set the stage to 'Prospecting'.
*The Flow should be invoked from a Visualforce page.
*The Visualforce page should be called FlowPage.
*The Visualforce page will need a component to reference the 'New Customer Flow' process.

even after error the contacts and accounts are created but not opportunity.... error is given below:

UPSERT --- UPSERT FAILED --- ERRORS : (REQUIRED_FIELD_MISSING) Required fields are missing: [StageName] --- for SFDC record with ID : null,

i have given stagename value = stagename screen choice 

Please help me out

User-added image

User-added image
User-added image

even if I am selecting stage name prospecting or screen choice Stage than also it always land me to error 
Hello I have a class that I am trying to get some test coverage from that is using a http response. Here is my class 

public with sharing class APIApplicationUtility {

    public static DTOApplication createApplication (DTOApplication reqApplication){
        DTOApplication returnApplication = new DTOApplication();

        try{

            String endPoint='http://hcscdn-dev.apigee.net/retailapi/v1-dev/application/application';

            if(!Test.isRunningTest()){

            }

            HttpRequest req=new HttpRequest();
            req.setEndpoint(endPoint);
            req.setMethod('POST');
            req.setCompressed(false);
            req.setHeader('Content-Type','application/hal+json');
            String jsonBody = JSON.serialize(reqApplication);
            req.setBody(jsonBody);

            //Where going to call the API here
            HttpResponse r = OAuthUtility.InvokeService(req,false);

            if (r == null){
                DTOError er = new DTOError ('There was a problem with the Application service. Please call an administrator.');
                returnApplication.errors.add(er);
                return returnApplication;
            }

            String jsonStr = r.getBody();
            system.debug('Quote Response: '+jsonStr);

            //Deserialize JSON back to DTO class
            returnApplication = (DTOApplication)System.JSON.deserialize(jsonStr, DTOApplication.class);
        }catch (Exception e){
            system.debug(e);
            DTOError er = new DTOError(e.getMessage());
            returnApplication.errors.add(er);
        }
        return returnApplication;
    }

I wrote a mock also 
@isTest
global class TestApplicationAPIMock implements HttpCalloutMock {
    global HttpResponse respond(HttpRequest req){

        //Create a fake response

        HttpResponse res = new HttpResponse();
        res.setHeader('Content-type', 'application/json');
        res.setBody('{"applicationType"}:"major_med"}');
        res.setStatusCode(200);

        return res;

    }

}

And here is the start of my test class

@isTest
public class APIApplicationUtilityTest {
    
    @isTest static void TestAPIApplication(){

           Test.setMock(HttpCalloutMock.class, new TestApplicationAPIMock());

           APIApplicationUtility thisApp = new APIApplicationUtility();

          HttpResponse r = APIApplicationUtility.createApplication();
      
    }
    
    
}

Im having problems getting the method.
Hi All,

Task Sync Failed

Give any one solutions.
 
How is this possible when I'm selecting SF's own insert field values and it is populating them?
I have seen some posts with similar issues, but nothing exact to my organization; but apologies in advance if this is a duplicate.

I am trying to figure out how to update the Last Modified Date/Time field when an Activity is added to a case. We do not use email to case, we have our own process in which the support engineer uses the "Log a call" button in the Activity section when information is either sent to the customer or received from the customer.

If that is the only field edited then Last Modified Date/Time is NOT updated. I understand that this is the functionality, but I need to have this field update in order to report on the "Time Since Last Touch" which is a formula I created that compares the Last Modify field with NOW().

I have been told I need an Apex trigger to do this, but as a newbiew to Apex and Salesforce administration tasks I need help. Is this something simple to implement or shoud I just give up?

Any help would be greatly appreciated!
Hi all,

We have an object called Project and a child object called assignment which both share a common field called hours.  
A user enters an assignment and enters hours.  The project page has a field which calculates the total hours from all the individual assignments

There is a hierachy structure of master project and sub projects and what I am trying to achieve is have a field on the master project calculate all the total hours from all the sub projects.
I am guessing this is a trigger, of which I have acompletely run out of capabilities and need help.

The current calculation to show the total hours on the project page was done using the salesforce rollup summaries app and I think I need a trigger of some sort using a statement to match the project id's?

Nick


 
Hi there, need help, I wrote a query that returns 3 records. and I'm reading those records in the FOR loop to update record that matchs criteria, however this record iteration no happening, anything I'm missing in following code:

my question is, I put a debug before if, I epxcet 3 entries in the log but it just one.

List <Sales_Team__c> gst = [Select Sales_Team_Member__c,Primary__c,Producer__c,Opportunity__c,Email__c,Id
                                             From Sales_Team__c
                                             Where Sales_Team_Member__c IN: opportunityIdSet and  Producer__c = null];

for (Sales_Team__c OpptyGST : gst){
                     system.debug('Test GST Memebr# : ' + OpptyGST.Sales_Team_Member__c);                            
                if (OpptyGST.Sales_Team_Member__c == Oppty.Sales_Rep__c){
                    OpptyGST.Primary__c = true;
                    OpptyGST.Email__c = 'primary@gst.com';
                   
                } 
}
 
How can we split street field into two different fields via Apex coding.

I know there is a way to do it through split method dividing using delimiters ex:
String s1 = 'Hello Max wrwer 345345';
//String s2 = s1.left(3);
List<String> s3 = s1.split(' ',2);
//List<String> s3 = s1.split('\n');

System.debug('s2'+s3);
System.debug('s2'+s3[0]);
System.debug('s2'+s3[1]);


But How can we split on the basis of Number of characters for example Before 8th character it should store in field1 and after 8th to 30th character in field 2 and so on ....

Could you please help me here
 
While consuming a WSDL, to generate a class, I have reciving a following error, I have not seen this kind of error before ever.
I have searched but not able to find out any solution for the same.
Error: "Error: Failed to parse wsdl: Unsupported transport http://www.tibco.com/namespaces/.........  "

Do any one came across same kind of Issue earlier.
I wanted to modify the Site.createPortalUser(u,accountId, password) to meet my requirment ? Can we do that if yes than How ?
Please suggest. Thanks in advance.
I am getting below error message and can you pls your suggestion to resolve it

Unable to generate a temporary class (result=1).
error CS0030: Cannot convert type 'SFDC.ListViewRecordColumn[]' to 'SFDC.ListViewRecordColumn'
error CS0030: Cannot convert type 'SFDC.ListViewRecordColumn[]' to 'SFDC.ListViewRecordColumn'
error CS0029: Cannot implicitly convert type 'SFDC.ListViewRecordColumn' to 'SFDC.ListViewRecordColumn[]'
error CS0029: Cannot implicitly convert type 'SFDC.ListViewRecordColumn' to 'SFDC.ListViewRecordColumn[]'
I have given with a situation, In Opportunity whenever the Status Goes 'Closed won' need to write Trigger like, Opportunity line item fields ( Name, Productname, price, Quantity, Account ) should be copied to ASSET ( Which is in product Object ) as new RECORD. Asset having three fiels Asset name ( Product name ), Account and Contact. Here How to get CONTACT ID from Opportunity.

I gave Trigger below, its working and I can save records in opportunity but datas not copied to ASSET ( Which is in Product Object )


trigger Demo on Opportunity (after insert, after update)
      {
        List<opportunitylineitem> opp1 = new List <opportunitylineitem>();
        Map<string,string> product = new map<string,string>();
        List<product2> product1 = new List<product2>();
        List<product2> updateproduct1 = new List<product2>();
         //List<Product2> products = new List<Product2>();
        List<Asset> ast = new List<Asset>();
    for(Opportunity opp:Trigger.new)
        {
            if(Trigger.isUpdate){
                Opportunity oldOpp = trigger.oldMap.get(opp.Id);        
                if(opp.StageName == 'Closed Won' && opp.StageName != oldOpp.StageName)
                {
                    opp1 = [select id,name,ProductCode,Quantity from opportunitylineitem where Opportunityid = :opp.id];
                    //product2 products = [select id, Name from Product2 where id=:opp1.id];
                    for(opportunitylineitem op : opp1)
                    {
                        List<string> productcode = new List<string>();
                   string value =' ';
                        productcode.add(op.productcode);
                        product.put(op.productcode,op.id);
                        product1 = [select id,name from Product2 where productcode in : productcode];
                        Asset a= new Asset();
                        for(Product2 prodnew:product1)
                        {
                        string ss1 = prodnew.productcode;
                            if(product.containskey(ss1))
                            {
                                value = product.get(ss1);
                               // system.debug(logginglevel.ERROR,'%%%% Value: ' + value);
                            }    
                    }
                        a.Name = value;
                        a.Quantity = op.Quantity;
                       // system.debug(logginglevel.ERROR,'%%%% Asset Name/Quantity: ' + a.Name + ' ' + a.Quantity);
                        ast.add(a);
                    }
                }
            }
        }
        
        insert ast;
    }
 
Need to disable some fields after a button si being clicked so that field cannot be edited further.
How can we do it .

This code is to check duplicate records.

 

i want the functionality of this.

 

for(Fasttrack_Activity__c FA : Trigger.new)

      {

              if(FA.Name == 'photo')

              {

                      FA.Name.addError('Duplicate Name');

              }

      }

Hello Friends!!!

 

I am trying to Generate Apex Classes from WSDL file.  But while parsing XML file getting below message.

 

Failed to parse wsdl: Unsupported Schema element found http://www.w3.org/2001/XMLSchema:attribute

 

Our WSDL contains below elements

 

<xs:attribute name="FactoryType" type="xs:QName"/>
<xs:attribute name="Id" type="xs:ID"/>
<xs:attribute name="Ref" type="xs:IDREF"/>

 

I referred Salesforce help site and w3school schemas referral sites and i found both supports attribute tag:

Salesforce help Site: http://www.salesforce.com/us/developer/docs/dbcom_apex250/Content/apex_callouts_wsdl2apex.htm

 

w3school XML Schema referral: http://www.w3.org/2001/XMLSchema

 

Please let me know if one knows about the same.

 

Thanks,

Pradip

 

for   case  object i created a field of  of text box.....i want to disable this text box (but it is in standard page i.e case obj) 

 

how can i disable this..so that  it wont allow  to enter anything....i  dont  want  validation rule bec i dont want to display any error , simply not allow the user to enter nothing in to the textbox. any solution?

Hi All,

 

I have generated a web - lead form and tried to pass values through website after submit values it says 

Internet Explorer cannot display the webpage

 

but when I check the leads in salesforce as leads got succesfullly inserted with the values which I have inserted through web to lead form.

 

could some help me out in resolving this error....

Setup>Customize>Integrate>API contains the following instructions and  a link to download a WSDL file

Salesforce's WSDL allows you to easily integrate Salesforce with your applications, and to build new applications that work with Salesforce. To get started, download a WSDL file to a place accessible to your development environment.

How/where do I save the webpage that is returned after clicking the link?

Finky
  • November 15, 2007
  • Like
  • 0