• karnadesai
  • NEWBIE
  • 80 Points
  • Member since 2012

  • Chatter
    Feed
  • 2
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 4
    Questions
  • 13
    Replies
I have this trigger, it seems simple enough. On the case object is a lookup to Opportunity. Opportunity has a rich text field I want to copy to the case. However, this does not copy the value from the Opp field to the case field. Any suggestion / help?

trigger CaseHiddenProductCopyToCase_Testingsomething on Case (Before Insert, Before Update)
   {
         Case ca = trigger.new[0];
             { ca.Product_Change_Request_s__c = ca.Opportunity__r.Hidden_Products__c;}
    }

Hello everyone,

 

I am having a basic trouble for Quering REST API having list data

 

Following query works,

 

SELECT Id,Name from Opportunity where AccountId='001i0000007BagvAAC'

 

I want to search not just for One records as used above but for a list of records 

 

I know in APEX we can use WHERE IN clause for the SOQL query but I am unable to replicate that with REST API.

 

I used following query's without any success

SELECT Id,Name from Opportunity where AccountId In '001i0000007BagvAAC,001i0000007BagvAAF'

SELECT Id,Name from Opportunity where AccountId In {'001i0000007BagvAAC,001i0000007BagvAAF'}

 

Please help.

I am currently in process of invoking Salesforce REST API from my own server.

Following are the two options I have already implemented,

  • Use OAuth 2.0 User-agent model for querying Salesforce REST API
  • User OAuth 2.0 User-password model for querying Salesforce REST API.

In both the above case, I needed to setup Remote Site in the Salesforce Org. How can I bypass this. i.e. Without setting up Remote Site, I can directly query Salesforce API. I have seen a popular app integrated with salesforce already done similar thing.

 

Also, after reviewing salesforce Authentication documentation, token used in Oauth 2.0 is same as Session Id. i.e. In theory if I have instance URL and SessionId , I can directly query API.

Thanks for your help.

Hello Everyone,

 

I have created a RESTFUL .NET Web Service using WCF. I want to integrate this web service within Salesforce.

My code for .NET and Salesforce is below. The problem i am facing right now is that whenever i populate the body and pass XML data my .NET web service returns bad request error. For testing my .NET Web service i had created a client in C# and also used tool called fiddler. It works fine for both of them.

 

My .NET Code,

 

Code for IService

 

[OperationContract]
[WebInvoke(UriTemplate = "getXML", Method = "POST", ResponseFormat = WebMessageFormat.Xml, RequestFormat = WebMessageFormat.Xml)]
String getXML(XElement response);

 

 

Code for Service

public String getXML(XElement response)
{
return "Hello World";
}

 

My Salesforce APEX Code is,

 

 HttpRequest req = new HttpRequest();
req.setEndpoint(url);
req.setHeader('Content-Type', 'text/xml');

req.setCompressed(true); // otherwise we hit a limit of 32000
req.setMethod('POST');
req.setHeader('Accept', 'text/xml;charset=utf-8');
String email='karnadesai@gmail.com';
string firstName='karna';
String requestString = '<list>'+
'<user>'+'<userId>0</userId>'+'<userName>othmanelmoulat</userName>'+
'<password>123qwe</password>'+'<mainRoleId>5</mainRoleId>'+
'<contact>'+'<email>'+email+'</email>'+
'<firstName>'+firstName+'</firstName></contact>'+
'</user></list>';

req.setHeader('Content-Length',String.valueOf(requestString.length()));
req.setBody(requestString);

Http http = new Http();
HttpResponse res = http.send(req);

System.debug(res.getBody());

 

I get bad request error only when i set the body of request. I have to pass data using XML only to this web service. Thanks for your help

I am new to Salesforce so if my question might be obvious to some of you.

I have created a junction object called BugCaseAssociation which makes many to many relationship between Case and custom object Bug. Now i want to customize the Page layout so that we can add multiple Bugs on Case Layout page and similarly for Bug layout page.

I found the following link http://wiki.developerforce.com/page/S-Control_Deprecation

http://wiki.developerforce.com/page/Create_a_many_to_many_relationship_with_a_multi-select_picklist

 

It gives a demo but using S-control. Visual Force is the only Approach?. If so can you guide me on how should i implement this feature?

This is the error I received:

"All components failed Version Compatibility Check.
Every component in this change set requires the "31.0" or higher platform version. Please select an organization with a platform version of "31.0" or higher"

What do I do in this situation, wait until Production has been upgraded to Summer 14'?
Hello All,

I am new with Apex and have been researching how to do this for 2 days to no avail.

I have a simple question, can a class be activated based on any user clicking "Submit a ticket"

I am thinking that I can use .NET onclick() function, but have been unable to work out where to even start.

Any help, or points in the right direction would help.

Thanks,

-Mike
Hi All,

I am using Metadata API to get information about org. I want to retrieve all custom fields present in my org. I am using listMetadata() method which returns list of components. Below is my code:

MetadataService.MetadataPort service = createService();            
        List<MetadataService.ListMetadataQuery> queries = new List<MetadataService.ListMetadataQuery>();       
        MetadataService.ListMetadataQuery queryLayout = new MetadataService.ListMetadataQuery();
        //queryLayout.folder = MetaDataFolder;
        queryLayout.type_x ='CustomField';
        queries.add(queryLayout);      
        MetadataService.FileProperties[] fileProperties; 
        try{    
         fileProperties= service.listMetadata(queries, 29); //here 29 is api version
        }catch(exception e){
            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.Info,e.getMessage()));
        }

I am get exception as "IO Exception: Exceeded max size limit of 3000000". I know that number of custom fields present in my org is to much and the response that I am getting exceeding the allowed limit of 3MB. I want to list all custom fields present in my org. Same exception is coming when I am retrieving few other metadata(like all profile). Above mentioned code works fine in my developer org but in sandbox, its not working as number of metadata components is too much in my sandbox. 

I tried retrieving the components using Workbench which also uses metadata api. Workbench retrieved all components successfully. So there will be some mechanism in metadata API through which I can retrieve large number of components. I saw few post where people says to retrieve info in different chunks by spliting single request in 2 or 3 different request. But in my case, I am not able to split my request as I want all custom fields.

Can anyone help me on this .

Thanks in advance.

Regards,
Sunil kumar

Hi All,

Could you please let me know which are the best practice to check null in List, Map, Set to avoid nullpointer exception....

Regards
I have this trigger, it seems simple enough. On the case object is a lookup to Opportunity. Opportunity has a rich text field I want to copy to the case. However, this does not copy the value from the Opp field to the case field. Any suggestion / help?

trigger CaseHiddenProductCopyToCase_Testingsomething on Case (Before Insert, Before Update)
   {
         Case ca = trigger.new[0];
             { ca.Product_Change_Request_s__c = ca.Opportunity__r.Hidden_Products__c;}
    }

In one hand I have few opportunities created manually. On the other hand I have few opportunities which are cloned from the previous. Now I am in a position to write a trigger on Opportunity object, so how can I differentiate these opportunities ?

Thanks

Hello everyone,

 

I am having a basic trouble for Quering REST API having list data

 

Following query works,

 

SELECT Id,Name from Opportunity where AccountId='001i0000007BagvAAC'

 

I want to search not just for One records as used above but for a list of records 

 

I know in APEX we can use WHERE IN clause for the SOQL query but I am unable to replicate that with REST API.

 

I used following query's without any success

SELECT Id,Name from Opportunity where AccountId In '001i0000007BagvAAC,001i0000007BagvAAF'

SELECT Id,Name from Opportunity where AccountId In {'001i0000007BagvAAC,001i0000007BagvAAF'}

 

Please help.

I am currently in process of invoking Salesforce REST API from my own server.

Following are the two options I have already implemented,

  • Use OAuth 2.0 User-agent model for querying Salesforce REST API
  • User OAuth 2.0 User-password model for querying Salesforce REST API.

In both the above case, I needed to setup Remote Site in the Salesforce Org. How can I bypass this. i.e. Without setting up Remote Site, I can directly query Salesforce API. I have seen a popular app integrated with salesforce already done similar thing.

 

Also, after reviewing salesforce Authentication documentation, token used in Oauth 2.0 is same as Session Id. i.e. In theory if I have instance URL and SessionId , I can directly query API.

Thanks for your help.

I have a typical deployment scenario at my work place.
 
We have Perforce for Version control.
 
Here is the scenario:
 
A developer codes, customize or configure something in his dev org. He now checks in his changes to the version control repository called Perforce.
 
I have to do a automated deployment every night to query perforce for the latest changelist/Label dynamically and then deploy the changes to sandbox, prod etc. This one should be automated with no human interventions. Again this whole process of querying and then deploying should be automated. While querying i should be querying only the changed files based on a label or changelist and not all the files.
 
is there a way to handle this scenario and is there any reference for me to accomplish this?
 
 
Another question,
 
I have a folder that contains subfolders like objects, classes etc. can i do deployment using Ant migration tool without the package.xml file in it
Is the package.xml file really needed for any kind deployment.
 
This is a very critical req that has to be answered before noon. Please help me da.

Hello Everyone,

 

I have created a RESTFUL .NET Web Service using WCF. I want to integrate this web service within Salesforce.

My code for .NET and Salesforce is below. The problem i am facing right now is that whenever i populate the body and pass XML data my .NET web service returns bad request error. For testing my .NET Web service i had created a client in C# and also used tool called fiddler. It works fine for both of them.

 

My .NET Code,

 

Code for IService

 

[OperationContract]
[WebInvoke(UriTemplate = "getXML", Method = "POST", ResponseFormat = WebMessageFormat.Xml, RequestFormat = WebMessageFormat.Xml)]
String getXML(XElement response);

 

 

Code for Service

public String getXML(XElement response)
{
return "Hello World";
}

 

My Salesforce APEX Code is,

 

 HttpRequest req = new HttpRequest();
req.setEndpoint(url);
req.setHeader('Content-Type', 'text/xml');

req.setCompressed(true); // otherwise we hit a limit of 32000
req.setMethod('POST');
req.setHeader('Accept', 'text/xml;charset=utf-8');
String email='karnadesai@gmail.com';
string firstName='karna';
String requestString = '<list>'+
'<user>'+'<userId>0</userId>'+'<userName>othmanelmoulat</userName>'+
'<password>123qwe</password>'+'<mainRoleId>5</mainRoleId>'+
'<contact>'+'<email>'+email+'</email>'+
'<firstName>'+firstName+'</firstName></contact>'+
'</user></list>';

req.setHeader('Content-Length',String.valueOf(requestString.length()));
req.setBody(requestString);

Http http = new Http();
HttpResponse res = http.send(req);

System.debug(res.getBody());

 

I get bad request error only when i set the body of request. I have to pass data using XML only to this web service. Thanks for your help

Hi All,

I am using Metadata API to get information about org. I want to retrieve all custom fields present in my org. I am using listMetadata() method which returns list of components. Below is my code:

MetadataService.MetadataPort service = createService();            
        List<MetadataService.ListMetadataQuery> queries = new List<MetadataService.ListMetadataQuery>();       
        MetadataService.ListMetadataQuery queryLayout = new MetadataService.ListMetadataQuery();
        //queryLayout.folder = MetaDataFolder;
        queryLayout.type_x ='CustomField';
        queries.add(queryLayout);      
        MetadataService.FileProperties[] fileProperties; 
        try{    
         fileProperties= service.listMetadata(queries, 29); //here 29 is api version
        }catch(exception e){
            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.Info,e.getMessage()));
        }

I am get exception as "IO Exception: Exceeded max size limit of 3000000". I know that number of custom fields present in my org is to much and the response that I am getting exceeding the allowed limit of 3MB. I want to list all custom fields present in my org. Same exception is coming when I am retrieving few other metadata(like all profile). Above mentioned code works fine in my developer org but in sandbox, its not working as number of metadata components is too much in my sandbox. 

I tried retrieving the components using Workbench which also uses metadata api. Workbench retrieved all components successfully. So there will be some mechanism in metadata API through which I can retrieve large number of components. I saw few post where people says to retrieve info in different chunks by spliting single request in 2 or 3 different request. But in my case, I am not able to split my request as I want all custom fields.

Can anyone help me on this .

Thanks in advance.

Regards,
Sunil kumar