• Gaurav Agnihotri
  • NEWBIE
  • 475 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 77
    Questions
  • 111
    Replies
I have an account lookup field on Quotes. When a user starts typing in this area, it displays recent account name. It is possible to also display Account number with the account name. Alternatively,User-added image only the account number. 
Hello, 
I am not able to get a Jason response from the end point. http://largesystems.phpwebhosting.com/WQTDev/sf_get_bom.php?quotenum=21660
The only response I am getting back is 
09:40:02:478 USER_DEBUG [20]|DEBUG|System.HttpResponse[Status=OK, StatusCode=200]

However, if I copy/paste the code in the browser address I get a response.
[{"part_quantity":"1","part_number":"D10U-A2-ACC","part_desc":"VX Accessory Svr 2 - DHCP, NTP, Load Balancer","part_unit_msrp":"3543"},{"part_quantity":"10","part_number":"D10U-A2-DEC","part_desc":"VX Enhanced Decoder 2 with Mount, 1 Monitor","part_unit_msrp":"2840"},{"part_quantity":"2","part_number":"A1-KBD-3D-KIT2","part_desc":"VX Enh Keyboard & 3D Mouse Combo. Gen 2.0","part_unit_msrp":"951"},{"part_quantity":"2","part_number":"E1-OPS-WKS","part_desc":"VX Enterprise Workstation, Up to 2 Monitors","part_unit_msrp":"4963"},{"part_quantity":"2","part_number":"E1-OPS-WKS6","part_desc":"VX Enterprise Workstation Up to 6 Monitors","part_unit_msrp":"5622"},{"part_quantity":"1","part_number":"E1-BASE","part_desc":"VX Ent Base Lic with CMG, VXS and 32 Ch Lic","part_unit_msrp":"8667"},{"part_quantity":"4","part_number":"E1-VXS-SW","part_desc":"VX Ent VXS Storage Server Software License","part_unit_msrp":"999"},{"part_quantity":"34","part_number":"E1-32C","part_desc":"VX Ent VXS Storage Channel License - 32 Ch","part_unit_msrp":"8229"},{"part_quantity":"7","part_number":"E1-1C","part_desc":"VX Ent VXS Storage Channel License - 1 Ch","part_unit_msrp":"302"},{"part_quantity":"2","part_number":"KBD5000","part_desc":"ENDURA KEYBRD WITH JOG\/JOY\/KEY","part_unit_msrp":"1920"}]

Below is the simple code: 

 
public class WQTResponse 
{
  public static void Execute()
    {

        string baseURL ='http://largesystems.phpwebhosting.com/WQTDev/sf_get_bom.php?quotenum=21660';
        
        Http http = new Http();
        HttpRequest request = new HttpRequest();
        request.setMethod('GET');
        request.setHeader('Accept', 'application/json');
        request.setHeader('Content-Type','application/json');
        
        request.setEndpoint(baseURL);
        
        HttpResponse response = http.send(request);
        
        system.debug(response);
        
        //return(response.getBody());
    }
}

Not sure what I am missing
Gurus, 
Is there a way I could default lead notification when the lead owner is changed. Please let me know. RIght now, it is defaulted to uncheck and user needs to check to send email. I created a workflow to send notification when the user changes but the system sends two notifcations if "Send email notification" check box is checked.

Any suggestions?
-Gaurav
Hi All, 
I have a requirement where a user is asking for a delete access to a standard object. Now, I really don't want to create a new profile for the user. Can this issue be resolved using a permission set?

Thanks in Advance,
 
Hello, 
I am trying to explore different possiblity from Schema class. I beleive this class is a good resource for all programmers.
I am trying to display text fields of a custom object. The script below gives me all the fields 


public Map <String, Schema.SObjectType> schemaMap = Schema.getGlobalDescribe();
Map <String, Schema.SObjectField> fieldMap = schemaMap.get('Account').getDescribe().fields.getMap();
system.debug(fieldMap);


How can i get the field property so that i can filter all text fields?
Hello, 
 I am in a process of understanding developer console log and the best and fastest way to resolve "Too Many Query Rows:50001" error.

In general there seems to be two methods to diagnose this issue. 
1. filter the log on SOQL_EXECUTE_LOG to track the result of each query
2. Execute limit on Execution overview to track result of each SOQL query used in the code.

I tend to lean toward number 2, but i could be wrong. what would you guys recommend?
is there any other place in the developer console where i can look for this information faster.

Thanks in advance, 
Gaurav
Hello, 
We have a web to lead functionality in Salesforce and it seems to work fine most of the time. Sometime we exceed the number of web to lead. I was wondering if it is possible to create a visualforce page to caputure leads. 
i would appreciate someone can point me to an example or blog.

Thanks in advance
Gaurav
Hi 
I am trying to understand the actionsupport tag used in visualforce page. The classic defination is that it is a component that add support to another component that refreshed asynchonously when a particular event occurs.

Is it safe to assume that it is responsible to trigger controller actions in response to DOM element events.

why would i not use apex:commandButton instead? what is different?
Hello, 
 I am using Ellipse Neon. I was wondering if someone could help me to figure out where to find log file when deploying a project in production. I am getting a failure in deployment and not able to figure out why.
what is the difference between Email to case and on demand email to case. we have a need where we need to generate cases by any email server. what would be the most recommended approach
Hello, 
I am using Eclipse IDE for Java Developers. Version: Neon Release (4.6.0) Build id: 20160613-1800

I am unable to see log file on running the test class.Please find my run configuration Run Configuration
I have enabled log levels:
Run Configuration Log levels- enabled

I am not sure what I am doing wrong.
Any recommendations/suggestions?
Hi, 
I am able to create apex classes from WSDL using FuseIt ( v3.2.26095.1), however, i am unable to create test classes for code coverage. I do see a button but it does not generate classes.Did anyone experienced the same issue?

I have created an HTML (Using Letterhead) template. I am using the merge fields in this template. While using this template, I also input some text related to the case I am handling. However, when I navigate to the particular case and find that email in the Activity History,  In the "Text Body" of the Message Content I just find merged fields. All the text that I had input is not there. Is this a standard salesforce.com feature or do I need to enable some feature. 
Hi,
I am working on a very simple visual force page
 
<apex:page standardController="Case" extensions="JiraSearchIssue" sidebar="false">
    <apex:form >
        <apex:pageBlock >
            <apex:pageBlockSection collapsible="False" columns="3" > 
                <apex:commandButton action="{!Execute}" value="Search" />
                <apex:inputText value="{!searchString}" label="Search for Jira Issues"/>
            </apex:pageBlockSection>      
        </apex:pageBlock> 
    </apex:form>
</apex:page>
In the output both command button and inputtext are way apart on the page layout. I was wondering if there is a way to bring them next to each other as shown in the pictureUser-added image
 
Gurus, 
I am having issues trying to parse JSON returned from the HTTP response. 
Below is my APEX code:
public class JiraGetIssue 
{
    public String baseUrl = 'https://beta.pelco.com:8443/tasks/rest/api/latest/issue/SUSTAIN-4050';   // Base URL of your JIRA instance
    //public String baseUrl = 'https://beta.pelco.com:8443/tasks/rest/api/latest/issue/'; 
    public String username = 'salesforce.connector'; // JIRA username
    public String password = 'password'; // JIRA password // Constructs Basic Http Authentication header from provided credentials
    public String authHeader()
    { 
        Blob headerValue = Blob.valueOf(username+':'+password); 
        return 'Basic ' + EncodingUtil.base64Encode(headerValue);        
    }
    public void Execute()
    {
        Http http = new Http();
        HttpRequest request = new HttpRequest();
        string fields   =   'key,'+
            'assignee,'+
            'project,'+
            'summary,'+
            'created,'+
            'updated,'+
            'priority,'+
            'status';
        system.debug(fields);
        integer startAt = 0;
        integer maxResults= 10;
        string searchString='SUSTAIN';
        //String CreateIssueJsonJIra= '{"fields": {"summary":"test create jira1","description":"test create jira1" ,"issuetype":{"name": "Bug"}}} ';       
        //String CreateIssueJsonJIra= '{"fields": { "project":{  "key": "SUSTAIN"},"summary": "REST ye merry gentlemen2","description": "Creating of an issue using project keys and issue type names using the REST API2","issuetype": {"name": "Bug"}}}';
        request.setMethod('GET');
        //Set HTTPRequest header properties
        request.setHeader('Accept', 'application/json');
        request.setHeader('Content-Type','application/json');
        Blob headerValue = Blob.valueOf(username+':'+password);
        request.setHeader('Authorization','Basic '+ EncodingUtil.base64Encode(headerValue));
        baseUrl='https://beta.pelco.com:8443/tasks/rest/api/latest/search?jql=summary~"gentlemen*"&project=SUSTAIN&fields=key,summary,status,priority,status,created,updated,assignee';
        //baseUrl=baseUrl+searchString+'"';
        //baseUrl=baseUrl+ '&fields=' + fields + '&startAt='+ startAt +'&maxResults='+maxResults;
        system.debug(baseUrl);
        request.setEndpoint(baseUrl);
        HttpResponse response = http.send(request);
        // Log the JSON content
        System.debug('JSON Response: ' + response.getBody());
        string JSONContent = response.getBody();
        
        system.debug(jiraGetIssueResponse.parse(JSONContent));
        JSONParser parserJira = JSON.createParser(JSONContent);
        
        //system.debug('parserJira ='+parserJira);
        
    
        while (parserJira.nextToken() != null) 
        {
            // Start at the array of issues.
            if(parserJira.getCurrentToken() == JSONToken.START_ARRAY) 
            {
                while (parserJira.nextToken() != null) 
                {
                    if ((parserJira.getCurrentToken() == JSONToken.START_OBJECT))
                    {
                        //JiraGetIssueResponse jiraIssue = (JiraGetIssueResponse)parserJira.readValueAs(JiraGetIssueResponse.class);
                     	//system.debug(jiraIssue);
                     	system.debug('Current TOKEN:'+parserJira.getCurrentToken());
                		system.debug('Current TEXT:'+parserJira.getText());
                        //parserJira.nextToken();
                        //system.debug('**************');
                    }   
                }
                system.debug('**************');
                //system.debug('Current TOKEN:'+parserJira.getCurrentToken());
                //system.debug('Current TEXT:'+parserJira.getText());
                
            }
        }
        //system.debug('JiraId='+jiraId+' JiraKey='+jirakey);
    }
}

HTTP  response:
09:24:00:084 USER_DEBUG [43]|DEBUG|JSON Response: {"expand":"schema,names","startAt":0,"maxResults":50,"total":4,"issues":[{"expand":"operations,editmeta,changelog,transitions,renderedFields","id":"176072","self":"https://beta.pelco.com:8443/tasks/rest/api/latest/issue/176072","key":"TEST-3","fields":{"summary":"REST ye merry gentlemen2","created":"2016-03-03T11:38:40.000-0800","assignee":null,"priority":{"self":"https://beta.pelco.com:8443/tasks/rest/api/2/priority/6","iconUrl":"https://beta.pelco.com:8443/tasks/images/icons/help_16.gif","name":"None","id":"6"},"updated":"2016-03-03T11:38:40.000-0800","status":{"self":"https://beta.pelco.com:8443/tasks/rest/api/2/status/1","description":"The issue is open and ready for the assignee to start work on it.","iconUrl":"https://beta.pelco.com:8443/tasks/images/icons/statuses/open.png","name":"Open","id":"1","statusCategory":{"self":"https://beta.pelco.com:8443/tasks/rest/api/2/statuscategory/2","id":2,"key":"new","colorName":"blue-gray","name":"New"}}}},{"expand":"operations,editmeta,changelog,transitions,renderedFields","id":"176071","self":"https://beta.pelco.com:8443/tasks/rest/api/latest/issue/176071","key":"TEST-2","fields":{"summary":"REST ye merry gentlemen.","created":"2016-03-02T16:15:49.000-0800","assignee":null,"priority":{"self":"https://beta.pelco.com:8443/tasks/rest/api/2/priority/6","iconUrl":"https://beta.pelco.com:8443/tasks/images/icons/help_16.gif","name":"None","id":"6"},"updated":"2016-03-02T16:15:49.000-0800","status":{"self":"https://beta.pelco.com:8443/tasks/rest/api/2/status/1","description":"The issue is open and ready for the assignee to start work on it.","iconUrl":"https://beta.pelco.com:8443/tasks/images/icons/statuses/open.png","name":"Open","id":"1","statusCategory":{"self":"https://beta.pelco.com:8443/tasks/rest/api/2/statuscategory/2","id":2,"key":"new","colorName":"blue-gray","name":"New"}}}},{"expand":"operations,editmeta,changelog,transitions,renderedFields","id":"176073","self":"https://beta.pelco.com:8443/tasks/rest/api/latest/issue/176073","key":"SUSTAIN-4052","fields":{"summary":"REST ye merry gentlemen2","created":"2016-03-03T13:01:31.000-0800","assignee":null,"priority":{"self":"https://beta.pelco.com:8443/tasks/rest/api/2/priority/6","iconUrl":"https://beta.pelco.com:8443/tasks/images/icons/help_16.gif","name":"None","id":"6"},"updated":"2016-03-03T13:01:31.000-0800","status":{"self":"https://beta.pelco.com:8443/tasks/rest/api/2/status/1","description":"The issue is open and ready for the assignee to start work on it.","iconUrl":"https://beta.pelco.com:8443/tasks/images/icons/statuses/open.png","name":"Open","id":"1","statusCategory":{"self":"https://beta.pelco.com:8443/tasks/rest/api/2/statuscategory/2","id":2,"key":"new","colorName":"blue-gray","name":"New"}}}},{"expand":"operations,editmeta,changelog,transitions,renderedFields","id":"176074","self":"https://beta.pelco.com:8443/tasks/rest/api/latest/issue/176074","key":"SUSTAIN-4053","fields":{"summary":"REST ye merry gentlemen3","created":"2016-03-04T09:52:23.000-0800","assignee":null,"priority":{"self":"https://beta.pelco.com:8443/tasks/rest/api/2/priority/6","iconUrl":"https://beta.pelco.com:8443/tasks/images/icons/help_16.gif","name":"None","id":"6"},"updated":"2016-03-04T09:52:23.000-0800","status":{"self":"https://beta.pelco.com:8443/tasks/rest/api/2/status/1","description":"The issue is open and ready for the assignee to start work on it.","iconUrl":"https://beta.pelco.com:8443/tasks/images/icons/statuses/open.png","name":"Open","id":"1","statusCategory":{"self":"https://beta.pelco.com:8443/tasks/rest/api/2/statuscategory/2","id":2,"key":"new","colorName":"blue-gray","name":"New"}}}}]}

I converted Json to Apex and following classes were generated:
//
//Generated by AdminBooster
//

public class JiraGetIssueResponse
{
	public String expand;	//schema,names
	public Integer startAt;	//0
	public Integer maxResults;	//50
	public Integer total;	//4
	public cls_issues[] issues;
	public class cls_issues 
    {
		public String expand;	//operations,editmeta,changelog,transitions,renderedFields
		public String id;	//176072
		public String self;	//https://beta.pelco.com:8443/tasks/rest/api/latest/issue/176072
		public String key;	//TEST-3
		public cls_fields fields;
	}
	public class cls_fields 
    {
		public String summary;	//REST ye merry gentlemen2
		public String created;	//2016-03-03T11:38:40.000-0800
		public cls_assignee assignee;
		public cls_priority priority;
		public String updated;	//2016-03-03T11:38:40.000-0800
		public cls_status status;
	}
	public class cls_assignee 
    {
	}
	Public class cls_priority 
    {
		public String self;	//https://beta.pelco.com:8443/tasks/rest/api/2/priority/6
		public String iconUrl;	//https://beta.pelco.com:8443/tasks/images/icons/help_16.gif
		public String name;	//None
		public String id;	//6
	}
	public class cls_status 
    {
		public String self;	//https://beta.pelco.com:8443/tasks/rest/api/2/status/1
		public String description;	//The issue is open and ready for the assignee to start work on it.
		public String iconUrl;	//https://beta.pelco.com:8443/tasks/images/icons/statuses/open.png
		public String name;	//Open
		public String id;	//1
		public cls_statusCategory statusCategory;
	}
	Public class cls_statusCategory 
    {
		public String self;	//https://beta.pelco.com:8443/tasks/rest/api/2/statuscategory/2
		public Integer id;	//2
		public String key;	//new
		public String colorName;	//blue-gray
		public String name;	//New
	}
	public static JiraGetIssueResponse parse(String json)
    {
		return (JiraGetIssueResponse) System.JSON.deserialize(json, JiraGetIssueResponse.class);
	}
/*
	static testMethod void testParse() {
		String json=		'{"expand":"schema,names","startAt":0,"maxResults":50,"total":4,"issues":[{"expand":"operations,editmeta,changelog,transitions,renderedFields","id":"176072","self":"https://beta.pelco.com:8443/tasks/rest/api/latest/issue/176072","key":"TEST-3","fields":{"summary":"REST ye merry gentlemen2","created":"2016-03-03T11:38:40.000-0800","assignee":null,"priority":{"self":"https://beta.pelco.com:8443/tasks/rest/api/2/priority/6","iconUrl":"https://beta.pelco.com:8443/tasks/images/icons/help_16.gif","name":"None","id":"6"},"updated":"2016-03-03T11:38:40.000-0800","status":{"self":"https://beta.pelco.com:8443/tasks/rest/api/2/status/1","description":"The issue is open and ready for the assignee to start work on it.","iconUrl":"https://beta.pelco.com:8443/tasks/images/icons/statuses/open.png","name":"Open","id":"1","statusCategory":{"self":"https://beta.pelco.com:8443/tasks/rest/api/2/statuscategory/2","id":2,"key":"new","colorName":"blue-gray","name":"New"}}}},{"expand":"operations,editmeta,changelog,transitions,renderedFields","id":"176071","self":"https://beta.pelco.com:8443/tasks/rest/api/latest/issue/176071","key":"TEST-2","fields":{"summary":"REST ye merry gentlemen.","created":"2016-03-02T16:15:49.000-0800","assignee":null,"priority":{"self":"https://beta.pelco.com:8443/tasks/rest/api/2/priority/6","iconUrl":"https://beta.pelco.com:8443/tasks/images/icons/help_16.gif","name":"None","id":"6"},"updated":"2016-03-02T16:15:49.000-0800","status":{"self":"https://beta.pelco.com:8443/tasks/rest/api/2/status/1","description":"The issue is open and ready for the assignee to start work on it.","iconUrl":"https://beta.pelco.com:8443/tasks/images/icons/statuses/open.png","name":"Open","id":"1","statusCategory":{"self":"https://beta.pelco.com:8443/tasks/rest/api/2/statuscategory/2","id":2,"key":"new","colorName":"blue-gray","name":"New"}}}},{"expand":"operations,editmeta,changelog,transitions,renderedFields","id":"176073","self":"https://beta.pelco.com:8443/tasks/rest/api/latest/issue/176073","key":"SUSTAIN-4052","fields":{"summary":"REST ye merry gentlemen2","created":"2016-03-03T13:01:31.000-0800","assignee":null,"priority":{"self":"https://beta.pelco.com:8443/tasks/rest/api/2/priority/6","iconUrl":"https://beta.pelco.com:8443/tasks/images/icons/help_16.gif","name":"None","id":"6"},"updated":"2016-03-03T13:01:31.000-0800","status":{"self":"https://beta.pelco.com:8443/tasks/rest/api/2/status/1","description":"The issue is open and ready for the assignee to start work on it.","iconUrl":"https://beta.pelco.com:8443/tasks/images/icons/statuses/open.png","name":"Open","id":"1","statusCategory":{"self":"https://beta.pelco.com:8443/tasks/rest/api/2/statuscategory/2","id":2,"key":"new","colorName":"blue-gray","name":"New"}}}},{"expand":"operations,editmeta,changelog,transitions,renderedFields","id":"176074","self":"https://beta.pelco.com:8443/tasks/rest/api/latest/issue/176074","key":"SUSTAIN-4053","fields":{"summary":"REST ye merry gentlemen3","created":"2016-03-04T09:52:23.000-0800","assignee":null,"priority":{"self":"https://beta.pelco.com:8443/tasks/rest/api/2/priority/6","iconUrl":"https://beta.pelco.com:8443/tasks/images/icons/help_16.gif","name":"None","id":"6"},"updated":"2016-03-04T09:52:23.000-0800","status":{"self":"https://beta.pelco.com:8443/tasks/rest/api/2/status/1","description":"The issue is open and ready for the assignee to start work on it.","iconUrl":"https://beta.pelco.com:8443/tasks/images/icons/statuses/open.png","name":"Open","id":"1","statusCategory":{"self":"https://beta.pelco.com:8443/tasks/rest/api/2/statuscategory/2","id":2,"key":"new","colorName":"blue-gray","name":"New"}}}}]}';
		JiraGetIssueResponse obj = parse(json);
		System.assert(obj != null);
	}
*/
}

I am not sure what I am doing wrong, in the parsing and deserialization.

Regards, 
Gaurav
Hello, 
I am trying to integrate Salesforce.com application with Jira Application. I have created a new remote site having Remote Site URL:https://beta.pelco.com:8443
I am using a following call out apex
Http http = new Http();
        HttpRequest req = new HttpRequest();
        req.setEndpoint('https://beta.pelco.com:8443/tasks/rest/api/latest/issue/SUSTAIN-4763'+'&os_username=' + 'testuser' + 
                        '&os_password=' + 'password');
        req.setMethod('GET');
        
        HttpResponse res = http.send(req);

        // Log the JSON content
        System.debug('JSON Response: ' + res.getBody());

I am getting following error message:
System.CalloutException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
There are two ways to make a callout to Jira Application:
  1. using self signed certificate. 
  2. Two way SSL methord
I used the first method. I downloaded a self signed certificate and gave it to Jira team to install. However, even after installing the applicaiton is not going through.

Any suggestions/recommendations?
 

hi guys, 
I am a newbie in Salesforce. I have some very basic adminstration questions:
Questions1: what is the best way of creating multiple price book in Salesforce? …. cloning
Question 2: Does profile permission override criteria sharing permission on an object? I think yes
Question 3: How to improve the relevance of search results for knowledge articles?
Question 4: how to restrict user’s access to knowledge category groups?
Question 5: Can a sales manager apply dashboard filter to individual view sales team’s data?

Best Regards
Question 6. How to keep track of delegated administrator activities?
Question 7. How to count number of contact on Account (without apex)?
Guys, 
I have scheduled an hourly batch job. I want the job to start at 30 minutes instead of the begining of an hour. I was wondering how can I acomplish it.
Below is the code:
String CRON_EXP1 = '0 0 * * * ?';
ScheduleBatchWarehouseUpdate schU = new ScheduleBatchWarehouseUpdate();
system.schedule('Hourly  Warehouse Update', CRON_EXP1, schU);

 
Hi, 
I need to schedule following code:
tempuriOrg.QantelDataServiceEndPoint NewTempUri= new tempuriOrg.QantelDataServiceEndPoint();

      NewTempUri.ProcessWarehouseInventory('username','password');

I was wondering if someone could recommend me the best way to schedule. Should  I create a new class that implements Schedulable 
Any suggestions?
I was able to create a apex classes from WSDL. Now, I need to create a test class for code coverage. This requires doing a mock call to the web service. I am having difficultly creating test classes.
  1. First I started with a class that implements WebServiceMock. In this class I created a response element, populated it and add response element.
@isTest
global class WebServiceTestMock implements WebServiceMock {
	global void doInvoke(
	                     Object stub,
	                     Object request,
	                     Map<String, Object> response,
	                     String endpoint,
	                     String soapAction,
	                     String requestName,
	                     String responseNS,
	                     String responseName,
	                     String responseType)
	{

		//Create Response element form the autogenerated class.
		tempuriOrg.ProcessWarehouseInventoryResponse_element request_x = new tempuriOrg.ProcessWarehouseInventoryResponse_element();
		//populate response element
		tempuriOrg.ProcessWarehouseInventoryResponse_element response_x;
		//Add response element to the reponse parameter
		response.put('response_x', response_x);

	}
}
 2. ​ Next, I created a new class that populates end point and invokes EchoString Method
public class WebServiceCallout
{
	public static String callEchoString(String input)
	{

		
		tempuriOrg.QantelDataServiceEndPoint.endpoint_x = 'http://api.salesforce.com/foo/bar';

		// This invokes the EchoString method in the generated class
		String echo = sample.EchoString(input);

		return echo;
	}

}

3. Finally, I created a test class to fake a response to be generated
@isTest
private class WebSvcCalloutTest
{
	@isTest static void testEchoString()
	{
		// This causes a fake response to be generated
		Test.setMock(WebServiceMock.class, new WebServiceTestMock());

		// Call the method that invokes a callout
		//String output = WebServiceCallout.callEchoString('Hello World!');
		
		// Verify that a fake result is returned
		//System.assertEquals('Mock response', output);
	}


}
Please help me out or point me to the right resource !!

Regards, 
Gaurav
Hello, 
I am trying to explore different possiblity from Schema class. I beleive this class is a good resource for all programmers.
I am trying to display text fields of a custom object. The script below gives me all the fields 


public Map <String, Schema.SObjectType> schemaMap = Schema.getGlobalDescribe();
Map <String, Schema.SObjectField> fieldMap = schemaMap.get('Account').getDescribe().fields.getMap();
system.debug(fieldMap);


How can i get the field property so that i can filter all text fields?
Hi All, 
I have a requirement where a user is asking for a delete access to a standard object. Now, I really don't want to create a new profile for the user. Can this issue be resolved using a permission set?

Thanks in Advance,
 
Hello, 
 I am in a process of understanding developer console log and the best and fastest way to resolve "Too Many Query Rows:50001" error.

In general there seems to be two methods to diagnose this issue. 
1. filter the log on SOQL_EXECUTE_LOG to track the result of each query
2. Execute limit on Execution overview to track result of each SOQL query used in the code.

I tend to lean toward number 2, but i could be wrong. what would you guys recommend?
is there any other place in the developer console where i can look for this information faster.

Thanks in advance, 
Gaurav
Hi 
I am trying to understand the actionsupport tag used in visualforce page. The classic defination is that it is a component that add support to another component that refreshed asynchonously when a particular event occurs.

Is it safe to assume that it is responsible to trigger controller actions in response to DOM element events.

why would i not use apex:commandButton instead? what is different?
what is the difference between Email to case and on demand email to case. we have a need where we need to generate cases by any email server. what would be the most recommended approach
Hi, 
I am able to create apex classes from WSDL using FuseIt ( v3.2.26095.1), however, i am unable to create test classes for code coverage. I do see a button but it does not generate classes.Did anyone experienced the same issue?

hi guys, 
I am a newbie in Salesforce. I have some very basic adminstration questions:
Questions1: what is the best way of creating multiple price book in Salesforce? …. cloning
Question 2: Does profile permission override criteria sharing permission on an object? I think yes
Question 3: How to improve the relevance of search results for knowledge articles?
Question 4: how to restrict user’s access to knowledge category groups?
Question 5: Can a sales manager apply dashboard filter to individual view sales team’s data?

Best Regards
Question 6. How to keep track of delegated administrator activities?
Question 7. How to count number of contact on Account (without apex)?
Guys, 
I have scheduled an hourly batch job. I want the job to start at 30 minutes instead of the begining of an hour. I was wondering how can I acomplish it.
Below is the code:
String CRON_EXP1 = '0 0 * * * ?';
ScheduleBatchWarehouseUpdate schU = new ScheduleBatchWarehouseUpdate();
system.schedule('Hourly  Warehouse Update', CRON_EXP1, schU);

 
Hi, 
I need to schedule following code:
tempuriOrg.QantelDataServiceEndPoint NewTempUri= new tempuriOrg.QantelDataServiceEndPoint();

      NewTempUri.ProcessWarehouseInventory('username','password');

I was wondering if someone could recommend me the best way to schedule. Should  I create a new class that implements Schedulable 
Any suggestions?
I was able to create a apex classes from WSDL. Now, I need to create a test class for code coverage. This requires doing a mock call to the web service. I am having difficultly creating test classes.
  1. First I started with a class that implements WebServiceMock. In this class I created a response element, populated it and add response element.
@isTest
global class WebServiceTestMock implements WebServiceMock {
	global void doInvoke(
	                     Object stub,
	                     Object request,
	                     Map<String, Object> response,
	                     String endpoint,
	                     String soapAction,
	                     String requestName,
	                     String responseNS,
	                     String responseName,
	                     String responseType)
	{

		//Create Response element form the autogenerated class.
		tempuriOrg.ProcessWarehouseInventoryResponse_element request_x = new tempuriOrg.ProcessWarehouseInventoryResponse_element();
		//populate response element
		tempuriOrg.ProcessWarehouseInventoryResponse_element response_x;
		//Add response element to the reponse parameter
		response.put('response_x', response_x);

	}
}
 2. ​ Next, I created a new class that populates end point and invokes EchoString Method
public class WebServiceCallout
{
	public static String callEchoString(String input)
	{

		
		tempuriOrg.QantelDataServiceEndPoint.endpoint_x = 'http://api.salesforce.com/foo/bar';

		// This invokes the EchoString method in the generated class
		String echo = sample.EchoString(input);

		return echo;
	}

}

3. Finally, I created a test class to fake a response to be generated
@isTest
private class WebSvcCalloutTest
{
	@isTest static void testEchoString()
	{
		// This causes a fake response to be generated
		Test.setMock(WebServiceMock.class, new WebServiceTestMock());

		// Call the method that invokes a callout
		//String output = WebServiceCallout.callEchoString('Hello World!');
		
		// Verify that a fake result is returned
		//System.assertEquals('Mock response', output);
	}


}
Please help me out or point me to the right resource !!

Regards, 
Gaurav
I am preparing for salesforce developer I certification and ran into a question:
 
A Developer wants to create a custom object to track Customer Invoices.
How should Invoices and Accounts be related to relate that all invoices are visible to everyone with access to the Account?
Of course it’s going to be a master detail relationship
There are two options:
The Invoice should have master detail relationship to the Account
 The Account should have master detail relationship to the Invoice.I want to know what is the difference between the two. They both look similar.
Can someone please help
Gurus, 
I am new to salesforce.com. I need help with creating test class. 
Class:
public class ProductSearchController
{
	public ProductSearchDataModel productSearchData { get; set; }

	public ProductSearchController(ApexPages.StandardController controller)
	{
		this.productSearchData = new ProductSearchDataModel();

		Id quoteId = ApexPages.currentpage().getparameters().get('Id');
        
        ProductSearch_GetQuoteLineItems getQuoteLineItems = new ProductSearch_GetQuoteLineItems();

        this.productSearchData.productsOnQuote = getQuoteLineItems.Execute(quoteId);
	}

	public PageReference runSearch()
	{
        productSearchData.hasRecords = false;
        
        String productNumber = Apexpages.currentPage().getParameters().get('productNumber');
        String productDescription = Apexpages.currentPage().getParameters().get('productDescription');
        String productType = Apexpages.currentPage().getParameters().get('productType');

        if (productSearchData.productsFromSearch != null)
        {
            productSearchData.productsFromSearch.clear();
        }
        
        if (productNumber.Length() > 1 || productDescription.length() > 1 || productType.length() > 1)
		{
			ProductSearchProcess productSearch = new ProductSearchProcess();

			productSearchData.productsFromSearch = productSearch.GetProducts(productNumber, productDescription, productType);
            
            if(!productSearchData.productsFromSearch.isEmpty())
            {
                productSearchData.hasRecords = true;
            }
		}

		return null;
	}
	
	public PageReference ProcessSelectedProducts()
	{
		Id quoteId = System.currentPageReference().getParameters().get('id');
        
		ProductSearchProcessSave saveProducts = new ProductSearchProcessSave();

		String uiMessage = saveProducts.SaveSelectedProducts(quoteId, productSearchData);

		if (uiMessage != null)
		{
			ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, uiMessage));
		}

		return null;
	}

	public PageReference BackToQuote()
	{
		Id quoteNumber = System.currentPageReference().getParameters().get('id');

		string Oppty_Id = [SELECT OpportunityId FROM Quote WHERE Id = :quoteNumber].OpportunityId;
		boolean AccntOpty = [SELECT Account_Opportunity__c FROM Opportunity WHERE Id = :Oppty_Id].Account_Opportunity__c;

		if (AccntOpty == true)
		{
			return new PageReference('/apex/newquotepage?id=' + QuoteNumber);
		}

		if (AccntOpty == false)
		{
			return new PageReference('/' + QuoteNumber);
		}

		return new PageReference('/' + QuoteNumber);
	}
}

Test Class:
@isTest
private class ProductSearchProcess_Tests
{
    @testSetup static void GetTestData()
    {
        TestDataFactory_Accounts.Execute();
        TestDataFactory_Products.Execute();
        TestDataFactory_SpecialDiscounts.Execute();
        TestDataFactory_Pricebook.Execute();
        TestDataFactory_ExchangeRates.Execute();
        List<Opportunity> testOpportunities = new List<Opportunity> ();
        List<Quote> testQuotes = new List<Quote> ();
        List<Account> testAccounts = [Select Id from Account];
        
        integer i = 0;
        
        for (Account testAccount : testAccounts)
        {
            Opportunity opty = new Opportunity();
            
            opty.Name = 'Opportunity' + i;
            opty.AccountId = testAccount.Id;
            opty.CloseDate = System.today().addMonths(1);
            opty.StageName = 'Prospect';
            
            testOpportunities.add(opty);
            
            i++;
        }
        
        insert testOpportunities;
        
        i = 0;
        
        //inserting test Quotes
        
        Id StandardPriceBookId = test.getStandardPricebookId();
        
        for (Opportunity testOpportunity : testOpportunities)
        {
            Quote newQuote = new Quote();
            
            newQuote.Pelco_Account_Name__c = testOpportunity.AccountId;
            newQuote.OpportunityId = testOpportunity.Id;
            newQuote.Name = 'Test Quote' + i;
            newQuote.Pricebook2Id = StandardPriceBookId;
            
            TestQuotes.add(newQuote);
            
            i++;
        }
        
        insert TestQuotes;
        system.debug('TestQuotes='+TestQuotes);
        system.debug('testOpportunities='+testOpportunities);
    }
    //Positive Tests
    private static testMethod void Test_Product()
    {
        
        PageReference pageRef = page.ProductSearch;
        
        Test.setCurrentPageReference(pageRef);
        
        system.debug('pageRef'+pageRef);
        
        List<Quote> testQuotes = [select id,name from Quote];
        
        ProductSearch_GetQuoteLineItems getQuoteLineItems = new ProductSearch_GetQuoteLineItems();
        
		ApexPages.CurrentPage().getparameters().put('id', TestQuotes[0].id);
        ApexPages.currentPage().getParameters().put('productNumber', 'EPM');
		ApexPages.currentPage().getParameters().put('productDescription', 'En');
		ApexPages.currentPage().getParameters().put('productType', 'i');
        
		system.debug('TestQuotes[0].id='+TestQuotes[0].id);         
        
		Test.startTest();
              
        ApexPages.StandardController sc = new ApexPages.standardController(TestQuotes[0]);
        
        ProductSearchController psController = new ProductSearchController(sc);
                
        psController.runSearch();
        
        psController.ProcessSelectedProducts();
        
        Test.stopTest();
       
        //Test.startTest();
        
        //ProductSearchProcess search = new ProductSearchProcess();
        
        //List<ProductSearchItemDataModel> productsFromSearch = search.GetProducts('tb1', '', '');
        
        //Integer actualValue = productsFromSearch.size();
        
        //Test.stopTest();
        
        //System.assertEquals(1, actualValue);
    }
}

I am not sure why it has 0 code coverage.

Regards, 
Gaurav
Gurus,
I never came across such an issue. I am opening a visual force page by a button and passing Quote Id. This page has three 4 buttons that open a URL within salesforce. The issue is that the Quote Id has an extra 3 characters at the end of Quote Id and it does not open the right URL.
Here is the class:
public class QuoteToExcelClass {

public String Page {get; set;}
    public String OpenPageURL {get; set;}
    public Id sQuoteId {get; set;}
    
    public void QuoteToExcelClass(ApexPages.StandardController controller )
    {

    }
    
        
    
    public void QuoteToExcelClass()
    {
        Page = '' ;
        OpenPageURL = '' ;
    }
    
    public void redirect()
    {
        sQuoteId= ApexPages.currentpage().getparameters().get('id');
        if(Page == 'Dealer')
        {
            OpenPageURL = 'https://pelcosales.schneider-electric.com/Salesforce/ExportQuote/Index/'+sQuoteId+'/Dealer';
        }
       if(Page == 'Standard')
        {
            OpenPageURL = 'https://pelcosales.schneider-electric.com/Salesforce/ExportQuote/Index/'+sQuoteId+'/Standard';
        }
       if(Page == 'Discounted')
        {
            OpenPageURL = 'https://pelcosales.schneider-electric.com/Salesforce/ExportQuote/Index/'+sQuoteId+'/Dealer';
        }
       if(Page == 'MSRP')
        {
            OpenPageURL = 'https://pelcosales.schneider-electric.com/Salesforce/ExportQuote/Index/'+sQuoteId+'/Dealer';
        }
        
    }    


}

Here is Page:
<apex:page id="pg" standardController="Quote" extensions="QuoteToExcelClass">

<apex:form >

<apex:actionFunction action="{!redirect}" name="OpenPage" reRender="pb,theIframe">
    <apex:param assignTo="{!Page}" value="" name="param1"/>
</apex:actionFunction>


    <apex:pageBlock id="pb">

        <apex:pageBlockButtons >
            <apex:commandButton value="Discounted" onclick="OpenPage('Discounted'); return false;"/>
            <apex:commandButton value="MSRP" onclick="OpenPage('MSRP'); return false;"/>
            <apex:commandButton value="Standard" onclick="OpenPage('Standard'); return false;"/>
            <apex:commandButton value="Dealer" onclick="OpenPage('Dealer'); return false;"/>
        </apex:pageBlockButtons>
        <apex:outputText style="font-style:italic" value=" this is just a test value will not be in Production: {!OpenPageURL}">
            </apex:outputText>
        <apex:iframe id="theIframe" src="{!OpenPageURL}" scrolling="true"/>

    </apex:pageBlock>


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

User-added image

As you can see there are 3 extra characters "CAK" after Quote Id  

Regards, 
Gaurav

Hi ,

 

  My scenario is , if i create a employee details record in in salesforce , It will be Display in SAP/PI. 

 

  Employee objects

 

  Fields - Name,Ename__c & Salary__c

 

  Steps:

1) generate Apex class from sap/pi WSDL

2) create a new apex class (future methods ) and set enerated class end point.

3) write a trigger , to call future methods apex class

   

Generated Apex class from SAP PI system

 

public class intrigoSoapSforceCom456 {
    public class HTTPS_Port {
        public String endpoint_x = 'http://ca-in02:520/XISOAPAdapter/MessageServlet?senderParty=&senderService=BC_SFDCTEST&receiverParty=&receiverService=&interface=SI_SFDC_OUT&interfaceNamespace=urn:intrigo.soap.sforce.com';
        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[]{'urn:intrigo.soap.sforce.com', 'intrigoSoapSforceCom456'};
        public intrigoSoapSforceCom456.Response_element[] SI_SFDC_OUT(intrigoSoapSforceCom456.Employee_element[] Employee) {
            intrigoSoapSforceCom456.SfdcTest_Request request_x = new intrigoSoapSforceCom456.SfdcTest_Request();
            intrigoSoapSforceCom456.SFDCResponse response_x;
            request_x.Employee = Employee;
            Map<String, intrigoSoapSforceCom456.SFDCResponse> response_map_x = new Map<String, intrigoSoapSforceCom456.SFDCResponse>();
            response_map_x.put('response_x', response_x);
            WebServiceCallout.invoke(
              this,
              request_x,
              response_map_x,
              new String[]{endpoint_x,
              'http://sap.com/xi/WebService/soap1.1',
              'urn:intrigo.soap.sforce.com',
              'MT_SFDC_Request',
              'urn:intrigo.soap.sforce.com',
              'MT_SFDC_Response',
              'intrigoSoapSforceCom456.SFDCResponse'}
            );
            response_x = response_map_x.get('response_x');
            return response_x.Response;
        }
    }
    public class Response_element {
        public String sapno;
        private String[] sapno_type_info = new String[]{'sapno','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
        private String[] apex_schema_type_info = new String[]{'urn:intrigo.soap.sforce.com','false','false'};
        private String[] field_order_type_info = new String[]{'sapno'};
    }
    public class SFDCResponse {
        public intrigoSoapSforceCom456.Response_element[] Response;
        private String[] Response_type_info = new String[]{'Response','urn:intrigo.soap.sforce.com','Response_element','1','-1','false'};
        private String[] apex_schema_type_info = new String[]{'urn:intrigo.soap.sforce.com','false','false'};
        private String[] field_order_type_info = new String[]{'Response'};
    }
    public class Employee_element {
        public String EmployeeNo;
        public String Ename;
        public String Salary;
        private String[] EmployeeNo_type_info = new String[]{'EmployeeNo','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
        private String[] Ename_type_info = new String[]{'Ename','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
        private String[] Salary_type_info = new String[]{'Salary','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
        private String[] apex_schema_type_info = new String[]{'urn:intrigo.soap.sforce.com','false','false'};
        private String[] field_order_type_info = new String[]{'EmployeeNo','Ename','Salary'};
    }
    public class SfdcTest_Request {
        public intrigoSoapSforceCom456.Employee_element[] Employee;
        private String[] Employee_type_info = new String[]{'Employee','urn:intrigo.soap.sforce.com','Employee_element','1','-1','false'};
        private String[] apex_schema_type_info = new String[]{'urn:intrigo.soap.sforce.com','false','false'};
        private String[] field_order_type_info = new String[]{'Employee'};
    }
}

 

 

Apex class :

 

global class WebServiceCallout123 {
 
    @future (callout=true)
    WebService static void sendNotification(String EmployeeNo ,String Ename, String Salary) {
     //Set your username and password here
        String username = 'nreddy';
        String password = 'sappi123';
 
        //Construct HTTP request and response
        HttpRequest req = new HttpRequest();
        HttpResponse res = new HttpResponse();
        Http http = new Http();
        
         //Construct Authorization and Content header
        Blob headerValue = Blob.valueOf(username+':'+password);
        String authorizationHeader = 'Basic ' + EncodingUtil.base64Encode(headerValue);
        req.setHeader('Authorization', authorizationHeader);
       req.setHeader('Content-Type','application/json');
        
         //Set Method and Endpoint and Body
        req.setMethod('POST');
        req.setEndpoint('http://ca-in02:520/XISOAPAdapter/MessageServlet?senderParty=&senderService=BC_SFDCTEST&receiverParty=&receiverService=&interface=SI_SFDC_OUT&interfaceNamespace=urn:intrigo.soap.sforce.com');
        
        req.setBody('{"EmployeeNo":"'+EmployeeNo+'","ename":"'+ename+'","Salary":"'+Salary+'"}');
        System.debug('EmployeeNo -->' + EmployeeNo); 
        try {
           //Send endpoint to JIRA
           res = http.send(req);
            
        } catch(System.CalloutException e) {
            System.debug(res.toString());
        }
    }

 

    
    public static testMethod void testMe() {
        WebServiceCallout123.sendNotification('aza','aza','aza');
    }
 
}

 

trigger:

 

trigger InsertEcc on Employee__c (after Insert) {

for(Employee__c s:Trigger.New)
{
   
     WebServiceCallout123.sendNotification(s.Name,s.Ename__c,s.Salary__c);
     System.debug('Emp data -->' + s);

 

}

}

 

The problem is it is not affected in sap /pi. Any body have a idea. what wrong i done? please help me