• Shekhar Dautpure
  • NEWBIE
  • 15 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 4
    Replies
I have inbound soap based ws. I am now trying to test it via postman. 

However i am getting error 

This is the request message
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ecc="http://soap.sforce.com/schemas/class/EccoInterfaceEntryPoint">
   <soapenv:Header>
      <ecc:SessionHeader>
         <ecc:sessionId>iAO3qU9TwI5_ad4wZIa31cN3w9P9nUVULl1UlUE9cIEKKmdkBEkvWNyxJ5r.eyoRVa5r5qfGKq_aWkGfAmt</ecc:sessionId>
      </ecc:SessionHeader>
   </soapenv:Header>
   <soapenv:Body>
      <ecc:SentMessagetoSalesforce>
         <ecc:RequestMessage>
            <EccoMessage>
               <Header>
                  <ServiceId>Brand_CRUD</ServiceId>
                  <TypeCode>CreateBrand</TypeCode>
                  <SentDate>19/03/2018</SentDate>
                  <SourceSystem>SAP</SourceSystem>
                  <DestinationSystem>SFDC</DestinationSystem>
                  <RequestId>1234</RequestId>
                  <Object>Brand</Object>
                  <ObjectId>888</ObjectId>
                  <langId>ENG</langId>
               </Header>
               <Body>
                  <Payload>
                     <BrandName>ELG1</BrandName>
                     <BrandId>567</BrandId>
                     <ActiveFlg>Y</ActiveFlg>
                     <BrandOwnerEmail>shd@ecco.com</BrandOwnerEmail>
                  </Payload>
               </Body>
            </EccoMessage>
         </ecc:RequestMessage>
      </ecc:SentMessagetoSalesforce>
   </soapenv:Body>
</soapenv:Envelope>

This is the response:
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
    <soapenv:Body>
        <soapenv:Fault>
            <faultcode>soapenv:Client</faultcode>
            <faultstring>Unexpected element {}EccoMessage during simple type deserialization</faultstring>
        </soapenv:Fault>
    </soapenv:Body>
</soapenv:Envelope>


And this is the class :
/*
* @Author : Chandrashekhar Dautpure (CSD)
* @ Date  : 19-03-2018
* @ Functionality : This is main class for Interface framework
* @ version :
*     1. 19-03-2018 -- Initial Draft -- CSD 
*
*/
global class EccoInterfaceEntryPoint
{
	webservice static void SentMessagetoSalesforce(String RequestMessage)
	{
		XPath xp = new XPath(RequestMessage);
		
		Ecco_Interface_Log__c InterfaceMess = New Ecco_Interface_Log__c();
		InterfaceMess.Ecco_Service__c 	= 	GetServiceId(xp.getText ('/soapenv:Envelope/soapenv:Body/EccoMessage/Header/ServiceId'));
        InterfaceMess.ActionCode__c		=	xp.getText ('/soapenv:Envelope/soapenv:Body/EccoMessage/Header/TypeCode');
		InterfaceMess.Destination__c 	= 	xp.getText ('/soapenv:Envelope/soapenv:Body/EccoMessage/Header/DestinationSystem');
		InterfaceMess.ParentId__c       =   xp.getText ('/soapenv:Envelope/soapenv:Body/EccoMessage/Header/ObjectId');
        InterfaceMess.Source__c         = 	xp.getText ('/soapenv:Envelope/soapenv:Body/EccoMessage/Header/ObjectId');
        InterfaceMess.RequestId__c 		= 	xp.getText ('/soapenv:Envelope/soapenv:Body/EccoMessage/Header/RequestId');
        InterfaceMess.ProcessFlg__c 	= 	false;
        InterfaceMess.ParentType__c		= 	xp.getText ('/soapenv:Envelope/soapenv:Body/EccoMessage/Header/Object');
        InterfaceMess.LangID__c         =   xp.getText ('/soapenv:Envelope/soapenv:Body/EccoMessage/Header/langId');
        
		Dom.Document doc = new Dom.Document();
		doc.load(RequestMessage);
        Dom.XMLNode root = doc.getRootElement();
		for(Dom.XMLNode firstlevelchild : root.getChildren())
        {
            if(firstlevelchild.GetName()=='Body')
            {
                InterfaceMess.Payload__c = String.valueOf(firstlevelchild);
            }
        }
		insert InterfaceMess;
		 
	}
	
	private static String GetServiceId(String ServiceName)
	{
		return [Select Id from Ecco_Service__c where Name =: ServiceName].Id;
	}
}

I dont know what am i doing wrong in the request as class is now successfully saved (this mean no syntax errors). 

Thus any help to debug it would be helpfull
Dear All 

I am in middle of migration from our old instance of ET to new MC. I need to move the images , however our entire product catalog is there

Using ET Java Fuel SDk, i am able to connect to ET and download information like folder , list , DE etc. However to get the images , what should use
Dear All

I have 2 objects. Master (Account) and Child (SWOT__C). 

SWOT__C has 2 recordtype .. R1 and R2

I have 2 profiles. P1 and P2

If a user with Profile P1 navigates to Account - SWOT page , he should see account with SWOT (where RecordType = R1)

If a user with Profile P2 navigates to Account - SWOT page , he should see account with SWOT (where RecordType = R1 or R2)

I am trying to do this using visualforce , however not able to do it. can you suggest if there is any other option  which i can use for my requirement , 

Profile P1 --> On SWOT only have R1
Profile P2 on SWOT have P2 as default , but also have access to P1. 

alternative solution would be a great help

 
Dear All 

We need to create Outlook meeting from Salesforce. I am using flow which will call apex class to create the meeting. I am getting error at one line, and not sure what is wrong 
global class SentEmailFlow implements Process.Plugin
{		
		String FromAddress;
		String ToAddresses;
		String CCAddresses;
		String Subject;
		String MessageBody;
		String MeetingSubject;
		DateTime StartTime;
		DateTime EndTime;
		String Location; 
		String ObjectType;
		String ObjectId;
		String[] ToAddressesList;
		String[] CCAddressesList;
		Boolean IsMeetingInOutlook    = false;
		//Boolean IsMeetingInSalesforce = false;
		
	global Process.Plugin invoke(Process.PluginRequest request)
	{
		FromAddress 		 = (String) request.inputParameters.get('FromAddress');
		ToAddresses 		 = (String) request.inputParameters.get('ToAddresses');
		CCAddresses 		 = (String) request.inputParameters.get('CCAddresses');
		MeetingSubject	 	 = (String) request.inputParameters.get('Subject');
		MessageBody 		 = (String) request.inputParameters.get('MessageBody');
		StartTime 		 	= (DateTime) request.inputParameters.get('StartTime');
		EndTime 		 	= (DateTime) request.inputParameters.get('EndTime');
		Location 		 	= (String) request.inputParameters.get('Location');
		ObjectType 		 	= (String) request.inputParameters.get('ObjectType');
		ObjectId 		 	= (String) request.inputParameters.get('ObjectId');

		
		ToAddressesList = new String[] {ToAddresses};
		CCAddressesList = new String[] {CCAddresses};
		
		IsMeetingInOutlook    = CreateOutlookMeeting();
		//IsMeetingInSalesforce = CreateSalesforceMeeting();
		
		Map<String,Object> result = new Map<String,Object>();
        result.put('IsMeetingInOutlook', IsMeetingInOutlook);
       // result.put('IsMeetingInSalesforce', IsMeetingInSalesforce);
        return new Process.PluginResult(result);
	}
	
	private boolean CreateOutlookMeeting()
	{
		boolean IsSuccessfull=false;
		
		try
		{
			Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
			mail.setToAddresses(ToAddressesList);
			mail.setCcAddresses(CCAddressesList);
	        mail.setSubject(MeetingSubject);
	        mail.setPlainTextBody(MessageBody);
	        Messaging.EmailFileAttachment attach = new Messaging.EmailFileAttachment();
	        attach.filename = 'meeting.ics';
	        attach.ContentType = 'text/calendar;';
	        attach.inline = true;
	        attach.body = invite();
	        mail.setFileAttachments(new Messaging.EmailFileAttachment[] {attach});
	        Messaging.SendEmailResult[] er = Messaging.sendEmail(new Messaging.Email[] {mail});
	        IsSuccessfull = true;
		}
		catch(exception e)
		{	IsSuccessfull=false;		
		}
		return IsSuccessfull;
		
	} 
	
	/*private boolean CreateSalesforceMeeting()
	{
		boolean IsSuccessfull=false;
		try
		{
			IsSuccessfull=true;
		}
		catch(exception e)
		{
			
		}
		return IsSuccessfull;
	}*/
	
	private Blob invite()
	{
		String txtInvite = '';
 
        txtInvite += 'BEGIN:VCALENDAR\n';
        txtInvite += 'PRODID:-//Microsoft Corporation//Outlook 12.0 MIMEDIR//EN\n';
        txtInvite += 'VERSION:2.0\n';
        txtInvite += 'METHOD:PUBLISH\n';
        txtInvite += 'X-MS-OLK-FORCEINSPECTOROPEN:TRUE\n';
        txtInvite += 'BEGIN:VEVENT\n';
        txtInvite += 'CLASS:PUBLIC\n';
        txtInvite += 'CREATED:20091026T203709Z\n';
        txtInvite += 'DTEND:20091028T010000Z\n';
        txtInvite += 'DTSTAMP:20091026T203709Z\n';
        txtInvite += 'DTSTART:20091028T000000Z\n';
        txtInvite += 'LAST-MODIFIED:20091026T203709Z\n';
        txtInvite += 'LOCATION:Online\n';
        txtInvite += 'PRIORITY:5\n';
        txtInvite += 'SEQUENCE:0\n';
        txtInvite += 'SUMMARY;';
        txtInvite += 'LANGUAGE=en-us:Meeting\n';
        txtInvite += 'TRANSP:OPAQUE\n';
        txtInvite += 'UID:4036587160834EA4AE7848CBD028D1D200000000000000000000000000000000\n';
        txtInvite += 'X-ALT-DESC;FMTTYPE=text/html:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"><HTML><HEAD><META NAME="Generator" CONTENT="MS Exchange Server version 08.00.0681.000"><TITLE></TITLE></HEAD><BODY><!-- Converted from text/plain format --></BODY></HTML>\n';
        txtInvite += 'X-MICROSOFT-CDO-BUSYSTATUS:BUSY\n';
        txtInvite += 'X-MICROSOFT-CDO-IMPORTANCE:1\n';
        txtInvite += 'END:VEVENT\n';
        txtInvite += 'END:VCALENDAR';
 
        return Blob.valueOf(txtInvite);
	}
	
	global Process.PluginDescribeResult describe()
	{
		Process.PluginDescribeResult result = new Process.PluginDescribeResult(); 
		result.Name = 'Meeting Creation';
		result.Tag  = 'MeetingClasses';
		result.inputParameters = new List<Process.PluginDescribeResult.InputParameter>
		{
			 new Process.PluginDescribeResult.InputParameter('Username', Process.PluginDescribeResult.ParameterType.STRING, true)
		};
				result.outputParameter = new List<Process.PluginDescribeResult.OutputParameter>
		{
			new Process.PluginDescribeResult.OutputParameter('IsMeetingInOutlook', Process.PluginDescribeResult.ParameterType.BOOLEAN)
		};
		result.outputParameter = new List<Process.PluginDescribeResult.OutputParameter>
		{
			new Process.PluginDescribeResult.OutputParameter('IsMeetingInSalesforce', Process.PluginDescribeResult.ParameterType.BOOLEAN)
		};
		return result;
	}
 }

Line which is error is 
return new Process.PluginResult(result);

Error message is : Save error: Return value must be of type: Process.Plugin

could you tell me what is going wrong.
 
Dear All

I have vf page and custom extension controller. All is fine , however I need to migrate it to production, and i am having problem with code coverage. I have code coverage of 18%, and somehow its not incresing. 

can you please advise.

My custom extension is :
--
global without sharing class ContactSlim_Edelivery_Extension 
{
    //private final Contact_Slim__c cont; --1st change
    public Contact_Slim__c cont;
    private ApexPages.StandardController sc;
    public ID CP_Pri_Inv_Signer	= null;
    public ID CP_Sec_Inv_Signer	= null;
    public ID CP_Pri_OC_Signer	= null;
    public ID CP_Sec_OC_Signer	= null;
    public ID CP_General_Signer	= null;
    public boolean hasBeenSubmited                     {get; set;}
    public final ID AccntSlimID                        {get; set;}
    public final String UserLocale                     {get; set;}
    public List<multiRowContact> RelatedContactPersons {get; set;}
    public boolean displayPopup                        {get; set;}
    public boolean displayPopup_OC                     {get; set;}
    public String AccountName                          {get; set;}
    public String AccountSAPID                         {get; set;}
    public String AccountSFDCID                        {get; set;}
    public String AccountCountryCode                   {get; set;}
    private String AttachmentURL ='https://crmprod.force.com/';
    
    public ContactSlim_Edelivery_Extension(ApexPages.StandardController stdController)
    {
        sc = stdController;
        //Orginal Line of code
        //stdController.addFields(new List<String>{'Name','AccountId__c','Contact__c','Email__c','Primary_Invoice_Recipient__c','Primary_Order_Confirmation_Recipient__c','Secondary_Invoice_Recipient__c','Secondary_Order_Confirmation_Recipient__c'});
        
        //Updated line of code
        if(!test.isRunningTest())
        {
        	stdController.addFields(new List<String>{'Name','AccountId__c','Contact__c','Email__c','Primary_Invoice_Recipient__c','Primary_Order_Confirmation_Recipient__c','Secondary_Invoice_Recipient__c','Secondary_Order_Confirmation_Recipient__c'});
        }
        this.cont = (Contact_Slim__c)stdController.getRecord();
        
        AccntSlimID = cont.AccountId__c;  //SFDC ID of Account_Slim
        Account_Slim__c a = [Select Id,Name,Account__c,Account_Number__c,Country_Code__c from Account_Slim__c where Id =: AccntSlimID limit 1];
        AccountName = a.Name;
        AccountSAPID = a.Account_Number__c;
        AccountSFDCID = a.Account__c;  //Actual SFDC of Account
        UserLocale = ApexPages.currentPage().getParameters().get('Locale');
        AccountCountryCode = UserLocale;
        LoadData();
        hasBeenSubmited = false;
    }  
    
    private void LoadData()
    {   
        RelatedContactPersons = new List<multiRowContact>();
        for (List<Contact_Slim__c> cs :[Select Id , Name , Email__c,Primary_Invoice_Recipient__c,Primary_Order_Confirmation_Recipient__c,Secondary_Invoice_Recipient__c,
                Secondary_Order_Confirmation_Recipient__c, FirstName__c, LastName__c
                    from Contact_Slim__c where AccountId__c =: cont.AccountId__c and Email__c != '' and EDeliveryNotEnabled__c=false limit 900])
        {
            for (Contact_Slim__c c : cs) 
            {
                multiRowContact MRC = new multiRowContact();
                MRC.ID                = c.ID;
                MRC.Name              = c.Name;
                MRC.Email             = c.Email__c;
                MRC.Pri_Invoice_Flag  = c.Primary_Invoice_Recipient__c;
                MRC.Pri_OC_Flag       = c.Primary_Order_Confirmation_Recipient__c;
                MRC.Sec_Invoice_Flag  = c.Secondary_Invoice_Recipient__c;
                MRC.Sec_OC_Flag       = c.Secondary_Order_Confirmation_Recipient__c;
                MRC.FirstName         = c.FirstName__c;
                MRC.LastName          = c.LastName__c;
                RelatedContactPersons.add(MRC);
            }
        }
    }
    
    public  void showPopup() 
    {
        displayPopup = true;
    }
    
    public  void showPopup_OC()
    {
        displayPopup_OC = true;
    }
    
    public void closePopup() //Method executed on clicking OK on Invoice Popup applet
    {
        saveNewContacts();
    	for (multiRowContact MRC : RelatedContactPersons)
        {
            MRC.Save_Invoice();
        }
        UpdateAccountEdeliveryOptions();
        
        LoadData();
        displayPopup = false;
     }  
     
      public void closePopup_OC() //Method executed on clicking OK on OC Popup applet
      {
        saveNewContacts();
        for (multiRowContact MRC : RelatedContactPersons) 
        {
            MRC.Save_OC();
        }
        UpdateAccountEdeliveryOptions();

        LoadData();
        displayPopup_OC = false;    
      }
      
       public void closePopup_Cancel_OC() //Method executed on clicking Cancel on OC Popup applet
       {
        displayPopup_OC = false;
        cleanNewContacts();
       } 
     
     public void UpdateAccountEdeliveryOptions()
     {
     	Account_Slim__c accountToUpdate;
     	try{
     		for (List<Contact_Slim__c> cp :[Select Name,Id,EdeliverySigner__c,Primary_Invoice_Recipient__c,Primary_Order_Confirmation_Recipient__c,Secondary_Invoice_Recipient__c,Secondary_Order_Confirmation_Recipient__c  from Contact_Slim__c where AccountId__c =: AccntSlimID and Email__c != '' and EDeliveryNotEnabled__c= false limit : (limits.getLimitQueryRows()-limits.getQueryRows())])
     		{
     			for (Contact_Slim__c c : cp)
     			{
     				if(c.EdeliverySigner__c==true)
    				{
    					CP_General_Signer=c.Id;
    				}
    				if(c.Primary_Invoice_Recipient__c==true)
    				{
    					CP_Pri_Inv_Signer=c.Id;
    				}
    				if(c.Secondary_Invoice_Recipient__c==true)
    				{
    					CP_Sec_Inv_Signer=c.Id;
    				}
    				if(c.Primary_Order_Confirmation_Recipient__c==true)
    				{
    					CP_Pri_OC_Signer=c.Id;
    				}
    				if(c.Secondary_Order_Confirmation_Recipient__c==true)
    				{
    					CP_Sec_OC_Signer=c.Id;
    				}
     			}	
     		}
     		accountToUpdate=[SELECT EdeliverySigner__c,Primary_Invoice_Recipient__c,Primary_Order_Confirmation_Recipient__c,Secondary_Invoice_Recipient__c,Secondary_Order_Confirmation_Recipient__c FROM Account_Slim__c WHERE id =: AccntSlimID LIMIT :(limits.getLimitQueryRows()-limits.getQueryRows())];
			if(CP_General_Signer!=null)
    			{
    				accountToUpdate.EdeliverySigner__c=CP_General_Signer;
    			}
    		if(CP_Pri_Inv_Signer!=null)
    			{
    				accountToUpdate.Primary_Invoice_Recipient__c=CP_Pri_Inv_Signer;
    			}
    		if(CP_Sec_Inv_Signer!=null)
    			{
    				accountToUpdate.Secondary_Invoice_Recipient__c=CP_Sec_Inv_Signer;
    			}
    		if(CP_Pri_OC_Signer!=null)	
    			{
    				accountToUpdate.Primary_Order_Confirmation_Recipient__c=CP_Pri_OC_Signer;
    			}
    		if(CP_Sec_OC_Signer!=null)
    			{
    				accountToUpdate.Secondary_Order_Confirmation_Recipient__c=CP_Sec_OC_Signer;
    			}  
    			   		
     	}catch(DmlException e){
     		System.debug('An unexpected error has occurred while updating account with CP info : ' + e.getMessage());
     	}finally{
     		update accountToUpdate;
     	}
     }
    
     public void closePopup_Cancel() //Method executed on clicking Cancel on Invoice Popup applet
     {
        cleanNewContacts();
        displayPopup = false;
     } 
    
      public void closePopup_New_CP() //Method executed on clicking New Contact any Popup applet
      {
        addNewContact();
      }
      
      private void addNewContact()
      {
        multiRowContact MRC = new multiRowContact();
        MRC.InsertMode = true;
        RelatedContactPersons.add(MRC);
       }
      
      private void cleanNewContacts()
      {
        Integer j = 0;
        while (j < RelatedContactPersons.size())
        {
            if(RelatedContactPersons.get(j).ID == null)
            {
                RelatedContactPersons.remove(j);
            }else
            {
                j++;
            }
        }
      }
      
     public void saveNewContacts()
     {
        List<Contact_Slim__c> newContacts = new List<Contact_Slim__c>();
        for (multiRowContact MRC: RelatedContactPersons)
        {
            if (MRC.InsertMode)
            {
                Contact_Slim__c nCon = new Contact_Slim__c();
                setContact(nCon, MRC);
                if (isValidContact(nCon)) newContacts.add(nCon);
            }
        }
        if (newContacts.size()> 0 ) insert newContacts;
      }
      
      private void setContact(Contact_Slim__c con, multiRowContact MRC)
      {
        con.FirstName__c = MRC.FirstName;
        con.LastName__c = MRC.LastName;
        con.Email__c = MRC.Email;
        con.Primary_Invoice_Recipient__c = MRC.Pri_Invoice_Flag == null? false: MRC.Pri_Invoice_Flag;
        con.Primary_Order_Confirmation_Recipient__c = MRC.Pri_OC_Flag == null? false: MRC.Pri_OC_Flag;
        con.Secondary_Invoice_Recipient__c = MRC.Sec_Invoice_Flag== null? false: MRC.Sec_Invoice_Flag;
        con.Secondary_Order_Confirmation_Recipient__c = MRC.Sec_OC_Flag == null? false: MRC.Sec_OC_Flag;
        con.AccountId__c = AccntSlimID;
      }
      
      private Boolean isValidContact(Contact_Slim__c con)
      {
        if (con.Email__c == '' || con.FirstName__c == '' ||  con.LastName__c == '')
            return false;
        return true;
      }
      
      public void AttachAgreement()
      {
      	 String URL1=AttachmentURL+UserLocale+'/apex/Edelivery_Agreement?Locale='+UserLocale+'&id='+AccntSlimID;
      	 System.debug('URL -'+URL1);
    	 PageReference pdf = new PageReference(URL1);
    	 
    	 Attachment attach = new Attachment();
    	 Blob body;
    	 try
    	 {
             body = pdf.getContentAsPDF();
    	 }
    	 catch(VisualforceException e)
    	 {
    	 	body = Blob.valueOf('Error encountered while generating agreement. Contact Ecco customer care or your contact person for resolution.');
    	 }
    	 attach.Body = body;
	    // add the user entered name
	    attach.Name = 'Agreement for Edelivery of Invoices and Order Confirmation.pdf';
	    attach.IsPrivate = false;
	    // attach the pdf to the account
	    attach.ParentId = AccountSFDCID;
	    insert attach;
      }
      
      public PageReference save() 
      {
        //sc.save();
        AttachAgreement();
        hasBeenSubmited = true;
        return null;
      }
    
    //Inner class
   // private class multiRowContact -- 2nd change
    public class multiRowContact  
    {
        public String ID {get; set;}
        public String Name { get; set; }
        public String Email { get; set; }
        public Boolean Pri_Invoice_Flag { get; set; }
        public Boolean Sec_Invoice_Flag { get; set; }
        public Boolean Pri_OC_Flag { get; set; }
        public Boolean Sec_OC_Flag { get; set; }
        public Boolean InsertMode { get; set; }
        public String FirstName {get; set;}
        public String LastName {get; set;}

        public multiRowContact()
        {
            InsertMode = false;
        }

        public void Save_Invoice()
        {
            if (InsertMode == false)
            {

                    Contact_Slim__c c = [SELECT c.Primary_Invoice_Recipient__c,c.Secondary_Invoice_Recipient__c FROM Contact_Slim__c c WHERE c.ID = :ID LIMIT 1];
                    c.Primary_Invoice_Recipient__c    = Pri_Invoice_Flag;
                    c.Secondary_Invoice_Recipient__c  = Sec_Invoice_Flag;
                    update c;
            }
        }
        
        public void Save_OC()
        {
            if (InsertMode == false)
            {
                    Contact_Slim__c c = [SELECT c.Primary_Order_Confirmation_Recipient__c,c.Secondary_Order_Confirmation_Recipient__c FROM Contact_Slim__c c WHERE c.ID = :ID LIMIT 1];
                    c.Primary_Order_Confirmation_Recipient__c    = Pri_OC_Flag;
                    c.Secondary_Order_Confirmation_Recipient__c  = Sec_OC_Flag;
                    update c;
            }
        }
    }  
}


--

My testclass is :
@isTest(seeAllData=false)
private class Testcase_ContSlim_Edelivery_Exten 
{

    static testMethod void myUnitTest() 
    {
    	Test.startTest();
    	
    	//************************Instialisation************************************
    	Account A1 = New Account(); 
		A1.Name = 'TestConSEdeliveryExten';
		A1.Email__c='a@TestConSEdeliveryExten.com';
		insert A1;
		Account A2 = [Select Id from Account where Name =: 'TestConSEdeliveryExten' limit 1];
		String AccId=A2.Id;
		
		Contact C1 = New Contact();
		C1.AccountId = AccId;
		C1.FirstName = 'TestConSEdeliveryExten';
		C1.LastName = 'TestConSEdeliveryExten';
		C1.Email='contact@TestConSEdeliveryExten.com';
		insert c1;
		Contact c2 = [Select Id from Contact where FirstName ='TestConSEdeliveryExten' limit 1];
		String ConId=c2.Id;
		
		Account_Slim__c ac1 = New Account_Slim__c();
		ac1.Account__c=AccId;
		ac1.Account_Number__c='101010';
		ac1.Country_Code__c='NL';
		ac1.Name='TestConSEdeliveryExten';
		insert ac1;
		//Account_Slim__c ac2 = [Select Id from Account_Slim__c where Name = 'TestConSEdeliveryExten' limit 1];
		String AccSlimId = ac1.id;
		
		Contact_Slim__c conSlim1 = new Contact_Slim__c();
		conSlim1.AccountId__c=AccSlimId;
		conSlim1.AccountSFDCID__c=AccId;
		conSlim1.Contact__c=ConId;
		conSlim1.Name = 'TestConSEdeliveryExten';
		insert conSlim1;
		Contact_Slim__c  conSlim2 = [Select Id from Contact_Slim__c where Name = 'TestConSEdeliveryExten' limit 1];
		String conSlimId= conSlim2.Id;
        //************************Instialisation************************************
        
        PageReference pageRef = new PageReference('/apex/Edelivery_Survey_UK');
		Test.setCurrentPageReference(pageRef);
        ApexPages.CurrentPage().getparameters().put('Locale', 'UK');
        ApexPages.CurrentPage().getparameters().put('Id',conSlim1.Id);
        ApexPages.StandardController sc = new ApexPages.standardController(conSlim1);
        ContactSlim_Edelivery_Extension ec = new ContactSlim_Edelivery_Extension(sc);
        ec.cont = conSlim1;
        ContactSlim_Edelivery_Extension.multiRowContact mrc = new ContactSlim_Edelivery_Extension.multiRowContact();
        
		//ContactSlim_Edelivery_Extension ec = new ContactSlim_Edelivery_Extension(stdController);
		//ec.cont=conSlim1;
		//ContactSlim_Edelivery_Extension.multiRowContact mrc = new ContactSlim_Edelivery_Extension.multiRowContact();
		
		 
		
		Test.stopTest();
    }
}

thanks 
Shekhar
Dear All

I have VF page and custom controller. My requirement was to open the page (so that end user can preview the agreement) and then system also save the pdf as attachment on account agaist which it was open. . All goes good ,except the pdf is always currupt . and cannot be opened. Not sure what is missing. 

My Controller :
public with sharing class EAgreementPDFController 
{
    private final Account account;
    private String pdfName;

    public EAgreementPDFController()
    {   
        account = [SELECT Name,BillingStreet,BillingCity,BillingPostalCode,BillingCountry,E_Delivery_Contact_Signing_CP__c,E_Delivery_Pri_Invoice_Signing_CP__c,E_Delivery_Pri_Order_Confirma_Signing_CP__c,E_Delivery_Sec_Invoice_Signing_CP__c,E_Delivery_Sec_Order_Confirmation_CP__c FROM Account WHERE id =:ApexPages.currentPage().getParameters().get('id') LIMIT :(limits.getLimitQueryRows()-limits.getQueryRows())];
       
    }
    
	
    public void AttachAgreement()
    {
    	System.debug(LoggingLevel.FINEST,'Step1- Inside AttachAgreement');
    	 PageReference pdf = Page.EOrderConfirm_Invoice_GeneratedAgreement;
    	 Attachment attach = new Attachment();
    	 Blob body;
    	 try
    	 {
    	 	body = pdf.getContent();
    	 	//body = Blob.valueOf('Test 1233');
    	 }
    	 catch(VisualforceException e)
    	 {
    	 	body = Blob.valueOf('Error encountered while generating agreement. Contact Ecco customer care or your contact person for resolution.');
    	 }
    	 attach.Body = body;
	    // add the user entered name
	    attach.Name = 'Agreement for Edelivery of Invoices and Order Confirmation.pdf';
	    attach.IsPrivate = false;
	    // attach the pdf to the account
	    attach.ParentId = ApexPages.currentPage().getParameters().get('id');
	    insert attach;
    }
    
    public Account getAccount() 
    {
        return account;
    }
    
    public Contact getGeneral_Signature()
    {
    	System.debug(LoggingLevel.FINEST,'Step2- Inside getGeneral_Signature');
        return[Select FirstName,LastName,Title,Phone,Email from Contact where AccountId =:ApexPages.currentPage().getParameters().get('id') and E_ApprovalConfirmationFlag__c=true LIMIT :(limits.getLimitQueryRows()-limits.getQueryRows()) ];
    }
    
    public Contact getPri_Inv()
    {
        return[Select FirstName,LastName,Title,Phone,Email from Contact where AccountId =:ApexPages.currentPage().getParameters().get('id') and E_Invoice_Flag__c=true LIMIT :(limits.getLimitQueryRows()-limits.getQueryRows()) ];
    }
    
    public Contact getSec_Inv()
    {
        return[Select FirstName,LastName,Title,Phone,Email from Contact where AccountId =:ApexPages.currentPage().getParameters().get('id') and Secondary_E_Invoice_Email_Flag__c=true LIMIT :(limits.getLimitQueryRows()-limits.getQueryRows()) ];
    }
    
    public Contact getPri_OC()
    {
        return[Select FirstName,LastName,Title,Phone,Email from Contact where AccountId =:ApexPages.currentPage().getParameters().get('id') and E_Order_Confirmation_Flag__c=true LIMIT :(limits.getLimitQueryRows()-limits.getQueryRows()) ];
    }
    
    public Contact getSec_OC()
    {
        return[Select FirstName,LastName,Title,Phone,Email from Contact where AccountId =:ApexPages.currentPage().getParameters().get('id') and Secondary_E_Order_Confirmation_Email__c=true LIMIT :(limits.getLimitQueryRows()-limits.getQueryRows()) ];
    }
}

and my VF page is :
<apex:page controller="EAgreementPDFController" sidebar="False" renderAs="pdf" showHeader="false" id="AgreementPDF_page" cache="false" action="{!AttachAgreement}">
    <apex:includeScript value="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"/>
    <apex:includeScript value="https://code.jquery.com/ui/1.12.0-rc.2/jquery-ui.min.js"/>
    <apex:stylesheet value="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.15/themes/ui-lightness/jquery-ui.css" />
    
    
    <apex:form id="form1">
    	<html>
    		<head>
    			<title></title>
                <link rel="stylesheet" href="{!URLFOR($Resource.stylezip)}" />
                <style>
                	body
                	{
                		background:#f7f7f7;
                		height: 1000px;
                	}
                    .topbar1234 
                    {
                            background: #aabccf url('{!$Resource.TopBanner}') repeat-x;
                            height:42px;
                            width:100%;
                            padding-left:50px;
                            padding-top:10px;
                    }                   
                </style>
    		</head>
    		<body>
    		
    			
    			
    			<br/>
    			<br/>
    			<br/>
    				
					<h3>Subject : Agreement for Invoice and Order Confirmation Delivery by Email</h3>
				

    			<br/>
    			<br/>
    			<p>I ,  here by confirm that I on behalf of my employer mentioned below:</p>
    			<p>
    		
    						<apex:outputText value="{!account.Name}"/><br/>
    						<apex:outputText value="{!account.BillingStreet}"/><br/>
    						<apex:outputText value="{!account.BillingCity}"/><br/>
    						<apex:outputText value="{!account.BillingPostalCode}"/><br/>
    						<apex:outputText value="{!account.BillingCountry}"/><br/>
    				
    			</p>
				<p>to approve change in the way of Invoice and Order Confirmation delivery. I approve on behalf of my company that we would like to receive Invocie and Order confirmation by emails and pdf attachemnt, instead of printed copy delivered by postal service. </p>
				<p>For the same, I nominate following collegues are : </p>
				<ul type="circle">
					<li><b><apex:outputText value="{!Pri_Inv.FirstName} {!Pri_Inv.LastName}"/></b>&nbsp;(<apex:outputText value="{!Pri_Inv.Title}"/>)would be "Primary Invoice Receiver" and can be reach at &nbsp;<apex:outputText value="{!Pri_Inv.Email}"/>.<br/></li>
					<li><b><apex:outputText value="{!Sec_Inv.FirstName} {!Sec_Inv.LastName}"/></b>&nbsp;(<apex:outputText value="{!Sec_Inv.Title}"/>) would be "Secondary Invoice Receiver" and can be reach at  &nbsp;<apex:outputText value="{!Sec_Inv.Email}"/>.<br/></li>
					<li><b><apex:outputText value="{!Pri_OC.FirstName} {!Pri_OC.LastName}"/></b>&nbsp;(<apex:outputText value="{!Pri_OC.Title}"/>) would be "Primary Order Confirmation Receiver" and can be reach at  &nbsp;<apex:outputText value="{!Pri_OC.Email}"/>.<br/></li>
					<li><b><apex:outputText value="{!Sec_OC.FirstName} {!Sec_OC.LastName}"/></b>&nbsp;(<apex:outputText value="{!Sec_OC.Title}"/>) would be "Secondary Order Confirmation Receiver" and can be reach at  &nbsp;<apex:outputText value="{!Sec_OC.Email}"/>.<br/></li>
				</ul>
				
				Your Sincerely<br/>
				<b><apex:outputText value="{!General_Signature.FirstName} {!General_Signature.LastName}"/> </b>
				<b><apex:outputText value="{!General_Signature.Title}"/> </b>
				
			</body>  
    	</html>
    </apex:form>
</apex:page>

The whole flow is 

1. Landing page (which is not included above), has a checkbox. On checking the checkbox , from jquery i open the above VF page. In URL i have passed accountid (which works ok)
2. Then the above VF and Controller works

My requirement are 
1. PDF should open for preview --> which open as expected. 
2. PDF should be attached to account --> Which also happens , however when i try to open the attachd PDF , its say that the PDF is currupt. 

thus need you help to spot whats going wrong. 

thanks 
S
I have inbound soap based ws. I am now trying to test it via postman. 

However i am getting error 

This is the request message
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ecc="http://soap.sforce.com/schemas/class/EccoInterfaceEntryPoint">
   <soapenv:Header>
      <ecc:SessionHeader>
         <ecc:sessionId>iAO3qU9TwI5_ad4wZIa31cN3w9P9nUVULl1UlUE9cIEKKmdkBEkvWNyxJ5r.eyoRVa5r5qfGKq_aWkGfAmt</ecc:sessionId>
      </ecc:SessionHeader>
   </soapenv:Header>
   <soapenv:Body>
      <ecc:SentMessagetoSalesforce>
         <ecc:RequestMessage>
            <EccoMessage>
               <Header>
                  <ServiceId>Brand_CRUD</ServiceId>
                  <TypeCode>CreateBrand</TypeCode>
                  <SentDate>19/03/2018</SentDate>
                  <SourceSystem>SAP</SourceSystem>
                  <DestinationSystem>SFDC</DestinationSystem>
                  <RequestId>1234</RequestId>
                  <Object>Brand</Object>
                  <ObjectId>888</ObjectId>
                  <langId>ENG</langId>
               </Header>
               <Body>
                  <Payload>
                     <BrandName>ELG1</BrandName>
                     <BrandId>567</BrandId>
                     <ActiveFlg>Y</ActiveFlg>
                     <BrandOwnerEmail>shd@ecco.com</BrandOwnerEmail>
                  </Payload>
               </Body>
            </EccoMessage>
         </ecc:RequestMessage>
      </ecc:SentMessagetoSalesforce>
   </soapenv:Body>
</soapenv:Envelope>

This is the response:
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
    <soapenv:Body>
        <soapenv:Fault>
            <faultcode>soapenv:Client</faultcode>
            <faultstring>Unexpected element {}EccoMessage during simple type deserialization</faultstring>
        </soapenv:Fault>
    </soapenv:Body>
</soapenv:Envelope>


And this is the class :
/*
* @Author : Chandrashekhar Dautpure (CSD)
* @ Date  : 19-03-2018
* @ Functionality : This is main class for Interface framework
* @ version :
*     1. 19-03-2018 -- Initial Draft -- CSD 
*
*/
global class EccoInterfaceEntryPoint
{
	webservice static void SentMessagetoSalesforce(String RequestMessage)
	{
		XPath xp = new XPath(RequestMessage);
		
		Ecco_Interface_Log__c InterfaceMess = New Ecco_Interface_Log__c();
		InterfaceMess.Ecco_Service__c 	= 	GetServiceId(xp.getText ('/soapenv:Envelope/soapenv:Body/EccoMessage/Header/ServiceId'));
        InterfaceMess.ActionCode__c		=	xp.getText ('/soapenv:Envelope/soapenv:Body/EccoMessage/Header/TypeCode');
		InterfaceMess.Destination__c 	= 	xp.getText ('/soapenv:Envelope/soapenv:Body/EccoMessage/Header/DestinationSystem');
		InterfaceMess.ParentId__c       =   xp.getText ('/soapenv:Envelope/soapenv:Body/EccoMessage/Header/ObjectId');
        InterfaceMess.Source__c         = 	xp.getText ('/soapenv:Envelope/soapenv:Body/EccoMessage/Header/ObjectId');
        InterfaceMess.RequestId__c 		= 	xp.getText ('/soapenv:Envelope/soapenv:Body/EccoMessage/Header/RequestId');
        InterfaceMess.ProcessFlg__c 	= 	false;
        InterfaceMess.ParentType__c		= 	xp.getText ('/soapenv:Envelope/soapenv:Body/EccoMessage/Header/Object');
        InterfaceMess.LangID__c         =   xp.getText ('/soapenv:Envelope/soapenv:Body/EccoMessage/Header/langId');
        
		Dom.Document doc = new Dom.Document();
		doc.load(RequestMessage);
        Dom.XMLNode root = doc.getRootElement();
		for(Dom.XMLNode firstlevelchild : root.getChildren())
        {
            if(firstlevelchild.GetName()=='Body')
            {
                InterfaceMess.Payload__c = String.valueOf(firstlevelchild);
            }
        }
		insert InterfaceMess;
		 
	}
	
	private static String GetServiceId(String ServiceName)
	{
		return [Select Id from Ecco_Service__c where Name =: ServiceName].Id;
	}
}

I dont know what am i doing wrong in the request as class is now successfully saved (this mean no syntax errors). 

Thus any help to debug it would be helpfull
Please help me out I tried with forceguru but unable to get authentication and I tried to authenticate through force  connect but unable to do so please help me out through apex code to post in google drive whenever opportunity stage is closed won to send some fields to google drive please help me 

your suggestions are always welcome 
Hi
I have an general issue regarding the Dashboard , for opportunity  i am creating an funnel dashboard but the thing its showing in different format.
am sharing the image , User-added image

instead of 109M , I want the full amount in Rs.

Need help with SOQL query.  I am trying to run the query below and I am getting an error with the "Owner.Name" on my query.  I am trying to get the Owner Name instead of OwnerID on my extract.   Data Loader is giving the following error message, "Internal error.  Cannot parse field expression owner.name".  I am using Data Loader 23.0.  Please advice.  

 

SELECT Owner.Name, Case.Account.Parent.Name, Case.Account.Parent.Account_ID__c, Account.Name, Account_ID__c, Type, CC_Case_Reason__c, CreatedDate, ClosedDate, CreatedBy.Name, LastModifiedBy.Name, LastModifiedDate, Subject, Customer_Urgency__c, Customer_Feedback__c, Product_Group__c, Sub_Product_Group__c, CaseNumber  FROM Case  WHERE RecordTypeId = '012A0000000dFKZ' AND CreatedDate = LAST_N_DAYS:30

  • November 16, 2012
  • Like
  • 0