• Travis Hendrix
  • NEWBIE
  • 10 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 3
    Replies
I have a trigger here is its code: 
trigger QuoteTrigger on Quote (before insert, before update, before delete, after insert, after update, after delete, after undelete) {

	QuoteTriggerHandler qth = new QuoteTriggerHandler();

	if (Trigger.isBefore) {
    	if(Trigger.isInsert){
    		qth.OnBeforeInsert(Trigger.new);
    	}
    	else if(Trigger.isUpdate){
    		qth.OnBeforeUpdate(Trigger.old,Trigger.new,trigger.newMap, Trigger.oldMap);
    	}
    	else if(Trigger.isDelete){
    		qth.OnBeforeDelete(trigger.old,Trigger.newMap, Trigger.oldMap);
    	}    
	} 
	else if (Trigger.isAfter) {
    	if(Trigger.isInsert){
    		qth.OnAfterInsert(Trigger.new,trigger.newMap);
       	}
       	else if(Trigger.isUpdate){
    		qth.OnAfterUpdate(Trigger.old,Trigger.new,trigger.newMap, Trigger.oldMap);
    	}
    	else if(Trigger.isDelete){
    		qth.OnAfterDelete(trigger.old,Trigger.newMap, Trigger.oldMap);
    	}    
	}

}
When trying to deploy it from the sandbox to production I get the error: The following triggers have 0% code coverage. Each trigger must have at least 1% code coverage.  
I have a bunch of test classes that insert a quote but it still says 0% coverage.  I have tried deploying the test class and then the trigger or the trigger and test class at the same time and still the same error.  I finally wrote the following test just to cover the trigger:
@isTest
public with sharing class QuoteTriggerTest {
	public QuoteTriggerTest() {}

	@isTest static void Test_QuoteTrigger(){
		Test.startTest();
		CreateSobjectForTesting coft = new CreateSobjectForTesting();
		Account a = (Account)coft.CreateObject('Account');
		insert a;
		Opportunity o = (Opportunity)coft.CreateObject('Opportunity');
		o.AccountId = a.id;
		o.Contact_Email__c = 'test@test.com';
		o.Modified_ARR__c = False;
		o.Manager__c = 0;
		insert o;
		Product2 prod = (Product2)coft.CreateObject('Product2');
		insert prod;
		Id pricebookId = Test.getStandardPricebookId();
		PricebookEntry standardPrice = new PricebookEntry(Pricebook2Id = pricebookId, Product2Id = prod.Id, UnitPrice = 10000, IsActive = true);
		insert standardPrice;
		Quote q = (Quote)coft.CreateObject('Quote');
		q.OpportunityId = o.id;
		q.Eval_Days__c = '3';
		q.PriceBook2Id = pricebookId;
		insert q;
		Test.stopTest();
	}
}
I still get the same error.  This is happening for 2 different triggers.
I am trying to query validation rules in apex.  I was trying to do it with a callout but keep getting an error: No operation available for request.  Here is the code I am using.
HTTP h = new HTTP();
HTTPRequest req = new HTTPRequest();
req.setMethod('GET');
req.setHeader('Content-Type', 'text/xml');
req.setHeader('SOAPAction', 'ValidationRule');



String b = '';
b += '<?xml version="1.0" ?>';
b += '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:metadata.tooling.soap.sforce.com">';
b += '<soapenv:Header>';
b += '<urn:SessionHeader>';
b += '<urn:sessionId>'+UserInfo.getSessionId()+'</urn:sessionId>';
b += '</urn:SessionHeader>';
b += '</soapenv:Header>';
b += '<soapenv:Body>';
b += '<urn:ValidationRule>';
b += '</urn:ValidationRule>';
b += '</soapenv:Body>';
b += '</soapenv:Envelope>';

req.setBody(b);
req.setCompressed(false);
req.setEndpoint('https://na34.salesforce.com/services/Soap/T/35.0');
HTTPResponse resp = h.send(req);
System.debug(resp.getBody());


 
I am trying to figure out how to use the Rest-Api.  I am getting the error No operation available for request {urn:enterprise.soap.sforce.com}describeSObject I am not sure what I am doing wrong.
HTTP h = new HTTP();
HTTPRequest req = new HTTPRequest();
req.setMethod('GET');
req.setHeader('Content-Type', 'text/xml');
req.setHeader('SOAPAction', 'describeSObject');
//req.setHeader('Authorization', 'OAuth'+UserInfo.getSessionId());



String b = '';
b += '<?xml version="1.0" ?>';
b += '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:enterprise.soap.sforce.com">';
b += '<soapenv:Header>';
b += '<urn:SessionHeader>';
b += '<urn:sessionId>'+UserInfo.getSessionId()+'</urn:sessionId>';
b += '</urn:SessionHeader>';
b += '</soapenv:Header>';
b += '<soapenv:Body>';
b += '<urn:describeSObject>';
b += '<urn:sObjectType>Account</urn:sObjectType>';
b += '</urn:describeSObject>';
b += '</soapenv:Body>';
b += '</soapenv:Envelope>';

req.setBody(b);
req.setCompressed(false);
req.setEndpoint('https://na34.salesforce.com/services/Soap/u/25.0');
HTTPResponse resp = h.send(req);
System.debug(resp.getBody());

 
I am trying to figure out how to use the Rest-Api.  I am getting the error No operation available for request {urn:enterprise.soap.sforce.com}describeSObject I am not sure what I am doing wrong.
HTTP h = new HTTP();
HTTPRequest req = new HTTPRequest();
req.setMethod('GET');
req.setHeader('Content-Type', 'text/xml');
req.setHeader('SOAPAction', 'describeSObject');
//req.setHeader('Authorization', 'OAuth'+UserInfo.getSessionId());



String b = '';
b += '<?xml version="1.0" ?>';
b += '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:enterprise.soap.sforce.com">';
b += '<soapenv:Header>';
b += '<urn:SessionHeader>';
b += '<urn:sessionId>'+UserInfo.getSessionId()+'</urn:sessionId>';
b += '</urn:SessionHeader>';
b += '</soapenv:Header>';
b += '<soapenv:Body>';
b += '<urn:describeSObject>';
b += '<urn:sObjectType>Account</urn:sObjectType>';
b += '</urn:describeSObject>';
b += '</soapenv:Body>';
b += '</soapenv:Envelope>';

req.setBody(b);
req.setCompressed(false);
req.setEndpoint('https://na34.salesforce.com/services/Soap/u/25.0');
HTTPResponse resp = h.send(req);
System.debug(resp.getBody());

 
When action function calls apex controller method to upload a file it shows an error and abort the execution.

It shows a message when i start execution of action function.

Request entity is too large
You have an request that is too large (posted form is too big, URL is too long, etc)
__MISSING LABEL__ PropertyFile - val JettyIllegalRequest_reason not found in section Exception: Form too large 26976850>25000000

User-added image

I am adding a few command buttons dynamically by using the 

<apex:dynamicComponent/>

 

For each command button's controller action, I want to pass in a parameter value so that I know which button has been pressed. Each command button needs to have a different parameter value associated with it.

 

The use case is:

I want to display list of items a user can purchase. Each is a button. When the user clicks on the button, I need to have an item id associated with that item. These items are not regular Salesforce entities and are populated from a remote web-service call.

 

All the examples I have seen so far are simple and deal with only 1 button and on static Apex pages. None show how to pass a parameter to the controller action from a commandButton that is created dynamically.

 

How can I do this?