• Lukas van Rooyen
  • NEWBIE
  • 10 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 1
    Replies
public with sharing class StackItCalculationInfo 
{
       public class UserInput
       {
        @InvocableVariable(required = true)
        public String ItemId;
        @InvocableVariable(required = true)
        public String ClientId;
        @InvocableVariable(required = true)
        public String QuoteId;

    }
     
    

    @InvocableMethod(label='Calculation Info')
    public static void CalcInfo(List<UserInput> userInputs)
    {
           UserInput userInput = userInputs[0];
           string jsonData = JSON.serialize('{"ItemId":' + userInput.ItemId + ', "ClientId":' + userInput.ClientId + ', "QuoteId":' + userInput.QuoteId +'}');
        doCalloutFromFuture(jsonData);
               
    }
    
    @future(callout=true)
    public static void doCalloutFromFuture(string jsonData){
        Http http = new Http();
        HttpRequest request = new HttpRequest();
           request.setTimeout(25000);
        request.setEndpoint('https://endpoint');
        request.setMethod('POST');
        request.setHeader('Content-Type', 'application/json;charset=UTF-8');
        // Set the body as a JSON object
        request.setBody(jsonData);
        HttpResponse response = http.send(request);
        
        // Parse the JSON response
        if (response.getStatusCode() != 200) 
        {

            System.debug('The status code returned was not expected: ' +
            response.getStatusCode() + ' ' + response.getStatus());
        } 
        else 
        {

            System.debug(response.getBody());
        }
    }


}
Error Occurred: Too many DML rows: 10001
Getting this error when trying to insert data via a flow.
Hi all, first time receiving this error. I am trying to deploy my batchable/schedulable apex class.

 Milestone1_Email_Handler_TsttestEmailWithAttachmentsSystem.AssertException: Assertion Failed
Stack Trace: Class.Milestone1_Email_Handler_Tst.testEmailWithAttachments: line 104, column 1

Milestone1_Email_Handler_TsttestEmailWithoutAttachmentsSystem.AssertException: Assertion Failed
Stack Trace: Class.Milestone1_Email_Handler_Tst.testEmailWithoutAttachments: line 60, column 1

Milestone1_Email_Handler_TsttestNoAliasWithDefaultMilestoneAliasSystem.AssertException: Assertion Failed
Stack Trace: Class.Milestone1_Email_Handler_Tst.testNoAliasWithDefaultMilestoneAlias: line 310, column 1
Hi all. I am required to create a button that when clicked gets the report data of the current report you are on and the converts it to pdf. 

So I was thinking it could get the data with the apex class and the be displayed on a visual force page in pdf format?
Hi all, So I wrote code in my sandbox but must deploy it to our live environment, so its 1 apex class, two visual force pages and a static component. But when I try to validate it keep saying it only has a 68% code coverage and I need 75%. What can I do? Thanks 
I need to use Contact__c that I got in pol info query to compare it to the id of the cnt info query to get that info but what I have is obviously incorrect. Anybody have idea to fix that? Thank you.    

InputId = ApexPages.currentPage().getParameters().get('InputId');      

 PolInfo=[Select Id,Name,Policy_Number__c, Contact__c From PolContract__c where Id=:InputId];  
     
CntInfo=[Select Id,Name, MailingAddress from Contact where Id=:PolInfo.Contact__c];
Hi all, first time receiving this error. I am trying to deploy my batchable/schedulable apex class.

 Milestone1_Email_Handler_TsttestEmailWithAttachmentsSystem.AssertException: Assertion Failed
Stack Trace: Class.Milestone1_Email_Handler_Tst.testEmailWithAttachments: line 104, column 1

Milestone1_Email_Handler_TsttestEmailWithoutAttachmentsSystem.AssertException: Assertion Failed
Stack Trace: Class.Milestone1_Email_Handler_Tst.testEmailWithoutAttachments: line 60, column 1

Milestone1_Email_Handler_TsttestNoAliasWithDefaultMilestoneAliasSystem.AssertException: Assertion Failed
Stack Trace: Class.Milestone1_Email_Handler_Tst.testNoAliasWithDefaultMilestoneAlias: line 310, column 1