• SImmy
  • NEWBIE
  • 30 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 17
    Questions
  • 36
    Replies
{
schema = Azwp7Vtcy9VYKAoWJOhjcQ, payload = {
	Message_Details6__c = null,
	CreatedById = 0053 L000000WNRFQA4,
	Source__c = Salesforce,
	AccountId__c = null,
	Message_Action__c = Testing_Workorder,
	Message_Details9__c = null,
	Message_Details1__c = {
		"WORK_ORDER": {
			"WTF": null,
			"WASTE_PRODUCER_POST_CODE": "",
			"WASTE_PRODUCER_NAME": "",
			"WASTE_PRODUCER_ID": "0013L000003wGh8QAE",
			"WASTE_PRODUCER_EMAIL": "",
			"WASTE_PRODUCER_ADDR_4": "",
			"WASTE_PRODUCER_ADDR_3": "",
			"WASTE_PRODUCER_ADDR_2": "",
			"WASTE_PRODUCER_ADDR_1": "",
			"VEHICLE_TYPE": null,
			"VEHICLE_REG": null,
			"Numbers": "As List",
			"DESCRIPTION": "As List",
			"WORKORDER": "970400090053",
			"LOAD_TYPE": null,
			"Load_Num_Code": "00001859",
			"LICENCE_NO": null,
			"ID": "08p3L0000000iHs"			
		}
	},
	Message_Details12__c = null,
	Message_Details10__c = null,
	CreatedDate = 2020 - 09 - 23 T04: 10: 19.997 Z,
}, event = {
	replayId = 19738
}
}
I am getting the payload without any json format, Inside the Message_Details1__c I am sending the json from salesforce but in eclipse I am getting the above json. Now I want to desrialize it please help me with this one. How to deserialize it because it is incorrect json payload.
 
  • September 30, 2020
  • Like
  • 0
import javax.net.ssl.HttpsURLConnection;
import java.io.*;
import java.net.URL;
import java.util.Base64;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class OauthAuthentication {
	private static final Pattern pat = Pattern.compile(".*\"access_token\"\\s*:\\s*\"([^\"]+)\".*");
	private static final String clientId = "jdiwiweoiwe.NxkdgEZTQHC3SvdVQyFm5eSmbiDCQ";//clientId
	private static final String clientSecret = "fhdkhskjs";//client secret
	private static final String tokenUrl = 'https://login.salesforce.com/services/oauth2/token";
	private static final String auth = clientId + ":" + clientSecret;
	private static final String authentication = Base64.getEncoder().encodeToString(auth.getBytes());
	private static String userName="xyz";
	private static String password="abc";
	public static void main(String[] args) throws IOException 
	{
	
	//Username is netId for the person making the call and the password is there password
	String content = "grant_type=password&username=" + userName + "&password=" + password;
    BufferedReader reader = null;
    HttpsURLConnection connection = null;
    String returnValue = "";
    try {
    	System.out.println("authentication"+authentication);
        URL url = new URL(tokenUrl);
        connection = (HttpsURLConnection) url.openConnection();
        connection.setRequestMethod("POST");
        connection.setDoOutput(true);
        connection.setRequestProperty("Authorization", "Basic " + authentication);
        connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
        connection.setRequestProperty("Accept", "application/json");
       
        PrintStream os = new PrintStream(connection.getOutputStream());
        os.print(content);
        os.close();
        System.out.println("content"+content);
        /*reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
        String line = null;
        StringWriter out = new StringWriter(connection.getContentLength() > 0 ? connection.getContentLength() : 2048);
        while ((line = reader.readLine()) != null) {
            out.append(line);
        }
        String response = out.toString();
        System.out.println("output="+response);
        Matcher matcher = pat.matcher(response);
        if (matcher.matches() && matcher.groupCount() > 0) {
            returnValue = matcher.group(1);
        }*/
        System.out.println("response : " + connection.getResponseMessage());
 
    } catch (Exception e) 
    {
        System.out.println("Error : " + e.getMessage()+"\n"+e.getCause()+"\n"+e.getStackTrace()+"\n"+e.getLocalizedMessage());
    } finally {
        if (reader != null) {
            try {
                reader.close();
            } catch (IOException e) {
            }
        }
        connection.disconnect();
    }
	}
}

Error Response : Bad Request

 
  • September 11, 2020
  • Like
  • 0
I am getting following error : 19:40:18:141 USER_DEBUG [89]|DEBUG|Workday Submit Customer Error : System.CalloutException: IO Exception: Unable to tunnel through proxy. Proxy returns "HTTP/1.1 503 Service Unavailable"

Please help or guide me the correct way. Thanks a lot in advance.
  • July 02, 2020
  • Like
  • 0

 
String Customer_Dataa='{"version":"string","Customer_Data":{"Customer_ID":"string","Customer_Reference_ID":"string","Customer_Name":"string","Worktag_Only":"true","Submit":"true","Create_Customer_from_Financial_Institution_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Create_Customer_from_Supplier_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Create_Customer_from_Tax_Authority_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Create_Customer_from_Investor_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Customer_Category_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Restricted_To_Companies_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Customer_Group_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Customer_Preferred_Locale_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Customer_Preferred_Language_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Payment_Terms_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Default_Payment_Type_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"DUNS_Number":"string","Credit_Limit_Currency_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Credit_Limit":"1000.00","Hierarchy_Credit_Limit":"1000.00","Credit_Verification_Date":"2004-02-14","Commercial_Credit_Score":"1000.00","Commercial_Credit_Score_Date":"2018-11-01+00:00","Commercial_Credit_Score_Note":"string","Composite_Risk_Score":"1000.00","Composite_Risk_Date":"2013-05-22+00:00","Composite_Risk_Note":"string","Customer_Satisfaction_Score":"1000.00","Customer_Satisfaction_Date":"2002-11-05+00:00","Customer_Satisfaction_Note":"string","Tax_Code_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Tax_ID_Data":{"Tax_ID_Text":"string","Tax_ID_Type_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Transaction_Tax_ID":"false","Primary_Tax_ID":"false"},"Lockbox_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Included_Children_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Customer_Security_Segment_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Business_Entity_Data":{"Business_Entity_Name":"string","Business_Entity_Phonetic_Name":"string","External_Entity_ID":"string","Contact_Data":{"Address_Data":{"Formatted_Address":"string","Address_Format_Type":"string","Defaulted_Business_Site_Address":"false","Delete":"true","Do_Not_Replace_All":"true","Effective_Date":"2010-03-18","Country_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Last_Modified":"2018-12-28T19:51:14+00:00","Address_Line_Data":{"Descriptor":"string","Type":"string","#text":"string"},"Municipality":"string","Country_City_Reference":{"Descriptor":"string","ID":{"type":"string","parent_id":"string","parent_type":"string","#text":"string"}},"Submunicipality_Data":{"Address_Component_Name":"string","Type":"string","#text":"string"},"Country_Region_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Country_Region_Descriptor":"string","Subregion_Data":{"Descriptor":"string","Type":"string","#text":"string"},"Postal_Code":"string","Usage_Data":{"Public":"false","Type_Data":{"Primary":"true","Type_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}}},"Use_For_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Use_For_Tenanted_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Comments":"string"},"Number_of_Days":"1000.00","Municipality_Local":"string","Address_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Address_ID":"string"},"Phone_Data":{"Area_Code":"string","Tenant_Formatted_Phone":"string","International_Formatted_Phone":"string","Phone_Number_Without_Area_Code":"string","National_Formatted_Phone":"string","E164_Formatted_Phone":"string","Workday_Traditional_Formatted_Phone":"string","Delete":"false","Do_Not_Replace_All":"false","Country_ISO_Code":"str","International_Phone_Code":"string","Phone_Number":"string","Phone_Extension":"string","Phone_Device_Type_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Usage_Data":{"Public":"false","Type_Data":{"Primary":"false","Type_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}}},"Use_For_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Use_For_Tenanted_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Comments":"string"},"Phone_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"ID":"string"},"Email_Address_Data":{"Delete":"true","Do_Not_Replace_All":"true","Email_Address":"string","Email_Comment":"string","Usage_Data":{"Public":"false","Type_Data":{"Primary":"true","Type_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}}},"Use_For_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Use_For_Tenanted_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Comments":"string"},"Email_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"ID":"string"},"Instant_Messenger_Data":{"Delete":"false","Do_Not_Replace_All":"true","Instant_Messenger_Address":"string","Instant_Messenger_Type_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Instant_Messenger_Comment":"string","Usage_Data":{"Public":"false","Type_Data":{"Primary":"false","Type_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}}},"Use_For_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Use_For_Tenanted_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Comments":"string"},"Instant_Messenger_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"ID":"string"},"Web_Address_Data":{"Delete":"true","Do_Not_Replace_All":"false","Web_Address":"string","Web_Address_Comment":"string","Usage_Data":{"Public":"true","Type_Data":{"Primary":"true","Type_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}}},"Use_For_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Use_For_Tenanted_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Comments":"string"},"Web_Address_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"ID":"string"}},"Business_Entity_Logo_Image_Data":{"Filename":"string","Image":"YWM="}},"Settlement_Account_Data":{"Settlement_Bank_Account_ID":"string","Country_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Currency_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Bank_Account_Nickname":"string","Bank_Account_Type_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Bank_Name":"string","Routing_Transit_Number":"string","Branch_ID":"string","Branch_Name":"string","Bank_Account_Number":"string","Check_Digit":"string","Bank_Account_Name":"string","Roll_Number":"string","IBAN":"string","SWIFT_Bank_Identification_Code":"string","Accepts_Payment_Types_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Payment_Types_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"For_Supplier_Connections_Only":"false","Requires_Prenote":"true","Payment_Type_Prenote_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Inactive":"false","Bank_Instructions":"string","Intermediary_Bank_Data":{"Intermediary_Bank_Account_ID":"string","Intermediary_Bank_Order":"string","Country_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Currency_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Bank_Account_Nickname":"string","Bank_Account_Type_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Bank_Name":"string","Routing_Transit_Number":"string","Branch_ID":"string","Branch_Name":"string","Bank_Account_Number":"string","Check_Digit":"string","Bank_Account_Name":"string","Roll_Number":"string","IBAN":"string","SWIFT_Bank_Identification_Code":"string","Inactive":"false","Bank_Instructions":"string"}},"Credit_Card_Data":{"Merchant_Customer_Profile_ID":"string","Primary_Card":"true","Merchant_Account_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Credit_Card_Type_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"First_Name":"string","Last_Name":"string","Expiration_Date":"2016-09-11","Last_4_Digits_of_Credit_Card_Number":"stri","Customer_Profile_ID":"string"},"Approval_Status_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Customer_Status_Data":{"Customer_Status_Value_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Reason_for_Customer_Status_Change_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Customer_Status_Change_Reason_Description":"string"},"Proposed_Customer_Status_Data":{"Customer_Status_Value_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Reason_for_Customer_Status_Change_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Customer_Status_Change_Reason_Description":"string"},"Always_Separate_Payments":"false","Currency_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Accepted_Currencies_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Remit-from_Customer_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Invoice_Delivery_Method_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Invoice_Notification_Email_Recipients_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Statement_Delivery_Method_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Statement_Notification_Email_Recipients_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Dunning_Delivery_Method_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Dunning_Letter_Notification_Email_Recipients_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Electronic_Invoicing_Start_Date":"2018-07-19+00:00","Electronic_Invoicing_Government_Issued_Customer_ID":"string","Electronic_Invoicing_Intermediary_Vendor_ID":"string","Electronic_Invoicing_Vendor_Issued_Customer_ID":"string","Mandate_Required":"true","Direct_Debit_Payment_Type_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Default_Mandate_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Business_Entity_Alternate_Name_Data":{"Alternate_Name":"string","Alternate_Name_Usage_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}}},"Tax_Status_Data":{"Country_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Transaction_Tax_Status_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Withholding_Tax_Status_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}}},"Business_Entity_Attachment_Data":{"Content_Type":"string","Filename":"string","Encoding":"string","Compressed":"true","File_Content":"ZGVkaXQ=","Comment":"string"},"Note_Data":{"Created":"2006-12-05T12:02:31","Last_Updated":"2016-09-11T13:29:58","Worker_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Business_Entity_Contact_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"System_User_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Note_Content":"string"},"Followup_Date":"2005-02-02","Related_Worktags_Data":{"Replace_All":"false","Related_Worktags_by_Type_Data":{"Worktag_Type_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Required_On_Transaction":"true","Required_On_Transaction_For_Validation":"false","Default_Worktag_Data":{"Delete_Default_Value":"true","Default_Worktag_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}}},"Replace_All_Allowed_Values":"true","Allowed_Worktag_Data":{"Delete_Allowed_Value":"true","Allowed_Worktag_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}}}}}}}';

//Here I am deserializing it to my wrapper class and I am getting the error 
comWorkdayBsvc.Customer_WWS_DataType cd=new comWorkdayBsvc.Customer_WWS_DataType();
cd=(comWorkdayBsvc.Customer_WWS_DataType)json.deserialize(Customer_Dataa,comWorkdayBsvc.Customer_WWS_DataType.class); //Here it throws the error :
Error : Line: NaN, Column: undefined
Response to EXEC was : Bad Message 414
reason: URI Too Long
. HTTP CODE[414]
 
  • June 22, 2020
  • Like
  • 0
Database.saveResult[] res= Database.insert(invoiceList,false);
          Integer result2=res.size();
          System.debug('inserted invoices for SA=BA'+res);
          System.debug('result size for errorlogs loop '+result2);
          if(res.size()>0)
          {
               System.debug('debugging inside inv res ');
               for(Integer i=0; i< res.size(); i++) 
               {
                           System.debug('inside result of invoices for errorlogging');
                          if(!res.get(i).isSuccess())
                           {
                             Database.Error errors =  res.get(i).getErrors().get(0);
                             Event_Tracker__c erlog=new Event_Tracker__c();
                             erlog.Error_Description__c='Invoice creation failed for SA=BA'+'\n'+String.valueof(res.get(i).getErrors().get(0))+'\n'+invoiceList[i];
                             erlog.name='Script 2 - 2 ST_DataTransformationBatch Script has error';
                             erlog.Error_Object__c=invoiceList[i].Opportunity__c;
                             erlog.recordtypeid=evtrecordtypeid;
                             errorlogsList.add(erlog); 
                             scriptfailedoptId.add(invoiceList[i].Opportunity__c);
                                                 
                           }
                            if(res.get(i).isSuccess())
                            {
                                optyVsInvoiceId.put(invoiceList[i].Opportunity__c,invoiceList[i].Id);
                            }
               }
           }

I am able to get the debug System.debug('debugging inside inv res ');
But unable to get the debug System.debug('inside result of invoices for errorlogging');
Can somebody please help me why this strange behaviour is coming as I need to insert the errorlogs records and because of this issue my error logs are not getting inserted. Please help me or suggest what should I do.
  • April 30, 2020
  • Like
  • 0
I want to fetch the Invoice ID whenever the account matches from the map values:
InvoiceTo__c:{Id=a1m3L000000LMk9QAG, OptyAccount_For_reference__c=0017E000017irV8QAI, Name_InvoiceTo__c=0013L000002eawkQAA, Opportunity__c=0067E00000EPYbkQAH, RecordTypeId=0127E000001ikJ9QAI, CurrencyIsoCode=GBP}, InvoiceTo__c:{Id=a1m3L000000LMk9QAG, OptyAccount_For_reference__c=0017E000017irV8QAI, Name_InvoiceTo__c=0013L000002eawkQAA, Opportunity__c=0067E00000EPYbkQAH, RecordTypeId=0127E000001ikJ9QAI, CurrencyIsoCode=GBP})

If my account matches from the map values then it should trim the invoice id of that index. I want to get the invoice id from that index. How to do that please suggest.  Because you can see the opportunity can have multiple invoices, so I thought of using Substring by checking the index but somehow in comse cases it is throwing an exception.
  • April 29, 2020
  • Like
  • 0
  • April 28, 2020
  • Like
  • 0
Whenever I am trying to hit the platform  event bus in the format below then it gets successful but it's not being parsed as this has single quotes inside Message_Details__c.
{
	"Message_Name__c": "Batch Failure",
	"Source__c": "IPE",
	"Destination__c": "Salesforce",
	"Message_Action__c": "Testing",
	"Message_Details1__c":"{[{'ValidationErrorDetails': 'Duplicate Invoice Batch'},{'ValidationErrorDetails1': 'Duplicate Invoice Batch1'}]}"
}


Response : 
{
    "id": "e06xx0000000001AAA",
    "success": true,
    "errors": [
        {
            "statusCode": "OPERATION_ENQUEUED",
            "message": "1b05b592-cbec-42c1-aa3d-737d3980590c",
            "fields": []
        }
    ]



--------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------
But when I am sending the correct JSON as below then it gives me error : 

{

                "Destination__c": "Salesforce",

                 "Source__c": "IPE", 

                "Message_Action__c": "Success",

                "Message_Name__c":"Invoice",

                "Message_Details1__c": [{  "InvoiceNumber": "DRAFT-0000001", "AWSURL": "the AWS S3 bucket url for the PDF generated"}]
}


Response :

[
    {
        "message": "Cannot deserialize instance of textarea from START_ARRAY value [line:9, column:44]",
        "errorCode": "JSON_PARSER_ERROR"
    }
]

 
  • March 09, 2020
  • Like
  • 0
Whenever I am trying to hit the platform  event bus in the format below then it gets successful but it's not being parsed as this has single quotes inside Message_Details__c.
{
	"Message_Name__c": "Batch Failure",
	"Source__c": "IPE",
	"Destination__c": "Salesforce",
	"Message_Action__c": "Testing",
	"Message_Details1__c":"{[{'ValidationErrorDetails': 'Duplicate Invoice Batch'},{'ValidationErrorDetails1': 'Duplicate Invoice Batch1'}]}"
}


Response : 
{
    "id": "e06xx0000000001AAA",
    "success": true,
    "errors": [
        {
            "statusCode": "OPERATION_ENQUEUED",
            "message": "1b05b592-cbec-42c1-aa3d-737d3980590c",
            "fields": []
        }
    ]

But when I am sending the correct JSON as below then it gives me error : 
{

                "Destination__c": "Salesforce",

                 "Source__c": "IPE", 

                "Message_Action__c": "Success",

                "Message_Name__c":"Invoice",

                "Message_Details1__c": [{  "InvoiceNumber": "DRAFT-0000001", "AWSURL": "the AWS S3 bucket url for the PDF generated"}]
}


Response :

[
    {
        "message": "Cannot deserialize instance of textarea from START_ARRAY value [line:9, column:44]",
        "errorCode": "JSON_PARSER_ERROR"
    }
]
  • March 09, 2020
  • Like
  • 0
[{'InvoiceNumber':'DRAFT-0000007','ErrorDescription':'2130701-Customer Account Number doesn't exist in SAGE metadata'},{'InvoiceNumber':'DRAFT-0000166','ErrorDescription':'1778001-Customer Account Number doesn't exist in SAGE metadata'},{'InvoiceNumber':'DRAFT-0000000','ErrorDescription':'2281401-Customer Account Number doesn't exist in SAGE metadata'}]
  • March 07, 2020
  • Like
  • 0
<td>

<select  data-style="" class="selectpicker form-control" name="multipleSelected" id="multipleSelected" multiple="multiple">
                                                                                        
                          <apex:repeat value="{!MedicalAllergies}" var="itm">                                                   
                                 <option  value="{!itm.label}">{!itm.label} </option>
                           </apex:repeat>
  </select>   

 </td>

 
  • December 13, 2019
  • Like
  • 0
Account IT = new Account();
String integrationtransactionId= '0016F00001y5mQW';
List<String> fields = new List<String>(Account.SObjectType.getDescribe().fields.getMap().keySet());
String soql='';
soql=soql+' select ';
soql=soql+String.join(fields, ',');
System.debug('checking'+soql);
soql=soql+' from Account where id=:integrationtransactionid';
System.debug('soqq'+soql);
IT=database.query(soql);
System.debug('itt'+IT);
String ack=IT.Request__c;  
System.debug('acksss--'+ack);

 
  • September 20, 2019
  • Like
  • 1
I have had always studied that when working with related object we need to go for after trigger and if we are working with the same object then we need to go for before trigger or for performing validation checks.. please help me because today I tried one scenario and it's working for both before and after trigger. The code is below: 
trigger UpdateAccountField  on Contact  (before insert, before update) {

    Set <String> accID = New Set <String> (); 
    For (Contact con: Trigger.new) { 
        if (con.AccountId != Null ) {
       
        accID.add (con.AccountId); 
        } 
    } 
    If (accID.size ()> 0) { 
        List <Account> upAccList = new List <Account> (); 
        For (Account ac: [SELECT Id, csrs__FieldUpdate__c FROM Account WHERE id in: AccID AND csrs__FieldUpdate__c != True]) { 
            ac.csrs__FieldUpdate__c = true; 
            UpAccList.add (ac); 
        } 
        If (upAccList.size ()> 0) 
            update upAccList; 
    } 
}
  • July 20, 2019
  • Like
  • 0
Account IT = new Account();
String integrationtransactionId= '0016F00001y5mQW';
List<String> fields = new List<String>(Account.SObjectType.getDescribe().fields.getMap().keySet());
String soql='';
soql=soql+' select ';
soql=soql+String.join(fields, ',');
System.debug('checking'+soql);
soql=soql+' from Account where id=:integrationtransactionid';
System.debug('soqq'+soql);
IT=database.query(soql);
System.debug('itt'+IT);
String ack=IT.Request__c;  
System.debug('acksss--'+ack);

 
  • September 20, 2019
  • Like
  • 1

Hi All,


When trying to get access token through https://test.salesforce.com/services/oauth2/token from an app hosted on heroku unable to get access token.

Error seen in logs:
[{"message":"Session expired or invalid","errorCode":"INVALID_SESSION_ID"}]

Params for Post Request:
params={
        'grant_type':'password',
        'client_id':'3MVkfjayehklJSGHKHOL7j.O',
        'client_secret':'649E63F81AED235CAD',
        'username':'<UserId>',
        'password':'<Password>'
        }

When I hit through postman with same params I am able to get access token.

Approaches tried:

1. We have whitelisted all IP's
2. We have generated new client id and secret.
3. Hit the Same Url through the same parameters received the token.

4. Set Permitted Users to All users may self-authorize .

5.Relaxed IP restrictions.

Please help me in resolving this issue.

P.S: All the help available in Forum are related to login.salesforce.com and doesn't help in my case.

TIA.

import javax.net.ssl.HttpsURLConnection;
import java.io.*;
import java.net.URL;
import java.util.Base64;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class OauthAuthentication {
	private static final Pattern pat = Pattern.compile(".*\"access_token\"\\s*:\\s*\"([^\"]+)\".*");
	private static final String clientId = "jdiwiweoiwe.NxkdgEZTQHC3SvdVQyFm5eSmbiDCQ";//clientId
	private static final String clientSecret = "fhdkhskjs";//client secret
	private static final String tokenUrl = 'https://login.salesforce.com/services/oauth2/token";
	private static final String auth = clientId + ":" + clientSecret;
	private static final String authentication = Base64.getEncoder().encodeToString(auth.getBytes());
	private static String userName="xyz";
	private static String password="abc";
	public static void main(String[] args) throws IOException 
	{
	
	//Username is netId for the person making the call and the password is there password
	String content = "grant_type=password&username=" + userName + "&password=" + password;
    BufferedReader reader = null;
    HttpsURLConnection connection = null;
    String returnValue = "";
    try {
    	System.out.println("authentication"+authentication);
        URL url = new URL(tokenUrl);
        connection = (HttpsURLConnection) url.openConnection();
        connection.setRequestMethod("POST");
        connection.setDoOutput(true);
        connection.setRequestProperty("Authorization", "Basic " + authentication);
        connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
        connection.setRequestProperty("Accept", "application/json");
       
        PrintStream os = new PrintStream(connection.getOutputStream());
        os.print(content);
        os.close();
        System.out.println("content"+content);
        /*reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
        String line = null;
        StringWriter out = new StringWriter(connection.getContentLength() > 0 ? connection.getContentLength() : 2048);
        while ((line = reader.readLine()) != null) {
            out.append(line);
        }
        String response = out.toString();
        System.out.println("output="+response);
        Matcher matcher = pat.matcher(response);
        if (matcher.matches() && matcher.groupCount() > 0) {
            returnValue = matcher.group(1);
        }*/
        System.out.println("response : " + connection.getResponseMessage());
 
    } catch (Exception e) 
    {
        System.out.println("Error : " + e.getMessage()+"\n"+e.getCause()+"\n"+e.getStackTrace()+"\n"+e.getLocalizedMessage());
    } finally {
        if (reader != null) {
            try {
                reader.close();
            } catch (IOException e) {
            }
        }
        connection.disconnect();
    }
	}
}

Error Response : Bad Request

 
  • September 11, 2020
  • Like
  • 0
I want to be able to retrieve all sendevents from the date range and the subscriber list specified, however, I always get read time out when I do this in Prod. (Works fine in lower region.) How can I improve the architecture so that I can get all of the sendevents I need?
 
<?xml version="1.0" encoding="UTF-8"?>
    <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
        <env:Header>
            <Security xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
                <UsernameToken>
                    <Username>XXX</Username>
                    <Password>XXX</Password>
                </UsernameToken>
            </Security>
        </env:Header>
        <env:Body>
            <RetrieveRequestMsg xmlns="http://exacttarget.com/wsdl/partnerAPI">
                <RetrieveRequest>
                    <ClientIDs><ClientID>XXX</ClientID></ClientIDs>
                    <ObjectType>SentEvent</ObjectType>
                    <Filter xsi:type="ComplexFilterPart">
                        <LeftOperand xsi:type="SimpleFilterPart">
                            <Property>EventDate</Property>
               		   <SimpleOperator>between</SimpleOperator>
               		   <DateValue>2020-05-30T03:00:00.000Z</DateValue>
               		   <DateValue>2020-06-29T02:59:59.999Z</DateValue>
                        </LeftOperand>
                        <LogicalOperator>AND</LogicalOperator>
                       
                                      <RightOperand xsi:type="SimpleFilterPart">
	                                <Property>SubscriberKey</Property>
                            		  <SimpleOperator>IN</SimpleOperator>
                                     <Value>x@gmail.com</Value>
                                     <Value>C_x_y</Value>
                                     <Value>C_x1_y1</Value>
                                     <Value>C_x2_y2</Value>
                                     <Value>t</Value>
                                     <Value>dd@d.com</Value>

                                      </RightOperand>
                         
                    </Filter>
                    <Properties>SendId</Properties>
                    <Properties>BatchId</Properties>
                    <Properties>TriggeredSendDefinitionObjectID</Properties>
                    <Properties>EventType</Properties>
                   
                </RetrieveRequest>
            </RetrieveRequestMsg>
        </env:Body>
    </env:Envelope>

 
I am getting following error : 19:40:18:141 USER_DEBUG [89]|DEBUG|Workday Submit Customer Error : System.CalloutException: IO Exception: Unable to tunnel through proxy. Proxy returns "HTTP/1.1 503 Service Unavailable"

Please help or guide me the correct way. Thanks a lot in advance.
  • July 02, 2020
  • Like
  • 0

 
String Customer_Dataa='{"version":"string","Customer_Data":{"Customer_ID":"string","Customer_Reference_ID":"string","Customer_Name":"string","Worktag_Only":"true","Submit":"true","Create_Customer_from_Financial_Institution_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Create_Customer_from_Supplier_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Create_Customer_from_Tax_Authority_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Create_Customer_from_Investor_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Customer_Category_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Restricted_To_Companies_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Customer_Group_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Customer_Preferred_Locale_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Customer_Preferred_Language_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Payment_Terms_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Default_Payment_Type_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"DUNS_Number":"string","Credit_Limit_Currency_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Credit_Limit":"1000.00","Hierarchy_Credit_Limit":"1000.00","Credit_Verification_Date":"2004-02-14","Commercial_Credit_Score":"1000.00","Commercial_Credit_Score_Date":"2018-11-01+00:00","Commercial_Credit_Score_Note":"string","Composite_Risk_Score":"1000.00","Composite_Risk_Date":"2013-05-22+00:00","Composite_Risk_Note":"string","Customer_Satisfaction_Score":"1000.00","Customer_Satisfaction_Date":"2002-11-05+00:00","Customer_Satisfaction_Note":"string","Tax_Code_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Tax_ID_Data":{"Tax_ID_Text":"string","Tax_ID_Type_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Transaction_Tax_ID":"false","Primary_Tax_ID":"false"},"Lockbox_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Included_Children_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Customer_Security_Segment_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Business_Entity_Data":{"Business_Entity_Name":"string","Business_Entity_Phonetic_Name":"string","External_Entity_ID":"string","Contact_Data":{"Address_Data":{"Formatted_Address":"string","Address_Format_Type":"string","Defaulted_Business_Site_Address":"false","Delete":"true","Do_Not_Replace_All":"true","Effective_Date":"2010-03-18","Country_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Last_Modified":"2018-12-28T19:51:14+00:00","Address_Line_Data":{"Descriptor":"string","Type":"string","#text":"string"},"Municipality":"string","Country_City_Reference":{"Descriptor":"string","ID":{"type":"string","parent_id":"string","parent_type":"string","#text":"string"}},"Submunicipality_Data":{"Address_Component_Name":"string","Type":"string","#text":"string"},"Country_Region_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Country_Region_Descriptor":"string","Subregion_Data":{"Descriptor":"string","Type":"string","#text":"string"},"Postal_Code":"string","Usage_Data":{"Public":"false","Type_Data":{"Primary":"true","Type_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}}},"Use_For_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Use_For_Tenanted_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Comments":"string"},"Number_of_Days":"1000.00","Municipality_Local":"string","Address_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Address_ID":"string"},"Phone_Data":{"Area_Code":"string","Tenant_Formatted_Phone":"string","International_Formatted_Phone":"string","Phone_Number_Without_Area_Code":"string","National_Formatted_Phone":"string","E164_Formatted_Phone":"string","Workday_Traditional_Formatted_Phone":"string","Delete":"false","Do_Not_Replace_All":"false","Country_ISO_Code":"str","International_Phone_Code":"string","Phone_Number":"string","Phone_Extension":"string","Phone_Device_Type_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Usage_Data":{"Public":"false","Type_Data":{"Primary":"false","Type_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}}},"Use_For_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Use_For_Tenanted_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Comments":"string"},"Phone_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"ID":"string"},"Email_Address_Data":{"Delete":"true","Do_Not_Replace_All":"true","Email_Address":"string","Email_Comment":"string","Usage_Data":{"Public":"false","Type_Data":{"Primary":"true","Type_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}}},"Use_For_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Use_For_Tenanted_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Comments":"string"},"Email_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"ID":"string"},"Instant_Messenger_Data":{"Delete":"false","Do_Not_Replace_All":"true","Instant_Messenger_Address":"string","Instant_Messenger_Type_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Instant_Messenger_Comment":"string","Usage_Data":{"Public":"false","Type_Data":{"Primary":"false","Type_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}}},"Use_For_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Use_For_Tenanted_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Comments":"string"},"Instant_Messenger_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"ID":"string"},"Web_Address_Data":{"Delete":"true","Do_Not_Replace_All":"false","Web_Address":"string","Web_Address_Comment":"string","Usage_Data":{"Public":"true","Type_Data":{"Primary":"true","Type_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}}},"Use_For_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Use_For_Tenanted_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Comments":"string"},"Web_Address_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"ID":"string"}},"Business_Entity_Logo_Image_Data":{"Filename":"string","Image":"YWM="}},"Settlement_Account_Data":{"Settlement_Bank_Account_ID":"string","Country_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Currency_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Bank_Account_Nickname":"string","Bank_Account_Type_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Bank_Name":"string","Routing_Transit_Number":"string","Branch_ID":"string","Branch_Name":"string","Bank_Account_Number":"string","Check_Digit":"string","Bank_Account_Name":"string","Roll_Number":"string","IBAN":"string","SWIFT_Bank_Identification_Code":"string","Accepts_Payment_Types_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Payment_Types_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"For_Supplier_Connections_Only":"false","Requires_Prenote":"true","Payment_Type_Prenote_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Inactive":"false","Bank_Instructions":"string","Intermediary_Bank_Data":{"Intermediary_Bank_Account_ID":"string","Intermediary_Bank_Order":"string","Country_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Currency_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Bank_Account_Nickname":"string","Bank_Account_Type_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Bank_Name":"string","Routing_Transit_Number":"string","Branch_ID":"string","Branch_Name":"string","Bank_Account_Number":"string","Check_Digit":"string","Bank_Account_Name":"string","Roll_Number":"string","IBAN":"string","SWIFT_Bank_Identification_Code":"string","Inactive":"false","Bank_Instructions":"string"}},"Credit_Card_Data":{"Merchant_Customer_Profile_ID":"string","Primary_Card":"true","Merchant_Account_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Credit_Card_Type_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"First_Name":"string","Last_Name":"string","Expiration_Date":"2016-09-11","Last_4_Digits_of_Credit_Card_Number":"stri","Customer_Profile_ID":"string"},"Approval_Status_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Customer_Status_Data":{"Customer_Status_Value_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Reason_for_Customer_Status_Change_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Customer_Status_Change_Reason_Description":"string"},"Proposed_Customer_Status_Data":{"Customer_Status_Value_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Reason_for_Customer_Status_Change_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Customer_Status_Change_Reason_Description":"string"},"Always_Separate_Payments":"false","Currency_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Accepted_Currencies_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Remit-from_Customer_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Invoice_Delivery_Method_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Invoice_Notification_Email_Recipients_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Statement_Delivery_Method_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Statement_Notification_Email_Recipients_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Dunning_Delivery_Method_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Dunning_Letter_Notification_Email_Recipients_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Electronic_Invoicing_Start_Date":"2018-07-19+00:00","Electronic_Invoicing_Government_Issued_Customer_ID":"string","Electronic_Invoicing_Intermediary_Vendor_ID":"string","Electronic_Invoicing_Vendor_Issued_Customer_ID":"string","Mandate_Required":"true","Direct_Debit_Payment_Type_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Default_Mandate_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Business_Entity_Alternate_Name_Data":{"Alternate_Name":"string","Alternate_Name_Usage_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}}},"Tax_Status_Data":{"Country_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Transaction_Tax_Status_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Withholding_Tax_Status_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}}},"Business_Entity_Attachment_Data":{"Content_Type":"string","Filename":"string","Encoding":"string","Compressed":"true","File_Content":"ZGVkaXQ=","Comment":"string"},"Note_Data":{"Created":"2006-12-05T12:02:31","Last_Updated":"2016-09-11T13:29:58","Worker_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Business_Entity_Contact_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"System_User_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Note_Content":"string"},"Followup_Date":"2005-02-02","Related_Worktags_Data":{"Replace_All":"false","Related_Worktags_by_Type_Data":{"Worktag_Type_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}},"Required_On_Transaction":"true","Required_On_Transaction_For_Validation":"false","Default_Worktag_Data":{"Delete_Default_Value":"true","Default_Worktag_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}}},"Replace_All_Allowed_Values":"true","Allowed_Worktag_Data":{"Delete_Allowed_Value":"true","Allowed_Worktag_Reference":{"Descriptor":"string","ID":{"type":"string","#text":"string"}}}}}}}';

//Here I am deserializing it to my wrapper class and I am getting the error 
comWorkdayBsvc.Customer_WWS_DataType cd=new comWorkdayBsvc.Customer_WWS_DataType();
cd=(comWorkdayBsvc.Customer_WWS_DataType)json.deserialize(Customer_Dataa,comWorkdayBsvc.Customer_WWS_DataType.class); //Here it throws the error :
Error : Line: NaN, Column: undefined
Response to EXEC was : Bad Message 414
reason: URI Too Long
. HTTP CODE[414]
 
  • June 22, 2020
  • Like
  • 0

Class Name - AccountWebhookWebhookTriggerTest

Error Message - 

System.DmlException: Insert failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Required fields are missing: [Name]: [Name]
Stack Trace: Class.AccountWebhookWebhookTriggerTest.testTrigger: line 65, column 1

Database.saveResult[] res= Database.insert(invoiceList,false);
          Integer result2=res.size();
          System.debug('inserted invoices for SA=BA'+res);
          System.debug('result size for errorlogs loop '+result2);
          if(res.size()>0)
          {
               System.debug('debugging inside inv res ');
               for(Integer i=0; i< res.size(); i++) 
               {
                           System.debug('inside result of invoices for errorlogging');
                          if(!res.get(i).isSuccess())
                           {
                             Database.Error errors =  res.get(i).getErrors().get(0);
                             Event_Tracker__c erlog=new Event_Tracker__c();
                             erlog.Error_Description__c='Invoice creation failed for SA=BA'+'\n'+String.valueof(res.get(i).getErrors().get(0))+'\n'+invoiceList[i];
                             erlog.name='Script 2 - 2 ST_DataTransformationBatch Script has error';
                             erlog.Error_Object__c=invoiceList[i].Opportunity__c;
                             erlog.recordtypeid=evtrecordtypeid;
                             errorlogsList.add(erlog); 
                             scriptfailedoptId.add(invoiceList[i].Opportunity__c);
                                                 
                           }
                            if(res.get(i).isSuccess())
                            {
                                optyVsInvoiceId.put(invoiceList[i].Opportunity__c,invoiceList[i].Id);
                            }
               }
           }

I am able to get the debug System.debug('debugging inside inv res ');
But unable to get the debug System.debug('inside result of invoices for errorlogging');
Can somebody please help me why this strange behaviour is coming as I need to insert the errorlogs records and because of this issue my error logs are not getting inserted. Please help me or suggest what should I do.
  • April 30, 2020
  • Like
  • 0
  • April 28, 2020
  • Like
  • 0
Whenever I am trying to hit the platform  event bus in the format below then it gets successful but it's not being parsed as this has single quotes inside Message_Details__c.
{
	"Message_Name__c": "Batch Failure",
	"Source__c": "IPE",
	"Destination__c": "Salesforce",
	"Message_Action__c": "Testing",
	"Message_Details1__c":"{[{'ValidationErrorDetails': 'Duplicate Invoice Batch'},{'ValidationErrorDetails1': 'Duplicate Invoice Batch1'}]}"
}


Response : 
{
    "id": "e06xx0000000001AAA",
    "success": true,
    "errors": [
        {
            "statusCode": "OPERATION_ENQUEUED",
            "message": "1b05b592-cbec-42c1-aa3d-737d3980590c",
            "fields": []
        }
    ]



--------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------
But when I am sending the correct JSON as below then it gives me error : 

{

                "Destination__c": "Salesforce",

                 "Source__c": "IPE", 

                "Message_Action__c": "Success",

                "Message_Name__c":"Invoice",

                "Message_Details1__c": [{  "InvoiceNumber": "DRAFT-0000001", "AWSURL": "the AWS S3 bucket url for the PDF generated"}]
}


Response :

[
    {
        "message": "Cannot deserialize instance of textarea from START_ARRAY value [line:9, column:44]",
        "errorCode": "JSON_PARSER_ERROR"
    }
]

 
  • March 09, 2020
  • Like
  • 0
[{'InvoiceNumber':'DRAFT-0000007','ErrorDescription':'2130701-Customer Account Number doesn't exist in SAGE metadata'},{'InvoiceNumber':'DRAFT-0000166','ErrorDescription':'1778001-Customer Account Number doesn't exist in SAGE metadata'},{'InvoiceNumber':'DRAFT-0000000','ErrorDescription':'2281401-Customer Account Number doesn't exist in SAGE metadata'}]
  • March 07, 2020
  • Like
  • 0